2 var _typeof=
"function"==typeof Symbol&&
"symbol"==typeof Symbol.iterator?
function(t){
return typeof t}:
function(t){
return t&&
"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?
"symbol":typeof t},Sort=
function(t){this.table=t,this.sortList=[],this.changed=!1};Sort.prototype.initializeColumn=
function(t,e){var o,r,n=
this,i=!1;
switch(_typeof(t.definition.sorter)){
case"string":n.sorters[t.definition.sorter]?i=n.sorters[t.definition.sorter]:console.warn(
"Sort Error - No such sorter found: ",t.definition.sorter);
break;
case"function":i=t.definition.sorter}t.modules.sort={sorter:i,dir:
"none",params:t.definition.sorterParams||{},startingDir:t.definition.headerSortStartingDir||
"asc",tristate:
void 0!==t.definition.headerSortTristate?t.definition.headerSortTristate:this.table.options.headerSortTristate},(
void 0===t.definition.headerSort?!1!==this.table.options.headerSort:!1!==t.definition.headerSort)&&(o=t.getElement(),o.classList.add(
"tabulator-sortable"),r=document.createElement(
"div"),r.classList.add(
"tabulator-arrow"),e.appendChild(r),o.addEventListener(
"click",
function(e){var o=
"",r=[],i=!1;
if(t.modules.sort){
if(t.modules.sort.tristate)o=
"none"==t.modules.sort.dir?t.modules.sort.startingDir:t.modules.sort.dir==t.modules.sort.startingDir?
"asc"==t.modules.sort.dir?
"desc":
"asc":
"none";
else switch(t.modules.sort.dir){
case"asc":o=
"desc";
break;
case"desc":o=
"asc";
break;
default:o=t.modules.sort.startingDir}n.table.options.columnHeaderSortMulti&&(e.shiftKey||e.ctrlKey)?(r=n.getSort(),i=r.findIndex(
function(e){
return e.field===t.getField()}),i>-1?(r[i].dir=o,i!=r.length-1&&(i=r.splice(i,1)[0],
"none"!=o&&r.push(i))):
"none"!=o&&r.push({column:t,dir:o}),n.setSort(r)):
"none"==o?n.clear():n.setSort(t,o),n.table.rowManager.sorterRefresh(!n.sortList.length)}}))},Sort.prototype.hasChanged=
function(){var t=this.changed;
return this.changed=!1,t},Sort.prototype.getSort=
function(){var t=
this,e=[];
return t.sortList.forEach(
function(t){t.column&&e.push({column:t.column.getComponent(),field:t.column.getField(),dir:t.dir})}),e},Sort.prototype.setSort=
function(t,e){var o=
this,r=[];Array.isArray(t)||(t=[{column:t,dir:e}]),t.forEach(
function(t){var e;e=o.table.columnManager.findColumn(t.column),e?(t.column=e,r.push(t),o.changed=!0):console.warn(
"Sort Warning - Sort field does not exist and is being ignored: ",t.column)}),o.sortList=r,
this.table.options.persistence&&
this.table.modExists(
"persistence",!0)&&this.table.modules.persistence.config.sort&&this.table.modules.persistence.save(
"sort")},Sort.prototype.clear=
function(){this.setSort([])},Sort.prototype.findSorter=
function(t){var e,o=this.table.rowManager.activeRows[0],r=
"string";
if(o&&(o=o.getData(),t.getField()))
switch(e=t.getFieldValue(o),
void 0===e?
"undefined":_typeof(e)){
case"undefined":r=
"string";
break;
case"boolean":r=
"boolean";
break;
default:isNaN(e)||
""===e?e.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i)&&(r=
"alphanum"):r=
"number"}
return this.sorters[r]},Sort.prototype.sort=
function(t){var e,o=
this;e=this.table.options.sortOrderReverse?o.sortList.slice().reverse():o.sortList,o.table.options.dataSorting&&o.table.options.dataSorting.call(o.table,o.getSort()),o.clearColumnHeaders(),o.table.options.ajaxSorting?e.forEach(
function(t,e){o.setColumnHeader(t.column,t.dir)}):e.forEach(
function(r,n){r.column&&r.column.modules.sort&&(r.column.modules.sort.sorter||(r.column.modules.sort.sorter=o.findSorter(r.column)),o._sortItem(t,r.column,r.dir,e,n)),o.setColumnHeader(r.column,r.dir)}),o.table.options.dataSorted&&o.table.options.dataSorted.call(o.table,o.getSort(),o.table.rowManager.getComponents(
"active"))},Sort.prototype.clearColumnHeaders=
function(){this.table.columnManager.getRealColumns().forEach(
function(t){t.modules.sort&&(t.modules.sort.dir=
"none",t.getElement().setAttribute(
"aria-sort",
"none"))})},Sort.prototype.setColumnHeader=
function(t,e){t.modules.sort.dir=e,t.getElement().setAttribute(
"aria-sort",e)},Sort.prototype._sortItem=
function(t,e,o,r,n){var i=
this,s=
"function"==typeof e.modules.sort.params?e.modules.sort.params(e.getComponent(),o):e.modules.sort.params;t.sort(
function(t,a){var l=i._sortRow(t,a,e,o,s);
if(0===l&&n)
for(var u=n-1;u>=0&&0===(l=i._sortRow(t,a,r[u].column,r[u].dir,s));u--);
return l})},Sort.prototype._sortRow=
function(t,e,o,r,n){var i,s,a=
"asc"==r?t:e,l=
"asc"==r?e:t;
return t=o.getFieldValue(a.getData()),e=o.getFieldValue(l.getData()),t=
void 0!==t?t:
"",e=
void 0!==e?e:
"",i=a.getComponent(),s=l.getComponent(),o.modules.sort.sorter.call(
this,t,e,i,s,o.getComponent(),r,n)},Sort.prototype.sorters={number:
function(t,e,o,r,n,i,s){var a=s.alignEmptyValues,l=s.decimalSeparator||
".",u=s.thousandSeparator||
",",c=0;
if(t=parseFloat(String(t).split(u).join(
"").split(l).join(
".")),e=parseFloat(String(e).split(u).join(
"").split(l).join(
".")),isNaN(t))c=isNaN(e)?0:-1;
else{
if(!isNaN(e))
return t-e;c=1}
return(
"top"===a&&
"desc"===i||
"bottom"===a&&
"asc"===i)&&(c*=-1),c},
string:
function(t,e,o,r,n,i,s){var a,l=s.alignEmptyValues,u=0;
if(t){
if(e){
switch(_typeof(s.locale)){
case"boolean":s.locale&&(a=this.table.modules.localize.getLocale());
break;
case"string":a=s.locale}
return String(t).toLowerCase().localeCompare(String(e).toLowerCase(),a)}u=1}
else u=e?-1:0;
return(
"top"===l&&
"desc"===i||
"bottom"===l&&
"asc"===i)&&(u*=-1),u},date:
function(t,e,o,r,n,i,s){
return s.format||(s.format=
"DD/MM/YYYY"),this.sorters.datetime.call(
this,t,e,o,r,n,i,s)},time:
function(t,e,o,r,n,i,s){
return s.format||(s.format=
"hh:mm"),this.sorters.datetime.call(
this,t,e,o,r,n,i,s)},datetime:
function(t,e,o,r,n,i,s){var a=s.format||
"DD/MM/YYYY hh:mm:ss",l=s.alignEmptyValues,u=0;
if(
"undefined"!=typeof moment){
if(t=moment(t,a),e=moment(e,a),t.isValid()){
if(e.isValid())
return t-e;u=1}
else u=e.isValid()?-1:0;
return(
"top"===l&&
"desc"===i||
"bottom"===l&&
"asc"===i)&&(u*=-1),u}console.error(
"Sort Error - 'datetime' sorter is dependant on moment.js")},
boolean:
function(t,e,o,r,n,i,s){
return(!0===t||
"true"===t||
"True"===t||1===t?1:0)-(!0===e||
"true"===e||
"True"===e||1===e?1:0)},array:
function(t,e,o,r,n,i,s){
function a(t){
switch(c){
case"length":
return t.length;
case"sum":
return t.reduce(
function(t,e){
return t+e});
case"max":
return Math.max.apply(null,t);
case"min":
return Math.min.apply(null,t);
case"avg":
return t.reduce(
function(t,e){
return t+e})/t.length}}var l=0,u=0,c=s.type||
"length",d=s.alignEmptyValues,m=0;
if(Array.isArray(t)){
if(Array.isArray(e))
return l=t?a(t):0,u=e?a(e):0,l-u;d=1}
else d=Array.isArray(e)?-1:0;
return(
"top"===d&&
"desc"===i||
"bottom"===d&&
"asc"===i)&&(m*=-1),m},exists:
function(t,e,o,r,n,i,s){
return(
void 0===t?0:1)-(
void 0===e?0:1)},alphanum:
function(t,e,o,r,n,i,s){var a,l,u,c,d,m=0,f=/(\d+)|(\D+)/g,p=/\d/,h=s.alignEmptyValues,g=0;
if(t||0===t){
if(e||0===e){
if(isFinite(t)&&isFinite(e))
return t-e;
if(a=String(t).toLowerCase(),l=String(e).toLowerCase(),a===l)
return 0;
if(!p.test(a)||!p.test(l))
return a>l?1:-1;
for(a=a.match(f),l=l.match(f),d=a.length>l.length?l.length:a.length;m<d;)
if(u=a[m],c=l[m++],u!==c)
return isFinite(u)&&isFinite(c)?(
"0"===u.charAt(0)&&(u=
"."+u),
"0"===c.charAt(0)&&(c=
"."+c),u-c):u>c?1:-1;
return a.length>l.length}g=1}
else g=e||0===e?-1:0;
return(
"top"===h&&
"desc"===i||
"bottom"===h&&
"asc"===i)&&(g*=-1),g}},Tabulator.prototype.registerModule(
"sort",Sort);