2 var ResponsiveLayout=
function(e){this.table=e,this.columns=[],this.hiddenColumns=[],this.mode=
"",this.index=0,this.collapseFormatter=[],this.collapseStartOpen=!0,this.collapseHandleColumn=!1};ResponsiveLayout.prototype.initialize=
function(){var e=
this,t=[];this.mode=this.table.options.responsiveLayout,this.collapseFormatter=this.table.options.responsiveLayoutCollapseFormatter||this.formatCollapsedData,this.collapseStartOpen=this.table.options.responsiveLayoutCollapseStartOpen,this.hiddenColumns=[],this.table.columnManager.columnsByIndex.forEach(
function(o,n){o.modules.responsive&&o.modules.responsive.order&&o.modules.responsive.visible&&(o.modules.responsive.index=n,t.push(o),o.visible||
"collapse"!==e.mode||e.hiddenColumns.push(o))}),t=t.reverse(),t=t.sort(
function(e,t){
return t.modules.responsive.order-e.modules.responsive.order||t.modules.responsive.index-e.modules.responsive.index}),this.columns=t,
"collapse"===this.mode&&this.generateCollapsedContent();
for(var o=this.table.columnManager.columnsByIndex,n=Array.isArray(o),s=0,o=n?o:o[Symbol.iterator]();;){var i;
if(n){
if(s>=o.length)
break;i=o[s++]}
else{
if(s=o.next(),s.done)
break;i=s.value}var l=i;
if(
"responsiveCollapse"==l.definition.formatter){this.collapseHandleColumn=l;
break}}this.collapseHandleColumn&&(this.hiddenColumns.length?this.collapseHandleColumn.show():this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.initializeColumn=
function(e){var t=e.getDefinition();e.modules.responsive={order:
void 0===t.responsive?1:t.responsive,visible:!1!==t.visible}},ResponsiveLayout.prototype.initializeRow=
function(e){var t;
"calc"!==e.type&&(t=document.createElement(
"div"),t.classList.add(
"tabulator-responsive-collapse"),e.modules.responsiveLayout={element:t,open:this.collapseStartOpen},this.collapseStartOpen||(t.style.display=
"none"))},ResponsiveLayout.prototype.layoutRow=
function(e){var t=e.getElement();e.modules.responsiveLayout&&(t.appendChild(e.modules.responsiveLayout.element),this.generateCollapsedRowContent(e))},ResponsiveLayout.prototype.updateColumnVisibility=
function(e,t){e.modules.responsive&&(e.modules.responsive.visible=t,this.initialize())},ResponsiveLayout.prototype.hideColumn=
function(e){var t=this.hiddenColumns.length;e.hide(!1,!0),
"collapse"===this.mode&&(this.hiddenColumns.unshift(e),this.generateCollapsedContent(),this.collapseHandleColumn&&!t&&this.collapseHandleColumn.show())},ResponsiveLayout.prototype.showColumn=
function(e){var t;e.show(!1,!0),e.setWidth(e.getWidth()),
"collapse"===this.mode&&(t=this.hiddenColumns.indexOf(e),t>-1&&this.hiddenColumns.splice(t,1),this.generateCollapsedContent(),this.collapseHandleColumn&&!this.hiddenColumns.length&&this.collapseHandleColumn.hide())},ResponsiveLayout.prototype.update=
function(){
for(var e=
this,t=!0;t;){var o=
"fitColumns"==e.table.modules.layout.getMode()?e.table.columnManager.getFlexBaseWidth():e.table.columnManager.getWidth(),n=(e.table.options.headerVisible?e.table.columnManager.element.clientWidth:e.table.element.clientWidth)-o;
if(n<0){var s=e.columns[e.index];s?(e.hideColumn(s),e.index++):t=!1}
else{var i=e.columns[e.index-1];i&&n>0&&n>=i.getWidth()?(e.showColumn(i),e.index--):t=!1}e.table.rowManager.activeRowsCount||e.table.rowManager.renderEmptyScroll()}},ResponsiveLayout.prototype.generateCollapsedContent=
function(){var e=
this;this.table.rowManager.getDisplayRows().forEach(
function(t){e.generateCollapsedRowContent(t)})},ResponsiveLayout.prototype.generateCollapsedRowContent=
function(e){var t,o;
if(e.modules.responsiveLayout){
for(t=e.modules.responsiveLayout.element;t.firstChild;)t.removeChild(t.firstChild);o=this.collapseFormatter(this.generateCollapsedRowData(e)),o&&t.appendChild(o)}},ResponsiveLayout.prototype.generateCollapsedRowData=
function(e){var t,o=
this,n=e.getData(),s=[];
return this.hiddenColumns.forEach(
function(i){var l=i.getFieldValue(n);i.definition.title&&i.field&&(i.modules.format&&o.table.options.responsiveLayoutCollapseUseFormatters?(t={value:!1,data:{},getValue:
function(){
return l},getData:
function(){
return n},getElement:
function(){
return document.createElement(
"div")},getRow:
function(){
return e.getComponent()},getColumn:
function(){
return i.getComponent()}},s.push({title:i.definition.title,value:i.modules.format.formatter.call(o.table.modules.format,t,i.modules.format.params)})):s.push({title:i.definition.title,value:l}))}),s},ResponsiveLayout.prototype.formatCollapsedData=
function(e){var t=document.createElement(
"table"),o=
"";
return e.forEach(
function(e){var t=document.createElement(
"div");e.value instanceof Node&&(t.appendChild(e.value),e.value=t.innerHTML),o+=
"<tr><td><strong>"+e.title+
"</strong></td><td>"+e.value+
"</td></tr>"}),t.innerHTML=o,Object.keys(e).length?t:
""},Tabulator.prototype.registerModule(
"responsiveLayout",ResponsiveLayout);