/*! Buttons for DataTables 3.1.0
* © SpryMedia Ltd - datatables.net/license
*/
import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;var _instCounter=0,_buttonCounter=0,_dtButtons=DataTable.ext.buttons,_entityDecoder=null;function _fadeIn(t,n,e){$.fn.animate?t.stop().fadeIn(n,e):(t.css("display","block"),e&&e.call(t))}function _fadeOut(t,n,e){$.fn.animate?t.stop().fadeOut(n,e):(t.css("display","none"),e&&e.call(t))}var _infoTimer,Buttons=function(n,t){if(!DataTable.versionCheck("2"))throw"Warning: Buttons requires DataTables 2 or newer";if(!(this instanceof Buttons))return function(t){return new Buttons(t,n).container()};!0===(t=void 0===t?{}:t)&&(t={}),Array.isArray(t)&&(t={buttons:t}),this.c=$.extend(!0,{},Buttons.defaults,t),t.buttons&&(this.c.buttons=t.buttons),this.s={dt:new DataTable.Api(n),buttons:[],listenKeys:"",namespace:"dtb"+_instCounter++},this.dom={container:$("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)},this._constructor()},_filename=($.extend(Buttons.prototype,{action:function(t,n){t=this._nodeToButton(t);return void 0===n?t.conf.action:(t.conf.action=n,this)},active:function(t,n){var t=this._nodeToButton(t),e=this.c.dom.button.active,o=$(t.node);return t.inCollection&&this.c.dom.collection.button&&void 0!==this.c.dom.collection.button.active&&(e=this.c.dom.collection.button.active),void 0===n?o.hasClass(e):(o.toggleClass(e,void 0===n||n),this)},add:function(t,n,e){var o=this.s.buttons;if("string"==typeof n){for(var i=n.split("-"),s=this.s,a=0,r=i.length-1;a"),b.conf._collection=b.collection,$(b.node).append(u.action.dropHtml),this._expandButton(b.buttons,b.conf.buttons,b.conf.split,!r,r,s,b.conf)),b.conf.split){b.collection=$("<"+u.container.tag+"/>"),b.conf._collection=b.collection;for(var h=0;h").addClass("dt-button-spacer "+n.style+" "+p.spacer.className).html(i(n.text)),{conf:n,node:d,inserter:d,buttons:[],inCollection:t,isSplit:e,collection:null,textNode:d};if(n.available&&!n.available(f,n)&&!n.html)return!1;n.html?u=$(n.html):(a=function(t,n,e,o,i){o.action.call(n.button(e),t,n,e,o,i),$(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o])},r=function(t,n,e,o){o.async?(c.processing(e[0],!0),setTimeout(function(){a(t,n,e,o,function(){c.processing(e[0],!1)})},o.async)):a(t,n,e,o,function(){})},d=n.tag||p.tag,l=void 0===n.clickBlurs||n.clickBlurs,u=$("<"+d+"/>").addClass(p.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(t){t.preventDefault(),!u.hasClass(p.disabled)&&n.action&&r(t,f,u,n),l&&u.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),!u.hasClass(p.disabled))&&n.action&&r(t,f,u,n)}),"a"===d.toLowerCase()&&u.attr("href","#"),"button"===d.toLowerCase()&&u.attr("type","button"),s=p.liner.tag?(d=$("<"+p.liner.tag+"/>").html(i(n.text)).addClass(p.liner.className),"a"===p.liner.tag.toLowerCase()&&d.attr("href","#"),u.append(d),d):(u.html(i(n.text)),u),!1===n.enabled&&u.addClass(p.disabled),n.className&&u.addClass(n.className),n.titleAttr&&u.attr("title",i(n.titleAttr)),n.attr&&u.attr(n.attr),n.namespace||(n.namespace=".dt-button-"+_buttonCounter++),void 0!==n.config&&n.config.split&&(n.split=n.config.split));var b,h,g,m,v,y,d=this.c.dom.buttonContainer,d=d&&d.tag?$("<"+d.tag+"/>").addClass(d.className).append(u):u;return this._addKey(n),this.c.buttonCreated&&(d=this.c.buttonCreated(n,d)),e&&(h=(b=t?$.extend(!0,this.c.dom.split,this.c.dom.collection.split):this.c.dom.split).wrapper,g=$("<"+h.tag+"/>").addClass(h.className).append(u),m=$.extend(n,{align:b.dropdown.align,attr:{"aria-haspopup":"dialog","aria-expanded":!1},className:b.dropdown.className,closeButton:!1,splitAlignClass:b.dropdown.splitAlignClass,text:b.dropdown.text}),this._addKey(m),v=function(t,n,e,o){_dtButtons.split.action.call(n.button(g),t,n,e,o),$(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o]),e.attr("aria-expanded",!0)},y=$('').html(b.dropdown.dropHtml).on("click.dtb",function(t){t.preventDefault(),t.stopPropagation(),y.hasClass(p.disabled)||v(t,f,y,m),l&&y.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),y.hasClass(p.disabled)||v(t,f,y,m))}),0===n.split.length&&y.addClass("dtb-hide-drop"),g.append(y).attr(m.attr)),{conf:n,node:(e?g:u).get(0),inserter:e?g:d,buttons:[],inCollection:t,isSplit:e,inSplit:o,collection:null,textNode:s}},_nodeToButton:function(t,n){for(var e=0,o=(n=n||this.s.buttons).length;e").addClass(p.containerClassName).addClass(p.collectionLayout).addClass(p.splitAlignClass).addClass(d).css("display","none").attr({"aria-modal":!0,role:"dialog"}),o=$(o).addClass(p.contentClassName).attr("role","menu").appendTo(e),h.attr("aria-expanded","true"),h.parents("body")[0]!==document.body&&(h=document.body.lastChild),p.popoverTitle?e.prepend(''+p.popoverTitle+"
"):p.collectionTitle&&e.prepend(''+p.collectionTitle+"
"),p.closeButton&&e.prepend('×
').addClass("dtb-collection-closeable"),_fadeIn(e.insertAfter(h),p.fade),n=$(t.table().container()),d=e.css("position"),"container"!==p.span&&"dt-container"!==p.align||(h=h.parent(),e.css("width",n.width())),"absolute"===d?(t=$(h[0].offsetParent),n=h.position(),d=h.offset(),r=t.offset(),s=t.position(),a=window.getComputedStyle(t[0]),r.height=t.outerHeight(),r.width=t.width()+parseFloat(a.paddingLeft),r.right=r.left+r.width,r.bottom=r.top+r.height,t=n.top+h.outerHeight(),r=n.left,e.css({top:t,left:r}),a=window.getComputedStyle(e[0]),(l=e.offset()).height=e.outerHeight(),l.width=e.outerWidth(),l.right=l.left+l.width,l.bottom=l.top+l.height,l.marginTop=parseFloat(a.marginTop),l.marginBottom=parseFloat(a.marginBottom),p.dropup&&(t=n.top-l.height-l.marginTop-l.marginBottom),"button-right"!==p.align&&!e.hasClass(p.rightAlignClassName)||(r=n.left-l.width+h.outerWidth()),"dt-container"!==p.align&&"container"!==p.align||r$(window).width()&&(r=$(window).width()-l.width-s.left),d.left+r<0&&(r=-d.left),s.top+t+l.height>$(window).height()+$(window).scrollTop()&&(t=n.top-l.height-l.marginTop-l.marginBottom),s.top+t<$(window).scrollTop()&&(t=n.top+h.outerHeight()),e.css({top:t,left:r})):((u=function(){var t=$(window).height()/2,n=e.height()/2;e.css("marginTop",-1*(n=t").addClass(n).css("display","none").insertAfter(o),e):_fadeOut($("div."+n),e,function(){$(this).removeClass(n).remove()})},Buttons.instanceSelector=function(t,s){var a,r,l;return null==t?$.map(s,function(t){return t.inst}):(a=[],r=$.map(s,function(t){return t.name}),(l=function(t){var n;if(Array.isArray(t))for(var e=0,o=t.length;e)|(