/*!
 * Print button for Buttons and DataTables.
 * © SpryMedia Ltd - datatables.net/license
 */
import jQuery from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";let $=jQuery;var _link=document.createElement("a"),_relToAbs=function(t){_link.href=t;t=_link.host;return-1===t.indexOf("/")&&0!==_link.pathname.indexOf("/")&&(t+="/"),_link.protocol+"//"+t+_link.pathname+_link.search};DataTable.ext.buttons.print={className:"buttons-print",text:function(t){return t.i18n("buttons.print","Print")},action:function(t,e,o,n,r){var a=e.buttons.exportData($.extend({decodeEntities:!1},n.exportOptions)),i=e.buttons.exportInfo(n),s=e.columns(n.exportOptions.columns).nodes().map(function(t){return t.className}).toArray(),l='<table class="'+e.table().node().className+'">';n.header&&(l+="<thead>"+a.headerStructure.map(function(t){return"<tr>"+t.map(function(t){return t?'<th colspan="'+t.colspan+'" rowspan="'+t.rowspan+'">'+t.title+"</th>":""}).join("")+"</tr>"}).join("")+"</thead>"),l+="<tbody>";for(var u=0,c=a.body.length;u<c;u++)l+=((t,e)=>{for(var o="<tr>",n=0,r=t.length;n<r;n++){var a=null==t[n]?"":t[n];o+="<"+e+" "+(s[n]?'class="'+s[n]+'"':"")+">"+a+"</"+e+">"}return o+"</tr>"})(a.body[u],"td");l+="</tbody>",n.footer&&a.footer&&(l+="<tfoot>"+a.footerStructure.map(function(t){return"<tr>"+t.map(function(t){return t?'<th colspan="'+t.colspan+'" rowspan="'+t.rowspan+'">'+t.title+"</th>":""}).join("")+"</tr>"}).join("")+"</tfoot>"),l+="</table>";var p=window.open("","");p?(p.document.close(),p.document.title=i.title,$('style, link[rel="stylesheet"]').each(function(){var t=this.cloneNode(!0);"link"===t.tagName.toLowerCase()&&(t.href=_relToAbs(t.href)),p.document.head.appendChild(t)}),n.customScripts&&n.customScripts.forEach(function(t){var e=p.document.createElement("script");e.src=t,p.document.getElementsByTagName("head")[0].appendChild(e)}),p.document.body.innerHTML="<h1>"+i.title+"</h1><div>"+(i.messageTop||"")+"</div>"+l+"<div>"+(i.messageBottom||"")+"</div>",$(p.document.body).addClass("dt-print-view"),$("img",p.document.body).each(function(t,e){e.setAttribute("src",_relToAbs(e.getAttribute("src")))}),n.customize&&n.customize(p,n,e),p.setTimeout(function(){n.autoPrint&&(p.print(),p.close())},1e3),r()):e.buttons.info(e.i18n("buttons.printErrorTitle","Unable to open print view"),e.i18n("buttons.printErrorMsg","Please allow popups in your browser for this site to be able to view the print view."),5e3)},async:100,title:"*",messageTop:"*",messageBottom:"*",exportOptions:{},header:!0,footer:!0,autoPrint:!0,customize:null};export default DataTable;