!(function (t, e) {
  'object' == typeof exports && 'undefined' != typeof module
    ? e(exports)
    : 'function' == typeof define && define.amd
    ? define(['exports'], e)
    : e(
        ((t =
          'undefined' != typeof globalThis
            ? globalThis
            : t || self).gridjs = {}),
      );
})(this, function (t) {
  'use strict';
  /*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */ var e = function (
    t,
    n,
  ) {
    return (e =
      Object.setPrototypeOf ||
      ({ __proto__: [] } instanceof Array &&
        function (t, e) {
          t.__proto__ = e;
        }) ||
      function (t, e) {
        for (var n in e)
          Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
      })(t, n);
  };
  function n(t, n) {
    if ('function' != typeof n && null !== n)
      throw new TypeError(
        'Class extends value ' + String(n) + ' is not a constructor or null',
      );
    function r() {
      this.constructor = t;
    }
    e(t, n),
      (t.prototype =
        null === n ? Object.create(n) : ((r.prototype = n.prototype), new r()));
  }
  var r = function () {
    return (r =
      Object.assign ||
      function (t) {
        for (var e, n = 1, r = arguments.length; n < r; n++)
          for (var o in (e = arguments[n]))
            Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
        return t;
      }).apply(this, arguments);
  };
  function o(t, e, n, r) {
    return new (n || (n = Promise))(function (o, i) {
      function s(t) {
        try {
          u(r.next(t));
        } catch (t) {
          i(t);
        }
      }
      function a(t) {
        try {
          u(r.throw(t));
        } catch (t) {
          i(t);
        }
      }
      function u(t) {
        var e;
        t.done
          ? o(t.value)
          : ((e = t.value),
            e instanceof n
              ? e
              : new n(function (t) {
                  t(e);
                })).then(s, a);
      }
      u((r = r.apply(t, e || [])).next());
    });
  }
  function i(t, e) {
    var n,
      r,
      o,
      i,
      s = {
        label: 0,
        sent: function () {
          if (1 & o[0]) throw o[1];
          return o[1];
        },
        trys: [],
        ops: [],
      };
    return (
      (i = { next: a(0), throw: a(1), return: a(2) }),
      'function' == typeof Symbol &&
        (i[Symbol.iterator] = function () {
          return this;
        }),
      i
    );
    function a(i) {
      return function (a) {
        return (function (i) {
          if (n) throw new TypeError('Generator is already executing.');
          for (; s; )
            try {
              if (
                ((n = 1),
                r &&
                  (o =
                    2 & i[0]
                      ? r.return
                      : i[0]
                      ? r.throw || ((o = r.return) && o.call(r), 0)
                      : r.next) &&
                  !(o = o.call(r, i[1])).done)
              )
                return o;
              switch (((r = 0), o && (i = [2 & i[0], o.value]), i[0])) {
                case 0:
                case 1:
                  o = i;
                  break;
                case 4:
                  return s.label++, { value: i[1], done: !1 };
                case 5:
                  s.label++, (r = i[1]), (i = [0]);
                  continue;
                case 7:
                  (i = s.ops.pop()), s.trys.pop();
                  continue;
                default:
                  if (
                    !((o = s.trys),
                    (o = o.length > 0 && o[o.length - 1]) ||
                      (6 !== i[0] && 2 !== i[0]))
                  ) {
                    s = 0;
                    continue;
                  }
                  if (3 === i[0] && (!o || (i[1] > o[0] && i[1] < o[3]))) {
                    s.label = i[1];
                    break;
                  }
                  if (6 === i[0] && s.label < o[1]) {
                    (s.label = o[1]), (o = i);
                    break;
                  }
                  if (o && s.label < o[2]) {
                    (s.label = o[2]), s.ops.push(i);
                    break;
                  }
                  o[2] && s.ops.pop(), s.trys.pop();
                  continue;
              }
              i = e.call(t, s);
            } catch (t) {
              (i = [6, t]), (r = 0);
            } finally {
              n = o = 0;
            }
          if (5 & i[0]) throw i[1];
          return { value: i[0] ? i[1] : void 0, done: !0 };
        })([i, a]);
      };
    }
  }
  function s() {
    for (var t = 0, e = 0, n = arguments.length; e < n; e++)
      t += arguments[e].length;
    var r = Array(t),
      o = 0;
    for (e = 0; e < n; e++)
      for (var i = arguments[e], s = 0, a = i.length; s < a; s++, o++)
        r[o] = i[s];
    return r;
  }
  var a,
    u,
    l,
    p,
    c,
    h,
    f = {},
    d = [],
    _ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
  function g(t, e) {
    for (var n in e) t[n] = e[n];
    return t;
  }
  function m(t) {
    var e = t.parentNode;
    e && e.removeChild(t);
  }
  function y(t, e, n) {
    var r,
      o,
      i,
      s = arguments,
      a = {};
    for (i in e)
      'key' == i ? (r = e[i]) : 'ref' == i ? (o = e[i]) : (a[i] = e[i]);
    if (arguments.length > 3)
      for (n = [n], i = 3; i < arguments.length; i++) n.push(s[i]);
    if (
      (null != n && (a.children = n),
      'function' == typeof t && null != t.defaultProps)
    )
      for (i in t.defaultProps) void 0 === a[i] && (a[i] = t.defaultProps[i]);
    return v(t, a, r, o, null);
  }
  function v(t, e, n, r, o) {
    var i = {
      type: t,
      props: e,
      key: n,
      ref: r,
      __k: null,
      __: null,
      __b: 0,
      __e: null,
      __d: void 0,
      __c: null,
      __h: null,
      constructor: void 0,
      __v: null == o ? ++a.__v : o,
    };
    return null != a.vnode && a.vnode(i), i;
  }
  function b() {
    return { current: null };
  }
  function w(t) {
    return t.children;
  }
  function P(t, e) {
    (this.props = t), (this.context = e);
  }
  function S(t, e) {
    if (null == e) return t.__ ? S(t.__, t.__.__k.indexOf(t) + 1) : null;
    for (var n; e < t.__k.length; e++)
      if (null != (n = t.__k[e]) && null != n.__e) return n.__e;
    return 'function' == typeof t.type ? S(t) : null;
  }
  function x(t) {
    var e, n;
    if (null != (t = t.__) && null != t.__c) {
      for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++)
        if (null != (n = t.__k[e]) && null != n.__e) {
          t.__e = t.__c.base = n.__e;
          break;
        }
      return x(t);
    }
  }
  function C(t) {
    ((!t.__d && (t.__d = !0) && l.push(t) && !k.__r++) ||
      c !== a.debounceRendering) &&
      ((c = a.debounceRendering) || p)(k);
  }
  function k() {
    for (var t; (k.__r = l.length); )
      (t = l.sort(function (t, e) {
        return t.__v.__b - e.__v.__b;
      })),
        (l = []),
        t.some(function (t) {
          var e, n, r, o, i, s;
          t.__d &&
            ((i = (o = (e = t).__v).__e),
            (s = e.__P) &&
              ((n = []),
              ((r = g({}, o)).__v = o.__v + 1),
              I(
                s,
                o,
                r,
                e.__n,
                void 0 !== s.ownerSVGElement,
                null != o.__h ? [i] : null,
                n,
                null == i ? S(o) : i,
                o.__h,
              ),
              j(n, o),
              o.__e != i && x(o)));
        });
  }
  function N(t, e, n, r, o, i, s, a, u, l) {
    var p,
      c,
      h,
      _,
      g,
      m,
      y,
      b = (r && r.__k) || d,
      P = b.length;
    for (n.__k = [], p = 0; p < e.length; p++)
      if (
        null !=
        (_ = n.__k[p] =
          null == (_ = e[p]) || 'boolean' == typeof _
            ? null
            : 'string' == typeof _ || 'number' == typeof _
            ? v(null, _, null, null, _)
            : Array.isArray(_)
            ? v(w, { children: _ }, null, null, null)
            : _.__b > 0
            ? v(_.type, _.props, _.key, null, _.__v)
            : _)
      ) {
        if (
          ((_.__ = n),
          (_.__b = n.__b + 1),
          null === (h = b[p]) || (h && _.key == h.key && _.type === h.type))
        )
          b[p] = void 0;
        else
          for (c = 0; c < P; c++) {
            if ((h = b[c]) && _.key == h.key && _.type === h.type) {
              b[c] = void 0;
              break;
            }
            h = null;
          }
        I(t, _, (h = h || f), o, i, s, a, u, l),
          (g = _.__e),
          (c = _.ref) &&
            h.ref != c &&
            (y || (y = []),
            h.ref && y.push(h.ref, null, _),
            y.push(c, _.__c || g, _)),
          null != g
            ? (null == m && (m = g),
              'function' == typeof _.type && null != _.__k && _.__k === h.__k
                ? (_.__d = u = T(_, u, t))
                : (u = O(t, _, h, b, g, u)),
              l || 'option' !== n.type
                ? 'function' == typeof n.type && (n.__d = u)
                : (t.value = ''))
            : u && h.__e == u && u.parentNode != t && (u = S(h));
      }
    for (n.__e = m, p = P; p--; )
      null != b[p] &&
        ('function' == typeof n.type &&
          null != b[p].__e &&
          b[p].__e == n.__d &&
          (n.__d = S(r, p + 1)),
        A(b[p], b[p]));
    if (y) for (p = 0; p < y.length; p++) U(y[p], y[++p], y[++p]);
  }
  function T(t, e, n) {
    var r, o;
    for (r = 0; r < t.__k.length; r++)
      (o = t.__k[r]) &&
        ((o.__ = t),
        (e =
          'function' == typeof o.type
            ? T(o, e, n)
            : O(n, o, o, t.__k, o.__e, e)));
    return e;
  }
  function O(t, e, n, r, o, i) {
    var s, a, u;
    if (void 0 !== e.__d) (s = e.__d), (e.__d = void 0);
    else if (null == n || o != i || null == o.parentNode)
      t: if (null == i || i.parentNode !== t) t.appendChild(o), (s = null);
      else {
        for (a = i, u = 0; (a = a.nextSibling) && u < r.length; u += 2)
          if (a == o) break t;
        t.insertBefore(o, i), (s = i);
      }
    return void 0 !== s ? s : o.nextSibling;
  }
  function D(t, e, n) {
    '-' === e[0]
      ? t.setProperty(e, n)
      : (t[e] =
          null == n ? '' : 'number' != typeof n || _.test(e) ? n : n + 'px');
  }
  function F(t, e, n, r, o) {
    var i;
    t: if ('style' === e)
      if ('string' == typeof n) t.style.cssText = n;
      else {
        if (('string' == typeof r && (t.style.cssText = r = ''), r))
          for (e in r) (n && e in n) || D(t.style, e, '');
        if (n) for (e in n) (r && n[e] === r[e]) || D(t.style, e, n[e]);
      }
    else if ('o' === e[0] && 'n' === e[1])
      (i = e !== (e = e.replace(/Capture$/, ''))),
        (e = e.toLowerCase() in t ? e.toLowerCase().slice(2) : e.slice(2)),
        t.l || (t.l = {}),
        (t.l[e + i] = n),
        n
          ? r || t.addEventListener(e, i ? R : E, i)
          : t.removeEventListener(e, i ? R : E, i);
    else if ('dangerouslySetInnerHTML' !== e) {
      if (o) e = e.replace(/xlink[H:h]/, 'h').replace(/sName$/, 's');
      else if (
        'href' !== e &&
        'list' !== e &&
        'form' !== e &&
        'download' !== e &&
        e in t
      )
        try {
          t[e] = null == n ? '' : n;
          break t;
        } catch (t) {}
      'function' == typeof n ||
        (null != n && (!1 !== n || ('a' === e[0] && 'r' === e[1]))
          ? t.setAttribute(e, n)
          : t.removeAttribute(e));
    }
  }
  function E(t) {
    this.l[t.type + !1](a.event ? a.event(t) : t);
  }
  function R(t) {
    this.l[t.type + !0](a.event ? a.event(t) : t);
  }
  function I(t, e, n, r, o, i, s, u, l) {
    var p,
      c,
      h,
      f,
      d,
      _,
      m,
      y,
      v,
      b,
      S,
      x = e.type;
    if (void 0 !== e.constructor) return null;
    null != n.__h &&
      ((l = n.__h), (u = e.__e = n.__e), (e.__h = null), (i = [u])),
      (p = a.__b) && p(e);
    try {
      t: if ('function' == typeof x) {
        if (
          ((y = e.props),
          (v = (p = x.contextType) && r[p.__c]),
          (b = p ? (v ? v.props.value : p.__) : r),
          n.__c
            ? (m = (c = e.__c = n.__c).__ = c.__E)
            : ('prototype' in x && x.prototype.render
                ? (e.__c = c = new x(y, b))
                : ((e.__c = c = new P(y, b)),
                  (c.constructor = x),
                  (c.render = H)),
              v && v.sub(c),
              (c.props = y),
              c.state || (c.state = {}),
              (c.context = b),
              (c.__n = r),
              (h = c.__d = !0),
              (c.__h = [])),
          null == c.__s && (c.__s = c.state),
          null != x.getDerivedStateFromProps &&
            (c.__s == c.state && (c.__s = g({}, c.__s)),
            g(c.__s, x.getDerivedStateFromProps(y, c.__s))),
          (f = c.props),
          (d = c.state),
          h)
        )
          null == x.getDerivedStateFromProps &&
            null != c.componentWillMount &&
            c.componentWillMount(),
            null != c.componentDidMount && c.__h.push(c.componentDidMount);
        else {
          if (
            (null == x.getDerivedStateFromProps &&
              y !== f &&
              null != c.componentWillReceiveProps &&
              c.componentWillReceiveProps(y, b),
            (!c.__e &&
              null != c.shouldComponentUpdate &&
              !1 === c.shouldComponentUpdate(y, c.__s, b)) ||
              e.__v === n.__v)
          ) {
            (c.props = y),
              (c.state = c.__s),
              e.__v !== n.__v && (c.__d = !1),
              (c.__v = e),
              (e.__e = n.__e),
              (e.__k = n.__k),
              c.__h.length && s.push(c);
            break t;
          }
          null != c.componentWillUpdate && c.componentWillUpdate(y, c.__s, b),
            null != c.componentDidUpdate &&
              c.__h.push(function () {
                c.componentDidUpdate(f, d, _);
              });
        }
        (c.context = b),
          (c.props = y),
          (c.state = c.__s),
          (p = a.__r) && p(e),
          (c.__d = !1),
          (c.__v = e),
          (c.__P = t),
          (p = c.render(c.props, c.state, c.context)),
          (c.state = c.__s),
          null != c.getChildContext && (r = g(g({}, r), c.getChildContext())),
          h ||
            null == c.getSnapshotBeforeUpdate ||
            (_ = c.getSnapshotBeforeUpdate(f, d)),
          (S =
            null != p && p.type === w && null == p.key ? p.props.children : p),
          N(t, Array.isArray(S) ? S : [S], e, n, r, o, i, s, u, l),
          (c.base = e.__e),
          (e.__h = null),
          c.__h.length && s.push(c),
          m && (c.__E = c.__ = null),
          (c.__e = !1);
      } else null == i && e.__v === n.__v ? ((e.__k = n.__k), (e.__e = n.__e)) : (e.__e = L(n.__e, e, n, r, o, i, s, l));
      (p = a.diffed) && p(e);
    } catch (t) {
      (e.__v = null),
        (l || null != i) &&
          ((e.__e = u), (e.__h = !!l), (i[i.indexOf(u)] = null)),
        a.__e(t, e, n);
    }
  }
  function j(t, e) {
    a.__c && a.__c(e, t),
      t.some(function (e) {
        try {
          (t = e.__h),
            (e.__h = []),
            t.some(function (t) {
              t.call(e);
            });
        } catch (t) {
          a.__e(t, e.__v);
        }
      });
  }
  function L(t, e, n, r, o, i, s, a) {
    var u,
      l,
      p,
      c,
      h = n.props,
      _ = e.props,
      g = e.type,
      y = 0;
    if (('svg' === g && (o = !0), null != i))
      for (; y < i.length; y++)
        if (
          (u = i[y]) &&
          (u === t || (g ? u.localName == g : 3 == u.nodeType))
        ) {
          (t = u), (i[y] = null);
          break;
        }
    if (null == t) {
      if (null === g) return document.createTextNode(_);
      (t = o
        ? document.createElementNS('http://www.w3.org/2000/svg', g)
        : document.createElement(g, _.is && _)),
        (i = null),
        (a = !1);
    }
    if (null === g) h === _ || (a && t.data === _) || (t.data = _);
    else {
      if (
        ((i = i && d.slice.call(t.childNodes)),
        (l = (h = n.props || f).dangerouslySetInnerHTML),
        (p = _.dangerouslySetInnerHTML),
        !a)
      ) {
        if (null != i)
          for (h = {}, c = 0; c < t.attributes.length; c++)
            h[t.attributes[c].name] = t.attributes[c].value;
        (p || l) &&
          ((p && ((l && p.__html == l.__html) || p.__html === t.innerHTML)) ||
            (t.innerHTML = (p && p.__html) || ''));
      }
      if (
        ((function (t, e, n, r, o) {
          var i;
          for (i in n)
            'children' === i || 'key' === i || i in e || F(t, i, null, n[i], r);
          for (i in e)
            (o && 'function' != typeof e[i]) ||
              'children' === i ||
              'key' === i ||
              'value' === i ||
              'checked' === i ||
              n[i] === e[i] ||
              F(t, i, e[i], n[i], r);
        })(t, _, h, o, a),
        p)
      )
        e.__k = [];
      else if (
        ((y = e.props.children),
        N(
          t,
          Array.isArray(y) ? y : [y],
          e,
          n,
          r,
          o && 'foreignObject' !== g,
          i,
          s,
          t.firstChild,
          a,
        ),
        null != i)
      )
        for (y = i.length; y--; ) null != i[y] && m(i[y]);
      a ||
        ('value' in _ &&
          void 0 !== (y = _.value) &&
          (y !== t.value || ('progress' === g && !y)) &&
          F(t, 'value', y, h.value, !1),
        'checked' in _ &&
          void 0 !== (y = _.checked) &&
          y !== t.checked &&
          F(t, 'checked', y, h.checked, !1));
    }
    return t;
  }
  function U(t, e, n) {
    try {
      'function' == typeof t ? t(e) : (t.current = e);
    } catch (t) {
      a.__e(t, n);
    }
  }
  function A(t, e, n) {
    var r, o, i;
    if (
      (a.unmount && a.unmount(t),
      (r = t.ref) && ((r.current && r.current !== t.__e) || U(r, null, e)),
      n || 'function' == typeof t.type || (n = null != (o = t.__e)),
      (t.__e = t.__d = void 0),
      null != (r = t.__c))
    ) {
      if (r.componentWillUnmount)
        try {
          r.componentWillUnmount();
        } catch (t) {
          a.__e(t, e);
        }
      r.base = r.__P = null;
    }
    if ((r = t.__k)) for (i = 0; i < r.length; i++) r[i] && A(r[i], e, n);
    null != o && m(o);
  }
  function H(t, e, n) {
    return this.constructor(t, n);
  }
  function M(t, e, n) {
    var r, o, i;
    a.__ && a.__(t, e),
      (o = (r = 'function' == typeof n) ? null : (n && n.__k) || e.__k),
      (i = []),
      I(
        e,
        (t = ((!r && n) || e).__k = y(w, null, [t])),
        o || f,
        f,
        void 0 !== e.ownerSVGElement,
        !r && n
          ? [n]
          : o
          ? null
          : e.firstChild
          ? d.slice.call(e.childNodes)
          : null,
        i,
        !r && n ? n : o ? o.__e : e.firstChild,
        r,
      ),
      j(i, t);
  }
  function B() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
      /[xy]/g,
      function (t) {
        var e = (16 * Math.random()) | 0;
        return ('x' == t ? e : (3 & e) | 8).toString(16);
      },
    );
  }
  (a = {
    __e: function (t, e) {
      for (var n, r, o; (e = e.__); )
        if ((n = e.__c) && !n.__)
          try {
            if (
              ((r = n.constructor) &&
                null != r.getDerivedStateFromError &&
                (n.setState(r.getDerivedStateFromError(t)), (o = n.__d)),
              null != n.componentDidCatch &&
                (n.componentDidCatch(t), (o = n.__d)),
              o)
            )
              return (n.__E = n);
          } catch (e) {
            t = e;
          }
      throw t;
    },
    __v: 0,
  }),
    (u = function (t) {
      return null != t && void 0 === t.constructor;
    }),
    (P.prototype.setState = function (t, e) {
      var n;
      (n =
        null != this.__s && this.__s !== this.state
          ? this.__s
          : (this.__s = g({}, this.state))),
        'function' == typeof t && (t = t(g({}, n), this.props)),
        t && g(n, t),
        null != t && this.__v && (e && this.__h.push(e), C(this));
    }),
    (P.prototype.forceUpdate = function (t) {
      this.__v && ((this.__e = !0), t && this.__h.push(t), C(this));
    }),
    (P.prototype.render = w),
    (l = []),
    (p =
      'function' == typeof Promise
        ? Promise.prototype.then.bind(Promise.resolve())
        : setTimeout),
    (k.__r = 0),
    (h = 0);
  var W = (function () {
    function t(t) {
      this._id = t || B();
    }
    return (
      Object.defineProperty(t.prototype, 'id', {
        get: function () {
          return this._id;
        },
        enumerable: !1,
        configurable: !0,
      }),
      t
    );
  })();
  var q = {
      search: { placeholder: 'Type a keyword...' },
      sort: {
        sortAsc: 'Sort column ascending',
        sortDesc: 'Sort column descending',
      },
      pagination: {
        previous: 'Previous',
        next: 'Next',
        navigate: function (t, e) {
          return 'Page ' + t + ' of ' + e;
        },
        page: function (t) {
          return 'Page ' + t;
        },
        showing: 'Showing',
        of: 'of',
        to: 'to',
        results: 'results',
      },
      loading: 'Loading...',
      noRecordsFound: 'No matching records found',
      error: 'An error happened while fetching the data',
    },
    G = (function () {
      function t(t) {
        (this._language = t), (this._defaultLanguage = q);
      }
      return (
        (t.prototype.getString = function (t, e) {
          if (!e || !t) return null;
          var n = t.split('.'),
            r = n[0];
          if (e[r]) {
            var o = e[r];
            return 'string' == typeof o
              ? function () {
                  return o;
                }
              : 'function' == typeof o
              ? o
              : this.getString(n.slice(1).join('.'), o);
          }
          return null;
        }),
        (t.prototype.translate = function (t) {
          for (var e = [], n = 1; n < arguments.length; n++)
            e[n - 1] = arguments[n];
          var r,
            o = this.getString(t, this._language);
          return (r = o || this.getString(t, this._defaultLanguage))
            ? r.apply(void 0, e)
            : t;
        }),
        t
      );
    })();
  var $ = (function (t) {
      function e(e, n) {
        var r,
          o = t.call(this, e, n) || this;
        return (
          (o.config = (function (t) {
            if (!t) return null;
            var e = Object.keys(t);
            return e.length ? t[e[0]].props.value : null;
          })(n)),
          o.config &&
            (o._ =
              ((r = o.config.translator),
              function (t) {
                for (var e = [], n = 1; n < arguments.length; n++)
                  e[n - 1] = arguments[n];
                return r.translate.apply(r, s([t], e));
              })),
          o
        );
      }
      return n(e, t), e;
    })(P),
    K = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.render = function () {
          return y(this.props.parentElement, {
            dangerouslySetInnerHTML: { __html: this.props.content },
          });
        }),
        (e.defaultProps = { parentElement: 'span' }),
        e
      );
    })($);
  function z(t, e) {
    return y(K, { content: t, parentElement: e });
  }
  var V = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return n.update(e), n;
      }
      return (
        n(e, t),
        (e.prototype.cast = function (t) {
          return t instanceof HTMLElement ? z(t.outerHTML) : t;
        }),
        (e.prototype.update = function (t) {
          return (this.data = this.cast(t)), this;
        }),
        e
      );
    })(W),
    Y = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return (n.cells = e || []), n;
      }
      return (
        n(e, t),
        (e.prototype.cell = function (t) {
          return this._cells[t];
        }),
        Object.defineProperty(e.prototype, 'cells', {
          get: function () {
            return this._cells;
          },
          set: function (t) {
            this._cells = t;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype.toArray = function () {
          return this.cells.map(function (t) {
            return t.data;
          });
        }),
        (e.fromCells = function (t) {
          return new e(
            t.map(function (t) {
              return new V(t.data);
            }),
          );
        }),
        Object.defineProperty(e.prototype, 'length', {
          get: function () {
            return this.cells.length;
          },
          enumerable: !1,
          configurable: !0,
        }),
        e
      );
    })(W);
  var X = (function (t) {
    function e(e) {
      var n = t.call(this) || this;
      return (n.rows = e instanceof Array ? e : e instanceof Y ? [e] : []), n;
    }
    return (
      n(e, t),
      Object.defineProperty(e.prototype, 'rows', {
        get: function () {
          return this._rows;
        },
        set: function (t) {
          this._rows = t;
        },
        enumerable: !1,
        configurable: !0,
      }),
      Object.defineProperty(e.prototype, 'length', {
        get: function () {
          return this._length || this.rows.length;
        },
        set: function (t) {
          this._length = t;
        },
        enumerable: !1,
        configurable: !0,
      }),
      (e.prototype.toArray = function () {
        return this.rows.map(function (t) {
          return t.toArray();
        });
      }),
      (e.fromRows = function (t) {
        return new e(
          t.map(function (t) {
            return Y.fromCells(t.cells);
          }),
        );
      }),
      (e.fromArray = function (t) {
        return new e(
          (t = (function (t) {
            return !t[0] || t[0] instanceof Array ? t : [t];
          })(t)).map(function (t) {
            return new Y(
              t.map(function (t) {
                return new V(t);
              }),
            );
          }),
        );
      }),
      e
    );
  })(W);
  var Z,
    J = (function () {
      function t() {}
      return (
        (t.prototype.init = function (t) {
          this.callbacks || (this.callbacks = {}),
            t && !this.callbacks[t] && (this.callbacks[t] = []);
        }),
        (t.prototype.on = function (t, e) {
          return this.init(t), this.callbacks[t].push(e), this;
        }),
        (t.prototype.off = function (t, e) {
          var n = t;
          return (
            this.init(),
            this.callbacks[n] && 0 !== this.callbacks[n].length
              ? ((this.callbacks[n] = this.callbacks[n].filter(function (t) {
                  return t != e;
                })),
                this)
              : this
          );
        }),
        (t.prototype.emit = function (t) {
          for (var e = [], n = 1; n < arguments.length; n++)
            e[n - 1] = arguments[n];
          var r = t;
          return (
            this.init(r),
            this.callbacks[r].length > 0 &&
              (this.callbacks[r].forEach(function (t) {
                return t.apply(void 0, e);
              }),
              !0)
          );
        }),
        t
      );
    })();
  !(function (t) {
    (t[(t.Initiator = 0)] = 'Initiator'),
      (t[(t.ServerFilter = 1)] = 'ServerFilter'),
      (t[(t.ServerSort = 2)] = 'ServerSort'),
      (t[(t.ServerLimit = 3)] = 'ServerLimit'),
      (t[(t.Extractor = 4)] = 'Extractor'),
      (t[(t.Transformer = 5)] = 'Transformer'),
      (t[(t.Filter = 6)] = 'Filter'),
      (t[(t.Sort = 7)] = 'Sort'),
      (t[(t.Limit = 8)] = 'Limit');
  })(Z || (Z = {}));
  var Q = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return (n._props = {}), (n.id = B()), e && n.setProps(e), n;
      }
      return (
        n(e, t),
        (e.prototype.process = function () {
          for (var t = [], e = 0; e < arguments.length; e++)
            t[e] = arguments[e];
          this.validateProps instanceof Function &&
            this.validateProps.apply(this, t),
            this.emit.apply(this, s(['beforeProcess'], t));
          var n = this._process.apply(this, t);
          return this.emit.apply(this, s(['afterProcess'], t)), n;
        }),
        (e.prototype.setProps = function (t) {
          return (
            Object.assign(this._props, t), this.emit('propsUpdated', this), this
          );
        }),
        Object.defineProperty(e.prototype, 'props', {
          get: function () {
            return this._props;
          },
          enumerable: !1,
          configurable: !0,
        }),
        e
      );
    })(J),
    tt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.Filter;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function (t) {
          return this.props.keyword
            ? ((e = String(this.props.keyword).trim()),
              (n = t),
              (r = this.props.selector),
              (e = e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')),
              new X(
                n.rows.filter(function (t, n) {
                  return t.cells.some(function (t, o) {
                    if (!t) return !1;
                    var i = '';
                    if ('function' == typeof r) i = r(t.data, n, o);
                    else if ('object' == typeof t.data) {
                      var s = t.data;
                      s && s.props && s.props.content && (i = s.props.content);
                    } else i = String(t.data);
                    return new RegExp(e, 'gi').test(i);
                  });
                }),
              ))
            : t;
          var e, n, r;
        }),
        e
      );
    })(Q);
  function et() {
    for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
    var n = 'gridjs';
    return (
      '' +
      n +
      t.reduce(function (t, e) {
        return t + '-' + e;
      }, '')
    );
  }
  function nt() {
    for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
    return (
      t
        .filter(function (t) {
          return t;
        })
        .reduce(function (t, e) {
          return (t || '') + ' ' + e;
        }, '')
        .trim() || null
    );
  }
  var rt,
    ot = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return (
          (n.dispatcher = e),
          (n._state = n.getInitialState()),
          e.register(n._handle.bind(n)),
          n
        );
      }
      return (
        n(e, t),
        (e.prototype._handle = function (t) {
          this.handle(t.type, t.payload);
        }),
        (e.prototype.setState = function (t) {
          var e = this._state;
          (this._state = t), this.emit('updated', t, e);
        }),
        Object.defineProperty(e.prototype, 'state', {
          get: function () {
            return this._state;
          },
          enumerable: !1,
          configurable: !0,
        }),
        e
      );
    })(J),
    it = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.getInitialState = function () {
          return { keyword: null };
        }),
        (e.prototype.handle = function (t, e) {
          if ('SEARCH_KEYWORD' === t) {
            var n = e.keyword;
            this.search(n);
          }
        }),
        (e.prototype.search = function (t) {
          this.setState({ keyword: t });
        }),
        e
      );
    })(ot),
    st = (function () {
      function t(t) {
        this.dispatcher = t;
      }
      return (
        (t.prototype.dispatch = function (t, e) {
          this.dispatcher.dispatch({ type: t, payload: e });
        }),
        t
      );
    })(),
    at = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.search = function (t) {
          this.dispatch('SEARCH_KEYWORD', { keyword: t });
        }),
        e
      );
    })(st),
    ut = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.ServerFilter;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function (t) {
          if (!this.props.keyword) return t;
          var e = {};
          return (
            this.props.url &&
              (e.url = this.props.url(t.url, this.props.keyword)),
            this.props.body &&
              (e.body = this.props.body(t.body, this.props.keyword)),
            r(r({}, t), e)
          );
        }),
        e
      );
    })(Q),
    lt = new ((function () {
      function t() {}
      return (
        (t.prototype.format = function (t, e) {
          return '[Grid.js] [' + e.toUpperCase() + ']: ' + t;
        }),
        (t.prototype.error = function (t, e) {
          void 0 === e && (e = !1);
          var n = this.format(t, 'error');
          if (e) throw Error(n);
          console.error(n);
        }),
        (t.prototype.warn = function (t) {
          console.warn(this.format(t, 'warn'));
        }),
        (t.prototype.info = function (t) {
          console.info(this.format(t, 'info'));
        }),
        t
      );
    })())(),
    pt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return n(e, t), e;
    })($);
  (t.PluginPosition = void 0),
    ((rt = t.PluginPosition || (t.PluginPosition = {}))[(rt.Header = 0)] =
      'Header'),
    (rt[(rt.Footer = 1)] = 'Footer'),
    (rt[(rt.Cell = 2)] = 'Cell');
  var ct = (function () {
      function t() {
        this.plugins = [];
      }
      return (
        (t.prototype.get = function (t) {
          var e = this.plugins.filter(function (e) {
            return e.id === t;
          });
          return e.length > 0 ? e[0] : null;
        }),
        (t.prototype.add = function (t) {
          return t.id
            ? null !== this.get(t.id)
              ? (lt.error('Duplicate plugin ID: ' + t.id), this)
              : (this.plugins.push(t), this)
            : (lt.error('Plugin ID cannot be empty'), this);
        }),
        (t.prototype.remove = function (t) {
          return (
            this.plugins.splice(this.plugins.indexOf(this.get(t)), 1), this
          );
        }),
        (t.prototype.list = function (t) {
          return (null != t || null != t
            ? this.plugins.filter(function (e) {
                return e.position === t;
              })
            : this.plugins
          ).sort(function (t, e) {
            return t.order - e.order;
          });
        }),
        t
      );
    })(),
    ht = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.render = function () {
          var t = this;
          if (this.props.pluginId) {
            var e = this.config.plugin.get(this.props.pluginId);
            return e
              ? y(
                  w,
                  {},
                  y(
                    e.component,
                    r(r({ plugin: e }, e.props), this.props.props),
                  ),
                )
              : null;
          }
          return void 0 !== this.props.position
            ? y(
                w,
                {},
                this.config.plugin.list(this.props.position).map(function (e) {
                  return y(
                    e.component,
                    r(r({ plugin: e }, e.props), t.props.props),
                  );
                }),
              )
            : null;
        }),
        e
      );
    })($),
    ft = (function (t) {
      function e(e, n) {
        var r = t.call(this, e, n) || this;
        (r.actions = new at(r.config.dispatcher)),
          (r.store = new it(r.config.dispatcher));
        var o = e.enabled,
          i = e.keyword;
        if (o) {
          i && r.actions.search(i),
            (r.storeUpdatedFn = r.storeUpdated.bind(r)),
            r.store.on('updated', r.storeUpdatedFn);
          var s = void 0;
          (s = e.server
            ? new ut({
                keyword: e.keyword,
                url: e.server.url,
                body: e.server.body,
              })
            : new tt({ keyword: e.keyword, selector: e.selector })),
            (r.searchProcessor = s),
            r.config.pipeline.register(s);
        }
        return r;
      }
      return (
        n(e, t),
        (e.prototype.componentWillUnmount = function () {
          this.config.pipeline.unregister(this.searchProcessor),
            this.store.off('updated', this.storeUpdatedFn);
        }),
        (e.prototype.storeUpdated = function (t) {
          this.searchProcessor.setProps({ keyword: t.keyword });
        }),
        (e.prototype.onChange = function (t) {
          var e = t.target.value;
          this.actions.search(e);
        }),
        (e.prototype.render = function () {
          if (!this.props.enabled) return null;
          var t,
            e,
            n,
            r = this.onChange.bind(this);
          return (
            this.searchProcessor instanceof ut &&
              ((t = r),
              (e = this.props.debounceTimeout),
              (r = function () {
                for (var r = [], o = 0; o < arguments.length; o++)
                  r[o] = arguments[o];
                return new Promise(function (o) {
                  n && clearTimeout(n),
                    (n = setTimeout(function () {
                      return o(t.apply(void 0, r));
                    }, e));
                });
              })),
            y(
              'div',
              { className: et(nt('search', this.config.className.search)) },
              y('input', {
                type: 'search',
                placeholder: this._('search.placeholder'),
                'aria-label': this._('search.placeholder'),
                onInput: r,
                className: nt(et('input'), et('search', 'input')),
                value: this.store.state.keyword,
              }),
            )
          );
        }),
        (e.defaultProps = { debounceTimeout: 250 }),
        e
      );
    })(pt),
    dt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.validateProps = function () {
          if (isNaN(Number(this.props.limit)) || isNaN(Number(this.props.page)))
            throw Error('Invalid parameters passed');
        }),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.Limit;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function (t) {
          var e = this.props.page,
            n = e * this.props.limit,
            r = (e + 1) * this.props.limit;
          return new X(t.rows.slice(n, r));
        }),
        e
      );
    })(Q),
    _t = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.ServerLimit;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function (t) {
          var e = {};
          return (
            this.props.url &&
              (e.url = this.props.url(
                t.url,
                this.props.page,
                this.props.limit,
              )),
            this.props.body &&
              (e.body = this.props.body(
                t.body,
                this.props.page,
                this.props.limit,
              )),
            r(r({}, t), e)
          );
        }),
        e
      );
    })(Q),
    gt = (function (t) {
      function e(e, n) {
        var r = t.call(this, e, n) || this;
        return (r.state = { limit: e.limit, page: e.page || 0, total: 0 }), r;
      }
      return (
        n(e, t),
        (e.prototype.componentWillMount = function () {
          var t = this;
          if (this.props.enabled) {
            var e = void 0;
            (this.setTotalFromTabularFn = this.setTotalFromTabular.bind(this)),
              this.props.server
                ? ((e = new _t({
                    limit: this.state.limit,
                    page: this.state.page,
                    url: this.props.server.url,
                    body: this.props.server.body,
                  })),
                  this.config.pipeline.on(
                    'afterProcess',
                    this.setTotalFromTabularFn,
                  ))
                : (e = new dt({
                    limit: this.state.limit,
                    page: this.state.page,
                  })).on('beforeProcess', this.setTotalFromTabularFn),
              (this.processor = e),
              this.config.pipeline.register(e),
              this.config.pipeline.on('error', function () {
                t.setState({ total: 0, page: 0 });
              });
          }
        }),
        (e.prototype.setTotalFromTabular = function (t) {
          this.setTotal(t.length);
        }),
        (e.prototype.onUpdate = function (t) {
          this.props.resetPageOnUpdate &&
            t !== this.processor &&
            this.setPage(0);
        }),
        (e.prototype.componentDidMount = function () {
          (this.onUpdateFn = this.onUpdate.bind(this)),
            this.config.pipeline.on('updated', this.onUpdateFn);
        }),
        (e.prototype.componentWillUnmount = function () {
          this.config.pipeline.unregister(this.processor),
            this.config.pipeline.off('updated', this.onUpdateFn);
        }),
        Object.defineProperty(e.prototype, 'pages', {
          get: function () {
            return Math.ceil(this.state.total / this.state.limit);
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype.setPage = function (t) {
          if (t >= this.pages || t < 0 || t === this.state.page) return null;
          this.setState({ page: t }), this.processor.setProps({ page: t });
        }),
        (e.prototype.setTotal = function (t) {
          this.setState({ total: t });
        }),
        (e.prototype.renderPages = function () {
          var t = this;
          if (this.props.buttonsCount <= 0) return null;
          var e = Math.min(this.pages, this.props.buttonsCount),
            n = Math.min(this.state.page, Math.floor(e / 2));
          return (
            this.state.page + Math.floor(e / 2) >= this.pages &&
              (n = e - (this.pages - this.state.page)),
            y(
              w,
              null,
              this.pages > e &&
                this.state.page - n > 0 &&
                y(
                  w,
                  null,
                  y(
                    'button',
                    {
                      tabIndex: 0,
                      role: 'button',
                      onClick: this.setPage.bind(this, 0),
                      title: this._('pagination.firstPage'),
                      'aria-label': this._('pagination.firstPage'),
                      className: this.config.className.paginationButton,
                    },
                    this._('1'),
                  ),
                  y(
                    'button',
                    {
                      tabIndex: -1,
                      className: nt(
                        et('spread'),
                        this.config.className.paginationButton,
                      ),
                    },
                    '...',
                  ),
                ),
              Array.from(Array(e).keys())
                .map(function (e) {
                  return t.state.page + (e - n);
                })
                .map(function (e) {
                  return y(
                    'button',
                    {
                      tabIndex: 0,
                      role: 'button',
                      onClick: t.setPage.bind(t, e),
                      className: nt(
                        t.state.page === e
                          ? nt(
                              et('currentPage'),
                              t.config.className.paginationButtonCurrent,
                            )
                          : null,
                        t.config.className.paginationButton,
                      ),
                      title: t._('pagination.page', e + 1),
                      'aria-label': t._('pagination.page', e + 1),
                    },
                    t._('' + (e + 1)),
                  );
                }),
              this.pages > e &&
                this.pages > this.state.page + n + 1 &&
                y(
                  w,
                  null,
                  y(
                    'button',
                    {
                      tabIndex: -1,
                      className: nt(
                        et('spread'),
                        this.config.className.paginationButton,
                      ),
                    },
                    '...',
                  ),
                  y(
                    'button',
                    {
                      tabIndex: 0,
                      role: 'button',
                      onClick: this.setPage.bind(this, this.pages - 1),
                      title: this._('pagination.page', this.pages),
                      'aria-label': this._('pagination.page', this.pages),
                      className: this.config.className.paginationButton,
                    },
                    this._('' + this.pages),
                  ),
                ),
            )
          );
        }),
        (e.prototype.renderSummary = function () {
          return y(
            w,
            null,
            this.props.summary &&
              this.state.total > 0 &&
              y(
                'div',
                {
                  role: 'status',
                  'aria-live': 'polite',
                  className: nt(
                    et('summary'),
                    this.config.className.paginationSummary,
                  ),
                  title: this._(
                    'pagination.navigate',
                    this.state.page + 1,
                    this.pages,
                  ),
                },
                this._('pagination.showing'),
                ' ',
                y(
                  'b',
                  null,
                  this._('' + (this.state.page * this.state.limit + 1)),
                ),
                ' ',
                this._('pagination.to'),
                ' ',
                y(
                  'b',
                  null,
                  this._(
                    '' +
                      Math.min(
                        (this.state.page + 1) * this.state.limit,
                        this.state.total,
                      ),
                  ),
                ),
                ' ',
                this._('pagination.of'),
                ' ',
                y('b', null, this._('' + this.state.total)),
                ' ',
                this._('pagination.results'),
              ),
          );
        }),
        (e.prototype.render = function () {
          return this.props.enabled
            ? y(
                'div',
                {
                  className: nt(
                    et('pagination'),
                    this.config.className.pagination,
                  ),
                },
                this.renderSummary(),
                y(
                  'div',
                  { className: et('pages') },
                  this.props.prevButton &&
                    y(
                      'button',
                      {
                        tabIndex: 0,
                        role: 'button',
                        disabled: 0 === this.state.page,
                        onClick: this.setPage.bind(this, this.state.page - 1),
                        title: this._('pagination.previous'),
                        'aria-label': this._('pagination.previous'),
                        className: nt(
                          this.config.className.paginationButton,
                          this.config.className.paginationButtonPrev,
                        ),
                      },
                      this._('pagination.previous'),
                    ),
                  this.renderPages(),
                  this.props.nextButton &&
                    y(
                      'button',
                      {
                        tabIndex: 0,
                        role: 'button',
                        disabled:
                          this.pages === this.state.page + 1 ||
                          0 === this.pages,
                        onClick: this.setPage.bind(this, this.state.page + 1),
                        title: this._('pagination.next'),
                        'aria-label': this._('pagination.next'),
                        className: nt(
                          this.config.className.paginationButton,
                          this.config.className.paginationButtonNext,
                        ),
                      },
                      this._('pagination.next'),
                    ),
                ),
              )
            : null;
        }),
        (e.defaultProps = {
          summary: !0,
          nextButton: !0,
          prevButton: !0,
          buttonsCount: 3,
          limit: 10,
          resetPageOnUpdate: !0,
        }),
        e
      );
    })(pt);
  function mt(t, e) {
    return 'string' == typeof t
      ? t.indexOf('%') > -1
        ? (e / 100) * parseInt(t, 10)
        : parseInt(t, 10)
      : t;
  }
  function yt(t) {
    return t ? Math.floor(t) + 'px' : '';
  }
  function vt(t, e) {
    if (!t) return null;
    var n = t.querySelector('thead th[data-column-id="' + e + '"]');
    return n ? n.clientWidth : null;
  }
  var bt = (function (t) {
    function e() {
      return (null !== t && t.apply(this, arguments)) || this;
    }
    return (
      n(e, t),
      (e.prototype.render = function () {
        if (this.props.tableRef.current) {
          var t = this.props.tableRef.current.base.cloneNode(!0);
          return (
            (t.className += ' ' + et('shadowTable')),
            (t.style.position = 'absolute'),
            (t.style.zIndex = '-2147483640'),
            (t.style.visibility = 'hidden'),
            (t.style.tableLayout = 'auto'),
            (t.style.width = 'auto'),
            (t.style.padding = '0'),
            (t.style.margin = '0'),
            (t.style.border = 'none'),
            (t.style.outline = 'none'),
            y('div', {
              ref: function (e) {
                e && e.appendChild(t);
              },
            })
          );
        }
        return null;
      }),
      e
    );
  })($);
  function wt(t) {
    if (!t) return '';
    var e = t.split(' ');
    return 1 === e.length && /([a-z][A-Z])+/g.test(t)
      ? t
      : e
          .map(function (t, e) {
            return 0 == e
              ? t.toLowerCase()
              : t.charAt(0).toUpperCase() + t.slice(1).toLowerCase();
          })
          .join('');
  }
  var Pt,
    St = (function (e) {
      function o() {
        var t = e.call(this) || this;
        return (t._columns = []), t;
      }
      return (
        n(o, e),
        Object.defineProperty(o.prototype, 'columns', {
          get: function () {
            return this._columns;
          },
          set: function (t) {
            this._columns = t;
          },
          enumerable: !1,
          configurable: !0,
        }),
        Object.defineProperty(o.prototype, 'visibleColumns', {
          get: function () {
            return this._columns.filter(function (t) {
              return !t.hidden;
            });
          },
          enumerable: !1,
          configurable: !0,
        }),
        (o.prototype.adjustWidth = function (t, e, n, r) {
          if ((void 0 === r && (r = !0), !t)) return this;
          var i = t.clientWidth,
            s = { current: null };
          if (e.current && r) {
            var a = y(bt, { tableRef: e });
            (a.ref = s), M(a, n.current);
          }
          for (
            var u = 0,
              l = o.tabularFormat(this.columns).reduce(function (t, e) {
                return t.concat(e);
              }, []);
            u < l.length;
            u++
          ) {
            var p = l[u];
            (p.columns && p.columns.length > 0) ||
              (!p.width && r
                ? (p.width = yt(vt(s.current.base, p.id)))
                : (p.width = yt(mt(p.width, i))));
          }
          return e.current && r && M(null, n.current), this;
        }),
        (o.prototype.setSort = function (t, e) {
          for (var n = 0, o = e || this.columns || []; n < o.length; n++) {
            var i = o[n];
            i.columns && i.columns.length > 0 && (i.sort = { enabled: !1 }),
              void 0 === i.sort && t.sort && (i.sort = { enabled: !0 }),
              i.sort
                ? 'object' == typeof i.sort &&
                  (i.sort = r({ enabled: !0 }, i.sort))
                : (i.sort = { enabled: !1 }),
              i.columns && this.setSort(t, i.columns);
          }
        }),
        (o.prototype.setFixedHeader = function (t, e) {
          for (var n = 0, r = e || this.columns || []; n < r.length; n++) {
            var o = r[n];
            void 0 === o.fixedHeader && (o.fixedHeader = t.fixedHeader),
              o.columns && this.setFixedHeader(t, o.columns);
          }
        }),
        (o.prototype.setID = function (t) {
          for (var e = 0, n = t || this.columns || []; e < n.length; e++) {
            var r = n[e];
            r.id || 'string' != typeof r.name || (r.id = wt(r.name)),
              r.id ||
                lt.error(
                  'Could not find a valid ID for one of the columns. Make sure a valid "id" is set for all columns.',
                ),
              r.columns && this.setID(r.columns);
          }
        }),
        (o.prototype.populatePlugins = function (e, n) {
          for (var o = 0, i = n; o < i.length; o++) {
            var s = i[o];
            void 0 !== s.plugin &&
              e.plugin.add(
                r(r({ id: s.id, props: {} }, s.plugin), {
                  position: t.PluginPosition.Cell,
                }),
              );
          }
        }),
        (o.fromColumns = function (t) {
          for (var e = new o(), n = 0, r = t; n < r.length; n++) {
            var i = r[n];
            if ('string' == typeof i || u(i)) e.columns.push({ name: i });
            else if ('object' == typeof i) {
              var s = i;
              s.columns && (s.columns = o.fromColumns(s.columns).columns),
                'object' == typeof s.plugin &&
                  void 0 === s.data &&
                  (s.data = null),
                e.columns.push(i);
            }
          }
          return e;
        }),
        (o.fromUserConfig = function (t) {
          var e = new o();
          return (
            t.from
              ? (e.columns = o.fromHTMLTable(t.from).columns)
              : t.columns
              ? (e.columns = o.fromColumns(t.columns).columns)
              : !t.data ||
                'object' != typeof t.data[0] ||
                t.data[0] instanceof Array ||
                (e.columns = Object.keys(t.data[0]).map(function (t) {
                  return { name: t };
                })),
            e.columns.length
              ? (e.setID(),
                e.setSort(t),
                e.setFixedHeader(t),
                e.populatePlugins(t, e.columns),
                e)
              : null
          );
        }),
        (o.fromHTMLTable = function (t) {
          for (
            var e = new o(),
              n = 0,
              r = t.querySelector('thead').querySelectorAll('th');
            n < r.length;
            n++
          ) {
            var i = r[n];
            e.columns.push({ name: i.innerHTML, width: i.width });
          }
          return e;
        }),
        (o.tabularFormat = function (t) {
          var e = [],
            n = t || [],
            r = [];
          if (n && n.length) {
            e.push(n);
            for (var o = 0, i = n; o < i.length; o++) {
              var s = i[o];
              s.columns && s.columns.length && (r = r.concat(s.columns));
            }
            r.length && (e = e.concat(this.tabularFormat(r)));
          }
          return e;
        }),
        (o.leafColumns = function (t) {
          var e = [],
            n = t || [];
          if (n && n.length)
            for (var r = 0, o = n; r < o.length; r++) {
              var i = o[r];
              (i.columns && 0 !== i.columns.length) || e.push(i),
                i.columns && (e = e.concat(this.leafColumns(i.columns)));
            }
          return e;
        }),
        (o.maximumDepth = function (t) {
          return this.tabularFormat([t]).length - 1;
        }),
        o
      );
    })(W),
    xt = (function () {
      function t() {
        (this._callbacks = {}),
          (this._isDispatching = !1),
          (this._isHandled = {}),
          (this._isPending = {}),
          (this._lastID = 1);
      }
      return (
        (t.prototype.register = function (t) {
          var e = 'ID_' + this._lastID++;
          return (this._callbacks[e] = t), e;
        }),
        (t.prototype.unregister = function (t) {
          if (!this._callbacks[t])
            throw Error(
              'Dispatcher.unregister(...): ' +
                t +
                ' does not map to a registered callback.',
            );
          delete this._callbacks[t];
        }),
        (t.prototype.waitFor = function (t) {
          if (!this._isDispatching)
            throw Error(
              'Dispatcher.waitFor(...): Must be invoked while dispatching.',
            );
          for (var e = 0; e < t.length; e++) {
            var n = t[e];
            if (this._isPending[n]) {
              if (!this._isHandled[n])
                throw Error(
                  "Dispatcher.waitFor(...): Circular dependency detected while ' +\n            'waiting for " +
                    n +
                    '.',
                );
            } else {
              if (!this._callbacks[n])
                throw Error(
                  'Dispatcher.waitFor(...): ' +
                    n +
                    ' does not map to a registered callback.',
                );
              this._invokeCallback(n);
            }
          }
        }),
        (t.prototype.dispatch = function (t) {
          if (this._isDispatching)
            throw Error(
              'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.',
            );
          this._startDispatching(t);
          try {
            for (var e in this._callbacks)
              this._isPending[e] || this._invokeCallback(e);
          } finally {
            this._stopDispatching();
          }
        }),
        (t.prototype.isDispatching = function () {
          return this._isDispatching;
        }),
        (t.prototype._invokeCallback = function (t) {
          (this._isPending[t] = !0),
            this._callbacks[t](this._pendingPayload),
            (this._isHandled[t] = !0);
        }),
        (t.prototype._startDispatching = function (t) {
          for (var e in this._callbacks)
            (this._isPending[e] = !1), (this._isHandled[e] = !1);
          (this._pendingPayload = t), (this._isDispatching = !0);
        }),
        (t.prototype._stopDispatching = function () {
          delete this._pendingPayload, (this._isDispatching = !1);
        }),
        t
      );
    })(),
    Ct = function () {},
    kt = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return n.set(e), n;
      }
      return (
        n(e, t),
        (e.prototype.get = function () {
          return o(this, void 0, void 0, function () {
            var t;
            return i(this, function (e) {
              switch (e.label) {
                case 0:
                  return [4, this.data()];
                case 1:
                  return [2, { data: (t = e.sent()), total: t.length }];
              }
            });
          });
        }),
        (e.prototype.set = function (t) {
          return (
            t instanceof Array
              ? (this.data = function () {
                  return t;
                })
              : t instanceof Function && (this.data = t),
            this
          );
        }),
        e
      );
    })(Ct),
    Nt = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return (n.options = e), n;
      }
      return (
        n(e, t),
        (e.prototype.handler = function (t) {
          return 'function' == typeof this.options.handle
            ? this.options.handle(t)
            : t.ok
            ? t.json()
            : (lt.error(
                'Could not fetch data: ' + t.status + ' - ' + t.statusText,
                !0,
              ),
              null);
        }),
        (e.prototype.get = function (t) {
          var e = r(r({}, this.options), t);
          return 'function' == typeof e.data
            ? e.data(e)
            : fetch(e.url, e)
                .then(this.handler.bind(this))
                .then(function (t) {
                  return {
                    data: e.then(t),
                    total: 'function' == typeof e.total ? e.total(t) : void 0,
                  };
                });
        }),
        e
      );
    })(Ct),
    Tt = (function () {
      function t() {}
      return (
        (t.createFromUserConfig = function (t) {
          var e = null;
          return (
            t.data && (e = new kt(t.data)),
            t.from &&
              ((e = new kt(this.tableElementToArray(t.from))),
              (t.from.style.display = 'none')),
            t.server && (e = new Nt(t.server)),
            e || lt.error('Could not determine the storage type', !0),
            e
          );
        }),
        (t.tableElementToArray = function (t) {
          for (
            var e,
              n = [],
              r = 0,
              o = t.querySelector('tbody').querySelectorAll('tr');
            r < o.length;
            r++
          ) {
            for (
              var i = [], s = 0, a = o[r].querySelectorAll('td');
              s < a.length;
              s++
            ) {
              var u = a[s];
              1 === u.childNodes.length &&
              u.childNodes[0].nodeType === Node.TEXT_NODE
                ? i.push(
                    ((e = u.innerHTML),
                    new DOMParser().parseFromString(e, 'text/html')
                      .documentElement.textContent),
                  )
                : i.push(z(u.innerHTML));
            }
            n.push(i);
          }
          return n;
        }),
        t
      );
    })(),
    Ot = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return (
          (n._steps = new Map()),
          (n.cache = new Map()),
          (n.lastProcessorIndexUpdated = -1),
          e &&
            e.forEach(function (t) {
              return n.register(t);
            }),
          n
        );
      }
      return (
        n(e, t),
        (e.prototype.clearCache = function () {
          (this.cache = new Map()), (this.lastProcessorIndexUpdated = -1);
        }),
        (e.prototype.register = function (t, e) {
          if ((void 0 === e && (e = null), null === t.type))
            throw Error('Processor type is not defined');
          t.on('propsUpdated', this.processorPropsUpdated.bind(this)),
            this.addProcessorByPriority(t, e),
            this.afterRegistered(t);
        }),
        (e.prototype.unregister = function (t) {
          if (t) {
            var e = this._steps.get(t.type);
            e &&
              e.length &&
              (this._steps.set(
                t.type,
                e.filter(function (e) {
                  return e != t;
                }),
              ),
              this.emit('updated', t));
          }
        }),
        (e.prototype.addProcessorByPriority = function (t, e) {
          var n = this._steps.get(t.type);
          if (!n) {
            var r = [];
            this._steps.set(t.type, r), (n = r);
          }
          if (null === e || e < 0) n.push(t);
          else if (n[e]) {
            var o = n.slice(0, e - 1),
              i = n.slice(e + 1);
            this._steps.set(t.type, o.concat(t).concat(i));
          } else n[e] = t;
        }),
        Object.defineProperty(e.prototype, 'steps', {
          get: function () {
            for (
              var t = [], e = 0, n = this.getSortedProcessorTypes();
              e < n.length;
              e++
            ) {
              var r = n[e],
                o = this._steps.get(r);
              o && o.length && (t = t.concat(o));
            }
            return t.filter(function (t) {
              return t;
            });
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype.getStepsByType = function (t) {
          return this.steps.filter(function (e) {
            return e.type === t;
          });
        }),
        (e.prototype.getSortedProcessorTypes = function () {
          return Object.keys(Z)
            .filter(function (t) {
              return !isNaN(Number(t));
            })
            .map(function (t) {
              return Number(t);
            });
        }),
        (e.prototype.process = function (t) {
          return o(this, void 0, void 0, function () {
            var e, n, r, o, s, a, u;
            return i(this, function (i) {
              switch (i.label) {
                case 0:
                  (e = this.lastProcessorIndexUpdated),
                    (n = this.steps),
                    (r = t),
                    (i.label = 1);
                case 1:
                  i.trys.push([1, 7, , 8]), (o = 0), (s = n), (i.label = 2);
                case 2:
                  return o < s.length
                    ? ((a = s[o]),
                      this.findProcessorIndexByID(a.id) >= e
                        ? [4, a.process(r)]
                        : [3, 4])
                    : [3, 6];
                case 3:
                  return (r = i.sent()), this.cache.set(a.id, r), [3, 5];
                case 4:
                  (r = this.cache.get(a.id)), (i.label = 5);
                case 5:
                  return o++, [3, 2];
                case 6:
                  return [3, 8];
                case 7:
                  throw ((u = i.sent()), lt.error(u), this.emit('error', r), u);
                case 8:
                  return (
                    (this.lastProcessorIndexUpdated = n.length),
                    this.emit('afterProcess', r),
                    [2, r]
                  );
              }
            });
          });
        }),
        (e.prototype.findProcessorIndexByID = function (t) {
          return this.steps.findIndex(function (e) {
            return e.id == t;
          });
        }),
        (e.prototype.setLastProcessorIndex = function (t) {
          var e = this.findProcessorIndexByID(t.id);
          this.lastProcessorIndexUpdated > e &&
            (this.lastProcessorIndexUpdated = e);
        }),
        (e.prototype.processorPropsUpdated = function (t) {
          this.setLastProcessorIndex(t),
            this.emit('propsUpdated'),
            this.emit('updated', t);
        }),
        (e.prototype.afterRegistered = function (t) {
          this.setLastProcessorIndex(t),
            this.emit('afterRegister'),
            this.emit('updated', t);
        }),
        e
      );
    })(J),
    Dt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.Extractor;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function (t) {
          return o(this, void 0, void 0, function () {
            return i(this, function (e) {
              switch (e.label) {
                case 0:
                  return [4, this.props.storage.get(t)];
                case 1:
                  return [2, e.sent()];
              }
            });
          });
        }),
        e
      );
    })(Q),
    Ft = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.Transformer;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function (t) {
          var e = X.fromArray(t.data);
          return (e.length = t.total), e;
        }),
        e
      );
    })(Q),
    Et = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.Initiator;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function () {
          return Object.entries(this.props.serverStorageOptions)
            .filter(function (t) {
              return t[0], 'function' != typeof t[1];
            })
            .reduce(function (t, e) {
              var n,
                o = e[0],
                i = e[1];
              return r(r({}, t), (((n = {})[o] = i), n));
            }, {});
        }),
        e
      );
    })(Q),
    Rt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.Transformer;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype.castData = function (t) {
          if (!t || !t.length) return [];
          if (!this.props.header || !this.props.header.columns) return t;
          var e = St.leafColumns(this.props.header.columns);
          return t[0] instanceof Array
            ? t.map(function (t) {
                var n = 0;
                return e.map(function (e, r) {
                  return void 0 !== e.data
                    ? (n++, 'function' == typeof e.data ? e.data(t) : e.data)
                    : t[r - n];
                });
              })
            : 'object' != typeof t[0] || t[0] instanceof Array
            ? []
            : t.map(function (t) {
                return e.map(function (e, n) {
                  return void 0 !== e.data
                    ? 'function' == typeof e.data
                      ? e.data(t)
                      : e.data
                    : e.id
                    ? t[e.id]
                    : (lt.error(
                        'Could not find the correct cell for column at position ' +
                          n +
                          ".\n                          Make sure either 'id' or 'selector' is defined for all columns.",
                      ),
                      null);
                });
              });
        }),
        (e.prototype._process = function (t) {
          return { data: this.castData(t.data), total: t.total };
        }),
        e
      );
    })(Q),
    It = (function () {
      function t() {}
      return (
        (t.createFromConfig = function (t) {
          var e = new Ot();
          return (
            t.storage instanceof Nt &&
              e.register(new Et({ serverStorageOptions: t.server })),
            e.register(new Dt({ storage: t.storage })),
            e.register(new Rt({ header: t.header })),
            e.register(new Ft()),
            e
          );
        }),
        t
      );
    })(),
    jt = (function () {
      function e(t) {
        Object.assign(this, r(r({}, e.defaultConfig()), t)),
          (this._userConfig = {});
      }
      return (
        (e.prototype.assign = function (t) {
          for (var e = 0, n = Object.keys(t); e < n.length; e++) {
            var r = n[e];
            '_userConfig' !== r && (this[r] = t[r]);
          }
          return this;
        }),
        (e.prototype.update = function (t) {
          return t
            ? ((this._userConfig = r(r({}, this._userConfig), t)),
              this.assign(e.fromUserConfig(this._userConfig)),
              this)
            : this;
        }),
        (e.defaultConfig = function () {
          return {
            plugin: new ct(),
            dispatcher: new xt(),
            tableRef: { current: null },
            tempRef: { current: null },
            width: '100%',
            height: 'auto',
            autoWidth: !0,
            style: {},
            className: {},
          };
        }),
        (e.fromUserConfig = function (n) {
          var o = new e(n);
          return (
            (o._userConfig = n),
            'boolean' == typeof n.sort &&
              n.sort &&
              o.assign({ sort: { multiColumn: !0 } }),
            o.assign({ header: St.fromUserConfig(o) }),
            o.assign({ storage: Tt.createFromUserConfig(n) }),
            o.assign({ pipeline: It.createFromConfig(o) }),
            o.assign({ translator: new G(n.language) }),
            o.plugin.add({
              id: 'search',
              position: t.PluginPosition.Header,
              component: ft,
              props: r(
                { enabled: !0 === n.search || n.search instanceof Object },
                n.search,
              ),
            }),
            o.plugin.add({
              id: 'pagination',
              position: t.PluginPosition.Footer,
              component: gt,
              props: r(
                {
                  enabled:
                    !0 === n.pagination || n.pagination instanceof Object,
                },
                n.pagination,
              ),
            }),
            n.plugins &&
              n.plugins.forEach(function (t) {
                return o.plugin.add(t);
              }),
            o
          );
        }),
        e
      );
    })();
  !(function (t) {
    (t[(t.Init = 0)] = 'Init'),
      (t[(t.Loading = 1)] = 'Loading'),
      (t[(t.Loaded = 2)] = 'Loaded'),
      (t[(t.Rendered = 3)] = 'Rendered'),
      (t[(t.Error = 4)] = 'Error');
  })(Pt || (Pt = {}));
  var Lt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.content = function () {
          return this.props.column &&
            'function' == typeof this.props.column.formatter
            ? this.props.column.formatter(
                this.props.cell.data,
                this.props.row,
                this.props.column,
              )
            : this.props.column && this.props.column.plugin
            ? y(ht, {
                pluginId: this.props.column.id,
                props: {
                  column: this.props.column,
                  cell: this.props.cell,
                  row: this.props.row,
                },
              })
            : this.props.cell.data;
        }),
        (e.prototype.handleClick = function (t) {
          this.props.messageCell ||
            this.config.eventEmitter.emit(
              'cellClick',
              t,
              this.props.cell,
              this.props.column,
              this.props.row,
            );
        }),
        (e.prototype.getCustomAttributes = function (t) {
          return t
            ? 'function' == typeof t.attributes
              ? t.attributes(
                  this.props.cell.data,
                  this.props.row,
                  this.props.column,
                )
              : t.attributes
            : {};
        }),
        (e.prototype.render = function () {
          return y(
            'td',
            r(
              {
                role: this.props.role,
                colSpan: this.props.colSpan,
                'data-column-id': this.props.column && this.props.column.id,
                className: nt(
                  et('td'),
                  this.props.className,
                  this.config.className.td,
                ),
                style: r(r({}, this.props.style), this.config.style.td),
                onClick: this.handleClick.bind(this),
              },
              this.getCustomAttributes(this.props.column),
            ),
            this.content(),
          );
        }),
        e
      );
    })($),
    Ut = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.getColumn = function (t) {
          if (this.props.header) {
            var e = St.leafColumns(this.props.header.columns);
            if (e) return e[t];
          }
          return null;
        }),
        (e.prototype.handleClick = function (t) {
          this.props.messageRow ||
            this.config.eventEmitter.emit('rowClick', t, this.props.row);
        }),
        (e.prototype.getChildren = function () {
          var t = this;
          return this.props.children
            ? this.props.children
            : y(
                w,
                null,
                this.props.row.cells.map(function (e, n) {
                  var r = t.getColumn(n);
                  return r && r.hidden
                    ? null
                    : y(Lt, {
                        key: e.id,
                        cell: e,
                        row: t.props.row,
                        column: r,
                      });
                }),
              );
        }),
        (e.prototype.render = function () {
          return y(
            'tr',
            {
              className: nt(et('tr'), this.config.className.tr),
              onClick: this.handleClick.bind(this),
            },
            this.getChildren(),
          );
        }),
        e
      );
    })($),
    At = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.render = function () {
          return y(
            Ut,
            { messageRow: !0 },
            y(Lt, {
              role: 'alert',
              colSpan: this.props.colSpan,
              messageCell: !0,
              cell: new V(this.props.message),
              className: nt(
                et('message'),
                this.props.className ? this.props.className : null,
              ),
            }),
          );
        }),
        e
      );
    })($),
    Ht = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.headerLength = function () {
          return this.props.header
            ? this.props.header.visibleColumns.length
            : 0;
        }),
        (e.prototype.render = function () {
          var t = this;
          return y(
            'tbody',
            { className: nt(et('tbody'), this.config.className.tbody) },
            this.props.data &&
              this.props.data.rows.map(function (e) {
                return y(Ut, { key: e.id, row: e, header: t.props.header });
              }),
            this.props.status === Pt.Loading &&
              (!this.props.data || 0 === this.props.data.length) &&
              y(At, {
                message: this._('loading'),
                colSpan: this.headerLength(),
                className: nt(et('loading'), this.config.className.loading),
              }),
            this.props.status === Pt.Rendered &&
              this.props.data &&
              0 === this.props.data.length &&
              y(At, {
                message: this._('noRecordsFound'),
                colSpan: this.headerLength(),
                className: nt(et('notfound'), this.config.className.notfound),
              }),
            this.props.status === Pt.Error &&
              y(At, {
                message: this._('error'),
                colSpan: this.headerLength(),
                className: nt(et('error'), this.config.className.error),
              }),
          );
        }),
        e
      );
    })($),
    Mt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.validateProps = function () {
          for (var t = 0, e = this.props.columns; t < e.length; t++) {
            var n = e[t];
            void 0 === n.direction && (n.direction = 1),
              1 !== n.direction &&
                -1 !== n.direction &&
                lt.error('Invalid sort direction ' + n.direction);
          }
        }),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.Sort;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype.compare = function (t, e) {
          return t > e ? 1 : t < e ? -1 : 0;
        }),
        (e.prototype.compareWrapper = function (t, e) {
          for (var n = 0, r = 0, o = this.props.columns; r < o.length; r++) {
            var i = o[r];
            if (0 !== n) break;
            var s = t.cells[i.index].data,
              a = e.cells[i.index].data;
            'function' == typeof i.compare
              ? (n |= i.compare(s, a) * i.direction)
              : (n |= this.compare(s, a) * i.direction);
          }
          return n;
        }),
        (e.prototype._process = function (t) {
          var e = s(t.rows);
          e.sort(this.compareWrapper.bind(this));
          var n = new X(e);
          return (n.length = t.length), n;
        }),
        e
      );
    })(Q),
    Bt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.getInitialState = function () {
          return [];
        }),
        (e.prototype.handle = function (t, e) {
          if ('SORT_COLUMN' === t) {
            var n = e.index,
              r = e.direction,
              o = e.multi,
              i = e.compare;
            this.sortColumn(n, r, o, i);
          } else if ('SORT_COLUMN_TOGGLE' === t) {
            (n = e.index), (o = e.multi), (i = e.compare);
            this.sortToggle(n, o, i);
          }
        }),
        (e.prototype.sortToggle = function (t, e, n) {
          var r = s(this.state).find(function (e) {
            return e.index === t;
          });
          r
            ? this.sortColumn(t, 1 === r.direction ? -1 : 1, e, n)
            : this.sortColumn(t, 1, e, n);
        }),
        (e.prototype.sortColumn = function (t, e, n, r) {
          var o = s(this.state),
            i = o.length,
            a = o.find(function (e) {
              return e.index === t;
            }),
            u = !1,
            l = !1,
            p = !1,
            c = !1;
          if (
            (void 0 !== a
              ? n
                ? -1 === a.direction
                  ? (p = !0)
                  : (c = !0)
                : 1 === i
                ? (c = !0)
                : i > 1 && ((l = !0), (u = !0))
              : 0 === i
              ? (u = !0)
              : i > 0 && !n
              ? ((u = !0), (l = !0))
              : i > 0 && n && (u = !0),
            l && (o = []),
            u)
          )
            o.push({ index: t, direction: e, compare: r });
          else if (c) {
            var h = o.indexOf(a);
            o[h].direction = e;
          } else if (p) {
            var f = o.indexOf(a);
            o.splice(f, 1);
          }
          this.setState(o);
        }),
        e
      );
    })(ot),
    Wt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.sortColumn = function (t, e, n, r) {
          this.dispatch('SORT_COLUMN', {
            index: t,
            direction: e,
            multi: n,
            compare: r,
          });
        }),
        (e.prototype.sortToggle = function (t, e, n) {
          this.dispatch('SORT_COLUMN_TOGGLE', {
            index: t,
            multi: e,
            compare: n,
          });
        }),
        e
      );
    })(st),
    qt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        Object.defineProperty(e.prototype, 'type', {
          get: function () {
            return Z.ServerSort;
          },
          enumerable: !1,
          configurable: !0,
        }),
        (e.prototype._process = function (t) {
          var e = {};
          return (
            this.props.url &&
              (e.url = this.props.url(t.url, this.props.columns)),
            this.props.body &&
              (e.body = this.props.body(t.body, this.props.columns)),
            r(r({}, t), e)
          );
        }),
        e
      );
    })(Q),
    Gt = (function (t) {
      function e(e, n) {
        var r = t.call(this, e, n) || this;
        return (
          (r.actions = new Wt(r.config.dispatcher)),
          (r.store = new Bt(r.config.dispatcher)),
          e.enabled &&
            ((r.sortProcessor = r.getOrCreateSortProcessor()),
            (r.updateStateFn = r.updateState.bind(r)),
            r.store.on('updated', r.updateStateFn),
            (r.state = { direction: 0 })),
          r
        );
      }
      return (
        n(e, t),
        (e.prototype.componentWillUnmount = function () {
          this.config.pipeline.unregister(this.sortProcessor),
            this.store.off('updated', this.updateStateFn),
            this.updateSortProcessorFn &&
              this.store.off('updated', this.updateSortProcessorFn);
        }),
        (e.prototype.updateState = function () {
          var t = this,
            e = this.store.state.find(function (e) {
              return e.index === t.props.index;
            });
          e
            ? this.setState({ direction: e.direction })
            : this.setState({ direction: 0 });
        }),
        (e.prototype.updateSortProcessor = function (t) {
          this.sortProcessor.setProps({ columns: t });
        }),
        (e.prototype.getOrCreateSortProcessor = function () {
          var t = Z.Sort;
          this.config.sort &&
            'object' == typeof this.config.sort.server &&
            (t = Z.ServerSort);
          var e,
            n = this.config.pipeline.getStepsByType(t);
          return (
            n.length > 0
              ? (e = n[0])
              : ((this.updateSortProcessorFn = this.updateSortProcessor.bind(
                  this,
                )),
                this.store.on('updated', this.updateSortProcessorFn),
                (e =
                  t === Z.ServerSort
                    ? new qt(
                        r(
                          { columns: this.store.state },
                          this.config.sort.server,
                        ),
                      )
                    : new Mt({ columns: this.store.state })),
                this.config.pipeline.register(e)),
            e
          );
        }),
        (e.prototype.changeDirection = function (t) {
          t.preventDefault(),
            t.stopPropagation(),
            this.actions.sortToggle(
              this.props.index,
              !0 === t.shiftKey && this.config.sort.multiColumn,
              this.props.compare,
            );
        }),
        (e.prototype.render = function () {
          if (!this.props.enabled) return null;
          var t = this.state.direction,
            e = 'neutral';
          return (
            1 === t ? (e = 'asc') : -1 === t && (e = 'desc'),
            y('button', {
              tabIndex: -1,
              'aria-label': this._('sort.sort' + (1 === t ? 'Desc' : 'Asc')),
              title: this._('sort.sort' + (1 === t ? 'Desc' : 'Asc')),
              className: nt(
                et('sort'),
                et('sort', e),
                this.config.className.sort,
              ),
              onClick: this.changeDirection.bind(this),
            })
          );
        }),
        e
      );
    })($),
    $t = (function (t) {
      function e(e, n) {
        var r = t.call(this, e, n) || this;
        return (
          (r.sortRef = { current: null }),
          (r.thRef = { current: null }),
          (r.state = { style: {} }),
          r
        );
      }
      return (
        n(e, t),
        (e.prototype.isSortable = function () {
          return this.props.column.sort.enabled;
        }),
        (e.prototype.onClick = function (t) {
          t.stopPropagation(),
            this.isSortable() && this.sortRef.current.changeDirection(t);
        }),
        (e.prototype.keyDown = function (t) {
          this.isSortable() && 13 === t.which && this.onClick(t);
        }),
        (e.prototype.componentDidMount = function () {
          var t = this;
          setTimeout(function () {
            if (t.props.column.fixedHeader && t.thRef.current) {
              var e = t.thRef.current.offsetTop;
              'number' == typeof e && t.setState({ style: { top: e } });
            }
          }, 0);
        }),
        (e.prototype.content = function () {
          return void 0 !== this.props.column.name
            ? this.props.column.name
            : void 0 !== this.props.column.plugin
            ? y(ht, {
                pluginId: this.props.column.plugin.id,
                props: { column: this.props.column },
              })
            : null;
        }),
        (e.prototype.getCustomAttributes = function () {
          var t = this.props.column;
          return t
            ? 'function' == typeof t.attributes
              ? t.attributes(null, null, this.props.column)
              : t.attributes
            : {};
        }),
        (e.prototype.render = function () {
          var t = {};
          return (
            this.isSortable() && (t.tabIndex = 0),
            y(
              'th',
              r(
                {
                  ref: this.thRef,
                  'data-column-id': this.props.column && this.props.column.id,
                  className: nt(
                    et('th'),
                    this.isSortable() ? et('th', 'sort') : null,
                    this.props.column.fixedHeader ? et('th', 'fixed') : null,
                    this.config.className.th,
                  ),
                  onClick: this.onClick.bind(this),
                  style: r(
                    r(
                      r(r({}, this.config.style.th), {
                        width: this.props.column.width,
                      }),
                      this.state.style,
                    ),
                    this.props.style,
                  ),
                  onKeyDown: this.keyDown.bind(this),
                  rowSpan: this.props.rowSpan > 1 ? this.props.rowSpan : void 0,
                  colSpan: this.props.colSpan > 1 ? this.props.colSpan : void 0,
                },
                this.getCustomAttributes(),
                t,
              ),
              y('div', { className: et('th', 'content') }, this.content()),
              this.isSortable() &&
                y(
                  Gt,
                  r(
                    { ref: this.sortRef, index: this.props.index },
                    this.props.column.sort,
                  ),
                ),
            )
          );
        }),
        e
      );
    })($);
  var Kt,
    zt,
    Vt,
    Yt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.renderColumn = function (t, e, n, r) {
          var o = (function (t, e, n) {
              var r = St.maximumDepth(t),
                o = n - e;
              return {
                rowSpan: Math.floor(o - r - r / o),
                colSpan: (t.columns && t.columns.length) || 1,
              };
            })(t, e, r),
            i = o.rowSpan,
            s = o.colSpan;
          return y($t, { column: t, index: n, colSpan: s, rowSpan: i });
        }),
        (e.prototype.renderRow = function (t, e, n) {
          var r = this,
            o = St.leafColumns(this.props.header.columns);
          return y(
            Ut,
            null,
            t.map(function (t) {
              return t.hidden ? null : r.renderColumn(t, e, o.indexOf(t), n);
            }),
          );
        }),
        (e.prototype.renderRows = function () {
          var t = this,
            e = St.tabularFormat(this.props.header.columns);
          return e.map(function (n, r) {
            return t.renderRow(n, r, e.length);
          });
        }),
        (e.prototype.render = function () {
          return this.props.header
            ? y(
                'thead',
                {
                  key: this.props.header.id,
                  className: nt(et('thead'), this.config.className.thead),
                },
                this.renderRows(),
              )
            : null;
        }),
        e
      );
    })($),
    Xt = (function (t) {
      function e() {
        return (null !== t && t.apply(this, arguments)) || this;
      }
      return (
        n(e, t),
        (e.prototype.render = function () {
          return y(
            'table',
            {
              role: 'grid',
              className: nt(et('table'), this.config.className.table),
              style: r(r({}, this.config.style.table), {
                width: this.props.width,
                height: this.props.height,
              }),
            },
            y(Yt, { header: this.props.header }),
            y(Ht, {
              data: this.props.data,
              status: this.props.status,
              header: this.props.header,
            }),
          );
        }),
        e
      );
    })($),
    Zt = (function (e) {
      function o(t, n) {
        var r = e.call(this, t, n) || this;
        return (
          (r.headerRef = { current: null }), (r.state = { isActive: !0 }), r
        );
      }
      return (
        n(o, e),
        (o.prototype.componentDidMount = function () {
          0 === this.headerRef.current.children.length &&
            this.setState({ isActive: !1 });
        }),
        (o.prototype.render = function () {
          return this.state.isActive
            ? y(
                'div',
                {
                  ref: this.headerRef,
                  className: nt(et('head'), this.config.className.header),
                  style: r({}, this.config.style.header),
                },
                y(ht, { position: t.PluginPosition.Header }),
              )
            : null;
        }),
        o
      );
    })($),
    Jt = (function (e) {
      function o(t, n) {
        var r = e.call(this, t, n) || this;
        return (
          (r.footerRef = { current: null }), (r.state = { isActive: !0 }), r
        );
      }
      return (
        n(o, e),
        (o.prototype.componentDidMount = function () {
          0 === this.footerRef.current.children.length &&
            this.setState({ isActive: !1 });
        }),
        (o.prototype.render = function () {
          return this.state.isActive
            ? y(
                'div',
                {
                  ref: this.footerRef,
                  className: nt(et('footer'), this.config.className.footer),
                  style: r({}, this.config.style.footer),
                },
                y(ht, { position: t.PluginPosition.Footer }),
              )
            : null;
        }),
        o
      );
    })($),
    Qt = (function (t) {
      function e(e, n) {
        var r = t.call(this, e, n) || this;
        return (
          (r.configContext = (function (t, e) {
            var n = {
              __c: (e = '__cC' + h++),
              __: t,
              Consumer: function (t, e) {
                return t.children(e);
              },
              Provider: function (t) {
                var n, r;
                return (
                  this.getChildContext ||
                    ((n = []),
                    ((r = {})[e] = this),
                    (this.getChildContext = function () {
                      return r;
                    }),
                    (this.shouldComponentUpdate = function (t) {
                      this.props.value !== t.value && n.some(C);
                    }),
                    (this.sub = function (t) {
                      n.push(t);
                      var e = t.componentWillUnmount;
                      t.componentWillUnmount = function () {
                        n.splice(n.indexOf(t), 1), e && e.call(t);
                      };
                    })),
                  t.children
                );
              },
            };
            return (n.Provider.__ = n.Consumer.contextType = n);
          })(null)),
          (r.state = { status: Pt.Loading, header: e.header, data: null }),
          r
        );
      }
      return (
        n(e, t),
        (e.prototype.processPipeline = function () {
          return o(this, void 0, void 0, function () {
            var t, e;
            return i(this, function (n) {
              switch (n.label) {
                case 0:
                  this.props.config.eventEmitter.emit('beforeLoad'),
                    this.setState({ status: Pt.Loading }),
                    (n.label = 1);
                case 1:
                  return (
                    n.trys.push([1, 3, , 4]), [4, this.props.pipeline.process()]
                  );
                case 2:
                  return (
                    (t = n.sent()),
                    this.setState({ data: t, status: Pt.Loaded }),
                    this.props.config.eventEmitter.emit('load', t),
                    [3, 4]
                  );
                case 3:
                  return (
                    (e = n.sent()),
                    lt.error(e),
                    this.setState({ status: Pt.Error, data: null }),
                    [3, 4]
                  );
                case 4:
                  return [2];
              }
            });
          });
        }),
        (e.prototype.componentDidMount = function () {
          return o(this, void 0, void 0, function () {
            var t;
            return i(this, function (e) {
              switch (e.label) {
                case 0:
                  return (t = this.props.config), [4, this.processPipeline()];
                case 1:
                  return (
                    e.sent(),
                    t.header &&
                      this.state.data &&
                      this.state.data.length &&
                      this.setState({
                        header: t.header.adjustWidth(
                          t.container,
                          t.tableRef,
                          t.tempRef,
                          t.autoWidth,
                        ),
                      }),
                    (this.processPipelineFn = this.processPipeline.bind(this)),
                    this.props.pipeline.on('updated', this.processPipelineFn),
                    [2]
                  );
              }
            });
          });
        }),
        (e.prototype.componentWillUnmount = function () {
          this.props.pipeline.off('updated', this.processPipelineFn);
        }),
        (e.prototype.componentDidUpdate = function (t, e) {
          e.status != Pt.Rendered &&
            this.state.status == Pt.Loaded &&
            (this.setState({ status: Pt.Rendered }),
            this.props.config.eventEmitter.emit('ready'));
        }),
        (e.prototype.render = function () {
          return y(
            this.configContext.Provider,
            { value: this.props.config },
            y(
              'div',
              {
                role: 'complementary',
                className: nt(
                  'gridjs',
                  et('container'),
                  this.state.status === Pt.Loading ? et('loading') : null,
                  this.props.config.className.container,
                ),
                style: r(r({}, this.props.config.style.container), {
                  width: this.props.width,
                }),
              },
              this.state.status === Pt.Loading &&
                y('div', { className: et('loading-bar') }),
              y(Zt, null),
              y(
                'div',
                {
                  className: et('wrapper'),
                  style: { width: this.props.width, height: this.props.height },
                },
                y(Xt, {
                  ref: this.props.config.tableRef,
                  data: this.state.data,
                  header: this.state.header,
                  width: this.props.width,
                  height: this.props.height,
                  status: this.state.status,
                }),
              ),
              y(Jt, null),
            ),
            y('div', {
              ref: this.props.config.tempRef,
              id: 'gridjs-temp',
              className: et('temp'),
            }),
          );
        }),
        e
      );
    })($),
    te = (function (t) {
      function e(e) {
        var n = t.call(this) || this;
        return (
          (n.config = new jt({ instance: n, eventEmitter: n }).update(e)),
          (n.plugin = n.config.plugin),
          n
        );
      }
      return (
        n(e, t),
        (e.prototype.updateConfig = function (t) {
          return this.config.update(t), this;
        }),
        (e.prototype.createElement = function () {
          return y(Qt, {
            config: this.config,
            pipeline: this.config.pipeline,
            header: this.config.header,
            width: this.config.width,
            height: this.config.height,
          });
        }),
        (e.prototype.forceRender = function () {
          return (
            (this.config && this.config.container) ||
              lt.error(
                'Container is empty. Make sure you call render() before forceRender()',
                !0,
              ),
            this.config.pipeline.clearCache(),
            M(null, this.config.container),
            M(this.createElement(), this.config.container),
            this
          );
        }),
        (e.prototype.render = function (t) {
          return (
            t || lt.error('Container element cannot be null', !0),
            t.childNodes.length > 0
              ? (lt.error(
                  'The container element ' +
                    t +
                    ' is not empty. Make sure the container is empty and call render() again',
                ),
                this)
              : ((this.config.container = t), M(this.createElement(), t), this)
          );
        }),
        e
      );
    })(J),
    ee = 0,
    ne = [],
    re = a.__b,
    oe = a.__r,
    ie = a.diffed,
    se = a.__c,
    ae = a.unmount;
  function ue(t, e) {
    a.__h && a.__h(zt, t, ee || e), (ee = 0);
    var n = zt.__H || (zt.__H = { __: [], __h: [] });
    return t >= n.__.length && n.__.push({}), n.__[t];
  }
  function le() {
    ne.forEach(function (t) {
      if (t.__P)
        try {
          t.__H.__h.forEach(ce), t.__H.__h.forEach(he), (t.__H.__h = []);
        } catch (e) {
          (t.__H.__h = []), a.__e(e, t.__v);
        }
    }),
      (ne = []);
  }
  (a.__b = function (t) {
    (zt = null), re && re(t);
  }),
    (a.__r = function (t) {
      oe && oe(t), (Kt = 0);
      var e = (zt = t.__c).__H;
      e && (e.__h.forEach(ce), e.__h.forEach(he), (e.__h = []));
    }),
    (a.diffed = function (t) {
      ie && ie(t);
      var e = t.__c;
      e &&
        e.__H &&
        e.__H.__h.length &&
        ((1 !== ne.push(e) && Vt === a.requestAnimationFrame) ||
          (
            (Vt = a.requestAnimationFrame) ||
            function (t) {
              var e,
                n = function () {
                  clearTimeout(r), pe && cancelAnimationFrame(e), setTimeout(t);
                },
                r = setTimeout(n, 100);
              pe && (e = requestAnimationFrame(n));
            }
          )(le)),
        (zt = void 0);
    }),
    (a.__c = function (t, e) {
      e.some(function (t) {
        try {
          t.__h.forEach(ce),
            (t.__h = t.__h.filter(function (t) {
              return !t.__ || he(t);
            }));
        } catch (n) {
          e.some(function (t) {
            t.__h && (t.__h = []);
          }),
            (e = []),
            a.__e(n, t.__v);
        }
      }),
        se && se(t, e);
    }),
    (a.unmount = function (t) {
      ae && ae(t);
      var e = t.__c;
      if (e && e.__H)
        try {
          e.__H.__.forEach(ce);
        } catch (t) {
          a.__e(t, e.__v);
        }
    });
  var pe = 'function' == typeof requestAnimationFrame;
  function ce(t) {
    var e = zt;
    'function' == typeof t.__c && t.__c(), (zt = e);
  }
  function he(t) {
    var e = zt;
    (t.__c = t.__()), (zt = e);
  }
  function fe(t, e) {
    return (
      !t ||
      t.length !== e.length ||
      e.some(function (e, n) {
        return e !== t[n];
      })
    );
  }
  (t.BaseActions = st),
    (t.BaseComponent = $),
    (t.BaseStore = ot),
    (t.Cell = V),
    (t.Component = P),
    (t.Config = jt),
    (t.Dispatcher = xt),
    (t.Grid = te),
    (t.PluginBaseComponent = pt),
    (t.Row = Y),
    (t.className = et),
    (t.createElement = y),
    (t.createRef = b),
    (t.h = y),
    (t.html = z),
    (t.useEffect = function (t, e) {
      var n = ue(Kt++, 3);
      !a.__s && fe(n.__H, e) && ((n.__ = t), (n.__H = e), zt.__H.__h.push(n));
    }),
    (t.useRef = function (t) {
      return (
        (ee = 5),
        (function (t, e) {
          var n = ue(Kt++, 7);
          return fe(n.__H, e) && ((n.__ = t()), (n.__H = e), (n.__h = t)), n.__;
        })(function () {
          return { current: t };
        }, [])
      );
    }),
    Object.defineProperty(t, '__esModule', { value: !0 });
});
//# sourceMappingURL=gridjs.production.min.js.map
