tupali_fork/librerias/datatables2/SearchPanes-1.1.0/js/dataTables.searchPanes.min.js
2020-05-20 18:49:50 -05:00

105 lines
49 KiB
JavaScript

/*!
SearchPanes 1.1.0
2019-2020 SpryMedia Ltd - datatables.net/license
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.getGlobal=function(e){e=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,e];for(var t=0;t<e.length;++t){var d=e[t];if(d&&d.Math==Math)return d}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.checkEs6ConformanceViaProxy=function(){try{var e={},t=Object.create(new $jscomp.global.Proxy(e,{get:function(d,n,q){return d==e&&"q"==n&&q==t}}));return!0===t.q}catch(d){return!1}};
$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();$jscomp.arrayIteratorImpl=function(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}};$jscomp.arrayIterator=function(e){return{next:$jscomp.arrayIteratorImpl(e)}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,d){e!=Array.prototype&&e!=Object.prototype&&(e[t]=d.value)};$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.SymbolClass=function(e,t){this.$jscomp$symbol$id_=e;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:t})};
$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function e(d){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(d||"")+"_"+t++,d)}var t=0;return e}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.asyncIterator;e||(e=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};
$jscomp.makeIterator=function(e){var t="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return t?t.call(e):$jscomp.arrayIterator(e)};$jscomp.owns=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};$jscomp.polyfill=function(e,t,d,n){if(t){d=$jscomp.global;e=e.split(".");for(n=0;n<e.length-1;n++){var q=e[n];q in d||(d[q]={});d=d[q]}e=e[e.length-1];n=d[e];t=t(n);t!=n&&null!=t&&$jscomp.defineProperty(d,e,{configurable:!0,writable:!0,value:t})}};
$jscomp.polyfill("WeakMap",function(e){function t(){if(!e||!Object.seal)return!1;try{var a=Object.seal({}),c=Object.seal({}),f=new e([[a,2],[c,3]]);if(2!=f.get(a)||3!=f.get(c))return!1;f.delete(a);f.set(c,4);return!f.has(a)&&4==f.get(c)}catch(r){return!1}}function d(){}function n(a){var c=typeof a;return"object"===c&&null!==a||"function"===c}function q(a){if(!$jscomp.owns(a,v)){var c=new d;$jscomp.defineProperty(a,v,{value:c})}}function h(a){var c=Object[a];c&&(Object[a]=function(a){if(a instanceof
d)return a;q(a);return c(a)})}if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(e&&$jscomp.ES6_CONFORMANCE)return e}else if(t())return e;var v="$jscomp_hidden_"+Math.random();h("freeze");h("preventExtensions");h("seal");var w=0,b=function(a){this.id_=(w+=Math.random()+1).toString();if(a){a=$jscomp.makeIterator(a);for(var c;!(c=a.next()).done;)c=c.value,this.set(c[0],c[1])}};b.prototype.set=function(a,c){if(!n(a))throw Error("Invalid WeakMap key");q(a);if(!$jscomp.owns(a,v))throw Error("WeakMap key fail: "+
a);a[v][this.id_]=c;return this};b.prototype.get=function(a){return n(a)&&$jscomp.owns(a,v)?a[v][this.id_]:void 0};b.prototype.has=function(a){return n(a)&&$jscomp.owns(a,v)&&$jscomp.owns(a[v],this.id_)};b.prototype.delete=function(a){return n(a)&&$jscomp.owns(a,v)&&$jscomp.owns(a[v],this.id_)?delete a[v][this.id_]:!1};return b},"es6","es3");$jscomp.MapEntry=function(){};
$jscomp.polyfill("Map",function(e){function t(){if($jscomp.ASSUME_NO_NATIVE_MAP||!e||"function"!=typeof e||!e.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),a=new e($jscomp.makeIterator([[b,"s"]]));if("s"!=a.get(b)||1!=a.size||a.get({x:4})||a.set({x:4},"t")!=a||2!=a.size)return!1;var c=a.entries(),f=c.next();if(f.done||f.value[0]!=b||"s"!=f.value[1])return!1;f=c.next();return f.done||4!=f.value[0].x||"t"!=f.value[1]||!c.next().done?!1:!0}catch(r){return!1}}
if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(e&&$jscomp.ES6_CONFORMANCE)return e}else if(t())return e;$jscomp.initSymbolIterator();var d=new WeakMap,n=function(b){this.data_={};this.head_=v();this.size=0;if(b){b=$jscomp.makeIterator(b);for(var a;!(a=b.next()).done;)a=a.value,this.set(a[0],a[1])}};n.prototype.set=function(b,a){b=0===b?0:b;var c=q(this,b);c.list||(c.list=this.data_[c.id]=[]);c.entry?c.entry.value=a:(c.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:b,
value:a},c.list.push(c.entry),this.head_.previous.next=c.entry,this.head_.previous=c.entry,this.size++);return this};n.prototype.delete=function(b){b=q(this,b);return b.entry&&b.list?(b.list.splice(b.index,1),b.list.length||delete this.data_[b.id],b.entry.previous.next=b.entry.next,b.entry.next.previous=b.entry.previous,b.entry.head=null,this.size--,!0):!1};n.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=v();this.size=0};n.prototype.has=function(b){return!!q(this,b).entry};
n.prototype.get=function(b){return(b=q(this,b).entry)&&b.value};n.prototype.entries=function(){return h(this,function(b){return[b.key,b.value]})};n.prototype.keys=function(){return h(this,function(b){return b.key})};n.prototype.values=function(){return h(this,function(b){return b.value})};n.prototype.forEach=function(b,a){for(var c=this.entries(),f;!(f=c.next()).done;)f=f.value,b.call(a,f[1],f[0],this)};n.prototype[Symbol.iterator]=n.prototype.entries;var q=function(b,a){var c;var f=(c=a)&&typeof c;
"object"==f||"function"==f?d.has(c)?c=d.get(c):(f=""+ ++w,d.set(c,f),c=f):c="p_"+c;if((f=b.data_[c])&&$jscomp.owns(b.data_,c))for(b=0;b<f.length;b++){var r=f[b];if(a!==a&&r.key!==r.key||a===r.key)return{id:c,list:f,index:b,entry:r}}return{id:c,list:f,index:-1,entry:void 0}},h=function(b,a){var c=b.head_;return $jscomp.iteratorPrototype(function(){if(c){for(;c.head!=b.head_;)c=c.previous;for(;c.next!=c.head;)return c=c.next,{done:!1,value:a(c)};c=null}return{done:!0,value:void 0}})},v=function(){var b=
{};return b.previous=b.next=b.head=b},w=0;return n},"es6","es3");$jscomp.findInternal=function(e,t,d){e instanceof String&&(e=String(e));for(var n=e.length,q=0;q<n;q++){var h=e[q];if(t.call(d,h,q,e))return{i:q,v:h}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(e){return e?e:function(e,d){return $jscomp.findInternal(this,e,d).v}},"es6","es3");
$jscomp.iteratorFromArray=function(e,t){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var d=0,n={next:function(){if(d<e.length){var q=d++;return{value:t(q,e[q]),done:!1}}n.next=function(){return{done:!0,value:void 0}};return n.next()}};n[Symbol.iterator]=function(){return n};return n};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6","es3");
$jscomp.polyfill("Array.prototype.findIndex",function(e){return e?e:function(e,d){return $jscomp.findInternal(this,e,d).i}},"es6","es3");
(function(){function e(b){d=b;n=b.fn.dataTable}function t(b){h=b;v=b.fn.dataTable}var d,n,q=function(){function b(a,c,f,r,g,l){var k=this;void 0===l&&(l=null);if(!n||!n.versionCheck||!n.versionCheck("1.10.0"))throw Error("SearchPane requires DataTables 1.10 or newer");if(!n.select)throw Error("SearchPane requires Select");a=new n.Api(a);this.classes=d.extend(!0,{},b.classes);this.c=d.extend(!0,{},b.defaults,c);this.customPaneSettings=l;this.s={cascadeRegen:!1,clearing:!1,colOpts:[],deselect:!1,displayed:!1,
dt:a,dtPane:void 0,filteringActive:!1,index:f,indexes:[],lastCascade:!1,lastSelect:!1,listSet:!1,name:void 0,redraw:!1,rowData:{arrayFilter:[],arrayOriginal:[],arrayTotals:[],bins:{},binsOriginal:{},binsTotal:{},filterMap:new Map,totalOptions:0},searchFunction:void 0,selectPresent:!1,serverSelect:[],serverSelecting:!1,showFiltered:!1,tableLength:null,updating:!1};c=a.columns().eq(0).toArray().length;this.colExists=this.s.index<c;this.c.layout=r;c=parseInt(r.split("-")[1],10);this.dom={buttonGroup:d("<div/>").addClass(this.classes.buttonGroup),
clear:d('<button type="button">&#215;</button>').addClass(this.classes.dull).addClass(this.classes.paneButton).addClass(this.classes.clearButton),container:d("<div/>").addClass(this.classes.container).addClass(this.classes.layout+(10>c?r:r.split("-")[0]+"-9")),countButton:d('<button type="button"></button>').addClass(this.classes.paneButton).addClass(this.classes.countButton),dtP:d("<table><thead><tr><th>"+(this.colExists?d(a.column(this.colExists?this.s.index:0).header()).text():this.customPaneSettings.header||
"Custom Pane")+"</th><th/></tr></thead></table>"),lower:d("<div/>").addClass(this.classes.subRow2).addClass(this.classes.narrowButton),nameButton:d('<button type="button"></button>').addClass(this.classes.paneButton).addClass(this.classes.nameButton),panesContainer:g,searchBox:d("<input/>").addClass(this.classes.paneInputButton).addClass(this.classes.search),searchButton:d('<button type = "button" class="'+this.classes.searchIcon+'"></button>').addClass(this.classes.paneButton),searchCont:d("<div/>").addClass(this.classes.searchCont),
searchLabelCont:d("<div/>").addClass(this.classes.searchLabelCont),topRow:d("<div/>").addClass(this.classes.topRow),upper:d("<div/>").addClass(this.classes.subRow1).addClass(this.classes.narrowSearch)};this.s.displayed=!1;a=this.s.dt;this.selections=[];this.s.colOpts=this.colExists?this._getOptions():this._getBonusOptions();var e=this.s.colOpts;r=d('<button type="button">X</button>').addClass(this.classes.paneButton);d(r).text(a.i18n("searchPanes.clearPane","X"));this.dom.container.addClass(e.className);
this.dom.container.addClass(null!==this.customPaneSettings&&void 0!==this.customPaneSettings.className?this.customPaneSettings.className:"");this.s.name=void 0!==this.s.colOpts.name?this.s.colOpts.name:null!==this.customPaneSettings&&void 0!==this.customPaneSettings.name?this.customPaneSettings.name:this.colExists?d(a.column(this.s.index).header()).text():this.customPaneSettings.header||"Custom Pane";d(g).append(this.dom.container);var u=a.table(0).node();this.s.searchFunction=function(a,c,f,r){if(0===
k.selections.length||a.nTable!==u)return!0;a="";k.colExists&&(a=c[k.s.index],"filter"!==e.orthogonal.filter&&(a=k.s.rowData.filterMap.get(f),a instanceof d.fn.dataTable.Api&&(a=a.toArray())));return k._search(a,f)};d.fn.dataTable.ext.search.push(this.s.searchFunction);if(this.c.clear)d(r).on("click",function(){k.dom.container.find(k.classes.search).each(function(){d(this).val("");d(this).trigger("input")});k.clearPane()});a.on("draw.dtsp",function(){k._adjustTopRow()});a.on("buttons-action",function(){k._adjustTopRow()});
d(window).on("resize.dtsp",n.util.throttle(function(){k._adjustTopRow()}));a.on("column-reorder.dtsp",function(a,c,f){k.s.index=f.mapping[k.s.index]});return this}b.prototype.clearData=function(){this.s.rowData={arrayFilter:[],arrayOriginal:[],arrayTotals:[],bins:{},binsOriginal:{},binsTotal:{},filterMap:new Map,totalOptions:0}};b.prototype.clearPane=function(){this.s.dtPane.rows({selected:!0}).deselect();this.updateTable();return this};b.prototype.destroy=function(){d(this.s.dtPane).off(".dtsp");
d(this.s.dt).off(".dtsp");d(this.dom.nameButton).off(".dtsp");d(this.dom.countButton).off(".dtsp");d(this.dom.clear).off(".dtsp");d(this.dom.searchButton).off(".dtsp");d(this.dom.container).remove();for(var a=d.fn.dataTable.ext.search.indexOf(this.s.searchFunction);-1!==a;)d.fn.dataTable.ext.search.splice(a,1),a=d.fn.dataTable.ext.search.indexOf(this.s.searchFunction);void 0!==this.s.dtPane&&this.s.dtPane.destroy();this.s.listSet=!1};b.prototype.getPaneCount=function(){return void 0!==this.s.dtPane?
this.s.dtPane.rows({selected:!0}).data().toArray().length:0};b.prototype.rebuildPane=function(a,c,f,r){void 0===a&&(a=!1);void 0===c&&(c=null);void 0===f&&(f=null);void 0===r&&(r=!1);this.clearData();var g=[];this.s.serverSelect=[];var b=null;void 0!==this.s.dtPane&&(r&&(this.s.dt.page.info().serverSide?this.s.serverSelect=this.s.dtPane.rows({selected:!0}).data().toArray():g=this.s.dtPane.rows({selected:!0}).data().toArray()),this.s.dtPane.clear().destroy(),b=d(this.dom.container).prev(),this.destroy(),
this.s.dtPane=void 0,d.fn.dataTable.ext.search.push(this.s.searchFunction));this.dom.container.removeClass(this.classes.hidden);this.s.displayed=!1;this._buildPane(g,a,c,f,b);return this};b.prototype.removePane=function(){this.s.displayed=!1;d(this.dom.container).hide()};b.prototype.setCascadeRegen=function(a){this.s.cascadeRegen=a};b.prototype.setClear=function(a){this.s.clearing=a};b.prototype.updatePane=function(a){void 0===a&&(a=!1);this.s.updating=!0;this._updateCommon(a);this.s.updating=!1};
b.prototype.updateTable=function(){this.selections=this.s.dtPane.rows({selected:!0}).data().toArray();this._searchExtras();(this.c.cascadePanes||this.c.viewTotal)&&this.updatePane()};b.prototype._setListeners=function(){var a=this,c=this.s.rowData,f;this.s.dtPane.on("select.dtsp",function(){a.s.dt.page.info().serverSide&&!a.s.updating?a.s.serverSelecting||(a.s.serverSelect=a.s.dtPane.rows({selected:!0}).data().toArray(),a.s.selectPresent=!0,a.s.dt.draw(!1)):(clearTimeout(f),d(a.dom.clear).removeClass(a.classes.dull),
a.s.selectPresent=!0,a.s.updating||a._makeSelection(),a.s.selectPresent=!1)});this.s.dtPane.on("deselect.dtsp",function(){f=setTimeout(function(){a.s.dt.page.info().serverSide&&!a.s.updating?a.s.serverSelecting||(a.s.serverSelect=a.s.dtPane.rows({selected:!0}).data().toArray(),a.s.deselect=!0,a.s.dt.draw(!1)):(a.s.deselect=!0,0===a.s.dtPane.rows({selected:!0}).data().toArray().length&&d(a.dom.clear).addClass(a.classes.dull),a._makeSelection(),a.s.deselect=!1,a.s.dt.state.save())},50)});this.s.dt.on("stateSaveParams.dtsp",
function(f,g,b){if(d.isEmptyObject(b))a.s.dtPane.state.clear();else{f=[];if(void 0!==a.s.dtPane){f=a.s.dtPane.rows({selected:!0}).data().map(function(a){return a.filter.toString()}).toArray();var r=d(a.dom.searchBox).val();var l=a.s.dtPane.order();var e=c.binsOriginal;var p=c.arrayOriginal}void 0===b.searchPanes&&(b.searchPanes={});void 0===b.searchPanes.panes&&(b.searchPanes.panes=[]);b.searchPanes.panes.push({arrayFilter:p,bins:e,id:a.s.index,order:l,searchTerm:r,selected:f})}});this.s.dtPane.on("user-select.dtsp",
function(a,c,f,b,d){d.stopPropagation()});this.s.dtPane.on("draw.dtsp",function(){a._adjustTopRow()});d(this.dom.nameButton).on("click.dtsp",function(){var c=a.s.dtPane.order()[0][1];a.s.dtPane.order([0,"asc"===c?"desc":"asc"]).draw();a.s.dt.state.save()});d(this.dom.countButton).on("click.dtsp",function(){var c=a.s.dtPane.order()[0][1];a.s.dtPane.order([1,"asc"===c?"desc":"asc"]).draw();a.s.dt.state.save()});d(this.dom.clear).on("click.dtsp",function(){a.dom.container.find("."+a.classes.search).each(function(){d(this).val("");
d(this).trigger("input")});a.clearPane()});d(this.dom.searchButton).on("click.dtsp",function(){d(a.dom.searchBox).focus()});d(this.dom.searchBox).on("input.dtsp",function(){a.s.dtPane.search(d(a.dom.searchBox).val()).draw();a.s.dt.state.save()});this.s.dt.state.save();return!0};b.prototype._addOption=function(a,c,f,r,b,l){if(Array.isArray(a)||a instanceof n.Api)if(a instanceof n.Api&&(a=a.toArray(),c=c.toArray()),a.length===c.length)for(var g=0;g<a.length;g++)l[a[g]]?l[a[g]]++:(l[a[g]]=1,b.push({display:c[g],
filter:a[g],sort:f[g],type:r[g]})),this.s.rowData.totalOptions++;else throw Error("display and filter not the same length");else"string"===typeof this.s.colOpts.orthogonal?(l[a]?l[a]++:(l[a]=1,b.push({display:c,filter:a,sort:f,type:r})),this.s.rowData.totalOptions++):b.push({display:c,filter:a,sort:f,type:r})};b.prototype._addRow=function(a,c,f,r,g,b){for(var k,l=0,d=this.s.indexes;l<d.length;l++){var e=d[l];e.filter===c&&(k=e.index)}void 0===k&&(k=this.s.indexes.length,this.s.indexes.push({filter:c,
index:k}));return this.s.dtPane.row.add({display:""!==a?a:this.c.emptyMessage,filter:c,index:k,shown:f,sort:""!==g?g:this.c.emptyMessage,total:r,type:b})};b.prototype._adjustTopRow=function(){var a=this.dom.container.find("."+this.classes.subRowsContainer),c=this.dom.container.find(".dtsp-subRow1"),f=this.dom.container.find(".dtsp-subRow2"),r=this.dom.container.find("."+this.classes.topRow);(252>d(a[0]).width()||252>d(r[0]).width())&&0!==d(a[0]).width()?(d(a[0]).addClass(this.classes.narrow),d(c[0]).addClass(this.classes.narrowSub).removeClass(this.classes.narrowSearch),
d(f[0]).addClass(this.classes.narrowSub).removeClass(this.classes.narrowButton)):(d(a[0]).removeClass(this.classes.narrow),d(c[0]).removeClass(this.classes.narrowSub).addClass(this.classes.narrowSearch),d(f[0]).removeClass(this.classes.narrowSub).addClass(this.classes.narrowButton))};b.prototype._buildPane=function(a,c,f,r,b){var g=this;void 0===a&&(a=[]);void 0===c&&(c=!1);void 0===f&&(f=null);void 0===r&&(r=null);void 0===b&&(b=null);this.selections=[];var k=this.s.dt,e=k.column(this.colExists?
this.s.index:0),u=this.s.colOpts,p=this.s.rowData,h=k.i18n("searchPanes.count","{total}"),t=k.i18n("searchPanes.countFiltered","{shown} ({total})"),q=k.state.loaded();this.s.listSet&&(q=k.state());if(this.colExists){var v=-1;if(q&&q.searchPanes&&q.searchPanes.panes)for(var m=0;m<q.searchPanes.panes.length;m++)if(q.searchPanes.panes[m].id===this.s.index){v=m;break}if((!1===u.show||void 0!==u.show&&!0!==u.show)&&-1===v)return this.dom.container.addClass(this.classes.hidden),this.s.displayed=!1;if(!0===
u.show||-1!==v)this.s.displayed=!0;if(!this.s.dt.page.info().serverSide){if(0===p.arrayFilter.length)if(this._populatePane(c),q&&q.searchPanes&&q.searchPanes.panes)if(-1!==v)p.binsOriginal=q.searchPanes.panes[v].bins,p.arrayOriginal=q.searchPanes.panes[v].arrayFilter;else{this.dom.container.addClass(this.classes.hidden);this.s.displayed=!1;return}else p.arrayOriginal=p.arrayFilter,p.binsOriginal=p.bins;m=Object.keys(p.binsOriginal).length;f=this._uniqueRatio(m,k.rows()[0].length);if(!1===this.s.displayed&&
((void 0===u.show&&null===u.threshold?f>this.c.threshold:f>u.threshold)||!0!==u.show&&1>=m)){this.dom.container.addClass(this.classes.hidden);this.s.displayed=!1;return}this.c.viewTotal&&0===p.arrayTotals.length?this._detailsPane():p.binsTotal=p.bins;this.dom.container.addClass(this.classes.show);this.s.displayed=!0}else if(null!==f){if(void 0!==f.tableLength)this.s.tableLength=f.tableLength,this.s.rowData.totalOptions=this.s.tableLength;else if(null===this.s.tableLength||k.rows()[0].length>this.s.tableLength)this.s.tableLength=
k.rows()[0].length,this.s.rowData.totalOptions=this.s.tableLength;c=k.column(this.s.index).dataSrc();if(void 0!==f[c])for(m=0,f=f[c];m<f.length;m++)c=f[m],this.s.rowData.arrayFilter.push({display:c.label,filter:c.value,sort:c.label,type:c.label}),this.s.rowData.bins[c.value]=this.c.viewTotal||this.c.cascadePanes?c.count:c.total,this.s.rowData.binsTotal[c.value]=c.total;m=Object.keys(p.binsTotal).length;f=this._uniqueRatio(m,this.s.tableLength);if(!1===this.s.displayed&&((void 0===u.show&&null===u.threshold?
f>this.c.threshold:f>u.threshold)||!0!==u.show&&1>=m)){this.dom.container.addClass(this.classes.hidden);this.s.displayed=!1;return}this.s.displayed=!0}}else this.s.displayed=!0;this._displayPane();if(!this.s.listSet)this.dom.dtP.on("stateLoadParams.dt",function(a,c,f){d.isEmptyObject(k.state.loaded())&&d.each(f,function(a,c){delete f[a]})});null!==b&&0<d(this.dom.panesContainer).has(b).length?d(this.dom.panesContainer).insertAfter(b):d(this.dom.panesContainer).prepend(this.dom.container);b=d.fn.dataTable.ext.errMode;
d.fn.dataTable.ext.errMode="none";m=n.Scroller;this.s.dtPane=d(this.dom.dtP).DataTable(d.extend(!0,{columnDefs:[{className:"dtsp-nameColumn",data:"display",render:function(a,c,f){if("sort"===c)return f.sort;if("type"===c)return f.type;var b;(g.s.filteringActive||g.s.showFiltered)&&g.c.viewTotal?b=t.replace(/{total}/,f.total):b=h.replace(/{total}/,f.total);for(b=b.replace(/{shown}/,f.shown);-1!==b.indexOf("{total}");)b=b.replace(/{total}/,f.total);for(;-1!==b.indexOf("{shown}");)b=b.replace(/{shown}/,
f.shown);c='<span class="'+g.classes.pill+'">'+b+"</span>";if(g.c.hideCount||u.hideCount)c="";return g.c.dataLength?null!==a&&a.length>g.c.dataLength?'<span class="'+g.classes.name+'">'+a.substr(0,g.c.dataLength)+"...</span>"+c:'<span class="'+g.classes.name+'">'+a+"</span>"+c:'<span class="'+g.classes.name+'">'+a+"</span>"+c},targets:0,type:void 0!==k.settings()[0].aoColumns[this.s.index]?k.settings()[0].aoColumns[this.s.index]._sManualType:null},{className:"dtsp-countColumn "+this.classes.badgePill,
data:"total",targets:1,visible:!1}],deferRender:!0,dom:"t",info:!1,paging:m?!0:!1,scrollY:"200px",scroller:m?!0:!1,select:!0,stateSave:k.settings()[0].oFeatures.bStateSave?!0:!1},this.c.dtOpts,void 0!==u?u.dtOpts:{},null!==this.customPaneSettings&&void 0!==this.customPaneSettings.dtOpts?this.customPaneSettings.dtOpts:{}));d(this.dom.dtP).addClass(this.classes.table);d(this.dom.searchBox).attr("placeholder",void 0!==u.header?u.header:this.colExists?k.settings()[0].aoColumns[this.s.index].sTitle:this.customPaneSettings.header||
"Custom Pane");d.fn.dataTable.select.init(this.s.dtPane);d.fn.dataTable.ext.errMode=b;if(this.colExists){e=(e=e.search())?e.substr(1,e.length-2).split("|"):[];var w=0;p.arrayFilter.forEach(function(a){""===a.filter&&w++});m=0;for(b=p.arrayFilter.length;m<b;m++)if(this.s.dt.page.info().serverSide&&(!this.c.cascadePanes||this.c.cascadePanes&&0!==p.bins[p.arrayFilter[m].filter]||this.c.cascadePanes&&null!==r))for(e=this._addRow(p.arrayFilter[m].display,p.arrayFilter[m].filter,p.bins[p.arrayFilter[m].filter],
this.c.viewTotal?String(p.binsTotal[p.arrayFilter[m].filter]):p.bins[p.arrayFilter[m].filter],p.arrayFilter[m].sort,p.arrayFilter[m].type),void 0!==u.preSelect&&-1!==u.preSelect.indexOf(p.arrayFilter[m].filter)&&e.select(),f=0,c=this.s.serverSelect;f<c.length;f++)c[f].filter===p.arrayFilter[m].filter&&(this.s.serverSelecting=!0,e.select(),this.s.serverSelecting=!1);else this.s.dt.page.info().serverSide||!p.arrayFilter[m]||void 0===p.bins[p.arrayFilter[m].filter]&&this.c.cascadePanes?this.s.dt.page.info().serverSide||
this._addRow(this.c.emptyMessage,w,w,this.c.emptyMessage,this.c.emptyMessage,this.c.emptyMessage):(e=this._addRow(p.arrayFilter[m].display,p.arrayFilter[m].filter,p.bins[p.arrayFilter[m].filter],p.binsTotal[p.arrayFilter[m].filter],p.arrayFilter[m].sort,p.arrayFilter[m].type),void 0!==u.preSelect&&-1!==u.preSelect.indexOf(p.arrayFilter[m].filter)&&e.select())}(void 0!==u.options||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.options)&&this._getComparisonRows();n.select.init(this.s.dtPane);
this.s.dtPane.draw();this._adjustTopRow();this.s.listSet||(this._setListeners(),this.s.listSet=!0);for(r=0;r<a.length;r++)if(p=a[r],void 0!==p)for(b=0,m=this.s.dtPane.rows().indexes().toArray();b<m.length;b++)e=m[b],void 0!==this.s.dtPane.row(e).data()&&p.filter===this.s.dtPane.row(e).data().filter&&(this.s.dt.page.info().serverSide?(this.s.serverSelecting=!0,this.s.dtPane.row(e).select(),this.s.serverSelecting=!1):this.s.dtPane.row(e).select());if(q&&q.searchPanes&&q.searchPanes.panes)for(this.c.cascadePanes||
this._reloadSelect(q),a=0,q=q.searchPanes.panes;a<q.length;a++)r=q[a],r.id===this.s.index&&(d(this.dom.searchBox).val(r.searchTerm),d(this.dom.searchBox).trigger("input"),this.s.dtPane.order(r.order).draw());this.s.dt.state.save();return!0};b.prototype._detailsPane=function(){var a=this,c=this.s.dt;this.s.rowData.arrayTotals=[];this.s.rowData.binsTotal={};var f=this.s.dt.settings()[0];c.rows().every(function(c){a._populatePaneArray(c,a.s.rowData.arrayTotals,f,a.s.rowData.binsTotal)})};b.prototype._displayPane=
function(){var a=this.dom.container,c=this.s.colOpts,f=parseInt(this.c.layout.split("-")[1],10);d(this.dom.topRow).empty();d(this.dom.dtP).empty();d(this.dom.topRow).addClass(this.classes.topRow);3<f&&d(this.dom.container).addClass(this.classes.smallGap);d(this.dom.topRow).addClass(this.classes.subRowsContainer);d(this.dom.upper).appendTo(this.dom.topRow);d(this.dom.lower).appendTo(this.dom.topRow);d(this.dom.searchCont).appendTo(this.dom.upper);d(this.dom.buttonGroup).appendTo(this.dom.lower);(!1===
this.c.dtOpts.searching||void 0!==c.dtOpts&&!1===c.dtOpts.searching||!this.c.controls||!c.controls||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.dtOpts&&void 0!==this.customPaneSettings.dtOpts.searching&&!this.customPaneSettings.dtOpts.searching)&&d(this.dom.searchBox).attr("disabled","disabled").removeClass(this.classes.paneInputButton).addClass(this.classes.disabledButton);d(this.dom.searchBox).appendTo(this.dom.searchCont);this._searchContSetup();this.c.clear&&this.c.controls&&
c.controls&&d(this.dom.clear).appendTo(this.dom.buttonGroup);this.c.orderable&&c.orderable&&this.c.controls&&c.controls&&d(this.dom.nameButton).appendTo(this.dom.buttonGroup);!this.c.hideCount&&!c.hideCount&&this.c.orderable&&c.orderable&&this.c.controls&&c.controls&&d(this.dom.countButton).appendTo(this.dom.buttonGroup);d(this.dom.topRow).prependTo(this.dom.container);d(a).append(this.dom.dtP);d(a).show()};b.prototype._getBonusOptions=function(){return d.extend(!0,{},b.defaults,{orthogonal:{threshold:null},
threshold:null},void 0!==this.c?this.c:{})};b.prototype._getComparisonRows=function(){var a=this.s.colOpts;a=void 0!==a.options?a.options:null!==this.customPaneSettings&&void 0!==this.customPaneSettings.options?this.customPaneSettings.options:void 0;if(void 0!==a){var c=this.s.dt.rows({search:"applied"}).data().toArray(),f=this.s.dt.rows({search:"applied"}),b=this.s.dt.rows().data().toArray(),g=this.s.dt.rows(),d=[];this.s.dtPane.clear();for(var k=0;k<a.length;k++){var e=a[k],u=""!==e.label?e.label:
this.c.emptyMessage,p=u,h="function"===typeof e.value?e.value:[],n=0,q=u,t=0;if("function"===typeof e.value){for(var m=0;m<c.length;m++)e.value.call(this.s.dt,c[m],f[0][m])&&n++;for(m=0;m<b.length;m++)e.value.call(this.s.dt,b[m],g[0][m])&&t++;"function"!==typeof h&&h.push(e.filter)}(!this.c.cascadePanes||this.c.cascadePanes&&0!==n)&&d.push(this._addRow(p,h,n,t,q,u))}return d}};b.prototype._getOptions=function(){return d.extend(!0,{},b.defaults,{orthogonal:{threshold:null},threshold:null},this.s.dt.settings()[0].aoColumns[this.s.index].searchPanes)};
b.prototype._makeSelection=function(){this.updateTable();this.s.updating=!0;this.s.dt.draw();this.s.updating=!1};b.prototype._populatePane=function(a){void 0===a&&(a=!1);var c=this.s.dt;this.s.rowData.arrayFilter=[];this.s.rowData.bins={};var f=this.s.dt.settings()[0];if(!this.s.dt.page.info().serverSide){var b=0;for(a=(!this.c.cascadePanes&&!this.c.viewTotal||this.s.clearing||a?c.rows().indexes():c.rows({search:"applied"}).indexes()).toArray();b<a.length;b++)this._populatePaneArray(a[b],this.s.rowData.arrayFilter,
f)}};b.prototype._populatePaneArray=function(a,c,f,b){void 0===b&&(b=this.s.rowData.bins);var g=this.s.colOpts;if("string"===typeof g.orthogonal)f=f.oApi._fnGetCellData(f,a,this.s.index,g.orthogonal),this.s.rowData.filterMap.set(a,f),this._addOption(f,f,f,f,c,b);else{var r=f.oApi._fnGetCellData(f,a,this.s.index,g.orthogonal.search);this.s.rowData.filterMap.set(a,r);b[r]?b[r]++:(b[r]=1,this._addOption(r,f.oApi._fnGetCellData(f,a,this.s.index,g.orthogonal.display),f.oApi._fnGetCellData(f,a,this.s.index,
g.orthogonal.sort),f.oApi._fnGetCellData(f,a,this.s.index,g.orthogonal.type),c,b));this.s.rowData.totalOptions++}};b.prototype._reloadSelect=function(a){if(void 0!==a){for(var c,f=0;f<a.searchPanes.panes.length;f++)if(a.searchPanes.panes[f].id===this.s.index){c=f;break}if(void 0!==c){f=this.s.dtPane;var b=f.rows({order:"index"}).data().map(function(a){return null!==a.filter?a.filter.toString():null}).toArray(),g=0;for(a=a.searchPanes.panes[c].selected;g<a.length;g++){c=a[g];var d=-1;null!==c&&(d=
b.indexOf(c.toString()));-1<d&&(f.row(d).select(),this.s.dt.state.save())}}}};b.prototype._search=function(a,c){for(var f=this.s.colOpts,b=this.s.dt,g=0,d=this.selections;g<d.length;g++){var k=d[g];if(Array.isArray(a)){if(-1!==a.indexOf(k.filter))return!0}else if("function"===typeof k.filter)if(k.filter.call(b,b.row(c).data(),c)){if("or"===f.combiner)return!0}else{if("and"===f.combiner)return!1}else if(a===k.filter)return!0}return"and"===f.combiner?!0:!1};b.prototype._searchContSetup=function(){this.c.controls&&
this.s.colOpts.controls&&d(this.dom.searchButton).appendTo(this.dom.searchLabelCont);!1===this.c.dtOpts.searching||!1===this.s.colOpts.dtOpts.searching||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.dtOpts&&void 0!==this.customPaneSettings.dtOpts.searching&&!this.customPaneSettings.dtOpts.searching||d(this.dom.searchLabelCont).appendTo(this.dom.searchCont)};b.prototype._searchExtras=function(){var a=this.s.updating;this.s.updating=!0;var c=this.s.dtPane.rows({selected:!0}).data().pluck("filter").toArray(),
f=c.indexOf(this.c.emptyMessage),b=d(this.s.dtPane.table().container());-1<f&&(c[f]="");0<c.length?b.addClass(this.classes.selected):0===c.length&&b.removeClass(this.classes.selected);this.s.updating=a};b.prototype._uniqueRatio=function(a,c){return 0<c&&(0<this.s.rowData.totalOptions&&!this.s.dt.page.info().serverSide||this.s.dt.page.info().serverSide&&0<this.s.tableLength)?a/this.s.rowData.totalOptions:1};b.prototype._updateCommon=function(a){void 0===a&&(a=!1);if(!(this.s.dt.page.info().serverSide||
void 0===this.s.dtPane||this.s.filteringActive&&!this.c.cascadePanes&&!0!==a||!0===this.c.cascadePanes&&!0===this.s.selectPresent||this.s.lastSelect&&this.s.lastCascade)){var c=this.s.colOpts,f=this.s.dtPane.rows({selected:!0}).data().toArray();a=d(this.s.dtPane.table().node()).parent()[0].scrollTop;var b=this.s.rowData;this.s.dtPane.clear();if(this.colExists){0===b.arrayFilter.length?this._populatePane():this.c.cascadePanes&&this.s.dt.rows().data().toArray().length===this.s.dt.rows({search:"applied"}).data().toArray().length?
(b.arrayFilter=b.arrayOriginal,b.bins=b.binsOriginal):(this.c.viewTotal||this.c.cascadePanes)&&this._populatePane();this.c.viewTotal?this._detailsPane():b.binsTotal=b.bins;this.c.viewTotal&&!this.c.cascadePanes&&(b.arrayFilter=b.arrayTotals);for(var g=function(a){if(a&&(void 0!==b.bins[a.filter]&&0!==b.bins[a.filter]&&e.c.cascadePanes||!e.c.cascadePanes||e.s.clearing)){var c=e._addRow(a.display,a.filter,e.c.viewTotal?void 0!==b.bins[a.filter]?b.bins[a.filter]:0:b.bins[a.filter],e.c.viewTotal?String(b.binsTotal[a.filter]):
b.bins[a.filter],a.sort,a.type),g=f.findIndex(function(c){return c.filter===a.filter});-1!==g&&(c.select(),f.splice(g,1))}},e=this,k=0,h=b.arrayFilter;k<h.length;k++)g(h[k])}if(void 0!==c.searchPanes&&void 0!==c.searchPanes.options||void 0!==c.options||null!==this.customPaneSettings&&void 0!==this.customPaneSettings.options)for(g=function(a){var c=f.findIndex(function(c){if(c.display===a.data().display)return!0});-1!==c&&(a.select(),f.splice(c,1))},k=0,h=this._getComparisonRows();k<h.length;k++)c=
h[k],g(c);for(g=0;g<f.length;g++)c=f[g],c=this._addRow(c.display,c.filter,0,this.c.viewTotal?c.total:0,c.filter,c.filter),this.s.updating=!0,c.select(),this.s.updating=!1;this.s.dtPane.draw();this.s.dtPane.table().node().parentNode.scrollTop=a}};b.version="1.1.0";b.classes={buttonGroup:"dtsp-buttonGroup",buttonSub:"dtsp-buttonSub",clear:"dtsp-clear",clearAll:"dtsp-clearAll",clearButton:"clearButton",container:"dtsp-searchPane",countButton:"dtsp-countButton",disabledButton:"dtsp-disabledButton",dull:"dtsp-dull",
hidden:"dtsp-hidden",hide:"dtsp-hide",layout:"dtsp-",name:"dtsp-name",nameButton:"dtsp-nameButton",narrow:"dtsp-narrow",paneButton:"dtsp-paneButton",paneInputButton:"dtsp-paneInputButton",pill:"dtsp-pill",search:"dtsp-search",searchCont:"dtsp-searchCont",searchIcon:"dtsp-searchIcon",searchLabelCont:"dtsp-searchButtonCont",selected:"dtsp-selected",smallGap:"dtsp-smallGap",subRow1:"dtsp-subRow1",subRow2:"dtsp-subRow2",subRowsContainer:"dtsp-subRowsContainer",title:"dtsp-title",topRow:"dtsp-topRow"};
b.defaults={cascadePanes:!1,clear:!0,combiner:"or",controls:!0,container:function(a){return a.table().container()},dataLength:30,dtOpts:{},emptyMessage:"<i>No Data</i>",hideCount:!1,layout:"columns-3",name:void 0,orderable:!0,orthogonal:{display:"display",hideCount:!1,search:"filter",show:void 0,sort:"sort",threshold:.6,type:"type"},preSelect:[],threshold:.6,viewTotal:!1};return b}(),h,v,w=function(){function b(a,c,f){var d=this;void 0===f&&(f=!1);this.regenerating=!1;if(!v||!v.versionCheck||!v.versionCheck("1.10.0"))throw Error("SearchPane requires DataTables 1.10 or newer");
if(!v.select)throw Error("SearchPane requires Select");var g=new v.Api(a);this.classes=h.extend(!0,{},b.classes);this.c=h.extend(!0,{},b.defaults,c);this.dom={clearAll:h('<button type="button">Clear All</button>').addClass(this.classes.clearAll),container:h("<div/>").addClass(this.classes.panes).text(g.i18n("searchPanes.loadMessage","Loading Search Panes...")),emptyMessage:h("<div/>").addClass(this.classes.emptyMessage),options:h("<div/>").addClass(this.classes.container),panes:h("<div/>").addClass(this.classes.container),
title:h("<div/>").addClass(this.classes.title),titleRow:h("<div/>").addClass(this.classes.titleRow),wrapper:h("<div/>")};this.s={colOpts:[],dt:g,filterPane:-1,panes:[],selectionList:[],serverData:{},updating:!1};if(void 0===g.settings()[0]._searchPanes)if(g.on("xhr",function(a,c,b,f){b.searchPanes&&b.searchPanes.options&&(d.s.serverData=b.searchPanes.options,d.s.serverData.tableLength=b.recordsTotal,(d.c.viewTotal||d.c.cascadePanes)&&d._serverTotals())}),g.settings()[0]._searchPanes=this,this.dom.clearAll.text(g.i18n("searchPanes.clearMessage",
"Clear All")),this._getState(),this.s.dt.settings()[0]._bInitComplete||f)this._paneDeclare(g,a,c);else g.one("preInit.dt",function(b){d._paneDeclare(g,a,c)})}b.prototype.clearSelections=function(){this.dom.container.find(this.classes.search).each(function(){h(this).val("");h(this).trigger("input")});for(var a=[],c=0,b=this.s.panes;c<b.length;c++){var d=b[c];void 0!==d.s.dtPane&&a.push(d.clearPane())}this.s.dt.draw();return a};b.prototype.getNode=function(){return this.dom.container};b.prototype.rebuild=
function(a,c){void 0===a&&(a=!1);void 0===c&&(c=!1);h(this.dom.emptyMessage).remove();var b=[];h(this.dom.panes).empty();for(var d=0,g=this.s.panes;d<g.length;d++){var e=g[d];if(!1===a||e.s.index===a)e.clearData(),b.push(e.rebuildPane(void 0!==this.s.selectionList[this.s.selectionList.length-1]?e.s.index===this.s.selectionList[this.s.selectionList.length-1].index:!1,this.s.dt.page.info().serverSide?this.s.serverData:void 0,null,c));h(this.dom.panes).append(e.dom.container)}this.c.cascadePanes||this.c.viewTotal?
this.redrawPanes(!0):this._updateSelection();this._updateFilterCount();this._attachPaneContainer();this.s.dt.draw();return 1===b.length?b[0]:b};b.prototype.redrawPanes=function(a){void 0===a&&(a=!1);var c=this.s.dt;if(!this.s.updating&&!this.s.dt.page.info().serverSide){var b=!0,d=this.s.filterPane;if(c.rows({search:"applied"}).data().toArray().length===c.rows().data().toArray().length)b=!1;else if(this.c.viewTotal)for(var g=0,e=this.s.panes;g<e.length;g++){var k=e[g];if(void 0!==k.s.dtPane){var h=
k.s.dtPane.rows({selected:!0}).data().toArray().length;0<h&&-1===d?d=k.s.index:0<h&&(d=null)}}e=void 0;g=[];if(this.regenerating){a=0;for(g=this.s.panes;a<g.length;a++)if(k=g[a],void 0!==k.s.dtPane){e=!0;k.s.filteringActive=!0;if(-1!==d&&null!==d&&d===k.s.index||!1===b)e=!1,k.s.filteringActive=!1;k.updatePane(e?b:e)}this._updateFilterCount()}else{h=0;for(var u=this.s.panes;h<u.length;h++)if(k=u[h],k.s.selectPresent){this.s.selectionList.push({index:k.s.index,rows:k.s.dtPane.rows({selected:!0}).data().toArray(),
protect:!1});c.state.save();break}else if(k.s.deselect){e=k.s.index;var p=k.s.dtPane.rows({selected:!0}).data().toArray();0<p.length&&this.s.selectionList.push({index:k.s.index,rows:p,protect:!0})}if(0<this.s.selectionList.length)for(c=this.s.selectionList[this.s.selectionList.length-1].index,h=0,u=this.s.panes;h<u.length;h++)k=u[h],k.s.lastSelect=k.s.index===c;for(k=0;k<this.s.selectionList.length;k++)if(this.s.selectionList[k].index!==e||!0===this.s.selectionList[k].protect){c=!1;for(h=k+1;h<this.s.selectionList.length;h++)this.s.selectionList[h].index===
this.s.selectionList[k].index&&(c=!0);c||(g.push(this.s.selectionList[k]),this.s.selectionList[k].protect=!1)}c=0;for(h=this.s.panes;c<h.length;c++)if(k=h[c],void 0!==k.s.dtPane){e=!0;k.s.filteringActive=!0;if(-1!==d&&null!==d&&d===k.s.index||!1===b)e=!1,k.s.filteringActive=!1;k.updatePane(e?b:!1)}this._updateFilterCount();if(0<g.length&&(g.length<this.s.selectionList.length||a))for(this._cascadeRegen(g),c=g[g.length-1].index,d=0,a=this.s.panes;d<a.length;d++)k=a[d],k.s.lastSelect=k.s.index===c;else if(0<
g.length)for(k=0,a=this.s.panes;k<a.length;k++)if(g=a[k],void 0!==g.s.dtPane){e=!0;g.s.filteringActive=!0;if(-1!==d&&null!==d&&d===g.s.index||!1===b)e=!1,g.s.filteringActive=!1;g.updatePane(e?b:e)}}b||(this.s.selectionList=[])}};b.prototype._attach=function(){var a=this;h(this.dom.container).removeClass(this.classes.hide);h(this.dom.titleRow).removeClass(this.classes.hide);h(this.dom.titleRow).remove();h(this.dom.title).appendTo(this.dom.titleRow);this.c.clear&&(h(this.dom.clearAll).appendTo(this.dom.titleRow),
h(this.dom.clearAll).on("click.dtsps",function(){a.clearSelections()}));h(this.dom.titleRow).appendTo(this.dom.container);for(var c=0,b=this.s.panes;c<b.length;c++)h(b[c].dom.container).appendTo(this.dom.panes);h(this.dom.panes).appendTo(this.dom.container);0===h("div."+this.classes.container).length&&h(this.dom.container).prependTo(this.s.dt);return this.dom.container};b.prototype._attachExtras=function(){h(this.dom.container).removeClass(this.classes.hide);h(this.dom.titleRow).removeClass(this.classes.hide);
h(this.dom.titleRow).remove();h(this.dom.title).appendTo(this.dom.titleRow);this.c.clear&&h(this.dom.clearAll).appendTo(this.dom.titleRow);h(this.dom.titleRow).appendTo(this.dom.container);return this.dom.container};b.prototype._attachMessage=function(){try{var a=this.s.dt.i18n("searchPanes.emptyPanes","No SearchPanes")}catch(c){a=null}if(null===a)h(this.dom.container).addClass(this.classes.hide),h(this.dom.titleRow).removeClass(this.classes.hide);else return h(this.dom.container).removeClass(this.classes.hide),
h(this.dom.titleRow).addClass(this.classes.hide),h(this.dom.emptyMessage).text(a),this.dom.emptyMessage.appendTo(this.dom.container),this.dom.container};b.prototype._attachPaneContainer=function(){for(var a=0,c=this.s.panes;a<c.length;a++)if(!0===c[a].s.displayed)return this._attach();return this._attachMessage()};b.prototype._cascadeRegen=function(a){this.regenerating=!0;var c=-1;1===a.length&&(c=a[0].index);for(var b=0,d=this.s.panes;b<d.length;b++){var g=d[b];g.setCascadeRegen(!0);g.setClear(!0);
(void 0!==g.s.dtPane&&g.s.index===c||void 0!==g.s.dtPane)&&g.clearPane();g.setClear(!1)}this._makeCascadeSelections(a);this.s.selectionList=a;a=0;for(c=this.s.panes;a<c.length;a++)g=c[a],g.setCascadeRegen(!1);this.regenerating=!1};b.prototype._checkMessage=function(){for(var a=0,c=this.s.panes;a<c.length;a++)if(!0===c[a].s.displayed)return;return this._attachMessage()};b.prototype._getState=function(){var a=this.s.dt.state.loaded();a&&a.searchPanes&&void 0!==a.searchPanes.selectionList&&(this.s.selectionList=
a.searchPanes.selectionList)};b.prototype._makeCascadeSelections=function(a){for(var c=0;c<a.length;c++)for(var b=function(b){if(b.s.index===a[c].index&&void 0!==b.s.dtPane){c===a.length-1&&(b.s.lastCascade=!0);0<b.s.dtPane.rows({selected:!0}).data().toArray().length&&void 0!==b.s.dtPane&&(b.setClear(!0),b.clearPane(),b.setClear(!1));for(var f=function(a){b.s.dtPane.rows().every(function(c){void 0!==b.s.dtPane.row(c).data()&&void 0!==a&&b.s.dtPane.row(c).data().filter===a.filter&&b.s.dtPane.row(c).select()})},
g=0,e=a[c].rows;g<e.length;g++)f(e[g]);d._updateFilterCount();b.s.lastCascade=!1}},d=this,g=0,e=this.s.panes;g<e.length;g++)b(e[g]);this.s.dt.state.save()};b.prototype._paneDeclare=function(a,c,b){var f=this;a.columns(0<this.c.columns.length?this.c.columns:void 0).eq(0).each(function(a){f.s.panes.push(new q(c,b,a,f.c.layout,f.dom.panes))});for(var d=a.columns().eq(0).toArray().length,e=this.c.panes.length,k=0;k<e;k++)this.s.panes.push(new q(c,b,d+k,this.c.layout,this.dom.panes,this.c.panes[k]));if(0<
this.c.order.length)for(d=this.c.order.map(function(a,c,b){return f._findPane(a)}),this.dom.panes.empty(),this.s.panes=d,d=0,e=this.s.panes;d<e.length;d++)this.dom.panes.append(e[d].dom.container);this.s.dt.settings()[0]._bInitComplete?this._paneStartup(a):this.s.dt.settings()[0].aoInitComplete.push({fn:function(){f._paneStartup(a)}})};b.prototype._findPane=function(a){for(var c=0,b=this.s.panes;c<b.length;c++){var d=b[c];if(a===d.s.name)return d}};b.prototype._paneStartup=function(a){var c=this;
500>=this.s.dt.page.info().recordsTotal?this._startup(a):setTimeout(function(){c._startup(a)},100)};b.prototype._serverTotals=function(){for(var a=!1,c=!1,b=this.s.dt,d=0,e=this.s.panes;d<e.length;d++){var l=e[d];if(l.s.selectPresent){this.s.selectionList.push({index:l.s.index,rows:l.s.dtPane.rows({selected:!0}).data().toArray(),protect:!1});b.state.save();l.s.selectPresent=!1;a=!0;break}else l.s.deselect&&(c=l.s.dtPane.rows({selected:!0}).data().toArray(),0<c.length&&this.s.selectionList.push({index:l.s.index,
rows:c,protect:!0}),c=a=!0)}if(a){l=[];for(b=0;b<this.s.selectionList.length;b++){d=!1;for(e=b+1;e<this.s.selectionList.length;e++)this.s.selectionList[e].index===this.s.selectionList[b].index&&(d=!0);!d&&0<this.s.panes[this.s.selectionList[b].index].s.dtPane.rows({selected:!0}).data().toArray().length&&l.push(this.s.selectionList[b])}this.s.selectionList=l}else this.s.selectionList=[];b=-1;if(c&&1===this.s.selectionList.length)for(c=0,d=this.s.panes;c<d.length;c++)l=d[c],l.s.lastSelect=!1,l.s.deselect=
!1,void 0!==l.s.dtPane&&0<l.s.dtPane.rows({selected:!0}).data().toArray().length&&(b=l.s.index);else if(0<this.s.selectionList.length)for(c=this.s.selectionList[this.s.selectionList.length-1].index,d=0,e=this.s.panes;d<e.length;d++)l=e[d],l.s.lastSelect=l.s.index===c,l.s.deselect=!1;else if(0===this.s.selectionList.length)for(c=0,d=this.s.panes;c<d.length;c++)l=d[c],l.s.lastSelect=!1,l.s.deselect=!1;h(this.dom.panes).empty();c=0;for(d=this.s.panes;c<d.length;c++)l=d[c],l.s.lastSelect?l._setListeners():
l.rebuildPane(void 0,this.s.dt.page.info().serverSide?this.s.serverData:void 0,l.s.index===b?!0:null),h(this.dom.panes).append(l.dom.container),h.fn.dataTable.select.init(l.s.dtPane)};b.prototype._startup=function(a){var c=this;h(this.dom.container).text("");this._attachExtras();h(this.dom.container).append(this.dom.panes);h(this.dom.panes).empty();if(this.c.viewTotal&&!this.c.cascadePanes){var b=this.s.dt.state.loaded();if(null!==b&&void 0!==b&&void 0!==b.searchPanes&&void 0!==b.searchPanes.panes){for(var d=
!1,e=0,l=b.searchPanes.panes;e<l.length;e++)if(b=l[e],0<b.selected.length){d=!0;break}if(d)for(d=0,e=this.s.panes;d<e.length;d++)b=e[d],b.s.showFiltered=!0}}d=0;for(e=this.s.panes;d<e.length;d++)b=e[d],b.rebuildPane(void 0,this.s.dt.page.info().serverSide?this.s.serverData:void 0),h(this.dom.panes).append(b.dom.container);if(this.c.viewTotal&&!this.c.cascadePanes)for(d=0,e=this.s.panes;d<e.length;d++)b=e[d],b.updatePane();this._updateFilterCount();this._checkMessage();a.on("draw.dtsps",function(){c._updateFilterCount();
!c.c.cascadePanes&&!c.c.viewTotal||c.s.dt.page.info().serverSide?c._updateSelection():c.redrawPanes();c.s.filterPane=-1});this.s.dt.on("stateSaveParams.dtsp",function(a,b,d){void 0===d.searchPanes&&(d.searchPanes={});d.searchPanes.selectionList=c.s.selectionList});this.s.dt.on("xhr",function(){var a=!1;if(!c.s.dt.page.info().serverSide)c.s.dt.one("draw",function(){if(!a){a=!0;h(c.dom.panes).empty();for(var b=0,d=c.s.panes;b<d.length;b++){var e=d[b];e.clearData();e.rebuildPane(void 0!==c.s.selectionList[c.s.selectionList.length-
1]?e.s.index===c.s.selectionList[c.s.selectionList.length-1].index:!1);h(c.dom.panes).append(e.dom.container)}c.c.cascadePanes||c.c.viewTotal?c.redrawPanes():c._updateSelection();c._checkMessage()}})});if(void 0!==this.s.selectionList&&0<this.s.selectionList.length)for(d=this.s.selectionList[this.s.selectionList.length-1].index,e=0,l=this.s.panes;e<l.length;e++)b=l[e],b.s.lastSelect=b.s.index===d;0<this.s.selectionList.length&&this.c.cascadePanes&&this._cascadeRegen(this.s.selectionList);a.columns(0<
this.c.columns.length?this.c.columns:void 0).eq(0).each(function(a){if(void 0!==c.s.panes[a]&&void 0!==c.s.panes[a].s.dtPane&&void 0!==c.s.panes[a].s.colOpts.preSelect)for(var b=c.s.panes[a].s.dtPane.rows().data().toArray().length,d=0;d<b;d++)-1!==c.s.panes[a].s.colOpts.preSelect.indexOf(c.s.panes[a].s.dtPane.cell(d,0).data())&&(c.s.panes[a].s.dtPane.row(d).select(),c.s.panes[a].updateTable())});this._updateFilterCount();a.on("destroy.dtsps",function(){for(var b=0,d=c.s.panes;b<d.length;b++)d[b].destroy();
a.off(".dtsps");h(c.dom.clearAll).off(".dtsps");h(c.dom.container).remove();c.clearSelections()});if(this.c.clear)h(this.dom.clearAll).on("click.dtsps",function(){c.clearSelections()});if(this.s.dt.page.info().serverSide)a.on("preXhr.dt",function(a,b,d){void 0===d.searchPanes&&(d.searchPanes={});a=0;for(b=c.s.panes;a<b.length;a++){var e=b[a],f=c.s.dt.column(e.s.index).dataSrc();void 0===d.searchPanes[f]&&(d.searchPanes[f]={});if(void 0!==e.s.dtPane){e=e.s.dtPane.rows({selected:!0}).data().toArray();
for(var g=0;g<e.length;g++)d.searchPanes[f][g]=e[g].display}}c.c.viewTotal&&c._prepViewTotal()});a.settings()[0]._searchPanes=this};b.prototype._prepViewTotal=function(){for(var a=this.s.filterPane,b=!1,d=0,e=this.s.panes;d<e.length;d++){var g=e[d];if(void 0!==g.s.dtPane){var h=g.s.dtPane.rows({selected:!0}).data().toArray().length;0<h&&-1===a?(a=g.s.index,b=!0):0<h&&(a=null)}}d=0;for(e=this.s.panes;d<e.length;d++)if(g=e[d],void 0!==g.s.dtPane&&(g.s.filteringActive=!0,-1!==a&&null!==a&&a===g.s.index||
!1===b))g.s.filteringActive=!1};b.prototype._updateFilterCount=function(){for(var a=0,b=0,d=this.s.panes;b<d.length;b++){var e=d[b];void 0!==e.s.dtPane&&(a+=e.getPaneCount())}b=this.s.dt.i18n("searchPanes.title","Filters Active - %d",a);h(this.dom.title).text(b);void 0!==this.c.filterChanged&&"function"===typeof this.c.filterChanged&&this.c.filterChanged(a)};b.prototype._updateSelection=function(){this.s.selectionList=[];for(var a=0,b=this.s.panes;a<b.length;a++){var d=b[a];void 0!==d.s.dtPane&&this.s.selectionList.push({index:d.s.index,
rows:d.s.dtPane.rows({selected:!0}).data().toArray(),protect:!1})}this.s.dt.state.save()};b.version="1.0.1";b.classes={clear:"dtsp-clear",clearAll:"dtsp-clearAll",container:"dtsp-searchPanes",emptyMessage:"dtsp-emptyMessage",hide:"dtsp-hidden",panes:"dtsp-panesContainer",search:"dtsp-search",title:"dtsp-title",titleRow:"dtsp-titleRow"};b.defaults={cascadePanes:!1,clear:!0,container:function(a){return a.table().container()},columns:[],filterChanged:void 0,layout:"columns-3",order:[],panes:[],viewTotal:!1};
return b}();(function(b){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(a){return b(a,window,document)}):"object"===typeof exports?module.exports=function(a,c){a||(a=window);c&&c.fn.dataTable||(c=require("datatables.net")(a,c).$);return b(c,a,a.document)}:b(window.jQuery,window,document)})(function(b,a,c){function d(a,b){void 0===b&&(b=!1);a=new h.Api(a);var c=a.init().searchPanes||h.defaults.searchPanes;return(new w(a,c,b)).getNode()}e(b);t(b);var h=b.fn.dataTable;
b.fn.dataTable.SearchPanes=w;b.fn.DataTable.SearchPanes=w;b.fn.dataTable.SearchPane=q;b.fn.DataTable.SearchPane=q;h.Api.register("searchPanes.rebuild()",function(){return this.iterator("table",function(){this.searchPanes&&this.searchPanes.rebuild()})});h.Api.register("column().paneOptions()",function(a){return this.iterator("column",function(b){b=this.aoColumns[b];b.searchPanes||(b.searchPanes={});b.searchPanes.values=a;this.searchPanes&&this.searchPanes.rebuild()})});a=b.fn.dataTable.Api.register;
a("searchPanes()",function(){return this});a("searchPanes.clearSelections()",function(){this.context[0]._searchPanes.clearSelections();return this});a("searchPanes.rebuildPane()",function(a,b){this.context[0]._searchPanes.rebuild(a,b);return this});a("searchPanes.container()",function(){return this.context[0]._searchPanes.getNode()});b.fn.dataTable.ext.buttons.searchPanesClear={text:"Clear Panes",action:function(a,b,c,d){b.searchPanes.clearSelections()}};b.fn.dataTable.ext.buttons.searchPanes={action:function(a,
b,c,d){a.stopPropagation();this.popover(d._panes.getNode(),{align:"dt-container"})},config:{},init:function(a,c,d){var e=new b.fn.dataTable.SearchPanes(a,b.extend({filterChanged:function(b){a.button(c).text(a.i18n("searchPanes.collapse",{0:"SearchPanes",_:"SearchPanes (%d)"},b))}},d.config)),f=a.i18n("searchPanes.collapse","SearchPanes",0);a.button(c).text(f);d._panes=e},text:"Search Panes"};b(c).on("preInit.dt.dtsp",function(a,b,c){"dt"===a.namespace&&(b.oInit.searchPanes||h.defaults.searchPanes)&&
(b._searchPanes||d(b,!0))});h.ext.feature.push({cFeature:"P",fnInit:d});h.ext.features&&h.ext.features.register("searchPanes",d)})})();