/*! Select for DataTables 2.0.3 * © SpryMedia Ltd - datatables.net/license/mit */ import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;function cellRange(n,e,t){function l(t,l){ls.indexOf(l)&&(e=l,l=t,t=e),!1);return s.filter(function(e){return e===t&&(c=!0),e===l?!(c=!1):c})}var c,t=n.cells({selected:!0}).any()||t?(c=l(t.column,e.column),s(t.row,e.row)):(c=l(0,e.column),s(0,e.row)),t=n.cells(t,c).flatten();n.cells(e,{selected:!0}).any()?n.cells(t).deselect():n.cells(t).select()}function checkboxClass(e){var t=DataTable.select.classes.checkbox;return e?t.replace(/ /g,"."):t}function disableMouseSelection(e){var t=e.settings()[0]._select.selector;$(e.table().container()).off("mousedown.dtSelect",t).off("mouseup.dtSelect",t).off("click.dtSelect",t),$("body").off("click.dtSelect"+_safeId(e.table().node()))}function enableMouseSelection(a){var o,t=$(a.table().container()),l=a.settings()[0],s=l._select.selector;t.on("mousedown.dtSelect",s,function(e){(e.shiftKey||e.metaKey||e.ctrlKey)&&t.css("-moz-user-select","none").one("selectstart.dtSelect",s,function(){return!1}),window.getSelection&&(o=window.getSelection())}).on("mouseup.dtSelect",s,function(){t.css("-moz-user-select","")}).on("click.dtSelect",s,function(e){var t,l=a.select.items();if(o){var s=window.getSelection();if((!s.anchorNode||$(s.anchorNode).closest("table")[0]===a.table().node())&&s!==o)return}var c,s=a.settings()[0],n=a.table().container();$(e.target).closest("div.dt-container")[0]==n&&(n=a.cell($(e.target).closest("td, th"))).any()&&(c=$.Event("user-select.dt"),eventTrigger(a,c,[l,n,e]),c.isDefaultPrevented()||(c=n.index(),"row"===l?(t=c.row,typeSelect(e,a,s,"row",t)):"column"===l?(t=n.index().column,typeSelect(e,a,s,"column",t)):"cell"===l&&(t=n.index(),typeSelect(e,a,s,"cell",t)),s._select_lastCell=c))}),$("body").on("click.dtSelect"+_safeId(a.table().node()),function(e){var t;!l._select.blurable||$(e.target).parents().filter(a.table().container()).length||0===$(e.target).parents("html").length||$(e.target).parents("div.DTE").length||(t=$.Event("select-blur.dt"),eventTrigger(a,t,[e.target,e]),t.isDefaultPrevented())||clear(l,!0)})}function eventTrigger(e,t,l,s){s&&!e.flatten().length||("string"==typeof t&&(t+=".dt"),l.unshift(e),$(e.table().node()).trigger(t,l))}function info(s,e){var t,l,c,n,a;"api"!==s.select.style()&&!1!==s.select.info()&&(a=s.rows({selected:!0}).flatten().length,t=s.columns({selected:!0}).flatten().length,l=s.cells({selected:!0}).flatten().length,c=function(e,t,l){e.append($('').append(s.i18n("select."+t+"s",{_:"%d "+t+"s selected",0:"",1:"1 "+t+" selected"},l)))},e=$(e),c(n=$(''),"row",a),c(n,"column",t),c(n,"cell",l),(a=e.children("span.select-info")).length&&a.remove(),""!==n.text())&&e.append(n)}function initCheckboxHeader(a,o){a.columns(".dt-select").every(function(){var n,e=this.header();$("input",e).length||(n=$("").attr({class:checkboxClass(!0),type:"checkbox","aria-label":a.i18n("select.aria.headerCheckbox")||"Select all rows"}).appendTo(e).on("change",function(){this.checked?("select-page"==o?a.rows({page:"current"}):a.rows({search:"applied"})).select():a.rows({selected:!0}).deselect()}).on("click",function(e){e.stopPropagation()}),a.on("draw select deselect",function(e,t,l){var s,c;"row"!==l&&l||(l=a.rows({selected:!0}).count(),s=a.rows({search:"applied",selected:!0}).count(),c=("select-page"==o?a.rows({page:"current"}):a.rows({search:"applied"})).count(),s&&s<=l&&s===c?n.prop("checked",!0).prop("indeterminate",!1):0===s&&0===l?n.prop("checked",!1).prop("indeterminate",!1):n.prop("checked",!1).prop("indeterminate",!0))}))})}function init(a){var c=new DataTable.Api(a);a._select_init=!0,a.aoRowCreatedCallback.push(function(e,t,l){var s,c,n=a.aoData[l];for(n._select_selected&&$(e).addClass(a._select.className).find("input."+checkboxClass(!0)).prop("checked",!0),s=0,c=a.aoColumns.length;s").attr({"aria-label":s,class:checkboxClass(),name:a?a(l):null,type:"checkbox",value:n?n(l):null,checked:c}).on("input",function(e){e.preventDefault(),this.checked=$(this).closest("tr").hasClass("selected")})[0]:"type"===t?"select-checkbox":"filter"!==t&&c?"X":""}},DataTable.ext.order["select-checkbox"]=function(t,e){return this.api().column(e,{order:"index"}).nodes().map(function(e){return"row"===t._select.items?$(e).parent().hasClass(t._select.className):"cell"===t._select.items&&$(e).hasClass(t._select.className)})},$.fn.DataTable.select=DataTable.select,$(document).on("preInit.dt.dtSelect",function(e,t){"dt"===e.namespace&&DataTable.select.init(new DataTable.Api(t))});export default DataTable;