{"version":3,"file":"gridjs.mjs","sources":["../src/types.ts","../node_modules/preact/dist/preact.module.js","../src/pipeline/processor.ts","../src/util/id.ts","../src/base.ts","../src/view/htmlElement.tsx","../src/util/html.ts","../src/cell.ts","../src/row.ts","../src/tabular.ts","../src/util/array.ts","../src/util/eventEmitter.ts","../src/util/deepEqual.ts","../src/pipeline/filter/globalSearch.ts","../src/operator/search.ts","../src/util/className.ts","../src/pipeline/filter/serverGlobalSearch.ts","../node_modules/preact/hooks/dist/hooks.module.js","../src/hooks/useConfig.ts","../src/i18n/en_US.ts","../src/i18n/language.ts","../src/view/plugin/search/actions.ts","../src/hooks/useStore.ts","../src/hooks/useSelector.ts","../src/view/plugin/search/search.tsx","../src/util/debounce.ts","../src/pipeline/limit/pagination.ts","../src/pipeline/limit/serverPagination.ts","../src/view/plugin/pagination/actions.ts","../src/view/plugin/pagination/pagination.tsx","../src/util/width.ts","../src/view/table/shadow.tsx","../src/util/string.ts","../src/util/log.ts","../src/plugin.ts","../src/header.ts","../src/storage/storage.ts","../src/storage/memory.ts","../src/storage/server.ts","../src/storage/storageUtils.ts","../src/pipeline/pipeline.ts","../src/pipeline/extractor/storage.ts","../src/pipeline/transformer/arrayToTabular.ts","../src/pipeline/initiator/server.ts","../src/pipeline/transformer/storageResponseToArray.ts","../src/pipeline/pipelineUtils.ts","../src/state/store.ts","../src/config.ts","../src/view/table/td.tsx","../src/view/table/tr.tsx","../src/view/table/messageRow.tsx","../src/view/table/tbody.tsx","../src/pipeline/sort/native.ts","../src/view/plugin/sort/actions.ts","../src/pipeline/sort/server.ts","../src/view/plugin/sort/sort.tsx","../src/util/throttle.ts","../src/view/plugin/resize/resize.tsx","../src/view/table/th.tsx","../src/view/table/thead.tsx","../src/util/table.ts","../src/view/actions.ts","../src/view/table/table.tsx","../src/view/headerContainer.tsx","../src/view/footerContainer.tsx","../src/view/container.tsx","../src/grid.ts"],"sourcesContent":["import { ComponentChild } from 'preact';\nimport Row from './row';\nimport { SortConfig } from './view/plugin/sort/sort';\nimport { JSXInternal } from 'preact/src/jsx';\nimport { Plugin } from './plugin';\n\nexport type OneDArray<T> = T[];\nexport type TwoDArray<T> = T[][];\n\n/**\n * Table cell types\n */\nexport type TCell = number | string | boolean | ComponentChild | HTMLElement;\n// Array of Arrays\nexport type TDataArrayRow = OneDArray<TCell>;\nexport type TDataArray = OneDArray<TDataArrayRow>;\n// Array of Objects\nexport type TDataObjectRow = { [key: string]: TCell };\nexport type TDataObject = OneDArray<TDataObjectRow>;\n// (Array of Arrays) and (Array of Objects)\nexport type TData = TDataArray | TDataObject;\n// HTML attributes to be added to rows/cells\nexport type TAttribute = { [key: string]: string };\n\n// Table header cell type\nexport interface TColumn {\n  id?: string;\n  // default data for all columns\n  data?: ((row: TDataArrayRow | TDataObjectRow) => TCell) | TCell;\n  // column label\n  name?: string | ComponentChild;\n  plugin?: Plugin<any>;\n  // column width\n  width?: string;\n  minWidth?: string;\n  sort?: SortConfig;\n  columns?: OneDArray<TColumn>;\n  resizable?: boolean;\n  hidden?: boolean;\n  formatter?: (cell: TCell, row: Row, column: TColumn) => ComponentChild;\n  // HTML attributes to be added to all cells and header of this column\n  attributes?:\n    | ((\n        // this is null when `attributes` is called for a th\n        cell: TCell | null,\n        row: Row | null,\n        column: TColumn,\n      ) => JSXInternal.HTMLAttributes<HTMLTableCellElement>)\n    | JSXInternal.HTMLAttributes<HTMLTableCellElement>;\n}\n\n// Comparator function for the sorting plugin\nexport type Comparator<T> = (a: T, b: T) => number;\n\nexport interface TColumnSort {\n  index: number;\n  // 1 ascending, -1 descending\n  direction?: 1 | -1;\n}\n\n// container status\nexport enum Status {\n  Init,\n  Loading,\n  Loaded,\n  Rendered,\n  Error,\n}\n\nexport type CSSDeclaration = {\n  [key: string]: string | number;\n};\n","var n,l,u,i,t,o,r,f={},e=[],c=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s(n,l){for(var u in l)n[u]=l[u];return n}function a(n){var l=n.parentNode;l&&l.removeChild(n)}function h(l,u,i){var t,o,r,f={};for(r in u)\"key\"==r?t=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),\"function\"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v(l,f,t,o,null)}function v(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u:r};return null==r&&null!=l.vnode&&l.vnode(f),f}function y(){return{current:null}}function p(n){return n.children}function d(n,l){this.props=n,this.context=l}function _(n,l){if(null==l)return n.__?_(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return\"function\"==typeof n.type?_(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function b(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||setTimeout)(g)}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s({},t)).__v=t.__v+1,j(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_(t):o,t.__h),z(u,t),t.__e!=o&&k(t)))})}function w(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||\"boolean\"==typeof k?null:\"string\"==typeof k||\"number\"==typeof k||\"bigint\"==typeof k?v(null,k,null,null,k):Array.isArray(k)?v(p,{children:k},null,null,null):k.__b>0?v(k.type,k.props,k.key,k.ref?k.ref:null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null}j(n,k,d=d||f,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),\"function\"==typeof k.type&&k.__k===d.__k?k.__d=s=m(k,s,n):s=A(n,k,d,x,b,s),\"function\"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_(d))}for(u.__e=g,h=C;h--;)null!=x[h]&&N(x[h],x[h]);if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h])}function m(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l=\"function\"==typeof i.type?m(i,l,u):A(u,i,i,t,i.__e,l));return l}function x(n,l){return l=l||[],null==n||\"boolean\"==typeof n||(Array.isArray(n)?n.some(function(n){x(n,l)}):l.push(n)),l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else{for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=1)if(f==t)break n;n.insertBefore(t,o),r=o}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)\"children\"===o||\"key\"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&\"function\"!=typeof l[o]||\"children\"===o||\"key\"===o||\"value\"===o||\"checked\"===o||u[o]===l[o]||H(n,o,l[o],u[o],i)}function $(n,l,u){\"-\"===l[0]?n.setProperty(l,u):n[l]=null==u?\"\":\"number\"!=typeof u||c.test(l)?u:u+\"px\"}function H(n,l,u,i,t){var o;n:if(\"style\"===l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof i&&(n.style.cssText=i=\"\"),i)for(l in i)u&&l in u||$(n.style,l,\"\");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l])}else if(\"o\"===l[0]&&\"n\"===l[1])o=l!==(l=l.replace(/Capture$/,\"\")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if(\"dangerouslySetInnerHTML\"!==l){if(t)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"href\"!==l&&\"list\"!==l&&\"form\"!==l&&\"tabIndex\"!==l&&\"download\"!==l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&-1==l.indexOf(\"-\")?n.removeAttribute(l):n.setAttribute(l,u))}}function I(n){this.l[n.type+!1](l.event?l.event(n):n)}function T(n){this.l[n.type+!0](l.event?l.event(n):n)}function j(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H,I,T=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l.__b)&&a(u);try{n:if(\"function\"==typeof T){if(g=u.props,m=(a=T.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:(\"prototype\"in T&&T.prototype.render?u.__c=h=new T(g,x):(u.__c=h=new d(g,x),h.constructor=T,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[],h._sb=[]),null==h.__s&&(h.__s=h.state),null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s({},h.__s)),s(h.__s,T.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(null==T.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){for(h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k)})}if(h.context=x,h.props=g,h.__v=u,h.__P=n,C=l.__r,$=0,\"prototype\"in T&&T.prototype.render){for(h.state=h.__s,h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[]}else do{h.__d=!1,C&&C(u),a=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++$<25);h.state=h.__s,null!=h.getChildContext&&(t=s(s({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),I=null!=a&&a.type===p&&null==a.key?a.props.children:a,w(n,Array.isArray(I)?I:[I],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l.diffed)&&a(u)}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l.__e(n,u,i)}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if(\"svg\"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&\"setAttribute\"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS(\"http://www.w3.org/2000/svg\",d):document.createElement(d,p.is&&p),r=null,c=!1}if(null===d)y===p||c&&l.data===p||(l.data=p);else{if(r=r&&n.call(l.childNodes),h=(y=i.props||f).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||\"\"))}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w(l,Array.isArray(k)?k:[k],u,i,t,o&&\"foreignObject\"!==d,r,e,r?r[0]:i.__k&&_(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a(r[k]);c||(\"value\"in p&&void 0!==(k=p.value)&&(k!==l.value||\"progress\"===d&&!k||\"option\"===d&&k!==y.value)&&H(l,\"value\",k,y.value,!1),\"checked\"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,\"checked\",k,y.checked,!1))}return l}function M(n,u,i){try{\"function\"==typeof n?n(u):n.current=u}catch(n){l.__e(n,i)}}function N(n,u,i){var t,o;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount()}catch(n){l.__e(n,u)}t.base=t.__P=null,n.__c=void 0}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,i||\"function\"!=typeof n.type);i||null==n.__e||a(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l.__&&l.__(u,i),r=(o=\"function\"==typeof t)?null:t&&t.__k||i.__k,e=[],j(i,u=(!o&&t||i).__k=h(p,null,[u]),r||f,f,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z(e,u)}function S(n,l){P(n,l,S)}function q(l,u,i){var t,o,r,f=s({},l.props);for(r in u)\"key\"==r?t=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),v(l.type,f,t||l.key,o||l.ref,null)}function B(n,l){var u={__c:l=\"__cC\"+r++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(b)},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=e.slice,l={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},d.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s({},this.state),\"function\"==typeof n&&(n=n(s({},u),this.props)),n&&s(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),b(this))},d.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b(this))},d.prototype.render=p,t=[],g.__r=0,r=0;export{d as Component,p as Fragment,q as cloneElement,B as createContext,h as createElement,y as createRef,h,S as hydrate,i as isValidElement,l as options,P as render,x as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","// The order of enum items define the processing order of the processor type\n// e.g. Extractor = 0 will be processed before Transformer = 1\nimport { generateUUID, ID } from '../util/id';\nimport { EventEmitter } from '../util/eventEmitter';\nimport { deepEqual } from '../util/deepEqual';\n\nexport enum ProcessorType {\n  Initiator,\n  ServerFilter,\n  ServerSort,\n  ServerLimit,\n  Extractor,\n  Transformer,\n  Filter,\n  Sort,\n  Limit,\n}\n\ninterface PipelineProcessorEvents {\n  propsUpdated: <T, P>(processor: PipelineProcessor<T, P>) => void;\n  beforeProcess: (...args) => void;\n  afterProcess: (...args) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface PipelineProcessorProps {}\n\nexport abstract class PipelineProcessor<\n  T,\n  P extends Partial<PipelineProcessorProps>,\n> extends EventEmitter<PipelineProcessorEvents> {\n  public readonly id: ID;\n  private _props: P;\n\n  abstract get type(): ProcessorType;\n  protected abstract _process(...args): T | Promise<T>;\n  protected validateProps?(...args): void;\n\n  constructor(props?: Partial<P>) {\n    super();\n\n    this._props = {} as P;\n    this.id = generateUUID();\n\n    if (props) this.setProps(props);\n  }\n\n  /**\n   * process is used to call beforeProcess and afterProcess callbacks\n   * This function is just a wrapper that calls _process()\n   *\n   * @param args\n   */\n  process(...args): T | Promise<T> {\n    if (this.validateProps instanceof Function) {\n      this.validateProps(...args);\n    }\n\n    this.emit('beforeProcess', ...args);\n    const result = this._process(...args);\n    this.emit('afterProcess', ...args);\n    return result;\n  }\n\n  setProps(props: Partial<P>): this {\n    const updatedProps = {\n      ...this._props,\n      ...props,\n    };\n\n    if (!deepEqual(updatedProps, this._props)) {\n      this._props = updatedProps;\n      this.emit('propsUpdated', this);\n    }\n\n    return this;\n  }\n\n  get props(): P {\n    return this._props;\n  }\n}\n","export type ID = string;\n\nexport function generateUUID(): ID {\n  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n    const r = (Math.random() * 16) | 0,\n      v = c == 'x' ? r : (r & 0x3) | 0x8;\n    return v.toString(16);\n  });\n}\n","import { generateUUID, ID } from './util/id';\n\nclass Base {\n  private readonly _id: ID;\n\n  constructor(id?: ID) {\n    this._id = id || generateUUID();\n  }\n\n  get id(): ID {\n    return this._id;\n  }\n}\n\nexport default Base;\n","import { h } from 'preact';\n\nexport interface HTMLContentProps {\n  content: string;\n  parentElement?: string;\n}\n\nexport function HTMLElement(props: HTMLContentProps) {\n  return h(props.parentElement || 'span', {\n    dangerouslySetInnerHTML: { __html: props.content },\n  });\n}\n","import { h, VNode } from 'preact';\nimport { HTMLElement } from '../view/htmlElement';\n\nexport function decode(content: string): string {\n  const value = new DOMParser().parseFromString(content, 'text/html');\n  return value.documentElement.textContent;\n}\n\nexport function html(content: string, parentElement?: string): VNode {\n  return h(HTMLElement, { content: content, parentElement: parentElement });\n}\n","import Base from './base';\nimport { TCell } from './types';\nimport { html } from './util/html';\nimport { ComponentChild } from 'preact';\n\nclass Cell extends Base {\n  // because a Cell is a subset of TCell type\n  public data: number | string | boolean | ComponentChild;\n\n  constructor(data: TCell) {\n    super();\n\n    this.update(data);\n  }\n\n  private cast(data: TCell): number | string | boolean | ComponentChild {\n    if (data instanceof HTMLElement) {\n      return html(data.outerHTML);\n    }\n\n    return data;\n  }\n\n  /**\n   * Updates the Cell's data\n   *\n   * @param data\n   */\n  public update(data: TCell): Cell {\n    this.data = this.cast(data);\n    return this;\n  }\n}\n\nexport default Cell;\n","import Cell from './cell';\nimport Base from './base';\nimport { TCell } from './types';\n\nclass Row extends Base {\n  private _cells: Cell[];\n  private _extraData: { [key: string]: any };\n\n  constructor(cells?: Cell[], extraData?: { [key: string]: any }) {\n    super();\n\n    this.cells = cells || [];\n    this._extraData = extraData || {};\n  }\n\n  public cell(index: number): Cell {\n    return this._cells[index];\n  }\n\n  public get cells(): Cell[] {\n    return this._cells;\n  }\n\n  public set cells(cells: Cell[]) {\n    this._cells = cells;\n  }\n\n  public get extraData(): { [key: string]: any } {\n    return this._extraData;\n  }\n\n  public set extraData(extraData: { [key: string]: any }) {\n    this._extraData = extraData;\n  }\n\n  public getExtraData(key: string): any {\n    return this._extraData[key];\n  }\n\n  public setExtraData(key: string, value: any): void {\n    this._extraData[key] = value;\n  }\n\n  public toArray(): TCell[] {\n    return this.cells.map((cell) => cell.data);\n  }\n\n  /**\n   * Creates a new Row from an array of Cell(s)\n   * This method generates a new ID for the Row and all nested elements\n   *\n   * @param cells\n   * @param extraData\n   * @returns Row\n   */\n  static fromCells(cells: Cell[], extraData?: { [key: string]: any }): Row {\n    return new Row(\n      cells.map((cell) => new Cell(cell.data)),\n      extraData,\n    );\n  }\n\n  get length(): number {\n    return this.cells.length;\n  }\n}\n\nexport default Row;\n","import Base from './base';\nimport Row from './row';\nimport Cell from './cell';\nimport { OneDArray, TCell, TwoDArray } from './types';\nimport { oneDtoTwoD } from './util/array';\n\nclass Tabular extends Base {\n  private _rows: Row[];\n  private _length: number;\n\n  constructor(rows?: Row[] | Row) {\n    super();\n\n    if (rows instanceof Array) {\n      this.rows = rows;\n    } else if (rows instanceof Row) {\n      this.rows = [rows];\n    } else {\n      this.rows = [];\n    }\n  }\n\n  get rows(): Row[] {\n    return this._rows;\n  }\n\n  set rows(rows: Row[]) {\n    this._rows = rows;\n  }\n\n  get length(): number {\n    return this._length || this.rows.length;\n  }\n\n  // we want to sent the length when storage is ServerStorage\n  set length(len: number) {\n    this._length = len;\n  }\n\n  public toArray(): TCell[][] {\n    return this.rows.map((row) => row.toArray());\n  }\n\n  /**\n   * Creates a new Tabular from an array of Row(s)\n   * This method generates a new ID for the Tabular and all nested elements\n   *\n   * @param rows\n   * @returns Tabular\n   */\n  static fromRows(rows: Row[]): Tabular {\n    return new Tabular(rows.map((row) => Row.fromCells(row.cells)));\n  }\n\n  /**\n   * Creates a new Tabular from a 2D array\n   * This method generates a new ID for the Tabular and all nested elements\n   *\n   * @param data\n   * @returns Tabular\n   */\n  static fromArray<T extends TCell>(\n    data: OneDArray<T> | TwoDArray<T>,\n  ): Tabular {\n    data = oneDtoTwoD(data);\n\n    return new Tabular(\n      data.map((row) => new Row(row.map((cell) => new Cell(cell)))),\n    );\n  }\n}\n\nexport default Tabular;\n","import { OneDArray, TwoDArray } from '../types';\n\nexport function oneDtoTwoD<T>(data: OneDArray<T> | TwoDArray<T>): TwoDArray<T> {\n  if (data[0] && !(data[0] instanceof Array)) {\n    return [data] as TwoDArray<T>;\n  }\n\n  return data as TwoDArray<T>;\n}\n\nexport function flatten<T>(arrays: TwoDArray<T>): OneDArray<T> {\n  return arrays.reduce((prev, x) => prev.concat(x), []);\n}\n","type EventArgs<T> = [T] extends [(...args: infer U) => any]\n  ? U\n  : [T] extends [void]\n  ? []\n  : [T];\n\n/**\n * Example:\n *\n * export interface BaseEvents<P, S> {\n *   SET_STATE: (component: BaseComponent<P, S>, state: S) => void;\n * }\n */\n\nexport interface EventEmitter<EventTypes> {\n  addListener<EventName extends keyof EventTypes>(\n    event: EventName,\n    listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n  ): EventEmitter<EventTypes>;\n\n  on<EventName extends keyof EventTypes>(\n    event: EventName,\n    listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n  ): EventEmitter<EventTypes>;\n\n  off<EventName extends keyof EventTypes>(\n    event: EventName,\n    listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n  ): EventEmitter<EventTypes>;\n\n  emit<EventName extends keyof EventTypes>(\n    event: EventName,\n    ...args: EventArgs<EventTypes[EventName]>\n  ): boolean;\n}\n\nexport class EventEmitter<EventTypes> {\n  private callbacks: { [event: string]: ((...args) => void)[] };\n\n  // because we are using EventEmitter as a mixin and the\n  // constructor won't be called by the applyMixins function\n  // see src/base.ts and src/util/applyMixin.ts\n  private init(event?: string): void {\n    if (!this.callbacks) {\n      this.callbacks = {};\n    }\n\n    if (event && !this.callbacks[event]) {\n      this.callbacks[event] = [];\n    }\n  }\n\n  listeners(): { [event: string]: ((...args) => void)[] } {\n    return this.callbacks;\n  }\n\n  on<EventName extends keyof EventTypes>(\n    event: EventName,\n    listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n  ): EventEmitter<EventTypes> {\n    this.init(event as string);\n    this.callbacks[event as string].push(listener);\n    return this;\n  }\n\n  off<EventName extends keyof EventTypes>(\n    event: EventName,\n    listener: (...args: EventArgs<EventTypes[EventName]>) => void,\n  ): EventEmitter<EventTypes> {\n    const eventName = event as string;\n\n    this.init();\n\n    if (!this.callbacks[eventName] || this.callbacks[eventName].length === 0) {\n      // there is no callbacks with this key\n      return this;\n    }\n\n    this.callbacks[eventName] = this.callbacks[eventName].filter(\n      (value) => value != listener,\n    );\n\n    return this;\n  }\n\n  emit<EventName extends keyof EventTypes>(\n    event: EventName,\n    ...args: EventArgs<EventTypes[EventName]>\n  ): boolean {\n    const eventName = event as string;\n\n    this.init(eventName);\n\n    if (this.callbacks[eventName].length > 0) {\n      this.callbacks[eventName].forEach((value) => value(...args));\n      return true;\n    }\n\n    return false;\n  }\n}\n","/**\n * Returns true if both objects are equal\n * @param a left object\n * @param b right object\n * @returns\n */\nexport function deepEqual<A, B>(obj1: A, obj2: B) {\n  // If objects are not the same type, return false\n  if (typeof obj1 !== typeof obj2) {\n    return false;\n  }\n  // If objects are both null or undefined, return true\n  if (obj1 === null && obj2 === null) {\n    return true;\n  }\n  // If objects are both primitive types, compare them directly\n  if (typeof obj1 !== 'object') {\n    // eslint-disable-next-line\n    // @ts-ignore\n    return obj1 === obj2;\n  }\n  // If objects are arrays, compare their elements recursively\n  if (Array.isArray(obj1) && Array.isArray(obj2)) {\n    if (obj1.length !== obj2.length) {\n      return false;\n    }\n    for (let i = 0; i < obj1.length; i++) {\n      if (!deepEqual(obj1[i], obj2[i])) {\n        return false;\n      }\n    }\n    return true;\n  }\n  // If objects are VNodes, compare their props only\n  if (\n    // eslint-disable-next-line no-prototype-builtins\n    obj1.hasOwnProperty('constructor') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj2.hasOwnProperty('constructor') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj1.hasOwnProperty('props') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj2.hasOwnProperty('props') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj1.hasOwnProperty('key') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj2.hasOwnProperty('key') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj1.hasOwnProperty('ref') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj2.hasOwnProperty('ref') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj1.hasOwnProperty('type') &&\n    // eslint-disable-next-line no-prototype-builtins\n    obj2.hasOwnProperty('type')\n  ) {\n    return deepEqual(obj1['props'], obj2['props']);\n  }\n  // If objects are both objects, compare their properties recursively\n  const keys1 = Object.keys(obj1);\n  const keys2 = Object.keys(obj2);\n  if (keys1.length !== keys2.length) {\n    return false;\n  }\n  for (const key of keys1) {\n    // eslint-disable-next-line no-prototype-builtins\n    if (!obj2.hasOwnProperty(key) || !deepEqual(obj1[key], obj2[key])) {\n      return false;\n    }\n  }\n  return true;\n}\n","import search from '../../operator/search';\nimport Tabular from '../../tabular';\nimport {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\nimport { OneDArray, TCell, TColumn } from '../../types';\n\ninterface GlobalSearchFilterProps extends PipelineProcessorProps {\n  keyword: string;\n  columns: OneDArray<TColumn>;\n  ignoreHiddenColumns: boolean;\n  selector?: (cell: TCell, rowIndex: number, cellIndex: number) => string;\n}\n\nclass GlobalSearchFilter extends PipelineProcessor<\n  Tabular,\n  GlobalSearchFilterProps\n> {\n  get type(): ProcessorType {\n    return ProcessorType.Filter;\n  }\n\n  _process(data: Tabular): Tabular {\n    if (this.props.keyword) {\n      return search(\n        String(this.props.keyword).trim(),\n        this.props.columns,\n        this.props.ignoreHiddenColumns,\n        data,\n        this.props.selector,\n      );\n    }\n\n    return data;\n  }\n}\n\nexport default GlobalSearchFilter;\n","import Tabular from '../tabular';\nimport { VNode } from 'preact';\nimport { HTMLContentProps } from '../view/htmlElement';\nimport { OneDArray, TCell, TColumn } from '../types';\n\nexport default function (\n  keyword: string,\n  columns: OneDArray<TColumn>,\n  ignoreHiddenColumns: boolean,\n  tabular: Tabular,\n  selector?: (cell: TCell, rowIndex: number, cellIndex: number) => string,\n): Tabular {\n  // escape special regex chars\n  keyword = keyword.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&');\n\n  return new Tabular(\n    tabular.rows.filter((row, rowIndex) =>\n      row.cells.some((cell, cellIndex) => {\n        if (!cell) {\n          return false;\n        }\n\n        if (ignoreHiddenColumns) {\n          if (\n            columns &&\n            columns[cellIndex] &&\n            typeof columns[cellIndex] === 'object'\n          ) {\n            const typedColumn = columns[cellIndex] as TColumn;\n            if (typedColumn.hidden) {\n              return false;\n            }\n          }\n        }\n\n        let data = '';\n\n        if (typeof selector === 'function') {\n          data = selector(cell.data, rowIndex, cellIndex);\n        } else if (typeof cell.data === 'object') {\n          // HTMLContent element\n          const element = cell.data as VNode<HTMLContentProps>;\n          if (element && element.props && element.props.content) {\n            // TODO: we should only search in the content of the element. props.content is the entire HTML element\n            data = element.props.content;\n          }\n        } else {\n          // primitive types\n          data = String(cell.data);\n        }\n\n        return new RegExp(keyword, 'gi').test(data);\n      }),\n    ),\n  );\n}\n","import { JSXInternal } from 'preact/src/jsx';\n\nexport function className(...args: string[]): string {\n  const prefix = 'gridjs';\n\n  return `${prefix}${args.reduce(\n    (prev: string, cur: string) => `${prev}-${cur}`,\n    '',\n  )}`;\n}\n\nexport function classJoin(\n  ...classNames: (undefined | string | JSXInternal.SignalLike<string>)[]\n): string {\n  return classNames\n    .map((x) => (x ? x.toString() : ''))\n    .filter((x) => x)\n    .reduce((className, prev) => `${className || ''} ${prev}`, '')\n    .trim();\n}\n","import {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\n\ninterface ServerGlobalSearchFilterProps extends PipelineProcessorProps {\n  keyword?: string;\n  url?: (prevUrl: string, keyword: string) => string;\n  body?: (prevBody: BodyInit, keyword: string) => BodyInit;\n}\n\nclass ServerGlobalSearchFilter extends PipelineProcessor<\n  ServerStorageOptions,\n  ServerGlobalSearchFilterProps\n> {\n  get type(): ProcessorType {\n    return ProcessorType.ServerFilter;\n  }\n\n  _process(options?: ServerStorageOptions): ServerStorageOptions {\n    if (!this.props.keyword) return options;\n\n    const updates = {};\n\n    if (this.props.url) {\n      updates['url'] = this.props.url(options.url, this.props.keyword);\n    }\n\n    if (this.props.body) {\n      updates['body'] = this.props.body(options.body, this.props.keyword);\n    }\n\n    return {\n      ...options,\n      ...updates,\n    };\n  }\n}\n\nexport default ServerGlobalSearchFilter;\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=[],e=n.__b,a=n.__r,v=n.diffed,l=n.__c,m=n.unmount;function d(t,u){n.__h&&n.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function p(n){return o=1,y(B,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){r.u=!0;var f=r.shouldComponentUpdate;r.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!f||f.call(this,n,t,r))}}return o.__N||o.__}function h(u,i){var o=d(t++,3);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function s(u,i){var o=d(t++,4);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,s(function(){return\"function\"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){n.useDebugValue&&n.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=p();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],n.__e(r,t.__v)}}n.__b=function(n){r=null,e&&e(n)},n.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r},n.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===n.requestAnimationFrame||((i=n.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},n.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],n.__e(u,t.__v)}}),l&&l(t,r)},n.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&n.__e(r,u.__v))};var g=\"function\"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return\"function\"==typeof t?t(n):t}export{T as useCallback,q as useContext,x as useDebugValue,h as useEffect,P as useErrorBoundary,V as useId,A as useImperativeHandle,s as useLayoutEffect,F as useMemo,y as useReducer,_ as useRef,p as useState};\n//# sourceMappingURL=hooks.module.js.map\n","import { useContext } from 'preact/hooks';\nimport { Config, ConfigContext } from '../config';\n\nexport function useConfig(): Config {\n  return useContext(ConfigContext);\n}\n","export default {\n  search: {\n    placeholder: 'Type a keyword...',\n  },\n  sort: {\n    sortAsc: 'Sort column ascending',\n    sortDesc: 'Sort column descending',\n  },\n  pagination: {\n    previous: 'Previous',\n    next: 'Next',\n    navigate: (page, pages) => `Page ${page} of ${pages}`,\n    page: (page) => `Page ${page}`,\n    showing: 'Showing',\n    of: 'of',\n    to: 'to',\n    results: 'results',\n  },\n  loading: 'Loading...',\n  noRecordsFound: 'No matching records found',\n  error: 'An error happened while fetching the data',\n};\n","import { useConfig } from '../hooks/useConfig';\nimport enUS from './en_US';\ntype MessageFormat = (...args) => string;\ntype Message = string | MessageFormat;\nexport type Language = { [key: string]: Message | Language };\n\nexport class Translator {\n  private readonly _language: Language;\n  private readonly _defaultLanguage: Language;\n\n  constructor(language?: Language) {\n    this._language = language;\n    this._defaultLanguage = enUS;\n  }\n\n  /**\n   * Tries to split the message with \".\" and find\n   * the key in the given language\n   *\n   * @param message\n   * @param lang\n   */\n  getString(message: string, lang: Language): MessageFormat {\n    if (!lang || !message) return null;\n\n    const splitted = message.split('.');\n    const key = splitted[0];\n\n    if (key in lang) {\n      const val = lang[key];\n\n      if (typeof val === 'string') {\n        return (): string => val;\n      } else if (typeof val === 'function') {\n        return val;\n      } else {\n        return this.getString(splitted.slice(1).join('.'), val);\n      }\n    }\n\n    return null;\n  }\n\n  translate(message: string, ...args): string {\n    const translated = this.getString(message, this._language);\n    let messageFormat;\n\n    if (translated) {\n      messageFormat = translated;\n    } else {\n      messageFormat = this.getString(message, this._defaultLanguage);\n    }\n\n    if (messageFormat) {\n      return messageFormat(...args);\n    }\n\n    return message;\n  }\n}\n\nexport function useTranslator() {\n  const config = useConfig();\n\n  return function (message: string, ...args): string {\n    return config.translator.translate(message, ...args);\n  };\n}\n","export const SearchKeyword = (payload) => (state) => {\n  return {\n    ...state,\n    search: {\n      keyword: payload,\n    },\n  };\n};\n","import { useConfig } from './useConfig';\n\nexport function useStore() {\n  const config = useConfig();\n  return config.store;\n}\n","import { useEffect, useState } from 'preact/hooks';\nimport { useStore } from './useStore';\n\nexport default function useSelector<T>(selector: (state) => T) {\n  const store = useStore();\n  const [current, setCurrent] = useState(selector(store.getState()));\n\n  useEffect(() => {\n    const unsubscribe = store.subscribe(() => {\n      const updated = selector(store.getState());\n\n      if (current !== updated) {\n        setCurrent(updated);\n      }\n    });\n\n    return unsubscribe;\n  }, []);\n\n  return current;\n}\n","import { h, JSX } from 'preact';\nimport GlobalSearchFilter from '../../../pipeline/filter/globalSearch';\nimport { classJoin, className } from '../../../util/className';\nimport ServerGlobalSearchFilter from '../../../pipeline/filter/serverGlobalSearch';\nimport { TCell } from '../../../types';\nimport { useConfig } from '../../../hooks/useConfig';\nimport { useCallback, useEffect, useState } from 'preact/hooks';\nimport { useTranslator } from '../../../i18n/language';\nimport * as actions from './actions';\nimport { useStore } from '../../../hooks/useStore';\nimport useSelector from '../../../hooks/useSelector';\nimport { debounce } from '../../../util/debounce';\n\nexport interface SearchConfig {\n  keyword?: string;\n  ignoreHiddenColumns?: boolean;\n  debounceTimeout?: number;\n  selector?: (cell: TCell, rowIndex: number, cellIndex: number) => string;\n  server?: {\n    url?: (prevUrl: string, keyword: string) => string;\n    body?: (prevBody: BodyInit, keyword: string) => BodyInit;\n  };\n}\n\nexport function Search() {\n  const [processor, setProcessor] = useState<\n    GlobalSearchFilter | ServerGlobalSearchFilter\n  >(undefined);\n  const config = useConfig();\n  const props = config.search as SearchConfig;\n  const _ = useTranslator();\n  const { dispatch } = useStore();\n  const state = useSelector((state) => state.search);\n\n  useEffect(() => {\n    if (!processor) return;\n\n    processor.setProps({\n      keyword: state?.keyword,\n    });\n  }, [state, processor]);\n\n  useEffect(() => {\n    if (props.server) {\n      setProcessor(\n        new ServerGlobalSearchFilter({\n          keyword: props.keyword,\n          url: props.server.url,\n          body: props.server.body,\n        }),\n      );\n    } else {\n      setProcessor(\n        new GlobalSearchFilter({\n          keyword: props.keyword,\n          columns: config.header && config.header.columns,\n          ignoreHiddenColumns:\n            props.ignoreHiddenColumns ||\n            props.ignoreHiddenColumns === undefined,\n          selector: props.selector,\n        }),\n      );\n    }\n\n    // initial search\n    if (props.keyword) dispatch(actions.SearchKeyword(props.keyword));\n  }, [props]);\n\n  useEffect(() => {\n    if (!processor) return undefined;\n\n    config.pipeline.register<object, object>(processor);\n\n    return () => config.pipeline.unregister<object, object>(processor);\n  }, [config, processor]);\n\n  const debouncedOnInput = useCallback(\n    debounce(\n      (event: JSX.TargetedEvent<HTMLInputElement>) => {\n        if (event.target instanceof HTMLInputElement) {\n          dispatch(actions.SearchKeyword(event.target.value));\n        }\n      },\n      processor instanceof ServerGlobalSearchFilter\n        ? props.debounceTimeout || 250\n        : 0,\n    ),\n    [props, processor],\n  );\n\n  return (\n    <div className={className(classJoin('search', config.className?.search))}>\n      <input\n        type=\"search\"\n        placeholder={_('search.placeholder')}\n        aria-label={_('search.placeholder')}\n        onInput={debouncedOnInput}\n        className={classJoin(className('input'), className('search', 'input'))}\n        defaultValue={state?.keyword || ''}\n      />\n    </div>\n  );\n}\n","export const debounce = <F extends (...args: any[]) => any>(\n  func: F,\n  waitFor: number,\n) => {\n  let timeout;\n\n  return (...args: Parameters<F>): Promise<ReturnType<F>> =>\n    new Promise((resolve) => {\n      if (timeout) {\n        clearTimeout(timeout);\n      }\n\n      timeout = setTimeout(() => resolve(func(...args)), waitFor);\n    });\n};\n","import Tabular from '../../tabular';\nimport {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\n\ninterface PaginationLimitProps extends PipelineProcessorProps {\n  page: number;\n  limit: number;\n}\n\nclass PaginationLimit extends PipelineProcessor<Tabular, PaginationLimitProps> {\n  protected validateProps(): void {\n    if (isNaN(Number(this.props.limit)) || isNaN(Number(this.props.page))) {\n      throw Error('Invalid parameters passed');\n    }\n  }\n\n  get type(): ProcessorType {\n    return ProcessorType.Limit;\n  }\n\n  protected _process(data: Tabular): Tabular {\n    if (this.props.limit === -1) {\n      return new Tabular(data.rows);\n    }\n\n    const page = this.props.page;\n    const start = page * this.props.limit;\n    const end = (page + 1) * this.props.limit;\n\n    return new Tabular(data.rows.slice(start, end));\n  }\n}\n\nexport default PaginationLimit;\n","import {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\n\ninterface ServerPaginationLimitProps extends PipelineProcessorProps {\n  page: number;\n  limit: number;\n  url?: (prevUrl: string, page: number, limit: number) => string;\n  body?: (prevBody: BodyInit, page: number, limit: number) => BodyInit;\n}\n\nclass ServerPaginationLimit extends PipelineProcessor<\n  ServerStorageOptions,\n  ServerPaginationLimitProps\n> {\n  get type(): ProcessorType {\n    return ProcessorType.ServerLimit;\n  }\n\n  _process(options?: ServerStorageOptions): ServerStorageOptions {\n    const updates = {};\n\n    if (this.props.url) {\n      updates['url'] = this.props.url(\n        options.url,\n        this.props.page,\n        this.props.limit,\n      );\n    }\n\n    if (this.props.body) {\n      updates['body'] = this.props.body(\n        options.body,\n        this.props.page,\n        this.props.limit,\n      );\n    }\n\n    return {\n      ...options,\n      ...updates,\n    };\n  }\n}\n\nexport default ServerPaginationLimit;\n","export const SetPaginationInfo = (page: number, limit: number) => (state) => {\n  return {\n    ...state,\n    pagination: {\n      page,\n      limit,\n    },\n  };\n};\n","import { h, Fragment } from 'preact';\nimport PaginationLimit from '../../../pipeline/limit/pagination';\nimport { classJoin, className } from '../../../util/className';\nimport ServerPaginationLimit from '../../../pipeline/limit/serverPagination';\nimport { useConfig } from '../../../hooks/useConfig';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useTranslator } from '../../../i18n/language';\nimport * as actions from './actions';\n\nexport interface PaginationConfig {\n  limit?: number;\n  page?: number;\n  summary?: boolean;\n  nextButton?: boolean;\n  prevButton?: boolean;\n  buttonsCount?: number;\n  resetPageOnUpdate?: boolean;\n  server?: {\n    url?: (prevUrl: string, page: number, limit: number) => string;\n    body?: (prevBody: BodyInit, page: number, limit: number) => BodyInit;\n  };\n  perPageSelect?: (number | [string, number])[] | false;\n}\n\nexport function Pagination() {\n  const config = useConfig();\n  const {\n    server,\n    summary = true,\n    nextButton = true,\n    prevButton = true,\n    buttonsCount = 3,\n    limit = 10,\n    page = 0,\n    perPageSelect = [5, 10, 25, 50, ['All', -1]],\n    resetPageOnUpdate = true,\n  } = config.pagination as PaginationConfig;\n\n  const processor = useRef<PaginationLimit | ServerPaginationLimit>(null);\n  const [currentPage, setCurrentPage] = useState(page);\n  const [total, setTotal] = useState(0);\n  const [perPageOption, setPerPageOption] = useState(limit);\n  const _ = useTranslator();\n\n  const dispatch = (action) => config.store.dispatch(action);\n\n  useEffect(() => {\n    dispatch(actions.SetPaginationInfo(currentPage, perPageOption));\n\n    if (server) {\n      processor.current = new ServerPaginationLimit({\n        limit: limit,\n        page: currentPage,\n        url: server.url,\n        body: server.body,\n      });\n\n      config.pipeline.register(processor.current);\n    } else {\n      processor.current = new PaginationLimit({\n        limit: limit,\n        page: currentPage,\n      });\n\n      config.pipeline.register(processor.current);\n    }\n\n    if (processor.current instanceof ServerPaginationLimit) {\n      config.pipeline.on('afterProcess', (tabular) => setTotal(tabular.length));\n    } else if (processor.current instanceof PaginationLimit) {\n      // Pagination (all Limit processors) is the last step in the pipeline\n      // and we assume that at this stage, we have the rows that we care about.\n      // Let's grab the rows before processing Pagination and set total number of rows\n      processor.current.on('beforeProcess', (tabular) =>\n        setTotal(tabular.length),\n      );\n    }\n\n    config.pipeline.on('updated', onUpdate);\n\n    // we need to make sure that the state is set\n    // to the default props when an error happens\n    config.pipeline.on('error', () => {\n      setTotal(0);\n      setCurrentPage(0);\n    });\n\n    return () => {\n      config.pipeline.unregister<object, object>(processor.current);\n      config.pipeline.off('updated', onUpdate);\n    };\n  }, []);\n\n  const onUpdate = (updatedProcessor) => {\n    // this is to ensure that the current page is set to 0\n    // when a processor is updated for some reason\n    if (resetPageOnUpdate && updatedProcessor !== processor.current) {\n      setCurrentPage(0);\n\n      if (processor.current.props.page !== 0) {\n        processor.current.setProps({\n          page: 0,\n        });\n      }\n\n      dispatch(actions.SetPaginationInfo(0, perPageOption));\n    }\n  };\n\n  const pages = () => Math.max(Math.ceil(total / perPageOption), 1);\n\n  const setPage = (page: number) => {\n    if (page >= pages() || page < 0 || page === currentPage) {\n      return null;\n    }\n\n    setCurrentPage(page);\n\n    processor.current.setProps({\n      page: page,\n    });\n\n    dispatch(actions.SetPaginationInfo(page, perPageOption));\n  };\n\n  const setPerPage = (perPage: number) => {\n    if (perPage === perPageOption) {\n      return null;\n    }\n\n    setPerPageOption(perPage);\n    setPage(0);\n\n    processor.current.setProps({\n      limit: perPage,\n    });\n\n    dispatch(actions.SetPaginationInfo(0, perPage));\n  };\n\n  const renderPages = () => {\n    if (buttonsCount <= 0) {\n      return null;\n    }\n\n    // how many pagination buttons to render?\n    const maxCount: number = Math.min(pages(), buttonsCount);\n\n    let pagePivot = Math.min(currentPage, Math.floor(maxCount / 2));\n    if (currentPage + Math.floor(maxCount / 2) >= pages()) {\n      pagePivot = maxCount - (pages() - currentPage);\n    }\n\n    return (\n      <Fragment>\n        {pages() > maxCount && currentPage - pagePivot > 0 && (\n          <Fragment>\n            <button\n              tabIndex={0}\n              role=\"button\"\n              type=\"button\"\n              onClick={() => setPage(0)}\n              title={_('pagination.firstPage')}\n              aria-label={_('pagination.firstPage')}\n              className={config.className.paginationButton}\n            >\n              {_('1')}\n            </button>\n            <button\n              tabIndex={-1}\n              className={classJoin(\n                className('spread'),\n                config.className.paginationButton,\n              )}\n            >\n              ...\n            </button>\n          </Fragment>\n        )}\n\n        {Array.from(Array(maxCount).keys())\n          .map((i) => currentPage + (i - pagePivot))\n          .map((i) => (\n            <button\n              tabIndex={0}\n              role=\"button\"\n              type=\"button\"\n              onClick={() => setPage(i)}\n              className={classJoin(\n                currentPage === i\n                  ? classJoin(\n                      className('currentPage'),\n                      config.className.paginationButtonCurrent,\n                    )\n                  : null,\n                config.className.paginationButton,\n              )}\n              title={_('pagination.page', i + 1)}\n              aria-label={_('pagination.page', i + 1)}\n            >\n              {_(`${i + 1}`)}\n            </button>\n          ))}\n\n        {pages() > maxCount && pages() > currentPage + pagePivot + 1 && (\n          <Fragment>\n            <button\n              tabIndex={-1}\n              className={classJoin(\n                className('spread'),\n                config.className.paginationButton,\n              )}\n            >\n              ...\n            </button>\n            <button\n              tabIndex={0}\n              role=\"button\"\n              type=\"button\"\n              onClick={() => setPage(pages() - 1)}\n              title={_('pagination.page', pages())}\n              aria-label={_('pagination.page', pages())}\n              className={config.className.paginationButton}\n            >\n              {_(`${pages()}`)}\n            </button>\n          </Fragment>\n        )}\n      </Fragment>\n    );\n  };\n\n  const renderSummary = () => {\n    return (\n      <Fragment>\n        {summary && total > 0 && (\n          <div\n            role=\"status\"\n            aria-live=\"polite\"\n            className={classJoin(\n              className('summary'),\n              config.className.paginationSummary,\n            )}\n            title={_('pagination.navigate', currentPage + 1, pages())}\n          >\n            {_('pagination.showing')}{' '}\n            <b>\n              {_(\n                `${perPageOption === -1 ? 1 : currentPage * perPageOption + 1}`,\n              )}\n            </b>{' '}\n            {_('pagination.to')}{' '}\n            <b>\n              {_(\n                `${\n                  perPageOption === -1\n                    ? total\n                    : Math.min((currentPage + 1) * perPageOption, total)\n                }`,\n              )}\n            </b>{' '}\n            {_('pagination.of')} <b>{_(`${total}`)}</b>{' '}\n            {_('pagination.results')}\n            {perPageSelect && (\n              <p id=\"grid-js-per-page-select\">\n                {_('pagination.showing')}{' '}\n                <select\n                  name=\"gridjs\"\n                  className={classJoin(\n                    className('per-page-select'),\n                    config.className.paginationPerPageSelect,\n                  )}\n                  value={perPageOption}\n                  onChange={(e) =>\n                    setPerPage(parseInt((e.target as HTMLInputElement).value))\n                  }\n                  aria-labelledby=\"grid-js-per-page-select\"\n                >\n                  {perPageSelect.map(\n                    (perPage: number | [string, number], index) =>\n                      Array.isArray(perPage) ? (\n                        <option key={index} value={perPage[1]}>\n                          {perPage[0]}\n                        </option>\n                      ) : (\n                        <option key={index} value={perPage}>\n                          {perPage}\n                        </option>\n                      ),\n                  )}\n                </select>{' '}\n                {_('pagination.results')}\n              </p>\n            )}\n          </div>\n        )}\n      </Fragment>\n    );\n  };\n\n  return (\n    <div\n      className={classJoin(\n        className('pagination'),\n        config.className.pagination,\n      )}\n    >\n      {renderSummary()}\n\n      <div className={className('pages')}>\n        {prevButton && (\n          <button\n            tabIndex={0}\n            role=\"button\"\n            type=\"button\"\n            disabled={currentPage === 0}\n            onClick={() => setPage(currentPage - 1)}\n            title={_('pagination.previous')}\n            aria-label={_('pagination.previous')}\n            className={classJoin(\n              config.className.paginationButton,\n              config.className.paginationButtonPrev,\n            )}\n          >\n            {_('pagination.previous')}\n          </button>\n        )}\n\n        {renderPages()}\n\n        {nextButton && (\n          <button\n            tabIndex={0}\n            role=\"button\"\n            type=\"button\"\n            disabled={pages() === currentPage + 1 || pages() === 0}\n            onClick={() => setPage(currentPage + 1)}\n            title={_('pagination.next')}\n            aria-label={_('pagination.next')}\n            className={classJoin(\n              config.className.paginationButton,\n              config.className.paginationButtonNext,\n            )}\n          >\n            {_('pagination.next')}\n          </button>\n        )}\n      </div>\n    </div>\n  );\n}\n","export function width(width: string | number, containerWidth?: number): number {\n  if (typeof width == 'string') {\n    if (width.indexOf('%') > -1) {\n      return (containerWidth / 100) * parseInt(width, 10);\n    } else {\n      return parseInt(width, 10);\n    }\n  }\n\n  return width;\n}\n\nexport function px(width: number): string {\n  if (!width) return '';\n  return `${Math.floor(width)}px`;\n}\n","import { h } from 'preact';\nimport { className } from '../../util/className';\n\n/**\n * ShadowTable renders a hidden table and is used to calculate the column's width\n * when autoWidth option is enabled\n */\nexport function ShadowTable(props: { tableRef: HTMLTableElement }) {\n  const shadowTable = props.tableRef.cloneNode(true) as HTMLTableElement;\n\n  shadowTable.style.position = 'absolute';\n  shadowTable.style.width = '100%';\n  shadowTable.style.zIndex = '-2147483640';\n  shadowTable.style.visibility = 'hidden';\n\n  return (\n    <div\n      ref={(nodeElement) => {\n        nodeElement && nodeElement.appendChild(shadowTable);\n      }}\n    />\n  );\n}\n\nexport function getShadowTableWidths(tempRef: HTMLDivElement): {\n  [columnId: string]: { minWidth: number; width: number };\n} {\n  const tableElement: HTMLTableElement = tempRef.querySelector(\n    'table',\n  ) as HTMLTableElement;\n\n  if (!tableElement) {\n    return {};\n  }\n\n  const tableClassName = tableElement.className;\n  const tableStyle = tableElement.style.cssText;\n  tableElement.className = `${tableClassName} ${className('shadowTable')}`;\n\n  tableElement.style.tableLayout = 'auto';\n  tableElement.style.width = 'auto';\n  tableElement.style.padding = '0';\n  tableElement.style.margin = '0';\n  tableElement.style.border = 'none';\n  tableElement.style.outline = 'none';\n\n  let obj = Array.from(\n    tableElement.parentNode.querySelectorAll<HTMLElement>('thead th'),\n  ).reduce((prev, current) => {\n    current.style.width = `${current.clientWidth}px`;\n\n    return {\n      [current.getAttribute('data-column-id')]: {\n        minWidth: current.clientWidth,\n      },\n      ...prev,\n    };\n  }, {});\n\n  tableElement.className = tableClassName;\n  tableElement.style.cssText = tableStyle;\n  tableElement.style.tableLayout = 'auto';\n\n  obj = Array.from(\n    tableElement.parentNode.querySelectorAll<HTMLElement>('thead th'),\n  ).reduce((prev, current) => {\n    prev[current.getAttribute('data-column-id')]['width'] = current.clientWidth;\n\n    return prev;\n  }, obj);\n\n  return obj;\n}\n","export function camelCase(str: string): string {\n  if (!str) return '';\n\n  const words = str.split(' ');\n\n  // do not convert strings that are already in camelCase format\n  if (words.length === 1 && /([a-z][A-Z])+/g.test(str)) {\n    return str;\n  }\n\n  return words\n    .map(function (word, index) {\n      // if it is the first word, lowercase all the chars\n      if (index == 0) {\n        return word.toLowerCase();\n      }\n\n      // if it is not the first word only upper case the first char and lowercase the rest\n      return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n    })\n    .join('');\n}\n","/**\n * Centralized logging lib\n *\n * This class needs some improvements but so far it has been used to have a coherent way to log\n */\nclass Logger {\n  private format(message: string, type: string): string {\n    return `[Grid.js] [${type.toUpperCase()}]: ${message}`;\n  }\n\n  error(message: string, throwException = false): void {\n    const msg = this.format(message, 'error');\n\n    if (throwException) {\n      throw Error(msg);\n    } else {\n      console.error(msg);\n    }\n  }\n\n  warn(message: string): void {\n    console.warn(this.format(message, 'warn'));\n  }\n\n  info(message: string): void {\n    console.info(this.format(message, 'info'));\n  }\n}\n\nexport default new Logger();\n","import { Fragment, FunctionComponent, h } from 'preact';\nimport { useConfig } from './hooks/useConfig';\nimport log from './util/log';\n\nexport enum PluginPosition {\n  Header,\n  Footer,\n  Cell,\n}\n\nexport interface Plugin<T extends FunctionComponent> {\n  id: string;\n  position: PluginPosition;\n  component: T;\n  order?: number;\n}\n\nexport class PluginManager {\n  private readonly plugins: Plugin<any>[];\n\n  constructor() {\n    this.plugins = [];\n  }\n\n  get<T extends FunctionComponent>(id: string): Plugin<T> | undefined {\n    return this.plugins.find((p) => p.id === id);\n  }\n\n  add<T extends FunctionComponent<any>>(plugin: Plugin<T>): this {\n    if (!plugin.id) {\n      log.error('Plugin ID cannot be empty');\n      return this;\n    }\n\n    if (this.get(plugin.id)) {\n      log.error(`Duplicate plugin ID: ${plugin.id}`);\n      return this;\n    }\n\n    this.plugins.push(plugin);\n    return this;\n  }\n\n  remove(id: string): this {\n    const plugin = this.get(id);\n\n    if (plugin) {\n      this.plugins.splice(this.plugins.indexOf(plugin), 1);\n    }\n\n    return this;\n  }\n\n  list<T extends FunctionComponent>(position?: PluginPosition): Plugin<T>[] {\n    let plugins: Plugin<T>[];\n\n    if (position != null || position != undefined) {\n      plugins = this.plugins.filter((p) => p.position === position);\n    } else {\n      plugins = this.plugins;\n    }\n\n    return plugins.sort((a, b) => (a.order && b.order ? a.order - b.order : 1));\n  }\n}\n\nexport function PluginRenderer(props: {\n  props?: any;\n  // to render a single plugin\n  pluginId?: string;\n  // to render all plugins in this PluginPosition\n  position?: PluginPosition;\n}) {\n  const config = useConfig();\n\n  if (props.pluginId) {\n    // render a single plugin\n    const plugin = config.plugin.get(props.pluginId);\n\n    if (!plugin) return null;\n\n    return h(\n      Fragment,\n      {},\n      h(plugin.component, {\n        plugin: plugin,\n        ...props.props,\n      }),\n    );\n  } else if (props.position !== undefined) {\n    // render using a specific plugin position\n    return h(\n      Fragment,\n      {},\n      config.plugin.list(props.position).map((p) => {\n        return h(p.component, { plugin: p, ...this.props.props });\n      }),\n    );\n  }\n\n  return null;\n}\n","import { OneDArray, TColumn, TwoDArray } from './types';\nimport Base from './base';\nimport { Config } from './config';\nimport { px, width } from './util/width';\nimport { getShadowTableWidths, ShadowTable } from './view/table/shadow';\nimport { ComponentChild, h, isValidElement, RefObject, render } from 'preact';\nimport { camelCase } from './util/string';\nimport { flatten } from './util/array';\nimport logger from './util/log';\nimport { PluginManager, PluginPosition } from './plugin';\nimport { GenericSortConfig } from './view/plugin/sort/sort';\n\nclass Header extends Base {\n  private _columns: OneDArray<TColumn>;\n\n  constructor() {\n    super();\n\n    this._columns = [];\n  }\n\n  get columns(): OneDArray<TColumn> {\n    return this._columns;\n  }\n\n  set columns(columns) {\n    this._columns = columns;\n  }\n\n  get visibleColumns(): OneDArray<TColumn> {\n    return this._columns.filter((c) => !c.hidden);\n  }\n\n  /**\n   * Tries to automatically adjust the width of columns based on:\n   *    - Header cell content\n   *    - Cell content of the first row\n   *    - Cell content of the last row\n   *\n   * @param config\n   */\n  adjustWidth(\n    config: Config,\n    tableRef: RefObject<HTMLTableElement>,\n    tempRef: RefObject<HTMLDivElement>,\n  ): this {\n    const container: Element = config.container;\n    const autoWidth = config.autoWidth;\n\n    if (!container) {\n      // we can't calculate the width because the container\n      // is unknown at this stage\n      return this;\n    }\n\n    // pixels\n    const containerWidth = container.clientWidth;\n\n    let widths = {};\n\n    if (tableRef.current && autoWidth) {\n      // let's create a shadow table with the first 10 rows of the data\n      // and let the browser to render the table with table-layout: auto\n      // no padding, margin or border to get the minimum space required\n      // to render columns. Once the table is rendered and widths are known,\n      // we unmount the shadow table from the DOM and set the correct width\n      render(\n        h(ShadowTable, {\n          tableRef: tableRef.current,\n        }),\n        tempRef.current,\n      );\n\n      widths = getShadowTableWidths(tempRef.current);\n    }\n\n    for (const column of flatten(Header.tabularFormat(this.columns))) {\n      // because we don't want to set the width of parent THs\n      if (column.columns && column.columns.length > 0) {\n        continue;\n      }\n\n      if (!column.width && autoWidth) {\n        // tries to find the corresponding cell\n        // from the ShadowTable and set the correct width\n\n        if (column.id in widths) {\n          // because a column can be hidden, too\n          column.width = px(widths[column.id]['width']);\n          column.minWidth = px(widths[column.id]['minWidth']);\n        }\n      } else {\n        // column width is already defined\n        // sets the column with based on the width of its container\n        column.width = px(width(column.width, containerWidth));\n      }\n    }\n\n    if (tableRef.current && autoWidth) {\n      // unmount the shadow table from temp\n      render(null, tempRef.current);\n    }\n\n    return this;\n  }\n\n  private setSort(\n    sortConfig: GenericSortConfig | boolean,\n    columns?: OneDArray<TColumn>,\n  ): void {\n    const cols = columns || this.columns || [];\n\n    for (const column of cols) {\n      // sorting can only be enabled for columns without any children\n      if (column.columns && column.columns.length > 0) {\n        column.sort = undefined;\n      } else if (column.sort === undefined && sortConfig) {\n        column.sort = {};\n      } else if (!column.sort) {\n        // false, null, etc.\n        column.sort = undefined;\n      } else if (typeof column.sort === 'object') {\n        column.sort = {\n          ...column.sort,\n        };\n      }\n\n      if (column.columns) {\n        this.setSort(sortConfig, column.columns);\n      }\n    }\n  }\n\n  private setResizable(resizable: boolean, columns?: OneDArray<TColumn>): void {\n    const cols = columns || this.columns || [];\n\n    for (const column of cols) {\n      if (column.resizable === undefined) {\n        column.resizable = resizable;\n      }\n\n      if (column.columns) {\n        this.setResizable(resizable, column.columns);\n      }\n    }\n  }\n\n  private setID(columns?: OneDArray<TColumn>): void {\n    const cols = columns || this.columns || [];\n\n    for (const column of cols) {\n      if (!column.id && typeof column.name === 'string') {\n        // let's guess the column ID if it's undefined\n        column.id = camelCase(column.name);\n      }\n\n      if (!column.id) {\n        logger.error(\n          `Could not find a valid ID for one of the columns. Make sure a valid \"id\" is set for all columns.`,\n        );\n      }\n\n      // nested columns\n      if (column.columns) {\n        this.setID(column.columns);\n      }\n    }\n  }\n\n  private populatePlugins(\n    pluginManager: PluginManager,\n    columns: OneDArray<TColumn>,\n  ): void {\n    // populate the cell columns\n    for (const column of columns) {\n      if (column.plugin !== undefined) {\n        pluginManager.add({\n          id: column.id,\n          ...column.plugin,\n          position: PluginPosition.Cell,\n        });\n      }\n    }\n  }\n\n  static fromColumns(\n    columns: OneDArray<TColumn | string | ComponentChild>,\n  ): Header {\n    const header = new Header();\n\n    for (const column of columns) {\n      if (typeof column === 'string' || isValidElement(column)) {\n        header.columns.push({\n          name: column,\n        });\n      } else if (typeof column === 'object') {\n        const typedColumn = column as TColumn;\n\n        if (typedColumn.columns) {\n          typedColumn.columns = Header.fromColumns(typedColumn.columns).columns;\n        }\n\n        // because the data for that cell is null\n        // if we are trying to render a plugin\n        if (typeof typedColumn.plugin === 'object') {\n          if (typedColumn.data === undefined) {\n            typedColumn.data = null;\n          }\n        }\n\n        // TColumn type\n        header.columns.push(column as TColumn);\n      }\n    }\n\n    return header;\n  }\n\n  static createFromConfig(config: Partial<Config>): Header | null {\n    const header = new Header();\n\n    // TODO: this part needs some refactoring\n    if (config.from) {\n      header.columns = Header.fromHTMLTable(config.from).columns;\n    } else if (config.columns) {\n      header.columns = Header.fromColumns(config.columns).columns;\n    } else if (\n      config.data &&\n      typeof config.data[0] === 'object' &&\n      !(config.data[0] instanceof Array)\n    ) {\n      // if data[0] is an object but not an Array\n      // used for when a JSON payload is provided\n      header.columns = Object.keys(config.data[0]).map((name) => {\n        return { name: name };\n      });\n    }\n\n    if (header.columns.length) {\n      header.setID();\n      header.setSort(config.sort);\n      header.setResizable(config.resizable);\n      header.populatePlugins(config.plugin, header.columns);\n      return header;\n    }\n\n    return null;\n  }\n\n  static fromHTMLTable(element: HTMLElement): Header {\n    const header = new Header();\n    const thead = element.querySelector('thead');\n    const ths = thead.querySelectorAll('th');\n\n    for (const th of ths as any) {\n      header.columns.push({\n        name: th.innerHTML,\n        width: th.width,\n      });\n    }\n\n    return header;\n  }\n\n  /**\n   * Converts the tree-like format of Header to a tabular format\n   *\n   * Example:\n   *\n   *    H1\n   *      H1-H1\n   *      H1-H2\n   *    H2\n   *      H2-H1\n   *\n   *    becomes:\n   *      [\n   *        [H1, H2],\n   *        [H1-H1, H1-H2, H2-H1]\n   *      ]\n   *\n   * @param columns\n   */\n  static tabularFormat(columns: OneDArray<TColumn>): TwoDArray<TColumn> {\n    let result: TwoDArray<TColumn> = [];\n    const cols = columns || [];\n    let nextRow = [];\n\n    if (cols && cols.length) {\n      result.push(cols);\n\n      for (const col of cols) {\n        if (col.columns && col.columns.length) {\n          nextRow = nextRow.concat(col.columns);\n        }\n      }\n\n      if (nextRow.length) {\n        result = result.concat(this.tabularFormat(nextRow));\n      }\n    }\n\n    return result;\n  }\n\n  /**\n   * Returns an array of leaf columns (last columns in the tree)\n   *\n   * @param columns\n   */\n  static leafColumns(columns: OneDArray<TColumn>): OneDArray<TColumn> {\n    let result: OneDArray<TColumn> = [];\n    const cols = columns || [];\n\n    if (cols && cols.length) {\n      for (const col of cols) {\n        if (!col.columns || col.columns.length === 0) {\n          result.push(col);\n        }\n\n        if (col.columns) {\n          result = result.concat(this.leafColumns(col.columns));\n        }\n      }\n    }\n\n    return result;\n  }\n\n  /**\n   * Returns the maximum depth of a column tree\n   * @param column\n   */\n  static maximumDepth(column: TColumn): number {\n    return this.tabularFormat([column]).length - 1;\n  }\n}\n\nexport default Header;\n","/**\n * Base Storage class. All storage implementation must inherit this class\n */\nimport { TData } from '../types';\n\nabstract class Storage<I> {\n  /**\n   * Returns all rows based on ...args\n   * @param args\n   */\n  abstract get(...args): Promise<StorageResponse>;\n\n  /**\n   * To set all rows\n   *\n   * @param data\n   */\n  set?(data: I | ((...args) => void)): this;\n}\n\nexport interface StorageResponse {\n  data: TData;\n  total: number;\n}\n\nexport default Storage;\n","import Storage, { StorageResponse } from './storage';\nimport { TData } from '../types';\n\nclass MemoryStorage extends Storage<TData> {\n  private data: (() => TData) | (() => Promise<TData>);\n\n  constructor(data: TData | (() => TData) | (() => Promise<TData>)) {\n    super();\n    this.set(data);\n  }\n\n  public async get(): Promise<StorageResponse> {\n    const data = await this.data();\n\n    return {\n      data: data,\n      total: data.length,\n    };\n  }\n\n  public set(data: TData | (() => TData) | (() => Promise<TData>)): this {\n    if (data instanceof Array) {\n      this.data = (): TData => data;\n    } else if (data instanceof Function) {\n      this.data = data;\n    }\n\n    return this;\n  }\n}\n\nexport default MemoryStorage;\n","import Storage, { StorageResponse } from './storage';\nimport log from '../util/log';\n\nexport interface ServerStorageOptions extends RequestInit {\n  url: string;\n  // to format the data and columns\n  then?: (data: any) => any[][];\n  // to handle the response from the server. `handle` will\n  // be called first and then `then` callback will be invoked\n  // The purpose of this function is to handle the behaviour\n  // of server and either reject and resolve the initial response\n  // before calling the `then` function\n  handle?: (response: Response) => Promise<any>;\n  total?: (data: any) => number;\n  // to bypass the current implementation of ServerStorage and process the\n  // request manually (e.g. when user wants to connect their own SDK/HTTP Client)\n  data?: (opts: ServerStorageOptions) => Promise<StorageResponse>;\n}\n\nclass ServerStorage extends Storage<ServerStorageOptions> {\n  private readonly options: ServerStorageOptions;\n\n  constructor(options: ServerStorageOptions) {\n    super();\n    this.options = options;\n  }\n\n  private handler(response: Response): Promise<any> {\n    if (typeof this.options.handle === 'function') {\n      return this.options.handle(response);\n    }\n\n    if (response.ok) {\n      return response.json();\n    } else {\n      log.error(\n        `Could not fetch data: ${response.status} - ${response.statusText}`,\n        true,\n      );\n      return null;\n    }\n  }\n\n  public get(options?: ServerStorageOptions): Promise<StorageResponse> {\n    // this.options is the initial config object\n    // options is the runtime config passed by the pipeline (e.g. search component)\n    const opts = {\n      ...this.options,\n      ...options,\n    };\n\n    // if `options.data` is provided, the current ServerStorage\n    // implementation will be ignored and we let options.data to\n    // handle the request. Useful when HTTP client needs to be\n    // replaced with something else\n    if (typeof opts.data === 'function') {\n      return opts.data(opts);\n    }\n\n    return fetch(opts.url, opts)\n      .then(this.handler.bind(this))\n      .then((res) => {\n        return {\n          data: opts.then(res),\n          total: typeof opts.total === 'function' ? opts.total(res) : undefined,\n        };\n      });\n  }\n}\n\nexport default ServerStorage;\n","import { Config } from '../config';\nimport MemoryStorage from './memory';\nimport Storage from './storage';\nimport ServerStorage from './server';\nimport log from '../util/log';\nimport { decode, html } from '../util/html';\n\nclass StorageUtils {\n  /**\n   * Accepts a Config object and tries to guess and return a Storage type\n   *\n   * @param config\n   */\n  public static createFromConfig(config: Config): Storage<any> {\n    let storage = null;\n    // `data` array is provided\n    if (config.data) {\n      storage = new MemoryStorage(config.data);\n    }\n\n    if (config.from) {\n      storage = new MemoryStorage(this.tableElementToArray(config.from));\n      // remove the source table element from the DOM\n      config.from.style.display = 'none';\n    }\n\n    if (config.server) {\n      storage = new ServerStorage(config.server);\n    }\n\n    if (!storage) {\n      log.error('Could not determine the storage type', true);\n    }\n\n    return storage;\n  }\n\n  /**\n   * Accepts a HTML table element and converts it into a 2D array of data\n   *\n   * TODO: This function can be a step in the pipeline: Convert Table -> Load into a memory storage -> ...\n   *\n   * @param element\n   */\n  static tableElementToArray(element: HTMLElement): any[][] {\n    const arr = [];\n    const tbody = element.querySelector('tbody');\n    const rows = tbody.querySelectorAll('tr');\n\n    for (const row of rows as any) {\n      const cells: HTMLElement[] = row.querySelectorAll('td');\n      const parsedRow = [];\n\n      for (const cell of cells) {\n        // try to capture a TD with single text element first\n        if (\n          cell.childNodes.length === 1 &&\n          cell.childNodes[0].nodeType === Node.TEXT_NODE\n        ) {\n          parsedRow.push(decode(cell.innerHTML));\n        } else {\n          parsedRow.push(html(cell.innerHTML));\n        }\n      }\n\n      arr.push(parsedRow);\n    }\n\n    return arr;\n  }\n}\n\nexport default StorageUtils;\n","import { PipelineProcessor, ProcessorType } from './processor';\nimport { ID } from '../util/id';\nimport log from '../util/log';\nimport { EventEmitter } from '../util/eventEmitter';\n\ninterface PipelineEvents<R> {\n  /**\n   * Generic updated event. Triggers the callback function when the pipeline\n   * is updated, including when a new processor is registered, a processor's props\n   * get updated, etc.\n   */\n  updated: <T, P>(processor: PipelineProcessor<T, P>) => void;\n  /**\n   * Triggers the callback function when a new\n   * processor is registered successfully\n   */\n  afterRegister: () => void;\n  /**\n   * Triggers the callback when a registered\n   * processor's property is updated\n   */\n  propsUpdated: () => void;\n  /**\n   * Triggers the callback function when the pipeline\n   * is fully processed, before returning the results\n   *\n   * afterProcess will not be called if there is an\n   * error in the pipeline (i.e a step throw an Error)\n   */\n  afterProcess: (prev: R) => void;\n  /**\n   * Triggers the callback function when the pipeline\n   * fails to process all steps or at least one step\n   * throws an Error\n   */\n  error: <T>(prev: T) => void;\n}\n\nclass Pipeline<R> extends EventEmitter<PipelineEvents<R>> {\n  // available steps for this pipeline\n  private readonly _steps: Map<\n    ProcessorType,\n    PipelineProcessor<unknown, unknown>[]\n  > = new Map<ProcessorType, PipelineProcessor<unknown, unknown>[]>();\n  // used to cache the results of processors using their id field\n  private cache: Map<string, unknown> = new Map<string, unknown>();\n  // keeps the index of the last updated processor in the registered\n  // processors list and will be used to invalidate the cache\n  // -1 means all new processors should be processed\n  private lastProcessorIndexUpdated = -1;\n\n  constructor(steps?: PipelineProcessor<unknown, unknown>[]) {\n    super();\n\n    if (steps) {\n      steps.forEach((step) => this.register(step));\n    }\n  }\n\n  /**\n   * Clears the `cache` array\n   */\n  clearCache(): void {\n    this.cache = new Map<string, object>();\n    this.lastProcessorIndexUpdated = -1;\n  }\n\n  /**\n   * Registers a new processor\n   *\n   * @param processor\n   * @param priority\n   */\n  register<T, P>(\n    processor: PipelineProcessor<T, P>,\n    priority: number = null,\n  ): PipelineProcessor<T, P> {\n    if (!processor) {\n      throw Error('Processor is not defined');\n    }\n\n    if (processor.type === null) {\n      throw Error('Processor type is not defined');\n    }\n\n    if (this.findProcessorIndexByID(processor.id) > -1) {\n      throw Error(`Processor ID ${processor.id} is already defined`);\n    }\n\n    // binding the propsUpdated callback to the Pipeline\n    processor.on('propsUpdated', this.processorPropsUpdated.bind(this));\n\n    this.addProcessorByPriority(processor, priority);\n    this.afterRegistered(processor);\n\n    return processor;\n  }\n\n  /**\n   * Tries to register a new processor\n   * @param processor\n   * @param priority\n   */\n  tryRegister<T, P>(\n    processor: PipelineProcessor<T, P>,\n    priority: number = null,\n  ): PipelineProcessor<T, P> | undefined {\n    try {\n      return this.register(processor, priority);\n    } catch (_) {\n      // noop\n    }\n\n    return undefined;\n  }\n\n  /**\n   * Removes a processor from the list\n   *\n   * @param processor\n   */\n  unregister<T, P>(processor: PipelineProcessor<T, P>): void {\n    if (!processor) return;\n    if (this.findProcessorIndexByID(processor.id) === -1) return;\n\n    const subSteps = this._steps.get(processor.type);\n\n    if (subSteps && subSteps.length) {\n      this._steps.set(\n        processor.type,\n        subSteps.filter((proc) => proc != processor),\n      );\n      this.emit('updated', processor);\n    }\n  }\n\n  /**\n   * Registers a new processor\n   *\n   * @param processor\n   * @param priority\n   */\n  private addProcessorByPriority<T, P>(\n    processor: PipelineProcessor<T, P>,\n    priority: number,\n  ): void {\n    let subSteps = this._steps.get(processor.type);\n\n    if (!subSteps) {\n      const newSubStep = [];\n      this._steps.set(processor.type, newSubStep);\n      subSteps = newSubStep;\n    }\n\n    if (priority === null || priority < 0) {\n      subSteps.push(processor);\n    } else {\n      if (!subSteps[priority]) {\n        // slot is empty\n        subSteps[priority] = processor;\n      } else {\n        // slot is NOT empty\n        const first = subSteps.slice(0, priority - 1);\n        const second = subSteps.slice(priority + 1);\n\n        this._steps.set(processor.type, first.concat(processor).concat(second));\n      }\n    }\n  }\n\n  /**\n   * Flattens the _steps Map and returns a list of steps with their correct priorities\n   */\n  get steps(): PipelineProcessor<unknown, unknown>[] {\n    let steps: PipelineProcessor<unknown, unknown>[] = [];\n\n    for (const type of this.getSortedProcessorTypes()) {\n      const subSteps = this._steps.get(type);\n\n      if (subSteps && subSteps.length) {\n        steps = steps.concat(subSteps);\n      }\n    }\n\n    // to remove any undefined elements\n    return steps.filter((s) => s);\n  }\n\n  /**\n   * Accepts ProcessType and returns an array of the registered processes\n   * with the give type\n   *\n   * @param type\n   */\n  getStepsByType(type: ProcessorType): PipelineProcessor<unknown, unknown>[] {\n    return this.steps.filter((process) => process.type === type);\n  }\n\n  /**\n   * Returns a list of ProcessorType according to their priority\n   */\n  private getSortedProcessorTypes(): ProcessorType[] {\n    return Object.keys(ProcessorType)\n      .filter((key) => !isNaN(Number(key)))\n      .map((key) => Number(key));\n  }\n\n  /**\n   * Runs all registered processors based on their correct priority\n   * and returns the final output after running all steps\n   *\n   * @param data\n   */\n  async process(data?: R): Promise<R> {\n    const lastProcessorIndexUpdated = this.lastProcessorIndexUpdated;\n    const steps = this.steps;\n\n    let prev = data;\n\n    try {\n      for (const processor of steps) {\n        const processorIndex = this.findProcessorIndexByID(processor.id);\n\n        if (processorIndex >= lastProcessorIndexUpdated) {\n          // we should execute process() here since the last\n          // updated processor was before \"processor\".\n          // This is to ensure that we always have correct and up to date\n          // data from processors and also to skip them when necessary\n          prev = (await processor.process(prev)) as R;\n          this.cache.set(processor.id, prev);\n        } else {\n          // cached results already exist\n          prev = this.cache.get(processor.id) as R;\n        }\n      }\n    } catch (e) {\n      log.error(e);\n      // trigger the onError callback\n      this.emit('error', prev);\n\n      // rethrow\n      throw e;\n    }\n\n    // means the pipeline is up to date\n    this.lastProcessorIndexUpdated = steps.length;\n\n    // triggers the afterProcess callbacks with the results\n    this.emit('afterProcess', prev);\n\n    return prev;\n  }\n\n  /**\n   * Returns the registered processor's index in _steps array\n   *\n   * @param processorID\n   */\n  private findProcessorIndexByID(processorID: ID): number {\n    return this.steps.findIndex((p) => p.id == processorID);\n  }\n\n  /**\n   * Sets the last updates processors index locally\n   * This is used to invalid or skip a processor in\n   * the process() method\n   */\n  private setLastProcessorIndex<T, P>(\n    processor: PipelineProcessor<T, P>,\n  ): void {\n    const processorIndex = this.findProcessorIndexByID(processor.id);\n\n    if (this.lastProcessorIndexUpdated > processorIndex) {\n      this.lastProcessorIndexUpdated = processorIndex;\n    }\n  }\n\n  private processorPropsUpdated(processor): void {\n    this.setLastProcessorIndex(processor);\n    this.emit('propsUpdated');\n    this.emit('updated', processor);\n  }\n\n  private afterRegistered(processor): void {\n    this.setLastProcessorIndex(processor);\n    this.emit('afterRegister');\n    this.emit('updated', processor);\n  }\n}\n\nexport default Pipeline;\n","import Storage, { StorageResponse } from '../../storage/storage';\nimport {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\n\ninterface StorageExtractorProps extends PipelineProcessorProps {\n  storage: Storage<any>;\n}\n\nclass StorageExtractor extends PipelineProcessor<\n  StorageResponse,\n  StorageExtractorProps\n> {\n  get type(): ProcessorType {\n    return ProcessorType.Extractor;\n  }\n\n  async _process(opts: any): Promise<StorageResponse> {\n    return await this.props.storage.get(opts);\n  }\n}\n\nexport default StorageExtractor;\n","import { PipelineProcessor, ProcessorType } from '../processor';\nimport Tabular from '../../tabular';\nimport { ArrayResponse } from './storageResponseToArray';\nimport Row from '../../row';\n\nclass ArrayToTabularTransformer extends PipelineProcessor<\n  Tabular,\n  Record<string, any>\n> {\n  get type(): ProcessorType {\n    return ProcessorType.Transformer;\n  }\n\n  _process(arrayResponse: ArrayResponse): Tabular {\n    const tabular = Tabular.fromArray(arrayResponse.data);\n\n    if (arrayResponse.extraData && arrayResponse.extraData.length > 0) {\n      tabular.rows.forEach((row: Row, index: number) => {\n        if (arrayResponse.extraData[index]) {\n          row.extraData = arrayResponse.extraData[index];\n        }\n      });\n    }\n\n    // for server-side storage\n    tabular.length = arrayResponse.total;\n\n    return tabular;\n  }\n}\n\nexport default ArrayToTabularTransformer;\n","import {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\n\ninterface ServerInitiatorProps extends PipelineProcessorProps {\n  serverStorageOptions: ServerStorageOptions;\n}\n\nclass ServerInitiator extends PipelineProcessor<\n  ServerStorageOptions,\n  ServerInitiatorProps\n> {\n  get type(): ProcessorType {\n    return ProcessorType.Initiator;\n  }\n\n  _process(): ServerStorageOptions {\n    return Object.entries(this.props.serverStorageOptions)\n      .filter(([_, val]) => typeof val !== 'function')\n      .reduce(\n        (acc, [k, v]) => ({ ...acc, [k]: v }),\n        {},\n      ) as ServerStorageOptions;\n  }\n}\n\nexport default ServerInitiator;\n","import {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\nimport { StorageResponse } from '../../storage/storage';\nimport { TCell, TData, TDataArray, TDataObject, TwoDArray } from '../../types';\nimport Header from '../../header';\nimport logger from '../../util/log';\n\nexport interface ArrayResponse {\n  data: TwoDArray<TCell>;\n  extraData?: Array<{ [key: string]: any }>;\n  total: number;\n}\n\ninterface StorageResponseToArrayTransformerProps\n  extends PipelineProcessorProps {\n  header: Header;\n}\n\nclass StorageResponseToArrayTransformer extends PipelineProcessor<\n  ArrayResponse,\n  StorageResponseToArrayTransformerProps\n> {\n  get type(): ProcessorType {\n    return ProcessorType.Transformer;\n  }\n\n  private castData(data: TData): {\n    data: TwoDArray<TCell>;\n    extraData: Array<{ [key: string]: any }>;\n  } {\n    if (!data || !data.length) {\n      return { data: [], extraData: [] };\n    }\n\n    if (!this.props.header || !this.props.header.columns) {\n      return { data: data as TwoDArray<TCell>, extraData: [] };\n    }\n\n    const columns = Header.leafColumns(this.props.header.columns);\n\n    // if it's a 2d array already\n    if (data[0] instanceof Array) {\n      const extraDataArray: Array<{ [key: string]: any }> = [];\n\n      const mappedData = (data as TDataArray).map((row) => {\n        let pad = 0;\n        const extraData: { [key: string]: any } = {};\n        const usedIndices = new Set<number>();\n\n        const mappedRow = columns.map((column, i) => {\n          // default `data` is provided for this column\n          if (column.data !== undefined) {\n            pad++;\n\n            if (typeof column.data === 'function') {\n              return column.data(row);\n            } else {\n              return column.data;\n            }\n          }\n\n          const index = i - pad;\n          usedIndices.add(index);\n\n          return row[index];\n        });\n\n        row.forEach((value, index) => {\n          if (!usedIndices.has(index)) {\n            extraData[`col_${index}`] = value;\n          }\n        });\n\n        extraDataArray.push(extraData);\n\n        return mappedRow;\n      });\n\n      return { data: mappedData, extraData: extraDataArray };\n    }\n\n    // if it's an array of objects (but not array of arrays, i.e JSON payload)\n    if (typeof data[0] === 'object' && !(data[0] instanceof Array)) {\n      const extraDataArray: Array<{ [key: string]: any }> = [];\n\n      const mappedData = (data as TDataObject).map((row) => {\n        const columnIds = new Set<string>();\n        const extraData: { [key: string]: any } = {};\n\n        columns.forEach((column) => {\n          if (column.id) {\n            columnIds.add(column.id);\n          }\n        });\n\n        Object.keys(row).forEach((key) => {\n          if (!columnIds.has(key)) {\n            extraData[key] = row[key];\n          }\n        });\n\n        extraDataArray.push(extraData);\n\n        return columns.map((column, i) => {\n          if (column.data !== undefined) {\n            if (typeof column.data === 'function') {\n              return column.data(row);\n            } else {\n              return column.data;\n            }\n          } else if (column.id) {\n            return row[column.id];\n          } else {\n            logger.error(`Could not find the correct cell for column at position ${i}.\n                          Make sure either 'id' or 'selector' is defined for all columns.`);\n            return null;\n          }\n        });\n      });\n\n      return { data: mappedData, extraData: extraDataArray };\n    }\n\n    return { data: [], extraData: [] };\n  }\n\n  _process(storageResponse: StorageResponse): ArrayResponse {\n    const result = this.castData(storageResponse.data);\n    return {\n      data: result.data,\n      total: storageResponse.total,\n      extraData: result.extraData,\n    };\n  }\n}\n\nexport default StorageResponseToArrayTransformer;\n","import { Config } from '../config';\nimport Pipeline from './pipeline';\nimport Tabular from '../tabular';\nimport StorageExtractor from './extractor/storage';\nimport ArrayToTabularTransformer from './transformer/arrayToTabular';\nimport ServerStorage from '../storage/server';\nimport ServerInitiator from './initiator/server';\nimport StorageResponseToArrayTransformer from './transformer/storageResponseToArray';\n\nclass PipelineUtils {\n  static createFromConfig(config: Config): Pipeline<Tabular> {\n    const pipeline = new Pipeline<Tabular>();\n\n    if (config.storage instanceof ServerStorage) {\n      pipeline.register(\n        new ServerInitiator({\n          serverStorageOptions: config.server,\n        }),\n      );\n    }\n\n    pipeline.register(new StorageExtractor({ storage: config.storage }));\n    pipeline.register(\n      new StorageResponseToArrayTransformer({ header: config.header }),\n    );\n    pipeline.register(new ArrayToTabularTransformer());\n\n    return pipeline;\n  }\n}\n\nexport default PipelineUtils;\n","export class Store<S = Record<string, unknown>> {\n  private state: S;\n  private listeners: ((current?: S, prev?: S) => void)[] = [];\n  private isDispatching = false;\n\n  constructor(initialState: S) {\n    this.state = initialState;\n  }\n\n  getState = () => this.state;\n  getListeners = () => this.listeners;\n\n  dispatch = (reducer: (state: S) => S) => {\n    if (typeof reducer !== 'function')\n      throw new Error('Reducer is not a function');\n    if (this.isDispatching)\n      throw new Error('Reducers may not dispatch actions');\n\n    this.isDispatching = true;\n\n    const prevState = this.state;\n    try {\n      this.state = reducer(this.state);\n    } finally {\n      this.isDispatching = false;\n    }\n\n    for (const listener of this.listeners) {\n      listener(this.state, prevState);\n    }\n\n    return this.state;\n  };\n\n  subscribe = (listener: (current?: S, prev?: S) => void): (() => void) => {\n    if (typeof listener !== 'function')\n      throw new Error('Listener is not a function');\n\n    this.listeners = [...this.listeners, listener];\n    return () =>\n      (this.listeners = this.listeners.filter((lis) => lis !== listener));\n  };\n}\n","import {\n  CSSDeclaration,\n  OneDArray,\n  Status,\n  TAttribute,\n  TCell,\n  TColumn,\n  TData,\n} from './types';\nimport Storage from './storage/storage';\nimport Pipeline from './pipeline/pipeline';\nimport Tabular from './tabular';\nimport { Search, SearchConfig } from './view/plugin/search/search';\nimport {\n  Pagination,\n  PaginationConfig,\n} from './view/plugin/pagination/pagination';\nimport Header from './header';\nimport { ServerStorageOptions } from './storage/server';\nimport { GenericSortConfig } from './view/plugin/sort/sort';\nimport { Language, Translator } from './i18n/language';\nimport { ComponentChild, createContext, createRef, RefObject } from 'preact';\nimport StorageUtils from './storage/storageUtils';\nimport PipelineUtils from './pipeline/pipelineUtils';\nimport { EventEmitter } from './util/eventEmitter';\nimport { GridEvents } from './events';\nimport { PluginManager, PluginPosition, Plugin } from './plugin';\nimport Grid from './grid';\nimport { Store } from './state/store';\nimport Row from './row';\n\nexport const ConfigContext = createContext(null);\n\nexport interface Config {\n  // a reference to the current Grid.js instance\n  instance: Grid;\n  store: Store;\n  eventEmitter: EventEmitter<GridEvents>;\n  plugin: PluginManager;\n  /** container element that is used to mount the Grid.js to */\n  // TODO: change this to an element reference\n  container?: Element;\n  /** pointer to the main table element */\n  tableRef?: RefObject<HTMLTableElement>;\n  data?: TData | (() => TData) | (() => Promise<TData>);\n  server?: ServerStorageOptions;\n  header?: Header;\n  /** to parse a HTML table and load the data */\n  from: HTMLElement;\n  storage: Storage<any>;\n  /** Pipeline process throttle timeout in milliseconds */\n  processingThrottleMs: number;\n  pipeline: Pipeline<Tabular>;\n  /** to automatically calculate the columns width */\n  autoWidth: boolean;\n  /** sets the width of the container and table */\n  width: string;\n  /** sets the height of the table */\n  height: string;\n  pagination: PaginationConfig | boolean;\n  sort: GenericSortConfig | boolean;\n  translator: Translator;\n  /** fixes the table header to the top of the table */\n  fixedHeader: boolean;\n  /** Resizable columns? */\n  resizable: boolean;\n  columns: OneDArray<TColumn | string | ComponentChild>;\n  search: SearchConfig | boolean;\n  language: Language;\n  plugins?: Plugin<any>[];\n  style?: Partial<{\n    table: CSSDeclaration;\n    td: CSSDeclaration;\n    th: CSSDeclaration;\n    container: CSSDeclaration;\n    header: CSSDeclaration;\n    footer: CSSDeclaration;\n  }>;\n  rowAttribute?: TAttribute | ((row: Row) => TAttribute);\n  cellAttribute?:\n    | TAttribute\n    | ((cell: TCell, row: Row, column: TColumn) => TAttribute);\n  className?: Partial<{\n    table: string;\n    th: string;\n    thead: string;\n    tbody: string;\n    tr: string;\n    td: string;\n    container: string;\n    footer: string;\n    header: string;\n    search: string;\n    sort: string;\n    pagination: string;\n    paginationPerPageSelect: string;\n    paginationSummary: string;\n    paginationButton: string;\n    paginationButtonNext: string;\n    paginationButtonCurrent: string;\n    paginationButtonPrev: string;\n    loading: string;\n    notfound: string;\n    error: string;\n  }>;\n}\n\nexport class Config {\n  public constructor() {\n    Object.assign(this, Config.defaultConfig());\n  }\n  /**\n   * Assigns `updatedConfig` keys to the current config file\n   *\n   * @param partialConfig\n   */\n  assign(partialConfig: Partial<Config>): Config {\n    return Object.assign(this, partialConfig);\n  }\n\n  /**\n   * Updates the config from a partial Config\n   *\n   * @param partialConfig\n   */\n  update(partialConfig: Partial<Config>): Config {\n    if (!partialConfig) return this;\n\n    this.assign(\n      Config.fromPartialConfig({\n        ...this,\n        ...partialConfig,\n      }),\n    );\n\n    return this;\n  }\n\n  static defaultConfig(): Partial<Config> {\n    return {\n      store: new Store({\n        status: Status.Init,\n        header: undefined,\n        data: null,\n      }),\n      plugin: new PluginManager(),\n      tableRef: createRef(),\n      width: '100%',\n      height: 'auto',\n      processingThrottleMs: 100,\n      autoWidth: true,\n      style: {},\n      rowAttribute: {},\n      cellAttribute: {},\n      className: {},\n    };\n  }\n\n  static fromPartialConfig(partialConfig: Partial<Config>): Partial<Config> {\n    const config = new Config().assign(partialConfig);\n\n    // Sort\n    if (typeof partialConfig.sort === 'boolean' && partialConfig.sort) {\n      config.assign({\n        sort: {\n          multiColumn: true,\n        },\n      });\n    }\n\n    // clear existing plugins list to prevent duplicate errors\n    config.plugin = new PluginManager();\n\n    // Header\n    config.assign({\n      header: Header.createFromConfig(config),\n    });\n\n    config.assign({\n      storage: StorageUtils.createFromConfig(config),\n    });\n\n    config.assign({\n      pipeline: PipelineUtils.createFromConfig(config),\n    });\n\n    // Translator\n    config.assign({\n      translator: new Translator(config.language),\n    });\n\n    if (config.search) {\n      // Search\n      config.plugin.add({\n        id: 'search',\n        position: PluginPosition.Header,\n        component: Search,\n      });\n    }\n\n    if (config.pagination) {\n      // Pagination\n      config.plugin.add({\n        id: 'pagination',\n        position: PluginPosition.Footer,\n        component: Pagination,\n      });\n    }\n\n    // Additional plugins\n    if (config.plugins) {\n      config.plugins.forEach((p) => config.plugin.add(p));\n    }\n\n    return config;\n  }\n}\n","import { h, ComponentChild, JSX } from 'preact';\n\nimport Cell from '../../cell';\nimport { classJoin, className } from '../../util/className';\nimport { CSSDeclaration, TAttribute, TColumn } from '../../types';\nimport Row from '../../row';\nimport { JSXInternal } from 'preact/src/jsx';\nimport { PluginRenderer } from '../../plugin';\nimport { useConfig } from '../../hooks/useConfig';\n\nexport function TD(\n  props: {\n    cell: Cell;\n    row?: Row;\n    column?: TColumn;\n    style?: CSSDeclaration;\n    messageCell?: boolean;\n  } & Omit<JSX.HTMLAttributes<HTMLTableCellElement>, 'style'>,\n) {\n  const config = useConfig();\n\n  const content = (): ComponentChild => {\n    if (props.column && typeof props.column.formatter === 'function') {\n      return props.column.formatter(props.cell.data, props.row, props.column);\n    }\n\n    if (props.column && props.column.plugin) {\n      return (\n        <PluginRenderer\n          pluginId={props.column.id}\n          props={{\n            column: props.column,\n            cell: props.cell,\n            row: props.row,\n          }}\n        />\n      );\n    }\n\n    return props.cell.data;\n  };\n\n  const handleClick = (\n    e: JSX.TargetedMouseEvent<HTMLTableCellElement>,\n  ): void => {\n    if (props.messageCell) return;\n\n    config.eventEmitter.emit(\n      'cellClick',\n      e,\n      props.cell,\n      props.column,\n      props.row,\n    );\n  };\n\n  const getCustomAttributes = (\n    column: TColumn | null,\n  ): JSXInternal.HTMLAttributes<HTMLTableCellElement> => {\n    if (!column) return {};\n\n    if (typeof column.attributes === 'function') {\n      return column.attributes(props.cell.data, props.row, props.column);\n    } else {\n      return column.attributes;\n    }\n  };\n\n  const customAttributes: TAttribute = (\n    config.cellAttribute instanceof Function\n      ? config.cellAttribute(props.cell, props.row, props.column)\n      : config.cellAttribute\n  ) as TAttribute;\n\n  const { class: customClass, ...attributes } = customAttributes;\n\n  return (\n    <td\n      role={props.role}\n      colSpan={props.colSpan}\n      data-column-id={props.column && props.column.id}\n      className={classJoin(\n        className('td'),\n        props.className,\n        config.className.td,\n        customClass,\n      )}\n      style={{\n        ...props.style,\n        ...config.style.td,\n      }}\n      onClick={handleClick}\n      {...getCustomAttributes(props.column)}\n      {...attributes}\n    >\n      {content()}\n    </td>\n  );\n}\n","import { h, JSX, ComponentChildren } from 'preact';\n\nimport Row from '../../row';\nimport Cell from '../../cell';\nimport { classJoin, className } from '../../util/className';\nimport { TAttribute, TColumn } from '../../types';\nimport { TD } from './td';\nimport Header from '../../header';\nimport { useConfig } from '../../hooks/useConfig';\nimport useSelector from '../../hooks/useSelector';\n\nexport function TR(props: {\n  index?: number;\n  row?: Row;\n  messageRow?: boolean;\n  children?: ComponentChildren;\n}) {\n  const config = useConfig();\n  const header = useSelector((state) => state.header);\n\n  const getColumn = (cellIndex: number): TColumn => {\n    if (header) {\n      const cols = Header.leafColumns(header.columns);\n\n      if (cols) {\n        return cols[cellIndex];\n      }\n    }\n\n    return null;\n  };\n\n  const handleClick = (\n    e: JSX.TargetedMouseEvent<HTMLTableRowElement>,\n  ): void => {\n    if (props.messageRow) return;\n    config.eventEmitter.emit('rowClick', e, props.row);\n  };\n\n  const getChildren = (): ComponentChildren => {\n    if (props.children) {\n      return props.children;\n    }\n\n    return props.row.cells.map((cell: Cell, i) => {\n      const column = getColumn(i);\n\n      if (column && column.hidden) return null;\n\n      return <TD key={cell.id} cell={cell} row={props.row} column={column} />;\n    });\n  };\n\n  const customAttributes: TAttribute = (\n    config.rowAttribute instanceof Function\n      ? config.rowAttribute(props.row)\n      : config.rowAttribute\n  ) as TAttribute;\n\n  const { class: customClass, ...attributes } = customAttributes;\n\n  return (\n    <tr\n      className={classJoin(className('tr'), config.className.tr, customClass)}\n      onClick={handleClick}\n      data-index={props.index}\n      {...attributes}\n    >\n      {getChildren()}\n    </tr>\n  );\n}\n","import { h } from 'preact';\nimport Cell from '../../cell';\nimport { classJoin, className } from '../../util/className';\nimport { TR } from './tr';\nimport { TD } from './td';\n\nexport function MessageRow(props: {\n  message: string;\n  colSpan?: number;\n  className?: string;\n}) {\n  return (\n    <TR messageRow={true}>\n      <TD\n        role=\"alert\"\n        colSpan={props.colSpan}\n        messageCell={true}\n        cell={new Cell(props.message)}\n        className={classJoin(\n          className('message'),\n          props.className ? props.className : null,\n        )}\n      />\n    </TR>\n  );\n}\n","import { h } from 'preact';\nimport Row from '../../row';\nimport { TR } from './tr';\nimport { classJoin, className } from '../../util/className';\nimport { Status } from '../../types';\nimport { MessageRow } from './messageRow';\nimport { useConfig } from '../../hooks/useConfig';\nimport { useTranslator } from '../../i18n/language';\nimport useSelector from '../../hooks/useSelector';\n\nexport function TBody() {\n  const config = useConfig();\n  const data = useSelector((state) => state.data);\n  const status = useSelector((state) => state.status);\n  const header = useSelector((state) => state.header);\n  const pagination = useSelector((state) => state.pagination);\n  const _ = useTranslator();\n\n  const headerLength = () => {\n    if (header) {\n      return header.visibleColumns.length;\n    }\n    return 0;\n  };\n\n  const getPaginationOffset = () => {\n    if (!pagination || !config.pagination) {\n      return 0;\n    }\n\n    const { page = 0, limit = 10 } = pagination;\n\n    if (limit === -1) {\n      return 0;\n    }\n\n    return page * limit;\n  };\n\n  const paginationOffset = getPaginationOffset();\n\n  return (\n    <tbody className={classJoin(className('tbody'), config.className.tbody)}>\n      {data &&\n        data.rows.map((row: Row, index: number) => {\n          return <TR index={paginationOffset + index} row={row} />;\n        })}\n\n      {status === Status.Loading && (!data || data.length === 0) && (\n        <MessageRow\n          message={_('loading')}\n          colSpan={headerLength()}\n          className={classJoin(className('loading'), config.className.loading)}\n        />\n      )}\n\n      {(status === Status.Rendered || status === Status.Loaded) &&\n        data &&\n        data.length === 0 && (\n          <MessageRow\n            message={_('noRecordsFound')}\n            colSpan={headerLength()}\n            className={classJoin(\n              className('notfound'),\n              config.className.notfound,\n            )}\n          />\n        )}\n\n      {status === Status.Error && (\n        <MessageRow\n          message={_('error')}\n          colSpan={headerLength()}\n          className={classJoin(className('error'), config.className.error)}\n        />\n      )}\n    </tbody>\n  );\n}\n","import { Comparator, TCell } from '../../types';\nimport Tabular from '../../tabular';\nimport {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\nimport Row from '../../row';\nimport log from '../../util/log';\n\ninterface NativeSortProps extends PipelineProcessorProps {\n  columns: {\n    index: number;\n    // 1 ascending, -1 descending\n    direction?: 1 | -1;\n    compare?: Comparator<TCell>;\n  }[];\n}\n\nclass NativeSort extends PipelineProcessor<Tabular, NativeSortProps> {\n  protected validateProps(): void {\n    for (const condition of this.props.columns) {\n      if (condition.direction === undefined) {\n        condition.direction = 1;\n      }\n\n      if (condition.direction !== 1 && condition.direction !== -1) {\n        log.error(`Invalid sort direction ${condition.direction}`);\n      }\n    }\n  }\n\n  get type(): ProcessorType {\n    return ProcessorType.Sort;\n  }\n\n  private compare(cellA: TCell, cellB: TCell): number {\n    if (cellA > cellB) {\n      return 1;\n    } else if (cellA < cellB) {\n      return -1;\n    }\n\n    return 0;\n  }\n\n  private compareWrapper(a: Row, b: Row): number {\n    let cmp = 0;\n\n    for (const column of this.props.columns) {\n      if (cmp === 0) {\n        const cellA = a.cells[column.index].data;\n        const cellB = b.cells[column.index].data;\n\n        if (typeof column.compare === 'function') {\n          cmp |= column.compare(cellA, cellB) * column.direction;\n        } else {\n          cmp |= this.compare(cellA, cellB) * column.direction;\n        }\n      } else {\n        break;\n      }\n    }\n\n    return cmp;\n  }\n\n  protected _process(data: Tabular): Tabular {\n    const sortedRows = [...data.rows];\n    sortedRows.sort(this.compareWrapper.bind(this));\n\n    const sorted = new Tabular(sortedRows);\n    // we have to set the tabular length manually\n    // because of the server-side storage\n    sorted.length = data.length;\n\n    return sorted;\n  }\n}\n\nexport default NativeSort;\n","import { Comparator, TCell } from '../../../types';\n\nexport const SortColumn =\n  (\n    index: number,\n    direction: 1 | -1,\n    multi?: boolean,\n    compare?: Comparator<TCell>,\n  ) =>\n  (state) => {\n    let columns = state.sort?.columns\n      ? state.sort.columns.map((x) => {\n          return { ...x };\n        })\n      : [];\n    const count = columns.length;\n    const column = columns.find((x) => x.index === index);\n    const exists = column !== undefined;\n\n    let add = false;\n    let reset = false;\n    let remove = false;\n    let update = false;\n\n    if (!exists) {\n      // the column has not been sorted\n      if (count === 0) {\n        // the first column to be sorted\n        add = true;\n      } else if (count > 0 && !multi) {\n        // remove the previously sorted column\n        // and sort the current column\n        add = true;\n        reset = true;\n      } else if (count > 0 && multi) {\n        // multi-sorting\n        // sort this column as well\n        add = true;\n      }\n    } else {\n      // the column has been sorted before\n      if (!multi) {\n        // single column sorting\n        if (count === 1) {\n          update = true;\n        } else if (count > 1) {\n          // this situation happens when we have already entered\n          // multi-sorting mode but then user tries to sort a single column\n          reset = true;\n          add = true;\n        }\n      } else {\n        // multi sorting\n        if (column.direction === -1) {\n          // remove the current column from the\n          // sorted columns array\n          remove = true;\n        } else {\n          update = true;\n        }\n      }\n    }\n\n    if (reset) {\n      // resetting the sorted columns\n      columns = [];\n    }\n\n    if (add) {\n      columns.push({\n        index: index,\n        direction: direction,\n        compare: compare,\n      });\n    } else if (update) {\n      const index = columns.indexOf(column);\n      columns[index].direction = direction;\n    } else if (remove) {\n      const index = columns.indexOf(column);\n      columns.splice(index, 1);\n    }\n\n    return {\n      ...state,\n      sort: {\n        columns: columns,\n      },\n    };\n  };\n\nexport const SortToggle =\n  (index: number, multi: boolean, compare?: Comparator<TCell>) => (state) => {\n    const columns = state.sort ? [...state.sort.columns] : [];\n    const column = columns.find((x) => x.index === index);\n\n    if (!column) {\n      return {\n        ...state,\n        ...SortColumn(index, 1, multi, compare)(state),\n      };\n    }\n\n    return {\n      ...state,\n      ...SortColumn(\n        index,\n        column.direction === 1 ? -1 : 1,\n        multi,\n        compare,\n      )(state),\n    };\n  };\n","import {\n  PipelineProcessor,\n  PipelineProcessorProps,\n  ProcessorType,\n} from '../processor';\nimport { ServerStorageOptions } from '../../storage/server';\nimport { TColumnSort } from '../../types';\n\ninterface ServerSortProps extends PipelineProcessorProps {\n  columns: TColumnSort[];\n  url?: (prevUrl: string, columns: TColumnSort[]) => string;\n  body?: (prevBody: BodyInit, columns: TColumnSort[]) => BodyInit;\n}\n\nclass ServerSort extends PipelineProcessor<\n  ServerStorageOptions,\n  ServerSortProps\n> {\n  get type(): ProcessorType {\n    return ProcessorType.ServerSort;\n  }\n\n  _process(options?: ServerStorageOptions): ServerStorageOptions {\n    const updates = {};\n\n    if (this.props.url) {\n      updates['url'] = this.props.url(options.url, this.props.columns);\n    }\n\n    if (this.props.body) {\n      updates['body'] = this.props.body(options.body, this.props.columns);\n    }\n\n    return {\n      ...options,\n      ...updates,\n    };\n  }\n}\n\nexport default ServerSort;\n","import { h, JSX } from 'preact';\n\nimport { classJoin, className } from '../../../util/className';\nimport { PipelineProcessor, ProcessorType } from '../../../pipeline/processor';\nimport NativeSort from '../../../pipeline/sort/native';\nimport { Comparator, TCell, TColumnSort } from '../../../types';\nimport * as actions from './actions';\nimport ServerSort from '../../../pipeline/sort/server';\nimport { useEffect, useState } from 'preact/hooks';\nimport { useConfig } from '../../../hooks/useConfig';\nimport { useTranslator } from '../../../i18n/language';\nimport useSelector from '../../../hooks/useSelector';\nimport { useStore } from '../../../hooks/useStore';\n\n// column specific config\nexport interface SortConfig {\n  compare?: Comparator<TCell>;\n  // 1 ascending, -1 descending\n  direction?: 1 | -1;\n}\n\n// generic sort config:\n//\n// Config {\n//    sort: GenericSortConfig\n// }\n//\nexport interface GenericSortConfig {\n  multiColumn?: boolean;\n  server?: {\n    url?: (prevUrl: string, columns: TColumnSort[]) => string;\n    body?: (prevBody: BodyInit, columns: TColumnSort[]) => BodyInit;\n  };\n}\n\nexport function Sort(\n  props: {\n    // column index\n    index: number;\n  } & SortConfig,\n) {\n  const config = useConfig();\n  const { dispatch } = useStore();\n  const _ = useTranslator();\n  const [direction, setDirection] = useState(0);\n  const sortConfig = config.sort as GenericSortConfig;\n  const state = useSelector((state) => state.sort);\n  const processorType =\n    typeof sortConfig?.server === 'object'\n      ? ProcessorType.ServerSort\n      : ProcessorType.Sort;\n\n  const getSortProcessor = () => {\n    const processors = config.pipeline.getStepsByType(processorType);\n    if (processors.length) {\n      return processors[0];\n    }\n    return undefined;\n  };\n\n  const createSortProcessor = () => {\n    if (processorType === ProcessorType.ServerSort) {\n      return new ServerSort({\n        columns: state ? state.columns : [],\n        ...sortConfig.server,\n      });\n    }\n\n    return new NativeSort({\n      columns: state ? state.columns : [],\n    });\n  };\n\n  const getOrCreateSortProcessor = (): PipelineProcessor<any, any> => {\n    const existingSortProcessor = getSortProcessor();\n    if (existingSortProcessor) {\n      return existingSortProcessor;\n    }\n\n    return createSortProcessor();\n  };\n\n  useEffect(() => {\n    const processor = getOrCreateSortProcessor();\n    config.pipeline.tryRegister(processor);\n\n    return () => config.pipeline.unregister(processor);\n  }, [config]);\n\n  /**\n   * Sets the internal state of component\n   */\n  useEffect(() => {\n    if (!state) return;\n\n    const currentColumn = state.columns.find((x) => x.index === props.index);\n\n    if (!currentColumn) {\n      setDirection(0);\n    } else {\n      // if the direction is not set, initialize the selected\n      // column direction with the passed prop (default to ascending)\n      if (direction === 0) {\n        currentColumn.direction = props.direction ?? 1;\n      }\n      setDirection(currentColumn.direction);\n    }\n  }, [state]);\n\n  useEffect(() => {\n    const processor = getSortProcessor();\n\n    if (!processor) return;\n    if (!state) return;\n\n    processor.setProps({\n      columns: state.columns,\n    });\n  }, [state]);\n\n  const changeDirection = (e: JSX.TargetedMouseEvent<HTMLButtonElement>) => {\n    e.preventDefault();\n    e.stopPropagation();\n    // to sort two or more columns at the same time\n    dispatch(\n      actions.SortToggle(\n        props.index,\n        e.shiftKey === true && sortConfig.multiColumn,\n        props.compare,\n      ),\n    );\n  };\n\n  const getSortClassName = (direction: number) => {\n    if (direction === 1) {\n      return 'asc';\n    } else if (direction === -1) {\n      return 'desc';\n    }\n\n    return 'neutral';\n  };\n\n  return (\n    <span\n      // because the corresponding <th> has tabIndex=0\n      tabIndex={-1}\n      aria-label={_(`sort.sort${direction === 1 ? 'Desc' : 'Asc'}`)}\n      title={_(`sort.sort${direction === 1 ? 'Desc' : 'Asc'}`)}\n      className={classJoin(\n        className('sort'),\n        className('sort', getSortClassName(direction)),\n        config.className.sort,\n      )}\n      onClick={changeDirection}\n    />\n  );\n}\n","/**\n * Throttle a given function\n * @param fn Function to be called\n * @param wait Throttle timeout in milliseconds\n * @returns Throttled function\n */\nexport const throttle = (fn: (...args) => void, wait = 100) => {\n  let timeoutId: ReturnType<typeof setTimeout>;\n  let lastTime = Date.now();\n\n  const execute = (...args) => {\n    lastTime = Date.now();\n    fn(...args);\n  };\n\n  return (...args) => {\n    const currentTime = Date.now();\n    const elapsed = currentTime - lastTime;\n\n    if (elapsed >= wait) {\n      // If enough time has passed since the last call, execute the function immediately\n      execute(...args);\n    } else {\n      // If not enough time has passed, schedule the function call after the remaining delay\n      if (timeoutId) {\n        clearTimeout(timeoutId);\n      }\n\n      timeoutId = setTimeout(() => {\n        execute(...args);\n        timeoutId = null;\n      }, wait - elapsed);\n    }\n  };\n};\n","import { h, RefObject } from 'preact';\nimport { classJoin, className } from '../../../util/className';\nimport { TColumn } from '../../../types';\nimport { throttle } from '../../../util/throttle';\n\nexport function Resize(props: {\n  column: TColumn;\n  thRef: RefObject<HTMLTableCellElement>;\n}) {\n  let moveFn: (e) => void;\n\n  const getPageX = (e: MouseEvent | TouchEvent) => {\n    if (e instanceof MouseEvent) {\n      return Math.floor(e.pageX);\n    } else {\n      return Math.floor(e.changedTouches[0].pageX);\n    }\n  };\n\n  const start = (e: MouseEvent | TouchEvent) => {\n    e.stopPropagation();\n\n    const thElement = props.thRef.current;\n\n    const offsetStart = parseInt(thElement.style.width, 10) - getPageX(e);\n\n    moveFn = throttle((e) => move(e, offsetStart), 10);\n\n    document.addEventListener('mouseup', end);\n    document.addEventListener('touchend', end);\n    document.addEventListener('mousemove', moveFn);\n    document.addEventListener('touchmove', moveFn);\n  };\n\n  const move = (e: MouseEvent | TouchEvent, offsetStart: number) => {\n    e.stopPropagation();\n\n    const thElement = props.thRef.current;\n\n    if (offsetStart + getPageX(e) >= parseInt(thElement.style.minWidth, 10)) {\n      thElement.style.width = `${offsetStart + getPageX(e)}px`;\n    }\n  };\n\n  const end = (e: MouseEvent | TouchEvent) => {\n    e.stopPropagation();\n\n    document.removeEventListener('mouseup', end);\n    document.removeEventListener('mousemove', moveFn);\n    document.removeEventListener('touchmove', moveFn);\n    document.removeEventListener('touchend', end);\n  };\n\n  return (\n    <div\n      className={classJoin(className('th'), className('resizable'))}\n      onMouseDown={start}\n      onTouchStart={start}\n      onClick={(e) => e.stopPropagation()}\n    />\n  );\n}\n","import { h, ComponentChild, JSX } from 'preact';\n\nimport { classJoin, className } from '../../util/className';\nimport { CSSDeclaration, TColumn } from '../../types';\nimport { GenericSortConfig, Sort } from '../plugin/sort/sort';\nimport { PluginRenderer } from '../../plugin';\nimport { Resize } from '../plugin/resize/resize';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useConfig } from '../../hooks/useConfig';\nimport * as SortActions from '../plugin/sort/actions';\nimport { useStore } from '../../hooks/useStore';\n\nexport function TH(\n  props: {\n    index: number;\n    column: TColumn;\n    style?: CSSDeclaration;\n  } & Omit<JSX.HTMLAttributes<HTMLTableCellElement>, 'style'>,\n) {\n  const config = useConfig();\n  const thRef = useRef(null);\n  const [style, setStyle] = useState({});\n  const { dispatch } = useStore();\n\n  useEffect(() => {\n    // sets the `top` style if the current TH is fixed\n    if (config.fixedHeader && thRef.current) {\n      const offsetTop = thRef.current.offsetTop;\n\n      if (typeof offsetTop === 'number') {\n        setStyle({\n          top: offsetTop,\n        });\n      }\n    }\n  }, [thRef]);\n\n  const isSortable = (): boolean => props.column.sort != undefined;\n  const isResizable = (): boolean => props.column.resizable;\n  const onClick = (\n    e:\n      | JSX.TargetedMouseEvent<HTMLTableCellElement>\n      | JSX.TargetedKeyboardEvent<HTMLTableCellElement>,\n  ) => {\n    e.stopPropagation();\n\n    if (isSortable()) {\n      const sortConfig = config.sort as GenericSortConfig;\n\n      dispatch(\n        SortActions.SortToggle(\n          props.index,\n          e.shiftKey === true && sortConfig.multiColumn,\n          props.column.sort.compare,\n        ),\n      );\n    }\n  };\n\n  const keyDown = (e: JSX.TargetedKeyboardEvent<HTMLTableCellElement>) => {\n    // Enter key\n    if (isSortable() && e.which === 13) {\n      onClick(e);\n    }\n  };\n\n  const content = (): ComponentChild => {\n    if (props.column.name !== undefined) {\n      return props.column.name;\n    }\n\n    if (props.column.plugin !== undefined) {\n      return (\n        <PluginRenderer\n          pluginId={props.column.plugin.id}\n          props={{\n            column: props.column,\n          }}\n        />\n      );\n    }\n\n    return null;\n  };\n\n  const getCustomAttributes = () => {\n    const column = props.column;\n\n    if (!column) return {};\n\n    if (typeof column.attributes === 'function') {\n      return column.attributes(null, null, props.column);\n    } else {\n      return column.attributes;\n    }\n  };\n\n  return (\n    <th\n      ref={thRef}\n      data-column-id={props.column && props.column.id}\n      className={classJoin(\n        className('th'),\n        isSortable() ? className('th', 'sort') : null,\n        config.fixedHeader ? className('th', 'fixed') : null,\n        config.className.th,\n      )}\n      onClick={onClick}\n      style={{\n        ...config.style.th,\n        ...{\n          minWidth: props.column.minWidth,\n          width: props.column.width,\n        },\n        ...style,\n        ...props.style,\n      }}\n      onKeyDown={keyDown}\n      rowSpan={props.rowSpan > 1 ? props.rowSpan : undefined}\n      colSpan={props.colSpan > 1 ? props.colSpan : undefined}\n      {...getCustomAttributes()}\n      {...(isSortable() ? { tabIndex: 0 } : {})}\n    >\n      <div className={className('th', 'content')}>{content()}</div>\n      {isSortable() && <Sort index={props.index} {...props.column.sort} />}\n      {isResizable() &&\n        props.index < config.header.visibleColumns.length - 1 && (\n          <Resize column={props.column} thRef={thRef} />\n        )}\n    </th>\n  );\n}\n","import { h } from 'preact';\nimport { TR } from './tr';\nimport { TH } from './th';\nimport { classJoin, className } from '../../util/className';\nimport Header from '../../header';\nimport { TColumn } from '../../types';\nimport { calculateRowColSpans } from '../../util/table';\nimport { useConfig } from '../../hooks/useConfig';\nimport useSelector from '../../hooks/useSelector';\n\nexport function THead() {\n  const config = useConfig();\n  const header = useSelector((state) => state.header);\n\n  const renderColumn = (\n    column: TColumn,\n    rowIndex: number,\n    columnIndex: number,\n    totalRows: number,\n  ) => {\n    const { rowSpan, colSpan } = calculateRowColSpans(\n      column,\n      rowIndex,\n      totalRows,\n    );\n\n    return (\n      <TH\n        column={column}\n        index={columnIndex}\n        colSpan={colSpan}\n        rowSpan={rowSpan}\n      />\n    );\n  };\n\n  const renderRow = (row: TColumn[], rowIndex: number, totalRows: number) => {\n    // because the only sortable columns are leaf columns (not parents)\n    const leafColumns = Header.leafColumns(header.columns);\n\n    return (\n      <TR>\n        {row.map((col) => {\n          if (col.hidden) return null;\n\n          return renderColumn(\n            col,\n            rowIndex,\n            leafColumns.indexOf(col),\n            totalRows,\n          );\n        })}\n      </TR>\n    );\n  };\n\n  const renderRows = () => {\n    const rows = Header.tabularFormat(header.columns);\n\n    return rows.map((row, rowIndex) => renderRow(row, rowIndex, rows.length));\n  };\n\n  if (header) {\n    return (\n      <thead\n        key={header.id}\n        className={classJoin(className('thead'), config.className.thead)}\n      >\n        {renderRows()}\n      </thead>\n    );\n  }\n\n  return null;\n}\n","import { TColumn } from '../types';\nimport Header from '../header';\n\nexport function calculateRowColSpans(\n  column: TColumn,\n  rowIndex: number,\n  totalRows: number,\n): { rowSpan: number; colSpan: number } {\n  const depth = Header.maximumDepth(column);\n  const remainingRows = totalRows - rowIndex;\n  const rowSpan = Math.floor(remainingRows - depth - depth / remainingRows);\n  const colSpan = (column.columns && column.columns.length) || 1;\n\n  return {\n    rowSpan: rowSpan,\n    colSpan: colSpan,\n  };\n}\n","import Header from 'src/header';\nimport Tabular from '../tabular';\nimport { Status } from '../types';\n\nexport const SetStatusToRendered = () => (state) => {\n  if (state.status === Status.Loaded) {\n    return {\n      ...state,\n      status: Status.Rendered,\n    };\n  }\n\n  return state;\n};\n\nexport const SetLoadingData = () => (state) => {\n  return {\n    ...state,\n    status: Status.Loading,\n  };\n};\n\nexport const SetData = (data: Tabular) => (state) => {\n  if (!data) return state;\n\n  return {\n    ...state,\n    data: data,\n    status: Status.Loaded,\n  };\n};\n\nexport const SetDataErrored = () => (state) => {\n  return {\n    ...state,\n    data: null,\n    status: Status.Error,\n  };\n};\n\nexport const SetHeader = (header: Header) => (state) => {\n  return {\n    ...state,\n    header: header,\n  };\n};\n\nexport const SetTableRef = (tableRef) => (state) => {\n  return {\n    ...state,\n    tableRef: tableRef,\n  };\n};\n","import { h } from 'preact';\nimport { TBody } from './tbody';\nimport { THead } from './thead';\nimport { classJoin, className } from '../../util/className';\nimport { useConfig } from '../../hooks/useConfig';\nimport { useEffect, useRef } from 'preact/hooks';\nimport * as actions from '../actions';\nimport { useStore } from '../../hooks/useStore';\n\nexport function Table() {\n  const config = useConfig();\n  const tableRef = useRef(null);\n  const { dispatch } = useStore();\n\n  useEffect(() => {\n    if (tableRef) dispatch(actions.SetTableRef(tableRef));\n  }, [tableRef]);\n\n  return (\n    <table\n      ref={tableRef}\n      role=\"grid\"\n      className={classJoin(className('table'), config.className.table)}\n      style={{\n        ...config.style.table,\n        ...{\n          height: config.height,\n        },\n      }}\n    >\n      <THead />\n      <TBody />\n    </table>\n  );\n}\n","import { classJoin, className } from '../util/className';\nimport { h } from 'preact';\nimport { PluginPosition, PluginRenderer } from '../plugin';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useConfig } from '../hooks/useConfig';\n\nexport function HeaderContainer() {\n  const [isActive, setIsActive] = useState(true);\n  const headerRef = useRef(null);\n  const config = useConfig();\n\n  useEffect(() => {\n    if (headerRef.current.children.length === 0) {\n      setIsActive(false);\n    }\n  }, [headerRef]);\n\n  if (isActive) {\n    return (\n      <div\n        ref={headerRef}\n        className={classJoin(className('head'), config.className.header)}\n        style={{ ...config.style.header }}\n      >\n        <PluginRenderer position={PluginPosition.Header} />\n      </div>\n    );\n  }\n\n  return null;\n}\n","import { h } from 'preact';\nimport { classJoin, className } from '../util/className';\nimport { PluginPosition, PluginRenderer } from '../plugin';\nimport { useEffect, useRef, useState } from 'preact/hooks';\nimport { useConfig } from '../hooks/useConfig';\n\nexport function FooterContainer() {\n  const footerRef = useRef(null);\n  const [isActive, setIsActive] = useState(true);\n  const config = useConfig();\n\n  useEffect(() => {\n    if (footerRef.current.children.length === 0) {\n      setIsActive(false);\n    }\n  }, [footerRef]);\n\n  if (isActive) {\n    return (\n      <div\n        ref={footerRef}\n        className={classJoin(className('footer'), config.className.footer)}\n        style={{ ...config.style.footer }}\n      >\n        <PluginRenderer position={PluginPosition.Footer} />\n      </div>\n    );\n  }\n\n  return null;\n}\n","import { createRef, h } from 'preact';\nimport { classJoin, className } from '../util/className';\nimport { Status } from '../types';\nimport { Table } from './table/table';\nimport { HeaderContainer } from './headerContainer';\nimport { FooterContainer } from './footerContainer';\nimport log from '../util/log';\nimport { useEffect } from 'preact/hooks';\nimport * as actions from './actions';\nimport { useStore } from '../hooks/useStore';\nimport useSelector from '../hooks/useSelector';\nimport { useConfig } from '../hooks/useConfig';\nimport { throttle } from '../util/throttle';\n\nexport function Container() {\n  const config = useConfig();\n  const { dispatch } = useStore();\n  const status = useSelector((state) => state.status);\n  const data = useSelector((state) => state.data);\n  const tableRef = useSelector((state) => state.tableRef);\n  const tempRef = createRef();\n\n  const processPipeline = throttle(async () => {\n    dispatch(actions.SetLoadingData());\n\n    try {\n      const data = await config.pipeline.process();\n      dispatch(actions.SetData(data));\n\n      // TODO: do we need this setTimemout?\n      setTimeout(() => {\n        dispatch(actions.SetStatusToRendered());\n      }, 0);\n    } catch (e) {\n      log.error(e);\n      dispatch(actions.SetDataErrored());\n    }\n  }, config.processingThrottleMs);\n\n  useEffect(() => {\n    // set the initial header object\n    // we update the header width later when \"data\"\n    // is available in the state\n    dispatch(actions.SetHeader(config.header));\n\n    processPipeline();\n    config.pipeline.on('updated', processPipeline);\n\n    return () => config.pipeline.off('updated', processPipeline);\n  }, []);\n\n  useEffect(() => {\n    if (config.header && status === Status.Loaded && data?.length) {\n      config.eventEmitter?.emit('ready');\n\n      // now that we have the data, let's adjust columns width\n      // NOTE: that we only calculate the columns width once\n      dispatch(\n        actions.SetHeader(config.header.adjustWidth(config, tableRef, tempRef)),\n      );\n    }\n  }, [data, config, tempRef]);\n\n  return (\n    <div\n      role=\"complementary\"\n      className={classJoin(\n        'gridjs',\n        className('container'),\n        status === Status.Loading ? className('loading') : null,\n        config.className.container,\n      )}\n      style={{\n        ...config.style.container,\n        ...{\n          width: config.width,\n        },\n      }}\n    >\n      {status === Status.Loading && (\n        <div className={className('loading-bar')} />\n      )}\n\n      <HeaderContainer />\n\n      <div className={className('wrapper')} style={{ height: config.height }}>\n        <Table />\n      </div>\n\n      <FooterContainer />\n\n      <div ref={tempRef} id=\"gridjs-temp\" className={className('temp')} />\n    </div>\n  );\n}\n","import { Config } from './config';\nimport { h, render, VNode } from 'preact';\nimport { Container } from './view/container';\nimport log from './util/log';\nimport { EventEmitter } from './util/eventEmitter';\nimport { GridEvents } from './events';\nimport { PluginManager } from './plugin';\nimport { ConfigContext } from './config';\n\nclass Grid extends EventEmitter<GridEvents> {\n  public config: Config;\n  public plugin: PluginManager;\n\n  constructor(config?: Partial<Config>) {\n    super();\n    this.config = new Config()\n      .assign({ instance: this, eventEmitter: this })\n      .update(config);\n    this.plugin = this.config.plugin;\n  }\n\n  public updateConfig(config: Partial<Config>): this {\n    this.config.update(config);\n    return this;\n  }\n\n  createElement(): VNode {\n    return h(ConfigContext.Provider, {\n      value: this.config,\n      children: h(Container, {}),\n    });\n  }\n\n  /**\n   * Uses the existing container and tries to clear the cache\n   * and re-render the existing Grid.js instance again. This is\n   * useful when a new config is set/updated.\n   *\n   */\n  forceRender(): this {\n    if (!this.config || !this.config.container) {\n      log.error(\n        'Container is empty. Make sure you call render() before forceRender()',\n        true,\n      );\n    }\n\n    this.destroy();\n\n    // recreate the Grid instance\n    render(this.createElement(), this.config.container);\n\n    return this;\n  }\n\n  /**\n   * Deletes the Grid.js instance\n   */\n  destroy(): void {\n    this.config.pipeline.clearCache();\n    // TODO: not sure if it's a good idea to render a null element but I couldn't find a better way\n    render(null, this.config.container);\n  }\n\n  /**\n   * Mounts the Grid.js instance to the container\n   * and renders the instance\n   *\n   * @param container\n   */\n  render(container: Element): this {\n    if (!container) {\n      log.error('Container element cannot be null', true);\n    }\n\n    if (container.childNodes.length > 0) {\n      log.error(\n        `The container element ${container} is not empty. Make sure the container is empty and call render() again`,\n      );\n      return this;\n    }\n\n    this.config.container = container;\n    render(this.createElement(), container);\n\n    return this;\n  }\n}\n\nexport default Grid;\n"],"names":["Status","n","l","u","i","t","o","r","ProcessorType","f","e","c","s","a","parentNode","removeChild","h","arguments","length","children","call","defaultProps","v","type","props","key","ref","__k","__","__b","__e","__d","__c","__h","constructor","__v","vnode","y","current","p","d","this","context","_","indexOf","k","base","b","push","g","__r","debounceRendering","setTimeout","sort","some","__P","j","__n","ownerSVGElement","z","w","x","C","Array","isArray","m","A","N","M","appendChild","nextSibling","insertBefore","$","setProperty","test","H","style","cssText","replace","toLowerCase","slice","addEventListener","T","I","removeEventListener","removeAttribute","setAttribute","event","contextType","value","__E","prototype","render","O","sub","state","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","forEach","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","L","diffed","localName","nodeType","document","createTextNode","createElementNS","createElement","is","data","childNodes","dangerouslySetInnerHTML","attributes","name","__html","innerHTML","checked","unmount","componentWillUnmount","P","firstChild","Math","random","toString","getDerivedStateFromError","setState","componentDidCatch","forceUpdate","Base","id","_id","generateUUID","HTMLElement","parentElement","content","html","Cell","super","update","cast","outerHTML","cells","extraData","_cells","_extraData","cell","index","getExtraData","setExtraData","toArray","map","static","Row","Tabular","rows","_rows","_length","len","row","fromCells","oneDtoTwoD","callbacks","init","listeners","on","listener","off","eventName","filter","emit","args","deepEqual","obj1","obj2","hasOwnProperty","keys1","Object","keys","keys2","EventEmitter","_props","setProps","process","validateProps","Function","_process","result","updatedProps","_extends","GlobalSearchFilter","PipelineProcessor","Filter","keyword","String","trim","columns","ignoreHiddenColumns","tabular","selector","rowIndex","cellIndex","hidden","element","className","reduce","prev","cur","classNames","ServerGlobalSearchFilter","ServerFilter","options","updates","url","body","__H","__V","B","__N","every","F","shift","requestAnimationFrame","clearTimeout","cancelAnimationFrame","useContext","ConfigContext","enUS","search","placeholder","sortAsc","sortDesc","pagination","previous","next","navigate","page","pages","showing","of","to","results","loading","noRecordsFound","error","Translator","language","_language","_defaultLanguage","getString","message","lang","splitted","split","val","join","translate","messageFormat","useTranslator","config","useConfig","translator","SearchKeyword","payload","store","useSelector","useStore","setCurrent","useState","getState","useEffect","subscribe","updated","Search","_config$className","processor","setProcessor","undefined","dispatch","server","header","actions","pipeline","register","unregister","debouncedOnInput","useCallback","func","waitFor","timeout","resolve","target","HTMLInputElement","debounce","debounceTimeout","classJoin","onInput","defaultValue","isNaN","Number","limit","Error","Limit","ServerPaginationLimit","ServerLimit","Pagination","summary","nextButton","prevButton","buttonsCount","perPageSelect","resetPageOnUpdate","useRef","currentPage","setCurrentPage","total","setTotal","perPageOption","setPerPageOption","action","PaginationLimit","onUpdate","updatedProcessor","max","ceil","setPage","Fragment","role","paginationSummary","title","min","paginationPerPageSelect","onChange","perPage","setPerPage","parseInt","tabIndex","disabled","onClick","paginationButton","paginationButtonPrev","maxCount","pagePivot","floor","from","paginationButtonCurrent","renderPages","paginationButtonNext","width","containerWidth","px","ShadowTable","shadowTable","tableRef","cloneNode","position","zIndex","visibility","nodeElement","camelCase","str","words","word","charAt","toUpperCase","PluginPosition","log","format","throwException","msg","console","warn","info","plugins","get","find","add","plugin","remove","splice","list","order","PluginRenderer","pluginId","component","_columns","visibleColumns","adjustWidth","tempRef","container","autoWidth","clientWidth","widths","tableElement","querySelector","tableClassName","tableStyle","tableLayout","padding","margin","border","outline","obj","querySelectorAll","getAttribute","minWidth","getShadowTableWidths","column","Header","tabularFormat","concat","setSort","sortConfig","cols","setResizable","resizable","setID","logger","populatePlugins","pluginManager","isValidElement","typedColumn","fromColumns","fromHTMLTable","ths","th","nextRow","col","leafColumns","Storage","MemoryStorage","set","async","ServerStorage","handler","response","handle","ok","json","status","statusText","opts","fetch","then","bind","res","StorageUtils","storage","tableElementToArray","display","arr","parsedRow","Node","TEXT_NODE","DOMParser","parseFromString","documentElement","textContent","decode","Pipeline","steps","_steps","cache","Map","lastProcessorIndexUpdated","step","clearCache","priority","findProcessorIndexByID","processorPropsUpdated","addProcessorByPriority","afterRegistered","tryRegister","subSteps","proc","newSubStep","first","second","getSortedProcessorTypes","getStepsByType","processorID","findIndex","setLastProcessorIndex","processorIndex","StorageExtractor","Extractor","ArrayToTabularTransformer","Transformer","arrayResponse","fromArray","ServerInitiator","Initiator","entries","serverStorageOptions","acc","StorageResponseToArrayTransformer","castData","extraDataArray","mappedData","pad","usedIndices","Set","mappedRow","has","columnIds","storageResponse","PipelineUtils","Store","initialState","isDispatching","getListeners","reducer","prevState","lis","Consumer","Provider","createContext","Config","assign","defaultConfig","partialConfig","fromPartialConfig","Init","height","processingThrottleMs","rowAttribute","cellAttribute","multiColumn","createFromConfig","Footer","_excluded","TD","customAttributes","class","customClass","_objectWithoutPropertiesLoose","colSpan","td","messageCell","eventEmitter","formatter","TR","tr","messageRow","getColumn","MessageRow","TBody","getPaginationOffset","tbody","paginationOffset","Loading","headerLength","Rendered","Loaded","notfound","NativeSort","condition","direction","Sort","compare","cellA","cellB","compareWrapper","cmp","sortedRows","sorted","multi","_state$sort","reset","count","SortToggle","SortColumn","ServerSort","setDirection","processorType","getSortProcessor","processors","currentColumn","_props$direction","getSortClassName","preventDefault","stopPropagation","shiftKey","throttle","fn","wait","lastTime","Date","now","execute","elapsed","timeoutId","Resize","moveFn","getPageX","MouseEvent","pageX","changedTouches","start","offsetStart","thRef","move","end","thElement","onMouseDown","onTouchStart","TH","setStyle","fixedHeader","offsetTop","top","isSortable","SortActions","onKeyDown","which","rowSpan","getCustomAttributes","THead","thead","totalRows","columnIndex","calculateRowColSpans","depth","maximumDepth","remainingRows","renderColumn","renderRow","renderRows","SetStatusToRendered","SetHeader","Table","table","HeaderContainer","isActive","setIsActive","headerRef","FooterContainer","footerRef","footer","Container","processPipeline","_config$eventEmitter","Grid","instance","updateConfig","forceRender","destroy"],"mappings":"4WAmECA,GAND,SAAYA,GACVA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,QAAA,GAAA,UACAA,EAAAA,EAAA,OAAA,GAAA,SACAA,EAAAA,EAAA,SAAA,GAAA,WACAA,EAAAA,EAAA,MAAA,GAAA,OACD,CAND,CAAYA,IAAAA,EAMX,CAAA,ICnED,IAAIC,EAAEC,EAAEC,EAAEC,EAAEC,EAAEC,EAAEC,ECgBfC,EDhBiBC,EAAE,CAAE,EAACC,EAAE,GAAGC,EAAE,oEAAoE,SAASC,EAAEX,EAAEC,GAAG,IAAI,IAAIC,KAAKD,EAAED,EAAEE,GAAGD,EAAEC,GAAG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