!function(n){"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(t){return n(t,window,document)}):"object"==typeof exports?module.exports=function(t,e){return t||(t=window),e&&e.fn.dataTable||(e=require("datatables.net")(t,e).$),e.fn.dataTable.Buttons||require("datatables.net-buttons")(t,e),n(e,t,t.document)}:n(jQuery,window,document)}(function(n,t,e,o){"use strict";var i=n.fn.dataTable;return n.extend(i.ext.buttons,{colvis:function(n,t){return{extend:"collection",text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",buttons:[{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}]}},columnsToggle:function(n,t){var e=n.columns(t.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:t.columnText}}).toArray();return e},columnToggle:function(n,t){return{extend:"columnVisibility",columns:t.columns,columnText:t.columnText}},columnsVisibility:function(n,t){var e=n.columns(t.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:t.visibility,columnText:t.columnText}}).toArray();return e},columnVisibility:{columns:o,text:function(n,t,e){return e._columnText(n,e)},className:"ColVis_Button TableTools_Button ui-button ui-state-default",action:function(n,t,e,i){var s=t.columns(i.columns),l=s.visible();s.visible(i.visibility!==o?i.visibility:!(l.length?l[0]:!1))},init:function(n,t,e){var o=this;t.attr("data-cv-idx",e.columns),n.on("column-visibility.dt"+e.namespace,function(t,i){i.bDestroying||i.nTable!=n.settings()[0].nTable||o.active(n.column(e.columns).visible())}).on("column-reorder.dt"+e.namespace,function(){1===n.columns(e.columns).count()&&(o.text(e._columnText(n,e)),o.active(n.column(e.columns).visible()))}),this.active(n.column(e.columns).visible())},destroy:function(n,t,e){n.off("column-visibility.dt"+e.namespace).off("column-reorder.dt"+e.namespace)},_columnText:function(n,t){var e=n.column(t.columns).index(),o=n.settings()[0].aoColumns[e].sTitle.replace(/\n/g," ").replace(/<br\s*\/?>/gi," ").replace(/<select(.*?)<\/select>/g,"").replace(/<!\-\-.*?\-\->/g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),i='<span class="ColVis_radio"><span class="colvis_checkbox"></span></span><span class="ColVis_title">'+o+"</span>";return t.columnText?t.columnText(n,e,i):i}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(n,t,e){e._visOriginal=n.columns().indexes().map(function(t){return n.column(t).visible()}).toArray()},action:function(n,t,e,o){t.columns().every(function(n){var e=t.colReorder&&t.colReorder.transpose?t.colReorder.transpose(n,"toOriginal"):n;this.visible(o._visOriginal[e])})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,t,e,o){t.columns(o.show).visible(!0,!1),t.columns(o.hide).visible(!1,!1),t.columns.adjust()},show:[],hide:[]}}),i.Buttons});