!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(d){"use strict";var a;d.support.htmlMenuitem="HTMLMenuItemElement"in window,d.support.htmlCommand="HTMLCommandElement"in window,d.support.eventSelectstart="onselectstart"in document.documentElement,d.ui&&d.widget||(d.cleanData=(a=d.cleanData,function(e){for(var t,n,o=0;null!=e[o];o++){n=e[o];try{(t=d._data(n,"events"))&&t.remove&&d(n).triggerHandler("remove")}catch(e){}}a(e)}));var i=null,m=!1,p=d(window),f=0,h={},g={},x={},v={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,reposition:!0,hideOnSecondTrigger:!1,selectableSubMenu:!1,classNames:{hover:"context-menu-hover",disabled:"context-menu-disabled",visible:"context-menu-visible",notSelectable:"context-menu-not-selectable",icon:"context-menu-icon",iconEdit:"context-menu-icon-edit",iconCut:"context-menu-icon-cut",iconCopy:"context-menu-icon-copy",iconPaste:"context-menu-icon-paste",iconDelete:"context-menu-icon-delete",iconAdd:"context-menu-icon-add",iconQuit:"context-menu-icon-quit",iconLoadingClass:"context-menu-icon-loading"},determinePosition:function(e){var t;d.ui&&d.ui.position?e.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none"):((t=this.offset()).top+=this.outerHeight(),t.left+=this.outerWidth()/2-e.outerWidth()/2,e.css(t))},position:function(e,t,n){var o,a,s;t||n?(o="maintain"===t&&"maintain"===n?e.$menu.position():{top:n-(s=e.$menu.offsetParent().offset()).top,left:t-s.left},a=p.scrollTop()+p.height(),n=p.scrollLeft()+p.width(),t=e.$menu.outerHeight(),s=e.$menu.outerWidth(),o.top+t>a&&(o.top-=t),o.top<0&&(o.top=0),o.left+s>n&&(o.left-=s),o.left<0&&(o.left=0),e.$menu.css(o)):e.determinePosition.call(this,e.$menu)},positionSubmenu:function(e){var t;void 0!==e&&(d.ui&&d.ui.position?e.css("display","block").position({my:"left top-5",at:"right top",of:this,collision:"flipfit fit"}).css("display",""):(t={top:-9,left:this.outerWidth()-5},e.css(t)))},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{preShow:d.noop,show:d.noop,hide:d.noop,activated:d.noop},callback:null,items:{}},s={timer:null,pageX:null,pageY:null},b={abortevent:function(e){e.preventDefault(),e.stopImmediatePropagation()},contextmenu:function(e){var t=d(this);if(!1!==e.data.events.preShow(t,e)&&("right"===e.data.trigger&&(e.preventDefault(),e.stopImmediatePropagation()),!("right"!==e.data.trigger&&"demand"!==e.data.trigger&&e.originalEvent||!(void 0===e.mouseButton||!e.data||"left"===e.data.trigger&&0===e.mouseButton||"right"===e.data.trigger&&2===e.mouseButton)||t.hasClass("context-menu-active")||t.hasClass("context-menu-disabled")))){if(i=t,e.data.build){var n=e.data.build(i,e);if(!1===n)return;if(e.data=d.extend(!0,{},v,e.data,n||{}),!e.data.items||d.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log).call(console,"No items specified to show in contextMenu"),new Error("No Items specified");e.data.$trigger=i,$.create(e.data)}$.show.call(t,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),d(this).trigger(d.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var t=d(this);i&&i.length&&!i.is(t)&&i.data("contextMenu").$menu.trigger("contextmenu:hide"),2===e.button&&(i=t.data("contextMenuActive",!0))},mouseup:function(e){var t=d(this);t.data("contextMenuActive")&&i&&i.length&&i.is(t)&&!t.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),(i=t).trigger(d.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),t.removeData("contextMenuActive")},mouseenter:function(e){var t=d(this),n=d(e.relatedTarget),o=d(document);n.is(".context-menu-list")||n.closest(".context-menu-list").length||i&&i.length||(s.pageX=e.pageX,s.pageY=e.pageY,s.data=e.data,o.on("mousemove.contextMenuShow",b.mousemove),s.timer=setTimeout(function(){s.timer=null,o.off("mousemove.contextMenuShow"),(i=t).trigger(d.Event("contextmenu",{data:s.data,pageX:s.pageX,pageY:s.pageY}))},e.data.delay))},mousemove:function(e){s.pageX=e.pageX,s.pageY=e.pageY},mouseleave:function(e){var t=d(e.relatedTarget);if(!t.is(".context-menu-list")&&!t.closest(".context-menu-list").length){try{clearTimeout(s.timer)}catch(e){}s.timer=null}},layerClick:function(o){var a,s,i=d(this).data("contextMenuRoot"),c=o.button,l=o.pageX,r=o.pageY,u=void 0===l;o.preventDefault(),o.stopImmediatePropagation(),o.stopPropagation(),setTimeout(function(){if(u)null!=i&&null!==i.$menu&&void 0!==i.$menu&&i.$menu.trigger("contextmenu:hide");else{var e,t,n="left"===i.trigger&&0===c||"right"===i.trigger&&2===c;if(document.elementFromPoint&&i.$layer&&(i.$layer.hide(),null!==(a=document.elementFromPoint(l-p.scrollLeft(),r-p.scrollTop()))&&a.isContentEditable&&(e=document.createRange(),t=window.getSelection(),e.selectNode(a),e.collapse(!0),t.removeAllRanges(),t.addRange(e)),d(a).trigger(o),i.$layer.show(),d(a).focus()),i.hideOnSecondTrigger&&n&&null!==i.$menu&&void 0!==i.$menu)i.$menu.trigger("contextmenu:hide");else{if(i.reposition&&n)if(document.elementFromPoint){if(i.$trigger.is(a))return void i.position.call(i.$trigger,i,l,r)}else if(s=i.$trigger.offset(),e=d(window),s.top+=e.scrollTop(),s.top<=o.pageY&&(s.left+=e.scrollLeft(),s.left<=o.pageX&&(s.bottom=s.top+i.$trigger.outerHeight(),s.bottom>=o.pageY&&(s.right=s.left+i.$trigger.outerWidth(),s.right>=o.pageX))))return void i.position.call(i.$trigger,i,l,r);a&&n&&i.$trigger.one("contextmenu:hidden",function(){d(a).contextMenu({x:l,y:r,button:c})}),null!=i&&null!==i.$menu&&void 0!==i.$menu&&i.$menu.trigger("contextmenu:hide")}}},50)},keyStop:function(e,t){t.isInput||e.preventDefault(),e.stopPropagation()},key:function(e){var t={};i&&(t=i.data("contextMenu")||{}),void 0===t.zIndex&&(t.zIndex=0);var n=0,o=function(e){""!==e.style.zIndex?n=e.style.zIndex:null!==e.offsetParent&&void 0!==e.offsetParent?o(e.offsetParent):null!==e.parentElement&&void 0!==e.parentElement&&o(e.parentElement)};if(o(e.target),!(t.$menu&&parseInt(n,10)>parseInt(t.$menu.css("zIndex"),10))){switch(e.keyCode){case 9:case 38:if(b.keyStop(e,t),t.isInput){if(9===e.keyCode&&e.shiftKey)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));if(38===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault()}else if(9!==e.keyCode||e.shiftKey)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));break;case 40:if(b.keyStop(e,t),!t.isInput)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(9===e.keyCode)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(40===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault();break;case 37:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;if(t.$selected.parent().hasClass("context-menu-root"))break;var a=t.$selected.parent().parent();return t.$selected.trigger("contextmenu:blur"),void(t.$selected=a);case 39:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;var s=t.$selected.data("contextMenu")||{};if(s.$menu&&t.$selected.hasClass("context-menu-submenu"))return t.$selected=null,s.$selected=null,void s.$menu.trigger("nextcommand");break;case 35:case 36:return t.$selected&&t.$selected.find("input, textarea, select").length?void 0:((t.$selected&&t.$selected.parent()||t.$menu).children(":not(."+t.classNames.disabled+", ."+t.classNames.notSelectable+")")[36===e.keyCode?"first":"last"]().trigger("contextmenu:focus"),void e.preventDefault());case 13:if(b.keyStop(e,t),t.isInput){if(t.$selected&&!t.$selected.is("textarea, select"))return void e.preventDefault();break}return void(void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger("mouseup"));case 32:case 33:case 34:return void b.keyStop(e,t);case 27:return b.keyStop(e,t),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("contextmenu:hide"));default:s=String.fromCharCode(e.keyCode).toUpperCase();if(t.accesskeys&&t.accesskeys[s])return void t.accesskeys[s].$node.trigger(t.accesskeys[s].$menu?"contextmenu:focus":"mouseup")}e.stopPropagation(),void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger(e)}},prevItem:function(e){e.stopPropagation();var t,n=d(this).data("contextMenu")||{},o=d(this).data("contextMenuRoot")||{};n.$selected&&(t=n.$selected,(n=n.$selected.parent().data("contextMenu")||{}).$selected=t);for(var a=n.$menu.children(),s=n.$selected&&n.$selected.prev().length?n.$selected.prev():a.last(),i=s;s.hasClass(o.classNames.disabled)||s.hasClass(o.classNames.notSelectable)||s.is(":hidden");)if((s=s.prev().length?s.prev():a.last()).is(i))return;n.$selected&&b.itemMouseleave.call(n.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);e=s.find("input, textarea, select");e.length&&e.focus()},nextItem:function(e){e.stopPropagation();var t,n=d(this).data("contextMenu")||{},o=d(this).data("contextMenuRoot")||{};n.$selected&&(t=n.$selected,(n=n.$selected.parent().data("contextMenu")||{}).$selected=t);for(var a=n.$menu.children(),s=n.$selected&&n.$selected.next().length?n.$selected.next():a.first(),i=s;s.hasClass(o.classNames.disabled)||s.hasClass(o.classNames.notSelectable)||s.is(":hidden");)if((s=s.next().length?s.next():a.first()).is(i))return;n.$selected&&b.itemMouseleave.call(n.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);e=s.find("input, textarea, select");e.length&&e.focus()},focusInput:function(){var e=d(this).closest(".context-menu-item"),t=e.data(),n=t.contextMenu,t=t.contextMenuRoot;t.$selected=n.$selected=e,t.isInput=n.isInput=!0},blurInput:function(){var e=d(this).closest(".context-menu-item").data(),t=e.contextMenu;e.contextMenuRoot.isInput=t.isInput=!1},menuMouseenter:function(){d(this).data().contextMenuRoot.hovering=!0},menuMouseleave:function(e){var t=d(this).data().contextMenuRoot;t.$layer&&t.$layer.is(e.relatedTarget)&&(t.hovering=!1)},itemMouseenter:function(e){var t=d(this),n=t.data(),o=n.contextMenu,n=n.contextMenuRoot;n.hovering=!0,e&&n.$layer&&n.$layer.is(e.relatedTarget)&&(e.preventDefault(),e.stopImmediatePropagation()),(o.$menu?o:n).$menu.children("."+n.classNames.hover).trigger("contextmenu:blur").children(".hover").trigger("contextmenu:blur"),t.hasClass(n.classNames.disabled)||t.hasClass(n.classNames.notSelectable)?o.$selected=null:t.trigger("contextmenu:focus")},itemMouseleave:function(e){var t=d(this),n=t.data(),o=n.contextMenu,n=n.contextMenuRoot;if(n!==o&&n.$layer&&n.$layer.is(e.relatedTarget))return void 0!==n.$selected&&null!==n.$selected&&n.$selected.trigger("contextmenu:blur"),e.preventDefault(),e.stopImmediatePropagation(),void(n.$selected=o.$selected=o.$node);o&&o.$menu&&o.$menu.hasClass("context-menu-visible")||t.trigger("contextmenu:blur")},itemClick:function(e){var t,n=d(this),o=n.data(),a=o.contextMenu,s=o.contextMenuRoot,o=o.contextMenuKey;if(!(!a.items[o]||n.is("."+s.classNames.disabled+", .context-menu-separator, ."+s.classNames.notSelectable)||n.is(".context-menu-submenu")&&!1===s.selectableSubMenu)){if(e.preventDefault(),e.stopImmediatePropagation(),d.isFunction(a.callbacks[o])&&Object.prototype.hasOwnProperty.call(a.callbacks,o))t=a.callbacks[o];else{if(!d.isFunction(s.callback))return;t=s.callback}!1!==t.call(s.$trigger,o,s,e)?s.$menu.trigger("contextmenu:hide"):s.$menu.parent().length&&$.update.call(s.$trigger,s)}},inputClick:function(e){e.stopImmediatePropagation()},hideMenu:function(e,t){var n=d(this).data("contextMenuRoot");$.hide.call(n.$trigger,n,t&&t.force)},focusItem:function(e){e.stopPropagation();var t=d(this),n=t.data(),e=n.contextMenu,n=n.contextMenuRoot;t.hasClass(n.classNames.disabled)||t.hasClass(n.classNames.notSelectable)||(t.addClass([n.classNames.hover,n.classNames.visible].join(" ")).parent().find(".context-menu-item").not(t).removeClass(n.classNames.visible).filter("."+n.classNames.hover).trigger("contextmenu:blur"),e.$selected=n.$selected=t,e&&e.$node&&e.$node.hasClass("context-menu-submenu")&&e.$node.addClass(n.classNames.hover),e.$node&&n.positionSubmenu.call(e.$node,e.$menu))},blurItem:function(e){e.stopPropagation();var t=d(this),n=t.data(),e=n.contextMenu,n=n.contextMenuRoot;e.autoHide&&t.removeClass(n.classNames.visible),t.removeClass(n.classNames.hover),e.$selected=null}},$={show:function(n,e,t){var o=d(this),a={};d("#context-menu-layer").trigger("mousedown"),n.$trigger=o,!1!==n.events.show.call(o,n)&&!1!==$.update.call(o,n)?(n.position.call(o,n,e,t),n.zIndex&&(t=n.zIndex,"function"==typeof n.zIndex&&(t=n.zIndex.call(o,n)),a.zIndex=function(e){for(var t=0,n=e;t=Math.max(t,parseInt(n.css("z-index"),10)||0),(n=n.parent())&&n.length&&!(-1<"html body".indexOf(n.prop("nodeName").toLowerCase())););return t}(o)+t),$.layer.call(n.$menu,n,a.zIndex),n.$menu.find("ul").css("zIndex",a.zIndex+1),n.$menu.css(a)[n.animation.show](n.animation.duration,function(){o.trigger("contextmenu:visible"),$.activated(n),n.events.activated(n)}),o.data("contextMenu",n).addClass("context-menu-active"),d(document).off("keydown.contextMenu").on("keydown.contextMenu",b.key),n.autoHide&&d(document).on("mousemove.contextMenuAutoHide",function(e){var t=n.$menu.offset();t.left=t.left-15,t.right=t.left+n.$menu.outerWidth()+15,t.top=t.top-15,t.bottom=t.top+n.$menu.outerHeight()+15,!n.$layer||n.hovering||e.pageX>=t.left&&e.pageX<=t.right&&e.pageY>=t.top&&e.pageY<=t.bottom||setTimeout(function(){n.hovering||null===n.$menu||void 0===n.$menu||n.$menu.trigger("contextmenu:hide")},50)})):i=null},hide:function(t,e){var n,o=d(this);if(t=t||(o.data("contextMenu")||{}),e||!t.events||!1!==t.events.hide.call(o,t)){if(o.removeData("contextMenu").removeClass("context-menu-active"),t.$layer){setTimeout((n=t.$layer,function(){n.remove()}),10);try{delete t.$layer}catch(e){t.$layer=null}}i=null,t.$menu.find("."+t.classNames.hover).trigger("contextmenu:blur"),t.$selected=null,t.$menu.find("."+t.classNames.visible).removeClass(t.classNames.visible),d(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),t.$menu&&t.$menu[t.animation.hide](t.animation.duration,function(){t.build&&(t.$menu.remove(),d.each(t,function(e){switch(e){case"ns":case"selector":case"build":case"trigger":return!0;default:t[e]=void 0;try{delete t[e]}catch(e){}return!0}})),setTimeout(function(){o.trigger("contextmenu:hidden")},10)})}},create:function(l,r){function u(e){var t=d("");if(e._accesskey)e._beforeAccesskey&&t.append(document.createTextNode(e._beforeAccesskey)),d("").addClass("context-menu-accesskey").text(e._accesskey).appendTo(t),e._afterAccesskey&&t.append(document.createTextNode(e._afterAccesskey));else if(e.isHtmlName){if(void 0!==e.accesskey)throw new Error("accesskeys are not compatible with HTML names and cannot be used together in the same item");t.html(e.name)}else t.text(e.name);return t}void 0===r&&(r=l),l.$menu=d('
').addClass(l.className||"").data({contextMenu:l,contextMenuRoot:r}),l.dataAttr&&d.each(l.dataAttr,function(e,t){l.$menu.attr("data-"+l.key,t)}),d.each(["callbacks","commands","inputs"],function(e,t){l[t]={},r[t]||(r[t]={})}),r.accesskeys||(r.accesskeys={}),d.each(l.items,function(n,o){var e=d('').addClass(o.className||""),t=null,a=null;if(e.on("click",d.noop),"string"!=typeof o&&"cm_separator"!==o.type||(o={type:"cm_seperator"}),o.$node=e.data({contextMenu:l,contextMenuRoot:r,contextMenuKey:n}),void 0!==o.accesskey)for(var s=function(e){for(var t,n=e.split(/\s+/),o=[],a=0;t=n[a];a++)t=t.charAt(0).toUpperCase(),o.push(t);return o}(o.accesskey),i=0;c=s[i];i++)if(!r.accesskeys[c]){var c=(r.accesskeys[c]=o).name.match(new RegExp("^(.*?)("+c+")(.*)$","i"));c&&(o._beforeAccesskey=c[1],o._accesskey=c[2],o._afterAccesskey=c[3]);break}if(o.type&&x[o.type])x[o.type].call(e,o,l,r),d.each([l,r],function(e,t){t.commands[n]=o,!d.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==l.type||(t.callbacks[n]=o.callback)});else{switch("cm_seperator"===o.type?e.addClass("context-menu-separator "+r.classNames.notSelectable):"html"===o.type?e.addClass("context-menu-html "+r.classNames.notSelectable):"sub"!==o.type&&o.type?(t=d("").appendTo(e),u(o).appendTo(t),e.addClass("context-menu-input"),l.hasTypes=!0,d.each([l,r],function(e,t){t.commands[n]=o,t.inputs[n]=o})):o.items&&(o.type="sub"),o.type){case"cm_seperator":break;case"text":a=d('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t);break;case"textarea":a=d('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t),o.height&&a.height(o.height);break;case"checkbox":a=d('').attr("name","context-menu-input-"+n).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"radio":a=d('').attr("name","context-menu-input-"+o.radio).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"select":a=d('').attr("name","context-menu-input-"+n).appendTo(t),o.options&&(d.each(o.options,function(e,t){d("").val(e).text(t).appendTo(a)}),a.val(o.selected));break;case"sub":u(o).appendTo(e),o.appendTo=o.$node,e.data("contextMenu",o).addClass("context-menu-submenu"),o.callback=null,"function"==typeof o.items.then?$.processPromises(o,r,o.items):$.create(o,r);break;case"html":d(o.html).appendTo(e);break;default:d.each([l,r],function(e,t){t.commands[n]=o,!d.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==l.type||(t.callbacks[n]=o.callback)}),u(o).appendTo(e)}o.type&&"sub"!==o.type&&"html"!==o.type&&"cm_seperator"!==o.type&&(a.on("focus",b.focusInput).on("blur",b.blurInput),o.events&&a.on(o.events,l)),o.icon&&(d.isFunction(o.icon)?o._icon=o.icon.call(this,this,e,n,o):"string"!=typeof o.icon||"fab "!==o.icon.substring(0,4)&&"fas "!==o.icon.substring(0,4)&&"fad "!==o.icon.substring(0,4)&&"far "!==o.icon.substring(0,4)&&"fal "!==o.icon.substring(0,4)?"string"==typeof o.icon&&"fa-"===o.icon.substring(0,3)?o._icon=r.classNames.icon+" "+r.classNames.icon+"--fa fa "+o.icon:o._icon=r.classNames.icon+" "+r.classNames.icon+"-"+o.icon:(e.addClass(r.classNames.icon+" "+r.classNames.icon+"--fa5"),o._icon=d('')),"string"==typeof o._icon?e.addClass(o._icon):e.prepend(o._icon))}o.$input=a,o.$label=t,e.appendTo(l.$menu),!l.hasTypes&&d.support.eventSelectstart&&e.on("selectstart.disableTextSelect",b.abortevent)}),l.$node||l.$menu.css("display","none").addClass("context-menu-root"),l.$menu.appendTo(l.appendTo||document.body)},resize:function(e,t){var n;e.css({position:"absolute",display:"block"}),e.data("width",(n=e.get(0)).getBoundingClientRect?Math.ceil(n.getBoundingClientRect().width):e.outerWidth()+1),e.css({position:"static",minWidth:"0px",maxWidth:"100000px"}),e.find("> li > ul").each(function(){$.resize(d(this),!0)}),t||e.find("ul").addBack().css({position:"",display:"",minWidth:"",maxWidth:""}).outerWidth(function(){return d(this).data("width")})},update:function(s,i){var c=this;void 0===i&&(i=s,$.resize(s.$menu));var l=!1;return s.$menu.children().each(function(){var e=d(this),t=e.data("contextMenuKey"),n=s.items[t],o=d.isFunction(n.disabled)&&n.disabled.call(c,t,i)||!0===n.disabled,a=d.isFunction(n.visible)?n.visible.call(c,t,i):void 0===n.visible||!0===n.visible;if(a&&(l=!0),e[a?"show":"hide"](),e[o?"addClass":"removeClass"](i.classNames.disabled),d.isFunction(n.icon)&&(e.removeClass(n._icon),"string"==typeof(t=n.icon.call(this,c,e,t,n))?e.addClass(t):e.prepend(t)),n.type)switch(e.find("input, select, textarea").prop("disabled",o),n.type){case"text":case"textarea":n.$input.val(n.value||"");break;case"checkbox":case"radio":n.$input.val(n.value||"").prop("checked",!!n.selected);break;case"select":n.$input.val((0===n.selected?"0":n.selected)||"")}n.$menu&&$.update.call(c,n,i)&&(l=!0)}),l},layer:function(e,t){e=e.$layer=d('').css({height:p.height(),width:p.width(),display:"block",position:"fixed","z-index":t-1,top:0,left:0,opacity:0,filter:"alpha(opacity=0)","background-color":"#000"}).data("contextMenuRoot",e).appendTo(document.body).on("contextmenu",b.abortevent).on("mousedown",b.layerClick);return void 0===document.body.style.maxWidth&&e.css({position:"absolute",height:d(document).height()}),e},processPromises:function(e,t,n){function o(e,t,n){void 0===n?(n={error:{name:"No items and no error item",icon:"context-menu-icon context-menu-icon-quit"}},window.console&&(console.error||console.log).call(console,'When you reject a promise, provide an "items" object, equal to normal sub-menu items')):"string"==typeof n&&(n={error:{name:n}}),a(e,t,n)}function a(e,t,n){void 0!==t.$menu&&t.$menu.is(":visible")&&(e.$node.removeClass(t.classNames.iconLoadingClass),e.items=n,$.create(e,t,!0),$.update(e,t),t.positionSubmenu.call(e.$node,e.$menu))}e.$node.addClass(t.classNames.iconLoadingClass),n.then(function(e,t,n){void 0===n&&o(void 0),a(e,t,n)}.bind(this,e,t),o.bind(this,e,t))},activated:function(e){var t=e.$menu,n=t.offset(),o=d(window).height(),a=d(window).scrollTop(),e=t.height();o