import{c as sn,a as an}from"./_commonjsHelpers-C4iS2aBk.js";var Dt={exports:{}};(function(Ft,B){(function(w,mt){mt(B)})(sn,function(w){function mt(r,e){for(var n=0;nr.length)&&(e=r.length);for(var n=0,t=new Array(e);n=r.length?{done:!0}:{done:!1,value:r[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var nt,_,Rt,Tt,Q,Ut,Lt,rt={},Bt=[],we=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function G(r,e){for(var n in e)r[n]=e[n];return r}function Mt(r){var e=r.parentNode;e&&e.removeChild(r)}function p(r,e,n){var t,i,o,s={};for(o in e)o=="key"?t=e[o]:o=="ref"?i=e[o]:s[o]=e[o];if(arguments.length>2&&(s.children=arguments.length>3?nt.call(arguments,2):n),typeof r=="function"&&r.defaultProps!=null)for(o in r.defaultProps)s[o]===void 0&&(s[o]=r.defaultProps[o]);return it(r,s,t,i,null)}function it(r,e,n,t,i){var o={type:r,props:e,key:n,ref:t,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i??++Rt};return i==null&&_.vnode!=null&&_.vnode(o),o}function M(r){return r.children}function Y(r,e){this.props=r,this.context=e}function J(r,e){if(e==null)return r.__?J(r.__,r.__.__k.indexOf(r)+1):null;for(var n;e0?it(c.type,c.props,c.key,null,c.__v):c)!=null){if(c.__=n,c.__b=n.__b+1,(h=b[a])===null||h&&c.key==h.key&&c.type===h.type)b[a]=void 0;else for(g=0;g0&&(this.callbacks[i].forEach(function(o){return o.apply(void 0,[].slice.call(t,1))}),!0)},r}();(function(r){r[r.Initiator=0]="Initiator",r[r.ServerFilter=1]="ServerFilter",r[r.ServerSort=2]="ServerSort",r[r.ServerLimit=3]="ServerLimit",r[r.Extractor=4]="Extractor",r[r.Transformer=5]="Transformer",r[r.Filter=6]="Filter",r[r.Sort=7]="Sort",r[r.Limit=8]="Limit"})(I||(I={}));var j=function(r){function e(t){var i;return(i=r.call(this)||this).id=void 0,i._props=void 0,i._props={},i.id=Zt(),t&&i.setProps(t),i}m(e,r);var n=e.prototype;return n.process=function(){var t=[].slice.call(arguments);this.validateProps instanceof Function&&this.validateProps.apply(this,t),this.emit.apply(this,["beforeProcess"].concat(t));var i=this._process.apply(this,t);return this.emit.apply(this,["afterProcess"].concat(t)),i},n.setProps=function(t){return Object.assign(this._props,t),this.emit("propsUpdated",this),this},k(e,[{key:"props",get:function(){return this._props}}]),e}(pt),Pe=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype._process=function(n){return this.props.keyword?(t=String(this.props.keyword).trim(),i=this.props.columns,o=this.props.ignoreHiddenColumns,s=n,l=this.props.selector,t=t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),new ct(s.rows.filter(function(u,d){return u.cells.some(function(a,g){if(!a||o&&i&&i[g]&&typeof i[g]=="object"&&i[g].hidden)return!1;var h="";if(typeof l=="function")h=l(a.data,d,g);else if(typeof a.data=="object"){var c=a.data;c&&c.props&&c.props.content&&(h=c.props.content)}else h=String(a.data);return new RegExp(t,"gi").test(h)})}))):n;var t,i,o,s,l},k(e,[{key:"type",get:function(){return I.Filter}}]),e}(j);function y(){var r="gridjs";return""+r+[].slice.call(arguments).reduce(function(e,n){return e+"-"+n},"")}function x(){return[].slice.call(arguments).filter(function(r){return r}).reduce(function(r,e){return(r||"")+" "+e},"").trim()||null}var Z,bt=function(r){function e(t){var i;return(i=r.call(this)||this)._state=void 0,i.dispatcher=void 0,i.dispatcher=t,i._state=i.getInitialState(),t.register(i._handle.bind(V(i))),i}m(e,r);var n=e.prototype;return n._handle=function(t){this.handle(t.type,t.payload)},n.setState=function(t){var i=this._state;this._state=t,this.emit("updated",t,i)},k(e,[{key:"state",get:function(){return this._state}}]),e}(pt),Ee=function(r){function e(){return r.apply(this,arguments)||this}m(e,r);var n=e.prototype;return n.getInitialState=function(){return{keyword:null}},n.handle=function(t,i){t==="SEARCH_KEYWORD"&&this.search(i.keyword)},n.search=function(t){this.setState({keyword:t})},e}(bt),wt=function(){function r(e){this.dispatcher=void 0,this.dispatcher=e}return r.prototype.dispatch=function(e,n){this.dispatcher.dispatch({type:e,payload:n})},r}(),Ne=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype.search=function(n){this.dispatch("SEARCH_KEYWORD",{keyword:n})},e}(wt),Kt=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype._process=function(n){if(!this.props.keyword)return n;var t={};return this.props.url&&(t.url=this.props.url(n.url,this.props.keyword)),this.props.body&&(t.body=this.props.body(n.body,this.props.keyword)),C({},n,t)},k(e,[{key:"type",get:function(){return I.ServerFilter}}]),e}(j),L=new(function(){function r(){}var e=r.prototype;return e.format=function(n,t){return"[Grid.js] ["+t.toUpperCase()+"]: "+n},e.error=function(n,t){t===void 0&&(t=!1);var i=this.format(n,"error");if(t)throw Error(i);console.error(i)},e.warn=function(n){console.warn(this.format(n,"warn"))},e.info=function(n){console.info(this.format(n,"info"))},r}()),Ct=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e}(E);w.PluginPosition=void 0,(Z=w.PluginPosition||(w.PluginPosition={}))[Z.Header=0]="Header",Z[Z.Footer=1]="Footer",Z[Z.Cell=2]="Cell";var Ie=function(){function r(){this.plugins=void 0,this.plugins=[]}var e=r.prototype;return e.get=function(n){var t=this.plugins.filter(function(i){return i.id===n});return t.length>0?t[0]:null},e.add=function(n){return n.id?this.get(n.id)!==null?(L.error("Duplicate plugin ID: "+n.id),this):(this.plugins.push(n),this):(L.error("Plugin ID cannot be empty"),this)},e.remove=function(n){return this.plugins.splice(this.plugins.indexOf(this.get(n)),1),this},e.list=function(n){var t;return t=n!=null||n!=null?this.plugins.filter(function(i){return i.position===n}):this.plugins,t.sort(function(i,o){return i.order-o.order})},r}(),ht=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype.render=function(){var n=this;if(this.props.pluginId){var t=this.config.plugin.get(this.props.pluginId);return t?p(M,{},p(t.component,C({plugin:t},t.props,this.props.props))):null}return this.props.position!==void 0?p(M,{},this.config.plugin.list(this.props.position).map(function(i){return p(i.component,C({plugin:i},i.props,n.props.props))})):null},e}(E),Vt=function(r){function e(t,i){var o;(o=r.call(this,t,i)||this).searchProcessor=void 0,o.actions=void 0,o.store=void 0,o.storeUpdatedFn=void 0,o.actions=new Ne(o.config.dispatcher),o.store=new Ee(o.config.dispatcher);var s,l=t.keyword;return t.enabled&&(l&&o.actions.search(l),o.storeUpdatedFn=o.storeUpdated.bind(V(o)),o.store.on("updated",o.storeUpdatedFn),s=t.server?new Kt({keyword:t.keyword,url:t.server.url,body:t.server.body}):new Pe({keyword:t.keyword,columns:o.config.header&&o.config.header.columns,ignoreHiddenColumns:t.ignoreHiddenColumns||t.ignoreHiddenColumns===void 0,selector:t.selector}),o.searchProcessor=s,o.config.pipeline.register(s)),o}m(e,r);var n=e.prototype;return n.componentWillUnmount=function(){this.config.pipeline.unregister(this.searchProcessor),this.store.off("updated",this.storeUpdatedFn)},n.storeUpdated=function(t){this.searchProcessor.setProps({keyword:t.keyword})},n.onChange=function(t){this.actions.search(t.target.value)},n.render=function(){if(!this.props.enabled)return null;var t,i,o,s=this.onChange.bind(this);return this.searchProcessor instanceof Kt&&(t=s,i=this.props.debounceTimeout,s=function(){var l=arguments;return new Promise(function(u){o&&clearTimeout(o),o=setTimeout(function(){return u(t.apply(void 0,[].slice.call(l)))},i)})}),p("div",{className:y(x("search",this.config.className.search))},p("input",{type:"search",placeholder:this._("search.placeholder"),"aria-label":this._("search.placeholder"),onInput:s,className:x(y("input"),y("search","input")),value:this.store.state.keyword}))},e}(Ct);Vt.defaultProps={debounceTimeout:250};var De=function(r){function e(){return r.apply(this,arguments)||this}m(e,r);var n=e.prototype;return n.validateProps=function(){if(isNaN(Number(this.props.limit))||isNaN(Number(this.props.page)))throw Error("Invalid parameters passed")},n._process=function(t){var i=this.props.page;return new ct(t.rows.slice(i*this.props.limit,(i+1)*this.props.limit))},k(e,[{key:"type",get:function(){return I.Limit}}]),e}(j),Fe=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype._process=function(n){var t={};return this.props.url&&(t.url=this.props.url(n.url,this.props.page,this.props.limit)),this.props.body&&(t.body=this.props.body(n.body,this.props.page,this.props.limit)),C({},n,t)},k(e,[{key:"type",get:function(){return I.ServerLimit}}]),e}(j),Qt=function(r){function e(t,i){var o;return(o=r.call(this,t,i)||this).processor=void 0,o.onUpdateFn=void 0,o.setTotalFromTabularFn=void 0,o.state={limit:t.limit,page:t.page||0,total:0},o}m(e,r);var n=e.prototype;return n.componentWillMount=function(){var t,i=this;this.props.enabled&&(this.setTotalFromTabularFn=this.setTotalFromTabular.bind(this),this.props.server?(t=new Fe({limit:this.state.limit,page:this.state.page,url:this.props.server.url,body:this.props.server.body}),this.config.pipeline.on("afterProcess",this.setTotalFromTabularFn)):(t=new De({limit:this.state.limit,page:this.state.page})).on("beforeProcess",this.setTotalFromTabularFn),this.processor=t,this.config.pipeline.register(t),this.config.pipeline.on("error",function(){i.setState({total:0,page:0})}))},n.setTotalFromTabular=function(t){this.setTotal(t.length)},n.onUpdate=function(t){this.props.resetPageOnUpdate&&t!==this.processor&&this.setPage(0)},n.componentDidMount=function(){this.onUpdateFn=this.onUpdate.bind(this),this.config.pipeline.on("updated",this.onUpdateFn)},n.componentWillUnmount=function(){this.config.pipeline.unregister(this.processor),this.config.pipeline.off("updated",this.onUpdateFn)},n.setPage=function(t){if(t>=this.pages||t<0||t===this.state.page)return null;this.setState({page:t}),this.processor.setProps({page:t})},n.setTotal=function(t){this.setState({total:t})},n.renderPages=function(){var t=this;if(this.props.buttonsCount<=0)return null;var i=Math.min(this.pages,this.props.buttonsCount),o=Math.min(this.state.page,Math.floor(i/2));return this.state.page+Math.floor(i/2)>=this.pages&&(o=i-(this.pages-this.state.page)),p(M,null,this.pages>i&&this.state.page-o>0&&p(M,null,p("button",{tabIndex:0,role:"button",onClick:this.setPage.bind(this,0),title:this._("pagination.firstPage"),"aria-label":this._("pagination.firstPage"),className:this.config.className.paginationButton},this._("1")),p("button",{tabIndex:-1,className:x(y("spread"),this.config.className.paginationButton)},"...")),Array.from(Array(i).keys()).map(function(s){return t.state.page+(s-o)}).map(function(s){return p("button",{tabIndex:0,role:"button",onClick:t.setPage.bind(t,s),className:x(t.state.page===s?x(y("currentPage"),t.config.className.paginationButtonCurrent):null,t.config.className.paginationButton),title:t._("pagination.page",s+1),"aria-label":t._("pagination.page",s+1)},t._(""+(s+1)))}),this.pages>i&&this.pages>this.state.page+o+1&&p(M,null,p("button",{tabIndex:-1,className:x(y("spread"),this.config.className.paginationButton)},"..."),p("button",{tabIndex:0,role:"button",onClick:this.setPage.bind(this,this.pages-1),title:this._("pagination.page",this.pages),"aria-label":this._("pagination.page",this.pages),className:this.config.className.paginationButton},this._(""+this.pages))))},n.renderSummary=function(){return p(M,null,this.props.summary&&this.state.total>0&&p("div",{role:"status","aria-live":"polite",className:x(y("summary"),this.config.className.paginationSummary),title:this._("pagination.navigate",this.state.page+1,this.pages)},this._("pagination.showing")," ",p("b",null,this._(""+(this.state.page*this.state.limit+1)))," ",this._("pagination.to")," ",p("b",null,this._(""+Math.min((this.state.page+1)*this.state.limit,this.state.total)))," ",this._("pagination.of")," ",p("b",null,this._(""+this.state.total))," ",this._("pagination.results")))},n.render=function(){return this.props.enabled?p("div",{className:x(y("pagination"),this.config.className.pagination)},this.renderSummary(),p("div",{className:y("pages")},this.props.prevButton&&p("button",{tabIndex:0,role:"button",disabled:this.state.page===0,onClick:this.setPage.bind(this,this.state.page-1),title:this._("pagination.previous"),"aria-label":this._("pagination.previous"),className:x(this.config.className.paginationButton,this.config.className.paginationButtonPrev)},this._("pagination.previous")),this.renderPages(),this.props.nextButton&&p("button",{tabIndex:0,role:"button",disabled:this.pages===this.state.page+1||this.pages===0,onClick:this.setPage.bind(this,this.state.page+1),title:this._("pagination.next"),"aria-label":this._("pagination.next"),className:x(this.config.className.paginationButton,this.config.className.paginationButtonNext)},this._("pagination.next")))):null},k(e,[{key:"pages",get:function(){return Math.ceil(this.state.total/this.state.limit)}}]),e}(Ct);function Ae(r,e){return typeof r=="string"?r.indexOf("%")>-1?e/100*parseInt(r,10):parseInt(r,10):r}function xt(r){return r?Math.floor(r)+"px":""}Qt.defaultProps={summary:!0,nextButton:!0,prevButton:!0,buttonsCount:3,limit:10,resetPageOnUpdate:!0};var Re=function(r){function e(t,i){var o;return(o=r.call(this,t,i)||this).tableElement=void 0,o.tableClassName=void 0,o.tableStyle=void 0,o.tableElement=o.props.tableRef.current.base.cloneNode(!0),o.tableElement.style.position="absolute",o.tableElement.style.width="100%",o.tableElement.style.zIndex="-2147483640",o.tableElement.style.visibility="hidden",o.tableClassName=o.tableElement.className,o.tableStyle=o.tableElement.style.cssText,o}m(e,r);var n=e.prototype;return n.widths=function(){this.tableElement.className=this.tableClassName+" "+y("shadowTable"),this.tableElement.style.tableLayout="auto",this.tableElement.style.width="auto",this.tableElement.style.padding="0",this.tableElement.style.margin="0",this.tableElement.style.border="none",this.tableElement.style.outline="none";var t=Array.from(this.base.parentNode.querySelectorAll("thead th")).reduce(function(i,o){var s;return o.style.width=o.clientWidth+"px",C(((s={})[o.getAttribute("data-column-id")]={minWidth:o.clientWidth},s),i)},{});return this.tableElement.className=this.tableClassName,this.tableElement.style.cssText=this.tableStyle,this.tableElement.style.tableLayout="auto",Array.from(this.base.parentNode.querySelectorAll("thead th")).reduce(function(i,o){return i[o.getAttribute("data-column-id")].width=o.clientWidth,i},t)},n.render=function(){var t=this;return this.props.tableRef.current?p("div",{ref:function(i){i&&i.appendChild(t.tableElement)}}):null},e}(E);function Te(r){if(!r)return"";var e=r.split(" ");return e.length===1&&/([a-z][A-Z])+/g.test(r)?r:e.map(function(n,t){return t==0?n.toLowerCase():n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}).join("")}var q=function(r){function e(){var t;return(t=r.call(this)||this)._columns=void 0,t._columns=[],t}m(e,r);var n=e.prototype;return n.adjustWidth=function(t){var i=t.container,o=t.tableRef,s=t.tempRef,l=t.tempRef||!0;if(!i)return this;var u=i.clientWidth,d={current:null},a={};if(o.current&&l){var g=p(Re,{tableRef:o});g.ref=d,tt(g,s.current),a=d.current.widths()}for(var h,c=F(e.tabularFormat(this.columns).reduce(function(P,v){return P.concat(v)},[]));!(h=c()).done;){var f=h.value;f.columns&&f.columns.length>0||(!f.width&&l?f.id in a&&(f.width=xt(a[f.id].width),f.minWidth=xt(a[f.id].minWidth)):f.width=xt(Ae(f.width,u)))}return o.current&&l&&tt(null,s.current),this},n.setSort=function(t,i){for(var o,s=F(i||this.columns||[]);!(o=s()).done;){var l=o.value;l.columns&&l.columns.length>0&&(l.sort={enabled:!1}),l.sort===void 0&&t.sort&&(l.sort={enabled:!0}),l.sort?typeof l.sort=="object"&&(l.sort=C({enabled:!0},l.sort)):l.sort={enabled:!1},l.columns&&this.setSort(t,l.columns)}},n.setFixedHeader=function(t,i){for(var o,s=F(i||this.columns||[]);!(o=s()).done;){var l=o.value;l.fixedHeader===void 0&&(l.fixedHeader=t.fixedHeader),l.columns&&this.setFixedHeader(t,l.columns)}},n.setResizable=function(t,i){for(var o,s=F(i||this.columns||[]);!(o=s()).done;){var l=o.value;l.resizable===void 0&&(l.resizable=t.resizable),l.columns&&this.setResizable(t,l.columns)}},n.setID=function(t){for(var i,o=F(t||this.columns||[]);!(i=o()).done;){var s=i.value;s.id||typeof s.name!="string"||(s.id=Te(s.name)),s.id||L.error('Could not find a valid ID for one of the columns. Make sure a valid "id" is set for all columns.'),s.columns&&this.setID(s.columns)}},n.populatePlugins=function(t,i){for(var o,s=F(i);!(o=s()).done;){var l=o.value;l.plugin!==void 0&&t.plugin.add(C({id:l.id,props:{}},l.plugin,{position:w.PluginPosition.Cell}))}},e.fromColumns=function(t){for(var i,o=new e,s=F(t);!(i=s()).done;){var l=i.value;if(typeof l=="string"||Tt(l))o.columns.push({name:l});else if(typeof l=="object"){var u=l;u.columns&&(u.columns=e.fromColumns(u.columns).columns),typeof u.plugin=="object"&&u.data===void 0&&(u.data=null),o.columns.push(l)}}return o},e.fromUserConfig=function(t){var i=new e;return t.from?i.columns=e.fromHTMLTable(t.from).columns:t.columns?i.columns=e.fromColumns(t.columns).columns:!t.data||typeof t.data[0]!="object"||t.data[0]instanceof Array||(i.columns=Object.keys(t.data[0]).map(function(o){return{name:o}})),i.columns.length?(i.setID(),i.setSort(t),i.setFixedHeader(t),i.setResizable(t),i.populatePlugins(t,i.columns),i):null},e.fromHTMLTable=function(t){for(var i,o=new e,s=F(t.querySelector("thead").querySelectorAll("th"));!(i=s()).done;){var l=i.value;o.columns.push({name:l.innerHTML,width:l.width})}return o},e.tabularFormat=function(t){var i=[],o=t||[],s=[];if(o&&o.length){i.push(o);for(var l,u=F(o);!(l=u()).done;){var d=l.value;d.columns&&d.columns.length&&(s=s.concat(d.columns))}s.length&&(i=i.concat(this.tabularFormat(s)))}return i},e.leafColumns=function(t){var i=[],o=t||[];if(o&&o.length)for(var s,l=F(o);!(s=l()).done;){var u=s.value;u.columns&&u.columns.length!==0||i.push(u),u.columns&&(i=i.concat(this.leafColumns(u.columns)))}return i},e.maximumDepth=function(t){return this.tabularFormat([t]).length-1},k(e,[{key:"columns",get:function(){return this._columns},set:function(t){this._columns=t}},{key:"visibleColumns",get:function(){return this._columns.filter(function(t){return!t.hidden})}}]),e}(at),te=function(){function r(){this._callbacks=void 0,this._isDispatching=void 0,this._isHandled=void 0,this._isPending=void 0,this._lastID=void 0,this._pendingPayload=void 0,this._callbacks={},this._isDispatching=!1,this._isHandled={},this._isPending={},this._lastID=1}var e=r.prototype;return e.register=function(n){var t="ID_"+this._lastID++;return this._callbacks[t]=n,t},e.unregister=function(n){if(!this._callbacks[n])throw Error("Dispatcher.unregister(...): "+n+" does not map to a registered callback.");delete this._callbacks[n]},e.waitFor=function(n){if(!this._isDispatching)throw Error("Dispatcher.waitFor(...): Must be invoked while dispatching.");for(var t=0;t=s)return Promise.resolve(c.process(u)).then(function(v){i.cache.set(c.id,u=v)});u=i.cache.get(c.id)}();if(P&&P.then)return P.then(function(){})})}catch(c){return g(c)}return h&&h.then?h.then(void 0,g):h}(0,function(a){throw L.error(a),i.emit("error",u),a});return Promise.resolve(d&&d.then?d.then(o):o())}catch(a){return Promise.reject(a)}},n.findProcessorIndexByID=function(t){return this.steps.findIndex(function(i){return i.id==t})},n.setLastProcessorIndex=function(t){var i=this.findProcessorIndexByID(t.id);this.lastProcessorIndexUpdated>i&&(this.lastProcessorIndexUpdated=i)},n.processorPropsUpdated=function(t){this.setLastProcessorIndex(t),this.emit("propsUpdated"),this.emit("updated",t)},n.afterRegistered=function(t){this.setLastProcessorIndex(t),this.emit("afterRegister"),this.emit("updated",t)},k(e,[{key:"steps",get:function(){for(var t,i=[],o=F(this.getSortedProcessorTypes());!(t=o()).done;){var s=this._steps.get(t.value);s&&s.length&&(i=i.concat(s))}return i.filter(function(l){return l})}}]),e}(pt),Be=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype._process=function(n){try{return Promise.resolve(this.props.storage.get(n))}catch(t){return Promise.reject(t)}},k(e,[{key:"type",get:function(){return I.Extractor}}]),e}(j),Me=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype._process=function(n){var t=ct.fromArray(n.data);return t.length=n.total,t},k(e,[{key:"type",get:function(){return I.Transformer}}]),e}(j),He=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype._process=function(){return Object.entries(this.props.serverStorageOptions).filter(function(n){return typeof n[1]!="function"}).reduce(function(n,t){var i;return C({},n,((i={})[t[0]]=t[1],i))},{})},k(e,[{key:"type",get:function(){return I.Initiator}}]),e}(j),Oe=function(r){function e(){return r.apply(this,arguments)||this}m(e,r);var n=e.prototype;return n.castData=function(t){if(!t||!t.length)return[];if(!this.props.header||!this.props.header.columns)return t;var i=q.leafColumns(this.props.header.columns);return t[0]instanceof Array?t.map(function(o){var s=0;return i.map(function(l,u){return l.data!==void 0?(s++,typeof l.data=="function"?l.data(o):l.data):o[u-s]})}):typeof t[0]!="object"||t[0]instanceof Array?[]:t.map(function(o){return i.map(function(s,l){return s.data!==void 0?typeof s.data=="function"?s.data(o):s.data:s.id?o[s.id]:(L.error("Could not find the correct cell for column at position "+l+`. Make sure either 'id' or 'selector' is defined for all columns.`),null)})})},n._process=function(t){return{data:this.castData(t.data),total:t.total}},k(e,[{key:"type",get:function(){return I.Transformer}}]),e}(j),je=function(){function r(){}return r.createFromConfig=function(e){var n=new Le;return e.storage instanceof re&&n.register(new He({serverStorageOptions:e.server})),n.register(new Be({storage:e.storage})),n.register(new Oe({header:e.header})),n.register(new Me),n},r}(),se=function(){function r(n){this._userConfig=void 0,Object.assign(this,C({},r.defaultConfig(),n)),this._userConfig={}}var e=r.prototype;return e.assign=function(n){for(var t=0,i=Object.keys(n);ti?1:t1&&(g=!0,a=!0):u===0?a=!0:u>0&&!o?(a=!0,g=!0):u>0&&o&&(a=!0),g&&(l=[]),a)l.push({index:t,direction:i,compare:s});else if(c){var f=l.indexOf(d);l[f].direction=i}else if(h){var P=l.indexOf(d);l.splice(P,1)}this.setState(l)},e}(bt),ze=function(r){function e(){return r.apply(this,arguments)||this}m(e,r);var n=e.prototype;return n.sortColumn=function(t,i,o,s){this.dispatch("SORT_COLUMN",{index:t,direction:i,multi:o,compare:s})},n.sortToggle=function(t,i,o){this.dispatch("SORT_COLUMN_TOGGLE",{index:t,multi:i,compare:o})},e}(wt),$e=function(r){function e(){return r.apply(this,arguments)||this}return m(e,r),e.prototype._process=function(n){var t={};return this.props.url&&(t.url=this.props.url(n.url,this.props.columns)),this.props.body&&(t.body=this.props.body(n.body,this.props.columns)),C({},n,t)},k(e,[{key:"type",get:function(){return I.ServerSort}}]),e}(j),Ye=function(r){function e(t,i){var o;return(o=r.call(this,t,i)||this).sortProcessor=void 0,o.actions=void 0,o.store=void 0,o.updateStateFn=void 0,o.updateSortProcessorFn=void 0,o.actions=new ze(o.config.dispatcher),o.store=new Xe(o.config.dispatcher),t.enabled&&(o.sortProcessor=o.getOrCreateSortProcessor(),o.updateStateFn=o.updateState.bind(V(o)),o.store.on("updated",o.updateStateFn),o.state={direction:0}),o}m(e,r);var n=e.prototype;return n.componentWillUnmount=function(){this.config.pipeline.unregister(this.sortProcessor),this.store.off("updated",this.updateStateFn),this.updateSortProcessorFn&&this.store.off("updated",this.updateSortProcessorFn)},n.updateState=function(){var t=this,i=this.store.state.find(function(o){return o.index===t.props.index});this.setState(i?{direction:i.direction}:{direction:0})},n.updateSortProcessor=function(t){this.sortProcessor.setProps({columns:t})},n.getOrCreateSortProcessor=function(){var t=I.Sort;this.config.sort&&typeof this.config.sort.server=="object"&&(t=I.ServerSort);var i,o=this.config.pipeline.getStepsByType(t);return o.length>0?i=o[0]:(this.updateSortProcessorFn=this.updateSortProcessor.bind(this),this.store.on("updated",this.updateSortProcessorFn),i=t===I.ServerSort?new $e(C({columns:this.store.state},this.config.sort.server)):new We({columns:this.store.state}),this.config.pipeline.register(i)),i},n.changeDirection=function(t){t.preventDefault(),t.stopPropagation(),this.actions.sortToggle(this.props.index,t.shiftKey===!0&&this.config.sort.multiColumn,this.props.compare)},n.render=function(){if(!this.props.enabled)return null;var t=this.state.direction,i="neutral";return t===1?i="asc":t===-1&&(i="desc"),p("button",{tabIndex:-1,"aria-label":this._("sort.sort"+(t===1?"Desc":"Asc")),title:this._("sort.sort"+(t===1?"Desc":"Asc")),className:x(y("sort"),y("sort",i),this.config.className.sort),onClick:this.changeDirection.bind(this)})},e}(E),Je=function(r){function e(){for(var t,i=arguments.length,o=new Array(i),s=0;s=o&&(i.apply(void 0,d),u=Date.now())},Math.max(o-(Date.now()-u),0))):(i.apply(void 0,d),u=Date.now(),s=!0)}),document.addEventListener("mouseup",this.upFn),document.addEventListener("touchend",this.upFn),document.addEventListener("mousemove",this.moveFn),document.addEventListener("touchmove",this.moveFn)},n.move=function(t){t.stopPropagation();var i=this.props.thRef.current;this.state.offsetStart+this.getPageX(t)>=parseInt(i.style.minWidth,10)&&(i.style.width=this.state.offsetStart+this.getPageX(t)+"px")},n.end=function(t){t.stopPropagation(),document.removeEventListener("mouseup",this.upFn),document.removeEventListener("mousemove",this.moveFn),document.removeEventListener("touchmove",this.moveFn),document.removeEventListener("touchend",this.upFn)},n.render=function(){return p("div",{className:x(y("th"),y("resizable")),onMouseDown:this.start.bind(this),onTouchStart:this.start.bind(this),onClick:function(t){return t.stopPropagation()}})},e}(E),Ze=function(r){function e(t,i){var o;return(o=r.call(this,t,i)||this).sortRef={current:null},o.thRef={current:null},o.state={style:{}},o}m(e,r);var n=e.prototype;return n.isSortable=function(){return this.props.column.sort.enabled},n.isResizable=function(){return this.props.column.resizable},n.onClick=function(t){t.stopPropagation(),this.isSortable()&&this.sortRef.current.changeDirection(t)},n.keyDown=function(t){this.isSortable()&&t.which===13&&this.onClick(t)},n.componentDidMount=function(){var t=this;setTimeout(function(){if(t.props.column.fixedHeader&&t.thRef.current){var i=t.thRef.current.offsetTop;typeof i=="number"&&t.setState({style:{top:i}})}},0)},n.content=function(){return this.props.column.name!==void 0?this.props.column.name:this.props.column.plugin!==void 0?p(ht,{pluginId:this.props.column.plugin.id,props:{column:this.props.column}}):null},n.getCustomAttributes=function(){var t=this.props.column;return t?typeof t.attributes=="function"?t.attributes(null,null,this.props.column):t.attributes:{}},n.render=function(){var t={};return this.isSortable()&&(t.tabIndex=0),p("th",C({ref:this.thRef,"data-column-id":this.props.column&&this.props.column.id,className:x(y("th"),this.isSortable()?y("th","sort"):null,this.props.column.fixedHeader?y("th","fixed"):null,this.config.className.th),onClick:this.onClick.bind(this),style:C({},this.config.style.th,{minWidth:this.props.column.minWidth,width:this.props.column.width},this.state.style,this.props.style),onKeyDown:this.keyDown.bind(this),rowSpan:this.props.rowSpan>1?this.props.rowSpan:void 0,colSpan:this.props.colSpan>1?this.props.colSpan:void 0},this.getCustomAttributes(),t),p("div",{className:y("th","content")},this.content()),this.isSortable()&&p(Ye,C({ref:this.sortRef,index:this.props.index},this.props.column.sort)),this.isResizable()&&this.props.index0?(L.error("The container element "+t+" is not empty. Make sure the container is empty and call render() again"),this):(this.config.container=t,tt(this.createElement(),t),this)},e}(pt),Nt=0,ue=[],dt=[],ce=_.__b,pe=_.__r,he=_.diffed,de=_.__c,fe=_.unmount;function me(r,e){_.__h&&_.__h(T,r,Nt||e),Nt=0;var n=T.__H||(T.__H={__:[],__h:[]});return r>=n.__.length&&n.__.push({__V:dt}),n.__[r]}function nn(){for(var r;r=ue.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(ft),r.__H.__h.forEach(It),r.__H.__h=[]}catch(e){r.__H.__h=[],_.__e(e,r.__v)}}_.__b=function(r){T=null,ce&&ce(r)},_.__r=function(r){pe&&pe(r),St=0;var e=(T=r.__c).__H;e&&(kt===T?(e.__h=[],T.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=dt,n.__N=n.i=void 0})):(e.__h.forEach(ft),e.__h.forEach(It),e.__h=[])),kt=T},_.diffed=function(r){he&&he(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(ue.push(e)!==1&&ae===_.requestAnimationFrame||((ae=_.requestAnimationFrame)||function(n){var t,i=function(){clearTimeout(o),ge&&cancelAnimationFrame(t),setTimeout(n)},o=setTimeout(i,100);ge&&(t=requestAnimationFrame(i))})(nn)),e.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==dt&&(n.__=n.__V),n.i=void 0,n.__V=dt})),kt=T=null},_.__c=function(r,e){e.some(function(n){try{n.__h.forEach(ft),n.__h=n.__h.filter(function(t){return!t.__||It(t)})}catch(t){e.some(function(i){i.__h&&(i.__h=[])}),e=[],_.__e(t,n.__v)}}),de&&de(r,e)},_.unmount=function(r){fe&&fe(r);var e,n=r.__c;n&&n.__H&&(n.__H.__.forEach(function(t){try{ft(t)}catch(i){e=i}}),e&&_.__e(e,n.__v))};var ge=typeof requestAnimationFrame=="function";function ft(r){var e=T,n=r.__c;typeof n=="function"&&(r.__c=void 0,n()),T=e}function It(r){var e=T;r.__c=r.__(),T=e}function _e(r,e){return!r||r.length!==e.length||e.some(function(n,t){return n!==r[t]})}w.BaseActions=wt,w.BaseComponent=E,w.BaseStore=bt,w.Cell=lt,w.Component=Y,w.Config=se,w.Dispatcher=te,w.Grid=en,w.PluginBaseComponent=Ct,w.Row=ut,w.className=y,w.createElement=p,w.createRef=function(){return{current:null}},w.h=p,w.html=yt,w.useEffect=function(r,e){var n=me(St++,3);!_.__s&&_e(n.__H,e)&&(n.__=r,n.i=e,T.__H.__h.push(n))},w.useRef=function(r){return Nt=5,function(e,n){var t=me(St++,7);return _e(t.__H,n)?(t.__V=e(),t.i=n,t.__h=e,t.__V):t.__}(function(){return{current:r}},[])}})})(Dt,Dt.exports);var z=Dt.exports;const et=an(z);class ln{init(){this.GridjsTableInit()}GridjsTableInit(){document.getElementById("table-gridjs")&&new z.Grid({columns:[{name:"ID",formatter:function(B){return et.html(''+B+"")}},"Name",{name:"Email",formatter:function(B){return et.html(''+B+"")}},"Position","Company","Country",{name:"Actions",width:"120px",formatter:function(B){return et.html("Details")}}],pagination:{limit:5},sort:!0,search:!0,data:[["11","Alice","alice@example.com","Software Engineer","ABC Company","United States"],["12","Bob","bob@example.com","Product Manager","XYZ Inc","Canada"],["13","Charlie","charlie@example.com","Data Analyst","123 Corp","Australia"],["14","David","david@example.com","UI/UX Designer","456 Ltd","United Kingdom"],["15","Eve","eve@example.com","Marketing Specialist","789 Enterprises","France"],["16","Frank","frank@example.com","HR Manager","ABC Company","Germany"],["17","Grace","grace@example.com","Financial Analyst","XYZ Inc","Japan"],["18","Hannah","hannah@example.com","Sales Representative","123 Corp","Brazil"],["19","Ian","ian@example.com","Software Developer","456 Ltd","India"],["20","Jane","jane@example.com","Operations Manager","789 Enterprises","China"]]}).render(document.getElementById("table-gridjs")),document.getElementById("table-pagination")&&new z.Grid({columns:[{name:"ID",width:"120px",formatter:function(B){return et.html(''+B+"")}},"Name","Date","Total",{name:"Actions",width:"100px",formatter:function(B){return et.html("")}}],pagination:{limit:5},data:[["#RB2320","Alice","07 Oct, 2024","$24.05"],["#RB8652","Bob","07 Oct, 2024","$26.15"],["#RB8520","Charlie","06 Oct, 2024","$21.25"],["#RB9512","David","05 Oct, 2024","$25.03"],["#RB7532","Eve","05 Oct, 2024","$22.61"],["#RB9632","Frank","04 Oct, 2024","$24.05"],["#RB7456","Grace","04 Oct, 2024","$26.15"],["#RB3002","Hannah","04 Oct, 2024","$21.25"],["#RB9857","Ian","03 Oct, 2024","$22.61"],["#RB2589","Jane","03 Oct, 2024","$25.03"]]}).render(document.getElementById("table-pagination")),document.getElementById("table-search")&&new z.Grid({columns:["Name","Email","Position","Company","Country"],pagination:{limit:5},search:!0,data:[["Alice","alice@example.com","Software Engineer","ABC Company","United States"],["Bob","bob@example.com","Product Manager","XYZ Inc","Canada"],["Charlie","charlie@example.com","Data Analyst","123 Corp","Australia"],["David","david@example.com","UI/UX Designer","456 Ltd","United Kingdom"],["Eve","eve@example.com","Marketing Specialist","789 Enterprises","France"],["Frank","frank@example.com","HR Manager","ABC Company","Germany"],["Grace","grace@example.com","Financial Analyst","XYZ Inc","Japan"],["Hannah","hannah@example.com","Sales Representative","123 Corp","Brazil"],["Ian","ian@example.com","Software Developer","456 Ltd","India"],["Jane","jane@example.com","Operations Manager","789 Enterprises","China"]]}).render(document.getElementById("table-search")),document.getElementById("table-sorting")&&new z.Grid({columns:["Name","Email","Position","Company","Country"],pagination:{limit:5},sort:!0,data:[["Alice","alice@example.com","Software Engineer","ABC Company","United States"],["Bob","bob@example.com","Product Manager","XYZ Inc","Canada"],["Charlie","charlie@example.com","Data Analyst","123 Corp","Australia"],["David","david@example.com","UI/UX Designer","456 Ltd","United Kingdom"],["Eve","eve@example.com","Marketing Specialist","789 Enterprises","France"],["Frank","frank@example.com","HR Manager","ABC Company","Germany"],["Grace","grace@example.com","Financial Analyst","XYZ Inc","Japan"],["Hannah","hannah@example.com","Sales Representative","123 Corp","Brazil"],["Ian","ian@example.com","Software Developer","456 Ltd","India"],["Jane","jane@example.com","Operations Manager","789 Enterprises","China"]]}).render(document.getElementById("table-sorting")),document.getElementById("table-loading-state")&&new z.Grid({columns:["Name","Email","Position","Company","Country"],pagination:{limit:5},sort:!0,data:function(){return new Promise(function(B){setTimeout(function(){B([["Alice","alice@example.com","Software Engineer","ABC Company","United States"],["Bob","bob@example.com","Product Manager","XYZ Inc","Canada"],["Charlie","charlie@example.com","Data Analyst","123 Corp","Australia"],["David","david@example.com","UI/UX Designer","456 Ltd","United Kingdom"],["Eve","eve@example.com","Marketing Specialist","789 Enterprises","France"],["Frank","frank@example.com","HR Manager","ABC Company","Germany"],["Grace","grace@example.com","Financial Analyst","XYZ Inc","Japan"],["Hannah","hannah@example.com","Sales Representative","123 Corp","Brazil"],["Ian","ian@example.com","Software Developer","456 Ltd","India"],["Jane","jane@example.com","Operations Manager","789 Enterprises","China"]])},2e3)})}}).render(document.getElementById("table-loading-state")),document.getElementById("table-fixed-header")&&new z.Grid({columns:["Name","Email","Position","Company","Country"],sort:!0,pagination:!0,fixedHeader:!0,height:"400px",data:[["Alice","alice@example.com","Software Engineer","ABC Company","United States"],["Bob","bob@example.com","Product Manager","XYZ Inc","Canada"],["Charlie","charlie@example.com","Data Analyst","123 Corp","Australia"],["David","david@example.com","UI/UX Designer","456 Ltd","United Kingdom"],["Eve","eve@example.com","Marketing Specialist","789 Enterprises","France"],["Frank","frank@example.com","HR Manager","ABC Company","Germany"],["Grace","grace@example.com","Financial Analyst","XYZ Inc","Japan"],["Hannah","hannah@example.com","Sales Representative","123 Corp","Brazil"],["Ian","ian@example.com","Software Developer","456 Ltd","India"],["Jane","jane@example.com","Operations Manager","789 Enterprises","China"]]}).render(document.getElementById("table-fixed-header")),document.getElementById("table-hidden-column")&&new z.Grid({columns:["Name","Email","Position","Company",{name:"Country",hidden:!0}],pagination:{limit:5},sort:!0,data:[["Alice","alice@example.com","Software Engineer","ABC Company","United States"],["Bob","bob@example.com","Product Manager","XYZ Inc","Canada"],["Charlie","charlie@example.com","Data Analyst","123 Corp","Australia"],["David","david@example.com","UI/UX Designer","456 Ltd","United Kingdom"],["Eve","eve@example.com","Marketing Specialist","789 Enterprises","France"],["Frank","frank@example.com","HR Manager","ABC Company","Germany"],["Grace","grace@example.com","Financial Analyst","XYZ Inc","Japan"],["Hannah","hannah@example.com","Sales Representative","123 Corp","Brazil"],["Ian","ian@example.com","Software Developer","456 Ltd","India"],["Jane","jane@example.com","Operations Manager","789 Enterprises","China"]]}).render(document.getElementById("table-hidden-column"))}}document.addEventListener("DOMContentLoaded",function(Ft){new ln().init()});