jQuery.fn.dataTable.Api.register("contextualActions()",function(u){var e=this.table();const h={DIVIDER:"divider",OPTION:"option",STATIC:"static"},b={isDisabled:function(t,e){return t.type!==h.STATIC&&0===e.length||void 0!==t.multi&&!1===t.multi&&1<e.length||"function"==typeof t.isDisabled&&((void 0===t.isDisabledStrictMode||"boolean"==typeof t.isDisabledStrictMode&&!1===t.isDisabledStrictMode)&&0===e.filter(e=>!t.isDisabled(e)).length||"boolean"==typeof t.isDisabledStrictMode&&!0===t.isDisabledStrictMode&&e.some(e=>t.isDisabled(e)))||t.type===h.STATIC&&"function"==typeof t.isDisabled&&t.isDisabled()}};if((u=function e(t,...i){if(!i.length)return t;var n=i.shift();if(s(t)&&s(n))for(const o in n)s(n[o])?(t[o]||Object.assign(t,{[o]:{}}),e(t[o],n[o])):Object.assign(t,{[o]:n[o]});return e(t,...i)}({contextMenu:{enabled:!0,isMulti:!1,xoffset:-10,yoffset:-10,showSpeed:"0.30s",headerRenderer:"",headerIsFollowedByDivider:!1,showStaticOptions:!1,startsNewSelection:!1},buttonList:{enabled:!0,groupClass:"btn-group",iconOnly:!1,disabledOpacity:.5,dividerSpacing:10},classes:[],iconPrefix:"",items:[],deselectAfterAction:!0,showConfirmationMethod:function(e){e.callback(window.confirm(e.message))}},u=null==u?{}:u)).buttonList.enabled&&void 0===u.buttonList.containerSelector)throw"The buttonList.containerSelector option must be specified if the buttonList is enabled, to specify where the buttons will be created";var y={dt:null,table:null,contextMenuId:"",rightClickedRowData:"",init:function(o){this.dt=e,this.table=$(this.dt.container()).find("table"),$(window).click(function(e){$("#"+y.contextMenuId).is(":visible")&&!$(e.target).closest(".dropdown-menu").length&&i()}),this.contextMenuId=(this.table instanceof jQuery?this.table.attr("id"):this.table.id)+"-context-menu",this.rightClickedRowData=[];var s=this;$(this.table).on("contextmenu","tr",function(e){var t=()=>y.table.DataTable().rows().deselect();o.contextMenu.isMulti?s.dt.rows({selected:!0}).indexes().toArray().includes(y.dt.row(this).index())||o.contextMenu.startsNewSelection&&t():t(),s.dt.row(this).select();t=s.table.DataTable().rows({selected:!0}).toArray()[0],t=s.table.DataTable().rows(t).data().toArray();if(o.contextMenu.enabled&&void 0!==t)return i(),s.rightClickedRowData=t,function(t,e){!function(a,e,d,c,l){var r=$('<div id="'+a+'" class="dropdown-menu shadow'+e.join(" ")+'">');r.css({display:"block",visibility:"hidden",left:0,top:0,opacity:0}),r.on("contextmenu",function(e){return!1}),!1!==u.contextMenu.headerRenderer&&(r.append('<h6 class="dropdown-header"></h6>'),u.contextMenu.headerIsFollowedByDivider&&r.append('<div class="dropdown-divider"></div>'));$.each(c,function(e,t){var i,n,o,s;"function"==typeof t.isHidden&&(0===l.length||l.some(e=>t.isHidden(e)))||(t.type===h.DIVIDER?!(0<e&&e!==c.length-1&&c[e-1].type!==h.DIVIDER)||c[e-1].type===h.STATIC&&!u.contextMenu.showStaticOptions&&2<=e&&c[e-2].type===h.DIVIDER||r.append('<div class="dropdown-divider"></div>'):(t.type===h.OPTION||u.contextMenu.showStaticOptions&&t.type===h.STATIC)&&(i="",void 0!==t.iconClass&&""!==t.icon&&(i='<i style="margin-right:15px;" class="'+d+" "+t.iconClass+'"></i>'),n=void 0!==t.contextMenuClasses?t.contextMenuClasses.join(" "):"",o=void 0!==t.classes?t.classes.join(" "):"",e=void 0!==t.multiTitle&&1<l.length?t.multiTitle||"":t.title||"",s=$.parseHTML('<a class="dropdown-item '+o+" "+n+'" style="cursor: pointer;">'+i+e+"</a>"),b.isDisabled(t,l)&&$(s).addClass("disabled").css("opacity","0.5"),1<l.length&&t.type!==h.STATIC&&(e=("function"==typeof t.isDisabled?l.filter(e=>!t.isDisabled(e)):l).length,$(s).append(" ("+e+")")),void 0!==t.confirmation?$(s).click(function(){v(t,l),p(a)}):$(s).click(function(){var e=l.filter(e=>void 0===t.isDisabled||!t.isDisabled(e));p(a),t.action(e,$(s)),u.deselectAfterAction?y.dt.rows().deselect():y.update()}),r.append(s)))}),r.children(":last-child.dropdown-divider").remove(),r.children().each(function(){$(this).hasClass("dropdown-divider")&&$(this).prev().hasClass("dropdown-divider")&&$(this).remove()}),$("body").append(r)}(y.contextMenuId,u.classes,u.iconPrefix,u.items,y.rightClickedRowData);var o=e+u.contextMenu.yoffset,s=t+u.contextMenu.xoffset;if(!1!==u.contextMenu.headerRenderer){t="";try{"string"==typeof u.contextMenu.headerRenderer?t=u.contextMenu.headerRenderer:"function"==typeof u.contextMenu.headerRenderer&&(t=u.contextMenu.headerRenderer(y.rightClickedRowData))}catch(e){t=""}$("#"+y.contextMenuId).find(".dropdown-header").html(t)}setTimeout(function(){$("#"+y.contextMenuId).css({display:"block",visibility:"visible",opacity:0,top:o,left:s,transition:u.contextMenu.showSpeed+" ease all, left 0s, top 0s","z-index":99999}),$("#"+y.contextMenuId).css({opacity:1});var e=$("#"+y.contextMenuId).get(0).getBoundingClientRect(),t=window.innerHeight,i=document.body.clientWidth,n=!1;e.bottom>t&&(o-=e.bottom-t,n=!0),e.right>i&&(s-=e.right-i,n=!0),n&&$("#"+y.contextMenuId).css({top:o-20,left:s-20})},1)}(e.pageX,e.pageY),!1}),this.dt.on("select",function(e,t,i,n){"row"===i&&(i=t.rows({selected:!0}).toArray()[0],i=s.table.DataTable().rows(i).data().toArray(),a(0,o,i))}),this.dt.on("deselect",function(e,t,i,n){"row"===i&&(i=t.rows({selected:!0}).toArray()[0],i=s.table.DataTable().rows(i).data().toArray(),a(0,o,i))}),a(this.dt,o,[])},update:function(){var e=this.dt.rows({selected:!0}).data().toArray();a(this.dt,u,e)}};function i(){$("#"+y.contextMenuId).removeClass("show").hide(),y.rightClickedRowData=[],p(y.contextMenuId)}function a(e,t,i){var n,o,s;t.buttonList.enabled&&(n=t.buttonList,o=t.classes,s=t.items,t=t.iconPrefix,i=i,function(e,t){$.each(t,function(e,t){$(u.containerSelector).removeClass(t)}),$(e).empty()}(n.containerSelector,o),function(d,e,c,l,r){var u='<div class="'+d.groupClass+'"></div>',p=[],f=null;$.each(c,function(e,t){if(null===f)f=$(u);else{if(0===e&&t.type===h.DIVIDER)return;if(0<e&&t.type===h.DIVIDER&&c[e-1].type===h.DIVIDER)return;if(e===c.length-1&&t.type===h.DIVIDER)return;if(0<e&&t.type===h.DIVIDER)return p.push(f),void(f=$(u)).css("margin-left",d.dividerSpacing+"px")}var i,n,o,s,a;"function"==typeof t.isHidden&&(0===r.length||r.some(e=>t.isHidden(e)))||t.type!==h.OPTION&&t.type!==h.STATIC||(s="",o=d.iconOnly?"":"margin-right:10px;",void 0!==t.iconClass&&""!==t.icon&&(s='<i style="'+o+'" class="'+l+" "+t.iconClass+'"></i>'),i=void 0!==t.buttonClasses?t.buttonClasses.join(" "):"",n=void 0!==t.classes?t.classes.join(" "):"",e="",o=void 0!==t.multiTitle&&1<r.length?t.multiTitle||"":t.title||"",e=d.iconOnly?s:s+o,s=("function"==typeof t.isDisabled?r.filter(e=>!t.isDisabled(e)):r).length,d.iconOnly?t.type!==h.STATIC&&1<r.length&&(o+=" ("+s+")"):o="",a=$.parseHTML('<button class="'+i+" "+n+'" data-original-title="'+o+'" >'+e+"</button>"),void 0!==t.id&&$(a).attr("id",t.id),(e=b.isDisabled(t,r))?($(a).addClass("disabled"),$(a).attr("disabled","disabled"),$(a).css("cursor","not-allowed"),$(a).css("opacity",d.disabledOpacity),$(a).removeAttr("title","")):!d.iconOnly&&t.type!==h.STATIC&&1<r.length&&$(a).append(" ("+s+")"),!e&&d.iconOnly&&""!==o&&$(a).attr("data-toggle","tooltip"),t.type===h.STATIC?$(a).click(function(){t.action(),d.deselectAfterAction?y.dt.rows().deselect():y.update()}):t.type===h.OPTION&&(void 0!==t.confirmation?$(a).click(function(){v(t,r)}):$(a).click(function(){var e=r.filter(e=>void 0===t.isDisabled||!t.isDisabled(e));t.action(e,$(a)),d.deselectAfterAction?y.dt.rows().deselect():y.update()})),f.append(a))}),p.push(f),$.each(e,function(e,t){$(d.containerSelector).addClass(t)}),$.each(p,function(e,t){0<t.children().length&&$(d.containerSelector).append(t)})}(n,o,s,t,i))}function p(e){$("#"+e+".dropdown-menu").remove()}function v(t,e,i){var n=e.filter(e=>void 0===t.isDisabled||!t.isDisabled(e)),e=t.confirmation(n);e.callback=function(e){e&&(t.action(n,i),u.deselectAfterAction?y.dt.rows().deselect():y.update())},u.showConfirmationMethod(e)}function s(e){return e&&"object"==typeof e&&!Array.isArray(e)}return y.init(u),y});