/*! * HTML5 export buttons for Buttons and DataTables. * © SpryMedia Ltd - datatables.net/license * * FileSaver.js (1.3.3) - MIT license * Copyright © 2016 Eli Grey - http://eligrey.com */ import jQuery from"jquery";import DataTable from"datatables.net";import Buttons from"datatables.net-buttons";let $=jQuery;var useJszip,usePdfmake;function _jsZip(){return useJszip||window.JSZip}function _pdfMake(){return usePdfmake||window.pdfMake}DataTable.Buttons.pdfMake=function(e){if(!e)return _pdfMake();usePdfmake=e},DataTable.Buttons.jszip=function(e){if(!e)return _jsZip();useJszip=e};var _saveAs=function(d){"use strict";var p,i,s,f,m,c,t,u,y,l,e;if(!(void 0===d||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent)))return e=d.document,p=function(){return d.URL||d.webkitURL||d},i=e.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in i,f=/constructor/i.test(d.HTMLElement)||d.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent),c=function(e){(d.setImmediate||d.setTimeout)(function(){throw e},0)},t=4e4,u=function(e){setTimeout(function(){"string"==typeof e?p().revokeObjectURL(e):e.remove()},t)},y=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},e=(l=function(e,o,t){t||(e=y(e));var l,n,r=this,t="application/octet-stream"===e.type,a=function(){for(var e=r,t="writestart progress write writeend".split(" "),o=void 0,l=(t=[].concat(t)).length;l--;){var n=e["on"+t[l]];if("function"==typeof n)try{n.call(e,o||e)}catch(e){c(e)}}};r.readyState=r.INIT,s?(l=p().createObjectURL(e),setTimeout(function(){var e,t;i.href=l,i.download=o,e=i,t=new MouseEvent("click"),e.dispatchEvent(t),a(),u(l),r.readyState=r.DONE})):(m||t&&f)&&d.FileReader?((n=new FileReader).onloadend=function(){var e=m?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");d.open(e,"_blank")||(d.location.href=e),r.readyState=r.DONE,a()},n.readAsDataURL(e),r.readyState=r.INIT):(l=l||p().createObjectURL(e),!t&&d.open(l,"_blank")||(d.location.href=l),r.readyState=r.DONE,a(),u(l))}).prototype,"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,o){return t=t||e.name||"download",o||(e=y(e)),navigator.msSaveOrOpenBlob(e,t)}:(e.abort=function(){},e.readyState=e.INIT=0,e.WRITING=1,e.DONE=2,e.error=e.onwritestart=e.onprogress=e.onwrite=e.onabort=e.onerror=e.onwriteend=null,function(e,t,o){return new l(e,t||e.name||"download",o)})}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content),_sheetname=(DataTable.fileSave=_saveAs,function(e){var t="Sheet1";return t=e.sheetName?e.sheetName.replace(/[\[\]\*\/\\\?\:]/g,""):t}),_newLine=function(e){return e.newline||(navigator.userAgent.match(/Windows/)?"\r\n":"\n")},_exportData=function(e,t){function o(e){for(var t="",o=0,l=e.length;o'+i:i).replace(/_dt_b_namespace_token_/g,":")).replace(/xmlns:NS[\d]+="" NS[\d]+:/g,""):i).replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");s.file(e,i)}})}function _createNode(e,t,o){var l=e.createElement(t);return o&&(o.attr&&$(l).attr(o.attr),o.children&&$.each(o.children,function(e,t){l.appendChild(t)}),null!==o.text)&&void 0!==o.text&&l.appendChild(e.createTextNode(o.text)),l}function _excelColWidth(e,t){var o=e.header[t].length;e.footer&&e.footer[t]&&e.footer[t].length>o&&(o=e.footer[t].length);for(var l=0,n=e.body.length;l',"xl/_rels/workbook.xml.rels":'',"[Content_Types].xml":'',"xl/workbook.xml":'',"xl/worksheets/sheet1.xml":'',"xl/styles.xml":''},_excelSpecials=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(e){return e/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(e){return e/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\-?\d+$/,style:65},{match:/^\-?\d+\.\d{2}$/,style:66},{match:/^\([\d,]+\)$/,style:61,fmt:function(e){return-1*e.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(e){return-1*e.replace(/[\(\)]/g,"")}},{match:/^\-?[\d,]+$/,style:63},{match:/^\-?[\d,]+\.\d{2}$/,style:64},{match:/^(19\d\d|[2-9]\d\d\d)\-(0\d|1[012])\-[0123][\d]$/,style:67,fmt:function(e){return Math.round(25569+Date.parse(e)/864e5)}}],_excelMergeCells=function(e,t,o,l,n){var r=$("mergeCells",e);r[0].appendChild(_createNode(e,"mergeCell",{attr:{ref:createCellPos(o)+t+":"+createCellPos(o+n-1)+(t+l-1)}})),r.attr("count",parseFloat(r.attr("count"))+1)};DataTable.ext.buttons.copyHtml5={className:"buttons-copy buttons-html5",text:function(e){return e.i18n("buttons.copy","Copy")},action:function(e,t,o,l,n){var r=_exportData(t,l),a=t.buttons.exportInfo(l),d=_newLine(l),p=r.str,i=$("
").css({height:1,width:1,overflow:"hidden",position:"fixed",top:0,left:0}),d=(a.title&&(p=a.title+d+d+p),a.messageTop&&(p=a.messageTop+d+d+p),a.messageBottom&&(p=p+d+d+a.messageBottom),l.customize&&(p=l.customize(p,l,t)),$("