/*! Buttons 4.0.0-beta.1 for DataTables
 * Copyright (c) SpryMedia Ltd - datatables.net/license
 */
import DataTable,{util,Dom}from"datatables.net";if(!DataTable.versionCheck("3"))throw"Warning: Buttons requires DataTables 3 or newer";let _exportTextarea=document.createElement("textarea");var useJszip,usePdfmake,_infoTimer,_instCounter=0,_buttonCounter=0,_entityDecoder=null;function _jsZip(){return useJszip||window.JSZip}function _pdfMake(){return usePdfmake||window.pdfMake}function fadeIn(t,e=400,n){t.css({opacity:"0"}).transition({opacity:"1"},e,null,n)}function fadeOut(t,e=400,n){t.css({opacity:"1"}).transition({opacity:"0"},e,null,n)}class Buttons{static pdfMake(t){return t&&(usePdfmake=t),_pdfMake()}static jszip(t){return t&&(useJszip=t),_jsZip()}popover(e,n,o){function i(){l=!0,fadeOut(Dom.s(c),u.fade,function(){this.detach()}),a.buttons('[aria-haspopup="dialog"][aria-expanded="true"]').nodes().attr("aria-expanded","false"),Dom.s("div.dt-button-background").off("click.dtb-collection"),Buttons.background(!1,u.backgroundClassName,u.fade,d.get(0)),Dom.w.off("resize.resize.dtb-collection"),Dom.s("body").off(".dtb-collection"),a.off("buttons-action.b-internal"),a.off("destroy.dtb-popover"),Dom.s("body").trigger("buttons-popover-hide.dt")}var a=n,r=this.c,l=!1,u=util.object.assign({align:"button-left",autoClose:!1,background:!0,backgroundClassName:"dt-button-background",closeButton:!0,containerClassName:r.dom.collection.container.className,contentClassName:r.dom.collection.container.content.className,collectionLayout:"",collectionTitle:"",dropup:!1,fade:400,popoverTitle:"",rightAlignClassName:"dt-button-right",tag:r.dom.collection.container.tag},o),c=u.tag+"."+u.containerClassName.replace(/ /g,"."),r=n.node(),d=u.collectionLayout.includes("fixed")?Dom.s("body"):n.node();if(!1===e)i();else{o=a.buttons('[aria-haspopup="dialog"][aria-expanded="true"]').nodes();o.count()&&(d.closest(c).count()&&(d=o.eq(0)),i());let s="string"==typeof e?Dom.c("div").html(e).children():Dom.s(e),t;u.sort&&((t=s.find("button").mapTo(function(t){return{text:Dom.s(t).text(),el:t}})).sort(function(t,e){return t.text.localeCompare(e.text)}),s.append(t.map(function(t){return t.el})));var p,f,b,h,m,g,v,y,o=s.find(".dt-button").count(),e="",D=(3===o?e="dtb-b3":2===o?e="dtb-b2":1===o&&(e="dtb-b1"),Dom.c(u.tag).classAdd(u.containerClassName).classAdd(u.collectionLayout).classAdd(u.splitAlignClass).classAdd(e).css("opacity","0").attr({"aria-modal":!0,role:"dialog"})),e=(s.classAdd(u.contentClassName).attr("role","menu").appendTo(D),r.attr("aria-expanded","true"),d.isAttached()||(o=Dom.s(document.body).children("div, section, p"),d=o.eq(o.count()-1)),u.popoverTitle?D.prepend('<div class="dt-button-collection-title">'+u.popoverTitle+"</div>"):u.collectionTitle&&D.prepend('<div class="dt-button-collection-title">'+u.collectionTitle+"</div>"),u.closeButton&&D.prepend('<div class="dtb-popover-close">&times;</div>').classAdd("dtb-collection-closeable"),d.get(0)===document.body?D.appendTo(document.body):D.insertAfter(d),Dom.s(n.table().container())),r=D.css("position");"container"!==u.span&&"dt-container"!==u.align||(d=d.parent(),D.css("width",e.width()+"px")),"absolute"===r?(o=Dom.s(d.get(0).offsetParent),n=d.position(),e=d.offset(),r=o.position(),p=n.top+d.height("outer"),f=n.left,D.css({top:p+"px",left:f+"px"}),v=window.getComputedStyle(D.get(0)),b=D.offset(),m=D.width("outer"),h=D.height("outer"),b.left,m=m,b.top,h=h,g=parseFloat(v.marginTop),v=parseFloat(v.marginBottom),b.top,b.left,u.dropup&&(p=n.top-h-g-v),"button-right"!==u.align&&!D.classHas(u.rightAlignClassName)||(f=n.left-m+d.width("outer")),"dt-container"!==u.align&&"container"!==u.align||f<n.left&&(f=-n.left),r.left+f+m>Dom.w.width()&&(f=Dom.w.width()-m-r.left),e.left+f<0&&(f=-e.left),r.top+p+h>Dom.w.height()+Dom.w.scrollTop()&&(p=n.top-h-g-v),o.offset().top+p<Dom.w.scrollTop()&&(p=n.top+d.height("outer")),D.css({top:p+"px",left:f+"px"})):((y=function(){var t=Dom.w.height()/2,e=D.height()/2;D.css("marginTop",(e=t<e?t:e)+"px")})(),Dom.w.on("resize.dtb-collection",function(){y()})),fadeIn(D,u.fade),u.background&&Buttons.background(!0,u.backgroundClassName,u.fade,u.backgroundHost||d.get(0)),Dom.s("div.dt-button-background").on("click.dtb-collection",function(){}),u.autoClose&&setTimeout(function(){a.on("buttons-action.b-internal",function(t,e,n,o){o.get(0)!==d.get(0)&&i()})},0),D.trigger("buttons-popover.dt"),a.on("destroy.dtb-popover",i),setTimeout(function(){l=!1,Dom.s("body").on("click.dtb-collection",function(t){l||(Dom.s(t.target).classHas("dt-button-background")||Dom.s(t.target).classHas("dtb-popover-close")||t.target!==D.get(0)&&0===D.find(t.target).count())&&i()}).on("keyup.dtb-collection",function(t){27===t.keyCode&&i()}).on("keydown.dtb-collection",function(t){var e=s.find("a, button"),n=document.activeElement,o=e.eq(0),i=e.eq(e.count()-1);9===t.keyCode&&(e.get().includes(n)?(o.focus(),t.preventDefault()):t.shiftKey?n===e.get(0)&&(i.focus(),t.preventDefault()):n===i.get(0)&&(o.focus(),t.preventDefault()))})},0)}}action(t,e){t=this._nodeToButton(t);return void 0===e?t?t.conf.action:null:(t&&(t.conf.action=e),this)}active(t,e){var t=this._nodeToButton(t),n=this.c.dom.button.active;return t&&t.inCollection&&this.c.dom.collection.button&&void 0!==this.c.dom.collection.button.active&&(n=this.c.dom.collection.button.active),void 0===e?!!t&&t.node.classHas(n):(t&&t.node.classToggle(n,void 0===e||e),this)}add(t,e,n=!0){var o=this.s.buttons;if("string"==typeof e){for(var i=e.split("-"),s=this.s,a=0,r=i.length-1;a<r;a++)s=s.buttons[parseInt(i[a])];o=s.buttons,e=parseInt(i[i.length-1])}var l=t?t.split:void 0,o=this._expandButton(o,t,l,(!t||!l||0===l.length)&&s,!1,e);return void 0!==n&&!0!==n||this._draw(),o}collectionRebuild(t,e){var n=this._nodeToButton(t);if(n){if(void 0!==e){for(var o=n.buttons.length-1;0<=o;o--)this.remove(n.buttons[o].node);for(n.conf.prefixButtons&&e.unshift.apply(e,n.conf.prefixButtons),n.conf.postfixButtons&&e.push.apply(e,n.conf.postfixButtons),o=0;o<e.length;o++){var i=e[o];this._expandButton(n.buttons,i,void 0!==i&&void 0!==i.config&&void 0!==i.config.split,!0,void 0!==i.parentConf&&void 0!==i.parentConf.split,void 0,i.parentConf)}}this._draw(n.collection,n.buttons)}}container(){return this.dom.container}disable(t){t=this._nodeToButton(t);return t&&((t.isSplit?t.node.children().eq(0):t.node).classAdd(this.c.dom.button.disabled).prop("disabled",!0),t.disabled=!0,this._checkSplitEnable()),this}destroy(){Dom.s("body").off("keyup."+this.s.namespace);for(var t=this.s.buttons.slice(),e=0,n=t.length;e<n;e++)this.remove(t[e].node.get(0));this.dom.container.remove();var o=this.s.dt.settings()[0]._buttons;for(e=0,n=o.length;e<n;e++)if(o[e].inst===this){o.splice(e,1);break}return this}enable(t,e=!0){return!1===e?this.disable(t):((e=this._nodeToButton(t))&&((e.isSplit?e.node.children().eq(0):e.node).classRemove(this.c.dom.button.disabled).prop("disabled",!1),e.disabled=!1,this._checkSplitEnable()),this)}index(t,e,n){e=e||"";for(var o=0,i=(n=n||this.s.buttons).length;o<i;o++){var s=n[o].buttons;if(n[o].node.get(0)===t)return e+o;if(s&&s.length){s=this.index(t,o+"-",s);if(null!==s)return s}}return null}name(){return this.c.name}node(t){return t?(t=this._nodeToButton(t))?t.node:null:this.dom.container}processing(t,e){var n=this.s.dt,o=this._nodeToButton(t);return void 0===e?!!o&&o.node.classHas("processing"):(o&&(o.node.classToggle("processing",e),Dom.s(n.table().node()).trigger("buttons-processing.dt",!1,[e,n.button(t),n,o.node,o.conf])),this)}remove(t){var e=this._nodeToButton(t);if(e){var n=this._nodeToHost(t),o=this.s.dt;if(e.buttons.length)for(let t=e.buttons.length-1;0<=t;t--)this.remove(e.buttons[t].node.get(0));e.conf.destroying=!0,e.conf.destroy&&e.conf.destroy.call(o.button(t),o,e.node,e.conf),this._removeKey(e.conf),e.node.remove(),e.inserter&&e.inserter.remove(),n&&(t=n.indexOf(e),n.splice(t,1))}return this}text(t,e){let n=this._nodeToButton(t);if(!n)return void 0===e?"":this;t=n.textNode;let o=this.s.dt;function i(t){return"function"==typeof t?t(o,n.node,n.conf):t}return void 0===e?i(n.conf.text||""):(n.conf.text=e,t&&t.html(i(e)),this)}constructor(t,e){let n;var t=new DataTable.Api(t),o=(n=void 0===e||!0===e?{}:Array.isArray(e)?{buttons:e}:e,this.c=util.object.assignDeep({},Buttons.defaults,n),n.buttons&&(this.c.buttons=n.buttons),this.s={dt:t,buttons:[],listenKeys:"",namespace:"dtb"+_instCounter++},this.dom={container:Dom.c(this.c.dom.container.tag).classAdd(this.c.dom.container.className)},this),i=this.s.dt.settings()[0],s=this.c.buttons;i._buttons||(i._buttons=[]),i._buttons.push({inst:this,name:this.c.name});for(var a=0,r=s.length;a<r;a++)this.add(s[a]);t.on("destroy",function(t,e){e===i&&o.destroy()}),Dom.c("body").on("keyup."+this.s.namespace,function(t){var e;document.activeElement&&document.activeElement!==document.body||(e=String.fromCharCode(t.keyCode).toLowerCase(),-1!==o.s.listenKeys.toLowerCase().indexOf(e)&&o._keypress(e,t))})}_addKey(t){t.key&&(this.s.listenKeys+=(util.is.plainObject(t.key)?t.key:t).key)}_draw(t,e){t=t||this.dom.container,e=e||this.s.buttons,t.children().detach();for(var n=0,o=e.length;n<o;n++)t.append(e[n].inserter),t.append(document.createTextNode(" ")),e[n].buttons&&e[n].buttons.length&&this._draw(e[n].collection,e[n].buttons)}_expandButton(t,e,n,o,i,s,a){for(var r,l,u=this.s.dt,c=this.c.dom.collection,d=Array.isArray(e)?e:[e],p=0,f=(d=void 0===e?Array.isArray(n)?n:[n]:d).length;p<f;p++)if(Array.isArray(d[p]))this._expandButton(t,d[p],void 0,o,void 0!==a&&void 0!==a.split,s,a);else{var b=this._resolveExtends(d[p]);if(b)if(r=!!b.split,Array.isArray(b))this._expandButton(t,b,!1,o,void 0!==a&&void 0!==a.split,s,a);else{var h=this._buildButton(b,o,void 0!==b.split,i);if(h){if(null!=s?(t.splice(s,0,h),s++):t.push(h),h.conf.dropIcon&&!h.conf.split&&h.node.classAdd(this.c.dom.button.dropClass).append(this.c.dom.button.dropHtml),h.conf.buttons&&(h.collection=Dom.c(c.container.content.tag),h.conf._collection=h.collection,this._expandButton(h.buttons,h.conf.buttons,h.conf.split,!r,r,s,h.conf)),h.conf.split){h.collection=Dom.c(c.container.tag),h.conf._collection=h.collection;for(var m=0;m<h.conf.split.length;m++){var g=h.conf.split[m];"object"==typeof g&&(g.parent=a,void 0===g.collectionLayout&&(g.collectionLayout=h.conf.collectionLayout),void 0===g.dropup&&(g.dropup=h.conf.dropup),void 0===g.fade)&&(g.fade=h.conf.fade)}this._expandButton(h.buttons,h.conf.buttons,h.conf.split,!r,r,s,h.conf)}h.conf.parent=a,b.init&&b.init.call(u.button(h.node),u,h.node,b),l=h.node}}}return l}_buildButton(e,t,n,o){function i(t){return"function"==typeof t?t(p,l,e):t}var s,a,r,l,u=this,c=this.c.dom,d=null,p=this.s.dt,f=!1,b=util.object.assignDeep({},c.button);if(t&&n&&c.collection.split?util.object.assignDeep(b,c.collection.split.action):o||t?util.object.assignDeep(b,c.collection.button):n&&util.object.assignDeep(b,c.split.button),e.spacer)return c=Dom.c(b.spacer.tag).classAdd(["dt-button-spacer",e.style||"",b.spacer.className]).html(i(e.text||"")),{buttons:[],collection:null,conf:e,disabled:!1,inserter:c,inSplit:o,inCollection:t,isCollection:!1,isSplit:!1,node:c,nodeChild:null,textNode:c};if(e.available&&!e.available(p,e)&&!e.html)return!1;e.html?l=Dom.c("div").html(e.html):(s=function(t,e,n,o,i){var s;null!=(s=o.action)&&s.call(e.button(n),t,e,n,o,i),Dom.s(e.table().node()).trigger("buttons-action.dt",!1,[e.button(n),e,n,o])},a=function(t,e,n,o){o.async?(u.processing(n.get(0),!0),setTimeout(function(){s(t,e,n,o,function(){u.processing(n.get(0),!1)})},o.async)):s(t,e,n,o,()=>{})},c=e.tag||b.tag,r=void 0===e.clickBlurs||e.clickBlurs,l=Dom.c(c).classAdd(b.className).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(t){t.preventDefault(),!l.classHas(b.disabled)&&e.action&&a(t,p,l,e),r&&l.blur()}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),!l.classHas(b.disabled))&&e.action&&a(t,p,l,e)}),"a"===c.toLowerCase()&&l.attr("href","#"),"button"===c.toLowerCase()&&l.attr("type","button"),d=b.liner.tag?(c=b.liner.tag.toLowerCase(),y=Dom.c(c).html(i(e.text||"")).classAdd(b.liner.className),"a"===c&&y.attr("href","#"),"a"!==c&&"button"!==c||(y.attr("tabindex",this.s.dt.settings()[0].tabIndex),f=!0),l.append(y),y):(l.html(i(e.text||"")),l),f||l.attr("tabindex",this.s.dt.settings()[0].tabIndex),!1===e.enabled&&l.classAdd(b.disabled),e.className&&l.classAdd(e.className),e.titleAttr&&l.attr("title",i(e.titleAttr)),e.attr&&l.attr(e.attr),e.namespace||(e.namespace=".dt-button-"+_buttonCounter++));var h,m,g,v,c=this.c.dom.buttonContainer,y=c&&c.tag?Dom.c(c.tag).classAdd(c.className).append(l):l;return this._addKey(e),this.c.buttonCreated&&(y=this.c.buttonCreated(e,y,t)),n&&(c=(f=t?util.object.assignDeep(this.c.dom.split,this.c.dom.collection.split):this.c.dom.split).wrapper,h=Dom.c(c.tag).classAdd(c.className).append(l),m=util.object.assign(e,{autoClose:!0,align:f.dropdown.align,attr:{"aria-haspopup":"dialog","aria-expanded":!1},className:f.dropdown.className,closeButton:!1,splitAlignClass:f.dropdown.splitAlignClass,text:f.dropdown.text}),this._addKey(m),g=function(t,e,n,o){"object"==typeof Buttons.buttons.split&&Buttons.buttons.split.action&&Buttons.buttons.split.action.call(e.button(h),t,e,n,o,()=>{}),Dom.s(e.table().node()).trigger("buttons-action.dt",!1,[e.button(n),e,n,o]),n.attr("aria-expanded",!0)},v=Dom.c("button").classAdd([f.dropdown.className,"dt-button",this.c.dom.button.dropClass]).html(this.c.dom.button.dropHtml).on("click.dtb",function(t){t.preventDefault(),t.stopPropagation(),v.classHas(b.disabled)||g(t,p,v,m),r&&v.blur()}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),v.classHas(b.disabled)||g(t,p,v,m))}),e.split&&0===e.split.length&&v.classAdd("dtb-hide-drop"),m.attr&&h.append(v).attr(m.attr),l=h),{buttons:[],collection:null,conf:e,disabled:!1,inserter:n?l:y,inCollection:t,inSplit:o,isCollection:!1,isSplit:n,node:l,nodeChild:l&&l.children&&l.children().count()?l.children().get(0):null,textNode:d}}_checkSplitEnable(t){t=t||this.s.buttons;for(var e=0;e<t.length;e++){var n,o=t[e];o.isSplit?(n=o.node.get(0).childNodes[1],(this._checkAnyEnabled(o.buttons)?Dom.s(n).classRemove(this.c.dom.button.disabled):Dom.s(n).classAdd(this.c.dom.button.disabled)).prop("disabled",!1)):o.isCollection&&this._checkSplitEnable(o.buttons)}}_checkAnyEnabled(t){for(var e=0;e<t.length;e++)if(!t[e].disabled)return!0;return!1}_nodeToButton(t,e){e=e||this.s.buttons,util.is.dom(t)&&(t=t.get(0));for(var n=0,o=e.length;n<o;n++){if(e[n].node.get(0)===t||e[n].nodeChild===t)return e[n];if(e[n].buttons.length){var i=this._nodeToButton(t,e[n].buttons);if(i)return i}}}_nodeToHost(t,e){e=e||this.s.buttons,util.is.dom(t)&&(t=t.get(0));for(var n=0,o=e.length;n<o;n++){if(e[n].node.get(0)===t)return e;if(e[n].buttons.length){var i=this._nodeToHost(t,e[n].buttons);if(i)return i}}}_keypress(s,a){var r;a._buttonsHandled||(r=function(t){for(var e,n,o=0,i=t.length;o<i;o++)e=t[o].conf,n=t[o].node,!e.key||e.key!==s&&(!util.is.plainObject(e.key)||e.key.key!==s||e.key.shiftKey&&!a.shiftKey||e.key.altKey&&!a.altKey||e.key.ctrlKey&&!a.ctrlKey||e.key.metaKey&&!a.metaKey)||(a._buttonsHandled=!0,n.trigger("click")),t[o].buttons.length&&r(t[o].buttons)})(this.s.buttons)}_removeKey(t){var e;t.key&&(t=(util.is.plainObject(t.key)?t.key:t).key,t=(e=this.s.listenKeys.split("")).indexOf(t),e.splice(t,1),this.s.listenKeys=e.join(""))}_resolveExtends(t){function e(t,e){for(var n=0;!util.is.plainObject(t)&&!Array.isArray(t);){if(void 0===t)return!1;if("function"==typeof t){if(!(t=t.call(i,s,e)))return!1}else if("string"==typeof t){if(!Buttons.buttons[t])return{html:t};t=Buttons.buttons[t]}if(30<++n)throw"Buttons: Too many iterations"}return Array.isArray(t)?t:util.object.assign({},t)}var n,o,i=this,s=this.s.dt,t=e(t,t);if(!1===t)return!1;for(var a=t;a&&a.extend;){if(!Buttons.buttons[a.extend])throw"Cannot extend unknown button type: "+a.extend;var r=e(Buttons.buttons[a.extend],a);if(Array.isArray(r))return r;if(!r)return!1;var l=r.className,a=util.object.assign({},r,a);l&&a.className!==l&&(a.className=l+" "+a.className),a.extend=r.extend}var u=a.postfixButtons;if(u)for(a.buttons||(a.buttons=[]),n=0,o=u.length;n<o;n++)a.buttons.push(u[n]);var c=a.prefixButtons;if(c)for(a.buttons||(a.buttons=[]),n=0,o=c.length;n<o;n++)a.buttons.splice(n,0,c[n]);return a}}Buttons.background=function(t,e="",n=400,o=document.body){t?(t=Dom.c("div").classAdd(e).css("opacity","0"),o===document.body?t.appendTo(o):t.insertAfter(o),fadeIn(t,n)):fadeOut(Dom.s("div."+e),n,function(){this.classRemove(e).remove()})},Buttons.buttons=DataTable.ext.buttons,Buttons.instanceSelector=function(t,s){var a,r,l;return null==t?s.map(t=>t.inst):(a=[],r=s.map(t=>t.name),(l=function(t){var e;if(Array.isArray(t))for(var n=0,o=t.length;n<o;n++)l(t[n]);else if("string"==typeof t)-1!==t.indexOf(",")?l(t.split(",")):-1!==(e=r.indexOf(t.trim()))&&a.push(s[e].inst);else if("number"==typeof t)a.push(s[t].inst);else if(util.is.element(t))for(var i=0;i<s.length;i++)s[i].inst.dom.container.get(0)===t&&a.push(s[i].inst);else"object"==typeof t&&a.push(t)})(t),a)},Buttons.buttonSelector=function(t,e){for(var u=[],c=function(t,e,n){for(var o,i,s=0,a=e.length;s<a;s++)(o=e[s])&&(t.push({node:o.node,name:o.conf.name,idx:i=void 0!==n?n+s:s+""}),o.buttons)&&c(t,o.buttons,i+"-")},d=function(t,e){var n=[],o=(c(n,e.s.buttons),n.map(t=>t.node.get(0)));if((t=util.is.dom(t)?t.get():t)&&util.is.arrayLike(t))for(s=0,a=t.length;s<a;s++)d(t[s],e);else if(null==t||"*"===t)for(s=0,a=n.length;s<a;s++)u.push({inst:e,node:n[s].node});else if("number"==typeof t)e.s.buttons[t]&&u.push({inst:e,node:e.s.buttons[t].node});else if("string"==typeof t)if(-1!==t.indexOf(","))for(var i=t.split(","),s=0,a=i.length;s<a;s++)d(i[s].trim(),e);else if(t.match(/^\d+(\-\d+)*$/)){var r=n.map(t=>t.idx);u.push({inst:e,node:n[r.indexOf(t)].node})}else if(-1!==t.indexOf(":name")){var l=t.replace(":name","");for(s=0,a=n.length;s<a;s++)n[s].name===l&&u.push({inst:e,node:n[s].node})}else Dom.s(o).filter(t).each(function(t){u.push({inst:e,node:Dom.s(t)})});else util.is.element(t)&&-1!==(r=o.indexOf(t))&&u.push({inst:e,node:Dom.s(o[r])})},n=0,o=t.length;n<o;n++){var i=t[n];d(e,i)}return u},Buttons.stripData=function(t,e){t=null!==t&&"object"==typeof t&&t.nodeName&&t.nodeType?t.innerHTML:t;return t="string"==typeof t&&(t=Buttons.stripHtmlScript(t),t=Buttons.stripHtmlComments(t),e&&!e.stripHtml||(t=DataTable.util.stripHtml(t)),e&&!e.trim||(t=t.trim()),e&&!e.stripNewlines||(t=t.replace(/\n/g," ")),e&&!e.decodeEntities||(t=_entityDecoder?_entityDecoder(t):(_exportTextarea.innerHTML=t,_exportTextarea.value)),!e||e.escapeExcelFormula)&&t.match(/^[=@\t\r]/)?"'"+t:t},Buttons.entityDecoder=function(t){_entityDecoder=t},Buttons.stripHtmlComments=function(t){for(var e;(t=(e=t).replace(/(<!--.*?--!?>)|(<!--[\S\s]+?--!?>)|(<!--[\S\s]*?$)/g,""))!==e;);return t},Buttons.stripHtmlScript=function(t){for(var e;(t=(e=t).replace(/<script\b[^<]*(?:(?!<\/script[^>]*>)<[^<]*)*<\/script[^>]*>/gi,""))!==e;);return t},Buttons.defaults={buttons:["copy","excel","csv","pdf","print"],name:"main",tabIndex:0,dom:{button:{tag:"button",className:"dt-button",active:"dt-button-active",disabled:"disabled",dropClass:"",dropHtml:'<span class="dt-button-down-arrow">&#x25BC;</span>',liner:{tag:"span",className:""},spacer:{className:"dt-button-spacer",tag:"span"}},container:{tag:"div",className:"dt-buttons"},collection:{container:{className:"dt-button-collection",content:{className:"",tag:"div"},tag:"div"}},split:{action:{className:"dt-button-split-drop-button dt-button",tag:"button"},dropdown:{align:"split-right",className:"dt-button-split-drop",splitAlignClass:"dt-button-split-left",tag:"button"},wrapper:{className:"dt-button-split",tag:"div"}}}},Buttons.version="4.0.0-beta.1",Buttons.buttons.collection={text:function(t){return t.i18n("buttons.collection","Collection")},className:"buttons-collection",closeButton:!1,dropIcon:!0,init:function(t,e){e.attr("aria-expanded",!1)},action:function(t,e,n,o){o._collection.isAttached()?this.popover(!1,o):this.popover(o._collection,o),"keypress"===t.type&&o._collection.find("a, button").eq(0).focus()},attr:{"aria-haspopup":"dialog"}},Buttons.buttons.split={text:function(t){return t.i18n("buttons.split","Split")},className:"buttons-split",closeButton:!1,init:function(t,e){return e.attr("aria-expanded",!1)},action:function(t,e,n,o){this.popover(o._collection,o)},attr:{"aria-haspopup":"dialog"}},Buttons.buttons.copy=function(t,e){if(Buttons.buttons.copyHtml5)return"copyHtml5"},Buttons.buttons.csv=function(t,e){if("object"==typeof Buttons.buttons.csvHtml5&&Buttons.buttons.csvHtml5.available(t,e))return"csvHtml5"},Buttons.buttons.excel=function(t,e){if("object"==typeof Buttons.buttons.excelHtml5&&Buttons.buttons.excelHtml5.available(t,e))return"excelHtml5"},Buttons.buttons.pdf=function(t,e){if("object"==typeof Buttons.buttons.pdfHtml5&&Buttons.buttons.pdfHtml5.available(t,e))return"pdfHtml5"},Buttons.buttons.pageLength=function(t){var e=t.settings()[0].lengthMenu,n=[],o=[];if(Array.isArray(e[0]))n=e[0],o=e[1];else for(var i=0;i<e.length;i++){var s=e[i];util.is.plainObject(s)?(n.push(s.value),o.push(s.label)):(n.push(s),o.push(s))}return{extend:"collection",text:function(t){return t.i18n("buttons.pageLength",{"-1":"Show all rows",_:"Show %d rows"},t.page.len())},className:"buttons-page-length",autoClose:!0,buttons:n.map(function(s,t){return{text:o[t],className:"button-page-length",action:function(t,e){e.page.len(s).draw()},init:function(t,e,n){function o(){i.active(t.page.len()===s)}var i=this;t.on("length.dt"+n.namespace,o),o()},destroy:function(t,e,n){t.off("length.dt"+n.namespace)}}}),init:function(t,e,n){var o=this;t.on("length.dt"+n.namespace,function(){o.text(n.text)})},destroy:function(t,e,n){t.off("length.dt"+n.namespace)}}},Buttons.buttons.spacer={style:"empty",spacer:!0,text:function(t){return t.i18n("buttons.spacer","")}};let buttonSelector=function(e,n){void 0===n&&(n=e,e=null),this.selector.buttonGroup=e;var t=this.iterator(!0,"table",function(t){if(t._buttons)return Buttons.buttonSelector(Buttons.instanceSelector(e,t._buttons),n)},!0);return t._groupSelector=e,t};function _init(t,e){t=new DataTable.Api(t),e=e||t.init().buttons||DataTable.defaults.buttons;return new Buttons(t,e).container()}DataTable.Api.register("buttons()",buttonSelector),DataTable.Api.register("button()",function(t,e){e=buttonSelector.call(this,t,e);return 1<e.length&&e.splice(1,e.length),e._groupSelector=t,e}),DataTable.Api.registerPlural("buttons().active()","button().active()",function(e){return void 0===e?this.map(function(t){return t.inst.active(t.node)}):this.each(function(t){t.inst.active(t.node,e)})}),DataTable.Api.registerPlural("buttons().action()","button().action()",function(e){return void 0===e?this.map(function(t){return t.inst.action(t.node)}):this.each(function(t){t.inst.action(t.node,e)})}),DataTable.Api.registerPlural("buttons().collectionRebuild()","button().collectionRebuild()",function(n){return this.each(function(t){for(var e=0;e<n.length;e++)"object"==typeof n[e]&&(n[e].parentConf=t);t.inst.collectionRebuild(t.node,n)})}),DataTable.Api.register(["buttons().enable()","button().enable()"],function(e){return this.each(function(t){t.inst.enable(t.node,e)})}),DataTable.Api.register(["buttons().disable()","button().disable()"],function(){return this.each(function(t){t.inst.disable(t.node)})}),DataTable.Api.register("button().index()",function(){var e=null;return this.each(function(t){t=t.inst.index(t.node.get(0));null!==t&&(e=t)}),e}),DataTable.Api.registerPlural("buttons().nodes()","button().node()",function(){var e=new Dom;return this.each(function(t){e.add(t.inst.node(t.node).get(0))}),e}),DataTable.Api.registerPlural("buttons().processing()","button().processing()",function(e){return void 0===e?this.map(function(t){return t.inst.processing(t.node)}):this.each(function(t){t.inst.processing(t.node,e)})}),DataTable.Api.registerPlural("buttons().text()","button().text()",function(e){return void 0===e?this.map(function(t){return t.inst.text(t.node)}):this.each(function(t){t.inst.text(t.node,e)})}),DataTable.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(t){t.inst.node(t.node).trigger("click")})}),DataTable.Api.register("button().popover()",function(e,n){return this.map(t=>t.inst.popover(e,this.button(this[0].node),n))}),DataTable.Api.register("buttons().containers()",function(){var i=new Dom,s=this._groupSelector;return this.iterator(!0,"table",function(t){if(t._buttons)for(var e=Buttons.instanceSelector(s,t._buttons),n=0,o=e.length;n<o;n++)i=i.add(e[n].container().get(0))}),i}),DataTable.Api.register("buttons().container()",function(){return this.containers().eq(0)}),DataTable.Api.register("button().add()",function(t,e,n=!0){var o,i=this.context;return(o=i.length&&(i=Buttons.instanceSelector(this._groupSelector,i[0]._buttons)).length?i[0].add(e,t,n):o)?this.button(this._groupSelector,o):this}),DataTable.Api.register("buttons().destroy()",function(){return this.pluck("inst").unique().each(function(t){t.destroy()}),this}),DataTable.Api.registerPlural("buttons().remove()","button().remove()",function(){return this.each(function(t){t.inst.remove(t.node)}),this}),DataTable.Api.register("buttons.info()",function(t,e,n){var o=this,i=Dom.s("#datatables_buttons_info");return!1===t?(this.off("destroy.btn-info"),fadeOut(i,400,function(){this.remove()}),_infoTimer&&(clearTimeout(_infoTimer),_infoTimer=null)):(_infoTimer&&clearTimeout(_infoTimer),i.remove(),t=t?"<h2>"+t+"</h2>":"",fadeIn(Dom.c("div").attr("id","datatables_buttons_info").classAdd("dt-button-info").html(t).append(Dom.c("div")["string"==typeof e?"html":"append"](e)).css("display","none").appendTo("body")),void 0!==n&&0!==n&&(_infoTimer=setTimeout(function(){o.buttons.info(!1)},n)),this.on("destroy.btn-info",function(){o.buttons.info(!1)})),this}),DataTable.Api.register("buttons.exportData()",function(t){if(this.context.length)return _exportData(new DataTable.Api(this.context[0]),t)}),DataTable.Api.register("buttons.exportInfo()",function(t){return{filename:_filename(t=t||{},this),title:_title(t,this),messageTop:_message(this,t,t.message||t.messageTop,"top"),messageBottom:_message(this,t,t.messageBottom,"bottom")}}),DataTable.Buttons=Buttons,Dom.s(document).on("init.dt plugin-init.dt",function(t,e){"dt"===t.namespace&&(t=e.init.buttons||DataTable.defaults.buttons)&&!e._buttons&&new Buttons(e,t).container()}),DataTable.ext.feature.push({fnInit:_init,cFeature:"B"}),DataTable.feature&&DataTable.feature.register("buttons",_init);var _filename=function(t,e){var n;return null==(n="function"==typeof(n="*"===t.filename&&"*"!==t.title&&null!=t.title&&""!==t.title?t.title:t.filename)?n(t,e):n)?null:(n=(n=-1!==n.indexOf("*")?n.replace(/\*/g,Dom.s("head > title").text()).trim():n).replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""))+(_stringOrFunction(t.extension,t,e)||"")},_stringOrFunction=function(t,e,n){return null==t?null:"function"==typeof t?t(e,n):t},_title=function(t,e){t=_stringOrFunction(t.title,t,e);return null===t?null:-1!==t.indexOf("*")?t.replace(/\*/g,Dom.s("head > title").text()||"Exported data"):t},_message=function(t,e,n,o){n=_stringOrFunction(n,e,t);return null===n?null:(e=Dom.s(t.table().container()).find("caption").eq(0),"*"===n?e.css("caption-side")!==o?null:e.count()?e.text():"":n)},_exportData=function(i,t){for(var s=util.object.assignDeep({},{rows:null,columns:"",modifier:{search:"applied",order:"applied"},orthogonal:"display",stripHtml:!0,stripNewlines:!0,decodeEntities:!0,escapeExcelFormula:!1,trim:!0,format:{header:function(t){return Buttons.stripData(t,s)},footer:function(t){return Buttons.stripData(t,s)},body:function(t){return Buttons.stripData(t,s)}},customizeData:null,customizeZip:null},t),t=i.columns(s.columns).indexes().map(function(t){var e=i.column(t);return s.format.header(e.title(),t,e.header())}).toArray(),e=i.table().footer()?i.columns(s.columns).indexes().map(function(t){var e,n=i.column(t).footer(),o="";return n&&(o=((e=Dom.s(n).find(".dt-column-title")).count()?e:Dom.s(n)).html()),s.format.footer(o,t,n)}).toArray():null,n=util.object.assign({},s.modifier),o=(i.select&&"function"==typeof i.select.info&&void 0===n.selected&&i.rows(s.rows,util.object.assign({selected:!0},n)).any()&&util.object.assign(n,{selected:!0}),i.rows(s.rows,n).indexes().toArray()),o=i.cells(o,s.columns,{order:n.order}),a=o.render(s.orthogonal).toArray(),r=o.nodes().toArray(),l=o.indexes().toArray(),u=i.columns(s.columns).count(),c=[],d=0,p=0,f=0<u?a.length/u:0;p<f;p++){for(var b=[u],h=0;h<u;h++)b[h]=s.format.body(a[d],l[d].row,l[d].column,r[d]),d++;c[p]=b}n={header:t,headerStructure:_headerFormatter(s.format.header,i.table().header.structure(s.columns)),footer:e,footerStructure:_headerFormatter(s.format.footer,i.table().footer.structure(s.columns)),body:c};return s.customizeData&&s.customizeData(n),n};function _headerFormatter(t,e){for(var n=0;n<e.length;n++)for(var o=0;o<e[n].length;o++){var i=e[n][o];i&&(i.title=t(i.title,o,i.cell))}return e}export default DataTable;