PageSourceSearch

https://www.dialup.max7.org/bundles/js/max7?v=fqSk36suaFw6xnnaa5Y9In4snj1sj3QhoQqZNxFV5ac1

js max7.org collected 2026-09-26 00:26:29 UTC 407,279 bytes, 3 lines download raw bytes

1function createObjectListRenderers(n){return max7app.services.objectListLayoutTypeManager?max7app.services.objectListLayoutTypeManager.createRenderers(n):(createObjectListRenderers._faultReported||(createObjectListRenderers._faultReported=!0,max7app.logJavascriptFault("No max7app.services.objectListLayoutTypeManager: the bandwidth mode script never ran, so no object list on this page can be rendered.")),null)}var __extends,DownloadDialogManager,EventDispatcher,MyCommunitiesListManager,CommunityApi,StatsApi,DownloadDialogManagerExtensionVisibility,TosAgreementDownloadDialogManagerExtension,max7validator,max7baseValidator,max7baseSingleElementValidator,max7customValidator,max7requiredValueValidator,max7minLengthValidator,max7regexValidator,max7emailValidator,max7validatorUtility,NotyObject,windowAlert;class MediaQueryManager{constructor(n){this.sizes=n;$.each(n,function(n,t){t.matcher=new MediaQuerySizeMatcher(t.code,t.width)})}matchesSize(n){var t=this.sizes.filter(function(t){return t.code===n})[0];if(!t)throw new`size ${n} not found`;return t.matcher.matches()}}class MediaQuerySizeMatcher{constructor(n,t){var i=this;i.code=n;i.min_width=t;i.matcher=window.matchMedia(`(min-width: ${t}px)`);i.crossSizeThreshold(i.matcher);i.matcher.addListener(i.crossSizeThreshold.bind(i))}matches(){return this.matcher.matches}crossSizeThreshold(n){var t=this;if(n.matches){const n=new CustomEvent(`mediaQueryEntered-${t.code}`);document.dispatchEvent(n)}else{const n=new CustomEvent(`mediaQueryExited-${t.code}`);document.dispatchEvent(n)}}}jQuery(function(n){n("body").css("display","block")}),function(n){n.widget("sylightsUI.switchButton",{options:{checked:undefined,show_labels:!0,labels_placement:"both",on_label:"ON",off_label:"OFF",width:25,height:11,button_width:12,clear:!0,clear_after:null,on_callback:undefined,off_callback:undefined},_create:function(){this.options.checked===undefined&&(this.options.checked=this.element.prop("checked"));this._initLayout();this._initEvents()},_initLayout:function(){this.element.hide();this.off_label=n("<span>").addClass("switch-button-label");this.on_label=n("<span>").addClass("switch-button-label");this.button_bg=n("<div>").addClass("switch-button-background");this.button=n("<div>").addClass("switch-button-button");this.off_label.insertAfter(this.element);this.button_bg.insertAfter(this.off_label);this.on_label.insertAfter(this.button_bg);this.button_bg.append(this.button);this.options.clear&&(this.options.clear_after==null&&(this.options.clear_after=this.on_label),n("<div>").css({clear:"left"}).insertAfter(this.options.clear_after));this._refresh();this.options.checked=!this.options.checked;this._toggleSwitch(!0)},_refresh:function(){this.options.show_labels?(this.off_label.show(),this.on_label.show()):(this.off_label.hide(),this.on_label.hide());switch(this.options.labels_placement){case"both":(this.button_bg.prev()!==this.off_label||this.button_bg.next()!==this.on_label)&&(this.off_label.detach(),this.on_label.detach(),this.off_label.insertBefore(this.button_bg),this.on_label.insertAfter(this.button_bg),this.on_label.addClass(this.options.checked?"on":"off").removeClass(this.options.checked?"off":"on"),this.off_label.addClass(this.options.checked?"off":"on").removeClass(this.options.checked?"on":"off"));break;case"left":(this.button_bg.prev()!==this.on_label||this.on_label.prev()!==this.off_label)&&(this.off_label.detach(),this.on_label.detach(),this.off_label.insertBefore(this.button_bg),this.on_label.insertBefore(this.button_bg),this.on_label.addClass("on").removeClass("off"),this.off_label.addClass("off").removeClass("on"));break;case"right":(this.button_bg.next()!==this.off_label||this.off_label.next()!==this.on_label)&&(this.off_label.detach(),this.on_label.detach(),this.off_label.insertAfter(this.button_bg),this.on_label.insertAfter(this.off_label),this.on_label.addClass("on").removeClass("off"),this.off_label.addClass("off").removeClass("on"))}this.on_label.html(this.options.on_label);this.off_label.html(this.options.off_label);this.button_bg.width(this.options.width);this.button_bg.height(this.options.height);this.button.width(this.options.button_width);this.button.height(this.options.height)},_initEvents:function(){var n=this;this.button_bg.click(function(t){return t.preventDefault(),t.stopPropagation(),n._toggleSwitch(!1),!1});this.button.click(function(t){return t.preventDefault(),t.stopPropagation(),n._toggleSwitch(!1),!1});this.on_label.click(function(){return n.options.checked&&n.options.labels_placement==="both"?!1:(n._toggleSwitch(!1),!1)});this.off_label.click(function(){return!n.options.checked&&n.options.labels_placement==="both"?!1:(n._toggleSwitch(!1),!1)})},_setOption:function(n,t){if(n==="checked"){this._setChecked(t);return}this.options[n]=t;this._refresh()},_setChecked:function(n){n!==this.options.checked&&(this.options.checked=!n,this._toggleSwitch(!1))},_toggleSwitch:function(n){var t,i;(n||this.element.attr("readonly")!="readonly"&&!this.element.prop("disabled"))&&(this.options.checked=!this.options.checked,t="",this.options.checked?(this.element.prop("checked",!0),this.element.change(),i=this.options.width-this.options.button_width,t="+="+i,this.options.labels_placement=="both"?(this.off_label.removeClass("on").addClass("off"),this.on_label.removeClass("off").addClass("on")):(this.off_label.hide(),this.on_label.show()),this.button_bg.addClass("checked"),typeof this.options.on_callback=="function"&&this.options.on_callback.call(this)):(this.element.prop("checked",!1),this.element.change(),t="-1px",this.options.labels_placement=="both"?(this.off_label.removeClass("off").addClass("on"),this.on_label.removeClass("on").addClass("off")):(this.off_label.show(),this.on_label.hide()),this.button_bg.removeClass("checked"),typeof this.options.off_callback=="function"&&this.options.off_callback.call(this)),this.button.animate({left:t},250,"easeInOutCubic"))}})}(jQuery),function(n){n.fn.autogrow=function(t){return this.filter("textarea").each(function(){var e=this,i=n(e),o=t&&t.minHeight?t.minHeight:i.height(),s=t&&t.maxHeight?t.maxHeight:null,h=i.hasClass("autogrow-short")?0:parseInt(i.css("lineHeight"))||0,u=n.extend({preGrowCallback:null,postGrowCallback:null},t),f=n("<div><\/div>").css({position:"absolute",top:-1e4,left:-1e4,width:i.width(),fontSize:i.css("fontSize"),fontFamily:i.css("fontFamily"),fontWeight:i.css("fontWeight"),lineHeight:i.css("lineHeight"),resize:"none","word-wrap":"break-word"}).appendTo(document.body),r=function(n){var c=function(n,t){for(var i=0,r="";i<t;i++)r+=n;return r},r=e.value.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n$/,"<br/>&nbsp;").replace(/\n/g,"<br/>").replace(/ {2,}/g,function(n){return c("&nbsp;",n.length-1)+" "}),t;(n&&n.data&&n.data.event==="keydown"&&n.keyCode===13&&(r+="<br />"),i.width()<=0)||(f.css("width",i.width()),f.html(r+(h===0?"...":"")),t=Math.max(f.height()+h,o),s!==null&&(t=Math.min(t,s)),u.preGrowCallback!==null&&(t=u.preGrowCallback(i,f,t,o)),i.height(t),i.css("min-height",t),u.postGrowCallback!==null&&u.postGrowCallback(i))};i.change(r).keyup(r).keydown({event:"keydown"},r);n(window).resize(r);r()})}}(jQuery);var RESOURCELISTOVERFLOW_WRAP="wrap",RESOURCELISTOVERFLOW_SCROLL="scroll",RESOURCETYPE_RESOURCE=1,RESOURCETYPE_LIBRARY=3,CATEGORYGROUP_RESOURCETYPE=1,CATEGORYGROUP_AUDIENCE=2,CATEGORYGROUP_PURPOSE=3,CATEGORYGROUP_TOPIC=5,SUBSCRIPTIONTYPE_MAX7NEWS=2,SUBSCRIPTIONTYPE_LIBRARYCONTENT=3,SUBSCRIPTIONTYPE_CHANNELNEWS=4,SUBSCRIPTIONTYPE_MAX7CONTENT=5,SUBSCRIPTIONACTIVITY_SUBSCRIBEDDURINGDOWNLOAD=1,SUBSCRIPTIONACTIVITY_SUBSCRIBEDTOLIBRARYFROMLIBRARYPAGE=8,SUBSCRIPTIONACTIVITY_SUBSCRIBEDFROMUSERPAGE=15,SUBSCRIPTIONACTIVITY_SUBSCRIBEDFROMGENERALNEWSLETTERSIDEBAR=18;class EventManager{constructor(){this.handlers=[]}subscribe(n){this.handlers.push(n)}unsubscribe(n){this.handlers=this.handlers.filter(function(t){if(t!==n)return t})}fire(n,t){var i=t||window;
1this.handlers.forEach(function(t){t.call(i,n)})}}$.widget("max7.translatable",{});max7app.lateInitialize=function(){max7app.hookUpGlobalJavascriptErrorReporting();try{max7app.setUpPage()}catch(n){max7app.logJavascriptFault("max7app.setUpPage() failed - dispatching max7appInitialize anyway",n)}var t=new CustomEvent("max7appInitialize");document.dispatchEvent(t);try{max7app.startPage()}catch(n){max7app.logJavascriptFault("max7app.startPage() failed after max7appInitialize was dispatched",n)}};max7app.setUpPage=function(){max7app.services.drawerMenu=new Max7DrawerMenu($("#DrawerMenu"));this.mediaQueryManager=new MediaQueryManager([{code:"sm",width:576},{code:"md",width:768},{code:"lg",width:992},{code:"xl",width:1200},{code:"xx",width:1700}]);$(document).on("Max7ResponsiveScale",function(n){max7app.responsiveScale=n.detail.scale;$("body").get(0).style.setProperty("--responsive-scale",n.detail.scale)});const n=new ResponsiveScaleBroadcaster(600)};max7app.startPage=function(){function n(){var n=new CustomEvent("max7appReady");document.dispatchEvent(n)}this.onInitialized&&typeof this.onInitialized=="function"&&this.onInitialized();max7app.api.users.getFileDownloadPreferences({success:function(n){max7app.downloadPreferences=n}});max7app.showCookieWarningIfRequired();max7app.contentStoreUrlManager?n():document.addEventListener("max7ContentStoreReady",n,{once:!0})};max7app.hookUpGlobalJavascriptErrorReporting=function(){window.addEventListener("error",function(n){var t;if((typeof n.error=="string"?t={message:n.error,errormessage:n.error,filename:n.filename,lineno:n.lineno,colno:n.colno}:(t=n,t.stack=n.error?n.error.stack:"",t.errormessage=n.error?n.error.message:n.message),typeof t.message!="string"||t.message.indexOf("ResizeObserver loop")!==0)&&(typeof t.filename!="string"||!(t.filename.indexOf("-extension://")>-1))&&(typeof t.message!="string"||t.message.indexOf("Script error.")!==0)&&t.filename){$("#JavascriptErrorWarning").show();$("#JavascriptErrorDump").val(t.message+"\r\n"+(t.stack||"").trim());try{max7app.logJavascriptError(t.message||"",t.lineno||"",t.colno||"",t.errormessage||"",t.stack||"",t.filename||"")}catch(i){}}});$("#JavascriptErrorWarning .infoButton").on("click",function(){$("#JavascriptErrorDetails").show();$("#JavascriptErrorDump").autogrow();$("#JavascriptErrorWarning .infoButton").hide()})};max7app.initializeDarkMode=function(n){const t=n===null?max7app.getCurrentDarkMode():n;return t?$("body").addClass("dark-theme"):$("body").removeClass("dark-theme"),t};max7app.stripExtension=function(n){var t=n.lastIndexOf(".");return t>-1&&(n=n.substring(0,t)),n};max7app.getCategoryLabelClassNames=function(n){var t;switch(n.id){case 40:t=40;break;case 115:t="library";break;default:t=n.parent}return`category-label category-${t?t:n.id}`};max7app.createCategoryLabelHtml=function(n,t,i){var r=null,u;if(t){switch(i){case 0:u=max7app.displayText("LIBRARY_LABEL_EMPTY");break;case 1:u=max7app.displayText("LIBRARY_LABEL_1_RESOURCE");break;default:u=max7app.displayText({code:"LIBRARY_LABEL_X_RESOURCES",parameters:{qty:i}})}r=`<a href='${max7app.urlManager.getUrl(["search"])}?category=115' class='${max7app.getCategoryLabelClassNames({id:115})}'>${u}</a>`}else max7appdata.flatcategories.forEach(function(u){var e,f,o;if(r===null&&u.groupId===1&&$.inArray(u.id,n)>-1&&(e=max7app.getCategory(u.id),f=e.singularTitle,f.length>0)){if(o=max7app.getCategoryLabelClassNames(e),t)switch(i){case 0:f=max7app.displayText("LIBRARY_LABEL_EMPTY");break;case 1:f=max7app.displayText("LIBRARY_LABEL_1_RESOURCE");break;default:f=max7app.displayText({code:"LIBRARY_LABEL_X_RESOURCES",parameters:{qty:i}})}r=`<a href='${max7app.urlManager.getUrl(["search"])}?category=${u.id}' class='${o}'>${f}</a>`}});return r||""};max7app.convertToPlainText=function(n){var t=document.createElement("div");return t.innerHTML=n,t.textContent||t.innerText||""};max7app.truncateTextToSentences=function(n,t,i){var r=[],u;if(n===undefined||n===null||n=="")return{text:"",is_truncated:!1,mid_sentence_truncation:!1};if(!n.matchAll)return{text:n,is_truncated:!1,mid_sentence_truncation:!1};const e=1,f=2;
1return(Array.from(n.matchAll(/\.\s/gm)).forEach(n=>{n.index<i&&r.push({method:e,length:n.index+1,score:Math.abs(n.index+1-t)})}),n.length<i&&r.push({method:f,length:n.length,score:Math.abs(n.length-t)}),r.length>0)?(r.sort(function(n,t){return n.score-t.score}),u=r[0],{text:n.substring(0,u.length),is_truncated:u.method!=f,mid_sentence_truncation:!1}):{text:n.substring(0,t),is_truncated:!0,mid_sentence_truncation:!0}};max7app.showCookieWarningIfRequired=function(){var t="CookieWarningShown",i=max7app.getCookie(t)==="1",n;i||(n=max7app.destroyAndAppendDivById("CookieWarning","#BottomFixedContent"),$("<span/>",{html:max7app.displayText({code:"COOKIE_WARNING",parameters:{privacylink:"<a href='"+max7app.urlManager.getUrl(["privacy"])+"' target='blank'>"+max7app.displayText("PrivacyPolicyText")+"<\/a>",site:max7app.siteTitle}})}).appendTo(n),$("<button/>",{html:max7app.displayText("COOKIE_WARNING_BUTTON")}).on("click",i=>{i.preventDefault(),i.stopPropagation(),max7app.setCookie(t,"1",3650),n.fadeOut()}).appendTo(n),n.slideDown(400))};max7app.setCookie=function(n,t,i){var u="",r;i&&(r=new Date,r.setTime(r.getTime()+i*864e5),u="; expires="+r.toUTCString());document.cookie=n+"="+(t||"")+u+"; path=/"};max7app.setDefaultButton=function(n,t){$(n).on("keydown",function(n){var i=n.keyCode?n.keyCode:n.which?n.which:n.charCode;return Number(i)===13?($(t).click(),!1):!0})};max7app.personId=function(){return this.person!==null?parseInt(this.person.ID):null};max7app.apiDate=function(n){return n==null?"":n.getFullYear()+this.pad(n.getMonth()+1,2)+this.pad(n.getDate(),2)};max7app.htmlDate=function(n){return n==null?"":`${n.getFullYear()}-${this.pad(n.getMonth()+1,2)}-${this.pad(n.getDate(),2)}`};max7app.distanceFromOne=function(n){return n===null?null:n===0?Number.MAX_SAFE_INTEGER:n<1?1/n:n};max7app.scanFileNameForLanguage=function(n){var u=new RegExp("([(_]([^._)]+)[._)])","i"),r=n.match(u),t,i;return r===null?null:(t=null,r.length>2&&(i=r[2],t=t||max7app.getCultureByCode(i)||max7app.getCultureByEndonym(i)||max7app.getCultureByEnglishName(i)),t)};max7app.readXmlNodeContent=function(n,t,i){var r=n.getElementsByTagName(t)[0];return r?r.innerHTML:i};max7app.roleHasSecurityGrant=function(n,t){return $.grep(max7app.securityGrantMap,function(i){return i.roleid===n&&i.grantid===t}).length>0};max7app.dateYYYYMMDD=function(n){return n==null?"":n.getFullYear()+"-"+this.pad(n.getMonth()+1,2)+"-"+this.pad(n.getDate(),2)};max7app.moderationStatusTypes=[];max7app.moderatorStatusTypes=[];max7app.moderationStatusIsHandled=function(n){var t=max7app.getModerationStatusType(n);return t?t.isHandled:!1};max7app.moderationStatusIsApproved=function(n){var t=max7app.getModerationStatusType(n);return t?t.isApproved:!1};max7app.moderationStatusIsRejected=function(n){var t=max7app.getModerationStatusType(n);return t?t.isRejected:!1};max7app.moderationStatusIsUniversallyRejected=function(n){var t=max7app.getModerationStatusType(n);return t?t.isUniversallyRejected:!1};max7app.getModeratorStatusType=function(n){return max7app.moderatorStatusTypes[n]};max7app.moderatorStatusTypeIsActive=function(n){var t=max7app.getModeratorStatusType(n);return t?t.isActive:!1};max7app.displayDateAndTime=function(n){var t=new Date(n);return t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()+" "+t.getHours()+":"+max7app.pad(t.getMinutes(),2)};max7app.displayDate=function(n){var t=new Date(n);return t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()};max7app.displayNullableDate=function(n){if(n===null)return"";var t=new Date(n);return t.getDate()+"/"+(t.getMonth()+1)+"/"+t.getFullYear()};max7app.nullableApiValue=function(n){return n===null?"":n};max7app.broadcastResourceFavoriteChanged=function(n,t){const i=new CustomEvent("max7resourceFavoriteChanged",{detail:{resourceId:n,isFavorite:t}});document.dispatchEvent(i)};max7app.broadcastActivityFeedUpdated=function(){const n=new CustomEvent("max7ActivityFeedUpdated");document.dispatchEvent(n)};max7app.broadcastModerationIncidentAssigned=function(n,t){const i=new CustomEvent("max7ModerationIncidentAssigned",{detail:{incidentId:n,moderatorId:t}});document.dispatchEvent(i)};max7app.broadcastModerationCommentAdded=function(n){const t=new CustomEvent("max7ModerationCommentAdded",{detail:{incidentId:n}});document.dispatchEvent(t)};max7app.broadcastModerationIncidentsResolved=function(n,t){const i=new CustomEvent("max7ModerationIncidentsResolved",{detail:{incidentIds:n,status:t}});document.dispatchEvent(i)};max7app.getBibleReferenceQueryString=function(n,t,i){return n+(t>0?"+"+t+(i>0?"."+i:""):"")};max7app.broadcastModerationIncidentsRolledBack=function(n){const t=new CustomEvent("max7ModerationIncidentsRolledBack",{detail:{incidentIds:n}});document.dispatchEvent(t)};max7app.createTranslatableElement=function(n){var i="",r,t;return i=n.code!==undefined?max7app.displayText(n.code):n.rawtext,r=n.rawtext!==undefined?n.rawtext:n.parameters!==undefined?max7app.displayText({code:n.code,parameters:n.parameters}):i,t=$("<"+(n.elementType||"span")+" />",{html:r}),$.fn.translatable&&t.translatable({text:{code:n.code,textid:n.textid,current:i},updateUI:n.updateUI}),(n.class||"")!==""&&t.addClass(n.class),n.id&&t.attr("id",n.id),n.href&&t.attr("href",n.href),n.target&&t.attr("target",n.target),n.title&&t.attr("title",n.title),t};max7app.getBannerTemplate=function(n){return $.grep(max7appdata.bannerTemplates,function(t){return t.id===n})[0]};max7app.getBannerTemplatePickerIcon=function(n){return`/images/editmode/custompages/bannertemplates/picker/${n}.png`};max7app.getBannerTemplateSampleIcon=function(n){return`/images/editmode/custompages/bannertemplates/sample/${n}.png`};max7app.getBannerTemplateSampleIconById=function(n){return this.getBannerTemplateSampleIcon(this.getBannerTemplate(n).code)};max7app.getChannelColourSchemePickerIcon=function(n){return"/images/editmode/resources/channels/colorscheme/picker/"+n+".png"};max7app.getChannelColourSchemeSampleIcon=function(n){return"/images/editmode/resources/channels/colorscheme/sample/"+n+".png"};max7app.getCommunitySecurityLevelDetails=function(n){var t=$.grep(max7appdata.communitySecurityLevels,function(t){return t.id===n});return t.length>0?t[0]:null};max7app.createCookie=function(n,t,i){var u,r;i?(r=new Date,r.setTime(r.getTime()+i*864e5),u="; expires="+r.toGMTString()):u="";document.cookie=n+"="+t+u+"; path=/"};max7app.isValidEmail=function(n){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)};max7app.displayFolderResourceCounts=function(n,t,i){return i===null?n:t===i?n+" <span class='resourceCount'>("+i+")<\/span>":n+" <span class='resourceCount'>("+t+"/"+i+")<\/span>"};max7app.areInPlaceTranslationKeysPressed=function(n){return n.altKey&&n.shiftKey||n.ctrlKey&&n.shiftKey};max7app.displayFolderResourceCountsTooltip=function(n,t,i){if(i===null)return n;if(t===i)switch(i){case 1:return max7app.displayText({code:"FOLDER_RESOURCE_COUNTS_TOOLTIP_1/1",parameters:{title:n}});default:return max7app.displayText({code:"FOLDER_RESOURCE_COUNTS_TOOLTIP_X/X",parameters:{title:n,count:i}})}switch(i){case 1:return max7app.displayText({code:"FOLDER_RESOURCE_COUNTS_TOOLTIP_0/1",parameters:{title:n,language:max7app.getLanguageNameByCode(max7app.filterCultureCode)}});default:return max7app.displayText({code:"FOLDER_RESOURCE_COUNTS_TOOLTIP_X/Y",parameters:{title:n,totalcount:i,languagecount:t,language:max7app.getLanguageNameByCode(max7app.filterCultureCode)}})}};max7app.getCookie=function(n){return document.cookie.length>0&&(c_start=document.cookie.indexOf(n+"="),c_start!==-1)?(c_start=c_
1start+n.length+1,c_end=document.cookie.indexOf(";",c_start),c_end===-1&&(c_end=document.cookie.length),unescape(document.cookie.substring(c_start,c_end))):""};max7app.clone=function(n){var t,i,u,r;if(null===n||"object"!=typeof n)return n;if(n instanceof Date)return t=new Date,t.setTime(n.getTime()),t;if(n instanceof Array){for(t=[],i=0,u=n.length;i<u;i++)t[i]=max7app.clone(n[i]);return t}if(n instanceof Object){t={};for(r in n)n.hasOwnProperty(r)&&(t[r]=max7app.clone(n[r]));return t}throw new Error("Unable to copy obj! Its type isn't supported.");};max7app.isValidUserName=function(n){return n.length<4?!1:n.indexOf("@")>-1?!1:!0};max7app.showPopupNotification=function(n,t){typeof n=="string"&&(n={message:n,type:t?t.toLowerCase():"alert"});n.timeout=n.timeout||1e4;n.type=n.type||"alert";noty({text:n.message,layout:"topRight",type:n.type,timeout:n.timeout,animation:{open:"animated bounceInDown",close:"animated bounceOutUp"},theme:"max7"})};max7app.pollDurableFunction=function(n,t){function r(){if(Date.now()-e>f){t&&t.error&&t.error("Polling timed out after "+f/1e3+" seconds");return}max7app.apiCall({method:"uploadsessions/DurableFunctionStatus",parameters:{instanceId:n},success:function(n){i=0;n.runtimeStatus==="Completed"?t&&t.success&&t.success(n.output):n.runtimeStatus==="Failed"?t&&t.error&&t.error(n.output||"Durable function failed"):setTimeout(r,u)},error:function(n){i++;i<=o?setTimeout(r,u):t&&t.error&&t.error("Network error polling durable function: "+(n.error||n))}})}var u=t&&t.interval||3e3,f=t&&t.timeout||6e5,e=Date.now(),i=0,o=3;r()};max7app.logJavascriptError=function(n,t,i,r,u,f){max7app.apiCall({connection:"cors",method:"exceptionhandling/LogJavascriptError",data:{message:n,url:window.location.href,line:t,col:i,error:r,userAgent:navigator.userAgent,stack:u,fileName:f}})};max7app.logJavascriptFault=function(n,t){try{console.warn(n,t||"");max7app.logJavascriptError(n,"","",t&&t.message||"",t&&t.stack||"",window.location.href)}catch(i){}};max7app.hookUpGlobalJavascriptExceptionHandler=function(){window.onerror=function(n,t,i,r,u){var f=r?"<tr><td>column<\/td><td>"+r+"<\/td><\/tr>":"";return f+=u?"<tr><td>error<\/td><td>"+u+"<\/td><\/tr>":"",self.showPopupNotification("<b>"+n+"<\/b><table><tr><td>url<\/td><td>"+t+"<\/td><\/tr><tr><td>line<\/td><td>"+i+"<\/td><\/tr>"+f,"error"),max7app.apiCall({connection:"cors",method:"exceptionhandling/LogJavascriptError",data:{message:n,url:t,line:i,col:r,error:u}}),!0}};max7app.userCanModerate=function(){return this.userHasPermission(this.SECURITYGRANT_MODERATE)};max7app.userCanManageResourceFileFacsimiles=function(){return this.userHasPermission(this.SECURITYGRANT_MANAGE_RESOURCE_FILE_FACSIMILES)};max7app.userCanRequeueIndividualResourceFileFacsimiles=function(){return this.userHasPermission(this.SECURITYGRANT_REQUEUE_INDIVIDUAL_RESOURCE_FILE_FACSIMILES)};max7app.userCanTranslateWithoutClaimingAuthorship=function(){return this.userHasPermission(this.SECURITYGRANT_TRANSLATE_WITHOUT_CLAIMING_AUTHORSHIP)};max7app.userCanAdminister=function(){return this.userHasPermission(this.SECURITYGRANT_ADMINISTER)};max7app.downloadFile=function(n,t,i,r,u){var e,f;i&&i&&r&&this._updateUserDownloadPreferences(r);e=new CustomEvent("max7downloadingFile",{detail:{fileid:n}});document.dispatchEvent(e);window.location.href=max7app.getDownloadFileUrl(t,i);f={value:1,currency:"AUD"};u&&(f.content_ids=[u],f.content_type="product");fbq("track","Purchase",f);gtag("event","conversion",{send_to:"AW-626478607/9k7PCJHP79UbEI-c3aoC",value:1,currency:"AUD"})};max7app.reducePieChartData=function(n,t,i,r){var f=0;$.each(n,function(n,t){f+=t.Qty});var o=Math.floor(f*t/100),u=[],e=0;$.each(n,function(n,t){t.Qty<o&&(u.push(n),e+=t.Qty)});u.length>1&&(u.reverse().forEach(t=>{n.splice(t,1)}),new_obj={Qty:e},new_obj[i]=r,n.push(new_obj))};max7app._updateUserDownloadPreferences=function(n){if(n){var t=-1;$.each(max7app.downloadPreferences,function(i,r){r.FileType===n.filetype&&(t=i)});t===-1&&(max7app.downloadPreferences.unshift({FileType:n.filetype,Width:null,Height:null,BitRate:null}),t=0);n.width&&n.height&&(max7app.downloadPreferences[t].Width=n.width,max7app.downloadPreferences[t].Height=n.height);n.bitrate&&(max7app.downloadPreferences[t].BitRate=n.bitrate);t>0&&max7app.downloadPreferences.splice(0,0,max7app.downloadPreferences.splice(t,1)[0])}};max7app.getDownloadFileUrl=function(n,t){return"/services/resource/downloadfile.ashx?id="+n+"&explicit="+(t?"true":"false")+"&platform="+max7app.platformId+"&user="+max7app.userEntityId+"&channel="+(max7app.channelGuid?max7app.channelGuid:"")+"&language="+max7app.languageCode};max7app.userHasPermission=function(n){var t=!1;return this.person!==null&&$.each(this.person.SecurityGrants,function(i,r){r===n&&(t=!0)}),t};max7app.padZeroes=function(n,t){return(t-=n.toString().length,t>0)?new Array(t+(/\./.test(n)?2:1)).join("0")+n:n+""};max7app.splitDuration=function(n){return n===null?{hours:null,minutes:null,seconds:null}:{hours:Math.floor(n/3600),minutes:Math.floor(n/60%60),seconds:Math.floor(n%60)}};max7app.displayDuration=function(n){var t=max7app.splitDuration(n);return t.hours===0?t.minutes+":"+max7app.padZeroes(t.seconds,2):t.hours+":"+max7app.padZeroes(t.minutes,2)+":"+max7app.padZeroes(t.seconds,2)};max7app.displayBitRate=function(n,t){return n===null?"":(t=t?t:1.6,n>1048576*t)?(n/1048576).toFixed(1)+"GBps":n>1024*t?(n/1024).toFixed(1)+"MBps":n.toFixed(1)+"KBps"};max7app.scrollToElement=function(n){var u;if(n=n||{},n instanceof jQuery&&(n={element:n}),$(n.element).length!==0){n.verticalOffset=n.verticalOffset||-10;n.duration=n.duration||400;var t=$(n.element).offset().top+n.verticalOffset,i=n.scrollElement||$(window),r=i.scrollTop(),f=r+i.innerHeight();return t<r||t>f?(u=n.scrollElement||$("html,body"),u.stop(!0,!1).animate({scrollTop:t-i.innerHeight()/3},n.duration,undefined,n.complete),!1):(n.complete&&n.complete(),!0)}};max7app.getLanguageNameByID=function(n,t){if(t=t!==undefined?t:max7app.displayText("NoLanguageText"),!n)return t;var i=max7app.getCultureByID(n);return i?i.name:"(unknown)"};max7app.getLanguageCodeByID=function(n){if(!n)return null;var t=max7app.getCultureByID(n);return t?t.code:null};max7app.displayFileSize=function(n){var i,t,r;return n===null||n===undefined?"":(i=1024,n<i)?n+"b":(t=Math.log(n)/Math.log(i),t=t%1>=.9?Math.round(t):Math.floor(t),r="KMGTPE".charAt(t-1),Math.round(10*n/Math.pow(i,t))/10+r+"b")};max7app.isFunction=function(n){return n&&typeof n=="function"};max7app.refreshActivityFeed=function(){$("#ActivityFeed").activityfeed("refresh")};max7app.createRatingControl=function(n,t,i,r,u){$(n).raty({score:i!==null?i:r,starOn:"/images/resourcepage/ratings/star_lit.png",starOff:"/images/resourcepage/ratings/"+(u?"star_unlit_white.png":"star_unlit.png"),starHalf:"/images/resourcepage/ratings/"+(u?"star_half_white.png":"star_half.png"),space:!1,click:function(n){max7app.apiCall({method:"resources/rate",parameters:{userentity:max7app.userEntityId,resource:t,score:n,context:max7app.channelGuid},timeout:3e4,success:function(){},error:function(){max7app.showPopupNotification("There was an error when trying to save your rating","error")}})}})};max7app._generic_on=function(n,t,i){typeof i=="function"&&(typeof t=="string"||t instanceof String)&&(n[t]=n[t]||[]).push(i)};max7app._generic_off=function(n,t,i){var u,r;if(typeof i=="function"&&n[t]&&(u=n[t].length,u))for(r=0;r<u;r++)if(n[t][r]===i){n[t].splice(r,1);break}};max7app._generic_call=function(n,t,i){if(typeof t=="string"||t instanceof String){var r=n[t];i=[].concat(i);r&&$.each(r,function(n,t){try{t.apply(undefined,i)}catch(r){}})}};max7app.addResourceToDownloadBasket=function(n){max7app.api.downloadBasket.addResourceToCurrentUserBasket(n,{success:function(n){$(document).trigger("max7DownloadBasketUpdated",[n])}})};max7app.removeResourceFromDownloadBasket=function(n){max7app.api.downloadBasket.removeResourceFromCurrentUserBasket(n,{success:function(n){$(document).trigger("max7DownloadBasketUpdated",[n])}})};max7app.getRatingHtml=function(n){for(var i="<ul class='rating'>",t=1;t<=5;t++)i+=t<=n?"<li class='lit'><\/li>":n===t-.5?"<li class='half'><\/li>":"<li class='unlit'><\/li>";return i+"<\/ul>"};max7app.getCultureByID=function(n){var t=null;return $.each(max7appdata.cultures,function(i,r){r.id===n&&(t=r)}),t};max7app.getCultureByEndonym=function(n){var t=null;return n?($.each(max7appdata.cultures,function(i,r){r.nativename.toUpperCase()===n.toUpperCase()&&(t=r)}),t):null};max7app.getCultureByEnglishName=function(n){var t=null;return n?($.each(max7appdata.cultures,function(i,r){r.name.toUpperCase()===n.toUpperCase()&&(t=r)}),t):null};max7app.getFileTypesIconUrl=function(n){var r=this,i=[],t;return(n.forEach(function(n){var t=n.toUpperCase().trim();i.indexOf(t)===-1&&i.push(t)}),i.length===0)?"":i.length===1?max7app.getFileTypeIconUrl(i[0]):(t=[],i.forEac
1h(function(n){var i=max7app.getFileTypeIconUrl(n);t.indexOf(i)===-1&&t.push(i)}),t.length===1)?t[0]:t.length===2&&t.indexOf(r.getFileTypeIconUrl("pdf"))>-1&&t.indexOf(r.getFileTypeIconUrl("doc"))>-1?max7app.getFileTypeIconUrlByCode("document"):t[0]};max7app.getFileTypeIconUrl=function(n){var t=null,i;if(n)switch(n.toUpperCase()){case"PDF":t="pdf";break;case"DOC":case"DOCX":case"DOT":t="doc"}if(t===null)if(i=max7app.getFileTypeDetails(n),i===null)t="generic";else switch(i.fileTypeCategoryID){case 1:t="video";break;case 2:t="audio";break;case 3:t="document";break;case 4:t="image";break;case 5:t="presentation";break;case 6:t="spreadsheet";break;case 7:t="vector";break;case 8:t="text";break;case 9:t="3d";break;default:t="generic"}return max7app.getFileTypeIconUrlByCode(t)};max7app.getFileTypeIconUrlByCode=function(n){return`/images/filetypes/svg/${n}.svg`};max7app.getCurrentLanguage=function(){return this.getCultureByCode(this.languageCode)};max7app.getPersonCommunityMembership=function(n){var t=null;this._communityMembershipCache[n.person]||!0?max7app.apiCall({method:"person/GetCommunityMemberships",parameters:{person:n.person},success:function(i){max7app._communityMembershipCache[n.person]=t;n.success(i)}}):(t=this._communityMembershipCache[n.person],n.success(t))};max7app.setResourceFavorite=function(n,t){var i=t?"add":"remove";max7app.api.resources.setFavorite(n,t,{success:function(){max7app.broadcastResourceFavoriteChanged(n,t)},error:function(){max7app.showPopupNotification("There was an error when trying to "+i+" your favorite","error")}})};max7app.setLoginReturnUrl=function(n){this.services.userManager&&(this.services.userManager.loginReturnUrl=n)};max7app.buildResourceContextDetailsHtml=function(n,t,i,r,u){var l=function(n,t){var i=`<div class='${n}'>`,r;return i+=$.grep(t,function(n,t){return t<2}).join(" "),t.length>2&&(r="(+"+(t.length-2)+")",i+=`<span class='resource-tooltip-index-more'>${r}</span>`),i+"<\/div>"},o={},s=null,f,c,e,h;if($.each(n.Categories,function(t,i){var u=max7app.getCategory(i),e,r;if(u.groupId===1)s===null&&(r=u.singularTitle,r.length>0&&(e=max7app.getCategoryLabelClassNames(u),n.IsLibrary&&(r=n.LibraryResourceCount===0?"Empty Library":n.LibraryResourceCount+" resources"),s=`<a href='${max7app.urlManager.getUrl(["search"])}?category=${i}' class='${e}'>${r}</a>`));else if(r=u.title,r.length>0){var h="<a href='"+max7app.urlManager.getUrl(["search"])+"?category="+i+"'>"+r+"<\/a>",f="G"+u.groupId,c=max7app.getResourceCategoryGroup(u.groupId);f in o||(o[f]={groupdetails:c,html:[]});o[f].html.push(h)}}),f="<div class='resource-tooltip'>",max7app.services.displayedContent.resourcePreviewsInTooltips&&n.PreviewCode!==""&&(c=max7app.previewManager.renderTooltipPreviewContent(n.PreviewCode,u,n.PreviewResourceFileGuid,n.PreviewPageCount,""),c&&(f+=`<div class='previewContent'>${c}</div>`)),s!==null&&(f+=s),f+=`<div class='resource-tooltip-title'>${n.Title}</div>`,t){var y=max7app.convertToPlainText(n.Description),a=max7app.truncateTextToSentences(y,i,r),v=a.text;a.is_truncated&&(v+=`<a class="more-description" href="${max7app.urlManager.getResourceUrl(n.ResourceType,n.UniqueCode)}">more</a>`);f+=`<div class='resource-tooltip-description'>${v}</div>`}return e="",h=[],$.each(n.BibleReferences,function(n,t){var i=max7app.createBibleReferenceFromBibleReferenceData(t),r="<a href='"+max7app.urlManager.getUrl("search")+"?bibleref="+max7app.getBibleReferenceQueryString(i.bookcode,i.startChapter,i.startVerse)+"'>"+max7app.displayBibleReference(i)+"<\/a>";h.push(r)}),h.length>0&&(e+=`<tr><td class='category-title'>${max7app.displayText("ContributeBibleHeading")}</td><td>${l("resource-tooltip-biblereferences",h)}</td></tr>`),$.each(o,function(n,t){if(n!=="G1"){var i=t.html.length>1?t.groupdetails.PluralTitle:t.groupdetails.Title;e+="<tr><td class='category-title'>"+i+"<\/td><td>"+l("resource-tooltip-categories",t.html)+"<\/td><\/tr>"}}),n.OwnedByLibraryUniqueCode&&(e+=`<tr class='resource-tooltip-ownedby'><td class='category-title'>${max7app.displayText("RESOURCE_PART_OF_HEADING")}</td><td><a href='${max7app.urlManager.getUrl(["library",n.OwnedByLibraryUniqueCode,n.OwnedByLibraryFolderGuid])}'>${n.OwnedByLibraryTitle}</a></td></tr>`),e.length>
10&&(f+="<table class='resource-tooltip-indexes'>"+e+"<\/table>"),f+"<\/div>"};max7app.createResourceSocialMediaIconsPanel=function(n,t,i,r,u){var e=max7app.urlManager.getFullResourceUrl(i,r,!0),f=$("<div class='resource-share-panel'><\/div>").appendTo(n);max7app.addSocialShareButtons(f,f,t,e,u)};max7app.addSocialShareButtons=function(n,t,i,r,u){$("<div class='button facebook-share'><svg><use xlink:href='/images/resources/actions/facebook.svg#image'><\/use><\/svg><div class='label'>Facebook<\/div><\/div>").appendTo(n);$("<div class='button pinterest-share'><svg><use xlink:href='/images/resources/actions/pinterest.svg#image'><\/use><\/svg><div class='label'>PInterest<\/div><\/div>").appendTo(n);$("<div class='button whatsapp-share'><svg><use xlink:href='/images/resources/actions/whatsapp.svg#image'><\/use><\/svg><div class='label'>WhatsApp<\/div><\/div>").appendTo(n);$(`<div class='button email-share'><svg><use xlink:href='/images/resources/actions/email.svg#image'></use></svg><div class='label'>${max7app.displayText("EMAIL_TEXT")}</div></div>`).appendTo(n);$(`<div class='button getlink-share'><svg><use xlink:href='/images/resources/actions/link.svg#image'></use></svg><div class='label'>${max7app.displayText("GETLINK_TEXT")}</div></div>`).appendTo(n);u&&$("<div class='button embed-share'><svg><use xlink:href='/images/resources/actions/embed.svg#image'><\/use><\/svg><div class='label'>Embed<\/div><\/div>").appendTo(n);$(`<div class='copied-notification'>${max7app.displayText("WEBADDRESSCOPIED_CONFIRMATION")}</div>`).appendTo(t);max7app.configureSocialMediaIcons(n,t,i,r,u)};max7app.addShareResourceButtons=function(n,t,i,r,u,f){var e=max7app.urlManager.getFullResourceUrl(r,u,!0);max7app.addSocialShareButtons(n,t,i,e,f)};max7app.configureSocialMediaIcons=function(n,t,i,r,u){$(n).socialShare({title:i,description:i,counts:!1,pinterest:!0,linkedin:!1,url:r});$(n).find(".whatsapp-share").on("click",n=>{n.preventDefault(),window.open(`whatsapp://send?text=${encodeURIComponent(r)}`)});$(n).find(".messenger-share").on("click",n=>{n.preventDefault(),window.open(`http://www.facebook.com/dialog/send?app_id=${fbid}&amp;link=${encodeURIComponent(r)}&amp;redirect_uri=${encodeURIComponent(window.location.href)}`)});$(n).find(".email-share").on("click",n=>{n.preventDefault();var t=`${i} on ${max7app.siteTitle}:
2�${r}`,u=`${max7app.siteTitle} - ${i}`;window.open(`mailto:?body=${encodeURIComponent(t)}&subject=${encodeURIComponent(u)}`)});$(n).find(".embed-share").on("click",n=>{n.preventDefault(),max7app.showEmbedVideoScreen(i,u)})};max7app.showEmbedVideoScreen=function(n,t){var r=`<iframe width="560" height="315" src="https://www.max7.org/en/embed/${t}" title="Max7" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>`,u=max7app.createModalScreen("EmbedVideoScreen",{title:n,width:"md"}),i=$("<div/>",{"class":"embed-modal-screen-layout"}).appendTo(u);$("<div/>",{html:max7app.displayText("EMBED_VIDEO_INTRO")}).appendTo(i);$("<div/>",{html:r}).appendTo(i);$("<textarea/>",{html:r}).appendTo(i);max7app.showModalScreen(u)};max7app.configureResourceSocialMediaIcons=function(n,t,i,r){var u=max7app.urlManager.getFullResourceUrl(i,r,!0);$(n).socialShare({title:t,description:t,counts:!1,pinterest:!0,linkedin:!1,url:u});$(n).find(".whatsapp-share").on("click",n=>{n.preventDefault(),window.open(`whatsapp://send?text=${encodeURIComponent(u)}`)});$(n).find(".messenger-share").on("click",n=>{n.preventDefault(),window.open(`http://www.facebook.com/dialog/send?app_id=${fbid}&amp;link=${encodeURIComponent(u)}&amp;redirect_uri=${encodeURIComponent(window.location.href)}`)});$(n).find(".email-share").on("click",n=>{n.preventDefault();var i=`${t} on ${max7app.siteTitle}:
3�${u}`,r=`${max7app.siteTitle} - ${t}`;window.open(`mailto:?body=${encodeURIComponent(i)}&subject=${encodeURIComponent(r)}`)});$(n).find(".getlink-share").on("click",t=>{t.preventDefault(),max7app.copyTextToClipboard(u),$(n).find(".copied-notification").addClass("visible")});$(n).find(".embed-share").on("click",n=>{n.preventDefault(),alert("Show embed text")})};max7app.configurePopup=function(n,t,i,r){$(n).on("click",function(){$(t).css("z-index",max7app.getElementZIndex(n,1)+1).toggle();var u={hidePopup:function(i){$(i.target).closest($(n)).length||$(i.target).closest($(t)).length||$(t).hide()}};if($(t).is(":visible")){$(t).position({my:i,at:r,"of":$(n),collision:"fit"});$(document).on("click",u.hidePopup)}
3else $(document).off("click",u.hidePopup);return!1})};max7app.showHelpDialog=function(n,t){var i=$("<div/>",{"class":"helpDialogContent",html:t}).appendTo($("BODY")).dialog({autoOpen:!0,width:565,modal:!0,title:n,stack:!0,resizable:!1,open:function(){$(this).css({"max-height":500,"overflow-y":"auto"})},close:function(){i.dialog("destroy");i.remove()}})};max7app.createHelpPopup=function(n,t){var i=$("<div/>",{"class":"helpWrapper"}).appendTo(n),r=$("<a/>",{"class":"helpLink"}).appendTo(i);return this.configureHelpPopup(r,t),i};max7app.getElementZIndex=function(n,t){var r="auto",i,u=$(n).parents().addBack().toArray(),f,e;for(f in u)if((e=u[f],i=$(e).css("z-index"),i!=="auto")&&i!=="initial"&&i!=="inherit"&&isNaN(i)!==!0){if(i=parseInt(i,10),r==="auto"){r=i;continue}if(i>r){r=i;continue}}return r==="auto"&&t!==undefined&&(r=t),r};max7app.configureHelpPopup=function(n,t,i){var r=this;i=i||"left";typeof t=="string"&&(t=$("<div />",{"class":"helpLinkDetail"}).html("<div class='arrowedBox standard left'>"+t+"<\/div>").insertAfter(n));t.dismissable();n.on("click",function(u){if(!max7app.areInPlaceTranslationKeysPressed(u)){u.preventDefault();u.stopPropagation();var f=i==="right"?"left":"right",e=i==="right"?"right+10":"left-10";t.dismissable("ignoreEvent",u).css("z-index",r.getElementZIndex(n,1)+1).show().position({my:f,at:e,"of":n,collision:"fit"}).find(".arrowedBox").toggleClass("right",i!=="right").toggleClass("left",i==="right")}})};
3max7app.validateEmail=function(n){return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(n)};max7app.displayRoundedMilliseconds=function(n){return n<59500?this.displaySecondsText(Math.round(n/1e3)):n<714e4?this.displayMinutesText(Math.round(n/6e4)):this.displayHoursText(Math.round(n/36e5))};max7app.displaySecondsText=function(n){return n===1?max7app.displayText("DISPLAY_TIME_1_SECOND"):max7app.displayText({code:"DISPLAY_TIME_X_SECONDS",parameters:{seconds:n}})};max7app.categoryIsDescendantOrSelf=function(n,t){if(n===t)return!0;var i=!1;return $.each(t.children,function(t,r){i=i||max7app.categoryIsDescendantOrSelf(n,r)}),i};max7app.displayMinutesText=function(n){return n===1?max7app.displayText("DISPLAY_TIME_1_MINUTE"):max7app.displayText({code:"DISPLAY_TIME_X_MINUTES",parameters:{minutes:n}})};max7app.displayHoursText=function(n){return n===1?max7app.displayText("DISPLAY_TIME_1_HOUR"):max7app.displayText({code:"DISPLAY_TIME_X_HOURS",parameters:{hours:n}})};max7app.destroyAndCreateDivById=function(n,t,i){i=i||"div";$("#"+n).remove();var r=$("<"+i+" />",{id:n});return t?r.insertAfter(t):r.appendTo($("BODY")),r};max7app.destroyAndAppendDivById=function(n,t,i){i=i||"div";$("#"+n).remove();var r=$(`<${i} />`,{id:n});return r.appendTo(t),r};max7app.apiCall=function(n){var t,r,u,i;if(n=typeof n!="object"?{}:n,n.connection=n.connection||"jsonp",n.data=n.data||null,n.clientstate=n.clientstate||null,n.minimumErrorDelay=n.minimumErrorDelay||0,n.autoErrorHandler=typeof n.autoErrorHandler!="object"?{}:n.autoErrorHandler,n.autoErrorHandler.customMessage=n.autoErrorHandler.customMessage||max7app.displayText("API_GENERIC_SERVER_ERROR"),n.autoErrorHandler.showRetry=n.autoErrorHandler.showRetry||!0,n.autoErrorHandler.retryText=n.autoErrorHandler.retryText||max7app.displayText("API_SERVER_ERROR_RETRY"),n.autoErrorHandler.loadingIconContainer=n.autoErrorHandler.loadingIconContainer||n.autoErrorHandler.element,(n.method||"")===""&&(n.url||"")==="")throw"either method or url are required";if(n.connection==="jsonp"&&n.data!==null)throw"data must be null if connection === 'jsonp'";if(n.minimumErrorDelay<0||n.minimumErrorDelay>6e4)throw"minimumErrorDelay must be between 0 and 60000";n.parameters=n.parameters||{};t=[];for(r in n.parameters)n.parameters.hasOwnProperty(r)&&(u=n.parameters[r],Array.isArray(u)?$.each(u,function(n,i){t.push({key:r,value:encodeURIComponent(i)})}):t.push({key:r,value:encodeURIComponent(u)}));n.data===null?(t.push({key:"appticket",value:max7app.appTicket}),n.clientstate&&t.push({key:"clientstate",value:n.clientstate})):(n.data.AppTicket=max7app.appTicket,n.clientstate&&(n.data.clientstate=n.clientstate));i="";$.each(t,function(n,t){i&&(i+="&");i+=t.key+"="+t.value});var f=n.connection==="local",e=n.connection==="jsonp",o=n.requestType||(n.data?"POST":"GET"),s=n.url||(f?"":max7app.apiUrl)+"/api/"+n.method+(i?"?":"")+i,h=new Date,c=new Date(h.getTime()+n.minimumErrorDelay);$.ajax({url:s,jsonp:e?"callback":"",dataType:e?"jsonp":"json",crossDomain:!f,type:o,data:f&&n.data?JSON.stringify(n.data):n.data,timeout:n.timeout,contentType:f?n.data?"application/json; charset=utf-8":!1:"application/x-www-form-urlencoded;
3 charset=UTF-8",success:function(t){max7app.validateApiResult(t,this._handleError)&&n.success&&(n.success.length===2?n.success(t.data,n.clientstate):n.success(t.data))},complete:function(n,t){(t==="error"||t==="parsererror"||t==="timeout")&&this._handleError({errorCode:t,error:t})},_handleError:function(t){var i=new Date,r=Math.max(0,c-i.getTime());setTimeout(function(){if(n.autoErrorHandler.element!==null&&n.autoErrorHandler.element!==undefined){var i=n.autoErrorHandler.customMessage;if(n.autoErrorHandler.showRetry&&(i+=" <span class='retryLink'>"+n.autoErrorHandler.retryText+"<\/span>"),n.autoErrorHandler.element.html("<span class='apiError'>"+i+"<\/span>"),n.autoErrorHandler.showRetry)n.autoErrorHandler.element.find(".retryLink").on("click",function(){n.minimumErrorDelay===0&&(n.minimumErrorDelay=1e3);typeof n.autoErrorHandler.showLoadingIcon=="function"?n.autoErrorHandler.showLoadingIcon():n.autoErrorHandler.loadingIconContainer.html("<div class='loadingdiv'><\/div>");max7app.apiCall(n)})}(n.error||null)!==null&&(n.error.length===2?n.error(t,n.clientstate):n.error(t))},r)}})};max7app.apiCallWithPromise=function(n){n=n||{};let t=n.generateUserAdminKey||!1;return new Promise((i,r)=>{max7app.generateUserAdminKeyIfRequired(t).then(u=>{let f=structuredClone(n);f.success=n=>{i(n)};f.error=n=>{r(n)};t&&(f.data?f.data.userAdminKey=u:(f.parameters=f.parameters||{},f.parameters.userAdminKey=u));max7app.apiCall(f)},n=>{r(n)})})};max7app.pad=function(n,t){for(var i=""+n;i.length<t;)i="0"+i;return i};max7app.getFileTypeDetails=function(n){if(!n)return null;var t=n.lastIndexOf(".");return(t>-1&&(n=n.substring(t+1)),n=n.toLowerCase(),max7appdata.fileTypes&&max7appdata.fileTypes[n])?max7appdata.fileTypes[n]:null};
3max7app.validateApiResult=function(n,t){return n.success?!0:t?(t(n),!1):(alert(max7app.displayText("API_GENERIC_SERVER_ERROR")),!1)};max7app.getDisplayAccessTextCode=function(n){switch(n){case 1:return"RESTRICTED_TEXT";case 2:return"UNLISTED_TEXT";case 3:return"PUBLIC_TEXT";default:return null}};max7app.displayAccess=function(n){var t=this.getDisplayAccessTextCode(n);return t===null?"(error: "+n+")":max7app.displayText(t)};max7app.getCategory=function(n){var t=null;return $.each(max7appdata.flatcategories,function(i,r){r.id===n&&(t=r)}),t};max7app.getBibleBook=function(n){for(var i=max7appdata.biblebooks.length,t=0;t<i;t++)if(max7appdata.biblebooks[t].bookno===n)return max7appdata.biblebooks[t];return null};max7app.getBibleBookByName=function(n){var t=[];return(n=n.trim().toLowerCase().replace(/\s/gi,""),$.each(max7appdata.biblebooks,function(i,r){var u=!1;r.name.toLowerCase().replace(/\s/gi,"").indexOf(n)===0&&(u=!0);r.code.toLowerCase()===n&&(u=!0);$.each(r.synonyms,function(t,i){i.toLowerCase().replace(/\s/gi,"")==n&&(u=!0)});u&&t.push(r)}),t.length===1)?t[0]:null};max7app.getBibleBookByCode=function(n){n=n.trim().toLowerCase();var t=$.grep(max7appdata.biblebooks,function(t){return t.code.toLowerCase()===n});return t.length===1?t[0]:null};max7app.hideContextMenu=function(){$("#ContextMenu").removeClass("active").fadeOut(400)};max7app.createBibleReferenceFromBibleReferenceData=function(n){return this._createBibleReference(this.getBibleBook(n.BookID),n.StartChapter||0,n.EndChapter||0,n.StartVerse||0,n.EndVerse||0,0,0)};max7app._createBibleReference=function(n,t,i,r,u,f,e){return n?{bookno:n.bookno,bookname:n.name,bookcode:n.code,bookchapters:n.chapters,startVerse:r,endVerse:u,startChapter:t,endChapter:i,startVersePart:f,endVersePart:e}:null};max7app.parseBibleReference=function(n){var f=0,u=0,r=0,i=0,s=0,c=0,l=n.split("-"),e="",a,t,v,o,y,h;return(l.length>1&&(e=l[1].trim()),a=/((?:[1|2|3|i|ii|iii]\s*)?[a-я]+)(?:\s*([0-9]+)(?:\s*[:\.]\s*([0-9]+)([a-z]?)?)?)?/i,t=a.exec(n),t===null)?null:(v=t[1],o=this.getBibleBookByName(v),o===null)?null:((t[2]||null)!==null&&(r=parseInt(t[2])),(t[3]||null)!==null&&(f=parseInt(t[3])),(t[4]||null)!==null&&(c=t[4].ToUpperInvariant().charCodeAt(0)-64),e===""?(t[4]||null)!==null?s=c:(t[3]||null)!==null?u=parseInt(f):(t[2]||null)!==null&&(i=parseInt(r)):!isNaN(e)&&Number.isInteger(Number(e))?(t[4]||null)!==null?s=e:(t[3]||null)!==null?u=parseInt(e):(t[2]||null)!==null&&(i=parseInt(e)):(y=/(?:\s*([0-9]+)(?:\s*[:\.]\s*([0-9]+)([a-z]?)?)?)?/i,t=y.exec(e),t!==null&&((t[1]||null)!==null&&(i=parseInt(t[1])),(t[2]||null)!==null&&(u=parseInt(t[2])),(t[3]||null)!==null&&(s=t[3].ToUpperInvariant().charCodeAt(0)-64))),r!==0&&(r<1||r>o.chapters))?null:i!==0&&(i<1||i>o.chapters)?null:r!==0&&i!==0&&i<r?null:f!==0&&(h=max7app.bibleVerseCounts[o.bookno-1][r-1],f<1||f>h)?null:u!==0&&(i===0&&(i=r),h=max7app.bibleVerseCounts[o.bookno-1][i-1],u<1||u>h)?null:r!==0&&i!==0&&f!==0&&u!==0&&r==i&&u<f?null:this._createBibleReference(o,r,i,f,u,c,s)};max7app.displayBibleReference=function(n){var t=n.bookname;return n.startChapter!==0&&(t+=" ",t+=n.startChapter,n.startVerse!==0&&(t+=":",t+=n.startVerse,n.startVersePart!==0&&(t+=String.fromCharCode(96+n.startVersePart))),n.endChapter!==0&&n.startChapter!==n.endChapter?(t+="-",t+=n.endChapter,n.endVerse!==0&&(t+=":",t+=n.endVerse)):n.endVerse!==0&&n.startVerse!==n.endVerse&&(t+="-",t+=n.endVerse,n.endVersePart!==0&&(t+=String.fromCharCode(96+n.endVersePart)))),t};max7app.getFallbackLibraryImageUrl=function(n){return"/images/resourceimages/library.jpg?preset="+n};max7app.getFallbackResourceImageUrl=function(n,t){var i="/images/resourceimages/default.jpg?preset="+n;return max7appdata.fallbackImageCategories!==null&&t!==null&&t!==undefined&&$.each(max7appdata.fallbackImageCategories,function(r,u){if(t.indexOf(u)>-1)return i="/images/resourceimages/category"+u+".jpg"+(n!==""?"?preset="+n:""),!1}),i};max7app.xmlToObject=function(n){var s,t,r,e,u,f,i,o,h;if((typeof n=="string"||n instanceof String)&&(s=new DOMParser,n=s.parseFromString(n,"text/xml")),t={},Number(n.nodeType)===1){if(n.attributes.length>0)for(t["@attributes"]={},r=0;r<n.attributes.length;r++)e=n.attributes.item(r),t["@attributes"][e.nodeName]=e.nodeValue}else Number(n.nodeType)===3&&(t=n.nodeValue);if(n.hasChildNodes())for(u=0;
3u<n.childNodes.length;u++)f=n.childNodes.item(u),i=f.nodeName,typeof t[i]=="undefined"?(o=max7app.xmlToObject(f),i==="#text"?t=o:t[i]=o):(typeof t[i].push=="undefined"&&(h=t[i],t[i]=[],t[i].push(h)),t[i].push(max7app.xmlToObject(f)));return t};max7app.disablePageScrolling=function(){var n=this;n._disablePageScrollingStack=n._disablePageScrollingStack||[];n._disablePageScrollingStack.push($("html").css("overflow"));$("html").css("overflow","hidden")};max7app.enablePageScrolling=function(){var n=this;n._disablePageScrollingStack=n._disablePageScrollingStack||[];n._disablePageScrollingStack.length>0&&$("html").css("overflow",n._disablePageScrollingStack[n._disablePageScrollingStack.length-1]);n._disablePageScrollingStack.length>1&&(n._disablePageScrollingStack=n._disablePageScrollingStack.slice(0,n._disablePageScrollingStack.length-1))};max7app.getResourceCategories=function(n){return this.resourceCategories===null&&(this.resourceCategories=[],$.each(max7appdata.rawcategorygroups,function(t,i){var r={ID:i.id,Title:i.title,TitleID:i.titleId,PluralTitle:i.pluralTitle,PluralTitleID:i.pluralTitleId,InitiallyCollapsed:i.initiallyCollapsed,ResourceCategories:max7app._buildResourceCategoryTree(i.id,0,n,0),ResourceTypeCategories:[max7app._buildResourceCategoryTree(i.id,0,n,0),max7app._buildResourceCategoryTree(i.id,0,n,1),null,max7app._buildResourceCategoryTree(i.id,0,n,3)]};max7app.resourceCategories.push(r)})),this.resourceCategories};max7app.getResourceCategoryGroup=function(n,t){var i=null;return $.each(this.getResourceCategories(t),function(t,r){r.ID===n&&(i=r)}),i};max7app.getResourceTypeCategories=function(n){var t=[];return n&&$.each(n,function(i,r){var u=max7app.getCategory(r),f;u!==null&&u.groupId===1&&(f=!1,$.each(n,function(n,t){if(t!==r){var i=max7app.getCategory(t);i!==null&&typeof i.parent!="undefined"&&i.parent===r&&(f=!0)}}),f||t.push(u.title))}),t};max7app.categoryIsAllowedForResource=function(n,t,i){var r=max7app.getCategory(n);return r.groupId!=t?!1:i==1?r.forResources:i==3?r.forLibraries:!0};max7app._buildResourceCategoryTree=function(n,t,i,r){var c=[],l=max7appdata.flatcategories?max7appdata.flatcategories.length:0,h,e,f,u,o,a,s;if(l)for(h=i?"parentItem":"parentCategory",e=0;e<l;e++)if(f=max7appdata.flatcategories[e],u={id:f.id,parent:f.parent,title:f.title,singularTitle:f.singularTitle||f.title,isPrimaryCategory:f.isPrimaryCategory,groupId:f.groupId,textid:f.textid,forResources:f.forResources,forLibraries:f.forLibraries},u.groupId===n&&u.parent===t&&(o=!0,Number(r)===1&&(o=u.forResources),Number(r)===3&&(o=u.forLibraries),o)){for(u[h]=null,u.children=max7app._buildResourceCategoryTree(n,u.id,i,r),a=u.children?u.children.length:0,s=0;s<a;s++)u.children[s][h]=u;c.push(u)}return c};max7app.saveDownloadAgreementTicked=function(){this.downloadAgreementRequired=!1;$.ajax({method:"POST",url:"/api/userentity/acceptdownloadagreement?user="+max7app.userEntityId+"&appticket="+max7app.appTicket,dataType:"json"})};max7app.testBrowserCapabilities=function(n){if(n)return!0;return max7app.showPopupNotification({message:`<p>The action you are trying to take requires a more modern browser.</p><p>Please switch to a browser with one of the followining minimum versions:</p><ul>${[{title:"Chrome",version:47},{title:"Edge",version:16},{title:"Safari",version:11.3},{title:"Firefox",version:41},{title:"Firefox for Android",version:127},{title:"Opera",version:34},{title:"Opera Mobile",version:80},{title:"Samsung Internet",version:5},{title:"Android Browser",version:126}].map(n=>`<li>${n.title} (${n.version})</li>`).join("")}`,type:"error",timeout:2e4}),!1};max7app.showModalAjaxBox=function(n,t){var r=$("#ModalAjaxBox"),i;r.remove();i="";(n||!1)&&(i+="<h2>"+n+"<\/h2>");(t||!1)&&(i+=t);i+="<div class='loadingdiv'><\/div>";$("body").append("<div id='ModalAjaxBox'><div>"+i+"<\/div><\/div>")};max7app.hideModalAjaxBox=function(){$("#ModalAjaxBox").remove()};max7app.showAlert=function(n,t,i,r){$("#ModalDialogBox").remove();var u="";u+=t;$("body").append("<div id='ModalDialogBox'>"+u+"<\/div>");$("#ModalDialogBox").dialog({title:n,resizable:!1,width:600,modal:!0,stack:!0,dialogClass:"hideClose",buttons:[{text:i||"Close",click:function(){$(this).dialog("close");r&&r()}}]})};max7app.balanceHorizontalPadding=function(n,t,i){var u=[],f=0,r;this.cleanWhitespace(n.get(0));n.css("white-space","nowrap");r=t?n.find(t):n.children();r.each(function(){var n=$(this).outerWidth(!0);u.push(n);f+=n});i=i||0;var o=n.width(),s=o-f-i*(r.length-1),h=s/u.length,e=0;r.each(function(){$(this).css("width",Math.floor(u[e]+h)+"px").css("text-align","center");$(this).css("float","left");i&&$(this).css("margin-right",i+"px");e++});n.children(":last").css("float","right").css("margin-right","0")};max7app.cleanWhitespace=function(n){for(var i,t=0;t<n.childNodes.length;t++)i=n.childNodes[t],i.nodeType!==3||/\S/.test(i.nodeValue)||n.removeChild(i)};max7app.getLibraryFolderGuid=function(n,t){var i=t.filter(t=>t.ID==n);return i.length>0?i[0].Guid:null};max7app.generateLibraryFolderResourcePackage=function(n,t,i,r,u,f,e,o,s){max7app.api.downloadBasket.launchResourcePackageBuilderTask(4,"<root><folderId>"+n+"<\/folderId><libraryId>"+r+"<\/libraryId><libraryTitle>"+f+"<\/libraryTitle><folderTitle>"+i+"<\/folderTitle><includeTranslationComponents>"+o+"<\/includeTranslationComponents><languageCode>"+s+"<\/languageCode><\/root>
3",e,i+" - "+f,max7app.urlManager.getLibraryUrl(u,t),{success:function(n){var t=n;max7app.backgroundActivityManager.displayBackgroundActivity(t,!0,!0)},error:function(){alert("There has been an unexpected error")}})};max7app.generateSingleLibraryResourcePackage=function(n,t,i,r,u,f){max7app.api.downloadBasket.launchResourcePackageBuilderTask(3,"<root><libraryId>"+n+"<\/libraryId><libraryTitle>"+r+"<\/libraryTitle><includeTranslationComponents>"+u+"<\/includeTranslationComponents><languageCode>"+f+"<\/languageCode><\/root>",i,r,max7app.urlManager.getResourceUrl(3,t),{success:function(n){var t=n;max7app.backgroundActivityManager.displayBackgroundActivity(t,!0,!0)},error:function(){alert("There has been an unexpected error")}})};max7app.generateDownloadBasketResourcePackage=function(n,t,i,r,u){n.sort();max7app.api.downloadBasket.launchResourcePackageBuilderTask(2,"<root><resources>"+$.map(n,function(n){return"<resource>"+n+"<\/resource>"}).join("")+"<\/resources><basketname>"+(i||"")+"<\/basketname><languageCode>"+r+"<\/languageCode><includeAllLanguages>"+u+"<\/includeAllLanguages><\/root>",t,i||"DownloadBasket","",{success:function(n){var t=n;max7app.backgroundActivityManager.displayBackgroundActivity(t,!0,!0)},error:function(){alert("There has been an unexpected error")}})};max7app.scrollToElementAndFlash=function(n){var t=this;(n=n||{},n instanceof jQuery&&(n={element:n}),$(n.element).length!==0)&&(n.complete=function(){t.flashElement(n.element)},max7app.scrollToElement(n))};max7app.flashElement=function(n){$(n).css("background-color","#d8f66f").animate({backgroundColor:"white",complete:function(){n.css("background-color","")}},1e3)};max7app.registerPageUnloadWarning=function(n){this._pageUnloadQueue.push(n);window.onbeforeunload=_Max7beforeWindowUnload};max7app.getUserAdminKey=function(n){if(max7app.person===null)throw"user is not logged in";if(this.userAdminKey!==null){n&&n.success&&n.success(this.userAdminKey);return}$.ajax({cache:!1,dataType:"json",url:"/services/useradminkey/getuseradminkey.ashx",success:function(t){max7app.userAdminKey=t.key;n&&n.success&&n.success(t.key)},error:function(n,t,i){alert(i)}})};max7app.generateUserAdminKeyIfRequired=function(n){return n?max7app.getUserAdminKeyPromise(!0):Promise.resolve(null)};max7app.getUserAdminKeyPromise=function(n){return new Promise((t,i)=>{if(max7app.person===null&&n){t(null);return}if(max7app.person===null){i("user is not logged in");return}if(max7app.userAdminKey!==null){t(max7app.userAdminKey);return}$.ajax({cache:!1,dataType:"json",url:"/services/useradminkey/getuseradminkey.ashx",success:function(n){max7app.userAdminKey=n.key;t(max7app.userAdminKey)},error:function(n,t,r){i(r)}})})};max7app.showTermsOfServiceDialog=function(){var n=this.destroyAndCreateDivById("tosDlg");this.getTermsOfServiceText({success:function(t){n.html(t);n.dialog({title:max7app.displayText("TermsOfServiceText"),width:600,height:400,autoOpen:!0})},error:function(){alert(max7app.displayText("ERROR_OPENING_TOS_DLG"))}})};max7app.getTermsOfServiceText=function(n){return this._termsOfServiceText?this._termsOfServiceText:(this.apiCall({connection:"local",method:"data/GetTermsOfService",requestType:"GET",parameters:{channel:max7app.channelGuid,languageCode:max7app.languageCode,appTicket:this.appTicket},success:function(t){this._termsOfServiceText=t;n.success&&typeof n.success=="function"&&n.success(t)},error:n.error||undefined,autoErrorHandler:n.autoErrorHandler||undefined}),!1)};max7app.htmlEncode=function(n){return $("<div/>").text(n).html()};max7app.htmlDecode=function(n){return $("<div/>").html(n).text()};max7app.isElement=function(n){return typeof HTMLElement=="object"?n instanceof HTMLElement:n&&typeof n=="object"&&n!==null&&n.nodeType===1&&typeof n.nodeName=="string"};max7app.newguid=function(){function n(n){var t=(Math.random().toString(16)+"000000000").substr(2,8);return n?"-"+t.substr(0,4)+"-"+t.substr(4,4):t}return n()+n(!0)+n(!0)+n()};max7app.createuniqueid=function(){return"ctl"+max7app.newguid().replace("-","")};max7app.copyTextToClipboard=function(n,t){var i=document.createElement("textarea"),r,u,f;i.style.position="fixed";i.style.top=0;i.style.left=0;i.style.width="2em";i.style.height="2em";i.style.padding=0;i.style.border="none";i.style.outline="none";i.style.boxShadow="none";i.style.background="transparent";i.value=n;r=t?t:document.body;$(r).append(i);i.select();try{u=document.execCommand("copy");f=u?"successful":"unsuccessful";console.log("Copying text command was "+f)}catch(e){console.log("Oops, unable to copy")}i.remove()};max7app.getCurrentPersonDisplayName=function(n){return this.getPersonDisplayName(this.person,n)};max7app.getPersonDisplayName=function(n,t){var i=t?" ("+n.UserName+")":"";return n.FirstName+" "+n.LastName+i};max7app.getPersonIconUrl=function(n,t,i){return t===PersonIconType.Custom?max7app.contentStoreUrlManager.getUploadedPersonIconUrl(n,i):"/images/avatars/"+this.pad(i,2)+".jpg"};max7app.getCommunityIconUrl=function(n,t,i){return t===CommunityIconType.Custom?max7app.contentStoreUrlManager.getUploadedCommunityIconUrl(n,i):"/images/communities/01.jpg"};max7app.getChannelBannerImageUrl=function(n,t){return max7app.contentStoreUrlManager.getChannelBannerImageUrl(n,t)};max7app.getCustomContentFileUrl=function(n,t,i){return max7app.contentStoreUrlManager.getCustomContentFileUrl(n,t,i)};max7app.compareBools=function(n,t){return n===t?0:n?-1:1};max7app.getRoleById=function(n){var t=$.grep(max7appdata.roles,function(t){return t.id===n});return t.length===0?null:t[0]};max7app.getRandomLoadingShadowText=function(n,t,i){for(var r=[],f=Math.ceil(Math.random()*(t-n))+n,u=0;u<f;u++)r.push("".padEnd(Math.ceil(Math.random()*5)+3,"█"));return r.join(i)};max7app.getRoleName=function(n){var t=max7app.getRoleById(n);return t?t.title:"?????"};max7app.clearAutoPopulateList=function(n){n=n||"none";n=n.toLowerCase();this._autoPopulateListCache[n]&&delete this._autoPopulateListCache[n]};max7app.getRegExCaptures=function(n,t,i){i||(i=1);for(var r=[],u;u=t.exec(n);)r.push(u[i]);return r};max7app.getCommonDataList=function(n,t,i){var r,u,f;if(n=n||"none",n=n.toLowerCase(),r=function(n){window.setTimeout(function(){t(n)},100)},this._autoPopulateListCache[n]&&(u=new Date(this._autoPopulateListCache[n].date.getTime()),u.setMinutes(u.getMinutes()+5),new Date<u)){r(max7app._autoPopulateListCache[n].list);return}switch(n){case"editableuserlibraries":this.person!==null?(f=this.person.ID,this.apiCall({method:"library/GetEditableLibrariesListByPerson",parameters:{person:f,culture:this.filterCultureCode,context:this.channelGuid,language:this.languageCode},success:function(i){max7app._autoPopulateListCache[n]={date:new Date,list:i};t(i)},error:i})):r([]);break;default:r([])}};max7app.showDialog=function(n){n.closest(".ui-dialog").show()};max7app.hideDialog=function(n){n.closest(".ui-dialog").hide()};max7app.enableDialogSaveButton=function(n,t,i,r){var u=n.closest(".ui-dialog").find(".ui-dialog-buttonset ."+t);u.attr("disabled",!i).toggleClass("ui-state-disabled",!i);!i&&r&&(u.empty(),$("<span/>",{"class":"loadingdiv"}).appendTo(u))};max7app.createCloseButton=function(){return $("<button/>",{"class":"close",html:'<svg><use xlink:href="/images/close.svg#image"><\/use><\/svg>'}).attr("type","button").attr("aria-label",max7app.displayText("CLOSE_BUTTON_TEXT"))};max7app.showModalWaitingScreen=function(n){var t=max7app.destroyAndCreateDivById("ModalWaitingScreen");t.addClass("modal-screen");$("<div/>",{"class":"prompt",html:n}).appendTo(t);$("<div/>",{"class":"loadingdiv"}).appendTo(t);max7app.showModalScreen(t,{closeOnEsc:!1})};max7app.hideModalWaitingScreen=function(){var n=$("#ModalWaitingScreen");max7app.hideModalScreen(n);n.remove()};max7app.downloadCrossOriginImage=function(n,t){return fetch(n,{mode:"cors"}).then(function(n){return n.blob()}).then(function(n){var r=URL.createObjectURL(n),i=document.createElement("a");i.href=r;i.download=t||"image.jpg";document.body.appendChild(i);i.click();document.body.removeChild(i);URL.revokeObjectURL(r)})};max7app.createModalScreen=function(n,t){typeof t=="string"&&(t={classes:t});t=t||{};var i=max7app.destroyAndCreateDivById(n);return i.addClass("modal-screen "+(t.classes?t.classes:"")),t.width&&i.addClass(`modal
3-screen-${t.width}-width`),t.createCloseButton!==!1&&max7app.createCloseButton().appendTo(i),t.title&&$("<div/>",{"class":"modal-screen-title",html:t.title}).appendTo(i),t.footer&&$("<div/>",{"class":"modal-screen-video-footer",html:t.footer}).appendTo(i),i};max7app.createModalScreenButtonsContainer=function(n){return $("<div/>",{"class":"modal-screen-buttons-container"}).appendTo(n)};max7app.createModalScreenCancelButton=function(n,t){return $("<button/>",{text:max7app.displayText("CancelText"),"class":"modal-screen-cancel-button"}).on("click",n=>{t(n)}).appendTo(n)};max7app.createModalScreenSubmitButton=function(n,t,i){return $("<button/>",{html:t,"class":"modal-screen-submit-button"}).on("click",n=>{i(n)}).appendTo(n)};max7app.clickDialogSaveButton=function(n,t){n.closest(".ui-dialog").find(".ui-dialog-buttonset ."+t).click()};max7app.browserPrefersDarkMode=function(){return window.matchMedia("(prefers-color-scheme: dark)").matches};max7app.setDarkModeOverride=function(n){try{window.localStorage.setItem(`darkmode-${max7app.browserPrefersDarkMode()}`,n)}catch(t){}};max7app.getDarkModeOverride=function(){try{return window.localStorage.getItem(`darkmode-${max7app.browserPrefersDarkMode()}`)}catch(n){return null}};max7app.getCurrentDarkMode=function(){var n=max7app.getDarkModeOverride();return n===null||n===undefined?max7app.browserPrefersDarkMode():n==="true"};max7app.getModerationStatusType=function(n){return max7app.moderationStatusTypes[n]};max7app.getModerationSummary=function(n,t,i,r){var h=max7app.getModerationStatusType(n),u="Unknown",f="",e=max7app.displayText("MODERATION_SUMMARY_UNKNOWN"),o="alert",s="moderation-unknown";if(h.isHandled||(u="Awaiting Moderation",f="",e=t?"This library has not yet been moderated.":max7app.displayText("RESOURCE_NOT_YET_APPROVED"),o="alert",s="moderation-unhandled"),h.isApproved)if(s="moderation-approved",t)u="Approved",f="",e=max7app.displayText("LIBRARY_APPROVED"),o="ok";else{var c=[],l=[],a=[],v=!1;i?$.each(i,function(n,t){if(Number(t.CommunityID)===Number(r)){var i=max7app.getModerationStatusType(t.ModerationStatus);i.isHandled||c.push(t);i.isApproved&&l.push(t);i.isRejected&&a.push(t)}}):v=!0;v?(u="Approved",f="",e=max7app.displayText({text:"Resource Approved"}),o="ok"):l.length>0&&c.length===0&&a.length===0?(u="Approved",f="",e=max7app.displayText("RESOURCE_AND_FILES_APPROVED"),o="ok"):c.length>0?(u="Approved",f="Some Files Pending",e=max7app.displayText("MODERATION_SUMMARY_RESOURCE_APPROVED_FILES_PENDING"),o="alert"):l.length+c.length===0?(u="Approved",f="All Files Rejected",e=max7app.displayText("MODERATION_SUMMARY_RESOURCE_APPROVED_FILES_REJECTED"),o="alert"):a.length>0&&(u="Approved",f="Some Files Rejected",e=max7app.displayText("MODERATION_SUMMARY_RESOURCE_APPROVED_SOME_FILES_REJECTED"),o="ok")}return h.isUniversallyRejected?(u="Universally Rejected",f="",e=max7app.displayText("MODERATION_SUMMARY_RESOURCE_REJECTED"),o="rejected",s="moderation-rejected"):h.isRejected&&(u="Rejected",f="",e=max7app.displayText("MODERATION_SUMMARY_RESOURCE_REJECTED"),o="rejected",s="moderation-rejected"),{title:u,subTitle:f,summary:e,icon:o,"class":s}};max7app.getXmlValue=function(n,t,i){const u=n.getElementsByTagName(t)[0];var r=u?u.innerHTML:i;return r===""&&(r=i),r};max7app.displayResourceModerationSummary=function(n,t,i,r){var u=this.getModerationSummary(n.ModerationStatus,n.IsLibrary,n.CommunityResourceFileModerationIncidents,t);$("<div />",{"class":"moderationSummary",text:u.summary}).appendTo(r)};max7app.moderationCommentsDialog={_dialogBox:null,_internalComment:null,_internalCommentInfo:null,_explanationToOwner:null,_explanationToOwnerInfo:null,_options:null,_isCancelling:!0,getInternalComment:function(){return this._internalComment&&this._internalComment.length?this._internalComment.val().trim():null},getExplanationToOwner:function(){return this._explanationToOwner&&this._explanationToOwner.length?this._explanationToOwner.val().trim():null},_createValidateFunction:function(n,t){var i=this;return function(){var r=(!n||i.getInternalComment())&&(!t||i.getExplanationToOwner())?!1:!0;i._dialogBox.closest(".ui-dialog").find(".ui-dialog-buttonpane button.actionButton").prop("disabled",r)}},_parseOptions:function(n){return n._parsed?n:{title:n.title,introText:n.introText===undefined?max7app.displayText("MODERATION_COMMENTS_INTRO_BLOCK"):n.introText,showInternalComment:n.showInternalComment===!1?!1:!0,internalCommentRequired:n.internalCommentRequired===!1?!1:!0,internalCommentPlaceholder:n.internalCommentPlaceholder===undefined?max7app.displayText("MODERATION_COMMENTS_INTERNAL_COMMENT_PLACEHOLDER"):n.internalCommentPlaceholder,showExplanationToOwner:n.showExplanationToOwner===!1?!1:!0,explanationToOwnerRequired:n.explanationToOwnerRequired===!1?!1:!0,explanationToOwnerPlaceholder:n.explanationToOwnerPlaceholder===undefined?max7app.displayText("ExplanationToOwnerText"):n.explanationToOwnerPlaceholder,explanationToOwnerInfoText:n.explanationToOwnerInfoText===undefined?max7app.displayText("MODERATE_FILE_REJECT_EXPLANATIONTOOWNER_PROMPT"):n.explanationToOwnerInfoText,actionButtonText:n.actionButtonText===undefined?max7app.displayText("MODERATION_REJECT_RESOURCE_TITLE"):n.actionButtonText,onAction:n.onAction,onCancel:n.onCancel,_parsed:!0}},_createDialog:function(n){var t=this._parseOptions(n),r=this,i;this._options=t;this._dialogBox?(this._internalComment.prop("placeholder",t.internalCommentPlaceholder),this._explanationToOwner.prop("placeholder",t.explanationToOwnerPlaceholder),this._explanationToOwnerInfo.text(t.explanationToOwnerInfoText),this._dialogBox.dialog("option","title",t.title)):(this._dialogBox=$("<div />",{id:"moderateResource_contactOwnerDialog","class":"contactResourceOwnerDialog"}),this._intro=$("<div />",{id:"moderateResource_contactOwnerDialog_intro"}).appendTo(this._dialogBox),i=$("<div/>",{"class":"controlsContainer"}).appendTo(this._dialogBox),this._internalComment=$("<textarea />",{"class":"internalComment",placeholder:t.internalCommentPlaceholder}
3).appendTo(i),this._internalCommentInfo=$("<div />",{"class":"internalCommentInfo",text:max7app.displayText("OtherModeratorsCanReadText")}).appendTo(i),this._explanationToOwner=$("<textarea />",{"class":"explanationToOwner",placeholder:t.explanationToOwnerPlaceholder}).appendTo(i),this._explanationToOwnerInfo=$("<div />",{"class":"explanationToOwnerInfo",text:t.explanationToOwnerInfoText}).appendTo(i),this._dialogBox.appendTo(document.body),this._dialogBox.dialog({title:t.title,width:400,modal:!0,stack:!0,dialogClass:"hideClose",close:function(){r._dialogClosing();r.resetInput()}}))},_dialogClosing:function(){this._isCancelling&&this._options.onCancel&&this._options.onCancel()},open:function(n){var t=this._parseOptions(n),r=this,i;if(this._createDialog(t),this._intro.html(t.introText),this._dialogBox.dialog("option","buttons",[{text:max7app.displayText("CancelText"),"class":"cancelButton",click:function(){$(this).dialog("close")}},{text:t.actionButtonText,"class":"orangebutton actionButton",click:function(n){r._isCancelling=!1;t.onAction(n)}}]),i=this._createValidateFunction(t.showInternalComment&&t.internalCommentRequired,t.showExplanationToOwner&&t.explanationToOwnerRequired),t.showInternalComment)if(this._internalComment.show(),this._internalCommentInfo.show(),t.internalCommentRequired){this._internalComment.on("blur.contactOwnerDialog",i).on("keyup.contactOwnerDialog",i).on("change.contactOwnerDialog",i);this._dialogBox.closest(".ui-dialog").find(".ui-dialog-buttonpane button.actionButton").prop("disabled",!0)}else this._internalComment.off("blur.contactOwnerDialog").off("keyup.contactOwnerDialog").off("change.contactOwnerDialog");else this._internalComment.hide(),this._internalCommentInfo.hide(),this._internalComment.off("blur.contactOwnerDialog").off("keyup.contactOwnerDialog").off("change.contactOwnerDialog");if(t.showExplanationToOwner)if(this._explanationToOwner.show(),this._explanationToOwnerInfo.show(),t.explanationToOwnerRequired){this._explanationToOwner.on("blur.contactOwnerDialog",i).on("keyup.contactOwnerDialog",i).on("change.contactOwnerDialog",i);this._dialogBox.closest(".ui-dialog").find(".ui-dialog-buttonpane button.actionButton").prop("disabled",!0)}else this._explanationToOwner.off("blur.contactOwnerDialog").off("keyup.contactOwnerDialog").off("change.contactOwnerDialog");else this._explanationToOwner.hide(),this._explanationToOwnerInfo.hide(),this._explanationToOwner.off("blur.contactOwnerDialog").off("keyup.contactOwnerDialog").off("change.contactOwnerDialog");this._isCancelling=!0;this._dialogBox.dialog("open")},close:function(){this._dialogBox.dialog("close")},disableInput:function(){this._dialogBox&&(this._internalComment.prop("disabled",!0),this._explanationToOwner.prop("disabled",!0),this._dialogBox.closest(".ui-dialog").find(".ui-dialog-buttonpane button").prop("disabled",!0))},resetInput:function(){this._dialogBox&&(this._internalComment.val(""),this._explanationToOwner.val(""),this._internalComment.prop("disabled",!1),this._explanationToOwner.prop("disabled",!1),this._dialogBox.closest(".ui-dialog").find(".ui-dialog-buttonpane button").prop("disabled",!1))}};max7app.getResourceModerationIncident=function(n,t){return $.grep(n,function(n){return Number(n.CommunityID)===Number(t)})[0]};max7app.getFilterCultureCode=function(){var n=this;return n.overrideFilterCultureCode||n.filterCultureCode};max7app.isAltLanguageUsable=function(){var n=this;return(n.getFilterCultureCode()||n.languageCode)!==n.languageCode};max7app.displayAltLanguage=function(){return this.isAltLanguageUsable()&&this._displayAltLanguage};max7app.addDaysToDate=function(n,t){var i=new Date(n.valueOf());return i.setDate(i.getDate()+t),i};max7app.showModalOverlay=function(n,t){if(n===undefined&&(n=!0),$("#ModalBackground").toggleClass("visible",n),n&&t!==undefined)$("#ModalBackground").on("click",t);if(n||$("#ModalBackground").off("click"),$("#MainContainer").toggleClass("modal-active",n),n){var i=window.scrollY,r=document.body.scrollHeight>$(document.body).height();document.body.style.position="fixed";document.body.style.width="100%";document.body.style.top=`-${i}px`;r&&(document.body.style.paddingInlineEnd="16px")}else{const n=document.body.style.top;document.body.style.position="";document.body.style.top="";document.body.style.width="";document.body.style.paddingInlineEnd="";window.scrollTo({left:0,top:parseInt(n||"0")*-1,behavior:"auto"})}};
3max7app.showNonModalBackground=function(n){n===undefined&&(n=!0);$("#NonModalBackground").toggleClass("visible",n)};max7app.toggleDarkPageContent=function(n){$("#StartSidebarDocker,#MainContentWrapper,#EndSidebar,#Footer").toggleClass("darken",n)};max7app.showModalScreen=function(n,t){t=t||{};t.closeOnEsc===undefined&&(t.closeOnEsc=!0);$(".modal-screen").removeClass("visible");max7app.showModalOverlay(!0);$(n).addClass("visible").children(".close").one("click",function(){max7app.hideModalScreen(n);t.autoclose&&t.autoclose()});var i=null;if(t.closeOnEsc&&(i=function(i){i.key==="Escape"&&(i.stopPropagation(),i.preventDefault(),max7app.hideModalScreen(n),t.autoclose&&t.autoclose())}),max7app.modalScreenStack=max7app.modalScreenStack||[],max7app.modalScreenStack.push({selector:n,escapeFunction:i}),t.closeOnEsc)$(document).on("keydown",i)};max7app.hideModalScreen=function(n){$(".modal-screen").removeClass("visible");$(n).removeClass("visible");max7app.showModalOverlay(!1);max7app.modalScreenStack=max7app.modalScreenStack||[];var t=max7app.modalScreenStack.pop();t&&t.escapeFunction&&$(document).off("keydown",t.escapeFunction)};max7app.displayAltLanguageText=function(n,t){return max7app.displayAltLanguage()?(t||"")===""?n+" (no translation)":t:n};max7app.showFullScreenVideo=function(n,t){console.log("showFullScreenVideo - Start)");$("#FullScreenPreview").remove();$("body").append("<ul id='FullScreenPreview'><\/ul>");sourceshtml="";$.each(n,function(n,t){sourceshtml+="<source src='"+t.url+"'  type='"+t.type+"' />"});var i=max7app.createModalScreen("FullScreenPreview",{footer:t});i.removeClass("modal-screen");i.addClass("fullscreen-video-preview");$("#FullScreenPreview").append(`<video controls autoplay>${sourceshtml}Your browser does not support HTML5 video.</video>`);$("#FullScreenPreview").attr("style","display: grid");max7app.showModalScreen(i,{autoclose:function(){$("#FullScreenPreview").remove()}})};max7app.showYouTubeVideo=function(n,t){var i=max7app.createModalScreen("YouTubeModalScreen"),r,u;$(`<iframe width='560' height='315' src='https://www.youtube.com/embed/${n}' title='${t}' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>`).appendTo(i);r=$("<div/>",{"class":"social-container"}).appendTo(i);u=$("<div/>",{"class":"social-container-status"}).appendTo(i);max7app.addSocialShareButtons(r,u,t,`https://www.youtube.com/watch?v=${n}`);max7app.showModalScreen(i,{autoclose:function(){$("#YouTubeModalScreen").remove()}})};max7app.broadcastMessage=function(n){const t=new CustomEvent(n);document.dispatchEvent(t)};max7app.getCategoryUrl=function(n){return max7app.urlManager.getUrl("search")+"?category="+n};max7app.toJavaLiteral=function(n){return n===null?"null":`"${n.replace(/\\/g,"\\\\").replace(/\"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\f/g,"\\f").replace(/\b/g,"\\b")}"`};max7app.parseDateTimeOffsetString=function(n){return new Date(n)};max7app.renderDateTimeStringWithoutTimezone=function(n){const t=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),r=String(n.getDate()).padStart(2,"0"),u=String(n.getHours()).padStart(2,"0"),f=String(n.getMinutes()).padStart(2,"0"),e=String(n.getSeconds()).padStart(2,"0");return`${t}-${i}-${r}T${u}:${f}:${e}`};max7app.convertTextStringToDateTimeStringWithoutTimezone=function(n){return n?max7app.renderDateTimeStringWithoutTimezone(new Date(n)):""};max7app.showTutorialVideo=function(n,t,i,r){var f="Tutorial-"+t.replace(/\s/gi,"-"),u=$("#"+f);if(u.length>0){max7app.scrollToElement(u);return}i=i||720;r=r||450;u=$("<div/>",{id:f}).appendTo($("body")).dialog({autoOpen:!0,draggable:!0,modal:!1,width:i+33,height:r+70,position:{my:"center",at:"center","of":window},title:t,resizable:!1,close:function(){u.dialog("destroy");u.remove()}}).html("<video class='lg-video-object lg-html5' controls autoplay style='width: "+i+"px; height: "+r+"px'><source src='"+n+"'  type='video/mp4' />Your browser does not support HTML5 video.<\/video>")};__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.
3setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])},n(t,i)};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();DownloadDialogManager=function(){function n(){this.extensions=[]}return n.prototype.registerExtension=function(n){var t=this;n.onValidated.subscribe(function(n,i){t.extensionValidated(n,i)});this.extensions.push(n)},n.prototype.isDialogRequired=function(){var n=!1;return $.each(this.extensions,function(t,i){switch(i.getVisibility()){case DownloadDialogManagerExtensionVisibility.DisplayedAndRequiresDialogDisplay:n=!0}}),n},n.prototype.getVisibleExtensions=function(){var n=$.grep(this.extensions,function(n){switch(n.getVisibility()){case DownloadDialogManagerExtensionVisibility.DisplayedAndRequiresDialogDisplay:case DownloadDialogManagerExtensionVisibility.DisplayedIfDialogDisplays:return!0;default:return!1}});return n.sort(function(n,t){return n.getSortOrder()-t.getSortOrder()}),n},n.prototype.renderDialogExtensions=function(n){n.empty();$.each(this.getVisibleExtensions(),function(t,i){var r=$("<div/>",{"class":"extension"}).appendTo(n);i.render(r)})},n.prototype.validateExtensions=function(n,t){if(this.isValid=!0,this.extensionsAwaitingValidation=this.getVisibleExtensions(),this.extensionsAwaitingValidation.length==0){t(!0,null);return}this.validationErrorMessages=[];this.validationCompletionFunction=t;$.each(this.extensionsAwaitingValidation,function(t,i){i.validate(n)})},n.prototype.processExtensions=function(n){$.each(this.getVisibleExtensions(),function(t,i){i.process(n)})},n.prototype.extensionValidated=function(n,t){var i=this;this.isValid=this.isValid&&t.isValid;!t.isValid&&t.errorMessages.length>0&&$.each(t.errorMessages,function(n,t){i.validationErrorMessages.push(t)});this.extensionsAwaitingValidation=$.grep(this.extensionsAwaitingValidation,function(t){return t!=n});this.extensionsAwaitingValidation.length==0&&this.validationCompletionFunction(this.isValid,this.validationErrorMessages)},n}();max7app.downloaddialogmanager=new DownloadDialogManager;EventDispatcher=function(){function n(){this._subscriptions=[]}return n.prototype.subscribe=function(n){n&&this._subscriptions.push(n)},n.prototype.unsubscribe=function(n){var t=this._subscriptions.indexOf(n);t>-1&&this._subscriptions.splice(t,1)},n.prototype.dispatch=function(n,t){for(var u,i=0,r=this._subscriptions;i<r.length;i++)u=r[i],u(n,t)},n}();MyCommunitiesListManager=function(){function n(){this._data=null;this.updatingCount=0}return Object.defineProperty(n.prototype,"data",{get:function(){return this._data===null&&new Error("MyCommunitiesListManager.data was called before the list had updated"),this._data},enumerable:!0,configurable:!0}),n.prototype.load=function(){this._data===null&&this.updatingCount===0&&this.refresh();this._data!==null&&this.updatingCount===0&&this.raiseUpdatedEvent()},n.prototype.refresh=function(){var n=this;max7app.person!==null&&(n.updatingCount++,this.raiseUpdatingEvent(),max7app.api.community.getByPerson(max7app.person.ID,{success:function(t){n.updatingCount--;n._data=t;n.raiseUpdatedEvent()},error:function(){n.updatingCount--}}))},n.prototype.raiseUpdatingEvent=function(){var n=new CustomEvent("myCommunitiesListManagerUpdating");document.dispatchEvent(n)},n.prototype.raiseUpdatedEvent=function(){var n=new CustomEvent("myCommunitiesListManagerUpdated");document.dispatchEvent(n)},n}();max7app.myCommunitiesList=new MyCommunitiesListManager;CommunityApi=function(){function n(){}return n.prototype.getByPerson=function(n,t){max7app.apiCall({connection:"jsonp",requestType:"GET",method:"community/getbyperson",parameters:{person:n},success:function(n){t&&t.success&&t.success(n)},error:function(n){t&&t.error&&t.error(n)}})},n}();max7app.api.community=new CommunityApi;StatsApi=function(){function n(){}return n.prototype.getUserCommunicationStats=function(n){max7app.apiCall({connection:"jsonp",method:"stats/GetUserCommunicationStats",parameters:{},success:function(t){n&&n.success&&n.success(t)},error:function(t){n&&n.error&&n.error(t)}})},n.prototype.getMachineTranslationStats=function(n){max7app.apiCall({connection:"jsonp",method:"stats/GetMachineTranslationStats",parameters:{},success:function(t){n&&n.success&&n.success(t)},error:function(t){n&&n.error&&n.error(t)}})},n}();max7app.api.stats=new StatsApi,function(n){n[n.NotDisplayed=0]="NotDisplayed";n[n.DisplayedIfDialogDisplays=1]="DisplayedIfDialogDisplays";n[n.DisplayedAndRequiresDialogDisplay=2]="DisplayedAndRequiresDialogDisplay"}(DownloadDialogManagerExtensionVisibility||(DownloadDialogManagerExtensionVisibility={}));var DownloadDialogManagerExtensionValidationResult=function(){function n(n,t){this.isValid=n;this.errorMessages=t||[]}return n}(),BaseDownloadDialogManagerExtension=function(){function n(){this._onValidated=new EventDispatcher}return n.prototype.getSortOrder=function(){return 10},Object.defineProperty(n.prototype,"onValidated",{get:function(){return this._onValidated},enumerable:!0,configurable:!0}),n}(),SUBSCRIPTIONTYPE_MAX7NEWS=2,SUBSCRIPTIONACTIVITY_SUBSCRIBEDDURINGDOWNLOAD=1,NewsletterSignupDownloadDialogManagerExtension=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.getVisibility=function(){return!max7app.channelAllowsNewsletterSubscriptions||max7app.userIsSubscribedToCh
3annelNewsletter?DownloadDialogManagerExtensionVisibility.NotDisplayed:DownloadDialogManagerExtensionVisibility.DisplayedIfDialogDisplays},t.prototype.getSortOrder=function(){return 20},t.prototype.render=function(n){var i=$("<label/>",{"class":"newsletter-signup-label"}).appendTo(n),r=$("<input/>",{"class":"newsletter-signup",type:"checkbox"}).appendTo(i),t,u;if(i.append(max7app.displayText({code:"SEND_CHANNEL_NEWS_TEXT",parameters:{channel:max7app.siteTitle}})),max7app.userSubscriptionEmail||!0){t=$("<label/>",{"class":"newsletter-signup-email-label"}).css("visibility","hidden").appendTo(n);t.append("Email:");u=$("<input/>",{"class":"newsletter-signup-email",type:"email"}).appendTo(t);r.on("click",function(){var n=r.is(":checked");t.css("visibility",n?"visible":"hidden")})}},t.prototype.validate=function(n){var f=n.find(".newsletter-signup"),e=f.is(":checked"),t=!0,i=[],u,r;e&&(max7app.userSubscriptionEmail||!0)&&(u=n.find(".newsletter-signup-email"),r=u.val(),r===""?(t=!1,i.push("Please enter an email address in order to receive Max7 News")):max7app.isValidEmail(r)||(t=!1,i.push("Please enter a valid email address")));this.onValidated.dispatch(this,new DownloadDialogManagerExtensionValidationResult(t,i))},t.prototype.process=function(n){var u=n.find(".newsletter-signup"),i=u.is(":checked"),t,r;i&&(t=null,i&&(max7app.userSubscriptionEmail||!0)&&(r=n.find(".newsletter-signup-email"),t=r.val()),max7app.api.subscriptions.activateSubscription(max7app.userEntityId,SUBSCRIPTIONTYPE_MAX7NEWS,null,max7app.languageCode,max7app.languageCode,t,SUBSCRIPTIONACTIVITY_SUBSCRIBEDDURINGDOWNLOAD,null))},t}(BaseDownloadDialogManagerExtension);max7app.downloaddialogmanager.registerExtension(new NewsletterSignupDownloadDialogManagerExtension);TosAgreementDownloadDialogManagerExtension=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.getVisibility=function(){return max7app.downloadAgreementRequired?DownloadDialogManagerExtensionVisibility.DisplayedAndRequiresDialogDisplay:DownloadDialogManagerExtensionVisibility.NotDisplayed},t.prototype.render=function(n){var t=$("<label/>",{"class":"checkbox-wrap-label"}).appendTo(n),i;$("<input/>",{"class":"accept-download-agreement",type:"checkbox"}).appendTo(t);i=$("<span/>").appendTo(t);i.append(max7app.displayText({code:"TOS_AGREE_CHANNEL",parameters:{channel:max7app.siteTitle,link:"<a href='"+max7app.urlManager.getUrl("termsofservice")+"' target='_blank'>"+max7app.displayText("TermsOfServiceText")+"<\/a>"}}))},t.prototype.validate=function(n){var u=n.find(".accept-download-agreement"),t=u.is(":checked"),i=[],r;t||i.push(max7app.displayText("ACCEPT_TOS_ERROR"));r=new DownloadDialogManagerExtensionValidationResult(t,i);this.onValidated.dispatch(this,r)},t.prototype.process=function(n){var t=n.find(".accept-download-agreement"),i=t.is(":checked");i&&max7app.saveDownloadAgreementTicked()},t}(BaseDownloadDialogManagerExtension);max7app.downloaddialogmanager.registerExtension(new TosAgreementDownloadDialogManagerExtension);max7app.setContentStoreUrlManager=function(n){n.getGuidBreakout=function(n,t){return n.substring(0,2)+t+n.substring(2,4)+t+n.substring(4,6)+t+n.substring(6,8)+t+n};n.getGuidPathBreakout=function(n){return this.getGuidBreakout(n,"/")};max7app.contentStoreUrlManager=n;document.dispatchEvent(new CustomEvent("max7ContentStoreReady"))};class Max7DrawerMenu{constructor(n){var t=this;t.element=n;$(t.element).addClass("drawer-menu");max7app.createCloseButton().on("click",function(n){n.stopPropagation();n.preventDefault();t.closeMenu()}).appendTo(t.element);t.contents=$("<div/>",{"class":"drawer-menu-contents"}).appendTo(t.element)}addItem(n,t){var i=this;$(n).css("order",t).appendTo(i.contents);const r=new CustomEvent("DrawerMenuPopulated");document.dispatchEvent(r)}openMenu(){var n=this;$(n.element).addClass("open");max7app.showModalOverlay(!0,function(){n.closeMenu()})}closeMenu(){var n=this;$(n.element).removeClass("open");max7app.showModalOverlay(!1)}}max7validator=function(){this.validators={elementManager:{},push:function(n){var t=$(n.element).prop("id")||$(n.element).prop("class");this.elementManager[t]||(this.elementManager[t]={validators:[],validate:function(n){var u=!1,f,t,r,i;if(this.validators.length){for(f=this.validators.length,t=null,r=0;r<f;r++)i=this.validators[r],i.hideInvalidState(),i.isValid()||(t=t?t.isWarning?i:t:i,i.isWarning||(u=!0));t&&t.showInvalidState(n)}return!u},clear:function(){var t,n;if(this.validators.length)for(t=this.validators.length,n=0;n<t;n++)this.validators[n].hideInvalidState()}});this.elementManager[t].validators.push(n)}}};max7validator.prototype.isValid=function(){var r,n,u,t,i;for(r in this.validators.elementManager)if(n=this.validators.elementManager[r],n&&n.validators&&n.validators.length)for(u=n.validators.length,t=0;t<u;t++)if(i=n.validators[t],!i.isWarning&&!i.isValid())return!1;return!0};max7validator.prototype.performValidation=function(n){var i=!1,r,t;for(r in this.validators.elementManager)t=this.validators.elementManager[r],t&&t.validate&&(t.validate(n)||(i=!0));return!i};max7validator.prototype.performValidationOnElement=function(n,t){var i=this.validators.elementManager[n];i&&i.validate(t)};max7validator.prototype.clear=function(){var t,n;for(t in this.validators.elementManager)n=this.validators.elementManager[t],n&&n.clear&&n.clear()};max7validator.prototype.clearElement=function(n){var t=this.validators.elementManager[n];t&&t.clear()};max7baseValidator=function(){this.warning=null;this.verticalOffset=10;this.limitWarningWidth=!1;this.appendToInputContainer=!1};max7baseValidator.prototype.toggleInvalidState=function(n,t,i){i=i||!1;$(n).toggleClass("invalid",t===-2);$(n).toggleClass("warning",t===-1);t===-2&&i&&max7app.scrollToElement($(n))};max7baseValidator.prototype.showInvalidWarning=function(n,t){this.ensureWarningElementExists(n,t);this.limitWarningWidth&&this.warning.css("max-width",$(n).outerWidth()-(this.warning.outerWidth()-this.warning.width())+"px");this.warning.show().position({"of":$(n),my:"right bottom",at:"right top-8px",collision:"none"})};max7baseValidator.prototype.hideInvalidWarning=function(){this.warning!==null&&this.warning.hide()};max7baseValidator.prototype.ensureWarningElementExists=function(n,t){this.warning||(this.warning=$("<div>",{"class":this.isWarning?"validationWarning":"validationError",style:"display: none",text:t}).appendTo(this.appendToInputContainer?$(n).parent():$(document.body)))};max7baseSingleElementValidator=function(n,t){max7baseValidator.call(this);this.element=n;this.errorMessage=t;this.isWarning=!1};max7baseSingleElementValidator.prototype=Object.create(max7baseValidator.prototype);max7baseSingleElementValidator.prototype.hideInvalidState=function(){this.toggleInvalidState(this.element,0);this.hideInvalidWarning(this.element)};max7baseSingleElementValidator.prototype.showInvalidState=function(n){this.toggleInvalidState(this.element,-2,n);this.showInvalidWarning(this.element,this.errorMessage)};max7baseSingleElementValidator.prototype.showWarningState=function(){this.toggleInvalidState(this.element,-1);this.showInvalidWarning(this.element,this.errorMessage)};max7baseSingleElementValidator.prototype.performValidation=function(n){return this.isValid()?(this.hideInvalidState(),!0):(this.isWarning?this.showWarningState():this.showInvalidState(n),!1)};max7customValidator=function(n,t){max7baseSingleElementValidator.call(this,n,t)};max7customValidator.prototype=Object.create(max7baseSingleElementValidator.prototype);max7customValidator.prototype.isValid=function(){return!0};max7requiredValueValidator=function(n,t){max7baseSingleElementValidator.call(this,n,t)};max7requiredValueValidator.prototype=Object.create(max7baseSingleElementValidator.prototype);max7requiredValueValidator.prototype.isValid=function(){return $(this.element).val()!==""};max7minLengthValidator=function(n,t,i){max7baseSingleElementValidator.call(this,n,t);this.minLength=i||1};max7minLengthValidator.prototype=Object.create(max7baseSingleElementValidator.prototype);max7minLengthValidator.prototype.isValid=function(){return $(this.element).val().length>=this.minLength};max7regexValidator=function(n,t,i){max7baseSingleElementValidator.call(this,n,t);this.regex=i instanceof RegExp?i:typeof i=="string"||i instanceof String?new RegExp(i,"i"):/a*/i};max7regexValidator.prototype=Object.create(max7baseSingleElementValidator.prototype);max7regexValidator.prototype.isValid=function(){var n=$(this.element).val();return n?this.regex.test(n):!0};max7emailValidator=function(n,t){max7regexValidator.call(this,n,t,/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/i)};max7emailValidator.prototype=Object.create(max7regexValidator.prototype);max7validatorUtility={setValidateOnEvent:function(n,t,i,r,u,f){u&&this.setValidateOnEventForElement(n,t,i,r,u,u,f)},setValidateOnEventForElement:function(n,t,i,r,u,f,e){var l,o,y,v;if(u&&f){var h=null,s=null,c=null,a=null;if(typeof f=="string"||f instanceof String?(h=$("#"+f),c=f):(h=$(f),c=h.attr("id")),typeof u=="string"||u instanceof String?(s=$("#"+u),a=u):(s=$(u),a=s.attr("id")),h&&h.length&&s&&s.length)if(l=t+(i?"."+i:""),o=a+":"+c+"-"+t,e){if(n[o]||(n[o]={isSet:!1,validateFn:null}),y=function(n,t){return function(){n.performValidationOnElement(t,r,!1)}},e.performValidationOnElement){v=y(e,c);n[o].isSet=!0;n[o].validateFn=v;s.on(l,v)}else if(n[o]&&typeof n[o].validateFn=="function"){n[o].isSet=!0;s.on(l,n[o].validateFn)}}else n[o]&&(n[o].isSet=!1),s.off(l)}}};max7app.api.users={getFileDownloadPreferences:function(n){max7app.apiCall({connection:"jsonp",method:"User/GetDownloadPreferences",parameters:{user:max7app.userEntityId,platform:max7app.platformId,client:1},success:function(t){n&&n.success&&n.success(t)},error:function(t){n&&n.error&&n.error(t)}})}};class collapsibleSidebarManager{constructor(n,t){var i=this,r;i.animation_timeout=null;this._controls={sidebarContent:n,collapsedContent:t};this._isExpanded=!1;$("body").addClass("sidebars-collapsible");$(n).addClass("sidebar-collapsible-content");i._controls.closeButton=max7app.createCloseButton();i._controls.closeButton.addClass("sidebar-collapsible-close-button scroll-visible").on("click",function(n){n.preventDefault();n.stopPropagation();i.collapseSidebar(!0)});r=n.find(".sidebar-heading");r.length>0?i._controls.closeButton.appendTo(r):i._controls.closeButton.prependTo(n);$(t).on("click",function(n){n.preventDefault();n.stopPropagation();i.cancelAnimation();$(window).on("click.collapsibleSidebar",function(){i.collapseSidebar(!0)});$(i._controls.sidebarContent).on("click.collapsibleSidebar",function(n){n.stopPropagation()});i._isExpanded=!0;
3max7app.showNonModalBackground(!0);$(i._controls.collapsedContent).addClass("hidden");$(i._controls.sidebarContent).removeClass("closing").addClass("sidebar-expanded-content opening");i._controls.closeButton.addClass("visible");setTimeout(function(){$(i._controls.sidebarContent).addClass("fully-open")},400)});$(document).on("scroll",function(){if(i._isExpanded){var n=$(i._controls.sidebarContent).offset().top+$(i._controls.sidebarContent).outerHeight(),t=$(window).scrollTop();i._controls.closeButton.toggleClass("scroll-visible",t+100<n)}});$(document).on("mediaQueryEntered-md",function(){i.collapseSidebar(!1)})}cancelAnimation(){this.animation_timeout&&(window.clearTimeout(this.animation_timeout),this.animation_timeout=null)}collapseSidebar(n){var t=this;t.cancelAnimation();t._isExpanded=!1;max7app.showNonModalBackground(!1);t._controls.closeButton.removeClass("visible");$(window).off("click.collapsibleSidebar");$(t._controls.sidebarContent).off("click.collapsibleSidebar").removeClass("opening fully-open");n?($(t._controls.sidebarContent).addClass("closing"),t.animation_timeout=setTimeout(function(){t._finalizeCollapseSidebar()},200)):t._finalizeCollapseSidebar()}_finalizeCollapseSidebar(){var n=this;$(n._controls.collapsedContent).removeClass("hidden");$(n._controls.sidebarContent).removeClass("sidebar-expanded-content closing")}}class stackableSidebarManager{constructor(n,t){var i=this;this._controls={sidebarContent:n,displayButton:t};this._isExpanded=!1;$(n).addClass("sidebar-collapsible-content");i._controls.closeButton=max7app.createCloseButton();i._controls.closeButton.addClass("sidebar-collapsible-close-button scroll-visible").prependTo(n).on("click",function(n){n.preventDefault();n.stopPropagation();i._isExpanded=!1;$(i._controls.sidebarContent).removeClass("visible");$(i._controls.displayButton).show();i._controls.closeButton.removeClass("visible");window.scrollTo(0,0)});$(t).addClass("sidebar-display-content-button").on("click",function(n){n.preventDefault();n.stopPropagation();i._isExpanded=!0;$(i._controls.sidebarContent).addClass("visible");$(i._controls.displayButton).hide();i._controls.closeButton.addClass("visible")});$(document).on("scroll",function(){if(i._isExpanded){var n=$(i._controls.sidebarContent).offset().top+$(i._controls.sidebarContent).outerHeight(),t=$(window).scrollTop();i._controls.closeButton.toggleClass("scroll-visible",t+100<n)}})}}max7app.bibleVerseCounts=[[31,25,24,26,32,22,24,22,29,32,32,20,18,24,21,16,27,33,38,18,34,24,20,67,34,35,46,22,35,43,55,32,20,31,29,43,36,30,23,23,57,38,34,34,28,34,31,22,33,26],[22,25,22,31,23,30,25,32,35,29,10,51,22,31,27,36,16,27,25,26,36,31,33,18,40,37,21,43,46,38,18,35,23,35,35,38,29,31,43,38],[17,16,17,35,19,30,38,36,24,20,47,8,59,57,33,34,16,30,37,27,24,33,44,23,55,46,34],[54,34,51,49,31,27,89,26,23,36,35,16,33,45,41,50,13,32,22,29,35,41,30,25,18,65,23,31,40,16,54,42,56,29,34,13],[46,37,29,49,33,25,26,20,29,22,32,32,18,29,23,22,20,22,21,20,23,30,25,22,19,19,26,68,29,20,30,52,29,12],[18,24,17,24,15,27,26,35,27,43,23,24,33,15,63,10,18,28,51,9,45,34,16,33],[36,23,31,24,31,40,25,35,57,18,40,15,25,20,20,31,13,31,30,48,25],[22,23,18,22],[28,36,21,22,12,21,17,22,27,27,15,25,23,52,35,23,58,30,24,42,15,23,29,22,44,25,12,25,11,31,13],[27,32,39,12,25,23,29,18,13,19,27,31,39,33,37,23,29,33,43,26,22,51,39,25],[53,46,28,34,18,38,51,66,28,29,43,33,34,31,34,34,24,46,21,43,29,53],[18,25,27,44,27,33,20,29,37,36,21,21,25,29,38,20,41,37,37,21,26,20,37,20,30],[54,55,24,43,26,81,40,40,44,14,47,40,14,17,29,43,27,17,19,8,30,19,32,31,31,32,34,21,30],[17,18,17,22,14,42,22,18,31,19,23,16,22,15,19,14,19,34,11,37,20,12,21,27,28,23,9,27,36,27,21,33,25,33,27,23],[11,70,13,24,17,22,28,36,15,44],[11,20,32,23,19,19,73,18,38,39,36,47,31],[22,23,15,17,14,14,10,17,32,3],[22,13,26,21,27,30,21,22,35,22,20,25,28,22,35,22,16,21,29,29,34,30,17,25,6,14,23,28,25,31,40,22,33,37,16,33,24,41,30,24,34,17],[6,12,8,8,12,10,17,9,20,18,7,8,6,7,5,11,15,50,14,9,13,31,6,10,22,12,14,9,11,12,24,11,22,22,28,12,40,22,13,17,13,11,5,26,17,11,9,14,20,23,19,9,6,7,23,13,11,11,17,12,8,12,11,10,13,20,7,35,36,5,24,20,28,23,10,12,20,72,13,19,16,8,18,12,13,17,7,18,52,17,16,15,5,23,11,13,12,9,9,5,8,28,22,35,45,48,43,13,31,7,10,10,9,8,18,19,2,29,176,7,8,9,4,8,5,6,5,6,8,8,3,18,3,3,21,26,9,8,24,13,10,7,12,15,21,10,20,14,9,6],[33,22,35,27,23,35,27,36,18,32,31,28,25,35,33,33,28,24,29,30,31,29,35,34,28,28,27,28,27,33,31],[18,26,22,16,20,12,29,17,18,20,10,14],[17,17,11,16,16,13,13,14],[31,22,26,6,30,13,25,22,21,34,16,6,22,32,9,14,14,7,25,6,17,25,18,23,12,21,13,29,24,33,9,20,24,17,10,22,38,22,8,31,29,25,28,28,25,13,15,22,26,11,23,15,12,17,13,12,21,14,21,22,11,12,19,12,25,24],[19,37,25,31,31,30,34,22,26,25,23,17,27,22,21,21,27,23,15,18,14,30,40,10,38,24,22,17,32,24,40,44,26,22,19,32,21,28,18,16,18,22,13,30,5,28,7,47,39,46,64,34],[22,22,66,22,22],[28,10,27,17,17,14,27,18,11,22,25,28,23,23,8,63,24,32,14,49,32,31,49,27,17,21,36,26,21,26,18,32,33,31,15,38,28,23,29,49,26,20,27,31,25,24,23,35],[21,49,30,37,31,28,28,27,27,21,45,13],[11,23,5,19,15,11,16,14,17,15,12,14,16,9],[20,32,21],[15,16,15,13,27,14,17,14,15],[21],[17,10,10,11],[16,13,12,13,15,16,20],[15,13,19],[17,20,19],[18,15,20],[15,23],[21,13,10,14,11,15,14,23,17,12,17,14,9,21],[14,17,18,6],[25,23,17,25,48,34,29,34,38,42,30,50,58,36,39,28,27,35,30,34,46,46,39,51,46,75,66,20],[45,28,35,41,43,56,37,38,50,52,33,44,37,72,47,20],[80,52,38,44,39,49,50,56,62,42,54,59,35,35,32,31,37,43,48,47,38,71,56,53],[51,25,36,54,47,71,53,59,41,42,57,50,38,31,27,33,26,40,42,31,25],[26,47,26,37,42,15,60,40,43,48,30,25,52,28,41,40,34,28,41,38,40,30,35,27,27,32,44,31],[32,29,31,25,21,23,25,39,33,21,36,21,14,23,33,27],[31,16,23,21,13,20,40,13,27,33,34,31,13,40,58,24],[24,17,18,18,21,18,16,24,15,18,33,21,14],[24,21,29,31,26,18],[23,22,21,32,33,24],[30,30,21,23],[29,23,25,18],[10,20,13,18,28],[12,17,18],[20,15,16,16,25,21],[18,26,17,22],[16,15,15],[25],[14,18,19,16,14,20,28,13,28,39,40,29,25],[27,26,18,17,20],[25,25,22,19,14],[21,22,18],[10,29,24,21,21],[13],[14],[25],[20,29,22,11,14,17,17,13,21,11,19,17,18,20,8,21,18,24,21,15,27,21]];max7app.searchByBibleReferencePanel={initialize:function(n){var t=this;t.populateBibleBook(!0,"gen",0,0);$("#ctlBibleBook").on("change",function(){var n=$(this).val(),i=$("#ctlBibleChapter").val(),r=$("#ctlBibleVerse").val();t.populateBibleChapters(n,i,r);t.styleSearchByBibleReferenceSelections()});$("#ctlBibleChapter").on("change",function(){var n=$("#ctlBibleBook").val(),i=$(this).val(),r=$("#ctlBibleVerse").val();t.populateBibleVerses(n,i,r);t.styleSearchByBibleReferenceSelections()});$("#SortBibleTraditionalBtn").on("click",function(n){if(!max7app.areInPlaceTranslationKeysPressed(n)){var i=$("#ctlBibleBook").val(),r=$("#ctlBibleChapter").val(),u=$("#ctlBibleVerse").val();t.populateBibleBook(!1,i,r,u);t.styleSearchByBibleReferenceSelections()}});$("#SortBibleAlphabeticalBtn").on("click",function(n){if(!max7app.areInPlaceTranslationKeysPressed(n)){var i=$("#ctlBibleBook").val(),r=$("#ctlBibleChapter").val(),u=$("#ctlBibleVerse").val();t.populateBibleBook(!0,i,r,u);t.styleSearchByBibleReferenceSelections()}});$("#SearchByBibleReferenceGoBtn").on("click",function(n){if(n.stopPropagation(),n.preventDefault(),!max7app.areInPlaceTranslationKeysPressed(n)){var r=$("#ctlBibleBook option:selected").val(),t=$("#ctlBibleChapter").val(),i=$("#ctlBibleVerse").val(),u=max7app.urlManager.getUrl("search")+"?bibleref="+r+(t>0?"+"+t+(i>0?"."+i:""):"");window.location.href=u}});n&&(t.populateBibleBook(!0,n.book,n.chapter,n.verse),$("#ctlBibleBook").val(n.book),$("#ctlBibleChapter").val(n.chapter),$("#ctlBibleVerse").val(n.verse));t.styleSearchByBibleReferenceSelections()},styleSearchByBibleReferenceSelections:function(){},populateBibleBook:function(n,t,i,r){var o=this,s=$("#ctlBibleBook"),u,e,f;for(n?(u=max7appdata.biblebooks.slice(0),u.sort(function(n,t){return n.name.localeCompare(t.name)})):u=max7appdata.biblebooks,e="",f=0;f<u.length;f++)e+='<option value="'+u[f].code+'"'+(u[f].code==t?" selected":"")+">"+u[f].name+"<\/option>";s.html(e);o.populateBibleChapters(t,i,r)},populateBibleChapters:function(n,t,i){var o=this,s=$("#ctlBibleChapter"),e=max7app.getBibleBookByCode(n),u,r,f;if(e===null){alert("Could not find book for "+n);return}for(u='<option value="0"'+(t==0?" selected":"")+">"+max7app.displayText("SEARCH_BIBLE_ALL_CHAPTERS")+"<\/option>",r=1;r<=e.chapters;r++)u+='<option value="'+r+'"'+(r==t?" selected":"")+">"+r+"<\/option>";s.html(u);f=document.getElementById("ctlBibleChapter");f.selectedIndex==-1&&(f.selectedIndex=t=0);o.populateBibleVerses(n,t,i)},populateBibleVerses:function(n,t,i){var s=$("#ctlBibleVerse"),f='
3<option value="0"'+(i==0?" selected":"")+">"+max7app.displayText("SEARCH_BIBLE_ALL_VERSES")+"<\/option>",e,o,r,u;if(t!=0)for(e=max7app.getBibleBookByCode(n),o=max7app.bibleVerseCounts[e.bookno-1][t-1],r=1;r<=o;r++)f+='<option value="'+r+'"'+(r==i?" selected":"")+">"+r+"<\/option>";s.html(f);u=document.getElementById("ctlBibleVerse");u.selectedIndex===-1&&(u.selectedIndex=0)}};$.widget("max7.categoriessidebar",{options:{categoriesPerGroup:3,categoriesFilter:null},_create:function(){var n=this;$(n.element).addClass(["sidebar-category-list","sidebar-padding"]);n._renderGroups()},_renderGroups:function(){var n=this,t=max7app.getResourceCategories(!0);$(n.element).empty();$.each(t,function(t,i){n._renderGroup(i)})},_renderGroup:function(n){var t=this,i=$(`<div class="category-group"></div>`),u=$(`<div class="group-heading"></div>`).on("click",function(){var n=$(this).closest(".category-group");$(t.element).find(".category-group").each(function(t,i){i==n[0]&&$(this).toggleClass("expanded")})}).appendTo(i),r;$("<div/>",{text:n.Title,"class":"group-heading-text"}).appendTo(u);
3$(`<svg class="group-heading-arrow" viewBox="0 0 6 9" xmlns="http://www.w3.org/2000/svg"><path d="M5.76512 4.35398L1.30806 8.0184C0.786049 8.44758 -8.89622e-08 8.07623 -1.48042e-07 7.40044L-7.14468e-07 0.921284C-7.73547e-07 0.245493 0.786048 -0.125852 1.30806 0.303327L5.76512 3.96775C5.88676 4.06776 5.88676 4.25397 5.76512 4.35398Z"/></svg>`).appendTo(u);r=$("<div class='items-list'><\/div>").appendTo(i);$.each(n.ResourceCategories,function(n,i){t._renderItem(i,r)});r.children().length>0&&i.appendTo(t.element)},_renderItem:function(n,t){var i=this,r,u;n.children&&n.children.length>0?$.each(n.children,function(n,r){i._renderItem(r,t)}):(!Array.isArray(i.options.categoriesFilter)||i.options.categoriesFilter.includes(n.id))&&(r=max7app.urlManager.getUrl("search")+"?category="+n.id,u=$("<div class='item'><\/div>").appendTo(t),$(`<a href='${r}'>${n.title}</a>`).appendTo(u))}});max7app.dataNormalizers=max7app.dataNormalizers||{};max7app.dataNormalizers.ClientResourceList={normalize:function(n){return n&&(n.Resources=n.Resources||[],n.Groups=n.Groups||[],$.each(n.Resources,function(n,t){max7app.dataNormalizers.ClientResourceListItem.normalize(t)})),n}};max7app.dataNormalizers.ClientResourceListItem={normalize:function(n){return n&&!n._isNormalized&&(n.Categories=n.Categories||[],n.Languages=n.Languages||[],n.FileTypes=n.FileTypes||[],n.Components=n.Components||[],n.InGroups=n.InGroups||[],n.ResourceType=n.ResourceType==null?max7app.RESOURCETYPE_RESOURCE:n.ResourceType,n.AltTitle=n.AltTitle||"",n.AverageRating=n.AverageRating==null?2.5:n.AverageRating,n.ModerationStatus=n.ModerationStatus==null?1:n.ModerationStatus,n.ImageIndex=n.ImageIndex==null?1:n.ImageIndex,n.Access=n.Access==null?3:n.Access,n.Active=n.Active==null?!0:n.Active,n.IsFavorite=n.IsFavorite==null?!1:n.IsFavorite,n.CanEdit=n.CanEdit==null?!1:n.CanEdit,n.OwnedByLibraryID=n.OwnedByLibraryID||null,n.ForGroupingOnly=n.ForGroupingOnly==null?!1:n.ForGroupingOnly,$.each(n.Components,function(n,t){max7app.dataNormalizers.ClientResourceListItemComponent.normalize(t)}),n._isNormalized=!0),n}};max7app.dataNormalizers.SimpleClientResourceList={normalize:function(n){return n&&(n.resources=n.resources||[],$.each(n.resources,function(n,t){max7app.dataNormalizers.SimpleClientResourceListItem.normalize(t)})),n}};max7app.dataNormalizers.SimpleClientResourceListItem={normalize:function(n){return n&&!n._isNormalized&&(n.Categories=n.Categories||[],n.ResourceType=n.ResourceType===undefined?max7app.RESOURCETYPE_RESOURCE:n.ResourceType,n.AltTitle=n.AltTitle||n.Title,n.ModerationStatus=n.ModerationStatus===undefined?1:n.ModerationStatus,n.ImageIndex=n.ImageIndex===undefined?1:n.ImageIndex,n.Access=n.Access===undefined?3:n.Access,n.Active=n.Active===undefined?!0:n.Active,n.IsFavorite=n.IsFavorite===undefined?!1:n.IsF
3avorite,n.LibraryResourceCount=n.LibraryResourceCount===undefined?0:n.LibraryResourceCount,n._isNormalized=!0),n}};max7app.dataNormalizers.ClientResourceListItemComponent={normalize:function(n){return n&&(n.Title=n.Title||"",n.AltTitle=n.AltTitle||"",n.PreviewCode=n.PreviewCode||""),n}};$.widget("max7.scaler",{options:{width:null,height:null,scale:1,scaleTarget:null},_create:function(){var n=this;n.scaleTarget=null;n.options.scaleTarget&&(n.scaleTarget=n.options.scaleTarget);n.scaleTarget||(n.scaleTarget=$(n.element).find(".scaler-target").first());n.scaleTarget&&n.scaleTarget.length!=0||(n.scaleTarget=$(n.element).find("*").first());n.baseWidth=n.options.width!==null?n.options.width:`${n.scaleTarget.outerWidth(!1)}px`;n.baseHeight=n.options.height!==null?n.options.height:`${n.scaleTarget.outerHeight(!1)}px`;n.scale(n.options.scale)},scale:function(n){var t=this;t.zoom!==n&&(t.zoom=n,n==1?($(t.element).css({width:"",height:""}),$(t.scaleTarget).css("transform","")):($(t.element).css({width:`calc(${n} * ${t.baseWidth})`,height:`calc(${n} * ${t.baseHeight})`}),$(t.scaleTarget).css("transform",`scale: ${n}`)))}});$.widget("max7.responsiveautoscaler",{options:{width:null,height:null,scale:1,scaleTarget:null},_create:function(){var n=this;$(n.element).scaler({width:n.options.width,height:n.options.height,scale:max7app.responsiveScale,scaleTarget:n.options.scaleTarget});$(document).on("Max7ResponsiveScale",function(t){n.scale(t.detail.scale)})},scale:function(n){var t=this;$(t.element).scaler("scale",n)}});class ResponsiveScaleBroadcaster{constructor(n){var t=this;t.desiredWidth=n;t.currentScale=1;$(window).on("resize",function(){t.reassessOptimalScale()});t.reassessOptimalScale()}reassessOptimalScale(){var n=this,t;if(n.desiredWidth&&(t=Math.min(1,$(window).width()/n.desiredWidth),t!==n.currentScale)){n.currentScale=t;const i=new CustomEvent("Max7ResponsiveScale",{detail:{scale:t}});document.dispatchEvent(i)}}}$.widget("max7.languageselect",{defaultElement:"<select>",_NOLANGUAGECODE:"NOLANGUAGE",options:{selectedLanguageCode:null,list:"visibletopublic",displaynative:!1,favorCurrent:!1,includeNoLanguage:!1,noLanguageText:max7app.displayText("NoLanguageText"),change:null},_create:function(){var n=this;if(n._buildMasterList(),n._buildOptionElements(),n.options.selectedLanguageCode&&$(n.element).val(n.options.selectedLanguageCode),n.options.change)$(n.element).on("change",n.options.change)},_destroy:function(){},_buildMasterList:function(){var n=this,t=[];switch(n.options.list){case"all":$.each(max7appdata.cultures,function(n,i){i.code!==""&&i.code!=="int"&&t.push(i)});break;case"testing":$.each(max7appdata.cultures,function(n,i){i.uiimplementation>0&&t.push(i)});break;case"implemented":$.each(max7appdata.cultures,function(n,i){i.uiimplementation===2&&t.push(i)});break;case"visibletopublic":$.each(max7appdata.cultures,function(n,i){i.visibletopublic&&t.push(i)});break;default:throw"Invalid list option";}this._masterlist=[];$.each(t,function(t,i){var r;r=n.options.displaynative?i.nativename:i.name;r!==""&&n._masterlist.push({code:i.code,text:r})});n._masterlist.sort(function(n,t){return n.text.localeCompare(t.text)});this.options.favorCurrent&&(n._moveLanguageToStartOfList(n._masterlist,max7app.languageCode),n._moveLanguageToStartOfList(n._masterlist,max7app.filterCultureCode));this.options.includeNoLanguage&&this._masterlist.splice(0,0,{code:"",text:this.options.noLanguageText})},_encodeLanguageCodeForOption:function(n){return n===null?"":n===""?this._NOLANGUAGECODE:n},_decodeLanguageCodeFromOption:function(n){return n===this._NOLANGUAGECODE?"":n},_buildOptionElements:function(){var n=this,t="",i=n.getSelectedLanguageCode();$.each(n._masterlist,function(r,u){var f=u.code===i;t+="<option value='"+n._encodeLanguageCodeForOption(u.code)+"'";f&&(t+=" selected");t+=">"+u.text+"<\/option>"});$(n.element).html(t)},_moveLanguageToStartOfList:function(n,t){var i=-1;$.each(n,function(n,r){i===-1&&r.code===t&&(i=n,firstitem=r)});i>-1&&(n.splice(i,1),n.splice(0,0,firstitem))},getSelectedLanguageCode:function(){return this._decodeLanguageCodeFromOption($(this.element).val())},getSelectedLanguageID:function(){const n=this.getSelectedLanguageCode();if(n===null)return null;const t=max7app.getCultureByCode(n);return t===null?null:t.id},setSelectedLanguageCode:function(n){var t=this;$(t.element).val(t._encodeLanguageCodeForOption(n))}}),function(n,t){typeof define=="function"&&define.amd?define(["jquery"],t):t(n.jQuery)}(this,function(n){"use strict";function f(i){if(t.webkit&&!i)return{height:0,width:0};if(!t.data.outer){var r={border:"none","box-sizing":"content-box",height:"200px",margin:"0",padding:"0",width:"200px"};t.data.inner=n("<div>").css(n.extend({},r));t.data.outer=n("<div>").css(n.extend({left:"-1000px",overflow:"scroll",position:"absolute",top:"-1000px"},r)).append(t.data.inner).appendTo("body")}return t.data.outer.scrollLeft(1e3).scrollTop(1e3),{height:Math.ceil(t.data.outer.offset().top-t.data.inner.offset().top||0),width:Math.ceil(t.data.outer.offset().left-t.data.inner.offset().left||0)}}function h(){var n=f(!0);return!(n.height||n.width)}function e(n){var t=n.originalEvent;return t.axis&&t.axis===t.HORIZONTAL_AXIS?!1:t.wheelDeltaX?!1:!0}var s=!1,t={data:{index:0,name:"scrollbar"},macosx:/mac/i.test(navigator.platform),mobile:/android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent),overlay:null,scroll:null,scrolls:[],webkit:/webkit/i.test(navigator.userAgent)&&!/edge\/\d+/i.test(navigator.userAgent)},r,u,o,i;t.scrolls.add=function(n){this.remove(n).push(n)};t.scrolls.remove=function(t){while(n.inArray(t,this)>=0)this.splice(n.inArray(t,this),1);return this};r={autoScrollSize:!0,autoUpdate:!0,debug:!1,disableBodyScroll:!1,duration:200,ignoreMobile:!1,ignoreOverlay:!1,scrollStep:30,showArrows:!1,stepScrolling:!0,scrollx:null,scrolly:null,onDestroy:null,onInit:null,onScroll:null,onUpdate:null};u=function(u){t.scroll||(t.overlay=h(),t.scroll=f(),i(),n(window).resize(function(){var r=!1,n;t.scroll&&(t.scroll.height||t.scroll.width)&&(n=f(),(n.height!==t.scroll.height||n.width!==t.scroll.width)&&(t.scroll=n,r=!0));i(r)}));this.container=u;this.namespace=".scrollbar_"+t.data.index++;this.options=n.extend({},r,window.jQueryScrollbarOptions||{});this.scrollTo=null;this.scrollx={};this.scrolly={};u.data(t.data.name,this);t.scrolls.add(this)};
3u.prototype={destroy:function(){if(this.wrapper){this.container.removeData(t.data.name);t.scrolls.remove(this);var i=this.container.scrollLeft(),r=this.container.scrollTop();this.container.insertBefore(this.wrapper).css({height:"",margin:"","max-height":""}).removeClass("scroll-content scroll-scrollx_visible scroll-scrolly_visible").off(this.namespace).scrollLeft(i).scrollTop(r);this.scrollx.scroll.removeClass("scroll-scrollx_visible").find("div").andSelf().off(this.namespace);this.scrolly.scroll.removeClass("scroll-scrolly_visible").find("div").andSelf().off(this.namespace);this.wrapper.remove();n(document).add("body").off(this.namespace);n.isFunction(this.options.onDestroy)&&this.options.onDestroy.apply(this,[this.container])}},init:function(i){var o=this,r=this.container,c=this.containerWrapper||r,s=this.namespace,f=n.extend(this.options,i||{}),u={x:this.scrollx,y:this.scrolly},h=this.wrapper,a={scrollLeft:r.scrollLeft(),scrollTop:r.scrollTop()},l;if(t.mobile&&f.ignoreMobile||t.overlay&&f.ignoreOverlay||t.macosx&&!t.webkit)return!1;if(h)c.css({height:"auto","margin-bottom":t.scroll.height*-1+"px","margin-right":t.scroll.width*-1+"px","max-height":""});else{this.wrapper=h=n("<div>").addClass("scroll-wrapper").addClass(r.attr("class")).css("position",r.css("position")=="absolute"?"absolute":"relative").insertBefore(r).append(r);r.is("textarea")&&(this.containerWrapper=c=n("<div>").insertBefore(r).append(r),h.addClass("scroll-textarea"));c.addClass("scroll-content").css({height:"auto","margin-bottom":t.scroll.height*-1+"px","margin-right":t.scroll.width*-1+"px","max-height":""});r.on("scroll"+s,function(){n.isFunction(f.onScroll)&&f.onScroll.call(o,{maxScroll:u.y.maxScrollOffset,scroll:r.scrollTop(),size:u.y.size,visible:u.y.visible},{maxScroll:u.x.maxScrollOffset,scroll:r.scrollLeft(),size:u.x.size,visible:u.x.visible});u.x.isVisible&&u.x.scroll.bar.css("left",r.scrollLeft()*u.x.kx+"px");u.y.isVisible&&u.y.scroll.bar.css("top",r.scrollTop()*u.y.kx+"px")});h.on("scroll"+s,function(){h.scrollTop(0).scrollLeft(0)});if(f.disableBodyScroll){l=function(n){e(n)?u.y.isVisible&&u.y.mousewheel(n):u.x.isVisible&&u.x.mousewheel(n)};h.on("MozMousePixelScroll"+s,l);h.on("mousewheel"+s,l);if(t.mobile)h.on("touchstart"+s,function(t){var i=t.originalEvent.touches&&t.originalEvent.touches[0]||t,u={pageX:i.pageX,pageY:i.pageY},f={left:r.scrollLeft(),top:r.scrollTop()};n(document).on("touchmove"+s,function(n){var t=n.originalEvent.targetTouches&&n.originalEvent.targetTouches[0]||n;r.scrollLeft(f.left+u.pageX-t.pageX);r.scrollTop(f.top+u.pageY-t.pageY);n.preventDefault()});n(document).on("touchend"+s,function(){n(document).off(s)})})}n.isFunction(f.onInit)&&f.onInit.apply(this,[r])}n.each(u,function(t,i){var v=null,l=1,c=t==="x"?"scrollLeft":"scrollTop",a=f.scrollStep,y=function(){var n=r[c]();r[c](n+a);l==1&&n+a>=h&&(n=r[c]());l==-1&&n+a<=h&&(n=r[c]());r[c]()==n&&v&&v()},h=0;if(!i.scroll){i.scroll=o._getScroll(f["scroll"+t]).addClass("scroll-"+t);f.showArrows&&i.scroll.addClass("scroll-element_arrows_visible");i.mousewheel=function(n){if(!i.isVisible||t==="x"&&e(n))return!0;if(t==="y"&&!e(n))return u.x.mousewheel(n),!0;var f=n.originalEvent.wheelDelta*-1||n.originalEvent.detail,s=i.size-i.visible-i.offset;return(f>0&&h<s||f<0&&h>0)&&(h=h+f,h<0&&(h=0),h>s&&(h=s),o.scrollTo=o.scrollTo||{},o.scrollTo[c]=h,setTimeout(function(){o.scrollTo&&(r.stop().animate(o.scrollTo,240,"linear",function(){h=r[c]()}),o.scrollTo=null)},1)),n.preventDefault(),!1};i.scroll.on("MozMousePixelScroll"+s,i.mousewheel).on("mousewheel"+s,i.mousewheel).on("mouseenter"+s,function(){h=r[c]()});i.scroll.find(".scroll-arrow, .scroll-element_track").on("mousedown"+s,function(u){if(u.which!=1)return!0;l=1;var e={eventOffset:u[t==="x"?"pageX":"pageY"],maxScrollValue:i.size-i.visible-i.offset,scrollbarOffset:i.scroll.bar.offset()[t==="x"?"left":"top"],scrollbarSize:i.scroll.bar[t==="x"?"outerWidth":"outerHeight"]()},s=0,p=0;return n(this).hasClass("scroll-arrow")?(l=n(this).hasClass("scroll-arrow_more")?1:-1,a=f.scrollStep*l,h=l>0?e.maxScrollValue:0):(l=e.eventOffset>e.scrollbarOffset+e.scrollbarSize?1:e.eventOffset<e.scrollbarOffset?-1:0,a=Math.round(i.visible*.75)*l,h=e.eventOffset-e.scrollbarOffset-(f.stepScrolling?l==1?e.scrollbarSize:0:Math.round(e.scrollbarSize/2)),h=r[c]()+h/i.kx),o.scrollTo=o.scrollTo||{},o.scrollTo[c]=f.stepScrolling?r[c]()+a:h,f.stepScrolling&&(v=function(){h=r[c]();clearInterval(p);clearTimeout(s);s=0;p=0},s=setTimeout(function(){p=setInterval(y,40)},f.duration+100)),setTimeout(function(){o.scrollTo&&(r.animate(o.scrollTo,f.duration),o.scrollTo=null)},1),o._handleMouseDown(v,u)});i.scroll.bar.on("mousedown"+s,function(u){if(u.which!=1)return!0;var f=u[t==="x"?"pageX":"pageY"],e=r[c]();i.scroll.addClass("scroll-draggable");n(document).on("mousemove"+s,function(n){var u=parseInt((n[t==="x"?"pageX":"pageY"]-f)/i.kx,10);r[c](e+u)});return o._handleMouseDown(function(){i.scroll.removeClass("scroll-draggable");h=r[c]()},u)})}});n.each(u,function(n,t){var i="scroll-scroll"+n+"_visible",r=n=="x"?u.y:u.x;t.scroll.removeClass(i);r.scroll.removeClass(i);c.removeClass(i)});n.each(u,function(t,i){n.extend(i,t=="x"?{offset:parseInt(r.css("left"),10)||0,size:r.prop("scrollWidth"),visible:h.width()}:{offset:parseInt(r.css("top"),10)||0,size:r.prop("scrollHeight"),visible:h.height()})});this._updateScroll("x",this.scrollx);this._updateScroll("y",this.scrolly);n.isFunction(f.onUpdate)&&f.onUpdate.apply(this,[r]);n.each(u,function(n,t){var e=n==="x"?"left":"top",o=n==="x"?"outerWidth":"outerHeight",h=n==="x"?"width":"height",c=parseInt(r.css(e),10)||0,i=t.size,u=t.visible+c,s=t.scroll.size[o]()+(parseInt(t.scroll.size.css(e),10)||0);f.autoScrollSize&&(t.scrollbarSize=parseInt(s*u/i,10),t.scroll.bar.css(h,t.scrollbarSize+"px"));t.scrollbarSize=t.scroll.bar[o]();t.kx=(s-t.scrollbarSize)/(i-u)||1;t.maxScrollOffset=i-u});r.scrollLeft(a.scrollLeft).scrollTop(a.scrollTop).trigger("scroll")},_getScroll:function(t){var i={advanced:'<div class="scroll-element">
3<div class="scroll-element_corner"><\/div><div class="scroll-arrow scroll-arrow_less"><\/div><div class="scroll-arrow scroll-arrow_more"><\/div><div class="scroll-element_outer"><div class="scroll-element_size"><\/div><div class="scroll-element_inner-wrapper"><div class="scroll-element_inner scroll-element_track"><div class="scroll-element_inner-bottom"><\/div><\/div><\/div><div class="scroll-bar"><div class="scroll-bar_body"><div class="scroll-bar_body-inner"><\/div><\/div><div class="scroll-bar_bottom"><\/div><div class="scroll-bar_center"><\/div><\/div><\/div><\/div>',simple:'<div class="scroll-element"><div class="scroll-element_outer"><div class="scroll-element_size"><\/div><div class="scroll-element_track"><\/div><div class="scroll-bar"><\/div><\/div><\/div>'};return i[t]&&(t=i[t]),t||(t=i.simple),t=typeof t=="string"?n(t).appendTo(this.wrapper):n(t),n.extend(t,{bar:t.find(".scroll-bar"),size:t.find(".scroll-element_size"),track:t.find(".scroll-element_track")}),t},_handleMouseDown:function(t,i){var r=this.namespace;n(document).on("blur"+r,function(){n(document).add("body").off(r);t&&t()});n(document).on("dragstart"+r,function(n){return n.preventDefault(),!1});n(document).on("mouseup"+r,function(){n(document).add("body").off(r);t&&t()});n("body").on("selectstart"+r,function(n){return n.preventDefault(),!1});return i&&i.preventDefault(),!1},_updateScroll:function(i,r){var u=this.container,o=this.containerWrapper||u,f="scroll-scroll"+i+"_visible",e=i==="x"?this.scrolly:this.scrollx,l=parseInt(this.container.css(i==="x"?"left":"top"),10)||0,s=this.wrapper,c=r.size,h=r.visible+l;r.isVisible=c-h>1;r.isVisible?(r.scroll.addClass(f),e.scroll.addClass(f),o.addClass(f)):(r.scroll.removeClass(f),e.scroll.removeClass(f),o.removeClass(f));i==="y"&&(u.is("textarea")||c<h?o.css({height:h+t.scroll.height+"px","max-height":"none"}):o.css({"max-height":h+t.scroll.height+"px"}));(r.size!=u.prop("scrollWidth")||e.size!=u.prop("scrollHeight")||r.visible!=s.width()||e.visible!=s.height()||r.offset!=(parseInt(u.css("left"),10)||0)||e.offset!=(parseInt(u.css("top"),10)||0))&&(n.extend(this.scrollx,{offset:parseInt(u.css("left"),10)||0,size:u.prop("scrollWidth"),visible:s.width()}),n.extend(this.scrolly,{offset:parseInt(u.css("top"),10)||0,size:this.container.prop("scrollHeight"),visible:s.height()}),this._updateScroll(i==="x"?"y":"x",e))}};o=u;n.fn.scrollbar=function(i,r){return typeof i!="string"&&(r=i,i="init"),typeof r=="undefined"&&(r=[]),n.isArray(r)||(r=[r]),this.not("body, .scroll-wrapper").each(function(){var f=n(this),u=f.data(t.data.name);(u||i==="init")&&(u||(u=new o(f)),u[i]&&u[i].apply(u,r))}),this};n.fn.scrollbar.options=r;i=function(){var n=0,r=0;return function(u){for(var o,c,f,e,l,a,h=0;h<t.scrolls.length;
3h++)f=t.scrolls[h],o=f.container,c=f.options,e=f.wrapper,l=f.scrollx,a=f.scrolly,(u||c.autoUpdate&&e&&e.is(":visible")&&(o.prop("scrollWidth")!=l.size||o.prop("scrollHeight")!=a.size||e.width()!=l.visible||e.height()!=a.visible))&&(f.init(),c.debug&&(window.console&&console.log({scrollHeight:o.prop("scrollHeight")+":"+f.scrolly.size,scrollWidth:o.prop("scrollWidth")+":"+f.scrollx.size,visibleHeight:e.height()+":"+f.scrolly.visible,visibleWidth:e.width()+":"+f.scrollx.visible},!0),r++));s&&r>10?(window.console&&console.log("Scroll updates exceed 10"),i=function(){}):(clearTimeout(n),n=setTimeout(i,300))}}();window.angular&&function(n){n.module("jQueryScrollbar",[]).provider("jQueryScrollbar",function(){var t=r;return{setOptions:function(i){n.extend(t,i)},$get:function(){return{options:n.copy(t)}}}}).directive("jqueryScrollbar",["jQueryScrollbar","$parse",function(n,t){return{restrict:"AC",link:function(i,r,u){var f=t(u.jqueryScrollbar),e=f(i);r.scrollbar(e||n.options).on("$destroy",function(){r.scrollbar("destroy")})}}}])}(window.angular)}),function(n){"use strict";var t={init:function(i){return this.each(function(){this.self=n(this);t.destroy.call(this.self);this.opt=n.extend(!0,{},n.fn.raty.defaults,i);t._adjustCallback.call(this);t._adjustNumber.call(this);t._adjustHints.call(this);this.opt.score=t._adjustedScore.call(this,this.opt.score);this.opt.starType!=="img"&&t._adjustStarType.call(this);t._adjustPath.call(this);t._createStars.call(this);this.opt.cancel&&t._createCancel.call(this);this.opt.precision&&t._adjustPrecision.call(this);t._createScore.call(this);t._apply.call(this,this.opt.score);t._setTitle.call(this,this.opt.score);t._target.call(this,this.opt.score);this.opt.readOnly?t._lock.call(this):(this.style.cursor="pointer",t._binds.call(this))})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName","target"],n=0;n<t.length;n++)typeof this.opt[t[n]]=="function"&&(this.opt[t[n]]=this.opt[t[n]].call(this))},_adjustedScore:function(n){return n?t._between(n,0,this.opt.number):n},_adjustHints:function(){var f,t,n,i,u,r;if(this.opt.hints||(this.opt.hints=[]),this.opt.halfShow||this.opt.half)for(f=this.opt.precision?10:2,t=0;t<this.opt.number;t++)for(n=this.opt.hints[t],Object.prototype.toString.call(n)!=="[object Array]"&&(n=[n]),this.opt.hints[t]=[],i=0;i<f;i++)u=n[i],r=n[n.length-1],r===undefined&&(r=null),this.opt.hints[t][i]=u===undefined?r:u},_adjustNumber:function(){this.opt.number=t._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"";this.opt.path&&this.opt.path.charAt(this.opt.path.length-1)!=="/"&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0},_adjustStarType:function(){var t=["cancelOff","cancelOn","starHalf","starOff","starOn"],n;for(this.opt.path="",n=0;n<t.length;n++)this.opt[t[n]]=this.opt[t[n]].replace(".","-")},_apply:function(n){t._fill.call(this,n);n&&(n>0&&this.score.val(n),t._roundStars.call(this,n))},_between:function(n,t,i){return Math.min(Math.max(parseFloat(n),t),i)},_binds:function(){this.cancel&&(t._bindOverCancel.call(this),t._bindClickCancel.call(this),t._bindOutCancel.call(this));t._bindOver.call(this);t._bindClick.call(this);t._bindOut.call(this)},_bindClick:function(){var i=this;i.stars.on("click.raty",function(r){var f=!0,u=i.opt.half||i.opt.precision?i.self.data("score"):this.alt||n(this).data("alt");i.opt.click&&(f=i.opt.click.call(i,+u,r));(f||f===undefined)&&(i.opt.half&&!i.opt.precision&&(u=t._roundHalfScore.call(i,u)),t._apply.call(i,u))})},_bindClickCancel:function(){var n=this;n.cancel.on("click.raty",function(t){n.score.removeAttr("value");n.opt.click&&n.opt.click.call(n,null,t)})},_bindOut:function(){var n=this;n.self.on("mouseleave.raty",function(i){var r=+n.score.val()||undefined;t._apply.call(n,r);t._target.call(n,r,i);t._resetTitle.call(n);n.opt.mouseout&&n.opt.mouseout.call(n,r,i)})},_bindOutCancel:function(){var n=this;n.cancel.on("mouseleave.raty",function(i){var r=n.opt.cancelOff,u;n.opt.starType!=="img"&&(r=n.opt.cancelClass+" "+r);t._setIcon.call(n,this,r);n.opt.mouseout&&(u=+n.score.val()||undefined,n.opt.mouseout.call(n,u,i))})},_bindOver:function(){var n=this,i=n.opt.half?"mousemove.raty":"mouseover.raty";n.stars.on(i,function(i){var r=t._getScoreByPosition.call(n,i,this);t._fill.call(n,r);n.opt.half&&(t._roundStars.call(n,r,i),t._setTitle.call(n,r,i),n.self.data("score",r));t._target.call(n,r,i);n.opt.mouseover&&n.opt.mouseover.call(n,r,i)})},_bindOverCancel:function(){var n=this;n.cancel.on("mouseover.raty",function(i){var u=n.opt.path+n.opt.starOff,r=n.opt.cancelOn;n.opt.starType==="img"?n.stars.attr("src",u):(r=n.opt.cancelClass+" "+r,n.stars.attr("class",u));t._setIcon.call(n,this,r);t._target.call(n,null,i);n.opt.mouseover&&n.opt.mouseover.call(n,null)})},_buildScoreField:function(){return n("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var i=this.opt.path+this.opt.cancelOff,t=n("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":this.opt.cancelClass});this.opt.starType==="img"?t.attr({src:i,alt:"x"}):t.attr("data-alt","x").addClass(i);this.opt.cancelPlace==="left"?this.self.prepend("&#160;").prepend(t):this.self.append("&#160;").append(t);this.cancel=t},_createScore:function(){var i=n(this.opt.targetScore);this.score=i.length?i:t._buildScoreField.call(this)},_createStars:function(){for(var u,r,i=1;i<=this.opt.number;i++)u=t._nameForIndex.call(this,i),r={alt:i,src:this.opt.path+this.opt[u]},this.opt.starType!=="img"&&(r={"data-alt":i,"class":r.src}),r.title=t._getHint.call(this,i),n("<"+this.opt.starType+" />",r).appendTo(this),this.opt.space&&this.self.append(i<this.opt.number?"&#160;":"");this.stars=this.self.children(this.opt.starType)},_error:function(t){n(this).text(t);n.error(t)}
3,_fill:function(n){for(var r,e,o,u,f=0,i=1;i<=this.stars.length;i++)e=this.stars[i-1],o=t._turnOn.call(this,i,n),this.opt.iconRange&&this.opt.iconRange.length>f?(u=this.opt.iconRange[f],r=t._getRangeIcon.call(this,u,o),i<=u.range&&t._setIcon.call(this,e,r),i===u.range&&f++):(r=this.opt[o?"starOn":"starOff"],t._setIcon.call(this,e,r))},_getFirstDecimal:function(n){var t=n.toString().split(".")[1],i=0;return t&&(i=parseInt(t.charAt(0),10),t.slice(1,5)==="9999"&&i++),i},_getRangeIcon:function(n,t){return t?n.on||this.opt.starOn:n.off||this.opt.starOff},_getScoreByPosition:function(i,r){var u=parseInt(r.alt||r.getAttribute("data-alt"),10),f,e;return this.opt.half&&(f=t._getWidth.call(this),e=parseFloat((i.pageX-n(r).offset().left)/f),u=u-1+e),u},_getHint:function(n,i){if(n!==0&&!n)return this.opt.noRatedMsg;var r=t._getFirstDecimal.call(this,n),o=Math.ceil(n),f=this.opt.hints[(o||1)-1],u=f,e=!i||this.move;return this.opt.precision?(e&&(r=r===0?9:r-1),u=f[r]):(this.opt.halfShow||this.opt.half)&&(r=e&&r===0?1:r>5?1:0,u=f[r]),u===""?"":u||n},_getWidth:function(){var n=this.stars[0].width||parseFloat(this.stars.eq(0).css("font-size"));return n||t._error.call(this,"Could not get the icon width!"),n},_lock:function(){var n=t._getHint.call(this,this.score.val());this.style.cursor="";this.title=n;this.score.prop("readonly",!0);this.stars.prop("title",n);this.cancel&&this.cancel.hide();this.self.data("readonly",!0)},_nameForIndex:function(n){return this.opt.score&&this.opt.score>=n?"starOn":"starOff"},_resetTitle:function(){for(var n=0;n<this.opt.number;n++)this.stars[n].title=t._getHint.call(this,n+1)},_roundHalfScore:function(n){var r=parseInt(n,10),i=t._getFirstDecimal.call(this,n);return i!==0&&(i=i>5?1:.5),r+i},_roundStars:function(n,i){var u=(n%1).toFixed(2),r,f,e;i||this.move?r=u>.5?"starOn":"starHalf":u>this.opt.round.down&&(r="starOn",this.opt.halfShow&&u<this.opt.round.up?r="starHalf":u<this.opt.round.full&&(r="starOff"));r&&(f=this.opt[r],e=this.stars[Math.ceil(n)-1],t._setIcon.call(this,e,f))},_setIcon:function(n,t){n[this.opt.starType==="img"?"src":"className"]=this.opt.path+t},_setTarget:function(n,t){t&&(t=this.opt.targetFormat.toString().replace("{score}",t));n.is(":input")?n.val(t):n.html(t)},_setTitle:function(n,i){if(n){var r=parseInt(Math.ceil(n),10),u=this.stars[r-1];u.title=t._getHint.call(this,n,i)}},_target:function(i,r){var u,f,e;this.opt.target&&(u=n(this.opt.target),u.length||t._error.call(this,"Target selector invalid or missing!"),f=r&&r.type==="mouseover",i===undefined?i=this.opt.targetText:i==null?i=f?this.opt.cancelHint:this.opt.targetText:(this.opt.targetType==="hint"?i=t._getHint.call(this,i,r):this.opt.precision&&(i=parseFloat(i).toFixed(1)),e=r&&r.type==="mousemove",f||e||this.opt.targetKeep||(i=this.opt.targetText)),t._setTarget.call(this,u,i))},_turnOn:function(n,t){return this.opt.single?n===t:n<=t},_unlock:function(){this.style.cursor="pointer";this.removeAttribute("title");this.score.removeAttr("readonly");this.self.data("readonly",!1);for(var n=0;n<this.opt.number;n++)this.stars[n].title=t._getHint.call(this,n+1);this.cancel&&this.cancel.css("display","")},cancel:function(i){return this.each(function(){var r=n(this);r.data("readonly")!==!0&&(t[i?"click":"score"].call(r,null),this.score.removeAttr("value"))})},click:function(i){return this.each(function(){n(this).data("readonly")!==!0&&(i=t._adjustedScore.call(this,i),t._apply.call(this,i),this.opt.click&&this.opt.click.call(this,i,n.Event("click")),t._target.call(this,i))})},destroy:function(){return this.each(function(){var t=n(this),i=t.data("raw");i?t.off(".raty").empty().css({cursor:i.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var n=[],t;return this.each(function(){t=this.score.val();n.push(t?+t:undefined)}),n.length>1?n:n[0]},move:function(i){return this.each(function(){var r=parseInt(i,10),u=t._getFirstDecimal.call(this,i);r>=this.opt.number&&(r=this.opt.number-1,u=10);var e=t._getWidth.call(this),o=e/10,f=n(this.stars[r]),s=f.offset().left+o*u,h=n.Event("mousemove",{pageX:s});this.move=!0;f.trigger(h);this.move=!1})},readOnly:function(i){return this.each(function(){var r=n(this);r.data("readonly")!==i&&(i?(r.off(".raty").children("img").off(".raty"),t._lock.call(this)):(t._binds.call(this),t._unlock.call(this)),r.data("readonly",i))})},reload:function(){return t.set.call(this,{})},score:function(){var i=n(this);return arguments.length?t.setScore.apply(i,arguments):t.getScore.call(i)},set:function(t){return this.each(function(){n(this).raty(n.extend({},this.opt,t))})},setScore:function(i){return this.each(function(){n(this).data("readonly")!==!0&&(i=t._adjustedScore.call(this,i),t._apply.call(this,i),t._target.call(this,i))})}};n.fn.raty=function(i){if(t[i])return t[i].apply(this,Array.prototype.slice.call(arguments,1
3));if(typeof i!="object"&&i)n.error("Method "+i+" does not exist!");else return t.init.apply(this,arguments)};n.fn.raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:undefined,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:undefined,mouseout:undefined,mouseover:undefined,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:undefined,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:undefined,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:undefined,targetFormat:"{score}",targetKeep:!1,targetScore:undefined,targetText:"",targetType:"hint"}}(jQuery),function(n){n.fn.socialShare=function(t){function r(n){if(t.toWord){if(n>=1e9)return(n/1e9).toFixed(1)+"G";if(n>=1e6)return(n/1e6).toFixed(1)+"M";if(n>=1e3)return(n/1e3).toFixed(1)+"K"}return n}var u={url:window.location.href,description:n("meta[name=description]").attr("content"),title:n("title").text(),counts:!0,twitter:!0,facebook:!0,pinterest:!0,linkedIn:!0,gPlus:!0,image:null,toWord:!0,twitterVia:null,twitterHashTags:n("meta[name=keywords]").attr("content")},i=this;return t=jQuery.extend({},u,t),this.each(function(){function s(u){t.facebook&&(t.counts&&i.find(".facebook-count").each(function(){n(this).html(r(u.facebook))}),i.find(".facebook-share").each(function(){var i="https://facebook.com/sharer/sharer.php?u="+encodeURIComponent(t.url);n(this).click(function(){o(i,"facebook")})}));t.twitter&&(t.counts&&i.find(".twitter-count").each(function(){n(this).html(r(u.twitter))}),i.find(".twitter-share").each(function(){var i="https://twitter.com/share?url="+t.url+"&text="+t.description;t.twitterVia!==undefined&&t.twitterVia!=null&&(i+="&via="+t.twitterVia+"");t.twitterHashTags!==undefined&&t.twitterHashTags!=null&&(i+="&hashtags="+t.twitterHashTags+"");n(this).click(function(){o(i,"twitter")})}));t.pinterest&&(t.counts&&i.find(".pinterest-count").each(function(){n(this).html(r(u.pinterest))}),i.find(".pinterest-share").each(function(){var i="https://pinterest.com/pin/create/bookmarklet/?media="+t.image+"&url="+t.url+"&description="+t.description;n(this).click(function(){o(i,"pinterest")})}));t.linkedIn&&(t.counts&&i.find(".linkedin-count").each(function(){n(this).html(r(u.linkedIn))}),i.find(".linkedin-share").each(function(){var i="http://www.linkedin.com/shareArticle?url="+t.url;n(this).click(function(){o(i,"linkedin")})}));t.gPlus&&(t.counts&&i.find(".gplus-count").each(function(){n(this).html(r(u.gPlus))}),i.find(".gplus-share").each(function(){var i="https://plus.google.com/share?url="+t.url;n(this).click(function(){o(i,"gplus")})}))}function o(n,t){return window.open(n,t+"-share-dialogue","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+e.width+",height="+e.height+",top="+e.top+",left="+e.left+""),!1}var f={all:{getCount:function(n){var i=jQuery.Deferred(),t={};return jQuery.getJSON("https://count.donreach.com/?url="+encodeURIComponent(n.url)+"&callback=?",function(n){t.url=n.url;t.facebook=n.shares.facebook;t.twitter=n.shares.twitter;t.linkedIn=n.shares.linkedin;t.pinterest=n.shares.pinterest;t.gPlus=n.shares.google;t.success=!0;i.resolve(t)}).fail(function(n,r,u){alert(u);t.success=!1;i.resolve(t)}),i.promise()}},twitter:{getCount:function(n,t){var i=jQuery.Deferred();return jQuery.getJSON("http://cdn.api.twitter.com/1/urls/count.json?url="+n.url+"&callback=?",function(n){t.twitter=n.count;i.resolve(t)}),i.promise()}},facebook:{getCount:function(n,t){var i=jQuery.Deferred();return jQuery.getJSON("https://api.facebook.com/method/links.getStats?format=json&urls="+n.url+"&callback=?",function(n){t.facebook=n[0].total_count;i.resolve(t)}),i.promise()}},pinterest:{getCount:function(n,t){var i=jQuery.Deferred();return jQuery.getJSON("http://api.pinterest.com/v1/urls/count.json?callback=?&url="+n.url,function(n){t.pinterest=n.count;i.resolve(t)}),i.promise()}},linkedIn:{getCount:function(n,t){var i=jQuery.Deferred();return jQuery.getJSON("https://www.linkedin.com/countserv/count/share?format=jsonp&url="+n.url+"&callback=?",function(n){t.linkedIn=n.count;i.resolve(t)}),i.promise()}},gPlus:{getCount:function(n,t){var i=jQuery.Deferred();return jQuery.getJSON("http://anyorigin.com/get?callback=?&url="+encodeURIComponent("https://plusone.google.com/_/+1/fastbutton?url="+n.url),function(n){t.gPlus=parseFloat(n.contents.match(/\{c: [0-9A-Z.]+/)[0].split(" ")[1]);i.resolve(t)}),i.promise()}}},u={},e;t.counts?f.all.getCount(t).then(function(i){u=i;i.success?s(u):n.when(t.facebook?f.facebook.getCount(t,u):null,t.twitter?f.twitter.getCount(t,u):null,t.pinterest?f.pinterest.getCount(t,u):null,t.linkedIn?f.linkedIn.getCount(t,u):null,t.gPlus?f.gPlus.getCount(t,u):null).then(function(){s(u)})}):s();
3e={width:626,height:336,left:n(window).width()/2-313,top:n(window).height()/3-168}})}}(jQuery);class MomentumHorizontalLayoutRenderer{constructor(){(this.scrollerHasMovedSinceMouseDown=!1,$.Kinetic&&$.Kinetic.prototype!==undefined)&&($.Kinetic.prototype._initEvents=function(){var n=this;this.settings.events={touchStart:function(t){var i;n._useTarget(t.target,t)&&(i=t.originalEvent.touches[0],n.threshold=n._threshold(t.target,t),n._start(i.clientX,i.clientY))},touchMove:function(t){var i;n.mouseDown&&(i=t.originalEvent.touches[0],n._inputmove(i.clientX,i.clientY))},inputDown:function(t){n._useTarget(t.target,t)&&(n.threshold=n._threshold(t.target,t),n._start(t.clientX,t.clientY),n.elementFocused=t.target,t.target.nodeName==="IMG"&&t.preventDefault(),t.stopPropagation())},inputEnd:function(t){n._useTarget(t.target,t)&&(n._end(),n.elementFocused=null)},inputMove:function(t){n.mouseDown&&(n._inputmove(t.clientX,t.clientY),t.preventDefault&&t.preventDefault())},scroll:function(t){typeof n.settings.moved=="function"&&n.settings.moved.call(n,n.settings);t.preventDefault&&t.preventDefault()},inputClick:function(t){if(Math.abs(n.velocity)>0)return t.preventDefault(),!1},dragStart:function(t){if(n._useTarget(t.target,t)&&n.elementFocused)return!1},selectStart:function(t){return typeof n.settings.selectStart=="function"?n.settings.selectStart.apply(n,arguments):n._useTarget(t.target,t)?!1:void 0}};this._attachListeners(this.$el,this.settings)},$.Kinetic.prototype.canScroll=function(){return this.canScrollLeft()||this.canScrollRight()},$.Kinetic.prototype.canScrollLeft=function(){var n=this._getScroller(),t=n[0];return t.scrollLeft>0},$.Kinetic.prototype.canScrollRight=function(){var t=this._getScroller(),n=t[0];return n.scrollLeft+n.offsetWidth<n.scrollWidth},$.Kinetic.prototype.getPercentage=function(n){var i=this._getScroller(),t=i[0];return t.scrollWidth===0?0:100*n/t.scrollWidth},$.Kinetic.prototype.startPercentage=function(){var t=this._getScroller(),n=t[0];return n.scrollWidth===0?0:Math.abs(100*n.scrollLeft)/n.scrollWidth},$.Kinetic.prototype.endPercentage=function(){var t=this._getScroller(),n=t[0];return n.scrollWidth===0?0:100*(Math.abs(n.scrollLeft)+n.offsetWidth)/n.scrollWidth},$.Kinetic.prototype.pageLeft=function(){var t=this._getScroller(),n=t[0],i=Math.min(Math.abs(n.scrollLeft)+50,n.offsetWidth*.8),r=this.calculateInitialVelocityForDistance(i,!1);this.start({velocity:-r});this.end()},$.Kinetic.prototype.pageRight=function(){var t=this._getScroller(),n=t[0],i=Math.min(Math.abs(n.scrollWidth-(n.scrollLeft+n.offsetWidth))+50,n.offsetWidth*.8),r=this.calculateInitialVelocityForDistance(i,!1);this.start({velocity:r});this.end()},$.Kinetic.prototype.calculateInitialVelocityForDistance=function(n){for(var t=1,i=!1,r;!i;)t+=.1,r=this.calculateTotalDistanceFromVelocity(t),i=r>n;return t},$.Kinetic.prototype.calculateTotalDistanceFromVelocity=function(n){for(var t=n,i=t;t>=1;)i+=t,t*=.9;return i})}initialize(n,t,i){if($.Kinetic&&$.Kinetic.prototype!==undefined){$(n).data("listWrapperElement",t);$(n).data("listContainerElement",i);$(n).addClass("horizontal-scroll");$("<div/>",{html:'<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="16" /><path d="M12.2305 15.8079L16.6879 12.0935C17.2089 11.6592 18 12.0298 18 12.708V19.292C18 19.9702 17.2089 20.3408 16.6879 19.9065L12.2305 16.1921C12.1105 16.0921 12.1105 15.9079 12.2305 15.8079Z" /><\/svg>',"class":"left-arrow object-list-arrow"}).appendTo(t).on("click",function(){$(i).kinetic("pageLeft")});$("<div/>",{html:'<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="16" /><path d="M19.7695 16.1921L15.3121 19.9065C14.7911 20.3408 14 19.9702 14 19.292L14 12.708C14 12.0298 14.7911 11.6592 15.3121 12.0935L19.7695 15.8079C19.8895 15.9079 19.8895 16.0921 19.7695 16.1921Z"/><\/svg>',"class":"right-arrow object-list-arrow"}).appendTo(t).on("click",function(){$(i).kinetic("pageRight")});var r=$("<div/>",{"class":"tracking-gauge"}).appendTo(t),u=$("<div/>",{"class":"tracking-gauge-fill-area"}).appendTo(r);$("<div/>",{"class":"tracking-gauge-visible-range"}).appendTo(u)}}onObjectsRendered(n,t,i){var r=this;if($.Kinetic&&$.Kinetic.prototype!==undefined){$(i).on("mousedown",function(){r.scrollerHasMovedSinceMouseDown=!1;const n=new CustomEvent("scrollingStarted",{bubbles:!0,detail:{}});$(i).each(function(t,i){i.dispatchEvent(n)})}).kinetic({x:!0,y:!1,cursor:"default",triggerHardware:!0,moved:function(t){r.scrollerHasMovedSinceMouseDown=!0;r.updateArrowsDisplay(n);r.updateTrackingGauge(n,t.scrollLeft)},stopped:function(){}});$(document).on("mouseup",function(){const n=new CustomEvent("scrollingStopped",{bubbles:!0,detail:{}});$(i).each(function(t,i){i.dispatchEvent(n)})});r.updateArrowsDisplay(n);r.updateTrackingGauge(n)}}updateArrowsDisplay(n){var t=$(n).data("listContainerElement").data("kinetic"),i,r;t!==undefined&&(i=t.canScrollLeft(),r=t.canScrollRight(),$(n).toggleClass("fully-left",!i).toggleClass("fully-right",!r))}updateTrackingGauge(n,t){var i=$(n).data("listContainerElement").data("kinetic"),r,u,f;i!==undefined&&($(n).find(".tracking-gauge").toggleClass("visible",i.canScroll()),r=typeof t=="number"?Math.abs(i.getPercentage(t)):i.startPercentage(),u=i.endPercentage(),f={},f=max7app.languageIsRightToLeft?{right:r+"%",left:100-u+"%"}:{left:r+"%",right:100-u+"%"},$(n).find(".tracking-gauge-visible-range").css(f))}showTrackingGauge(n){var t=$(n).data("listContainerElement").data("kinetic");t!==undefined&&t.canScroll()&&$(n).find(".tracking-gauge").addClass("visible")}hideTrackingGauge(n){$(n).find(".tracking-gauge").removeClass("visible")}displayEmptyMessage(n,t){$("<div/>",{html:t}).appendTo(n)}onTitleRendered(){}}class ToggleableHorizontalLayoutRendererFactory{constructor(n){this.options=n}createLayoutRenderer(){return new ToggleableHorizontalLayoutRenderer(this.options)}}class BaseObjectListCollectionDataSource{constructor(){this.STATUS_PREEXECUTION=0;this.STATUS_EXECUTING=1;this.STATUS_COMPLETED=2;this.STATUS_ABORTED=3;this.STATUS_IDLE=4;this.pendingRequestCount=0;this.incompleteRequests=0;this.status=this.STATUS_PREEXECUTION;this.isComplete=!1;this.plugins=[]}requestLists(n,t){var i=this;if(!i.isComplete){switch(i.status){case this.STATUS_PREEXECUTION:t===undefined||t===null||isNaN(t)?(i.pendingRequestCount=null,i.incompleteRequests=null):(i.pendingRequestCount=t,i.incompleteRequests=t);break;case this.STATUS_EXECUTING:if(i.incompleteRequests===null)return;t===undefined||t===null||isNaN(t)?(i.pendingRequestCount=null,i.incompleteRequests=null):(i.pendingRequestCount+=t,i.incompleteRequests+=t)}i._callbacks=n;i.launchPendingRequests()}}getTraceName(){return this.Tag?this.Tag:this.constructor.name}}class ListArrayObjectListCollectionDataSource extends BaseObjectListCollectionDataSource{constructor(n){super();this.subDataSources=n;this.nextListIndex=0;this._executingSources=[];this.data=[]}launchPendingRequests(){var n=this,t,i;if(!n.isComplete)for(t=n.pendingRequestCount,t===null&&(t=n.subDataSources.length),n.status=this.STATUS_EXECUTING,i=1;i<=t;
3i++)n.launchNextAvailableSubsourceRequest()}launchNextAvailableSubsourceRequest(){var n=this,t;n.isComplete||(t=n.nextListIndex,n.nextListIndex++,n._attemptSource(t))}_attemptSource(n){var t=this,i,r;if(n>=this.subDataSources.length){t._checkForCompletion();return}if(i=this.subDataSources[n],!i,r=i.getInMemoryData(),t.pendingRequestCount<=0,t.pendingRequestCount>0&&(console.log(`${t.getTraceName()}.attemptSource is called (pendingRequestCount changed from ${t.pendingRequestCount} to ${t.pendingRequestCount-1}, incompleteRequests is ${t.incompleteRequests})`),t.pendingRequestCount--),t.pendingRequestCount>=t.incompleteRequests,r!==null){t._dataReceived(r);return}t._executingSources.push(n);i.execute({dataLoaded:function(i){t._executingSources.pop(n);t._dataReceived(i);t._checkForCompletion()},failed:function(){t._executingSources.pop(n);console.log(`${t.getTraceName()}'s sub source failed (pendingRequestCount changed from ${t.pendingRequestCount} to ${t.pendingRequestCount+1}, incompleteRequests is ${t.incompleteRequests})`);t.pendingRequestCount++;t.launchPendingRequests();t._checkForCompletion()}})}getInMemoryData(){return this.data}_complete(){var n=this;this.isComplete||(this.isComplete=!0,console.log(`${n.getTraceName()} is reporting completion (pendingRequestCount ${n.pendingRequestCount}, incompleteRequests ${n.incompleteRequests})`),n._callbacks.listsCompleted(n.pendingRequestCount,n.incompleteRequests))}_checkForCompletion(){var n=this;n.nextListIndex>=this.subDataSources.length&&n._executingSources.length===0&&n._complete()}_dataReceived(n){var t=this;t.incompleteRequests<=0;t.incompleteRequests>0&&(console.log(`${t.getTraceName()} subsource's returned data (pendingRequestCount is ${t.pendingRequestCount}, incompleteRequests changed from ${t.incompleteRequests} to ${t.incompleteRequests-1})`),t.incompleteRequests--);t.data.push(n);t._callbacks.listReady(n);t.launchPendingRequests()}}class BaseOrderedObjectListCollectionDataSource extends BaseObjectListCollectionDataSource{_launchSubsourceRequest(n){var t=this,r=$.grep(t.sources,function(t){return t.id===n}),i=r[0];if(i.status===t.STATUS_COMPLETE)throw"Cannot execute a source that has completed";if(i.status===t.STATUS_ABORTED)throw"Cannot execute a source that has aborted";i.status=t.STATUS_EXECUTING;t.pendingRequestCount<=0;t.pendingRequestCount>0&&t.pendingRequestCount--;t.pendingRequestCount>=t.incompleteRequests;t.activeThreads++;this.modifyPreLaunchSubsourceDetails(i);i.source.requestLists({listReady:function(n){i.itemFormat&&(n.itemFormat=i.itemFormat);i.results.push(n);i.broadcasting&&t._callbacks.listReady(n);t.incompleteRequests<=0;t.incompleteRequests>0&&t.incompleteRequests--;t.activeThreads>0&&t.activeThreads--;t.launchPendingRequests()},listsCompleted:function(n){i.status=t.STATUS_COMPLETED;t.activeThreads-=n;t.handleSubsourceListsCompleted(i);t.pendingRequestCount!==null&&(t.pendingRequestCount+=n);t.launchPendingRequests();t._checkIfAllCompleted()}},1)}modifyPreLaunchSubsourceDetails(){}handleSubsourceListsCompleted(){}getAvailableThreads(){return this.maxThreads-this.activeThreads}launchPendingRequests(){var n=this,t,i;if(n._checkIfAllCompleted(),!n.isComplete)for(t=n.getAvailableThreads(),n.pendingRequestCount!==null&&(t=Math.min(n.pendingRequestCount,t)),n.status=this.STATUS_EXECUTING,i=1;i<=t;i++)n.launchNextAvailableSubsourceRequest()}launchNextAvailableSubsourceRequest(){var n=this,t;n.isComplete||(t=$.grep(n.sources,function(t){return t.status===n.STATUS_PREEXECUTION||t.status===n.STATUS_EXECUTING}),this.sortUnlaunchedSources(t),t.length>0&&n._launchSubsourceRequest(t[0].id))}sortUnlaunchedSources(){}abortFurtherExecutions(){var n=this;$.each(n.sources,function(n,t){t.status===STATUS_PREEXECUTION&&(t.status=STATUS_ABORTED)})}_checkIfAllCompleted(){var n=this,t;n.isComplete||(t=$.grep(n.sources,function(t){return t.status!==n.STATUS_COMPLETED}),t.length===0&&(n.isComplete=!0,n._callbacks.listsCompleted(n.pendingRequestCount,n.incompleteRequests)))}}class RollingObjectListCollectionDataSource extends BaseOrderedObjectListCollectionDataSource{constructor(n){super();this.DEFAULT_THREADS=3;this.sources=[];this.maxThreads=n||this.DEFAULT_THREADS;this.activeThreads=0}addSource(n,t){var i=this;if(i.status!==this.STATUS_PREEXECUTION)throw"You cannot add any more sources once execution has commenced";i.sources.push({id:i.sources.length,source:n,status:this.STATUS_PREEXECUTION,itemFormat:t,completed:!1,broadcasting:i.sources.length===0,results:[]})}addSingleListSource(n,t){var i=new ListArrayObjectListCollectionDataSource([n]);i.Tag=`${n.Tag||n.constructor.name}-Wrapper`;this.addSource(i,t)}handleSubsourceListsCompleted(n){var t=this,i=!0;n.broadcasting&&$.each(t.sources,function(r,u){u.id>n.id&&i&&(u.broadcasting=!0,$.each(u.results,function(n,i){t._callbacks.listReady(i)}),i=u.status===t.STATUS_COMPLETED)})}}class WeavingObjectListCollectionDataSource extends BaseOrderedObjectListCollectionDataSource{constructor(n){super();this.DEFAULT_THREADS=3;this.sources=[];this.maxThreads=n||this.DEFAULT_THREADS;this.activeThreads=0}addSource(n,t,i,r){var u=this;if(u.status!==this.STATUS_PREEXECUTION)throw"You cannot add any more sources once execution has commenced";u.sources.push({id:u.sources.length,source:n,status:this.STATUS_PREEXECUTION,weight:t||1,weighted_queue:i||0,itemFormat:r,completed:!1,broadcasting:!0,results:[]})}addSingleListSource(n,t,i,r){var u=new ListArrayObjectListCollectionDataSource([n]);u.Tag=`${n.Tag||n.constructor.name}-Wrapper`;this.addSource(u,t,i,r)}modifyPreLaunchSubsourceDetails(n){n.weighted_queue+=1/n.weight}sortUnlaunchedSources(n){n.sort(function(n,t){return Math.floor(n.weighted_queue)==Math.floor(t.weighted_queue)?n.id-t.id:Math.floor(n.weighted_queue)-Math.floor(t.weighted_queue)})}}class ApiCallPreGroupedObjectListCollectionDataSource extends BaseObjectListCollectionDataSource{constructor(n){super();this.url=n;this._error=new EventManager;this.callCompleted=!1;this.apiData=null;this.nextRowToReturn=0}onError(n){this._error.subscribe(n)}offError(n){this._error.unsubscribe(n)}launchPendingRequests(){var n=this;n.isComplete||(n.callCompleted?n.returnData():n.callApi())}returnData(){for(var n=this,i=n.incompleteRequests===null?n.apiData.length:n.nextRowToReturn+n.incompleteRequests,t=n.nextRowToReturn;t<i;t++)t<n.apiData.length&&(n.incompleteRequests!==null&&(n.incompleteRequests<=0,n.incompleteRequests>0&&n.incompleteRequests--),n._callbacks.listReady(n.apiData[t]));n.nextRowToReturn=i;i>=n.apiData.length&&n._callbacks.listsCompleted(n.pendingRequestCount,n.incompleteRequests)}callApi(){var n=this;n.isComplete||max7app.apiCall({url:this.url.replace("$ALTLANGUAGE$",max7app.getFilterCultureCode()),success:function(t){n.callCompleted=!0;n.apiData=t;n.returnData()},error:function(){n.callCompleted=!0;n._callbacks.listsCompleted(n.pendingRequestCount,n.incompleteRequests);n._error.fire({},n)}})}getInMemoryData(){return self.apiData}}class ApiCallPostGroupedObjectListCollectionDataSource extends BaseObjectListCollectionDataSource{constructor(n){super();this.url=n;this.callCompleted=!1;this._error=new EventManager;this.nextRowToReturn=0}onError(n){this._error.subscribe(n)}offError(n){this._error.unsubscribe(n)}executeApiCall(n){max7app.apiCall({url:this.url.replace("$ALTLANGUAGE$",max7app.getFilterCultureCode()),success:function(t){n.success(t)},error:function(){n.error()}})}unpackTitle(n){return n.Title}unpackAltTitle(n){return n.AltTitle}launchPendingRequests(){var n=this;n.isComplete||(n.callCompleted?n.returnData():n.callApi())}callApi(){var n=this;n.isComplete||n.executeApiCall({success:function(t){n.callCompleted=!0;n.apiData=[];
3t.Lists.forEach(function(i){var r={title:n.unpackTitle(i),altTitle:n.unpackTitle(i),titleTextIDs:i.TitleTextIDs};r.resources=[];i.ResourceIDs.forEach(function(n){var i=$.grep(t.Resources,function(t){return t.ID==n});i.length>0&&r.resources.push(i[0])});n.apiData.push(r)});n.returnData()},error:function(){n.callCompleted=!0;n._callbacks.listsCompleted(n.pendingRequestCount,n.incompleteRequests);n._error.fire({},n)}})}returnData(){for(var n=this,i=n.incompleteRequests===null?n.apiData.length:n.nextRowToReturn+n.incompleteRequests,t=n.nextRowToReturn;t<i;t++)t<n.apiData.length&&(n.incompleteRequests!==null&&(n.incompleteRequests<=0,n.incompleteRequests>0&&n.incompleteRequests--),n._callbacks.listReady(n.apiData[t]));n.nextRowToReturn=i;i>=n.apiData.length&&n._callbacks.listsCompleted(n.pendingRequestCount,n.incompleteRequests)}getInMemoryData(){return self.apiData}}class HomePageObjectListCollectionDataSource extends RollingObjectListCollectionDataSource{constructor(n){super(3);this._buildSources(n)}_buildSources(n){var e=this,i=new WeavingObjectListCollectionDataSource,f,t,u,r;i.Tag="primaryDataSources";f=$.map(n,function(n,t){if(n.Url.includes("GetByCategory"))return null;if(n.Url){let i=new ApiCallObjectListDataSource(n.Title,n.TitleTextIDs,n.Url,undefined,n.LinkUrl);return i.Tag=`Search Vector #${t+1}`,i}if(n.DataSource){let i=n.DataSource;return i.Tag=`Search Vector #${t+1}`,i}return null});t=new RollingObjectListCollectionDataSource(3);t.Tag="personalDataSources";t.addSingleListSource(new MyFavoritesObjectListDataSource);t.addSingleListSource(new MyRecentlyVisitedObjectListDataSource);t.addSingleListSource(new MyRecentDownloadsObjectListDataSource);t.addSource(new BecauseYouDownloadedObjectListCollectionDataSource(5));i.addSource(t,2,-1,"mediumportraitlist");u=new ListArrayObjectListCollectionDataSource(f);u.Tag="SearchVectors";i.addSource(u,1,0,"smallportraitlist");i.addSource(new GetPopularCategoryObjectListCollectionDataSource(5),1,0,"smalllandscapelist");r=new RollingObjectListCollectionDataSource(2);r.Tag="generalDataSources";r.addSingleListSource(new TopDownloadsByCountryObjectListDataSource);r.addSingleListSource(new RecentlyAddedObjectListDataSource);i.addSource(r,1,1,"smalllandscapelist");e.addSource(i)}_getRandomDemoListUrl(n){return n[Math.floor(Math.random()*n.length)].Url}}class ChannelHomePageObjectListCollectionDataSource extends RollingObjectListCollectionDataSource{constructor(n,t,i,r,u,f){super(3);this._buildSources(n,t,i,r,u,f)}_buildSources(n,t,i,r,u,f){var e=this;t&&t.sourceblocks&&Array.isArray(t.sourceblocks)&&t.sourceblocks.forEach(function(t){if(t.sources&&Array.isArray(t.sources)){var o;o=t.displayType&&t.displayType.toUpperCase()==="ROLLING"?new RollingObjectListCollectionDataSource:new WeavingObjectListCollectionDataSource;t.sources.forEach(function(t){var s=e._getDataSource(t,n,i,r,u,f);s&&o.addSource(s)});e.addSource(o)}})}_getDataSource(n,t,i,r,u,f){switch(n.code.toUpperCase()){case"MYFAVORITES":return new ListArrayObjectListCollectionDataSource([new MyFavoritesObjectListDataSource]);case"RECENTLYVISITED":return new ListArrayObjectListCollectionDataSource([new MyRecentlyVisitedObjectListDataSource]);case"RECENTDOWNLOADS":return new ListArrayObjectListCollectionDataSource([new MyRecentDownloadsObjectListDataSource]);case"BECAUSEYOUDOWNLOADED":return new BecauseYouDownloadedObjectListCollectionDataSource(n.qty||5);case"CUSTOMHOMEPAGELISTS":return this._getCustomHomePageListsDataSource(t);case"POPULARCATEGORIES":return new GetPopularCategoryObjectListCollectionDataSource(n.qty||5);case"POPULARRESOURCES":return new ListArrayObjectListCollectionDataSource([new PopularResourcesObjectListDataSource]);case"TOPCOUNTRYDOWNLOADS":return new ListArrayObjectListCollectionDataSource([new TopDownloadsByCountryObjectListDataSource]);case"RECENTLYADDED":return new ListArrayObjectListCollectionDataSource([new RecentlyAddedObjectListDataSource(f)]);case"LIBRARY":var e=max7app.getLibraryFolderGuid(i,r);return new LibraryFolderContentsObjectListCollectionDataSource(i,e,!0,r,u,{topFolderTitle:f,displaySubfolders:!1});default:return null}}_getCustomHomePageListsDataSource(n){var t=$.map(n,function(n){return n.Url.includes("GetByCategory")?null:n.Url?new ApiCallObjectListDataSource(n.Title,n.TitleTextIDs,n.Url,undefined,null):n.DataSource?n.DataSource:null});new ListArrayObjectListCollectionDataSource(t)}}class BecauseYouDownloadedObjectListCollectionDataSource extends RollingObjectListCollectionDataSource{constructor(n){super(1);this.maxNumber=n;this._buildSources()}_buildSources(){for(var t,i=this,r={resources_handled:[],has_failed:!1},n=0;n<i.maxNumber;
3n++)t=new BecauseYouDownloadedObjectListDataSource(r),t.Tag=`BecauseYouDownloaded#${n+1}`,i.addSingleListSource(t)}}class GetPopularCategoryObjectListCollectionDataSource extends RollingObjectListCollectionDataSource{constructor(n){super(1);this.maxNumber=n;this._buildSources()}_buildSources(){for(var t,i=this,r={categories_handled:[],has_failed:!1},n=0;n<i.maxNumber;n++)t=new GetPopularCategoryObjectListDataSource(r),t.Tag=`Popular Category List ${n+1}`,i.addSingleListSource(t)}}class OwnedResourcesObjectListCollectionDataSource extends ApiCallPostGroupedObjectListCollectionDataSource{constructor(n,t){super(null);this.includeResources=n!==!1;this.includeLibraries=t!==!1}executeApiCall(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetOwnedResourceLists",parameters:{user:max7app.userEntityId,maxResultsPerList:15,culture:"",context:null,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription,includeResources:t.includeResources,includeLibraries:t.includeLibraries},success:function(t){n.success(t)},error:function(){n.error()}})}unpackTitle(n){switch(n.LinkID){case 0:return"Resources you have shared";case-1:return"Libraries you have created";default:return`Resources shared by the ${n.Title} Community`}}unpackAltTitle(n){switch(n.LinkID){case 0:return"Resources you have shared";case-1:return"Libraries you have created";default:return`Resources shared by the ${n.Title} Community`}}}class ResourcesOwnedByPersonObjectListCollectionDataSource extends ApiCallPostGroupedObjectListCollectionDataSource{constructor(n,t,i){super(null);this.personId=n;this.includeResources=t!==!1;this.includeLibraries=i!==!1}executeApiCall(n){var t=this;max7app.getUserAdminKey({success:function(i){max7app.apiCall({connection:"cors",method:"SimpleResourceLists3/GetResourceListsOwnedByPerson",data:{person:t.personId,maxResultsPerList:15,culture:"",context:null,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription,includeResources:t.includeResources,includeLibraries:t.includeLibraries,userAdminKey:i},success:function(t){n.success(t)},error:function(){n.error()}})}})}unpackTitle(n){switch(n.LinkID){case 0:return"Resources shared";case-1:return"Libraries created";default:return`Resources shared by the ${n.Title} Community`}}unpackAltTitle(n){switch(n.LinkID){case 0:return"Resources shared";case-1:return"Libraries created";default:return`Resources shared by the ${n.Title} Community`}}}class LibraryContentsObjectListCollectionDataSource extends RollingObjectListCollectionDataSource{constructor(n,t){super(3);this.libraryUniqueCode=t;this._buildSources(n)}_buildSources(n){var t=this;$.each(n,function(n,i){i.ParentID==null&&t.addSingleListSource(new LibraryFolderObjectListDataSource(i.ID,i.Guid,i.Title,i.Description,!0,t.libraryUniqueCode))})}}class LibraryFolderContentsObjectListCollectionDataSource extends RollingObjectListCollectionDataSource{constructor(n,t,i,r,u,f){super(3);f=f||{};var e=f.topFolderTitle||"",o=f.displayDescriptions||!0,s=f.displaySubfolders||!0;this.libraryUniqueCode=u;this._buildSources(n,t,i,e,r,o,s)}_buildSources(n,t,i,r,u,f,e){var o=this,s;i&&(s=new LibraryFolderObjectListDataSource(n,t,r,"",!1,null),s.gateCount=0,o.addSingleListSource(s));$.each(u,function(t,i){i.ParentID==n&&o.addSingleListSource(new LibraryFolderObjectListDataSource(i.ID,i.Guid,i.Title,f?i.Description:"",e,o.libraryUniqueCode))})}}class ApiCallObjectListDataSource{constructor(n,t,i,r,u){this.title=n;this.titleLinkUrl=u;this.FAILED_BELOWGATE=1;this.FAILED_APIERROR=2;this.titleTextIDs=Array.isArray(t)?t:t===undefined||t===null?null:[t];this.url=i;this.resources=null;this.gateCount=r;this.data=null}execute(n){var t=this;max7app.apiCall({url:this.url.replace("$ALTLANGUAGE$",max7app.getFilterCultureCode()),success:function(i){if(t.gateCount!==undefined&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}getInMemoryData(){return this.resources===null?null:{title:this.title,titleTextIDs:this.titleTextIDs,titleLinkUrl:this.titleLinkUrl,resources:this.resources,data:this.data}}}class FallbackChainObjectListDataSource{constructor(n){this.subDataSources=n;this.data=null}execute(n){this.attemptSource(0,n)}attemptSource(n,t){var r=this,i;if(n>=this.subDataSources.length){t.failed(0);return}if(i=this.subDataSources[n],this.data=i.getInMemoryData(),this.data!==null){t.dataLoaded(this.data);return}i.execute({dataLoaded:function(n){r.data=n;t.dataLoaded(n)},failed:function(){r.attemptSource(n+1,t)}})}getInMemoryData(){return this.data}}class ArrayObjectListDataSource{constructor(n,t,i,r,u){this.title=n;this.titleTextIDs=t;this.titleLinkUrl=i;this.resources=r;this.data=u}getInMemoryData(){return{title:this.title,titleTextIDs:this.titleTextIDs,titleLinkUrl:this.titleLinkUrl,resources:this.resources,data:this.data}}}class MyFavoritesObjectListDataSource extends ApiCallObjectListDataSource{constructor(){super(max7app.displayText("MY_FAVORITES_LIST_HEADING"),[],null,1,null)}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetUserFavorites",parameters:{user:max7app.userEntityId,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class LibraryFolderObjectListDataSource extends ApiCallObjectListDataSource{constructor(n,t,i,r,u,f){if(super(i,[],null,1,max7app.urlManager.getLibraryUrl(f,t)),n===null)throw"folderid cannot be null";this.folderid=n;this.description=r;this.includeSubfolders=u;this.libraryUniqueCode=f}execute(n){var t=this,i={includeSubfolders:t.includeSubfolders,user:max7app.userEntityId,culture:max7app.filterCultureCode,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,context:max7app.channelGuid,includeDescription:max7app.services.displayedContent.includeDescription};$.isNumeric(t.folderid)?i.folder=t.folderid:i.folderguid=t.folderid;max7app.apiCall({method:"SimpleResourceLists3/GetLibraryFolderContents",parameters:i,success:function(i){if(t.gateCount!==undefined&&i.Resources.length+i.Subfolders.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}var r=[];$.each(i.Resources,function(n,t){t.objectType="resource";r.push(t)});$.each(i.Subfolders,function(n,u){u.objectType="folder";u.libraryUniqueCode=t.libraryUniqueCode;r.push(u);u.ResourceThumbnails=[];$.each(i.SubfolderResources,function(n,t){parseInt(t.FolderID)===parseInt(u.ID)&&u.ResourceThumbnails.push(t)})});t.data=i;t.data.ID=t.folderid;t.data.description=t.description;t.resources=r;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class MyRecentDownloadsObjectListDataSource extends ApiCallObjectListDataSource{constructor(){super(max7app.displayText("MY_RECENT_DOWNLOADS_LIST_TITLE"),[],null,4,null)}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetUserRecentDownloads",parameters:{user:max7app.userEntityId,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class MyRecentlyVisitedObjectListDataSource extends ApiCallObjectListDataSource{constructor(){super(max7app.displayText("VIRTUAL_LIBRARY_TITLE_RECENT"),[],null,1,null)}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetUserRecentlyVisited",parameters:{user:max7app.userEntityId,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class RecentlyAddedObjectListDataSource extends ApiCallObjectListDataSource{constructor(n){const t=n?max7app.displayText({code:"NEW_ON_X_LIST_TITLE",parameters:{title:n}}):max7app.displayText("NEW_ON_MAX7_LIST_TITLE");super(t,[],null,1,null)}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetRecentlyAdded",parameters:{user:max7app.userEntityId,maxResults:50,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class RelatedResourcesObjectListDataSource extends ApiCallObjectListDataSource{constructor(n){super(max7app.displayText("RelatedResourcesText"),[],null,1,null);this._resourceID=n}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetRelatedResources",parameters:{user:max7app.userEntityId,resource:t._resourceID,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class LibrariesWithResourceObjectListDataSource extends ApiCallObjectListDataSource{constructor(n,t,i){super("",[],null,t,null);i=i||{};i.all_cultures=i.all_cultures||!1;i.all_contexts=i.all_contexts||!1;i.include_rejected=i.include_rejected||!1;this.options=i;this._resourceID=n}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetLibrariesWithResource",parameters:{user:max7app.userEntityId,resource:t._resourceID,includeRejected:t.options.include_rejected,maxResults:15,culture:this.options.all_cultures?"":max7app.filterCultureCode,context:this.options.all_contexts?"":max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&t.gateCount!==null&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;t.title=max7app.displayText({code:"FOUND_IN_X_LIBRARIES_LIST_TITLE",parameters:{count:i.length}});n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class TopDownloadsByCountryObjectListDataSource extends ApiCallObjectListDataSource{constructor(){super("",[],null,1,null)}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetTopDownloadsFromCountry",parameters:{ip:max7app.clientIP,user:max7app.userEntityId,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.List.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.title=max7app.displayText({code:"TOP_DOWNLOADS_IN_LOCATION_LIST_TITLE",parameters:{location:i.Title}});t.resources=i.List;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class PopularResourcesObjectListDataSource extends ApiCallObjectListDataSource{constructor(){super("",[],null,1,null)}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetPopularResources",parameters:{user:max7app.userEntityId,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.title=max7app.displayText("MostPopularResourcesTitle");t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class BecauseYouDownloadedObjectListDataSource extends ApiCallObjectListDataSource{constructor(n){super("",[],null,1,null);this._tracking_data=n}execute(n){var t=this;if(this._tracking_data.has_failed){n.failed(this.FAILED_BELOWGATE);return}max7app.apiCall({method:"SimpleResourceLists3/GetBecauseYouDownloaded",parameters:{user:max7app.userEntityId,handledResources:t._tracking_data.resources_handled.join(","),maxResults:15,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.List.length<t.gateCount){t._tracking_data.has_failed=!0;n.failed(t.FAILED_BELOWGATE);return}t.title=max7app.displayText({code:"BECAUSE_YOU_DOWNLOADED_LIST_TITLE",parameters:{title:i.Title}});t.resources=i.List;t.titleLinkUrl=max7app.urlManager.getResourceUrl(max7app.RESOURCETYPE_RESOURCE,i.UniqueCode);(i.ResourceID||0)!==0?t._tracking_data.resources_handled.push(i.ResourceID):t._tracking_data.has_failed=!0;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class YouMayAlsoLikeObjectListDataSource extends ApiCallObjectListDataSource{constructor(n){super(max7app.displayText("YOU_MAY_ALSO_LIKE_LIST_TITLE"),[],null,1,null);this._resourceID=n}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetYouMayAlsoLike",parameters:{user:max7app.userEntityId,resource:t._resourceID,maxResults:15,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.List.length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i.List;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class GetPopularCategoryObjectListDataSource extends ApiCallObjectListDataSource{constructor(n){super("",[],null,1,null);this._tracking_data=n;this._categoryHandled=new EventManager}onCategoryHandled(n){this._categoryHandled.subscribe(n)}offCategoryHandled(n){this._categoryHandled.unsubscribe(n)}execute(n){var t=this;if(this._tracking_data.has_failed){n.failed(this.FAILED_BELOWGATE);return}max7app.apiCall({method:"SimpleResourceLists3/GetPopularCategoryResources",parameters:{user:max7app.userEntityId,handledCategories:t._tracking_data.categories_handled.join(","),maxResults:15,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode,includeDescription:max7app.services.displayedContent.includeDescription},success:function(i){if(t.gateCount!==undefined&&i.List.length<t.gateCount){t._tracking_data.has_failed=!0;n.failed(t.FAILED_BELOWGATE);return}var r=max7app.getCategory(i.ID);t.title=max7app.displayText({code:"POPULAR_X_TITLE",parameters:{item:r.noContextTitle}});t.titleLinkUrl=max7app.getCategoryUrl(i.ID);t.resources=i.List;t._categoryHandled.fire({id:i.ID},t);t._tracking_data.categories_handled.push(i.ID);n.dataLoaded(t.getInMemoryData())},error:function(){t._tracking_data.has_failed=!0;n.failed(t.FAILED_APIERROR)}})}}class GetCategoryObjectListDataSource extends ApiCallObjectListDataSource{constructor(n,t){super(t||"Category "+n,[],null,1,max7app.getCategoryUrl(n));this._categoryid=n}execute(n){var t=this;max7app.apiCall({method:"SimpleResourceLists3/GetByCategory",parameters:{id:t._categoryid,maxResults:15,userEntityID:max7app.userEntityId,culture:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,includeDescription:max7app.services.displayedContent.includeDescription,log:!1},success:function(i){if(t.gateCount!==undefined&&i.
3length<t.gateCount){n.failed(t.FAILED_BELOWGATE);return}t.resources=i;n.dataLoaded(t.getInMemoryData())},error:function(){n.failed(t.FAILED_APIERROR)}})}}class ResourceContextMenuRenderer{static _buildAndShowContextMenu(n,t,i,r,u,f){var o,h,c,s,l,a,p,v,y,e,w;if(f=f||"",o=max7app.createModalScreen("ResourceContextScreen"),o.attr("data-id",n.ID),r?o.append(r):o.append($("<div/>",{"class":"resource-title",text:n.Title})),h=$("<div/>",{"class":"button-sets"}).appendTo(o),c=$("<div/>").appendTo(h),$("<div/>",{"class":"button-set-title",text:max7app.displayText("ActionText")}).appendTo(c),e=$("<div/>",{"class":"button-set"}).appendTo(c),s=$(`<div class='button'><svg><use xlink:href='/images/resources/actions/download.svg#image'></use></svg><div class='label'>${max7app.displayText("DownloadButtonText")}</div></div>`),(n.ResourceType||max7app.RESOURCETYPE_RESOURCE)===max7app.RESOURCETYPE_LIBRARY){s.on("click",function(t){t.stopPropagation();t.preventDefault();max7app.generateSingleLibraryResourcePackage(n.ID,n.UniqueCode,50,n.Title.trim(),!1,max7app.filterCultureCode)});l=max7app.displayText("LIBRARY_PAGE_LINK_TEXT");a=max7app.displayText("LIBRARY_PAGE_NEW_TAB_LINK_TEXT")}else{if(!t)s.appendTo(e).on("click",ResourceContextMenuRenderer._createResourceDownloadClickFunction(n,s));max7app.supportsPreview&&i.PreviewCode&&$(`<div class='button'><svg><use xlink:href='/images/resources/actions/preview.svg#image'></use></svg><div class='label'>${max7app.displayText("PreviewButton")}</div></div>`).on("click",function(t){max7app.areInPlaceTranslationKeysPressed(t)||(t.stopPropagation(),t.preventDefault(),max7app.previewManager.resourcePreviewHandler.showFullScreenPreview(i.PreviewCode,n.Guid,i.PreviewResourceFileGuid,i.PreviewPageCount,n.Title,n.UniqueCode))}).appendTo(e);l=max7app.displayText("RESOURCE_PAGE_LINK_TEXT");a=max7app.displayText("RESOURCE_PAGE_NEW_TAB_LINK_TEXT")}p=$("<a/>",{href:u,target:f,"class":"button"}).appendTo(e);v=$("<a/>",{href:u,target:"_blank","class":"button"});f!="_blank"&&v.appendTo(e);$("<svg><use xlink:href='/images/resources/actions/resource.svg#image'><\/use><\/svg><div class='label'>"+l+"<\/div>").appendTo(p);$("<svg><use xlink:href='/images/resources/actions/resourcenewtab.svg#image'><\/use><\/svg><div class='label'>"+a+"<\/div>").appendTo(v);(n.ResourceType||max7app.RESOURCETYPE_RESOURCE)===max7app.RESOURCETYPE_LIBRARY;$(`<div id='ContextFavoriteButton' class='button favorite'><svg class='notfavorite_icon'><use xlink:href='/images/resources/actions/favorite.svg#image'></use></svg><svg class='favorite_icon'><use xlink:href='/images/resources/actions/favorite_filled.svg#image'></use></svg><div class='label'>${max7app.displayText("FAVORITE_TEXT")}</div></div>`).appendTo(e);$("#ContextFavoriteButton").favoritebutton({resourceId:n.ID,isFavorite:n.IsFavorite});y=$("<div/>").appendTo(h);$("<div/>",{"class":"button-set-title",text:max7app.displayText("ShareText")}).appendTo(y);e=$("<div/>",{"class":"button-set"}).appendTo(y);w=i.PreviewCode=="previewvideo"?i.PreviewResourceFileGuid:null;max7app.addShareResourceButtons($(e),$(o),n.Title,n.ResourceType,n.UniqueCode,w);max7app.showModalScreen(o)}static showContextMenu(n,t,i){i=i||"";max7app.apiCall({connection:"local",method:"Resources/GetResourceHoverDetails",parameters:{userEntity:max7app.userEntityId,resource:n.ID,context:max7app.channelGuid,culture:max7app.filterCultureCode,language:max7app.languageCode},success:function(r){var u="",f;max7app.mediaQueryManager.matchesSize("lg")||(u=max7app.buildResourceContextDetailsHtml(r,!0,96,256,n.Guid));f={PreviewCode:r.PreviewCode,PreviewResourceFileGuid:r.PreviewResourceFileGuid,PreviewPageCount:r.PreviewPageCount};ResourceContextMenuRenderer._buildAndShowContextMenu(n,r.IsPasswordProtected,f,u,t,i)}})}static _createResourceDownloadClickFunction(n,t){return function(i){max7app.areInPlaceTranslationKeysPressed(i)||(i.preventDefault(),i.stopPropagation(),ResourceContextMenuRenderer.downloadClicked(n,t))}}static downloadClicked(n){max7app.hideContextMenu();max7app.testBrowserCapabilities(max7app.showDownloadDialog)&&max7app.showDownloadDialog({resourceId:n.ID,defaultCulture:max7app.getFilterCultureCode(),downloadCallback:Res
3ourceContextMenuRenderer.onDownloaded})}}$.widget("max7.objectlist",{options:{layoutRenderer:null,datasource:null,rightToLeft:!1,showTitle:!0,showDescription:!0,displayLoadingShadow:!0,itemFormat:"smalllandscapelist",loadingShadowItems:null,layoutType:"scroll",objectRenderers:{},renderResourceContextMenu:!0,renderHiddenIcons:!0,useResourceEditUrl:!1,resourceLinkTarget:"",resourceUrlResolver:null,propagateOverrideFilterCultureCode:!0,onResourceClick:null,displayResourcesInFolder:null,plugins:[],delayLoadingTime:0,emptyListMessage:max7app.displayText("EMPTY_RESOURCE_LIST_MESSAGE"),objectListHeadingElement:"div",hideOnEmpty:!1,supportAltLanguage:!0,onItemRendered:null,onResourceDownloaded:null,onRenderTitle:null},_create:function(){var n=this;if(n._controls={},n.data=null,$(n.element).addClass("object-list").empty(),n._itemRendered=new EventManager,n.options.onItemRendered&&n.subscribeItemRendered(n.options.onItemRendered),n._applyLayoutTypeManager(),n._layoutRenderer){n.options.showTitle&&$(`<${this.options.objectListHeadingElement}/>`,{"class":"object-list-heading"}).appendTo(n.element);n._controls.listWrapper=$('<div class="object-list-items-wrapper"><\/div>').appendTo(n.element);n._controls.listContainer=$("<div class='object-list-items'><\/div>").appendTo(n._controls.listWrapper);n._layoutRenderer.initialize(n.element,n._controls.listWrapper,n._controls.listContainer);$(document).on("displayAltLanguageChanged",function(){n.updateText()});$.each(n.options.plugins,function(t,i){i.initializeObjectList(n)});n.reloadData()}},_applyLayoutTypeManager:function(){var t=this,n=createObjectListRenderers(t.options);n&&(this._layoutRenderer=n.layoutRenderer,this._objectRenderers=n.objectRenderers)},applyFilter:function(n){var t=this,r,i;t._filter=n;t.data&&(r=$.grep(t.data.resources,function(t){return $.inArray(t.ID,n)>-1}),i=r.length>0,t.toggleHidden(i),i&&t._toggleVisibleResources(n))},toggleHidden:function(n){var t=this;$(t.element).stop(!0,!0);n?$(t.element).hasClass("resourcelist-hidden")&&$(t.element).slideDown(800).removeClass("resourcelist-hidden"):$(t.element).hasClass("resourcelist-hidden")||$(t.element).slideUp(800).addClass("resourcelist-hidden")},_toggleVisibleResources:function(n){var t=this;$(t.element).find(".object-list-item").stop(!0,!0);$.each(t.data.resources,function(i,r){var f=$.inArray(r.ID,n)>-1,u=$(t.element).find(".object-list-item[data-id='"+r.ID+"']");f?u.hasClass("resourcelist-hidden")&&u.show().removeClass("resourcelist-hidden"):u.hasClass("resourcelist-hidden")||u.hide().addClass("resourcelist-hidden")})},clearFilter:function(){this.applyFilter(null)},subscribeItemRendered:function(n){this._itemRendered.subscribe(n)},unsubscribeItemRendered:function(n){this._itemRendered.unsubscribe(n)},_createScrollingHandler:function(n){return this._createSimpleHandler("scrollinglist",n)},_createFullyDisplayedHandler:function(n){return this._createSimpleHandler("fullydisplayedlist",n)},_setOption:function(n,t){var i=this;n==="viewMode"&&t!==this.options.viewMode&&(this.dataLoaded=!1);n==="url"&&t!==this.options.url&&(this.dataLoaded=!1);n==="datasource"&&i.reloadData();this._super(n,t);n==="showGroups"&&this.displayData()},reloadData:function(){var n=this,t=null;n.options.datasource&&(t=n.options.datasource.getInMemoryData());t?n.displayData(t,!1):n.options.datasource&&(n.displayLoading(),n.options.datasource.execute({dataLoaded:function(t){n.displayData(t,!1)},failed:function(){n.configureAsEmpty()}}))},performingLoadingDelay:function(n){var t=this;n&&(this.options.delayLoadingTime?setTimeout(function(){n()},t.options.delayLoadingTime):n())},displayLoading:function(){var t=this,n;this._renderLoadingShadow();n=$(t.element).find(".object-list-items");n.closest(".object-list").addClass("loading")},hideLoading:function(){var t=this,n;this._removeLoadingShadow();n=$(t.element).find(".object-list-items");n.closest(".object-list").removeClass("loading")},displayData:function(n,t){var i=this,f=i._layoutRenderer,u,r,e,o,s,h;if(i.hideLoading(),n=max7app.dataNormalizers.SimpleClientResourceList.normalize(n)||i.data,n!==null){if(t=t||!1,i.data=n,u=$(i.element).find(".object-list-heading"),f.renderTitleContainer&&(u=f.renderTitleContainer(u)||u),r={title:n.title,titleLinkUrl:n.titleLinkUrl,data:n.data,container:u,rendered:!1,renderedTextContainer:null},r.container.toggle(i.options.showTitle),e=!1,i.options.showTitle){if(e=!0,i.options.onRenderTitle)i.options.onRenderTitle(r);if(r.rendered||(o=r.title,r.titleLinkUrl&&(o=`<a href='${r.titleLinkUrl}'>${o}</a>`),u.html(o),r.title&&r.title.length===0&&(e=!1,r.container.hide())),f.onTitleRendered)f.onTitleRendered(u,r.container,r.renderedTextContainer)}if(!e&&f.onNoTitleRendered)f.onNoTitleRendered(r.container);s=n.resources;s.length===0?i.configureAsEmpty():(h=[],$.each(s,function(n,t){var r=t.objectType||"resource",u=i._getRenderer(r),f=u.render(t,i.options.itemFormat,i);h.push({object:t,element:f})}),i._controls.listContainer.empty(),i._controls.listContainer.append($.map(h,function(n){return n.element})),i._wireUpButtons(s),$.each(h,function(n,t){var r=t.object.objectType||"resource",u=i._getRenderer(r);u.ResourceRenderered(t.element);i._itemRendered.fire({objectList:i,objectListElement:i.element,objectType:r,objectElement:t.element,objectData:t.object,recommendedPopupDirection:u.getRecommendedPopupDirection(),iconElement:t.element.find(".object-list-item-thumbnail")},i)}));this.dataLoaded=!0}},configureAsEmpty:function(){var n=this,t={displayEmptyMessage:!0,emptyMessage:n.options.emptyListMessage,hideList:n.options.hideOnEmpty};this._trigger("listIsEmpty",null,t);t.displayEmptyMessage&&n._layoutRenderer.displayEmptyMessage(n.element,t.emptyMessage);$(this.element).toggleClass("object-list-hidden",t.hideList)},getRenderedItemElements:function(){return $(this.element).find(".object-list-item")},GetResourceTitle:function(n){return max7app.displayAltLanguageText(n.Title,n.AltTitle)},_wireUpButtons:function(n){var t=this;t._layoutRenderer.onObjectsRendered(t.element,t._controls.listWrapper,t._controls.listContainer,n)},_destroy:function(){this.element.removeClass("object-list").removeClass("object-list-hidden").removeClass("loading-shadow").empty()},updateText:function(){var n=this;n.data&&$.each(n.data.Resources,function(t,i){var r=$(n.element).find("li.resource[data-id='"+i.ID+"']");r.length>0&&(r.find("a.title").text(n.GetResourceTitle(i)),r.find("div.thumbnail").attr("title",n.GetResourceTitle(i)))})},queryListLength:function(n){this.options.url?max7app.apiCall({url:this.options.url.replace("$VIEWMODE$",n.viewMode).replace("$ALTLANGUAGE$",""),success:function(t){n.callback(t.Resources.length)}}):this.options.data&&n.callback(this.options.data.Resources.length)},_renderLoadingShadow:function(){var n=this,t,i,u,r;if(n.options.displayLoadingShadow){if(t=n.getResourceRenderer(),!t)return;for(i=$(n.element).find(".object-list-items"),i.closest(".object-list").addClass("loading-shadow"),u=n.options.loadingShadowItems||(n._layoutRenderer.getLoadingShadowItemCount?n._layoutRenderer.getLoadingShadowItemCount():null)||Math.ceil(Math.random()*4)+2,r=0;r<u;r++)i.append(t.RenderLoadingShadow(n.options.itemFormat))}},_getRenderer:function(n){return this._objectRenderers?this._objectRenderers[n]:null},getResourceRenderer:function(){return this._getRenderer("resource")},_removeLoadingShadow:function(){var n=this;$(n.element).find(".object-list-items").empty().closest(".object-list").removeClass("loading-shadow")},resolveUrl:function(n){var t=this;return t.options.resourceUrlResolver?t.options.resourceUrlResolver(n):t._getResourceUrl(n)},_getResourceUrl:function(n){var t=this;return t.options.useResourceEditUrl?max7app.urlManager.getEditResourceUrl(n.ResourceType||max7app.RESOURCETYPE_RESOURCE,n.UniqueCode):max7app.urlManager.getResourceUrl(n.ResourceType||max7app.RESOURCETYPE_RESOURCE,n.UniqueCode,t.options.propagateOverrideFilterCultureCode?max7app.overrideFilterCultureCode:null,t.options.displayRes
3ourcesInFolder)}});$.widget("max7.objectListCollection",{options:{layoutRenderer:null,datasource:null,expectedResultsCount:3,rightToLeft:!1,objectRenderers:{},renderResourceContextMenu:!0,renderHiddenIcons:!0,hideEmptyLists:!0,useResourceEditUrl:!1,resourceLinkTarget:"",resourceUrlResolver:"",propagateOverrideFilterCultureCode:!0,onResourceClick:null,onFolderClick:null,onRenderTitle:null,displayResourcesInFolder:null,supportAltLanguage:!0,displayThreshold:null,objectListHeadingElement:"div",itemFormats:null,plugins:[]},_listsdata:[],getLoadedListsData:function(){return this._listsdata},setDisplayThreshold:function(n){var t=this;t._displayThreshold=n},increaseDisplayThreshold:function(n){var t=this;t._displayThreshold+=n;t.launchRequests(n)},getDisplayThreshold:function(){return this._displayThreshold},_create:function(){var n=this,t;for(n._controls={},n._listAdded=new EventManager,n._beforeListAdded=new EventManager,n._displayThreshold=n.options.displayThreshold,n._applyLayoutTypeManager(),$(n.element).addClass("object-list-collection").empty(),t=1;t<=n.options.expectedResultsCount;t++)n._renderLoadingShadow(t);n.listsLoaded=0;n._listsdata=[];$.each(n.options.plugins,function(t,i){i.initializeObjectListCollection(n)});n.launchRequests(n._displayThreshold)},subscribeBeforeListAdded:function(n){this._beforeListAdded.subscribe(n)},unsubscribeBeforeListAdded:function(n){this._beforeListAdded.unsubscribe(n)},subscribeListAdded:function(n){this._listAdded.subscribe(n)},unsubscribeListAdded:function(n){this._listAdded.unsubscribe(n)},_applyLayoutTypeManager:function(){var t=this,n=createObjectListRenderers(t.options);n&&(this._layoutRenderer=n.layoutRenderer,this._objectRenderers=n.objectRenderers)},launchRequests:function(n){var t=this;t.options.datasource.requestLists({listReady:function(n){t.listsLoaded++;var i=t.listsLoaded;setTimeout(function(){t._removeLoadingShadow(i);t._addList(i,n)},1)},listsCompleted:function(){setTimeout(function(){t._removeAllLoadingShadows();t._trigger("completed")},1)}},n)},getResourceRenderer:function(){var n=this;return n._objectRenderers?n._objectRenderers.resource:null},_renderLoadingShadow:function(n){var t=this,r=t.getResourceRenderer(),u,i;if(r){u=$("<div/>",{"class":"object-list loading-shadow"}).attr("data-index",n).css("order",n).appendTo(t.element);i=$("<div/>",{"class":"object-list-inset"}).appendTo(u);$(`<${this.options.objectListHeadingElement}/>`,{"class":"object-list-heading",text:max7app.getRandomLoadingShadowText(1,3,"")}).appendTo(i);var f=$("<div/>",{"class":"object-list-items-wrapper"}).appendTo(i),e=$("<div/>",{"class":"object-list-items"}).appendTo(f),o=t.options.loadingShadowItems||(t._layoutRenderer.getLoadingShadowItemCount?t._layoutRenderer.getLoadingShadowItemCount():null)||Math.ceil(Math.random()*4)+2;for(let i=0;i<o;i++)e.append(r.RenderLoadingShadow(t._getItemFormatForListIndex(n)))}},_removeLoadingShadow:function(n){var t=this;$(t.element).find(".loading-shadow[data-index='"+n+"']").remove()},_removeAllLoadingShadows:function(){var n=this;$(n.element).find(".loading-shadow").remove()},_getItemFormatForListIndex:function(n){var t=this;return typeof t.options.itemFormats=="function"?t.options.itemFormats(n):Array.isArray(t.options.itemFormats)?n-1>t.options.itemFormats.length?t.options.itemFormats[t.options.itemFormats.length-1]:t.options.itemFormats[n-1]:t.options.itemFormats&&t.options.itemFormats.prototype.toString.call(myvar)=="[object String]"?t.options.itemFormats:"smalllandscapelist"},_addList:function(n,t){var i=this,u,r,f;i._beforeListAdded.fire({objectList:i,index:n-1,container:i.element,data:t},i);u=`<div class="object-list-collection-item" data-index="${n}" style="order: ${n}"></div>`;t.jQueryObject=$(u).appendTo(i.element);r=i._layoutRenderer;r&&r.createLayoutRenderer&&(r=r.createLayoutRenderer());f=t.itemFormat?t.itemFormat:i._getItemFormatForListIndex(n);t.jQueryObject.objectlist({datasource:new ArrayObjectListDataSource(t.title,t.titleTextIDs,t.titleLinkUrl,t.resources,t.data),layoutRenderer:r,layoutType:i.options.layoutType,renderHiddenIcons:i.options.renderHiddenIcons,hideOnEmpty:i.options.hideEmptyLists,emptyListMessage:i.options.emptyListMessage,rightToLeft:i.options.rightToLeft,supportAltL
3anguage:i.options.supportAltLanguage,onRenderTitle:i.options.onRenderTitle,plugins:i.options.plugins,objectRenderers:i._objectRenderers,itemFormat:f,objectListHeadingElement:i.options.objectListHeadingElement});i._listsdata.push(t);i._listAdded.fire({objectList:i,data:t},i)},_destroy:function(){var n=this;$(n.element).removeClass("object-list-collection").empty()}});class ObjectListCollectionDisplayThresholdManager{constructor(n,t){this._initialPreloadCount=Math.max(1,n);this._loadaheadCount=t;this._initialPreloadCount=2;this._loadaheadCount=1}initializeObjectList(){}initializeObjectListCollection(n){var t=this,i;t._objectlistcollection=n;t._listElement=n.element;i=Math.max(1,t._initialPreloadCount,t._loadaheadCount);n.setDisplayThreshold(i);this._displayThresholdChange=new EventManager;$(window).on("resize",function(){t.checkThreshold()});$(window).on("scroll",function(){t.checkThreshold()});t._objectlistcollection.subscribeListAdded(function(){t.checkThreshold()});t.checkThreshold()}checkThreshold(){for(var n=this,i=n._objectlistcollection.getDisplayThreshold()-n._loadaheadCount+1,t=0;n.listIsAboveViewportBottom($(n._listElement).find(".object-list[data-index='"+i+"']"));)t++,i++;t>0&&(n._objectlistcollection.increaseDisplayThreshold(t),n._displayThresholdChange.fire({increase:t,value:n._objectlistcollection.getDisplayThreshold()},n))}listIsInViewport(n){if($(n).length===0)return!1;var t=$(n).offset().top,i=$(n).offset().top+$(n).outerHeight(),r=$(window).scrollTop()+$(window).innerHeight(),u=$(window).scrollTop();return r>t&&u<i}listIsInOrAboveViewport(n){if($(n).length===0)return!1;var t=$(n).offset().top+$(n).outerHeight(),i=$(window).scrollTop();return i<t}listIsAboveViewportBottom(n){if($(n).length===0)return!1;var t=$(n).offset().top,i=$(window).scrollTop()+window.innerHeight;return t<i}}class ObjectListCollectionInlineBannersPlugin{constructor(n){this._banners=n}initializeObjectList(){}initializeObjectListCollection(n){var t=this;n.subscribeBeforeListAdded(function(n){t.handleBeforeListAdded(n)})}handleBeforeListAdded(n){var t=this;$.each(t._banners,function(t,i){if(i.beforeIndex===n.index){var r=i.render(n.container);r&&$(r).addClass("inline-banner").css("order",n.index)}})}}class ObjectListReponsiveAutoScalePlugin{initializeObjectList(n){n.subscribeItemRendered(this.handleItemRendered.bind(self))}initializeObjectListCollection(){}handleItemRendered(n){$(n.objectElement).responsiveautoscaler()}}const LOGINFORM_VIEW_LOGIN=21,LOGINFORM_VIEW_FORGOTUSERNAME=22,LOGINFORM_VIEW_FORGOTPASSWORD=23;$.widget("max7.loginform",{validatorManagers:{},_validationFunctions:{},options:{returnUrl:window.location.href},_create:function(){var n=this,r=n.element.find(".login-form-forgot-username-link"),u=n.element.find(".login-form-forgot-password-link"),t,i;if(r&&r.length){t=function(t){t.preventDefault();t.stopPropagation();n.switchView(n.element.find(".login-form-forgot-username.active").length>0?LOGINFORM_VIEW_LOGIN:LOGINFORM_VIEW_FORGOTUSERNAME)}.bind(n);r.on("click",t)}if(u&&u.length){t=function(t){t.preventDefault();t.stopPropagation();n.switchView(n.element.find(".login-form-forgot-password-section.active").length>0?LOGINFORM_VIEW_LOGIN:LOGINFORM_VIEW_FORGOTPASSWORD)}.bind(n);u.on("click",t)}n.element.find(".login-form-forgot-username-email").on("keyup",function(t){(t.key==="Enter"||t.keyCode===13)&&n.element.find(".login-form-forgot-username-send-email-button").trigger("click")});n.element.find(".login-form-forgot-username-send-email-button").on("click",function(t){t.preventDefault();t.stopPropagation();n.sendForgottenUsername()});n.element.find(".login-form-forgot-username-cancel-button").on("click",function(t){t.preventDefault();t.stopPropagation();n.switchView(LOGINFORM_VIEW_LOGIN)}.bind(n));n.element.find(".login-form-forgot-password-usernameoremail").on("keyup",function(t){(t.key==="Enter"||t.keyCode===13)&&n.element.find(".login-form-forgot-password-send-email-button").trigger("click")});n.element.find(".login-form-forgot-password-send-email-button").on("click",function(t){t.preventDefault();t.stopPropagation();n.sendForgottenPassword()});if(i=n.element.find(".login-form-forgot-password-cancel-button"),i&&i.length)i.on("click",function(t){t.preventDefault();t.stopPropagation();n.switchView(LOGINFORM_VIEW_LOGIN)}.bind(n));$(".login-form-forgot-username-success, .login-form-forgot-password-success").find(".modal
3-screen-ok-button").off("click.loginform").on("click.loginform",function(){max7app.hideModalScreen($(this).closest(".modal-screen"))});n.switchView(LOGINFORM_VIEW_LOGIN)},doLogin:function(){var n=this;this._validate(!0)&&(n.element.find(".login-form-invalid-credentials").removeClass("active"),n=this,$.ajax({url:"/api/login/login",type:"POST",dataType:"json",contentType:"application/json",data:JSON.stringify({UserName:n.element.find(".login-form-username-control").val(),Password:n.element.find(".login-form-password").val(),Remember:n.element.find(".login-form-remember-user-checkbox")[0].checked,AppTicket:max7app.appTicket}),success:function(t){if(t.data.Status&&t.data.Status===1)window.location=n.options.returnUrl&&(typeof n.options.returnUrl=="string"||n.options.returnUrl instanceof String)?n.options.returnUrl:max7app.urlManager.getUrl("");else if(t.data.Status===-1)n.element.find(".login-form-invalid-credentials").addClass("active"),n.element.find(".login-form-password").trigger("focus").trigger("select");else{var i=null;t.data.Status===-2?i=$(".login-form-result-confirmation-required"):t.data.Status===-3&&(i=$(".login-form-result-multiple-emails"));i&&i.length&&max7app.showModalScreen(i)}}}))},sendForgottenUsername:function(){var n=this,t,i;this._validate(LOGINFORM_VIEW_FORGOTUSERNAME,!0)&&(t=n.element.find(".login-form-forgot-username-email"),i=t.val(),max7app.apiCall({connection:"local",method:"login/SendForgotUserNameEmail",parameters:{email:i,appTicket:max7app.appTicket},success:function(){var r=$(".login-form-forgot-username-success");r.children(".modal-screen-section").html(max7app.displayText({code:"FORGOT_USERNAME_EMAIL_SENT",parameters:{recipient:i}}));max7app.showModalScreen(r);t.val("");n.switchView(LOGINFORM_VIEW_LOGIN)},autoErrorHandler:{element:n.element.find(".login-form-forgot-username-error")}}))},sendForgottenPassword:function(){var n=this,t,i;this._validate(LOGINFORM_VIEW_FORGOTPASSWORD,!0)&&(t=n.element.find(".login-form-forgot-password-usernameoremail"),i=t.val(),max7app.apiCall({connection:"local",method:"login/SendForgotPasswordEmail",parameters:{email:i,appTicket:max7app.appTicket},success:function(r){var u=r&&r.Result?r.Result:r,f=r&&r.ExternalLoginProvider,e,o;u==1?(e=$(".login-form-forgot-password-success"),e.children(".modal-screen-section").html(max7app.displayText({code:"FORGOT_PASSWORD_EMAIL_SENT",parameters:{recipient:i}})),max7app.showModalScreen(e),t.val(""),n.switchView(LOGINFORM_VIEW_LOGIN)):u==2?max7app.showModalScreen($(".login-form-forgot-password-emailnotfound")):u==3?max7app.showModalScreen($(".login-form-forgot-password-emailnotunique")):u==5&&f&&(o=$('.externalLoginProviders .socialLoginList button[value="'+f+'"]').first(),o.length?o.trigger("click"):max7app.showPopupNotification(max7app.displayText({code:"FORGOT_PASSWORD_LOGIN_PROVIDER_UNAVAILABLE",parameters:{provider:f}}),"error"))},autoErrorHandler:{element:n.element.find(".login-form-forgot-password-error")}}))},resetToLoginView:function(){this.switchView(LOGINFORM_VIEW_LOGIN)},switchView:function(n){var t=this,i=t.element.find(".login-form-forgot-username"),r=t.element.find(".login-form-forgot-password-section"),f=t.element.find(".pageLoginInput, .pageLoginForgotLink"),u,e,o,s;i&&i.length&&i.removeClass("active");r&&r.length&&r.removeClass("active");this.validatorManagers[LOGINFORM_VIEW_LOGIN]&&this.validatorManagers[LOGINFORM_VIEW_LOGIN].clear();this.validatorManagers[LOGINFORM_VIEW_FORGOTUSERNAME]&&(this.validatorManagers[LOGINFORM_VIEW_FORGOTUSERNAME].clear(),this._setValidateOnEvent("blur",t.element.find(".login-form-forgot-username-email")),this._setValidateOnEvent("change",t.element.find(".login-form-forgot-username-email")));this.validatorManagers[LOGINFORM_VIEW_FORGOTPASSWORD]&&(this.validatorManagers[LOGINFORM_VIEW_FORGOTPASSWORD].clear(),this._setValidateOnEvent("blur",t.element.find(".login-form-forgot-password-usernameoremail")));switch(n){case LOGINFORM_VIEW_FORGOTUSERNAME:this._setPageLoginActionButtonEnabled(!1);f.hide();t.element.find(".login-form-invalid-credentials").removeClass("active");i&&i.length&&i.addClass("active");this._setValidateOnEvent("blur",t.element.find(".login-form-username-control"));this._setValidateOnEvent("blur",t.element.find(".login-form-password"));this.validatorManagers[LOGINFORM_VIEW_FORGOTUSERNAME]?this._setValidateOnEvent("blur",t.element.find(".login-form-forgot-username-email"),
3!0):(this.validatorManagers[LOGINFORM_VIEW_FORGOTUSERNAME]=new max7validator,u=this.validatorManagers[LOGINFORM_VIEW_FORGOTUSERNAME],e=new max7requiredValueValidator(t.element.find(".login-form-forgot-username-email"),max7app.displayText("FORGOT_USERNAME_EMAIL_REQUIRED_VALIDATOR")),e.limitWarningWidth=!0,this._setValidateOnEvent("blur",t.element.find(".login-form-forgot-username-email"),u),u.validators.push(e),o=new max7emailValidator(t.element.find(".login-form-forgot-username-email"),max7app.displayText("REGISTER_INVALID_EMAIL_VALIDATION")),o.limitWarningWidth=!0,this._setValidateOnEvent("change",t.element.find(".login-form-forgot-username-email"),u),u.validators.push(o));t.element.find(".login-form-forgot-username-email").trigger("focus");break;case LOGINFORM_VIEW_FORGOTPASSWORD:this._setPageLoginActionButtonEnabled(!1);f.hide();t.element.find(".login-form-invalid-credentials").removeClass("active");r&&r.length&&r.addClass("active");this._setValidateOnEvent("blur",t.element.find(".login-form-username-control"));this._setValidateOnEvent("blur",t.element.find(".login-form-password"));this.validatorManagers[LOGINFORM_VIEW_FORGOTPASSWORD]?this._setValidateOnEvent("blur",t.element.find(".login-form-forgot-password-usernameoremail"),!0):(this.validatorManagers[LOGINFORM_VIEW_FORGOTPASSWORD]=new max7validator,s=new max7requiredValueValidator(t.element.find(".login-form-forgot-password-usernameoremail"),max7app.displayText("FORGOT_PASSWORD_USERNAME_OR_EMAIL_REQUIRED_VALIDATOR")),s.limitWarningWidth=!0,this._setValidateOnEvent("blur",t.element.find(".login-form-forgot-password-usernameoremail"),this.validatorManagers[LOGINFORM_VIEW_FORGOTPASSWORD]),this.validatorManagers[LOGINFORM_VIEW_FORGOTPASSWORD].validators.push(s));t.element.find(".login-form-forgot-password-usernameoremail").trigger("focus");break;default:this._setPageLoginActionButtonEnabled(!0);f.show();this._setValidateOnEvent("blur",t.element.find(".login-form-username-control"),!0,t.element.find(".login-form-password"));this._setValidateOnEvent("blur",t.element.find(".login-form-password"),!0);t.element.find(".login-form-username-control").trigger("focus")}},_initializeValidators:function(){var t,i,r,n=this;this.validatorManagers[LOGINFORM_VIEW_LOGIN]||(this.validatorManagers[LOGINFORM_VIEW_LOGIN]=new max7validator,t=this.validatorManagers[LOGINFORM_VIEW_LOGIN],r=new max7requiredValueValidator(n.element.find(".login-form-username-control"),max7app.displayText("USERNAME_OR_EMAIL_REQUIRED_VALIDATOR")),r.limitWarningWidth=!0,this._setValidateOnEvent("focus",n.element.find(".login-form-username-control"),t,n.element.find(".login-form-password")),this.validatorManagers[LOGINFORM_VIEW_LOGIN].validators.push(r),i=new max7requiredValueValidator(n.element.find(".login-form-password"),max7app.displayText("REGISTER_PASSWORD_MISSING_VALIDATION")),i.limitWarningWidth=!0,this._setValidateOnEvent("blur",n.element.find(".login-form-password"),t),this.validatorManagers[LOGINFORM_VIEW_LOGIN].validators.push(i))},_setValidateOnEvent:function(n,t,i,r){max7validatorUtility.setValidateOnEventForElement(this._validationFunctions,n,"userManager",!1,r||t,t,i)},_setPageLoginActionButtonEnabled:function(n){var u=this,r=u.element.find(".login-form-login-submit-button"),t=u.element.find(".login-form-username-control"),i=u.element.find(".login-form-password"),f;if(r&&r.length)if(n===!1)r.off("click"),r.prop("disabled",!0),t&&t.length&&t.off("keypress.userManager"),i&&i.length&&i.off("keypress.userManager");else{r.prop("disabled",!1);r.on("click",function(n){n.preventDefault();n.stopPropagation();u.doLogin()});if(f=function(n){n.which===13&&(n.preventDefault(),n.stopPropagation(),u.doLogin())},t&&t.length){t.off("keydown.userManager");t.on("keydown.userManager",f)}if(i&&i.length){i.off("keydown.userManager");i.on("keydown.userManager",f)}}},_validate:function(n,t){var i=!0;return this.validatorManagers[n]&&(i=this.validatorManagers[n].performValidation(t)),i}});$.widget("max7.collectioneditor",{_INITIAL_SEARCH_INSTANCE:0,options:{collectionTitle:"",searchPrompt:"",sortable:!1,getInitialCollectionItems:null,getInitialSearchResults:null,getSearchResults:null,collectionItemRenderer:null,searchResultRenderer:null,defaultAddButtonText:max7app.displayText("AddButtonText"),defaultRemoveButtonText:max7app.displayText("RemoveButtonText"),save:null,collectionChanged:null},_create:function(){const n=this;this._initialSearchResultsData=null;this._searchInstance=this._INITIAL_SEARCH_INSTANCE;n._controls={};n._collectionData=[];$(n.element).addClass("collectionEditor");var t="",i=max7app.getLanguageNameByCode(max7app.languageCode),r=max7app.getLanguageNameByCode(max7app.filterCultureCode);t+="<div class='searchSection'>";t+="<header>Search<\/header>";t+="<div class='client'>";t+="<div>"+n.options.searchPrompt+"<\/div>";t+="<div class='textpanel'>";t+="<input type='text' placeholder='"+max7app.displayText({code:"FIND_PLACEHOLDER_WITH_LANGUAGE",parameters:{language:i}})+"' />";t+="<button class='orangebutton thinbutton'>
3"+max7appdata.phrases.GoText+"<\/button>";t+="<\/div>";t+="<\/div>";t+="<\/div>";t+="<div class='searchResultsSection'>";t+="<div class='loadingdiv'><\/div>";t+="<\/div>";t+="<div class='collectionSection'>";t+="<header>"+n.options.collectionTitle+"<\/header>";t+="<div class='collectionListContainer'>";t+="<div class='collectionList'><\/div>";t+="<\/div>";t+="<\/div>";$(n.element).html(t);n._controls.searchInput=$(this.element).find(".searchSection input[type='text']");n._controls.useCultureFilter=$(this.element).find(".searchSection input[type='checkbox']");n._controls.searchInput.apitriggertextbox({trimOuterSpaces:!0,change:function(t,i){n._performTextSearch(i.text,n.getSearchCultureFilter())}});$(this.element).find(".searchSection button").button();n.options.sortable&&$(this.element).find(".collectionList").sortable({axis:"y"});typeof n.options.getInitialSearchResults=="function"&&n._handleGetSearchResultsCall(n.options.getInitialSearchResults(this,"0"),!0);Array.isArray(n.options.getInitialSearchResults)&&n._handleGetSearchResultsCall(n.options.getInitialSearchResults);typeof n.options.getInitialCollectionItems=="function"&&n._handleGetInitialCollectionItemsCall(n.options.getInitialCollectionItems(this))},getUseCultureFilterValue:function(){return this._controls.useCultureFilter?this._controls.useCultureFilter.val():!1},getSearchCultureFilter:function(){return this.getUseCultureFilterValue()?max7app.filterCultureCode:""},focusSearch:function(){this._controls.searchInput.focus()},_performTextSearch:function(n){var t=this,i;typeof t.options.getSearchResults=="function"?(t._searchInstance++,$(t.element).find(".searchResultsSection").addClass("loading"),t._handleGetSearchResultsCall(t.options.getSearchResults(n,t,t._searchInstance.toString()),!1)):(i=[],t._initialSearchResultsData&&t._initialSearchResultsData.length&&$.each(t._initialSearchResultsData,function(t,r){var u=!1;for(var f in r)r.hasOwnProperty(f)&&typeof r[f]=="string"&&(u=u||r[f].toLowerCase().indexOf(n.toLowerCase())>-1);u&&i.push(r)}),t._handleGetSearchResultsCall(i,!1,t._INITIAL_SEARCH_INSTANCE.toString()))},getInitialCollectionItemsCallback:function(n){!Array.isArray(n)&&n.Resources&&(n=n.Resources);$(this.element).find(".collectionList").html("").show();var t=this;t._collectionData=n;$.each(n,function(n,i){t._addCollectionListItem(i)});t.options.collectionChanged&&t.options.collectionChanged()},getSaveData:function(){var t=this,n=[];return $.each($(this.element).find(".collectionListContainer .collectionList .item"),function(i,r){var u=$(r).attr("data-id"),f=t._getCollectionListItemDataById(u);f?n.push(f):alert("Could not find the data for item "+u)}),n},getCollectionLength:function(){return $(this.element).find(".collectionListContainer .collectionList .item").length},_handleGetSearchResultsCall:function(n,t,i){n?this.getSearchResultsCallback(n,i||null):t&&$(this.element).find(".searchResultsSection").addClass("loading")},_handleGetInitialCollectionItemsCall:function(n){n?this.getInitialCollectionItemsCallback(n,null):$(this.element).find(".collectionList").html("<div class='loadingdiv'><\/div>").show()},getSearchResultsCallback:function(n,t){var i,f,r,u,e;if(!Array.isArray(n)&&n.Resources&&(n=n.Resources),i=this,i._initialSearchResultsData||(i._initialSearchResultsData=n),t==null||t==i._searchInstance.toString()){f=0;this._searchResultsData=n;r="";r+="<header><span class='description'><\/span><span class='loadingdiv'><\/span><\/header>";r+="<div class='searchListContainer'>";r+="<div class='searchList'>";r+="<\/div>";r+="<\/div>";u=$(this.element).find(".searchResultsSection");u.removeClass("loading").html(r);e=u.find(".searchList");$.each(n,function(n,t){var o=i.idExistsInCollection(t.ID),r,u,s;o||f++;r=$("<div class='item' data-id='"+t.ID+"'"+(o?" style='display: none'":"")+"><\/div>").appendTo(e);i.options.searchResultRenderer(r,t);u=r.find(".addButton");u&&u.length!==0||(s=$("<div/>",{"class":"addButtonContainer"}).appendTo(r),u=$("<button/>",{"class":"addButton orangebutton tinybutton",text:i.options.defaultAddButtonText}).appendTo(s).button());u.on("click",function(n){n.preventDefault();i.moveSearchResultToCollection(r)})});this._updateSearchResultsCount(f);
3e.find(".item").on("dblclick",function(){i.moveSearchResultToCollection(this)});u.show()}},_incrementSearchResultsCount:function(){this._updateSearchResultsCount(this._searchResultsCount+1)},_decrementSearchResultsCount:function(){this._updateSearchResultsCount(this._searchResultsCount-1)},_updateSearchResultsCount:function(n){$(this.element).find(".searchResultsSection header:first-child .description").html(n+" results");this._searchResultsCount=n},idExistsInCollection:function(n){var i=this._collectionData.length,t;if(i)for(t=0;t<i;t++)if(this._collectionData[t].ID==n)return!0;return!1},moveSearchResultToCollection:function(n){var u=$(n).offset(),e=$(n).outerWidth(),o=$(n).outerHeight(),s=$(n).attr("data-id"),h=this._getSearchResultById(s),t=this._addCollectionListItem(h),r,i;t.css("opacity",0);$(this.element).find(".collectionListContainer").scrollTop($(this.element).find(".collectionList").height());var f=$(t).offset(),c=$(t).outerWidth(),l=$(t).outerHeight();$("body").append("<div class='animatedTransferFrame' style='left: "+u.left+"px; top: "+u.top+"px; width: "+e+"px; height: "+o+"px'><\/div>");r=$(".animatedTransferFrame");i=400;$(n).animate({height:0,opacity:0},i,function(){$(n).hide()});r.animate({top:f.top,left:f.left,width:c,height:l},i,function(){$(r).remove()});t.show().animate({opacity:1},i);this._decrementSearchResultsCount();this.options.collectionChanged&&this.options.collectionChanged()},removeItemFromCollection:function(n){var f=$(n).offset(),h=$(n).outerWidth(),c=$(n).outerHeight(),e=$(n).attr("data-id"),o=this._getCollectionListItemIndexById(e),i,t,u;if(o>-1&&this._collectionData.splice(o,1),i=$(this.element).find(".searchResultsSection .item[data-id='"+e+"']"),t=400,i.length>0){var r=$(this.element).find(".searchResultsSection .searchListContainer"),s=$(r).offset(),l=$(r).outerWidth(),a=$(r).outerHeight();$("body").append("<div class='animatedTransferFrame' style='left: "+f.left+"px; top: "+f.top+"px; width: "+h+"px; height: "+c+"px'><\/div>");u=$(".animatedTransferFrame");u.animate({top:s.top,left:s.left,width:l,height:a},t,function(){$(u).remove()})}$(n).animate({height:0,opacity:0},t,function(){$(n).remove()});i.css({height:"",opacity:1}).slideDown(t);this._incrementSearchResultsCount()},_getSearchResultById:function(n){var t=null;return $.each(this._searchResultsData,function(i,r){r.ID==n&&(t=r)}),t},_getCollectionListItemDataById:function(n){var t=null;return $.each(this._collectionData,function(i,r){r.ID==n&&(t=r)}),t},_getCollectionListItemIndexById:function(n){var t=-1;return $.each(this._collectionData,function(i,r){r.ID==n&&(t=i)}),t},_collectionData:[],_addCollectionListItem:function(n){var i=this,r=$($(this.element).find(".collectionList")),t;r.append("<div class='item' data-id='"+n.ID+"'><\/div>");t=r.find(".item:last");i.options.collectionItemRenderer(t,n);t.find(".removeButton").length===0&&$("<button />",{"class":"removeButton",html:i.options.defaultRemoveButtonText}).button();t.find(".removeButton").on("click",function(n){n.preventDefault();i.removeItemFromCollection(t)});t.on("dblclick",function(n){n.preventDefault();i.removeItemFromCollection(t)});return this._collectionData.push(n),t}});max7app.collectioneditor={showdialog:function(n){var t={options:n,element:null,show:function(){var t=this;t.element=max7app.destroyAndCreateDivById("CollectionEditorDlg");$(t.element).collectioneditor("instance")!==undefined&&$(t.element).collectioneditor("destroy");$(t.element).collectioneditor(t.options);t.element.dialog({title:n.title,width:600,height:600,modal:!0,stack:!0,dialogClass:"hideClose",buttons:[{text:max7app.displayText("CancelText"),"class":"cancelButton",click:function(){$(this).dialog("close")}},{text:n.saveButtonText||max7app.displayText("SaveButtonText"),"class":"orangebutton saveButton",click:function(){if(t.enableSaveButton(!1),typeof t.options.save=="function"){var n=t.options.save($(t.element).collectioneditor("getSaveData"),t);n===!0&&$(t.element).dialog("close");n==null&&$(t.element).dialog("disable")}else alert("No Save function has been defined - data has not been saved")}}],open:function(){t.enableSaveButton(!1)},close:function(){$(this).dialog("destroy").remove()}})},close:function(){$(self.element).dialog("close")},enableSaveButton:function(n){max7app.enableDialogSaveButton(this.element,"saveButton",n)},saveCallback:function(n){this.element.dialog("enable");n&&this.element.dialog("close")}};return t.options.collectionChanged=function(){t.enableSaveButton($(t.element).collectioneditor("getCollectionLength")>0)},t.show(),t},showscreen:function(n){const t={options:n,element:null,show:function(){var t=this;t.element=max7app.createModalScreen("CollectionEditorDlg");const i=$("<div/>",{"class":"layout"}).appendTo(t.element);$("<div/>",{"class":"modal-screen-title",text:n.title}).appendTo(i);t.editor=$("<div/>").collectioneditor(t.options).appendTo(i);const r=$("<div/>",{"class":"modal-screen-buttons-container"}).appendTo(i);t.savebutton=$("<button />",{"class":"modal-screen-submit-button",text:n.saveButtonText||max7app.displayText("SaveButtonText")}).on("click",function(){if(t.showSavingText(),t.enableSaveButton(!1),typeof t.options.save=="function"){const i=t.editor.collectioneditor("getSaveData"),n=t.options.save(i,t);n===!0&&max7app.hideModalScreen(t.element);n==null&&t.enableSaveButton(!1)}else alert("No Save function has been defined - data has not been saved")}).appendTo(r);max7app.showModalScreen(t.element);t.editor.collectioneditor("focusSearch");t.enableSaveButton(!1)},close:function(){max7app.hideModalScreen(this.element)},enableSaveButton:function(n){this.savebutton.prop("disabled",!n)},getCollectionLength:function(){return this.editor.collectioneditor("getCollectionLength")},showSavingText:function(){n.savingButtonText&&this.savebutton.text(n.savingButtonText)},removeSavingText:function(){this.savebutton.text(n.saveButtonText||max7app.displayText("SaveButtonText"))},saveCallback:function(n){this.enableSaveButton(!0);this.removeSavingText();n&&this.close()}};return t.options.collectionChanged=function(){t.enableSaveButton(t.getCollectionLength()>0)},t.show(),t},searchFunctions:{getDefaultResourceSearchFunction:function(n){var t=this._createDefaultResourceSearchFunction(n);return t.searchFunction},_createDefaultResourceSearchFunction:function(n){return{searchFunction:function(t,i,r){max7app.apiCall({method:"collectioneditor/searchresources",clientstate:r,parameters:{searchText:t,person:max7app.person.ID,includePrivate:n.includePrivate===!0,includeUnmoderated:n.includeUnmoderated===!0,includeRejected:n.includeRejected===!0,includeDeleted:n.includeDeleted===!0,requireComponents:n.requireComponents===!0,culture:"",channel:max7app.channelGuid,language:max7app.languageCode},success:function(t,r){var u=[];$.each(t.Resources,function(t,i){var r=!0;Array.isArray(n.excludeResources)&&$.each(n.excludeResources,function(n,t){i.ID==t&&(r=!1)});n.includeResources===!1&&i.ResourceType==max7app.RESOURCETYPE_RESOURCE&&(r=!1);n.includeLibraries===!1&&i.ResourceType==max7app.RESOURCETYPE_LIBRARY&&(r=!1);r&&u.push(i)});t.Resources=u;i.getSearchResultsCallback(t,r)}})}}},getDefaultSearchResourcesExceptInLibraryFunction:function(n){var t=this._createDefaultSearchResourcesExceptLibraryFolderFunction(n);return t.searchFunction},_createDefaultSearchResourcesExceptLibraryFolderFunction:function(n){return{searchFunction:function(t,i,r){max7app.apiCall({method:"collectioneditor/SearchResourcesExcludingLibraryFolder",parameters:{searchText:t,person:max7app.person.ID,includePrivate:n.includePrivate===!0,includeUnmoderated:n.includeUnmoderated===!0,includeRejected:n.includeRejected===!0,includeDeleted:n.includeDeleted===!0,requireComponents:n.requireComponents===!0,library:n.library,folder:n.folder,culture:"",channel:max7app.channelGuid,language:max7app.languageCode},clientstate:r,success:function(t,r){var f,o,u,e;if(t&&t.Resources.length&&n.excludeResources&&n.excludeResources.length){for(f=[],o=t.Resources.length,u=0;u<o;
3u++)e=t.Resources[u],n.excludeResources.indexOf(e.ID)<0&&f.push(e);t=f}i.getSearchResultsCallback(t,r)}})}}},getDefaultSearchResourcesInLibraryFunction:function(n){var t=this._createDefaultSearchResourcesLibraryFolderFunction(n);return t.searchFunction},_createDefaultSearchResourcesLibraryFolderFunction:function(n){return{searchFunction:function(t,i,r){max7app.apiCall({method:"collectioneditor/SearchResourcesInLibrary",parameters:{searchText:t,person:max7app.person.ID,includePrivate:n.includePrivate===!0,includeUnmoderated:n.includeUnmoderated===!0,includeRejected:n.includeRejected===!0,includeDeleted:n.includeDeleted===!0,requireComponents:n.requireComponents===!0,library:n.library,culture:"",channel:max7app.channelGuid,language:max7app.languageCode},clientstate:r,success:function(t,r){var f,o,u,e;if(t&&t.Resources.length&&n.excludeResources&&n.excludeResources.length){for(f=[],o=t.Resources.length,u=0;u<o;u++)e=t.Resources[u],n.excludeResources.indexOf(e.ID)<0&&f.push(e);t=f}i.getSearchResultsCallback(t,r)}})}}},getDefaultLibraryAndFoldersSearchFunction:function(n){var t=this._createDefaultLibraryAndFoldersSearchFunction(n);return t.searchFunction},_createDefaultLibraryAndFoldersSearchFunction:function(n){return{searchFunction:function(t,i,r){max7app.apiCall({method:"collectioneditor/SearchLibraries",clientstate:r,parameters:{searchText:t,person:max7app.person.ID,includePrivate:n.includePrivate===!0,includeUnmoderated:n.includeUnmoderated===!0,includeRejected:n.includeRejected===!0,includeDeleted:n.includeDeleted===!0,culture:max7app.filterCultureCode,channel:max7app.channelGuid,language:max7app.languageCode},success:function(t,r){var u=[];$.each(t.Resources,function(t,i){var r=!0;Array.isArray(n.excludeResources)&&$.each(n.excludeResources,function(n,t){i.ID==t&&(r=!1)});n.includeResources===!1&&i.ResourceType==max7app.RESOURCETYPE_RESOURCE&&(r=!1);n.includeLibraries===!1&&i.ResourceType==max7app.RESOURCETYPE_LIBRARY&&(r=!1);r&&u.push(i)});t.Resources=u;i.getSearchResultsCallback(t,r)}})}}},getDefaultPersonSearchFunction:function(n){var t=this._createDefaultPersonSearchFunction(n);return t.searchFunction},_createDefaultPersonSearchFunction:function(n){return{searchFunction:function(t,i,r){max7app.apiCall({method:"collectioneditor/searchpeople",clientstate:r,parameters:{searchText:t},success:function(t,r){if(n.excludePeople&&Array.isArray(n.excludePeople)){var u=[];$.each(t,function(t,i){var r=!0;$.each(n.excludePeople,function(n,t){i.ID==t&&(r=!1)});r&&u.push(i)});t=u}i.getSearchResultsCallback(t,r)}})}}}},searchResultRenderers:{getResourceRenderer:function(n){return this._createResourceRenderer(n).renderer},_createResourceRenderer:function(n){var t=this;return{renderer:function(i,r){return t._resourceRenderer(i,r,n)}}},defaultResourceSearchResultRenderer:function(){this._resourceRenderer()},_resourceRenderer:function(n,t,i){var r,u,f;$(n).addClass("resource");html="<img class='logo' src='"+max7app.contentStoreUrlManager.getImageUrl(t.Guid,t.ImageIndex,"resourcelist",t.Categories)+"' /><div class='details'><div class='title'>"+t.Title+"<\/div>";html+="<div class='categories'>";html+=t.ResourceType==max7app.RESOURCETYPE_LIBRARY?max7appdata.phrases.LIBRARY_TEXT:max7app.displayText("ResourceText");r=max7app.getResourceTypeCategories(t.Categories);r.length>0&&(html+=" | "+r.join(", "));html+="<\/div>";i.showRating===!0&&(html+=max7app.getRatingHtml(t.AverageRating));html+="<\/div>";i.showPreviewButton===!0&&max7app.previewManager.canDisplayPreview(t)&&(html+="<button class='previewButton'>"+max7app.displayText("PreviewButton")+"<\/button>");i.showAddButton===!0&&(u=i.addButtonText?i.addButtonText:max7app.displayText("AddButtonText"),html+="<button class='addButton'>"+u+"<\/button>");i.showRemoveButton===!0&&(f=i.removeButtonText?i.removeButtonText:max7app.displayText("RemoveButtonText"),html+="<button class='removeButton'>"+f+"<\/button>");$(n).html(html);$(n).find(".addButton").button();$(n).find(".previewButton").button().on("click",function(){max7app.previewManager.showFullScreenPreview(t)});$(n).find(".removeButton").button()},getPersonRenderer:function(n){return this._createPersonRenderer(n).renderer},_createPersonRenderer:function(n){var t=this;return{renderer:function(i,r){return t._personRenderer(i,r,n)}}},_personRenderer:function(n,t,i){var r,u;i=i||{};i.showAddButton=i.showAddButton||!1;i.showAddButton=i.showRemoveButton||!1;$(n).addClass("person");html="<img class='logo' src='"+max7app.getPersonIconUrl(t.Guid,t.IconType,t.IconID)+"' />";html+="<div class='details'>";html+="<div class='name'>"+(t.FirstName+" "+t.LastName).trim()+"<\/div>";html+="<div class='username'>"+t.UserName+"<\/div>";html+="<\/div>";i.showAddButton===!0&&(r=i.addButtonText?i.addButtonText:max7app.displayText("AddButtonText"),html+="<button class='addButton'>"+r+"<\/button>
3");i.showRemoveButton===!0&&(u=i.removeButtonText?i.removeButtonText:max7app.displayText("RemoveButtonText"),html+="<button class='removeButton'>"+u+"<\/button>");$(n).html(html);$(n).find(".addButton").button();$(n).find(".removeButton").button()}}};$.widget("max7.apitriggertextbox",{options:{restTime:200,raiseEventOnBlankText:!1,trimOuterSpaces:!1,preventFormSubmissionOnEnter:!0},_create:function(){var n=this;if(!$(n.element).is("input"))throw"apitriggertextbox may only be applied to input elements";n._currentValue=$(n.element).val();n.options.trimOuterSpaces&&(n._currentValue=n._currentValue.trim());n._currentTimer=null;$(n.element).on("keydown",function(t){if(n.options.preventFormSubmissionOnEnter&&t.keyCode==13)return t.preventDefault(),!1;n._checkUpdate(t)}).on("keyup",function(t){n._checkUpdate(t)}).on("blur",function(t){n._checkUpdate(t)})},_destroy:function(){var n=this;$(n.element).off("keydown").off("keyup").off("blur")},_checkUpdate:function(){var n=this,t=$(n.element).val();n.options.trimOuterSpaces&&(t=t.trim());t!==n._currentValue&&(t!==""||n.options.raiseEventOnBlankText)&&(n._currentValue=t,n._launchTimer())},_launchTimer:function(){var n=this;n._currentTimer!=null&&clearTimeout(n._currentTimer);n._currentTimer=setTimeout(function(){n._triggerUpdate()},n.options.restTime)},_triggerUpdate:function(){var n=this,t;n._currentTimer=null;t=$(n.element).val();n.options.trimOuterSpaces&&(t=t.trim());n._trigger("change",null,{text:t})}});$.widget("max7.filterablelist",{_INITIAL_SEARCH_INSTANCE:0,options:{getInitialSearchResults:null,getSearchResults:null,searchResultRenderer:null,searchInput:null,actionButtons:[{code:"select",text:"Select","class":"selectButton",isDefault:!0,visible:!1}],actionButtonClick:null},_create:function(){var n=this;this._initialSearchResultsData=null;this._searchInstance=this._INITIAL_SEARCH_INSTANCE;n._collectionData=[];$(n.element).addClass("max7filterableList");n._controls={header:null};n._controls.loadingAnimation=$("<div class='loadingdiv'><\/div>").appendTo($(n.element));n.options.searchInput&&n.options.searchInput.apitriggertextbox({raiseEventOnBlankText:!0,trimOuterSpaces:!0,change:function(t,i){n.performFilter(i.text)}});$(this.element).find(".searchSection button").button();n.options.sortable&&$(this.element).find(".collectionList").sortable({axis:"y"});typeof n.options.getInitialSearchResults=="function"&&n._handleGetSearchResultsCall(n.options.getInitialSearchResults(function(t){n._initialSearchResultsData=t;n.performFilter(n._filterText||"")}),!0);Array.isArray(n.options.getInitialSearchResults)&&n._handleGetSearchResultsCall(n.options.getInitialSearchResults)},_showLoadingAnimation:function(){this._controls.loadingAnimation.show()},_hideLoadingAnimation:function(){this._controls.loadingAnimation.hide()},performFilter:function(n){var t=this,i;t._filterText=n;n||t._handleGetSearchResultsCall(t._initialSearchResultsData,!1,t._INITIAL_SEARCH_INSTANCE.toString());typeof t.options.getSearchResults=="function"?(t._searchInstance++,t._showLoadingAnimation(),t._handleGetSearchResultsCall(t.options.getSearchResults(n,t,t._searchInstance.toString()),!1)):(i=[],t._initialSearchResultsData&&t._initialSearchResultsData.length&&($.each(t._initialSearchResultsData,function(t,r){var u=!1;for(var f in r)r.hasOwnProperty(f)&&typeof r[f]=="string"&&(u=u||r[f].toLowerCase().indexOf(n.toLowerCase())>-1);u&&i.push(r)}),t._handleGetSearchResultsCall(i,!1,t._INITIAL_SEARCH_INSTANCE.toString())))},_handleGetSearchResultsCall:function(n,t,i){var r=this;n?this.applySearchResults(n,i||null):t&&r._showLoadingAnimation()},applySearchResults:function(n,t){var i,e,u,r,f;if(!Array.isArray(n)&&n.Resources&&(n=n.Resources),i=this,t==null||t==i._searchInstance.toString()){if($(i.element).hide(),e=0,this._searchResultsData=n,i._hideLoadingAnimation(),i._controls.header===null&&(i._controls.header=$("<header />").appendTo($(i.element))),u=$(i.element).find(".searchListContainer"),u.length==0&&(u=$("<div class='searchListContainer'><\/div>
3").appendTo($(i.element))),r=u.find(".searchList"),r.length==0?r=$("<div class='searchList'><\/div>").appendTo(u):r.empty(),f=null,$.each(i.options.actionButtons,function(n,t){t.isDefault&&(f=t.code)}),$.each(n,function(n,t){var f=i.idExistsInCollection(t.ID),u;f||e++;u=$("<div class='item' data-id='"+t.ID+"'"+(f?" style='display: none'":"")+"><\/div>").appendTo(r);i.options.searchResultRenderer(u,t);i.options.actionButtons&&$.each(i.options.actionButtons,function(n,r){var f,e,o;if(r.visible!==!1&&(f=u.find(`.${r.class}`),e=r.code,f&&f.length!==0||(o=$("<div/>",{"class":"actionButtonContainer"}).appendTo(u),addButton=$("<button/>",{"class":r.class,text:r.text}).appendTo(o).button()),i.options.actionButtonClick))f.on("click",function(n){n.preventDefault();i.options.actionButtonClick(t,u,e)})})}),this._updateSearchResultsCount(e),f)r.find(".item").on("dblclick",function(){var n=$(this),t=n.attr("data-id"),r=i._getSearchResultById(t);i.options.actionButtonClick(r,n,f)});r.find(".item").on("click",function(){var n=$(this),t=n.attr("data-id"),r=i._getSearchResultById(t);i.options.actionButtonClick(r,n,"click")});$(i.element).show()}},_updateSearchResultsCount:function(n){this._controls.header.html(n+" results");this._searchResultsCount=n},idExistsInCollection:function(n){var i=this._collectionData.length,t;if(i)for(t=0;t<i;t++)if(this._collectionData[t].ID==n)return!0;return!1},_getSearchResultById:function(n){var t=null;return $.each(this._searchResultsData,function(i,r){r.ID==n&&(t=r)}),t}});!function(n){"use strict";"function"==typeof define&&define.amd?define(["jquery"],n):"undefined"!=typeof module&&module.exports?module.exports=n(require("jquery")):n(jQuery)}(function(n,t){"use strict";var w,f,y,r,c,s,u,i,b,k,v,a;if(!n.jstree){var nt=0,h=!1,o=!1,l=!1,d=[],a=n("script:last").attr("src"),e=window.document,p=window.setImmediate,g=window.Promise;if(!p&&g&&(p=function(n,t){g.resolve(t).then(n)}),n.jstree={version:"3.3.15",defaults:{plugins:[]},plugins:{},path:a&&-1!==a.indexOf("/")?a.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},n.jstree.create=function(t,i){var r=new n.jstree.core(++nt),u=i;return i=n.extend(!0,{},n.jstree.defaults,i),u&&u.plugins&&(i.plugins=u.plugins),n.each(i.plugins,function(n,t){"core"!==n&&(r=r.plugin(t,i[t]))}),n(t).data("jstree",r),r.init(t,i),r},n.jstree.destroy=function(){n(".jstree:jstree").jstree("destroy");n(e).off(".jstree")},n.jstree.core=function(n){this._id=n;this._cnt=0;this._wrk=null;this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},n.jstree.reference=function(t){var r=null,i=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!i||!i.length)try{i=n(t)}catch(i){}if(!i||!i.length)try{i=n("#"+t.replace(n.jstree.idregex,"\\$&"))}catch(i){}return i&&i.length&&(i=i.closest(".jstree")).length&&(i=i.data("jstree"))?r=i:n(".jstree").each(function(){var i=n(this).data("jstree");if(i&&i._model.data[t])return r=i,!1}),r},n.fn.jstree=function(i){var u="string"==typeof i,f=Array.prototype.slice.call(arguments,1),r=null;return!(!0===i&&!this.length)&&(this.each(function(){var e=n.jstree.reference(this),o=u&&e?e[i]:null;if(r=u&&o?o.apply(e,f):null,e||u||i!==t&&!n.isPlainObject(i)||n.jstree.create(this,i),null!==(r=e&&!u||!0===i?e||!1:r)&&r!==t)return!1}),null!==r&&r!==t?r:this)},n.expr.pseudos.jstree=n.expr.createPseudo(function(){return function(i){return n(i).hasClass("jstree")&&n(i).data("jstree")!==t}}),n.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:n.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,compute_elements_positions:!1,keyboard:{"ctrl-space":function(t){t.type="click";n(t.currentTarget).trigger(t)},enter:function(t){t.type="click";n(t.currentTarget).trigger(t)},left:function(t){var t;t.preventDefault();this.is_open(t.currentTarget)?this.close_node(t.currentTarget):(t=this.get_parent(t.currentTarget))&&t.id!==n.jstree.root&&this.get_node(t,!0).children(".jstree-anchor").trigger("focus")},up:function(n){n.preventDefault();var n=this.get_prev_dom(n.currentTarget);n&&n.length&&n.children(".jstree-anchor").trigger("focus")},right:function(t){var t;t.preventDefault();this.is_closed(t.currentTarget)?this.open_node(t.currentTarget,function(n){this.get_node(n,!0).children(".jstree-anchor").trigger("focus")}):!this.is_open(t.currentTarget)||(t=this.get_node(t.currentTarget,!0).children(".jstree-children")[0])&&n(this._firstChild(t)).children(".jstree-anchor").trigger("focus")},down:function(n){n.preventDefault();var n=this.get_next_dom(n.currentTarget);n&&n.length&&n.children(".jstree-anchor").trigger("focus")},"*":function(){this.open_all()},home:function(t){t.preventDefault();var t=this._firstChild(this.get_container_ul()[0]);t&&n(t).children(".jstree-anchor").filter(":visible").trigger("focus")},end:function(n){n.preventDefault();this.element.find(".jstree-anchor").filter(":visible").last().trigger("focus")},f2:function(n){n.preventDefault();this.edit(n.currentTarget)}}},n.jstree.core.prototype={plugin:function(t,i){var r=n.jstree.plugins[t];return r?(this._data[t]={},r.prototype=this,new r(i,this)):this},init:function(t,i){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}};this._model.data[n.jstree.root]={id:n.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}};this.element=n(t).addClass("jstree jstree-"+this._id);this.settings=i;this._data.core.ready=!1;this._data.core.loaded=!1;this._data.core.rtl="rtl"===this.element.css("direction");this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl");this.element.attr("role","tree");this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0);this.element.attr("tabindex")||this.element.attr("tabindex","0");this.bind();this.trigger("init");this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0);this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove();this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='none'><i class='jstree-icon jstree-ocl'><\/i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden'><\/i>"+this.get_string("Loading ...")+"<\/a><\/li><\/ul>");this.element.attr("aria-activedescendant","j"+this._id+"_loading");this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24;this._data.core.node=this._create_prototype_node();this.trigger("loading");this.load_node(n.jstree.root)},destroy:function(n){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk);this._wrk=null}catch(n){}n||this.element.empty();this.teardown()},_create_prototype_node:function(){var t=e.createElement("LI"),n,i;return t.setAttribute("role","none"),(n=e.createElement("I")).className="jstree-icon jstree-ocl",n.setAttribute("role","presentation"),t.appendChild(n),(n=e.createElement("A")).className="jstree-anchor",n.setAttribute("href","#"),n.setAttribute("tabindex","-1"),n.setAttribute("role","treeitem"),(i=e.createElement("I")).className="jstree-icon jstree-themeicon",i.setAttribute("role","presentation"),n.appendChild(i),t.appendChild(n),n=i=null,t},_kbevent_to_func:function(n){var f={8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},t=[],r,u,i;
vendor: 42,662 bytes, line 3
3if(n.ctrlKey&&t.push("ctrl"),n.altKey&&t.push("alt"),n.shiftKey&&t.push("shift"),t.push(f[n.which]?f[n.which].toLowerCase():n.which),"shift-shift"===(t=t.sort().join("-").toLowerCase())||"ctrl-ctrl"===t||"alt-alt"===t)return null;r=this.settings.core.keyboard;for(u in r)if(r.hasOwnProperty(u)&&(i="-"!==(i=u)&&"+"!==i?(i=i.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase():i)===t)return r[u];return null},teardown:function(){this.unbind();this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")});this.element=null},bind:function(){var t="",i=null,r=0;this.element.on("dblclick.jstree",function(n){if(n.target.tagName&&"input"===n.target.tagName.toLowerCase())return!0;if(e.selection&&e.selection.empty)e.selection.empty();else if(window.getSelection){var n=window.getSelection();try{n.removeAllRanges();n.collapse()}catch(n){}}}).on("mousedown.jstree",function(n){n.target===this.element[0]&&(n.preventDefault(),r=+new Date)}.bind(this)).on("mousedown.jstree",".jstree-ocl",function(n){n.preventDefault()}).on("click.jstree",".jstree-ocl",function(n){this.toggle_node(n.target)}.bind(this)).on("dblclick.jstree",".jstree-anchor",function(n){if(n.target.tagName&&"input"===n.target.tagName.toLowerCase())return!0;this.settings.core.dblclick_toggle&&this.toggle_node(n.target)}.bind(this)).on("click.jstree",".jstree-anchor",function(t){t.preventDefault();t.currentTarget!==e.activeElement&&n(t.currentTarget).trigger("focus");this.activate_node(t.currentTarget,t)}.bind(this)).on("keydown.jstree",".jstree-anchor",function(n){var t,n;return n.target.tagName&&"input"===n.target.tagName.toLowerCase()?!0:(this._data.core.rtl&&(37===n.which?n.which=39:39===n.which&&(n.which=37)),t=this._kbevent_to_func(n),t&&(n=t.call(this,n),!1===n||!0===n)?n:void 0)}.bind(this)).on("load_node.jstree",function(t,i){i.status&&(i.node.id!==n.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){for(var i=[],t=0,r=this._data.core.selected.length;t<r;t++)i=i.concat(this._model.data[this._data.core.selected[t]].parents);for(t=0,r=(i=n.vakata.array_unique(i)).length;t<r;t++)this.open_node(i[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}}.bind(this),0))}.bind(this)).on("keypress.jstree",function(r){if(r.target.tagName&&"input"===r.target.tagName.toLowerCase())return!0;i&&clearTimeout(i);i=setTimeout(function(){t=""},500);var o=String.fromCharCode(r.which).toLowerCase(),f=this.element.find(".jstree-anchor").filter(":visible"),r=f.index(e.activeElement)||0,u=!1;if(1<(t+=o).length){if(f.slice(r).each(function(i,r){if(0===n(r).text().toLowerCase().indexOf(t))return n(r).trigger("focus"),!(u=!0)}.bind(this)),u)return;if(f.slice(0,r).each(function(i,r){if(0===n(r).text().toLowerCase().indexOf(t))return n(r).trigger("focus"),!(u=!0)}.bind(this)),u)return}new RegExp("^"+o.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(t)&&(f.slice(r+1).each(function(t,i){if(n(i).text().toLowerCase().charAt(0)===o)return n(i).trigger("focus"),!(u=!0)}.bind(this)),u||f.slice(0,r+1).each(function(t,i){if(n(i).text().toLowerCase().charAt(0)===o)return n(i).trigger("focus"),!(u=!0)}.bind(this)))}.bind(this)).on("init.jstree",function(){var n=this.settings.core.themes;this._data.core.themes.dots=n.dots;this._data.core.themes.stripes=n.stripes;this._data.core.themes.icons=n.icons;this._data.core.themes.ellipsis=n.ellipsis;this.set_theme(n.name||"default",n.url);this.set_theme_variant(n.variant)}.bind(this)).on("loading.jstree",function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"]();this[this._data.core.themes.icons?"show_icons":"hide_icons"]();this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"]();this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()}.bind(this)).on("blur.jstree",".jstree-anchor",function(t){this._data.core.focused=null;n(t.currentTarget).filter(".jstree-hovered").trigger("mouseleave");this.element.attr("tabindex","0");n(t.currentTarget).attr("tabindex","-1")}.bind(this)).on("focus.jstree",".jstree-anchor",function(t){var i=this.get_node(t.currentTarget);i&&(i.id||0===i.id)&&(this._data.core.focused=i.id);this.element.find(".jstree-hovered").not(t.currentTarget).trigger("mouseleave");n(t.currentTarget).trigger("mouseenter");this.element.attr("tabindex","-1");n(t.currentTarget).attr("tabindex","0")}.bind(this)).on("focus.jstree",function(){var n;500<+new Date-r&&!this._data.core.focused&&this.settings.core.restore_focus&&(r=0,(n=this.get_node(this.element.attr("aria-activedescendant"),!0))&&n.find("> .jstree-anchor").trigger("focus"))}.bind(this)).on("mouseenter.jstree",".jstree-anchor",function(n){this.hover_node(n.currentTarget)}.bind(this)).on("mouseleave.jstree",".jstree-anchor",function(n){this.dehover_node(n.currentTarget)}.bind(this))},unbind:function(){this.element.off(".jstree");n(e).off(".jstree-"+this._id)},trigger:function(n,t){((t=t||{}).instance=this).element.triggerHandler(n.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(t){var i=this.settings.core.strings;return n.vakata.is_function(i)?i.call(this,t):i&&i[t]?i[t]:t},_firstChild:function(n){for(n=n?n.firstChild:null;null!==n&&1!==n.nodeType;)n=n.nextSibling;return n},_nextSibling:function(n){for(n=n?n.nextSibling:null;null!==n&&1!==n.nodeType;)n=n.nextSibling;return n},_previousSibling:function(n){for(n=n?n.previousSibling:null;null!==n&&1!==n.nodeType;)n=n.previousSibling;return n},get_node:function(t,i){var r;(t=t&&(t.id||0===t.id)?t.id:t)instanceof n&&t.length&&t[0].id&&(t=t[0].id);try{if(this._model.data[t])t=this._model.data[t];else if("string"==typeof t&&this._model.data[t.replace(/^#/,"")])t=this._model.data[t.replace(/^#/,"")];else if("string"==typeof t&&(r=n("#"+t.replace(n.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else if((r=this.element.find(t)).length&&this._model.data[r.closest(".jstree-node").attr("id")])t=this._model.data[r.closest(".jstree-node").attr("id")];else{if(!(r=this.element.find(t)).length||!r.hasClass("jstree"))return!1;t=this._model.data[n.jstree.root]}return i?t.id===n.jstree.root?this.element:n("#"+t.id.replace(n.jstree.idregex,"\\$&"),this.element):t}catch(t){return!1}},get_path:function(t,i,r){if(!(t=t.parents?t:this.get_node(t))||t.id===n.jstree.root||!t.parents)return!1;var f,e,u=[];for(u.push(r?t.id:t.text),f=0,e=t.parents.length;f<e;f++)u.push(r?t.parents[f]:this.get_text(t.parents[f]));return u=u.reverse().slice(1),i?u.join(i):u},get_next_dom:function(t,i){var r;if((t=this.get_node(t,!0))[0]===this.element[0]){for(r=this._firstChild(this.get_container_ul()[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);return!!r&&n(r)}if(!t||!t.length)return!1;if(i){r=t[0];do r=this._nextSibling(r);while(r&&0===r.offsetHeight);return!!r&&n(r)}if(t.hasClass("jstree-open")){for(r=this._firstChild(t.children(".jstree-children")[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);if(null!==r)return n(r)}r=t[0];do r=this._nextSibling(r);while(r&&0===r.offsetHeight);return null!==r?n(r):t.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(t,i){var r;if((t=this.get_node(t,!0))[0]===this.element[0]){for(r=this.get_container_ul()[0].lastChild;r&&0===r.offsetHeight;)r=this._previousSibling(r);return!!r&&n(r)}if(!t||!t.length)return!1;if(i){r=t[0];do r=this._previousSibling(r);while(r&&0===r.offsetHeight);return!!r&&n(r)}r=t[0];do r=this._previousSibling(r);while(r&&0===r.offsetHeight);if(null===r)return!(!(r=t[0].parentNode.parentNode)||!r.className||-1===r.className.indexOf("jstree-node"))&&n(r);for(t=n(r);t.hasClass("jstree-open");)t=t.children(".jstree-children").first().children(".jstree-node:visible:last");return t},get_parent:function(t){return!(!(t=this.get_node(t))||t.id===n.jstree.root)&&t.parent},get_children_dom:function(n){return(n=this.get_node(n,!0))[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!n||!n.length)&&n.children(".jstree-children").children(".jstree-node")},is_parent:function(n){return(n=this.get_node(n))&&(!1===n.state.loaded||0<n.children.length)},is_loaded:function(n){return(n=this.get_node(n))&&n.state.loaded},is_loading:function(n){return(n=this.get_node(n))&&n.state&&n.state.loading},is_open:function(n){return(n=this.get_node(n))&&n.state.opened},is_closed:function(n){return(n=this.get_node(n))&&this.is_parent(n)&&!n.state.opened},is_leaf:function(n){return!this.is_parent(n)},load_node:function(t,i){var f=this.get_node(t,!0),r,o,u,s,e;if(n.vakata.is_array(t))return this._load_nodes(t.slice(),i),!0;if(!(t=this.get_node(t)))return i&&i.call(this,t,!1),!1;if(t.state.loaded){for(t.state.loaded=!1,u=0,s=t.parents.length;u<s;u++)this._model.data[t.parents[u]].children_d=n.vakata.array_filter(this._model.data[t.parents[u]].children_d,function(i){return-1===n.inArray(i,t.children_d)});for(r=0,o=t.children_d.length;r<o;r++)this._model.data[t.children_d[r]].state.selected&&(e=!0),delete this._model.data[t.children_d[r]];e&&(this._data.core.selected=n.vakata.array_filter(this._data.core.selected,function(i){return-1===n.inArray(i,t.children_d)}));t.children=[];t.children_d=[];e&&this.trigger("changed",{action:"load_node",node:t,selected:this._data.core.selected})}return t.state.failed=!1,t.state.loading=!0,(t.id!==n.jstree.root?f.children(".jstree-anchor"):f).attr("aria-busy",!0),f.addClass("jstree-loading"),this._load_node(t,function(r){(t=this._model.data[t.id]).state.loading=!1;t.state.loaded=r;t.state.failed=!t.state.loaded;for(var u=this.get_node(t,!0),f=0,s=0,e=this._model.data,o=!1,f=0,s=t.children.length;f<s;f++)if(e[t.children[f]]&&!e[t.children[f]].state.hidden){o=!0;break}t.state.loaded&&u&&u.length&&(u.removeClass("jstree-closed jstree-open jstree-leaf"),o?"#"!==t.id&&u.addClass(t.state.opened?"jstree-open":"jstree-closed"):u.addClass("jstree-leaf"));(t.id!==n.jstree.root?u.children(".jstree-anchor"):u).attr("aria-busy",!1);u.removeClass("jstree-loading");this.trigger("load_node",{node:t,status:r});i&&i.call(this,t,r)}.bind(this)),!0},_load_nodes:function(n,t,i,r){for(var o=!0,h=function(){this._load_nodes(n,t,!0)},f=this._model.data,s=[],u=0,e=n.length;u<e;u++)!f[n[u]]||(f[n[u]].state.loaded||f[n[u]].state.failed)&&(i||!r)||(this.is_loading(n[u])||this.load_node(n[u],h),o=!1);if(o){for(u=0,e=n.length;u<e;u++)f[n[u]]&&f[n[u]].state.loaded&&s.push(n[u]);t&&!t.done&&(t.call(this,s),t.done=!0)}},load_all:function(t,i){if(t=t||n.jstree.root,!(t=this.get_node(t)))return!1;var f=[],e=this._model.data,u=e[t.id].children_d,r,o;for(t.state&&!t.state.loaded&&f.push(t.id),r=0,o=u.length;r<o;r++)e[u[r]]&&e[u[r]].state&&!e[u[r]].state.loaded&&f.push(u[r]);f.length?this._load_nodes(f,function(){this.load_all(t,i)}):(i&&i.call(this,t),this.trigger("load_all",{node:t}))},_load_node:function(t,i){var r=this.settings.core.data,f,u=function(){return 3!==this.nodeType&&8!==this.nodeType};return r?n.vakata.is_function(r)?r.call(this,t,function(r){!1===r?i.call(this,!1):this["string"==typeof r?"_append_html_data":"_append_json_data"](t,"string"==typeof r?n(n.parseHTML(r)).filter(u):r,function(n){i.call(this,n)})}.bind(this)):"object"==typeof r?r.url?(r=n.extend(!0,{},r),n.vakata.is_function(r.url)&&(r.url=r.url.call(this,t)),n.vakata.is_function(r.data)&&(r.data=r.data.call(this,t)),n.ajax(r).done(function(r,f,e){var o=e.getResponseHeader("Content-Type");return o&&-1!==o.indexOf("json")||"object"==typeof r?this._append_json_data(t,r,function(n){i.call(this,n)}):o&&-1!==o.indexOf("html")||"string"==typeof r?this._append_html_data(t,n(n.parseHTML(r)).filter(u),function(n){i.call(this,n)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:e})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1))}.bind(this)).fail(function(n){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:t.id,xhr:n})};i.call(this,!1);this.settings.core.error.call(this,this._data.core.last_error)}.bind(this))):(f=n.vakata.is_array(r)?n.extend(!0,[],r):n.isPlainObject(r)?n.extend(!0,{},r):r,t.id===n.jstree.root?this._append_json_data(t,f,function(n){i.call(this,n)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1))):"string"==typeof r?t.id===n.jstree.root?this._append_html_data(t,n(n.parseHTML(r)).filter(u),function(n){i.call(this,n)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:t.id})},this.settings.core.error.call(this,this._data.core.last_error),i.call(this,!1)):i.call(this,!1):t.id===n.jstree.root?this._append_html_data(t,this._data.core.original_container_html.clone(!0),function(n){i.call(this,n)}):i.call(this,!1)},_node_changed:function(t){(t=this.get_node(t))&&-1===n.inArray(t.id,this._model.changed)&&this._model.changed.push(t.id)},_append_html_data:function(t,i,r){(t=this.get_node(t)).children=[];t.children_d=[];var i=i.is("ul")?i.children():i,e=t.id,c=[],u=[],o=this._model.data,f=o[e],t=this._data.core.selected.length,s,h,l;for(i.each(function(t,i){(s=this._parse_model_from_html(n(i),e,f.parents.concat()))&&(c.push(s),u.push(s),o[s].children_d.length&&(u=u.concat(o[s].children_d)))}.bind(this)),f.children=c,f.children_d=u,h=0,l=f.parents.length;h<l;h++)o[f.parents[h]].children_d=o[f.parents[h]].children_d.concat(u);this.trigger("model",{nodes:u,parent:e});e!==n.jstree.root?(this._node_changed(e),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0));this._data.core.selected.length!==t&&this.trigger("changed",{action:"model",selected:this._data.core.selected});r.call(this,!0)},_append_json_data:function(t,i,r,u){if(null!==this.element){(t=this.get_node(t)).children=[];t.children_d=[];i.d&&"string"==typeof(i=i.d)&&(i=JSON.parse(i));n.vakata.is_array(i)||(i=[i]);var e=null,o={df:this._model.default_state,dat:i,par:t.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},f=this,s=function(n,t){var u=(n=n.data?n.data:n).dat,l=n.par,p=[],s=[],a=[],c=n.df,k=n.t_id,y=n.t_cnt,r=n.m,e=r[l],n=n.sel,h,i,o,v,w=function(n,i,u){u=u?u.concat():[];i&&u.unshift(i);var h=n.id.toString(),e,l,o,s,f={id:h,text:n.text||"",icon:n.icon===t||n.icon,parent:i,parents:u,children:n.children||[],children_d:n.children_d||[],data:n.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(e in c)c.hasOwnProperty(e)&&(f.state[e]=c[e]);if(n&&n.data&&n.data.jstree&&n.data.jstree.icon&&(f.icon=n.data.jstree.icon),f.icon!==t&&null!==f.icon&&""!==f.icon||(f.icon=!0),n&&n.data&&(f.data=n.data,n.data.jstree))for(e in n.data.jstree)n.data.jstree.hasOwnProperty(e)&&(f.state[e]=n.data.jstree[e]);if(n&&"object"==typeof n.state)for(e in n.state)n.state.hasOwnProperty(e)&&(f.state[e]=n.state[e]);if(n&&"object"==typeof n.li_attr)for(e in n.li_attr)n.li_attr.hasOwnProperty(e)&&(f.li_attr[e]=n.li_attr[e]);if(f.li_attr.id||(f.li_attr.id=h),n&&"object"==typeof n.a_attr)for(e in n.a_attr)n.a_attr.hasOwnProperty(e)&&(f.a_attr[e]=n.a_attr[e]);for(n&&n.children&&!0===n.children&&(f.state.loaded=!1,f.children=[],f.children_d=[]),e=0,l=(r[f.id]=f).children.length;e<l;e++)o=w(r[f.children[e]],f.id,u),s=r[o],f.children_d.push(o),s.children_d.length&&(f.children_d=f.children_d.concat(s.children_d));return delete n.data,delete n.children,r[f.id].original=n,f.state.selected&&a.push(f.id),f.id},b=function(n,i,u){u=u?u.concat():[];i&&u.unshift(i);var o=!1,e,l,s,h,f;do o="j"+k+"_"+ ++y;while(r[o]);for(e in f={id:!1,text:"string"==typeof n?n:"",icon:"object"!=typeof n||n.icon===t||n.icon,parent:i,parents:u,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},c)c.hasOwnProperty(e)&&(f.state[e]=c[e]);if(n&&(n.id||0===n.id)&&(f.id=n.id.toString()),n&&n.text&&(f.text=n.text),n&&n.data&&n.data.jstree&&n.data.jstree.icon&&(f.icon=n.data.jstree.icon),f.icon!==t&&null!==f.icon&&""!==f.icon||(f.icon=!0),n&&n.data&&(f.data=n.data,n.data.jstree))for(e in n.data.jstree)n.data.jstree.hasOwnProperty(e)&&(f.state[e]=n.data.jstree[e]);if(n&&"object"==typeof n.state)for(e in n.state)n.state.hasOwnProperty(e)&&(f.state[e]=n.state[e]);if(n&&"object"==typeof n.li_attr)for(e in n.li_attr)n.li_attr.hasOwnProperty(e)&&(f.li_attr[e]=n.li_attr[e]);if(f.li_attr.id&&!f.id&&0!==f.id&&(f.id=f.li_attr.id.toString()),f.id||0===f.id||(f.id=o),f.li_attr.id||(f.li_attr.id=f.id),n&&"object"==typeof n.a_attr)for(e in n.a_attr)n.a_attr.hasOwnProperty(e)&&(f.a_attr[e]=n.a_attr[e]);if(n&&n.children&&n.children.length){for(e=0,l=n.children.length;e<l;e++)s=b(n.children[e],f.id,u),h=r[s],f.children.push(s),h.children_d.length&&(f.children_d=f.children_d.concat(h.children_d));f.children_d=f.children_d.concat(f.children)}return n&&n.children&&!0===n.children&&(f.state.loaded=!1,f.children=[],f.children_d=[]),delete n.data,delete n.children,f.original=n,(r[f.id]=f).state.selected&&a.push(f.id),f.id};if(u.length&&u[0].id!==t&&u[0].parent!==t){for(i=0,o=u.length;i<o;i++)u[i].children||(u[i].children=[]),u[i].state||(u[i].state={}),r[u[i].id.toString()]=u[i];for(i=0,o=u.length;i<o;i++)r[u[i].parent.toString()]?(r[u[i].parent.toString()].children.push(u[i].id.toString()),e.children_d.push(u[i].id.toString())):void 0!==f&&(f._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:u[i].id.toString(),parent:u[i].parent.toString()})},f.settings.core.error.call(f,f._data.core.last_error));for(i=0,o=e.children.length;i<o;i++)h=w(r[e.children[i]],l,e.parents.concat()),s.push(h),r[h].children_d.length&&(s=s.concat(r[h].children_d));for(i=0,o=e.parents.length;i<o;i++)r[e.parents[i]].children_d=r[e.parents[i]].children_d.concat(s);v={cnt:y,mod:r,sel:n,par:l,dpc:s,add:a}}else{for(i=0,o=u.length;i<o;i++)(h=b(u[i],l,e.parents.concat()))&&(p.push(h),s.push(h),r[h].children_d.length&&(s=s.concat(r[h].children_d)));for(e.children=p,e.children_d=s,i=0,o=e.parents.length;i<o;i++)r[e.parents[i]].children_d=r[e.parents[i]].children_d.concat(s);v={cnt:y,mod:r,sel:n,par:l,dpc:s,add:a}}if("undefined"!=typeof window&&void 0!==window.document)return v;postMessage(v)},h=function(t,i){var u,o;if(null!==this.element){for(u in this._cnt=t.cnt,o=this._model.data)o.hasOwnProperty(u)&&o[u].state&&o[u].state.loading&&t.mod[u]&&(t.mod[u].state.loading=!0);if(this._model.data=t.mod,i){var h,c=t.add,e=t.sel,s=this._data.core.selected.slice(),o=this._model.data;if(e.length!==s.length||n.vakata.array_unique(e.concat(s)).length!==e.length){for(u=0,h=e.length;u<h;u++)-1===n.inArray(e[u],c)&&-1===n.inArray(e[u],s)&&(o[e[u]].state.selected=!1);for(u=0,h=s.length;u<h;u++)-1===n.inArray(s[u],e)&&(o[s[u]].state.selected=!0)}}t.add.length&&(this._data.core.selected=this._data.core.selected.concat(t.add));this.trigger("model",{nodes:t.dpc,parent:t.par});t.par!==n.jstree.root?(this._node_changed(t.par),this.redraw()):this.redraw(!0);t.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected});!i&&p?p(function(){r.call(f,!0)}):r.call(f,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+s.toString()],{type:"text/javascript"})));!this._data.core.working||u?(this._data.core.working=!0,(e=new window.Worker(this._wrk)).onmessage=function(n){h.call(this,n.data,!0);try{e.terminate();e=null}catch(n){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}.bind(this),e.onerror=function(){h.call(this,s(o),!1);this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}.bind(this),o.par?e.postMessage(o):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([t,i,r,!0])}catch(t){h.call(this,s(o),!1);this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else h.call(this,s(o),!1)}},_parse_model_from_html:function(i,r,u){u=u?[].concat(u):[];r&&u.unshift(r);var o,s,c=this._model.data,f={id:!1,text:!1,icon:!0,parent:r,parents:u,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},e,r,h;for(e in this._model.default_state)this._model.default_state.hasOwnProperty(e)&&(f.state[e]=this._model.default_state[e]);if(r=n.vakata.attributes(i,!0),n.each(r,function(t,i){return!(i=n.vakata.trim(i)).length||(f.li_attr[t]=i,void("id"===t&&(f.id=i.toString())))}),(r=i.children("a").first()).length&&(r=n.vakata.attributes(r,!0),n.each(r,function(t,i){(i=n.vakata.trim(i)).length&&(f.a_attr[t]=i)})),(r=(i.children("a").first().length?i.children("a").first():i).clone()).children("ins, i, ul").remove(),r=r.html(),r=n("<div><\/div>").html(r),f.text=this.settings.core.force_text?r.text():r.html(),r=i.data(),f.data=r?n.extend(!0,{},r):null,f.state.opened=i.hasClass("jstree-open"),f.state.selected=i.children("a").hasClass("jstree-clicked"),f.state.disabled=i.children("a").hasClass("jstree-disabled"),f.data&&f.data.jstree)for(e in f.data.jstree)f.data.jstree.hasOwnProperty(e)&&(f.state[e]=f.data.jstree[e]);(r=i.children("a").children(".jstree-themeicon")).length&&(f.icon=!r.hasClass("jstree-themeicon-hidden")&&r.attr("rel"));f.state.icon!==t&&(f.icon=f.state.icon);f.icon!==t&&null!==f.icon&&""!==f.icon||(f.icon=!0);r=i.children("ul").children("li");do h="j"+this._id+"_"+ ++this._cnt;while(c[h]);return f.id=f.li_attr.id?f.li_attr.id.toString():h,r.length?(r.each(function(t,i){o=this._parse_model_from_html(n(i),f.id,u);s=this._model.data[o];f.children.push(o);s.children_d.length&&(f.children_d=f.children_d.concat(s.children_d))}.bind(this)),f.children_d=f.children_d.concat(f.children)):i.hasClass("jstree-closed")&&(f.state.loaded=!1),f.li_attr.class&&(f.li_attr.class=f.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),f.a_attr.class&&(f.a_attr.class=f.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),(c[f.id]=f).state.selected&&this._data.core.selected.push(f.id),f.id},_parse_model_from_flat_json:function(n,i,r){r=r?r.concat():[];i&&r.unshift(i);var h=n.id.toString(),e=this._model.data,o=this._model.default_state,f,c,l,s,u={id:h,text:n.text||"",icon:n.icon===t||n.icon,parent:i,parents:r,children:n.children||[],children_d:n.children_d||[],data:n.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in o)o.hasOwnProperty(f)&&(u.state[f]=o[f]);if(n&&n.data&&n.data.jstree&&n.data.jstree.icon&&(u.icon=n.data.jstree.icon),u.icon!==t&&null!==u.icon&&""!==u.icon||(u.icon=!0),n&&n.data&&(u.data=n.data,n.data.jstree))for(f in n.data.jstree)n.data.jstree.hasOwnProperty(f)&&(u.state[f]=n.data.jstree[f]);if(n&&"object"==typeof n.state)for(f in n.state)n.state.hasOwnProperty(f)&&(u.state[f]=n.state[f]);if(n&&"object"==typeof n.li_attr)for(f in n.li_attr)n.li_attr.hasOwnProperty(f)&&(u.li_attr[f]=n.li_attr[f]);if(u.li_attr.id||(u.li_attr.id=h),n&&"object"==typeof n.a_attr)for(f in n.a_attr)n.a_attr.hasOwnProperty(f)&&(u.a_attr[f]=n.a_attr[f]);for(n&&n.children&&!0===n.children&&(u.state.loaded=!1,u.children=[],u.children_d=[]),f=0,c=(e[u.id]=u).children.length;f<c;f++)s=e[l=this._parse_model_from_flat_json(e[u.children[f]],u.id,r)],u.children_d.push(l),s.children_d.length&&(u.children_d=u.children_d.concat(s.children_d));return delete n.data,delete n.children,e[u.id].original=n,u.state.selected&&this._data.core.selected.push(u.id),u.id},_parse_model_from_json:function(n,i,r){r=r?r.concat():[];i&&r.unshift(i);var e=!1,f,c,l,o,s=this._model.data,h=this._model.default_state,u;do e="j"+this._id+"_"+ ++this._cnt;while(s[e]);for(f in u={id:!1,text:"string"==typeof n?n:"",icon:"object"!=typeof n||n.icon===t||n.icon,parent:i,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},h)h.hasOwnProperty(f)&&(u.state[f]=h[f]);if(n&&(n.id||0===n.id)&&(u.id=n.id.toString()),n&&n.text&&(u.text=n.text),n&&n.data&&n.data.jstree&&n.data.jstree.icon&&(u.icon=n.data.jstree.icon),u.icon!==t&&null!==u.icon&&""!==u.icon||(u.icon=!0),n&&n.data&&(u.data=n.data,n.data.jstree))for(f in n.data.jstree)n.data.jstree.hasOwnProperty(f)&&(u.state[f]=n.data.jstree[f]);if(n&&"object"==typeof n.state)for(f in n.state)n.state.hasOwnProperty(f)&&(u.state[f]=n.state[f]);if(n&&"object"==typeof n.li_attr)for(f in n.li_attr)n.li_attr.hasOwnProperty(f)&&(u.li_attr[f]=n.li_attr[f]);if(u.li_attr.id&&!u.id&&0!==u.id&&(u.id=u.li_attr.id.toString()),u.id||0===u.id||(u.id=e),u.li_attr.id||(u.li_attr.id=u.id),n&&"object"==typeof n.a_attr)for(f in n.a_attr)n.a_attr.hasOwnProperty(f)&&(u.a_attr[f]=n.a_attr[f]);if(n&&n.children&&n.children.length){for(f=0,c=n.children.length;f<c;f++)o=s[l=this._parse_model_from_json(n.children[f],u.id,r)],u.children.push(l),o.children_d.length&&(u.children_d=u.children_d.concat(o.children_d));u.children_d=u.children.concat(u.children_d)}return n&&n.children&&!0===n.children&&(u.state.loaded=!1,u.children=[],u.children_d=[]),delete n.data,delete n.children,u.original=n,(s[u.id]=u).state.selected&&this._data.core.selected.push(u.id),u.id},_redraw:function(){for(var r=(this._model.force_full_redraw?this._model.data[n.jstree.root].children:this._model.changed).concat([]),i=e.createElement("UL"),t,f=this._data.core.focused,u=0,o=r.length;u<o;u++)(t=this.redraw_node(r[u],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&i.appendChild(t);this._model.force_full_redraw&&(i.className=this.get_container_ul()[0].className,i.setAttribute("role","presentation"),this.element.empty().append(i));null!==f&&this.settings.core.restore_focus&&((t=this.get_node(f,!0))&&t.length&&t.children(".jstree-anchor")[0]!==e.activeElement?t.children(".jstree-anchor").trigger("focus"):this._data.core.focused=null);this._model.force_full_redraw=!1;this._model.changed=[];this.trigger("redraw",{nodes:r})},redraw:function(n){n&&(this._model.force_full_redraw=!0);this._redraw()},draw_children:function(t){var i=this.get_node(t),r=!1,f=!1,u=!1,o=e;if(!i)return!1;if(i.id===n.jstree.root)return this.redraw(!0);if(!(t=this.get_node(t,!0))||!t.length)return!1;if(t.children(".jstree-children").remove(),t=t[0],i.children.length&&i.state.loaded){for((u=o.createElement("UL")).setAttribute("role","group"),u.className="jstree-children",r=0,f=i.children.length;r<f;r++)u.appendChild(this.redraw_node(i.children[r],!0,!0));t.appendChild(u)}},redraw_node:function(t,i,r,u){var f=this.get_node(t),s=!1,v=!1,w=!1,o=!1,h=!1,y=!1,c="",b=e,l=this._model.data,k=!1,a=null,d=0,g=0,nt=!1,p=!1;if(!f)return!1;if(f.id===n.jstree.root)return this.redraw(!0);if(i=i||0===f.children.length,t=e.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(f.id[0])?"\\3"+f.id[0]+" "+f.id.substr(1).replace(n.jstree.idregex,"\\$&"):f.id.replace(n.jstree.idregex,"\\$&"))):e.getElementById(f.id))t=n(t),r||((s=t.parent().parent()[0])===this.element[0]&&(s=null),v=t.index()),(i=!i&&f.children.length&&!t.children(".jstree-children").length?!0:i)||(w=t.children(".jstree-children")[0]),k=t.children(".jstree-anchor")[0]===e.activeElement,t.remove();else if(i=!0,!r){if(!(null===(s=f.parent!==n.jstree.root?n("#"+f.parent.replace(n.jstree.idregex,"\\$&"),this.element)[0]:null)||s&&l[f.parent].state.opened))return!1;v=n.inArray(f.id,(null===s?l[n.jstree.root]:l[f.parent]).children)}for(o in t=this._data.core.node.cloneNode(!0),c="jstree-node ",f.li_attr)f.li_attr.hasOwnProperty(o)&&"id"!==o&&("class"!==o?t.setAttribute(o,f.li_attr[o]):c+=f.li_attr[o]);for(f.a_attr.id||(f.a_attr.id=f.id+"_anchor"),t.childNodes[1].setAttribute("aria-selected",!!f.state.selected),t.childNodes[1].setAttribute("aria-level",f.parents.length),this.settings.core.compute_elements_positions&&(t.childNodes[1].setAttribute("aria-setsize",l[f.parent].children.length),t.childNodes[1].setAttribute("aria-posinset",l[f.parent].children.indexOf(f.id)+1)),f.state.disabled&&t.childNodes[1].setAttribute("aria-disabled",!0),o=0,h=f.children.length;o<h;o++)if(!l[f.children[o]].state.hidden){nt=!0;break}if(null!==f.parent&&l[f.parent]&&!f.state.hidden&&(o=n.inArray(f.id,l[f.parent].children),p=f.id,-1!==o))for(o++,h=l[f.parent].children.length;o<h;o++)if((p=l[l[f.parent].children[o]].state.hidden?p:l[f.parent].children[o])!==f.id)break;for(h in f.state.hidden&&(c+=" jstree-hidden"),f.state.loading&&(c+=" jstree-loading"),f.state.loaded&&!nt?c+=" jstree-leaf":(c+=f.state.opened&&f.state.loaded?" jstree-open":" jstree-closed",t.childNodes[1].setAttribute("aria-expanded",f.state.opened&&f.state.loaded)),p===f.id&&(c+=" jstree-last"),t.id=f.id,t.className=c,c=(f.state.selected?" jstree-clicked":"")+(f.state.disabled?" jstree-disabled":""),f.a_attr)f.a_attr.hasOwnProperty(h)&&("href"===h&&"#"===f.a_attr[h]||("class"!==h?t.childNodes[1].setAttribute(h,f.a_attr[h]):c+=" "+f.a_attr[h]));if(c.length&&(t.childNodes[1].className="jstree-anchor "+c),(f.icon&&!0!==f.icon||!1===f.icon)&&(!1===f.icon?t.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===f.icon.indexOf("/")&&-1===f.icon.indexOf(".")?t.childNodes[1].childNodes[0].className+=" "+f.icon+" jstree-themeicon-custom":(t.childNodes[1].childNodes[0].style.backgroundImage='url("'+f.icon+'")',t.childNodes[1].childNodes[0].style.backgroundPosition="center center",t.childNodes[1].childNodes[0].style.backgroundSize="auto",t.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?t.childNodes[1].appendChild(b.createTextNode(f.text)):t.childNodes[1].innerHTML+=f.text,i&&f.children.length&&(f.state.opened||u)&&f.state.loaded){for((y=b.createElement("UL")).setAttribute("role","group"),y.className="jstree-children",o=0,h=f.children.length;o<h;o++)y.appendChild(this.redraw_node(f.children[o],i,!0));t.appendChild(y)}if(w&&t.appendChild(w),!r){for(o=0,h=(s=s||this.element[0]).childNodes.length;o<h;o++)if(s.childNodes[o]&&s.childNodes[o].className&&-1!==s.childNodes[o].className.indexOf("jstree-children")){a=s.childNodes[o];break}a||((a=b.createElement("UL")).setAttribute("role","group"),a.className="jstree-children",s.appendChild(a));v<(s=a).childNodes.length?s.insertBefore(t,s.childNodes[v]):s.appendChild(t);k&&(d=this.element[0].scrollTop,g=this.element[0].scrollLeft,t.childNodes[1].focus(),this.element[0].scrollTop=d,this.element[0].scrollLeft=g)}return f.state.opened&&!f.state.loaded&&(f.state.opened=!1,setTimeout(function(){this.open_node(f.id,!1,0)}.bind(this),0)),t},open_node:function(i,r,u){var e,s,f,o;if(n.vakata.is_array(i)){for(e=0,s=(i=i.slice()).length;e<s;e++)this.open_node(i[e],r,u);return!0}return!(!(i=this.get_node(i))||i.id===n.jstree.root)&&(u=u===t?this.settings.core.animation:u,this.is_closed(i)?this.is_loaded(i)?(f=this.get_node(i,!0),o=this,f.length&&(u&&f.children(".jstree-children").length&&f.children(".jstree-children").stop(!0,!0),i.children.length&&!this._firstChild(f.children(".jstree-children")[0])&&this.draw_children(i),u?(this.trigger("before_open",{node:i}),f.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").children(".jstree-anchor").attr("aria-expanded",!0).end().children(".jstree-children").stop(!0,!0).slideDown(u,function(){this.style.display="";o.element&&o.trigger("after_open",{node:i})})):(this.trigger("before_open",{node:i}),f[0].className=f[0].className.replace("jstree-closed","jstree-open"),f[0].childNodes[1].setAttribute("aria-expanded",!0))),i.state.opened=!0,r&&r.call(this,i,!0),f.length||this.trigger("before_open",{node:i}),this.trigger("open_node",{node:i}),u&&f.length||this.trigger("after_open",{node:i}),!0):this.is_loading(i)?setTimeout(function(){this.open_node(i,r,u)}.bind(this),500):void this.load_node(i,function(n,t){return t?this.open_node(n,r,u):!!r&&r.call(this,n,!1)}):(r&&r.call(this,i,!1),!1))},_open_to:function(t){if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;for(var r=t.parents,i=0,u=r.length;i<u;i+=1)i!==n.jstree.root&&this.open_node(r[i],!1,0);return n("#"+t.id.replace(n.jstree.idregex,"\\$&"),this.element)},close_node:function(i,r){var f,o,e,u;if(n.vakata.is_array(i)){for(f=0,o=(i=i.slice()).length;f<o;f++)this.close_node(i[f],r);return!0}return!(!(i=this.get_node(i))||i.id===n.jstree.root)&&!this.is_closed(i)&&(r=r===t?this.settings.core.animation:r,u=(e=this).get_node(i,!0),i.state.opened=!1,this.trigger("close_node",{node:i}),void(u.length?r?u.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").children(".jstree-anchor").attr("aria-expanded",!1).end().children(".jstree-children").stop(!0,!0).slideUp(r,function(){this.style.display="";u.children(".jstree-children").remove();e.element&&e.trigger("after_close",{node:i})}):(u[0].className=u[0].className.replace("jstree-open","jstree-closed"),u.children(".jstree-anchor").attr("aria-expanded",!1),u.children(".jstree-children").remove(),this.trigger("after_close",{node:i})):this.trigger("after_close",{node:i})))},toggle_node:function(t){var i,r;if(n.vakata.is_array(t)){for(i=0,r=(t=t.slice()).length;i<r;i++)this.toggle_node(t[i]);return!0}return this.is_closed(t)?this.open_node(t):this.is_open(t)?this.close_node(t):void 0},open_all:function(t,i,r){if(t=t||n.jstree.root,!(t=this.get_node(t)))return!1;var u=t.id===n.jstree.root?this.get_container_ul():this.get_node(t,!0),f,e,o;if(!u.length){for(f=0,e=t.children_d.length;f<e;f++)this.is_closed(this._model.data[t.children_d[f]])&&(this._model.data[t.children_d[f]].state.opened=!0);return this.trigger("open_all",{node:t})}r=r||u;(u=(o=this).is_closed(t)?u.find(".jstree-closed").addBack():u.find(".jstree-closed")).each(function(){o.open_node(this,function(n,t){t&&this.is_parent(n)&&this.open_all(n,i,r)},i||0)});0===r.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(r)})},close_all:function(t,i){if(t=t||n.jstree.root,!(t=this.get_node(t)))return!1;var r=t.id===n.jstree.root?this.get_container_ul():this.get_node(t,!0),e=this,u,f;for(r.length&&(r=this.is_open(t)?r.find(".jstree-open").addBack():r.find(".jstree-open"),n(r.get().reverse()).each(function(){e.close_node(this,i||0)})),u=0,f=t.children_d.length;u<f;u++)this._model.data[t.children_d[u]].state.opened=!1;this.trigger("close_all",{node:t})},is_disabled:function(n){return(n=this.get_node(n))&&n.state&&n.state.disabled},enable_node:function(t){var i,r;if(n.vakata.is_array(t)){for(i=0,r=(t=t.slice()).length;i<r;i++)this.enable_node(t[i]);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;t.state.disabled=!1;this.get_node(t,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1);this.trigger("enable_node",{node:t})},disable_node:function(t){var i,r;if(n.vakata.is_array(t)){for(i=0,r=(t=t.slice()).length;i<r;i++)this.disable_node(t[i]);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;t.state.disabled=!0;this.get_node(t,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0);this.trigger("disable_node",{node:t})},is_hidden:function(n){return!0===(n=this.get_node(n)).state.hidden},hide_node:function(t,i){var r,u;if(n.vakata.is_array(t)){for(r=0,u=(t=t.slice()).length;r<u;r++)this.hide_node(t[r],!0);return i||this.redraw(),!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;t.state.hidden||(t.state.hidden=!0,this._node_changed(t.parent),i||this.redraw(),this.trigger("hide_node",{node:t}))},show_node:function(t,i){var r,u;if(n.vakata.is_array(t)){for(r=0,u=(t=t.slice()).length;r<u;r++)this.show_node(t[r],!0);return i||this.redraw(),!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;t.state.hidden&&(t.state.hidden=!1,this._node_changed(t.parent),i||this.redraw(),this.trigger("show_node",{node:t}))},hide_all:function(t){var i,r=this._model.data,u=[];for(i in r)r.hasOwnProperty(i)&&i!==n.jstree.root&&!r[i].state.hidden&&(r[i].state.hidden=!0,u.push(i));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("hide_all",{nodes:u}),u},show_all:function(t){var i,r=this._model.data,u=[];for(i in r)r.hasOwnProperty(i)&&i!==n.jstree.root&&r[i].state.hidden&&(r[i].state.hidden=!1,u.push(i));return this._model.force_full_redraw=!0,t||this.redraw(),this.trigger("show_all",{nodes:u}),u},activate_node:function(n,i){if(this.is_disabled(n))return!1;if(i&&"object"==typeof i||(i={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==t?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(i.metaKey||i.ctrlKey||i.shiftKey)&&(!i.shiftKey||this._data.core.last_clicked&&this.get_parent(n)&&this.get_parent(n)===this._data.core.last_clicked.parent))if(i.shiftKey){for(var e=this.get_node(n).id,o=this._data.core.last_clicked.id,u=this.get_node(this._data.core.last_clicked.parent).children,f=!1,r=0,s=u.length;r<s;r+=1)u[r]===e&&(f=!f),u[r]===o&&(f=!f),this.is_disabled(u[r])||!f&&u[r]!==e&&u[r]!==o?i.ctrlKey||this.deselect_node(u[r],!0,i):this.is_hidden(u[r])||this.select_node(u[r],!0,!1,i);this.trigger("changed",{action:"select_node",node:this.get_node(n),selected:this._data.core.selected,event:i})}else this.is_selected(n)?this.deselect_node(n,!1,i):(i.ctrlKey&&(this._data.core.last_clicked=this.get_node(n)),this.select_node(n,!1,!1,i));else!this.settings.core.multiple&&(i.metaKey||i.ctrlKey||i.shiftKey)&&this.is_selected(n)?this.deselect_node(n,!1,i):(this.is_selected(n)&&1===this._data.core.selected.length||(this.deselect_all(!0),this.select_node(n,!1,!1,i)),this._data.core.last_clicked=this.get_node(n));this.trigger("activate_node",{node:this.get_node(n),event:i})},hover_node:function(n){if(!(n=this.get_node(n,!0))||!n.length||n.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered"),i=this.element;t&&t.length&&this.dehover_node(t);n.children(".jstree-anchor").addClass("jstree-hovered");this.trigger("hover_node",{node:this.get_node(n)});setTimeout(function(){i.attr("aria-activedescendant",n[0].id)},0)},dehover_node:function(n){if(!(n=this.get_node(n,!0))||!n.length||!n.children(".jstree-hovered").length)return!1;n.children(".jstree-anchor").removeClass("jstree-hovered");this.trigger("dehover_node",{node:this.get_node(n)})},select_node:function(t,i,r,u){var f,e,o;if(n.vakata.is_array(t)){for(e=0,o=(t=t.slice()).length;e<o;e++)this.select_node(t[e],i,r,u);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;f=this.get_node(t,!0);t.state.selected||(t.state.selected=!0,this._data.core.selected.push(t.id),(f=r?f:this._open_to(t))&&f.length&&f.children(".jstree-anchor").addClass("jstree-clicked").attr("aria-selected",!0),this.trigger("select_node",{node:t,selected:this._data.core.selected,event:u}),i||this.trigger("changed",{action:"select_node",node:t,selected:this._data.core.selected,event:u}))},deselect_node:function(t,i,r){var u,e,f;if(n.vakata.is_array(t)){for(u=0,e=(t=t.slice()).length;u<e;u++)this.deselect_node(t[u],i,r);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;f=this.get_node(t,!0);t.state.selected&&(t.state.selected=!1,this._data.core.selected=n.vakata.array_remove_item(this._data.core.selected,t.id),f.length&&f.children(".jstree-anchor").removeClass("jstree-clicked").attr("aria-selected",!1),this.trigger("deselect_node",{node:t,selected:this._data.core.selected,event:r}),i||this.trigger("changed",{action:"deselect_node",node:t,selected:this._data.core.selected,event:r}))},select_all:function(t){var u=this._data.core.selected.concat([]),i,r;for(this._data.core.selected=this._model.data[n.jstree.root].children_d.concat(),i=0,r=this._data.core.selected.length;i<r;i++)this._model.data[this._data.core.selected[i]]&&(this._model.data[this._data.core.selected[i]].state.selected=!0);this.redraw(!0);this.trigger("select_all",{selected:this._data.core.selected});t||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:u})},deselect_all:function(n){for(var i=this._data.core.selected.concat([]),t=0,r=this._data.core.selected.length;t<r;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].state.selected=!1);this._data.core.selected=[];this.element.find(".jstree-clicked").removeClass("jstree-clicked").attr("aria-selected",!1);this.trigger("deselect_all",{selected:this._data.core.selected,node:i});n||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:i})},is_selected:function(t){return!(!(t=this.get_node(t))||t.id===n.jstree.root)&&t.state.selected},get_selected:function(t){return t?n.map(this._data.core.selected,function(n){return this.get_node(n)}.bind(this)):this._data.core.selected.slice()},get_top_selected:function(t){for(var r=this.get_selected(!0),u={},f,o,i=0,e=r.length;i<e;i++)u[r[i].id]=r[i];for(i=0,e=r.length;i<e;i++)for(f=0,o=r[i].children_d.length;f<o;f++)u[r[i].children_d[f]]&&delete u[r[i].children_d[f]];for(i in r=[],u)u.hasOwnProperty(i)&&r.push(i);return t?n.map(r,function(n){return this.get_node(n)}.bind(this)):r},get_bottom_selected:function(t){for(var r=this.get_selected(!0),u=[],i=0,f=r.length;i<f;i++)r[i].children.length||u.push(r[i].id);return t?n.map(u,function(n){return this.get_node(n)}.bind(this)):u}
3,get_state:function(){var i={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(var t in this._model.data)this._model.data.hasOwnProperty(t)&&t!==n.jstree.root&&(this._model.data[t].state.loaded&&this.settings.core.loaded_state&&i.core.loaded.push(t),this._model.data[t].state.opened&&i.core.open.push(t),this._model.data[t].state.selected&&i.core.selected.push(t));return i},set_state:function(i,r){if(i){if(i.core&&i.core.selected&&i.core.initial_selection===t&&(i.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),i.core){var f,u;if(i.core.loaded)return this.settings.core.loaded_state&&n.vakata.is_array(i.core.loaded)&&i.core.loaded.length?this._load_nodes(i.core.loaded,function(){delete i.core.loaded;this.set_state(i,r)}):(delete i.core.loaded,this.set_state(i,r)),!1;if(i.core.open)return n.vakata.is_array(i.core.open)&&i.core.open.length?this._load_nodes(i.core.open,function(n){this.open_node(n,!1,0);delete i.core.open;this.set_state(i,r)}):(delete i.core.open,this.set_state(i,r)),!1;if(i.core.scroll)return i.core.scroll&&i.core.scroll.left!==t&&this.element.scrollLeft(i.core.scroll.left),i.core.scroll&&i.core.scroll.top!==t&&this.element.scrollTop(i.core.scroll.top),delete i.core.scroll,this.set_state(i,r),!1;if(i.core.selected)return f=this,i.core.initial_selection!==t&&i.core.initial_selection!==this._data.core.selected.concat([]).sort().join(",")||(this.deselect_all(),n.each(i.core.selected,function(n,t){f.select_node(t,!1,!0)})),delete i.core.initial_selection,delete i.core.selected,this.set_state(i,r),!1;for(u in i)i.hasOwnProperty(u)&&"core"!==u&&-1===n.inArray(u,this.settings.plugins)&&delete i[u];if(n.isEmptyObject(i.core))return delete i.core,this.set_state(i,r),!1}return n.isEmptyObject(i)?(i=null,r&&r.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(t,i){this._data.core.state=!0===i?{}:this.get_state();i&&n.vakata.is_function(i)&&(this._data.core.state=i.call(this,this._data.core.state));this._cnt=0;this._model.data={};this._model.data[n.jstree.root]={id:n.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}};this._data.core.selected=[];this._data.core.last_clicked=null;this._data.core.focused=null;var r=this.get_container_ul()[0].className;t||(this.element.html("<ul class='"+r+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='none' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'><\/i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden'><\/i>"+this.get_string("Loading ...")+"<\/a><\/li><\/ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"));this.load_node(n.jstree.root,function(t,i){i&&(this.get_container_ul()[0].className=r,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(n.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")}));this._data.core.state=null})},refresh_node:function(t){if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;var i=[],r=[],u=this._data.core.selected.concat([]);r.push(t.id);!0===t.state.opened&&i.push(t.id);this.get_node(t,!0).find(".jstree-open").each(function(){r.push(this.id);i.push(this.id)});this._load_nodes(r,function(n){this.open_node(i,!1,0);this.select_node(u);this.trigger("refresh_node",{node:t,nodes:n})}.bind(this),!1,!0)},set_id:function(t,i){if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;var r,f,u=this._model.data,e=t.id;for(i=i.toString(),u[t.parent].children[n.inArray(t.id,u[t.parent].children)]=i,r=0,f=t.parents.length;r<f;r++)u[t.parents[r]].children_d[n.inArray(t.id,u[t.parents[r]].children_d)]=i;for(r=0,f=t.children.length;r<f;r++)u[t.children[r]].parent=i;for(r=0,f=t.children_d.length;r<f;r++)u[t.children_d[r]].parents[n.inArray(t.id,u[t.children_d[r]].parents)]=i;return-1!==(r=n.inArray(t.id,this._data.core.selected))&&(this._data.core.selected[r]=i),(r=this.get_node(t.id,!0))&&(r.attr("id",i),this.element.attr("aria-activedescendant")===t.id&&this.element.attr("aria-activedescendant",i
vendor: 54,978 bytes, line 3
3)),delete u[t.id],t.id=i,u[t.li_attr.id=i]=t,this.trigger("set_id",{node:t,"new":t.id,old:e}),!0},get_text:function(t){return!(!(t=this.get_node(t))||t.id===n.jstree.root)&&t.text},set_text:function(t,i){var r,u;if(n.vakata.is_array(t)){for(r=0,u=(t=t.slice()).length;r<u;r++)this.set_text(t[r],i);return!0}return!(!(t=this.get_node(t))||t.id===n.jstree.root)&&(t.text=i,this.get_node(t,!0).length&&this.redraw_node(t.id),this.trigger("set_text",{obj:t,text:i}),!0)},get_json:function(t,i,r){if(!(t=this.get_node(t||n.jstree.root)))return!1;i&&i.flat&&!r&&(r=[]);var u={id:t.id,text:t.text,icon:this.get_icon(t),li_attr:n.extend(!0,{},t.li_attr),a_attr:n.extend(!0,{},t.a_attr),state:{},data:(!i||!i.no_data)&&n.extend(!0,n.vakata.is_array(t.data)?[]:{},t.data)},f,e;if(i&&i.flat?u.parent=t.parent:u.children=[],i&&i.no_state)delete u.state;else for(f in t.state)t.state.hasOwnProperty(f)&&(u.state[f]=t.state[f]);if(i&&i.no_li_attr&&delete u.li_attr,i&&i.no_a_attr&&delete u.a_attr,i&&i.no_id&&(delete u.id,u.li_attr&&u.li_attr.id&&delete u.li_attr.id,u.a_attr&&u.a_attr.id&&delete u.a_attr.id),i&&i.flat&&t.id!==n.jstree.root&&r.push(u),!i||!i.no_children)for(f=0,e=t.children.length;f<e;f++)i&&i.flat?this.get_json(t.children[f],i,r):u.children.push(this.get_json(t.children[f],i));return i&&i.flat?r:t.id===n.jstree.root?u.children:u},create_node:function(i,r,u,f,e){if(null===i&&(i=n.jstree.root),!(i=this.get_node(i)))return!1;if(!(u=u===t?"last":u).toString().match(/^(before|after)$/)&&!e&&!this.is_loaded(i))return this.load_node(i,function(){this.create_node(i,r,u,f,!0)});var o,h,s,c;switch((r="string"==typeof(r=r||{text:this.get_string("New node")})?{text:r}:n.extend(!0,{},r)).text===t&&(r.text=this.get_string("New node")),u=i.id===n.jstree.root&&"after"===(u="before"===u?"first":u)?"last":u){case"before":o=this.get_node(i.parent);u=n.inArray(i.id,o.children);i=o;break;case"after":o=this.get_node(i.parent);u=n.inArray(i.id,o.children)+1;i=o;break;case"inside":case"first":u=0;break;case"last":u=i.children.length;break;default:u=u||0}if(u>i.children.length&&(u=i.children.length),r.id===t&&(r.id=!0),!this.check("create_node",r,i,u))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===r.id&&delete r.id,!(r=this._parse_model_from_json(r,i.id,i.parents.concat())))return!1;for(o=this.get_node(r),(h=[]).push(r),h=h.concat(o.children_d),this.trigger("model",{nodes:h,parent:i.id}),i.children_d=i.children_d.concat(h),s=0,c=i.parents.length;s<c;s++)this._model.data[i.parents[s]].children_d=this._model.data[i.parents[s]].children_d.concat(h);for(r=o,o=[],s=0,c=i.children.length;s<c;s++)o[u<=s?s+1:s]=i.children[s];return o[u]=r.id,i.children=o,this.redraw_node(i,!0),this.trigger("create_node",{node:this.get_node(r),parent:i.id,position:u}),f&&f.call(this,this.get_node(r)),r.id},rename_node:function(t,i){var r,u,f;if(n.vakata.is_array(t)){for(r=0,u=(t=t.slice()).length;r<u;r++)this.rename_node(t[r],i);return!0}return!(!(t=this.get_node(t))||t.id===n.jstree.root)&&(f=t.text,this.check("rename_node",t,this.get_parent(t),i)?(this.set_text(t,i),this.trigger("rename_node",{node:t,text:i,old:f}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1))},delete_node:function(t){var o,c,i,r,e,l,u,s,h,a,f;if(n.vakata.is_array(t)){for(o=0,c=(t=t.slice()).length;o<c;o++)this.delete_node(t[o]);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;if(i=this.get_node(t.parent),f=n.inArray(t.id,i.children),h=!1,!this.check("delete_node",t,i,f))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==f&&(i.children=n.vakata.array_remove(i.children,f)),(r=t.children_d.concat([])).push(t.id),e=0,l=t.parents.length;e<l;e++)this._model.data[t.parents[e]].children_d=n.vakata.array_filter(this._model.data[t.parents[e]].children_d,function(t){return-1===n.inArray(t,r)});for(u=0,s=r.length;u<s;u++)if(this._model.data[r[u]].state.selected){h=!0;break}for(h&&(this._data.core.selected=n.vakata.array_filter(this._data.core.selected,function(t){return-1===n.inArray(t,r)})),this.trigger("delete_node",{node:t,parent:i.id}),h&&this.trigger("changed",{action:"delete_node",node:t,selected:this._data.core.selected,parent:i.id}),u=0,s=r.length;u<s;u++)delete this._model.data[r[u]];return-1!==n.inArray(this._data.core.focused,r)&&(this._data.core.focused=null,a=this.element[0].scrollTop,f=this.element[0].scrollLeft,i.id===n.jstree.root?this._model.data[n.jstree.root].children[0]&&this.get_node(this._model.data[n.jstree.root].children[0],!0).children(".jstree-anchor").trigger("focus"):this.get_node(i,!0).children(".jstree-anchor").trigger("focus"),this.element[0].scrollTop=a,this.element[0].scrollLeft=f),this.redraw_node(i,!0),!0},check:function(t,i,r,u,f){i=i&&i.id?i:this.get_node(i);r=r&&r.id?r:this.get_node(r);var e=t.match(/^(move_node|copy_node|create_node)$/i)?r:i,o=this.settings.core.check_callback;if("move_node"===t||"copy_node"===t){if(!(f&&f.is_multi||"move_node"!==t||n.inArray(i.id,r.children)!==u))return!(this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:t,pos:u,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})});if(!(f&&f.is_multi||i.id!==r.id&&("move_node"!==t||n.inArray(i.id,r.children)!==u)&&-1===n.inArray(r.id,i.children_d)))return!(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:t,pos:u,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})})}return(e=e&&e.data?e.data:e)&&e.functions&&(!1===e.functions[t]||!0===e.functions[t])?(!1===e.functions[t]&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+t,data:JSON.stringify({chk:t,pos:u,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})}),e.functions[t]):!(!1===o||n.vakata.is_function(o)&&!1===o.call(this,t,i,r,u,f)||o&&!1===o[t])||!(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+t,data:JSON.stringify({chk:t,pos:u,obj:!(!i||!i.id)&&i.id,par:!(!r||!r.id)&&r.id})})},last_error:function(){return this._data.core.last_error},move_node:function(i,r,u,f,e,o,s){var k,d,y,g,c,l,nt,v,a,h,p,w,tt,b;if(r=this.get_node(r),u=u===t?0:u,!r)return!1;if(!u.toString().match(/^(before|after)$/)&&!e&&!this.is_loaded(r))return this.load_node(r,function(){this.move_node(i,r,u,f,!0,!1,s)});if(n.vakata.is_array(i)){if(1!==i.length){for(k=0,d=i.length;k<d;k++)(a=this.move_node(i[k],r,u,f,e,!1,s))&&(r=a,u="after");return this.redraw(),!0}i=i[0]}if(!(i=i&&i.id!==t?i:this.get_node(i))||i.id===n.jstree.root)return!1;if(y=(i.parent||n.jstree.root).toString(),c=u.toString().match(/^(before|after)$/)&&r.id!==n.jstree.root?this.get_node(r.parent):r,nt=!(l=s||(this._model.data[i.id]?this:n.jstree.reference(i.id)))||!l._id||this._id!==l._id,g=l&&l._id&&y&&l._model.data[y]&&l._model.data[y].children?n.inArray(i.id,l._model.data[y].children):-1,l&&l._id&&(i=l._model.data[i.id]),nt)return!!(a=this.copy_node(i,r,u,f,e,!1,s))&&(l&&l.delete_node(i),a);switch(u=r.id===n.jstree.root&&"after"===(u="before"===u?"first":u)?"last":u){case"before":u=n.inArray(r.id,c.children);break;case"after":u=n.inArray(r.id,c.children)+1;break;case"inside":case"first":u=0;break;case"last":u=c.children.length;break;default:u=u||0}if(u>c.children.length&&(u=c.children.length),!this.check("move_node",i,c,u,{core:!0,origin:s,is_multi:l&&l._id&&l._id!==this._id,is_foreign:!l||!l._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(i.parent===c.id){for(v=c.children.concat(),-1!==(a=n.inArray(i.id,v))&&(v=n.vakata.array_remove(v,a),a<u&&u--),a=[],h=0,p=v.length;h<p;h++)a[u<=h?h+1:h]=v[h];a[u]=i.id;c.children=a;this._node_changed(c.id);this.redraw(c.id===n.jstree.root)}else{for((a=i.children_d.concat()).push(i.id),h=0,p=i.parents.length;h<p;h++){for(v=[],w=0,tt=(b=l._model.data[i.parents[h]].children_d).length;w<tt;w++)-1===n.inArray(b[w],a)&&v.push(b[w]);l._model.data[i.parents[h]].children_d=v}for(l._model.data[y].children=n.vakata.array_remove_item(l._model.data[y].children,i.id),h=0,p=c.parents.length;h<p;h++)this._model.data[c.parents[h]].children_d=this._model.data[c.parents[h]].children_d.concat(a);for(v=[],h=0,p=c.children.length;h<p;h++)v[u<=h?h+1:h]=c.children[h];for(v[u]=i.id,c.children=v,c.children_d.push(i.id),c.children_d=c.children_d.concat(i.children_d),i.parent=c.id,(a=c.parents.concat()).unshift(c.id),b=i.parents.length,a=(i.parents=a).concat(),h=0,p=i.children_d.length;h<p;h++)this._model.data[i.children_d[h]].parents=this._model.data[i.children_d[h]].parents.slice(0,-1*b),Array.prototype.push.apply(this._model.data[i.children_d[h]].parents,a);y!==n.jstree.root&&c.id!==n.jstree.root||(this._model.force_full_redraw=!0);this._model.force_full_redraw||(this._node_changed(y),this._node_changed(c.id));o||this.redraw()}return f&&f.call(this,i,c,u),this.trigger("move_node",{node:i,parent:c.id,position:u,old_parent:y,old_position:g,is_multi:l&&l._id&&l._id!==this._id,is_foreign:!l||!l._id,old_instance:l,new_instance:this}),i.id},copy_node:function(i,r,u,f,e,o,s){var w,k,v,a,l,b,y,p,h,c,d;if(r=this.get_node(r),u=u===t?0:u,!r)return!1;if(!u.toString().match(/^(before|after)$/)&&!e&&!this.is_loaded(r))return this.load_node(r,function(){this.copy_node(i,r,u,f,!0,!1,s)});if(n.vakata.is_array(i)){if(1!==i.length){for(w=0,k=i.length;w<k;w++)(a=this.copy_node(i[w],r,u,f,e,!0,s))&&(r=a,u="after");return this.redraw(),!0}i=i[0]}if(!(i=i&&i.id!==t?i:this.get_node(i))||i.id===n.jstree.root)return!1;switch(p=(i.parent||n.jstree.root).toString(),h=u.toString().match(/^(before|after)$/)&&r.id!==n.jstree.root?this.get_node(r.parent):r,d=!(c=s||(this._model.data[i.id]?this:n.jstree.reference(i.id)))||!c._id||this._id!==c._id,c&&c._id&&(i=c._model.data[i.id]),u=r.id===n.jstree.root&&"after"===(u="before"===u?"first":u)?"last":u){case"before":u=n.inArray(r.id,h.children);break;case"after":u=n.inArray(r.id,h.children)+1;break;case"inside":case"first":u=0;break;case"last":u=h.children.length;break;default:u=u||0}if(u>h.children.length&&(u=h.children.length),!this.check("copy_node",i,h,u,{core:!0,origin:s,is_multi:c&&c._id&&c._id!==this._id,is_foreign:!c||!c._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!(y=c?c.get_json(i,{no_id:!0,no_data:!0,no_state:!0}):i)||(!0===y.id&&delete y.id,!(y=this._parse_model_from_json(y,h.id,h.parents.concat()))))return!1;for(a=this.get_node(y),i&&i.state&&!1===i.state.loaded&&(a.state.loaded=!1),(v=[]).push(y),v=v.concat(a.children_d),this.trigger("model",{nodes:v,parent:h.id}),l=0,b=h.parents.length;l<b;l++)this._model.data[h.parents[l]].children_d=this._model.data[h.parents[l]].children_d.concat(v);for(v=[],l=0,b=h.children.length;l<b;l++)v[u<=l?l+1:l]=h.children[l];return v[u]=a.id,h.children=v,h.children_d.push(a.id),h.children_d=h.children_d.concat(a.children_d),h.id===n.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(h.id),o||this.redraw(h.id===n.jstree.root),f&&f.call(this,a,h,u),this.trigger("copy_node",{node:a,original:i,parent:h.id,position:u,old_parent:p,old_position:c&&c._id&&p&&c._model.data[p]&&c._model.data[p].children?n.inArray(i.id,c._model.data[p].children):-1,is_multi:c&&c._id&&c._id!==this._id,is_foreign:!c||!c._id,old_instance:c,new_instance:this}),a.id},cut:function(t){if(t=t||this._data.core.selected.concat(),!(t=n.vakata.is_array(t)?t:[t]).length)return!1;for(var r=[],i,u=0,f=t.length;u<f;u++)(i=this.get_node(t[u]))&&(i.id||0===i.id)&&i.id!==n.jstree.root&&r.push(i);if(!r.length)return!1;h=r;o="move_node";(l=this).trigger("cut",{node:t})},copy:function(i){if(i=i||this._data.core.selected.concat(),!(i=n.vakata.is_array(i)?i:[i]).length)return!1;for(var u=[],r,f=0,e=i.length;f<e;f++)(r=this.get_node(i[f]))&&r.id!==t&&r.id!==n.jstree.root&&u.push(r);if(!u.length)return!1;h=u;o="copy_node";(l=this).trigger("copy",{node:i})},get_buffer:function(){return{mode:o,node:h,inst:l}},can_paste:function(){return!1!==o&&!1!==h},paste:function(n,t){if(!((n=this.get_node(n))&&o&&o.match(/^(copy_node|move_node)$/)&&h))return!1;this[o](h,n,t,!1,!1,!1,l)&&this.trigger("paste",{parent:n.id,node:h,mode:o});l=o=h=!1},clear_buffer:function(){l=o=h=!1;this.trigger("clear_buffer")},edit:function(t,i,r){var a,u,h,f,c,o,l,s,v=!1;return!!(t=this.get_node(t))&&(this.check("edit",t,this.get_parent(t))?(s=t,i="string"==typeof i?i:t.text,this.set_text(t,""),t=this._open_to(t),s.text=i,l=this._data.core.rtl,a=this.element.width(),this._data.core.focused=s.id,u=t.children(".jstree-anchor").trigger("focus"),h=n("<span><\/span>"),f=i,c=n("<div><\/div>",{css:{position:"absolute",top:"-200px",left:l?"0px":"-1000px",visibility:"hidden"}}).appendTo(e.body),o=n("<input />",{value:f,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:function(i){i.stopImmediatePropagation();i.preventDefault();var e=h.children(".jstree-rename-input").val(),i=this.settings.core.force_text;""===e&&(e=f);c.remove();h.replaceWith(u);h.remove();f=i?f:n("<div><\/div>").append(n.parseHTML(f)).html();t=this.get_node(t);this.set_text(t,f);(i=!!this.rename_node(t,i?n("<div><\/div>").text(e).text():n("<div><\/div>").append(n.parseHTML(e)).html()))||this.set_text(t,f);this._data.core.focused=s.id;setTimeout(function(){var n=this.get_node(s.id,!0);n.length&&(this._data.core.focused=s.id,n.children(".jstree-anchor").trigger("focus"))}.bind(this),0);r&&r.call(this,s,i,v,e);o=null}.bind(this),keydown:function(n){var t=n.which;27===t&&(v=!0,this.value=f);27!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&32!==t||n.stopImmediatePropagation();27!==t&&13!==t||(n.preventDefault(),this.blur())},click:function(n){n.stopImmediatePropagation()},mousedown:function(n){n.stopImmediatePropagation()},keyup:function(){o.width(Math.min(c.text("pW"+this.value).width(),a))},keypress:function(n){if(13===n.which)return!1}}),l={fontFamily:u.css("fontFamily")||"",fontSize:u.css("fontSize")||"",fontWeight:u.css("fontWeight")||"",fontStyle:u.css("fontStyle")||"",fontStretch:u.css("fontStretch")||"",fontVariant:u.css("fontVariant")||"",letterSpacing:u.css("letterSpacing")||"",wordSpacing:u.css("wordSpacing")||""},h.attr("class",u.attr("class")).append(u.contents().clone()).append(o),u.replaceWith(h),c.css(l),o.css(l).width(Math.min(c.text("pW"+o[0].value).width(),a))[0].select(),void n(e).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(t){o&&t.target!==o&&n(o).trigger("blur")})):(this.settings.core.error.call(this,this._data.core.last_error),!1))},set_theme:function(t,i){if(!t)return!1;var r;(i=!0===i?(r=(r=this.settings.core.themes.dir)||n.jstree.path+"/themes")+"/"+t+"/style.css":i)&&-1===n.inArray(i,d)&&(n("head").append('<link rel="stylesheet" href="'+i+'" type="text/css" />'),d.push(i));this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name);this._data.core.themes.name=t;this.element.addClass("jstree-"+t);this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+t+"-responsive");this.trigger("set_theme",{theme:t})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(n){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant);(this._data.core.themes.variant=n)&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0;this.get_container_ul().addClass("jstree-striped");this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1;this.get_container_ul().removeClass("jstree-striped");this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0;this.get_container_ul().removeClass("jstree-no-dots");this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1;this.get_container_ul().addClass("jstree-no-dots");this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0;this.get_container_ul().removeClass("jstree-no-icons");this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1;this.get_container_ul().addClass("jstree-no-icons");this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0;this.get_container_ul().addClass("jstree-ellipsis");this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1;this.get_container_ul().removeClass("jstree-ellipsis");this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(i,r){var e,o,u,f;if(n.vakata.is_array(i)){for(e=0,o=(i=i.slice()).length;e<o;e++)this.set_icon(i[e],r);return!0}return!(!(i=this.get_node(i))||i.id===n.jstree.root)&&(f=i.icon,i.icon=!0===r||null===r||r===t||""===r||r,u=this.get_node(i,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===r?(u.removeClass("jstree-themeicon-custom "+f).css("background","").removeAttr("rel"),this.hide_icon(i)):(!0===r||null===r||r===t||""===r?u.removeClass("jstree-themeicon-custom "+f).css("background","").removeAttr("rel"):-1===r.indexOf("/")&&-1===r.indexOf(".")?(u.removeClass(f).css("background",""),u.addClass(r+" jstree-themeicon-custom").attr("rel",r)):(u.removeClass(f).css("background",""),u.addClass("jstree-themeicon-custom").css("background","url('"+r+"') center center no-repeat").attr("rel",r)),!1===f&&this.show_icon(i)),!0)},get_icon:function(t){return!(!(t=this.get_node(t))||t.id===n.jstree.root)&&t.icon},hide_icon:function(t){var i,r;if(n.vakata.is_array(t)){for(i=0,r=(t=t.slice()).length;i<r;i++)this.hide_icon(t[i]);return!0}return!(!(t=this.get_node(t))||t===n.jstree.root)&&(t.icon=!1,this.get_node(t,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0)},show_icon:function(t){var i,u,r;if(n.vakata.is_array(t)){for(i=0,u=(t=t.slice()).length;i<u;i++)this.show_icon(t[i]);return!0}return!(!(t=this.get_node(t))||t===n.jstree.root)&&(r=this.get_node(t,!0),t.icon=!r.length||r.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),t.icon||(t.icon=!0),r.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0)}},n.vakata={},n.vakata.attributes=function(t,i){t=n(t)[0];var r=i?{}:[];return t&&t.attributes&&n.each(t.attributes,function(t,u){-1===n.inArray(u.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==u.value&&""!==n.vakata.trim(u.value)&&(i?r[u.name]=u.value:r.push(u.name))}),r},n.vakata.array_unique=function(n){for(var r=[],u={},i=0,f=n.length;i<f;i++)u[n[i]]===t&&(r.push(n[i]),u[n[i]]=!0);return r},n.vakata.array_remove=function(n,t){return n.splice(t,1),n},n.vakata.array_remove_item=function(t,i){var i=n.inArray(i,t);return-1!==i?n.vakata.array_remove(t,i):t},n.vakata.array_filter=function(n,t,i,r,u){if(n.filter)return n.filter(t,i);for(u in r=[],n)~~u+""==u+""&&0<=u&&t.call(i,n[u],+u,n)&&r.push(n[u]);return r},n.vakata.trim=function(n){return String.prototype.trim?String.prototype.trim.call(n.toString()):n.toString().replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},n.vakata.is_function=function(n){return"function"==typeof n&&"number"!=typeof n.nodeType},n.vakata.is_array=Array.isArray||function(n){return"[object Array]"===Object.prototype.toString.call(n)},Function.prototype.bind||(Function.prototype.bind=function(){var n=this,t=arguments[0],i=Array.prototype.slice.call(arguments,1);if("function"!=typeof n)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");return function(){var r=i.concat(Array.prototype.slice.call(arguments));return n.apply(t,r)}}),n.jstree.plugins.changed=function(n,t){var i=[];this.trigger=function(n,r){var u,f;if(r=r||{},"changed"===n.replace(".jstree","")){r.changed={selected:[],deselected:[]};for(var e={},u=0,f=i.length;u<f;u++)e[i[u]]=1;for(u=0,f=r.selected.length;u<f;u++)e[r.selected[u]]?e[r.selected[u]]=2:r.changed.selected.push(r.selected[u]);for(u=0,f=i.length;u<f;u++)1===e[i[u]]&&r.changed.deselected.push(i[u]);i=r.selected.slice()}t.trigger.call(this,n,r)};this.refresh=function(){return i=[],t.refresh.apply(this,arguments)}},w=e.createElement("I"),w.className="jstree-icon jstree-checkbox",w.setAttribute("role","presentation"),n.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},n.jstree.plugins.checkbox=function(i,r){this.bind=function(){r.bind.call(this);this._data.checkbox.uto=!1;this._data.checkbox.selected=[];this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined");this.element.on("init.jstree",function(){this._data.checkbox.visible=this.settings.checkbox.visible;this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked");this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")}.bind(this)).on("loading.jstree",function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()}.bind(this));-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto);this._data.checkbox.uto=setTimeout(this._undetermined.bind(this),50)}.bind(this));this.settings.checkbox.tie_selection||this.element.on("model.jstree",function(n,t){for(var u=this._model.data,e=u[t.parent],r=t.nodes,i=0,f=r.length;i<f;i++)u[r[i]].state.checked=u[r[i]].state.checked||u[r[i]].original&&u[r[i]].original.state&&u[r[i]].original.state.checked,u[r[i]].state.checked&&this._data.checkbox.selected.push(r[i])}.bind(this));-1===this.settings.checkbox.cascade.indexOf("up")&&-1===this.settings.checkbox.cascade.indexOf("down")||this.element.on("model.jstree",function(t,i){var e=this._model.data,u=e[i.parent],s=i.nodes,c=[],a,r,o,h,l,v,i=this.settings.checkbox.cascade,f=this.settings.checkbox.tie_selection;if(-1!==i.indexOf("down"))if(u.state[f?"selected":"checked"]){for(r=0,o=s.length;r<o;r++)e[s[r]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(s)}else for(r=0,o=s.length;r<o;r++)if(e[s[r]].state[f?"selected":"checked"]){for(h=0,l=e[s[r]].children_d.length;h<l;h++)e[e[s[r]].children_d[h]].state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected=this._data[f?"core":"checkbox"].selected.concat(e[s[r]].children_d)}if(-1!==i.indexOf("up")){for(r=0,o=u.children_d.length;r<o;r++)e[u.children_d[r]].children.length||c.push(e[u.children_d[r]].parent);for(h=0,l=(c=n.vakata.array_unique(c)).length;h<l;h++)for(u=e[c[h]];u&&u.id!==n.jstree.root;){for(r=a=0,o=u.children.length;r<o;r++)a+=e[u.children[r]].state[f?"selected":"checked"];if(a!==o)break;u.state[f?"selected":"checked"]=!0;this._data[f?"core":"checkbox"].selected.push(u.id);(v=this.get_node(u,!0))&&v.length&&v.children(".jstree-anchor").attr("aria-selected",!0).addClass(f?"jstree-clicked":"jstree-checked");u=this.get_node(u.parent)}}this._data[f?"core":"checkbox"].selected=n.vakata.array_unique(this._data[f?"core":"checkbox"].selected)}.bind(this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",function(t,i){for(var p=this,h=i.node,v=this._model.data,u=this.get_node(h.parent),l,a,i=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection,e={},s=this._data[o?"core":"checkbox"].selected,r=0,f=s.length;r<f;r++)e[s[r]]=!0;if(-1!==i.indexOf("down"))for(var y=this._cascade_new_checked_state(h.id,!0),c=h.children_d.concat(h.id),r=0,f=c.length;r<f;r++)-1<y.indexOf(c[r])?e[c[r]]=!0:delete e[c[r]];if(-1!==i.indexOf("up"))while(u&&u.id!==n.jstree.root){for(r=l=0,f=u.children.length;r<f;r++)l+=v[u.children[r]].state[o?"selected":"checked"];if(l!==f)break;u.state[o?"selected":"checked"]=!0;e[u.id]=!0;(a=this.get_node(u,!0))&&a.length&&a.children(".jstree-anchor").attr("aria-selected",!0).addClass(o?"jstree-clicked":"jstree-checked");u=this.get_node(u.parent)}for(r in s=[],e)e.hasOwnProperty(r)&&s.push(r);this._data[o?"core":"checkbox"].selected=s}.bind(this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",function(){for(var r=this.get_node(n.jstree.root),u=this._model.data,t,i=0,f=r.children_d.length;i<f;i++)(t=u[r.children_d[i]])&&t.original&&t.original.state&&t.original.state.undetermined&&(t.original.state.undetermined=!1)}.bind(this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",function(t,i){var l=this,r=i.node,a=this.get_node(r,!0),f,o,u,s=this.settings.checkbox.cascade,e=this.settings.checkbox.tie_selection,i=this._data[e?"core":"checkbox"].selected,c=r.children_d.concat(r.id),h;if(-1!==s.indexOf("down")&&(h=this._cascade_new_checked_state(r.id,!1),i=n.vakata.array_filter(i,function(n){return-1===c.indexOf(n)||-1<h.indexOf(n)})),-1!==s.indexOf("up")&&-1===i.indexOf(r.id)){for(f=0,o=r.parents.length;f<o;f++)(u=this._model.data[r.parents[f]]).state[e?"selected":"checked"]=!1,u&&u.original&&u.original.state&&u.original.state.undetermined&&(u.original.state.undetermined=!1),(u=this.get_node(r.parents[f],!0))&&u.length&&u.children(".jstree-anchor").attr("aria-selected",!1).removeClass(e?"jstree-clicked":"jstree-checked");i=n.vakata.array_filter(i,function(n){return-1===r.parents.indexOf(n)})}this._data[e?"core":"checkbox"].selected=i}.bind(this));-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",function(t,i){for(var r=this.get_node(i.parent),h=this._model.data,f,e,o,s,u=this.settings.checkbox.tie_selection;r&&r.id!==n.jstree.root&&!r.state[u?"selected":"checked"];){for(f=o=0,e=r.children.length;f<e;f++)o+=h[r.children[f]].state[u?"selected":"checked"];if(!(0<e&&o===e))break;r.state[u?"selected":"checked"]=!0;this._data[u?"core":"checkbox"].selected.push(r.id);(s=this.get_node(r,!0))&&s.length&&s.children(".jstree-anchor").attr("aria-selected",!0).addClass(u?"jstree-clicked":"jstree-checked");r=this.get_node(r.parent)}}.bind(this)).on("move_node.jstree",function(t,i){var c=i.is_multi,l=i.old_parent,i=this.get_node(i.parent),h=this._model.data,r,s,e,o,f,u=this.settings.checkbox.tie_selection;if(!c)for(r=this.get_node(l);r&&r.id!==n.jstree.root&&!r.state[u?"selected":"checked"];){for(e=s=0,o=r.children.length;e<o;e++)s+=h[r.children[e]].state[u?"selected":"checked"];if(!(0<o&&s===o))break;r.state[u?"selected":"checked"]=!0;this._data[u?"core":"checkbox"].selected.push(r.id);(f=this.get_node(r,!0))&&f.length&&f.children(".jstree-anchor").attr("aria-selected",!0).addClass(u?"jstree-clicked":"jstree-checked");r=this.get_node(r.parent)}for(r=i;r&&r.id!==n.jstree.root;){for(e=s=0,o=r.children.length;e<o;e++)s+=h[r.children[e]].state[u?"selected":"checked"];if(s===o)r.state[u?"selected":"checked"]||(r.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(r.id),(f=this.get_node(r,!0))&&f.length&&f.children(".jstree-anchor").attr("aria-selected",!0).addClass(u?"jstree-clicked":"jstree-checked"));else{if(!r.state[u?"selected":"checked"])break;r.state[u?"selected":"checked"]=!1;this._data[u?"core":"checkbox"].selected=n.vakata.array_remove_item(this._data[u?"core":"checkbox"].selected,r.id);(f=this.get_node(r,!0))&&f.length&&f.children(".jstree-anchor").attr("aria-selected",!1).removeClass(u?"jstree-clicked":"jstree-checked")}r=this.get_node(r.parent)}}.bind(this))};this.get_undetermined=function(i){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];for(var r,h,f={},e=this._model.data,l=this.settings.checkbox.tie_selection,s=this._data[l?"core":"checkbox"].selected,o=[],v=this,a=[],u=0,c=s.length;u<c;u++)if(e[s[u]]&&e[s[u]].parents)for(r=0,h=e[s[u]].parents.length;r<h;r++){if(f[e[s[u]].parents[r]]!==t)break;e[s[u]].parents[r]!==n.jstree.root&&(f[e[s[u]].parents[r]]=!0,o.push(e[s[u]].parents[r]))}for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var i=v.get_node(this),s;if(i)if(i.state.loaded){for(u=0,c=i.children_d.length;u<c;u++)if(!(s=e[i.children_d[u]]).state.loaded&&s.original&&s.original.state&&s.original.state.undetermined&&!0===s.original.state.undetermined)for(f[s.id]===t&&s.id!==n.jstree.root&&(f[s.id]=!0,o.push(s.id)),r=0,h=s.parents.length;r<h;r++)f[s.parents[r]]===t&&s.parents[r]!==n.jstree.root&&(f[s.parents[r]]=!0,o.push(s.parents[r]))}else if(i.original&&i.original.state&&i.original.state.undetermined&&!0===i.original.state.undetermined)for(f[i.id]===t&&i.id!==n.jstree.root&&(f[i.id]=!0,o.push(i.id)),r=0,h=i.parents.length;r<h;r++)f[i.parents[r]]===t&&i.parents[r]!==n.jstree.root&&(f[i.parents[r]]=!0,o.push(i.parents[r]))}),u=0,c=o.length;u<c;u++)e[o[u]].state[l?"selected":"checked"]||a.push(i?e[o[u]]:o[u]);return a};this._undetermined=function(){if(null!==this.element){var i=this.get_undetermined(!1),n,r,t;for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),n=0,r=i.length;n<r;n++)(t=this.get_node(i[n],!0))&&t.length&&t.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}};this.redraw_node=function(n,t,i){if(n=r.redraw_node.apply(this,arguments)){for(var f=null,e=null,u=0,o=n.childNodes.length;u<o;u++)if(n.childNodes[u]&&n.childNodes[u].className&&-1!==n.childNodes[u].className.indexOf("jstree-anchor")){f=n.childNodes[u];break}f&&(!this.settings.checkbox.tie_selection&&this._model.data[n.id].state.checked&&(f.className+=" jstree-checked"),e=w.cloneNode(!1),this._model.data[n.id].state.checkbox_disabled&&(e.className+=" jstree-checkbox-disabled"),f.insertBefore(e,f.childNodes[0]))}return i||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(this._undetermined.bind(this),50)),n};this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0;this.get_container_ul().removeClass("jstree-no-checkboxes")};this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1;this.get_container_ul().addClass("jstree-no-checkboxes")};this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()};this.is_undetermined=function(t){t=this.get_node(t);var r=this.settings.checkbox.cascade,i,u,f=this.settings.checkbox.tie_selection,o=this._data[f?"core":"checkbox"].selected,e=this._model.data;if(!t||!0===t.state[f?"selected":"checked"]||-1===r.indexOf("undetermined")||-1===r.indexOf("down")&&-1===r.indexOf("up"))return!1;if(!t.state.loaded&&!0===t.original.state.undetermined)return!0;for(i=0,u=t.children_d.length;i<u;i++)if(-1!==n.inArray(t.children_d[i],o)||!e[t.children_d[i]].state.loaded&&e[t.children_d[i]].original.state.undetermined)return!0;return!1};this.disable_checkbox=function(t){var i,u,r;if(n.vakata.is_array(t)){for(i=0,u=(t=t.slice()).length;i<u;i++)this.disable_checkbox(t[i]);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;r=this.get_node(t,!0);t.state.checkbox_disabled||(t.state.checkbox_disabled=!0,r&&r.length&&r.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:t}))};this.enable_checkbox=function(t){var i,u,r;if(n.vakata.is_array(t)){for(i=0,u=(t=t.slice()).length;i<u;i++)this.enable_checkbox(t[i]);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;r=this.get_node(t,!0);t.state.checkbox_disabled&&(t.state.checkbox_disabled=!1,r&&r.length&&r.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:t}))};this.activate_node=function(t,i){return!n(i.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||n(i.target).hasClass("jstree-checkbox"))&&(i.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!n(i.target).hasClass("jstree-checkbox")?r.activate_node.call(this,t,i):!this.is_disabled(t)&&(this.is_checked(t)?this.uncheck_node(t,i):this.check_node(t,i),void this.trigger("activate_node",{node:this.get_node(t)})))};this.delete_node=function(t){if(this.settings.checkbox.tie_selection||n.vakata.is_array(t))return r.delete_node.call(this,t);var i,u,f,e=!1;if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;for((i=t.children_d.concat([])).push(t.id),u=0,f=i.length;u<f;u++)if(this._model.data[i[u]].state.checked){e=!0;break}return e&&(this._data.checkbox.selected=n.vakata.array_filter(this._data.checkbox.selected,function(t){return-1===n.inArray(t,i)})),r.delete_node.call(this,t)};this._cascade_new_checked_state=function(n,t){var c=this,r=this.settings.checkbox.tie_selection,i=this._model.data[n],u=[],e=[],o,l,f,h,n;if(!this.settings.checkbox.cascade_to_disabled&&i.state.disabled||!this.settings.checkbox.cascade_to_hidden&&i.state.hidden)f=this.get_checked_descendants(n),i.state[r?"selected":"checked"]&&f.push(i.id),u=u.concat(f);else{if(i.children)for(o=0,l=i.children.length;o<l;o++){var s=i.children[o],f=c._cascade_new_checked_state(s,t),u=u.concat(f);-1<f.indexOf(s)&&e.push(s)}h=c.get_node(i,!0);n=0<e.length&&e.length<i.children.length;i.original&&i.original.state&&i.original.state.undetermined&&(i.original.state.undetermined=n);!n&&t&&e.length===i.children.length?(i.state[r?"selected":"checked"]=t,u.push(i.id),h.children(".jstree-anchor").attr("aria-selected",!0).addClass(r?"jstree-clicked":"jstree-checked")):(i.state[r?"selected":"checked"]=!1,h.children(".jstree-anchor").attr("aria-selected",!1).removeClass(r?"jstree-clicked":"jstree-checked"))}return u};this.get_checked_descendants=function(t){var i=this,r=i.settings.checkbox.tie_selection,t=i._model.data[t];return n.vakata.array_filter(t.children_d,function(n){return i._model.data[n].state[r?"selected":"checked"]})};this.check_node=function(t,i){if(this.settings.checkbox.tie_selection)return this.select_node(t,!1,!0,i);var r,u,f;if(n.vakata.is_array(t)){for(u=0,f=(t=t.slice()).length;u<f;u++)this.check_node(t[u],i);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;r=this.get_node(t,!0);t.state.checked||(t.state.checked=!0,this._data.checkbox.selected.push(t.id),r&&r.length&&r.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:t,selected:this._data.checkbox.selected,event:i}))};this.uncheck_node=function(t,i){if(this.settings.checkbox.tie_selection)return this.deselect_node(t,!1,i);var r,f,u;if(n.vakata.is_array(t)){for(r=0,f=(t=t.slice()).length;r<f;r++)this.uncheck_node(t[r],i);return!0}if(!(t=this.get_node(t))||t.id===n.jstree.root)return!1;u=this.get_node(t,!0);t.state.checked&&(t.state.checked=!1,this._data.checkbox.selected=n.vakata.array_remove_item(this._data.checkbox.selected,t.id),u.length&&u.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:t,selected:this._data.checkbox.selected,event:i}))};this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var r=this._data.checkbox.selected.concat([]),t,i;for(this._data.checkbox.selected=this._model.data[n.jstree.root].children_d.concat(),t=0,i=this._data.checkbox.selected.length;t<i;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!0);this.redraw(!0);this.trigger("check_all",{selected:this._data.checkbox.selected})};this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();for(var t=this._data.checkbox.selected.concat([]),n=0,i=this._data.checkbox.selected.length;n<i;n++)this._model.data[this._data.checkbox.selected[n]]&&(this._model.data[this._data.checkbox.selected[n]].state.checked=!1);this._data.checkbox.selected=[];this.element.find(".jstree-checked").removeClass("jstree-checked");this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:t})};this.is_checked=function(t){return this.settings.checkbox.tie_selection?this.is_selected(t):!(!(t=this.get_node(t))||t.id===n.jstree.root)&&t.state.checked};this.get_checked=function(t){return this.settings.checkbox.tie_selection?this.get_selected(t):t?n.map(this._data.checkbox.selected,function(n){return this.get_node(n)}.bind(this)):this._data.checkbox.selected.slice()};this.get_top_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_top_selected(t);for(var r=this.get_checked(!0),u={},f,o,i=0,e=r.length;i<e;i++)u[r[i].id]=r[i];for(i=0,e=r.length;i<e;i++)for(f=0,o=r[i].children_d.length;f<o;f++)u[r[i].children_d[f]]&&delete u[r[i].children_d[f]];for(i in r=[],u)u.hasOwnProperty(i)&&r.push(i);return t?n.map(r,function(n){return this.get_node(n)}.bind(this)):r};this.get_bottom_checked=function(t){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(t);for(var r=this.get_checked(!0),u=[],i=0,f=r.length;i<f;i++)r[i].children.length||u.push(r[i].id);return t?n.map(u,function(n){return this.get_node(n)}.bind(this)):u};this.load_node=function(t){var i,f,u;if(!n.vakata.is_array(t)&&!this.settings.checkbox.tie_selection&&(u=this.get_node(t))&&u.state.loaded)for(i=0,f=u.children_d.length;i<f;i++)this._model.data[u.children_d[i]].state.checked&&(this._data.checkbox.selected=n.vakata.array_remove_item(this._data.checkbox.selected,u.children_d[i]));return r.load_node.apply(this,arguments)};this.get_state=function(){var n=r.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection||(n.checkbox=this._data.checkbox.selected.slice()),n};this.set_state=function(t,i){var u=r.set_state.apply(this,arguments),f;return u&&t.checkbox?(this.settings.checkbox.tie_selection||(this.uncheck_all(),f=this,n.each(t.checkbox,function(n,t){f.check_node(t)})),delete t.checkbox,this.set_state(t,i),!1):u};this.refresh=function(){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),r.refresh.apply(this,arguments)}},n.jstree.defaults.conditionalselect=function(){return!0},n.jstree.plugins.conditionalselect=function(n,t){this.activate_node=function(n,i){if(this.settings.conditionalselect.call(this,this.get_node(n),i))return t.activate_node.call(this,n,i)}},n.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(t){var i=n.jstree.reference(t.reference),t=i.get_node(t.reference);i.create_node(t,{},"last",function(n){try{i.edit(n)}catch(t){setTimeout(function(){i.edit(n)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(t){var i=n.jstree.reference(t.reference),t=i.get_node(t.reference);i.edit(t)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(t){var i=n.jstree.reference(t.reference),t=i.get_node(t.reference);i.is_selected(t)?i.delete_node(i.get_selected()):i.delete_node(t)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(t){var i=n.jstree.reference(t.reference),t=i.get_node(t.reference);i.is_selected(t)?i.cut(i.get_top_selected()):i.cut(t)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(t){var i=n.jstree.reference(t.reference),t=i.get_node(t.reference);i.is_selected(t)?i.copy(i.get_top_selected()):i.copy(t)}},paste:{separator_before:!1,icon:!1,_disabled:function(t){return!n.jstree.reference(t.reference).can_paste()},separator_after:!1,label:"Paste",action:function(t){var i=n.jstree.reference(t.reference),t=i.get_node(t.reference);i.paste(t)}}}}}}},n.jstree.plugins.contextmenu=function(i,r){this.bind=function(){r.bind.call(this);var i=0,t=null,u,f;this.element.on("init.jstree loading.jstree ready.jstree",function(){this.get_container_ul().addClass("jstree-contextmenu")}.bind(this)).on("contextmenu.jstree",".jstree-anchor",function(n,r){"input"!==n.target.tagName.toLowerCase()&&(n.preventDefault(),i=n.ctrlKey?+new Date:0,(r||t)&&(i=+new Date+1e4),t&&clearTimeout(t),this.is_loading(n.currentTarget)||this.show_contextmenu(n.currentTarget,n.pageX,n.pageY,n))}.bind(this)).on("click.jstree",".jstree-anchor",function(){this._data.contextmenu.visible&&(!i||250<+new Date-i)&&n.vakata.context.hide();i=0}.bind(this)).on("touchstart.jstree",".jstree-anchor",function(i){i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches[0]&&(u=i.originalEvent.changedTouches[0].clientX,f=i.originalEvent.changedTouches[0].clientY,t=setTimeout(function(){n(i.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(i){t&&i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches[0]&&(10<Math.abs(u-i.originalEvent.changedTouches[0].clientX)||10<Math.abs(f-i.originalEvent.changedTouches[0].clientY))&&(clearTimeout(t),n.vakata.context.hide())}).on("touchend.vakata.jstree",function(){t&&clearTimeout(t)});n(e).on("context_hide.vakata.jstree",function(t,i){this._data.contextmenu.visible=!1;n(i.reference).removeClass("jstree-context")}.bind(this))};this.teardown=function(){this._data.contextmenu.visible&&n.vakata.context.hide();n(e).off("context_hide.vakata.jstree");r.teardown.call(this)};this.show_contextmenu=function(i,r,u,f){if(!(i=this.get_node(i))||i.id===n.jstree.root)return!1;var s=this.settings.contextmenu,h=this.get_node(i,!0).children(".jstree-anchor"),o=!1,e=!1;(s.show_at_node||r===t||u===t)&&(o=h.offset(),r=o.left,u=o.top+this._data.core.li_height);this.settings.contextmenu.select_node&&!this.is_selected(i)&&this.activate_node(i,f);e=s.items;n.vakata.is_function(e)&&(e=e.call(this,i,function(n){this._show_contextmenu(i,r,u,n)}.bind(this)));n.isPlainObject(e)&&this._show_contextmenu(i,r,u,e)};this._show_contextmenu=function(t,i,r,u){var f=this.get_node(t,!0).children(".jstree-anchor");n(e).one("context_show.vakata.jstree",function(t,i){var r="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";n(i.element).addClass(r);f.addClass("jstree-context")}.bind(this));this._data.contextmenu.visible=!0;n.vakata.context.show(f,{x:i,y:r},u);this.trigger("show_contextmenu",{node:t,x:i,y:r})}},r={element:y=!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1},(f=n).vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(n){f(e).triggerHandler("context_"+n+".vakata",{reference:r.reference,element:r.element,position:{x:r.position_x,y:r.position_y}})},_execute:function(n){return!(!(n=r.items[n])||n._disabled&&(!f.vakata.is_function(n._disabled)||n._disabled({item:n,reference:r.reference,element:r.element}))||!n.action)&&n.action.call(null,{item:n,reference:r.reference,element:r.element,position:{x:r.position_x,y:r.position_y}})},_parse:function(n,t){if(!n)return!1;t||(r.html="",r.items=[]);var i="",u=!1,e;return t&&(i+="<ul>"),f.each(n,function(n,t){return!t||(r.items.push(t),!u&&t.separator_before&&(i+="<li class='vakata-context-separator'><a href='#' "+(f.vakata.context.settings.icons?"":'class="vakata-context-no-icons"')+">&#160;<\/a><\/li>"),u=!1,i+="<li class='"+(t._class||"")+(!0===t._disabled||f.vakata.is_function(t._disabled)&&t._disabled({item:t,reference:r.reference,element:r.element})?" vakata-contextmenu-disabled ":"")+"' "+(t.shortcut?" data-shortcut='"+t.shortcut+"' ":"")+">",i+="<a href='#' rel='"+(r.items.length-1)+"' "+(t.title?"title='"+t.title+"'":"")+">",f.vakata.context.settings.icons&&(i+="<i ",t.icon&&(i+=-1!==t.icon.indexOf("/")||-1!==t.icon.indexOf(".")?" style='background:url(\""+t.icon+"\") center center no-repeat' ":" class='"+t.icon+"' "),i+="><\/i><span class='vakata-contextmenu-sep'>&#160;<\/span>"),i+=(f.vakata.is_function(t.label)?t.label({item:n,reference:r.reference,element:r.element}):t.label)+(t.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+t.shortcut+'">'+(t.shortcut_label||"")+"<\/span>":"")+"<\/a>",t.submenu&&(e=f.vakata.context._parse(t.submenu,!0))&&(i+=e),i+="<\/li>",void(t.separator_after&&(i+="<li class='vakata-context-separator'><a href='#' "+(f.vakata.context.settings.icons?"":'class="vakata-context-no-icons"')+">&#160;<\/a><\/li>",u=!0)))}),i=i.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),t&&(i+="<\/ul>"),t||(r.html=i,f.vakata.context._trigger("parse")),10<i.length&&i},_show_submenu:function(n){var t,e,r,o,i,s,u,h;(n=f(n)).length&&n.children("ul").length&&(t=n.children("ul"),r=(e=n.offset().left)+n.outerWidth(),o=n.offset().top,i=t.width(),s=t.height(),u=f(window).width()+f(window).scrollLeft(),h=f(window).height()+f(window).scrollTop(),y?n[r-(i+10+n.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):n[u<r+i&&u-r<e?"addClass":"removeClass"]("vakata-context-right"),h<o+s+10&&t.css("bottom","-1px"),n.hasClass("vakata-context-right")?e<i&&t.css("margin-right",e-i):u-r<i&&t.css("margin-left",u-r-i),t.show())},show:function(n,t,i){var h,o,u,s,c,l,a,i;switch(r.element&&r.element.length&&r.element.width(""),!0){case!t&&!n:return!1;case!!t&&!!n:r.reference=n;r.position_x=t.x;r.position_y=t.y;break;case!t&&!!n:h=(r.reference=n).offset();r.position_x=h.left+n.outerHeight();r.position_y=h.top;break;case!!t&&!n:r.position_x=t.x;r.position_y=t.y}n&&!i&&f(n).data("vakata_contextmenu")&&(i=f(n).data("vakata_contextmenu"));f.vakata.context._parse(i)&&r.element.html(r.html);r.items.length&&(r.element.appendTo(e.body),o=r.element,u=r.position_x,s=r.position_y,c=o.width(),l=o.height(),a=f(window).width()+f(window).scrollLeft(),i=f(window).height()+f(window).scrollTop(),y&&(u-=o.outerWidth()-f(n).outerWidth())<f(window).scrollLeft()+20&&(u=f(window).scrollLeft()+20),r.element.css({left:u=a<u+c+20?a-(c+20):u,top:s=i<s+l+20?i-(l+20):s}).show().find("a").first().trigger("focus").parent().addClass("vakata-context-hover"),r.is_visible=!0,f.vakata.context._trigger("show"))},hide:function(){r.is_visible&&(r.element.hide().find("ul").hide().end().find(":focus").trigger("blur").end().detach(),r.is_visible=!1,f.vakata.context._trigger("hide"))}},f(function(){y="rtl"===f(e.body).css("direction");var n=!1;r.element=f("<ul class='vakata-context'><\/ul>");r.element.on("mouseenter","li",function(t){t.stopImmediatePropagation();f.contains(this,t.relatedTarget)||(n&&clearTimeout(n),r.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),f(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),f.vakata.context._show_submenu(this))}).on("mouseleave","li",function(n){f.contains(this,n.relatedTarget)||f(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(){var t;f(this).find(".vakata-context-hover").removeClass("vakata-context-hover");f.vakata.context.settings.hide_onmouseleave&&(n=setTimeout((t=this,function(){f.vakata.context.hide()}),f.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(n){n.preventDefault();f(this).trigger("blur").parent().hasClass("vakata-context-disabled")||!1===f.vakata.context._execute(f(this).attr("rel"))||f.vakata.context.hide()}).on("keydown","a",function(n){var t=null;switch(n.which){case 13:case 32:n.type="click";n.preventDefault();f(n.currentTarget).trigger(n);break;case 37:r.is_visible&&(r.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").trigger("focus"),n.stopImmediatePropagation(),n.preventDefault());break;case 38:r.is_visible&&((t=(t=r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length?t:r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()).addClass("vakata-context-hover").children("a").trigger("focus"),n.stopImmediatePropagation(),n.preventDefault());break;case 39:r.is_visible&&(r.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").trigger("focus"),n.stopImmediatePropagation(),n.preventDefault());break;case 40:r.is_visible&&((t=(t=r.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length?t:r.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()).addClass("vakata-context-hover").children("a").trigger("focus"),n.stopImmediatePropagation(),n.preventDefault());break;case 27:f.vakata.context.hide();n.preventDefault()}}).on("keydown",function(n){n.preventDefault();var n=r.element.find(".vakata-contextmenu-shortcut-"+n.which).parent();n.parent().not(".vakata-context-disabled")&&n.trigger("click")});f(e).on("mousedown.vakata.jstree",function(n){r.is_visible&&r.element[0]!==n.target&&!f.contains(r.element[0],n.target)&&f.vakata.context.hide()}).on("context_show.vakata.jstree",function(){r.element.find("li:has(ul)").children("a").addClass("vakata-context-parent");y&&r.element.addClass("vakata-context-rtl").css("direction","rtl");r.element.find("ul").hide().end()})}),n.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1,blank_space_drop:!1},n.jstree.plugins.dnd=function(t,i){this.init=function(n,t){i.init.call(this,n,t);this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in e.createElement("span")};this.bind=function(){i.bind.call(this);this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",function(t){if(this.settings.dnd.large_drag_target&&n(t.target).closest(".jstree-node")[0]!==t.currentTarget||"touchstart"===t.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!n(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var i=this.get_node(t.target),r=this.is_selected(i)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,u=1<r?r+" "+this.get_string("nodes"):this.get_text(t.currentTarget);if(this.settings.core.force_text&&(u=n.vakata.html.escape(u)),i&&(i.id||0===i.id)&&i.id!==n.jstree.root&&(1===t.which||"touchstart"===t.type||"dragstart"===t.type)&&(!0===this.settings.dnd.is_draggable||n.vakata.is_function(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,1<r?this.get_top_selected(!0):[i],t))){if(c={jstree:!0,origin:this,obj:this.get_node(i,!0),nodes:1<r?this.get_top_selected():[i.id]},s=t.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),n.vakata.dnd.start(t,c,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"><\/i>'+u+'<ins class="jstree-copy">+<\/ins><\/div>');n.vakata.dnd._trigger("start",t,{helper:n(),element:s,data:c})}}.bind(this));this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(t){return t.preventDefault(),n.vakata.dnd._trigger("move",t,{helper:n(),element:s,data:c}),!1}).on("drop.jstree",function(t){return t.preventDefault(),n.vakata.dnd._trigger("stop",t,{helper:n(),element:s,data:c}),!1}.bind(this))};this.redraw_node=function(n){if((n=i.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)n.setAttribute("draggable",!0);else{for(var r=null,t=0,u=n.childNodes.length;t<u;t++)if(n.childNodes[t]&&n.childNodes[t].className&&-1!==n.childNodes[t].className.indexOf("jstree-anchor")){r=n.childNodes[t];break}r&&r.setAttribute("draggable",!0)}return n}},n(function(){var i=!1,o=!1,r=!1,u=!1,f=n('<div id="jstree-marker">&#160;<\/div>').hide();n(e).on("dragover.vakata.jstree",function(t){s&&n.vakata.dnd._trigger("move",t,{helper:n(),element:s,data:c})}).on("drop.vakata.jstree",function(t){s&&(n.vakata.dnd._trigger("stop",t,{helper:n(),element:s,data:c}),c=s=null)}).on("dnd_start.vakata.jstree",function(n,t){r=i=!1;t&&t.data&&t.data.jstree&&f.appendTo(e.body)}).on("dnd_move.vakata.jstree",function(e,s){var ot=s.event.target!==r.target;if(u&&(s.event&&"dragover"===s.event.type&&!ot||clearTimeout(u)),s&&s.data&&s.data.jstree&&(!s.event.target.id||"jstree-marker"!==s.event.target.id)){r=s.event;var h=n.jstree.reference(s.event.target),c=!1,a=!1,d=!1,g,nt,p,v,w,tt,y,l,it,et,rt,st,b,k,ut,ht,ft;if(h&&h._data&&h._data.dnd)if(f.attr("class","jstree-"+h.get_theme()+(h.settings.core.themes.responsive?" jstree-dnd-responsive":"")),ut=s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey)),s.helper.children().attr("class","jstree-"+h.get_theme()+" jstree-"+h.get_theme()+"-"+h.get_theme_variant()+" "+(h.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[ut?"show":"hide"](),(s.event.target===h.element[0]||s.event.target===h.get_container_ul()[0])&&(0===h.get_container_ul().children().length||h.settings.dnd.blank_space_drop)){for(y=!0,l=0,it=s.data.nodes.length;l<it;l++)if(!(y=y&&h.check(s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey))?"copy_node":"move_node",s.data.origin&&s.data.origin!==h?s.data.origin.get_node(s.data.nodes[l]):s.data.nodes[l],n.jstree.root,"last",{dnd:!0,ref:h.get_node(n.jstree.root),pos:"i",origin:s.data.origin,is_multi:s.data.origin&&s.data.origin!==h,is_foreign:!s.data.origin})))break;if(y)return i={ins:h,par:n.jstree.root,pos:"last"},f.hide(),s.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(s.event.originalEvent&&s.event.originalEvent.dataTransfer&&(s.event.originalEvent.dataTransfer.dropEffect=ut?"copy":"move"))}else if((c=h.settings.dnd.large_drop_target?n(s.event.target).closest(".
3jstree-node").children(".jstree-anchor"):n(s.event.target).closest(".jstree-anchor"))&&c.length&&c.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(a=c.offset(),d=(s.event.pageY!==t?s.event:s.event.originalEvent).pageY-a.top,p=c.outerHeight(),tt=d<p/3?["b","i","a"]:p-p/3<d?["a","i","b"]:p/2<d?["i","a","b"]:["i","b","a"],n.each(tt,function(t,r){switch(r){case"b":g=a.left-6;nt=a.top;v=h.get_parent(c);w=c.parent().index();ft="jstree-below";break;case"i":b=h.settings.dnd.inside_pos;k=h.get_node(c.parent());g=a.left-2;nt=a.top+p/2+1;v=k.id;w="first"===b?0:"last"===b?k.children.length:Math.min(b,k.children.length);ft="jstree-inside";break;case"a":g=a.left-6;nt=a.top+p;v=h.get_parent(c);w=c.parent().index()+1;ft="jstree-above"}for(y=!0,l=0,it=s.data.nodes.length;l<it;l++)if(et=s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey))?"copy_node":"move_node",rt=w,"move_node"==et&&"a"===r&&s.data.origin&&s.data.origin===h&&v===h.get_parent(s.data.nodes[l])&&(st=h.get_node(v),rt>n.inArray(s.data.nodes[l],st.children)&&--rt),!(y=y&&(h&&h.settings&&h.settings.dnd&&!1===h.settings.dnd.check_while_dragging||h.check(et,s.data.origin&&s.data.origin!==h?s.data.origin.get_node(s.data.nodes[l]):s.data.nodes[l],v,rt,{dnd:!0,ref:h.get_node(c.parent()),pos:r,origin:s.data.origin,is_multi:s.data.origin&&s.data.origin!==h,is_foreign:!s.data.origin})))){h&&h.last_error&&(o=h.last_error());break}var e,d;if("i"===r&&c.parent().is(".jstree-closed")&&h.settings.dnd.open_timeout&&(s.event&&"dragover"===s.event.type&&!ot||(u&&clearTimeout(u),u=setTimeout((d=c,function(){e.open_node(d)}),(e=h).settings.dnd.open_timeout))),y)return(ht=h.get_node(v,!0)).hasClass(".jstree-dnd-parent")||(n(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),ht.addClass("jstree-dnd-parent")),i={ins:h,par:v,pos:"i"!==r||"last"!==b||0!==w||h.is_loaded(k)?w:"last"},f.css({left:g+"px",top:nt+"px"}).show(),f.removeClass("jstree-above jstree-inside jstree-below").addClass(ft),s.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),s.event.originalEvent&&s.event.originalEvent.dataTransfer&&(s.event.originalEvent.dataTransfer.dropEffect=ut?"copy":"move"),o={},!(tt=!0)}),!0===tt))return;n(".jstree-dnd-parent").removeClass("jstree-dnd-parent");i=!1;s.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er");s.event.originalEvent&&s.event.originalEvent.dataTransfer;f.hide()}}).on("dnd_scroll.vakata.jstree",function(n,t){t&&t.data&&t.data.jstree&&(f.hide(),r=i=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(t,e){if(n(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),u&&clearTimeout(u),e&&e.data&&e.data.jstree){f.hide().detach();var s,h,c=[];if(i){for(s=0,h=e.data.nodes.length;s<h;s++)c[s]=e.data.origin?e.data.origin.get_node(e.data.nodes[s]):e.data.nodes[s];i.ins[e.data.origin&&(e.data.origin.settings.dnd.always_copy||e.data.origin.settings.dnd.copy&&(e.event.metaKey||e.event.ctrlKey))?"copy_node":"move_node"](c,i.par,i.pos,!1,!1,!1,e.data.origin)}else(s=n(e.event.target).closest(".jstree")).length&&o&&o.error&&"check"===o.error&&(s=s.jstree(!0))&&s.settings.core.error.call(this,o);i=r=!1}}).on("keyup.jstree keydown.jstree",function(t,e){(e=n.vakata.dnd._get())&&e.data&&e.data.jstree&&("keyup"===t.type&&27===t.which?(u&&clearTimeout(u),u=r=o=i=!1,f.hide().detach(),n.vakata.dnd._clean()):(e.helper.find(".jstree-copy").first()[e.data.origin&&(e.data.origin.settings.dnd.always_copy||e.data.origin.settings.dnd.copy&&(t.metaKey||t.ctrlKey))?"show":"hide"](),r&&(r.metaKey=t.metaKey,r.ctrlKey=t.ctrlKey,n.vakata.dnd._trigger("move",r))))})}),i={element:!((u=n).vakata.html={div:u("<div><\/div>"),escape:function(n){return u.vakata.html.div.text(n).html()},strip:function(n){return u.vakata.html.div.empty().append(u.parseHTML(n)).text()}}),target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},u.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(n,i,r){(r=r===t?u.vakata.dnd._get():r).event=i;u(e).triggerHandler("dnd_"+n+".vakata",r)},_get:function(){return{data:i.data,element:i.element,helper:i.helper}},_clean:function(){i.helper&&i.helper.remove();i.scroll_i&&(clearInterval(i.scroll_i),i.scroll_i=!1);i={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};s=null;u(e).off("mousemove.vakata.jstree touchmove.vakata.jstree",u.vakata.dnd.drag);u(e).off("mouseup.vakata.jstree touchend.vakata.jstree",u.vakata.dnd.stop)},_scroll:function(n){if(!i.scroll_e||!i.scroll_l&&!i.scroll_t)return i.scroll_i&&(clearInterval(i.scroll_i),i.scroll_i=!1),!1;if(!i.scroll_i)return i.scroll_i=setInterval(u.vakata.dnd._scroll,100),!1;if(!0===n)return!1;var t=i.scroll_e.scrollTop(),n=i.scroll_e.scrollLeft();i.scroll_e.scrollTop(t+i.scroll_t*u.vakata.dnd.settings.scroll_speed);i.scroll_e.scrollLeft(n+i.scroll_l*u.vakata.dnd.settings.scroll_speed);t===i.scroll_e.scrollTop()&&n===i.scroll_e.scrollLeft()||u.vakata.dnd._trigger("scroll",i.scroll_e)},start:function(n,t,r){"touchstart"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=e.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset));i.is_drag&&u.vakata.dnd.stop({});try{n.currentTarget.unselectable="on";n.currentTarget.onselectstart=function(){return!1};n.currentTarget.style&&(n.currentTarget.style.touchAction="none",n.currentTarget.style.msTouchAction="none",n.currentTarget.style.MozUserSelect="none")}catch(n){}return i.init_x=n.pageX,i.init_y=n.pageY,i.data=t,i.is_down=!0,i.element=n.currentTarget,i.target=n.target,i.is_touch="touchstart"===n.type,!1!==r&&(i.helper=u("<div id='vakata-dnd'><\/div>").html(r).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),u(e).on("mousemove.vakata.jstree touchmove.vakata.jstree",u.vakata.dnd.drag),u(e).on("mouseup.vakata.jstree touchend.vakata.jstree",u.vakata.dnd.stop),!1},drag:function(n){if("touchmove"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=e.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_down){if(!i.is_drag){if(!(Math.abs(n.pageX-i.init_x)>(i.is_touch?u.vakata.dnd.settings.threshold_touch:u.vakata.dnd.settings.threshold)||Math.abs(n.pageY-i.init_y)>(i.is_touch?u.vakata.dnd.settings.threshold_touch:u.vakata.dnd.settings.threshold)))return;i.helper&&(i.helper.appendTo(e.body),i.helper_w=i.helper.outerWidth());i.is_drag=!0;u(i.target).one("click.vakata",!1);u.vakata.dnd._trigger("start",n)}var t=!1,l=!1,r=!1,o=!1,f=!1,s=!1,a=!1,v=!1,h=!1,c=!1;return i.scroll_t=0,i.scroll_l=0,i.scroll_e=!1,u(u(n.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return this.ownerDocument&&/^auto|scroll$/.test(u(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var r=u(this),t=r.offset();if(this.scrollHeight>this.offsetHeight&&(t.top+r.height()-n.pageY<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=1),n.pageY-t.top<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=-1)),this.scrollWidth>
vendor: 19,844 bytes, line 3
3this.offsetWidth&&(t.left+r.width()-n.pageX<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=1),n.pageX-t.left<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=-1)),i.scroll_t||i.scroll_l)return i.scroll_e=u(this),!1}),i.scroll_e||(t=u(e),l=u(window),r=t.height(),o=l.height(),f=t.width(),s=l.width(),a=t.scrollTop(),v=t.scrollLeft(),o<r&&n.pageY-a<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=-1),o<r&&o-(n.pageY-a)<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_t=1),s<f&&n.pageX-v<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=-1),s<f&&s-(n.pageX-v)<u.vakata.dnd.settings.scroll_proximity&&(i.scroll_l=1),(i.scroll_t||i.scroll_l)&&(i.scroll_e=t)),i.scroll_e&&u.vakata.dnd._scroll(!0),i.helper&&(h=parseInt(n.pageY+u.vakata.dnd.settings.helper_top,10),c=parseInt(n.pageX+u.vakata.dnd.settings.helper_left,10),f&&c+i.helper_w>f&&(c=f-(i.helper_w+2)),i.helper.css({left:c+"px",top:(h=r&&r<h+25?r-50:h)+"px"})),u.vakata.dnd._trigger("move",n),!1}},stop:function(n){var t;return"touchend"===n.type&&n.originalEvent&&n.originalEvent.changedTouches&&n.originalEvent.changedTouches[0]&&(n.pageX=n.originalEvent.changedTouches[0].pageX,n.pageY=n.originalEvent.changedTouches[0].pageY,n.target=e.elementFromPoint(n.originalEvent.changedTouches[0].pageX-window.pageXOffset,n.originalEvent.changedTouches[0].pageY-window.pageYOffset)),i.is_drag?(n.target!==i.target&&u(i.target).off("click.vakata"),u.vakata.dnd._trigger("stop",n)):"touchend"===n.type&&n.target===i.target&&(t=setTimeout(function(){u(n.target).trigger("click")},100),u(n.target).one("click",function(){t&&clearTimeout(t)})),u.vakata.dnd._clean(),!1}},n.jstree.defaults.massload=null,n.jstree.plugins.massload=function(t,i){this.init=function(n,t){this._data.massload={};i.init.call(this,n,t)};this._load_nodes=function(t,r,u,f){var e=this.settings.massload,h=[],c=this._model.data,s,l,o;if(!u){for(s=0,l=t.length;s<l;s++)c[t[s]]&&(c[t[s]].state.loaded||c[t[s]].state.failed)&&!f||(h.push(t[s]),(o=this.get_node(t[s],!0))&&o.length&&o.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},h.length){if(n.vakata.is_function(e))return e.call(this,h,function(n){var e,s;if(n)for(e in n)n.hasOwnProperty(e)&&(this._data.massload[e]=n[e]);for(e=0,s=t.length;e<s;e++)(o=this.get_node(t[e],!0))&&o.length&&o.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,r,u,f)}.bind(this));if("object"==typeof e&&e&&e.url)return e=n.extend(!0,{},e),n.vakata.is_function(e.url)&&(e.url=e.url.call(this,h)),n.vakata.is_function(e.data)&&(e.data=e.data.call(this,h)),n.ajax(e).done(function(n){var e,s;if(n)for(e in n)n.hasOwnProperty(e)&&(this._data.massload[e]=n[e]);for(e=0,s=t.length;e<s;e++)(o=this.get_node(t[e],!0))&&o.length&&o.removeClass("jstree-loading").attr("aria-busy",!1);i._load_nodes.call(this,t,r,u,f)}.bind(this)).fail(function(){i._load_nodes.call(this,t,r,u,f)}.bind(this))}}return i._load_nodes.call(this,t,r,u,f)};this._load_node=function(t,r){var u=this._data.massload[t.id],f=null;return u?(f=this["string"==typeof u?"_append_html_data":"_append_json_data"](t,"string"==typeof u?n(n.parseHTML(u)).filter(function(){return 3!==this.nodeType}):u,function(n){r.call(this,n)}),(u=this.get_node(t.id,!0))&&u.length&&u.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[t.id],f):i._load_node.call(this,t,r)}},n.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},n.jstree.plugins.search=function(i,r){this.bind=function(){r.bind.call(this);this._data.search.str="";this._data.search.dom=n();this._data.search.res=[];this._data.search.opn=[];this._data.search.som=!1;this._data.search.smc=!1;this._data.search.hdn=[];this.element.on("search.jstree",function(t,i){if(this._data.search.som&&i.res.length){for(var u=this._model.data,f=[],e,o,r=0,s=i.res.length;r<s;r++)if(u[i.res[r]]&&!u[i.res[r]].state.hidden&&(f.push(i.res[r]),f=f.concat(u[i.res[r]].parents),this._data.search.smc))for(e=0,o=u[i.res[r]].children_d.length;e<o;e++)u[u[i.res[r]].children_d[e]]&&!u[u[i.res[r]].children_d[e]].state.hidden&&f.push(u[i.res[r]].children_d[e]);f=n.vakata.array_remove_item(n.vakata.array_unique(f),n.jstree.root);this._data.search.hdn=this.hide_all(!0);this.show_node(f,!0);this.redraw(!0)}}.bind(this)).on("clear_search.jstree",function(n,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))}.bind(this))};this.search=function(i,r,u,f,e,o){if(!1===i||""===n.vakata.trim(i.toString()))return this.clear_search();f=(f=this.get_node(f))&&(f.id||0===f.id)?f.id:null;i=i.toString();var h=this.settings.search,s=h.ajax||!1,v=this._model.data,y=null,a=[],c=[],l,p;if(this._data.search.res.length&&!e&&this.clear_search(),u===t&&(u=h.show_only_matches),o===t&&(o=h.show_only_matches_children),!r&&!1!==s)return n.vakata.is_function(s)?s.call(this,i,function(t){t&&t.d&&(t=t.d);this._load_nodes(n.vakata.is_array(t)?n.vakata.array_unique(t):[],function(){this.search(i,!0,u,f,e,o)})}.bind(this),f):((s=n.extend({},s)).data||(s.data={}),s.data.str=i,f&&(s.data.inside=f),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=n.ajax(s).fail(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(s)};this.settings.core.error.call(this,this._data.core.last_error)}.bind(this)).done(function(t){t&&t.d&&(t=t.d);this._load_nodes(n.vakata.is_array(t)?n.vakata.array_unique(t):[],function(){this.search(i,!0,u,f,e,o)})}.bind(this)),this._data.search.lastRequest);if(e||(this._data.search.str=i,this._data.search.dom=n(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=u,this._data.search.smc=o),y=new n.vakata.search(i,!0,{caseSensitive:h.case_sensitive,fuzzy:h.fuzzy}),n.each(v[f||n.jstree.root].children_d,function(n,t){var r=v[t];r.text&&!r.state.hidden&&(!h.search_leaves_only||r.state.loaded&&0===r.children.length)&&(h.search_callback&&h.search_callback.call(this,i,r)||!h.search_callback&&y.search(r.text).isMatch)&&(a.push(t),c=c.concat(r.parents))}),a.length){for(l=0,p=(c=n.vakata.array_unique(c)).length;l<p;l++)c[l]!==n.jstree.root&&v[c[l]]&&!0===this.open_node(c[l],null,0)&&this._data.search.opn.push(c[l]);e?(this._data.search.dom=this._data.search.dom.add(n(this.element[0].querySelectorAll("#"+n.map(a,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(n.jstree.idregex,"\\$&"):t.replace(n.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=n.vakata.array_unique(this._data.search.res.concat(a))):(this._data.search.dom=n(this.element[0].querySelectorAll("#"+n.map(a,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(n.jstree.idregex,"\\$&"):t.replace(n.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=a);this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:i,res:this._data.search.res,show_only_matches:u})};this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0);this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res});this._data.search.res.length&&(this._data.search.dom=n(this.element[0].querySelectorAll("#"+n.map(this._data.search.res,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(n.jstree.idregex,"\\$&"):t.replace(n.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"));this._data.search.str="";this._data.search.res=[];this._data.search.opn=[];this._data.search.dom=n()};this.redraw_node=function(t){if((t=r.redraw_node.apply(this,arguments))&&-1!==n.inArray(t.id,this._data.search.res)){for(var u=null,i=0,f=t.childNodes.length;i<f;i++)if(t.childNodes[i]&&t.childNodes[i].className&&-1!==t.childNodes[i].className.indexOf("jstree-anchor")){u=t.childNodes[i];break}u&&(u.className+=" jstree-search")}return t}},(b=n).vakata.search=function(n,t,i){i=i||{};!1!==(i=b.extend({},b.vakata.search.defaults,i)).fuzzy&&(i.fuzzy=!0);n=i.caseSensitive?n:n.toLowerCase();var u=i.location,o=i.distance,c=i.threshold,r=n.length,s,h,f,e;return 32<r&&(i.fuzzy=!1),i.fuzzy&&(s=1<<r-1,h=function(){for(var i={},t=0,t=0;t<r;t++)i[n.charAt(t)]=0;for(t=0;t<r;t++)i[n.charAt(t)]|=1<<r-t-1;return i}(),f=function(n,t){var n=n/r,t=Math.abs(u-t);return o?n+t/o:t?1:n}),e=function(t){if(t=i.caseSensitive?t.toString():t.toString().toLowerCase(),n===t||-1!==t.indexOf(n))return{isMatch:!0,score:0};if(!i.fuzzy)return{isMatch:!1,score:1};var a,e,tt=t.length,v=c,o=t.indexOf(n,u),p,l,w=r+tt,b,d,k,y,g,nt=1,it=[];for(-1!==o&&(v=Math.min(f(0,o),v),-1!==(o=t.lastIndexOf(n,u+r))&&(v=Math.min(f(0,o),v))),o=-1,a=0;a<r;a++){for(p=0,l=w;p<l;)f(a,u+l)<=v?p=l:w=l,l=Math.floor((w-p)/2+p);for(w=l,d=Math.max(1,u-l+1),k=Math.min(u+l,tt)+r,(y=new Array(k+2))[k+1]=(1<<a)-1,e=k;d<=e;e--)if(g=h[t.charAt(e-1)],y[e]=0===a?(y[e+1]<<1|1)&g:(y[e+1]<<1|1)&g|(b[e+1]|b[e])<<1|1|b[e+1],y[e]&s&&(nt=f(a,e-1))<=v){if(v=nt,it.push(o=e-1),!(u<o))break;d=Math.max(1,2*u-o)}if(f(a+1,u)>v)break;b=y}return{isMatch:0<=o,score:nt}},!0===t?{search:e}:e(t)},b.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1},n.jstree.defaults.sort=function(n,t){return this.get_text(n)>this.get_text(t)?1:-1},k=!(n.jstree.plugins.sort=function(n,t){this.bind=function(){t.bind.call(this);this.element.on("model.jstree",function(n,t){this.sort(t.parent,!0)}.bind(this)).on("rename_node.jstree create_node.jstree",function(n,t){this.sort(t.parent||t.node.parent,!1);this.redraw_node(t.parent||t.node.parent,!0)}.bind(this)).on("move_node.jstree copy_node.jstree",function(n,t){this.sort(t.parent,!1);this.redraw_node(t.parent,!0)}.bind(this))};this.sort=function(n,t){var i,r;if((n=this.get_node(n))&&n.children&&n.children.length&&(n.children.sort(this.settings.sort.bind(this)),t))for(i=0,r=n.children_d.length;i<r;i++)this.sort(n.children_d[i],!1)}}),n.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},n.jstree.plugins.state=function(t,i){this.bind=function(){i.bind.call(this);var n=function(){this.element.on(this.settings.state.events,function(){k&&clearTimeout(k);k=setTimeout(function(){this.save_state()}.bind(this),100)}.bind(this));this.trigger("state_ready")}.bind(this);this.element.on("ready.jstree",function(){this.element.one("restore_state.jstree",n);this.restore_state()||n()}.bind(this))};this.save_state=function(){var t=this.get_state();this.settings.state.preserve_loaded||delete t.core.loaded;t={state:t,ttl:this.settings.state.ttl,sec:+new Date};n.vakata.storage.set(this.settings.state.key,JSON.stringify(t))};this.restore_state=function(){var t=n.vakata.storage.get(this.settings.state.key);if(t)try{t=JSON.parse(t)}catch(i){return!1}return!(t&&t.ttl&&t.sec&&+new Date-t.sec>t.ttl)&&!!(t=(t=t&&t.state?t.state:t)&&n.vakata.is_function(this.settings.state.filter)?this.settings.state.filter.call(this,t):t)&&(this.settings.state.preserve_loaded||delete t.core.loaded,this.element.one("set_state.jstree",function(i,r){r.instance.trigger("restore_state",{state:n.extend(!0,{},t)})}),this.set_state(t),!0)};this.clear_state=function(){return n.vakata.storage.del(this.settings.state.key)}},n.vakata.storage={set:function(n,t){return window.localStorage.setItem(n,t)},get:function(n){return window.localStorage.getItem(n)},del:function(n){return window.localStorage.removeItem(n)}},n.jstree.defaults.types={"default":{}},n.jstree.defaults.types[n.jstree.root]={},n.jstree.plugins.types=function(i,r){this.init=function(i,u){var f,e;if(u&&u.types&&u.types.default)for(f in u.types)if("default"!==f&&f!==n.jstree.root&&u.types.hasOwnProperty(f))for(e in u.types.default)u.types.default.hasOwnProperty(e)&&u.types[f][e]===t&&(u.types[f][e]=u.types.default[e]);r.init.call(this,i,u);this._model.data[n.jstree.root].type=n.jstree.root};this.refresh=function(t,i){r.refresh.call(this,t,i);this._model.data[n.jstree.root].type=n.jstree.root};this.bind=function(){this.element.on("model.jstree",function(i,r){for(var f=this._model.data,e=r.nodes,s=this.settings.types,o="default",h,u=0,c=e.length;u<c;u++){if(o="default",f[e[u]].original&&f[e[u]].original.type&&s[f[e[u]].original.type]&&(o=f[e[u]].original.type),f[e[u]].data&&f[e[u]].data.jstree&&f[e[u]].data.jstree.type&&s[f[e[u]].data.jstree.type]&&(o=f[e[u]].data.jstree.type),f[e[u]].type=o,!0===f[e[u]].icon&&s[o].icon!==t&&(f[e[u]].icon=s[o].icon),s[o].li_attr!==t&&"object"==typeof s[o].li_attr)for(h in s[o].li_attr)s[o].li_attr.hasOwnProperty(h)&&"id"!==h&&(f[e[u]].li_attr[h]===t?f[e[u]].li_attr[h]=s[o].li_attr[h]:"class"===h&&(f[e[u]].li_attr.class=s[o].li_attr.class+" "+f[e[u]].li_attr.class));if(s[o].a_attr!==t&&"object"==typeof s[o].a_attr)for(h in s[o].a_attr)s[o].a_attr.hasOwnProperty(h)&&"id"!==h&&(f[e[u]].a_attr[h]===t?f[e[u]].a_attr[h]=s[o].a_attr[h]:"href"===h&&"#"===f[e[u]].a_attr[h]?f[e[u]].a_attr.href=s[o].a_attr.href:"class"===h&&(f[e[u]].a_attr.class=s[o].a_attr.class+" "+f[e[u]].a_attr.class))}f[n.jstree.root].type=n.jstree.root}.bind(this));r.bind.call(this)};this.get_json=function(t,i,u){var e,s,o=this._model.data,h=i?n.extend(!0,{},i,{no_id:!1}):{},f=r.get_json.call(this,t,h,u);if(!1===f)return!1;if(n.vakata.is_array(f))for(e=0,s=f.length;e<s;e++)f[e].type=(f[e].id||0===f[e].id)&&o[f[e].id]&&o[f[e].id].type?o[f[e].id].type:"default",i&&i.no_id&&(delete f[e].id,f[e].li_attr&&f[e].li_attr.id&&delete f[e].li_attr.id,f[e].a_attr&&f[e].a_attr.id&&delete f[e].a_attr.id);else f.type=(f.id||0===f.id)&&o[f.id]&&o[f.id].type?o[f.id].type:"default",i&&i.no_id&&(f=this._delete_ids(f));return f};this._delete_ids=function(t){if(n.vakata.is_array(t)){for(var i=0,r=t.length;i<r;i++)t[i]=this._delete_ids(t[i]);return t}return delete t.id,t.li_attr&&t.li_attr.id&&delete t.li_attr.id,t.a_attr&&t.a_attr.id&&delete t.a_attr.id,t.children&&n.vakata.is_array(t.children)&&(t.children=this._delete_ids(t.children)),t};this.check=function(i,u,f,e,o){if(!1===r.check.call(this,i,u,f,e,o))return!1;u=u&&(u.id||0===u.id)?u:this.get_node(u);f=f&&(f.id||0===f.id)?f:this.get_node(f);var s,h,l,a,c=(c=u&&(u.id||0===u.id)?o&&o.origin?o.origin:n.jstree.reference(u.id):null)&&c._model&&c._model.data?c._model.data:null;switch(i){case"create_node":case"move_node":case"copy_node":if("move_node"!==i||-1===n.inArray(u.id,f.children)){if((s=this.get_rules(f)).max_children!==t&&-1!==s.max_children&&s.max_children===f.children.length)return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+i,data:JSON.stringify({chk:i,pos:e,obj:!(!u||!u.id&&0!==u.id)&&u.id,par:!(!f||!f.id&&0!==f.id)&&f.id})});if(s.valid_children!==t&&-1!==s.valid_children&&-1===n.inArray(u.type||"default",s.valid_children))return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+i,data:JSON.stringify({chk:i,pos:e,obj:!(!u||!u.id&&0!==u.id)&&u.id,par:!(!f||!f.id&&0!==f.id)&&f.id})});if(c&&u.children_d&&u.parents){for(l=h=0,a=u.children_d.length;l<a;l++)h=Math.max(h,c[u.children_d[l]].parents.length);h=h-u.parents.length+1}(h<=0||h===t)&&(h=1);do{if(s.max_depth!==t&&-1!==s.max_depth&&s.max_depth<h)return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+i,data:JSON.stringify({chk:i,pos:e,obj:!(!u||!u.id&&0!==u.id)&&u.id,par:!(!f||!f.id&&0!==f.id)&&f.id})});f=this.get_node(f.parent);s=this.get_rules(f);h++}while(f)}}return!0};this.get_rules=function(n){if(!(n=this.get_node(n)))return!1;var n=this.get_type(n,!0);return n.max_depth===t&&(n.max_depth=-1),n.max_children===t&&(n.max_children=-1),n.valid_children===t&&(n.valid_children=-1),n};this.get_type=function(t,i){return!!(t=this.get_node(t))&&(i?n.extend({type:t.type},this.settings.types[t.type]):t.type)};this.set_type=function(i,r){var o=this._model.data,f,c,a,e,l,u,h,s;if(n.vakata.is_array(i)){for(c=0,a=(i=i.slice()).length;c<a;c++)this.set_type(i[c],r);return!0}if(f=this.settings.types,i=this.get_node(i),!f[r]||!i)return!1;if((h=this.get_node(i,!0))&&h.length&&(s=h.children(".jstree-anchor")),e=i.type,l=this.get_icon(i),i.type=r,!0!==l&&f[e]&&(f[e].icon===t||l!==f[e].icon)||this.set_icon(i,f[r].icon===t||f[r].icon),f[e]&&f[e].li_attr!==t&&"object"==typeof f[e].li_attr)for(u in f[e].li_attr)f[e].li_attr.hasOwnProperty(u)&&"id"!==u&&("class"===u?(o[i.id].li_attr.class=(o[i.id].li_attr.class||"").replace(f[e].li_attr[u],""),h&&h.removeClass(f[e].li_attr[u])):o[i.id].li_attr[u]===f[e].li_attr[u]&&(o[i.id].li_attr[u]=null,h&&h.removeAttr(u)));if(f[e]&&f[e].a_attr!==t&&"object"==typeof f[e].a_attr)for(u in f[e].a_attr)f[e].a_attr.hasOwnProperty(u)&&"id"!==u&&("class"===u?(o[i.id].a_attr.class=(o[i.id].a_attr.class||"").replace(f[e].a_attr[u],""),s&&s.removeClass(f[e].a_attr[u])):o[i.id].a_attr[u]===f[e].a_attr[u]&&("href"===u?(o[i.id].a_attr[u]="#",s&&s.attr("href","#")):(delete o[i.id].a_attr[u],s&&s.removeAttr(u))));if(f[r].li_attr!==t&&"object"==typeof f[r].li_attr)for(u in f[r].li_attr)f[r].li_attr.hasOwnProperty(u)&&"id"!==u&&(o[i.id].li_attr[u]===t?(o[i.id].li_attr[u]=f[r].li_attr[u],h&&("class"===u?h.addClass(f[r].li_attr[u]):h.attr(u,f[r].li_attr[u]))):"class"===u&&(o[i.id].li_attr.class=f[r].li_attr[u]+" "+o[i.id].li_attr.class,h&&h.addClass(f[r].li_attr[u])));if(f[r].a_attr!==t&&"object"==typeof f[r].a_attr)for(u in f[r].a_attr)f[r].a_attr.hasOwnProperty(u)&&"id"!==u&&(o[i.id].a_attr[u]===t?(o[i.id].a_attr[u]=f[r].a_attr[u],s&&("class"===u?s.addClass(f[r].a_attr[u]):s.attr(u,f[r].a_attr[u]))):"href"===u&&"#"===o[i.id].a_attr[u]?(o[i.id].a_attr.href=f[r].a_attr.href,s&&s.attr("href",f[r].a_attr.href)):"class"===u&&(o[i.id].a_attr.class=f[r].a_attr.class+" "+o[i.id].a_attr.class,s&&s.addClass(f[r].a_attr[u])));return!0}},n.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(n,t){return n+" ("+t+")"}},n.jstree.plugins.unique=function(i,r){this.check=function(t,i,u,f,e){if(!1===r.check.call(this,t,i,u,f,e))return!1;if(i=i&&(i.id||0===i.id)?i:this.get_node(i),!(u=u&&(u.id||0===u.id)?u:this.get_node(u))||!u.children)return!0;for(var o="rename_node"===t?f:i.text,c=[],l=this.settings.unique.case_sensitive,a=this.settings.unique.trim_whitespace,v=this._model.data,s,h=0,y=u.children.length;h<y;h++)s=v[u.children[h]].text,l||(s=s.toLowerCase()),a&&(s=s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),c.push(s);switch(l||(o=o.toLowerCase()),a&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),t){case"delete_node":return!0;case"rename_node":return s=i.text||"",l||(s=s.toLowerCase()),a&&(s=s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),(h=-1===n.inArray(o,c)||i.text&&s===o)||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:f,obj:!(!i||!i.id&&0!==i.id)&&i.id,par:!(!u||!u.id&&0!==u.id)&&u.id})}),h;case"create_node":return(h=-1===n.inArray(o,c))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:f,obj:!(!i||!i.id&&0!==i.id)&&i.id,par:!(!u||!u.id&&0!==u.id)&&u.id})}),h;case"copy_node":return(h=-1===n.inArray(o,c))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:f,obj:!(!i||!i.id&&0!==i.id)&&i.id,par:!(!u||!u.id&&0!==u.id)&&u.id})}),h;
3case"move_node":return(h=i.parent===u.id&&(!e||!e.is_multi)||-1===n.inArray(o,c))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+o+" already exists. Preventing: "+t,data:JSON.stringify({chk:t,pos:f,obj:!(!i||!i.id&&0!==i.id)&&i.id,par:!(!u||!u.id&&0!==u.id)&&u.id})}),h}return!0};this.create_node=function(i,u,f,e,o){if(!u||"object"==typeof u&&u.text===t){if((null===i&&(i=n.jstree.root),!(i=this.get_node(i)))||!(f=f===t?"last":f).toString().match(/^(before|after)$/)&&!o&&!this.is_loaded(i))return r.create_node.call(this,i,u,f,e,o);u=u||{};for(var v,p=this._model.data,c=this.settings.unique.case_sensitive,l=this.settings.unique.trim_whitespace,w=this.settings.unique.duplicate,s,a=v=this.get_string("New node"),y=[],h=0,b=i.children.length;h<b;h++)s=p[i.children[h]].text,c||(s=s.toLowerCase()),l&&(s=s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),y.push(s);for(h=1,s=a,c||(s=s.toLowerCase()),l&&(s=s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==n.inArray(s,y);)s=a=w.call(this,v,++h).toString(),c||(s=s.toLowerCase()),l&&(s=s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));u.text=a}return r.create_node.call(this,i,u,f,e,o)}},v=e.createElement("DIV"),v.setAttribute("unselectable","on"),v.setAttribute("role","presentation"),v.className="jstree-wholerow",v.innerHTML="&#160;",n.jstree.plugins.wholerow=function(t,i){this.bind=function(){i.bind.call(this);this.element.on("ready.jstree set_state.jstree",function(){this.hide_dots()}.bind(this)).on("init.jstree loading.jstree ready.jstree",function(){this.get_container_ul().addClass("jstree-wholerow-ul")}.bind(this)).on("deselect_all.jstree",function(){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")}.bind(this)).on("changed.jstree",function(n,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");for(var i=!1,r=0,u=t.selected.length;r<u;r++)(i=this.get_node(t.selected[r],!0))&&i.length&&i.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")}.bind(this)).on("open_node.jstree",function(n,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")}.bind(this)).on("hover_node.jstree dehover_node.jstree",function(n,t){"hover_node"===n.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===n.type?"addClass":"removeClass"]("jstree-wholerow-hovered")}.bind(this)).on("contextmenu.jstree",".jstree-wholerow",function(t){var i;this._data.contextmenu&&(t.preventDefault(),i=n.Event("contextmenu",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey,pageX:t.pageX,pageY:t.pageY}),n(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i))}.bind(this)).on("click.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation();var i=n.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});n(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i).trigger("focus")}).on("dblclick.jstree",".jstree-wholerow",function(t){t.stopImmediatePropagation();var i=n.Event("dblclick",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});n(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i).trigger("focus")}).on("click.jstree",".jstree-leaf > .jstree-ocl",function(t){t.stopImmediatePropagation();var i=n.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});n(t.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(i).trigger("focus")}.bind(this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",function(n){return n.stopImmediatePropagation(),this.is_disabled(n.currentTarget)||this.hover_node(n.currentTarget),!1}.bind(this)).on("mouseleave.jstree",".jstree-node",function(n){this.dehover_node(n.currentTarget)}.bind(this))};this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove();i.teardown.call(this)};this.redraw_node=function(t){var r;return(t=i.redraw_node.apply(this,arguments))&&(r=v.cloneNode(!0),-1!==n.inArray(t.id,this._data.core.selected)&&(r.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===t.id&&(r.className+=" jstree-wholerow-hovered"),t.insertBefore(r,t.childNodes[0])),t}},window.customElements&&Object&&Object.create){a=Object.create(HTMLElement.prototype);a.createdCallback=function(){var i={core:{},plugins:[]};for(var t in n.jstree.plugins)n.jstree.plugins.hasOwnProperty(t)&&this.attributes[t]&&(i.plugins.push(t),this.getAttribute(t)&&JSON.parse(this.getAttribute(t))&&(i[t]=JSON.parse(this.getAttribute(t))));for(t in n.jstree.defaults.core)n.jstree.defaults.core.hasOwnProperty(t)&&this.attributes[t]&&(i.core[t]=JSON.parse(this.getAttribute(t))||this.getAttribute(t));n(this).jstree(i)};try{window.customElements.define("vakata-jstree",function(){},{prototype:a})}catch(a){}}}}),function(n){"use strict";typeof define=="function"&&define.amd?define("jstree.node_customize",["jquery","jstree"],n):typeof exports=="object"?n(require("jquery"),require("jstree")):n(jQuery,jQuery.jstree)}(function(n){"use strict";n.jstree.plugins.node_customize||(n.jstree.defaults.node_customize={key:"type","switch":{},"default":null},n.jstree.plugins.node_customize=function(n,t){this.redraw_node=function(n){var o=n,r=t.redraw_node.apply(this,arguments);if(r){var i=this._model.data[o],u=this.settings.node_customize,s=u.key,f=i&&i.original&&i.original[s],e=f&&u.switch[f]||u.default;e&&e(r,i)}return r}})});$.widget("max7.libraryContentsTree",{options:{libraryID:0,contents:null,editorClass:"",canMoveNodes:!0,customRender:null,restrictMovementToNode:!1},_create:function(){var i=this;
3if(this.options.libraryID&&this.options.contents){this._skipNodeMoveEventFor={};this.options.editorClass&&this.element.addClass(this.options.editorClass);var n=this,t=["wholerow"],r=null,u=null;this.options.canMoveNodes&&(t.push("dnd"),r={copy:!1,touch:!0,large_drag_target:!0,large_drop_target:!0});this.options.customRender&&(t.push("node_customize"),u={"default":this.options.customRender});this.element.jstree({core:{data:this.options.contents,themes:{dots:!1},multiple:!1,check_callback:function(t,r,u,f){if(t==="move_node"){if(n.options.restrictMovementToNode&&n.options.restrictMovementToNode!==libraryContentsTreeHelper.getNodeIdFromNodeObject(r))return!1;var e=libraryContentsTreeHelper.nodeIsFolder(r),o=libraryContentsTreeHelper.nodeIsResource(r);if(libraryContentsTreeHelper.nodeIsTreeRoot(u)&&(u=i.getNode(u.children[0]),f=u.children.length),(e||o)&&u&&(libraryContentsTreeHelper.nodeIsFolder(u)||libraryContentsTreeHelper.nodeIsLibrary(u)||libraryContentsTreeHelper.nodeIsTreeRoot(u))){if(!u.children||!u.children.length||!u.state.opened)return!0;if(e)return f?libraryContentsTreeHelper.nodeIsFolder(u.children[f-1])?!0:!1:!0;if(o)return f>=u.children.length?!0:libraryContentsTreeHelper.nodeIsResource(u.children[f])}return!1}return t==="delete_node"||t==="create_node"||t==="rename_node"}},plugins:t,dnd:r,node_customize:u}).on("select_node.jstree",function(t,i){(!i.selected||i.selected&&i.selected.length&&(typeof i.selected[0]=="string"||i.selected[0]instanceof String))&&n._trigger("nodeselected",null,{node:i.node||i.selected||null})}).on("deselect_node.jstree",function(t,i){!i.node||i.selected&&i.selected.length||n._trigger("nodedeselected",null,{node:i.node,selected:i.selected})}).on("move_node.jstree",function(t,i){if(i&&i.parent&&i.node&&i.node.id){var r=!0,u=libraryContentsTreeHelper.getNodeIdFromNodeObject(i.node),f=libraryContentsTreeHelper.getNodeIdFromNodeObject(i.parent);n._skipNodeMoveEventFor[u]&&(r=n._skipNodeMoveEventFor[u]!=f,delete n._skipNodeMoveEventFor[u]);r&&n._nodeMoved(i.node,i.parent,i.position,i.old_parent,i.old_position,r)}}).on("refresh.jstree",function(){i.selectNode("ul > li:first")})}},_nodeMoved:function(n,t,i,r,u){var y=libraryContentsTreeHelper.getNodeIdFromNodeObject(n),h=libraryContentsTreeHelper.getNodeIdFromNodeObject(t),b=libraryContentsTreeHelper.getNodeIdFromNodeObject(r),v=this.getNode(h),s,c,l,e,f,a,o,p,w;if(h=="#"&&(v=this.getLibraryNode(),t=v.id,h=t,i=v.children.length,this.moveNode(n,h,i,!1)),libraryContentsTreeHelper.nodeIsResource(y)&&(s=libraryContentsTreeHelper.getNodeChildren(v),c=s?s.length||0:0,c&&i<c-1&&libraryContentsTreeHelper.nodeIsFolder(s[i+1]))){for(l=null,e=null,f=0;f<c;f++)if(a=s[f],o=f+1<c?s[f+1]:null,libraryContentsTreeHelper.nodeIsResource(a)&&o&&!libraryContentsTreeHelper.nodeIsResource(o)?l=a:libraryContentsTreeHelper.nodeIsResource(a)&&o&&libraryContentsTreeHelper.nodeIsResource(o)?e=f:libraryContentsTreeHelper.nodeIsResource(a)&&!o?e=f:o||(e=f+1),l&&e!==null)break;l&&(this.moveNode(l,h,e,!1),i=e)}p=this;w=function(n){n&&p.moveNode(y,b,u,!1)};this._trigger("nodemoved",null,{node:n,parent:t,position:i,oldParent:r,oldPosition:u,onError:w})},_removeResourceChildren:function(n){var r=[],u,i,t;if(n.children&&n.children.length)for(u=n.children.length,i=0;i<u;i++)t=n.children[i],t.children&&(t.children=this._removeResourceChildren(t)),libraryContentsTreeHelper.nodeIsResource(t)||r.push(t);return r},updateTree:function(n){var t=typeof n.contents!="undefined";this.options.libraryID=typeof n.libraryID!="undefined"?n.libraryID:this.options.libraryID;this.options.editorClass=typeof n.editorClass!="undefined"?n.editorClass:this.options.editorClass;this.options.canMoveNodes=typeof n.canMoveNodes!="undefined"?n.canMoveNodes:this.options.canMoveNodes;this.options.restrictMovementToNode=typeof n.restrictMovementToNode!="undefined"?n.restrictMovementToNode:this.options.restrictMovementToNode;t&&(this.options.contents=n.contents,this.element.jstree(!0).settings.core.data=this.options.contents,this.element.jstree(!0).refresh())},getNode:function(n){return this.element.jstree("get_node",libraryContentsTreeHelper.getNodeIdFromNodeObject(n))},getLibraryNode:function(){return this.getNode(`L${this.options.library
3ID}`)},getActiveNode:function(){var n=this.element.jstree("get_selected");return n&&n.length?n[0]:null},getRootNodeObject:function(){var n=this.element.jstree("_get_children",!0);return n&&n.length?n[0]:null},getActiveNodeObject:function(){var n=this.element.jstree("get_selected",!0);return n&&n.length?n[0]:null},getActiveNodeText:function(){var n=this.element.jstree("get_selected");return n&&n.length?this.element.jstree("get_text",n[0]):null},toggleNode:function(n){this.element.jstree("toggle_node",n)},expandNode:function(n){this.element.jstree("open_node",n)},selectNode:function(n){this.element.jstree("select_node",n)},moveNode:function(n,t,i,r){r===!1&&(this._skipNodeMoveEventFor[libraryContentsTreeHelper.getNodeIdFromNodeObject(n)]=libraryContentsTreeHelper.getNodeIdFromNodeObject(t));this.element.jstree("move_node",n,t,i)},createNode:function(n,t){this.element.jstree("create_node",n,t)},deleteNode:function(n){this.element.jstree("delete_node",n)},updateNode:function(n,t,i){n&&(n=typeof n=="string"||n instanceof String?this.getNode(n):n,n&&n.id&&(n.data||(n.data={}),(t||libraryContentsTreeHelper.nodeIsResource(n.id))&&this.element.jstree("rename_node",n,t||n.data.resourceTitle||n.text),i!==undefined&&i!==null&&(n.data.description=max7app.htmlEncode(i))))},destroy:function(){this.element.data("jstree")&&this.element.jstree("destroy")}});libraryContentsTreeHelper={getNodeIdFromNodeObject:function(n){if(n){if(typeof n=="string"||n instanceof String)return n;if(n.id&&(typeof n.id=="string"||n.id instanceof String))return n.id}return""},nodeIsLibrary:function(n){return this.getNodeIdFromNodeObject(n)[0]==="L"||!1},nodeIsTreeRoot:function(n){return this.getNodeIdFromNodeObject(n)==="#"||!1},nodeIsFolder:function(n){return this.getNodeIdFromNodeObject(n)[0]==="F"||!1},nodeIsResource:function(n){return this.getNodeIdFromNodeObject(n)[0]==="R"||!1},getLibraryResourceDetailsFromNode:function(n){if(n&&this.nodeIsResource(n)&&n.indexOf(":")>0){var t=/^R-([FL]{1}\d+):(\S+)$/i.exec(n);if(t&&t.length&&t.length>2)return{resourceCode:t[2],folderId:t[1]}}return null},createResourceNode:function(n,t,i,r,u){return{id:"R-"+n+":"+t,text:i,state:{opened:!1,disabled:!1,selected:u},li_attr:{"class":"resourceNode"},data:{resourceType:r,uniqueCode:t}}},getNodeChildren:function(n){return n?n.children?n.children:this._getNode(n).children:null}};$.widget("max7.addtolibrarybutton",{options:{resourceUniqueCode:null,resourceId:null,resourceTitle:"My resource",resourceType:1,buttonStyle:1,placeholder:max7appdata.phrases.ADD_TO_LIBRARY,newLibraryText:max7appdata.phrases.ADD_TO_NEW_LIBRARY,newLibrarySelectedButtonText:max7appdata.phrases.CreateLibraryHeading,librarySelectedText:max7appdata.phrases.ADD_TO_X,libraries:[],loginReturnUrl:null,autopopulate:"",saveToDB:!1,change:null},_create:function(){var n=this;if(this._libraries=[],this._librariespopulated=!1,this._selectedLocation=null,this._buttonTextElement=null,this._resetPopupControls(),this._libraries=this.options.libraries||[],this.element.addClass("max7-addtolibrarybutton"),this.options.buttonStyle===2){this.element.addClass("block");this.element.addClass("ui-state-default");this.element.addClass("ui-corner-all");this.element.hover(function(){$(this).removeClass("ui-state-default");$(this).addClass("ui-state-hover")},function(){$(this).removeClass("ui-state-hover");$(this).addClass("ui-state-default")});this._buttonTextElement=$("<span/>",{"class":"ui-selectmenu-text"});this.element.html(this.options.buttonStyle===2?'<span class="ui-icon ui-icon-triangle-1-s"><\/span>':"");this.element.append(this._buttonTextElement);$(".ui-icon",this.element).on("click",function(t){n._selectedLocation!==null&&(n.clear(),t.stopPropagation())});this._updateText()}else this.element.addClass("basic");this.element.on("click",function(t){max7app.areInPlaceTranslationKeysPressed(t)||(t.stopPropagation(),t.preventDefault(),n.trigger())})},_showAddToLibraryUIScreen:function(){var n=this;!n._librariespopulated||n._libraries.length>0?(n._createScreenUI(),max7app.showModalScreen(n._popupControls.modalScreen),n._popupControls.filterInput.focus()):n._select({libraryId:null,parentFolderId:null,subFolders:null,title:null})},_showPreLoginScreen:function(){var n=this;n._createPreLoginInfoScreen();max7app.showModalScreen(n._popupControls.preLoginScreen)},_onChange:function(){this._trigger("change",null)},_onSaveComplete:function(){this._trigger("saveComplete",null)},_onOpen:function(){this._trigger("open",null)},hidePopupScreen:function(){var n=this;n._popupControls.modalScreen&&max7app.hideModalScreen(n._popupControls.modalScreen)},_setText:function(n){this._buttonTextElement&&this._buttonTextElement.html(n).prop("title",n)},_updateText:function(){this.options.buttonStyle===2&&(this._selectedLocation===null?(this._displayPlaceholder(),this.element.toggleClass("selected",!1)):(this.element.toggleClass("selected",!0),this._selectedLocation.library
3Id===null?this._setText(this.options.newLibrarySelectedButtonText):this._setText(max7app.displayText({text:this.options.librarySelectedText,parameters:{title:this._selectedLocation.title}}))))},_displayPlaceholder:function(){this._setText(this.options.placeholder)},clear:function(){this._selectedLocation=null;this._onChange();this._updateText()},_select:function(n){n==null?this.clear():this._selectedLocation=n},getSelectedLocation:function(){return this._selectedLocation},hasSelection:function(){return this._selectedLocation!==null},_acceptCurrentItem:function(){var n=this;this._selectedLocation?(this._onChange(),this._updateText(),this.options.saveToDB&&this._selectedLocation.libraryId&&this.options.resourceId&&(this._popupControls.autoErrorControl.html(""),this._popupControls.saveButton.prop("disabled",!0),max7app.getUserAdminKey({success:function(t){max7app.apiCall({connection:"cors",method:"editlibraries/AddResourceAndFolders",data:{library:n._selectedLocation.libraryId,userAdminKey:t,resource:n.options.resourceId,parentFolder:n._selectedLocation.parentFolderId||null,resourceFolder:n._selectedLocation.parentFolderId||null,newFolders:[],language:max7app.languageCode},success:function(t){n._popupControls.saveButton.prop("disabled",!1);t===0?(n.hidePopupScreen(),max7app.showPopupNotification(max7app.displayText({code:"X_ADDED_TO_Y",parameters:{subject:n.options.resourceTitle,object:n._selectedLocation.title}}),"information"),n._onSaveComplete()):n._popupControls.autoErrorControl.text(max7app.displayText("API_GENERIC_SERVER_ERROR"))},error:function(){n._popupControls.saveButton.prop("disabled",!1)},autoErrorHandler:{element:n._popupControls.autoErrorControl,showRetry:!0,showLoadingIcon:function(){}}})}})),this.hidePopupScreen()):this._pickNewLibrary()},_pickNewLibrary:function(){if(this._select({libraryId:null,parentFolderId:null,subFolders:null,title:null}),this._popupControls.saveButton.prop("disabled",!0),this._onChange(),this._updateText(),this.options.saveToDB){window.location.href=max7app.urlManager.getCreateLibraryUrl(this.options.resourceUniqueCode);return}this.hidePopupScreen()},_resetPopupControls:function(){this._treeDataLoaded=!1;this._popupControls={modalScreen:null,libraryListElement:null,popupDialog:null,libraryFolderSelectionIntro:null,libraryFolderSelectionIntroTextElement:null,libraryFolderSelectionElementContainer:null,libraryFolderSelectionElement:null,libraryFolderSelectionLoadingElement:null,libraryFolderSelectionErrorElement:null,buttonsContainer:null,autoErrorControl:null,saveButton:null,cancelButton:null}},_createPreLoginInfoScreen:function(){var n=this,t;n._popupControls.preLoginScreen=max7app.createModalScreen("AddResourceToLibraryPreLoginScreen","");$("<div/>",{text:max7app.displayText("ADD_TO_LIBRARY"),"class":"modal-screen-title"}).appendTo(n._popupControls.preLoginScreen);$("<div/>",{html:max7app.displayText("ADD_TO_LIBRARY_INTRO")}).appendTo(n._popupControls.preLoginScreen);t=$("<div/>",{"class":"modal-screen-buttons-container"}).appendTo(n._popupControls.preLoginScreen);$("<button/>",{"class":"modal-screen-submit-button",text:max7app.displayText("SIGN_IN_HEADING")}).appendTo(t).on("click",function(t){max7app.areInPlaceTranslationKeysPressed(t)||(t.preventDefault(),t.stopPropagation(),max7app.services.userManager.showLoginDialog(n.options.loginReturnUrl))})},_createScreenUI:function(){var n=this,u,f,i,r,t;n._resetPopupControls();this._popupControls.modalScreen=max7app.createModalScreen("AddResourceToLibraryScreen","");$("<div/>",{"class":"modal-screen-title",text:max7app.displayText("ADD_RESOURCE_TO_LIBRARY_TITLE")}).appendTo(this._popupControls.modalScreen);u=$("<div/>",{"class":"create-section"}).appendTo(this._popupControls.modalScreen);f=$("<div/>",{"class":"newLibraryContainer"}).appendTo(u);$("<button/>",{"class":"newLibraryButton modal-screen-submit-button",text:this.options.newLibraryText}).appendTo(f).on("click",function(t){max7app.areInPlaceTranslationKeysPressed(t)||(t.stopPropagation(),t.preventDefault(),n._pickNewLibrary())});$("<div/>",{"class":"source-divider",text:max7app.displayText("OR_CAPS_TEXT")}).appendTo(this._popupControls.modalScreen);i=$("<div/>",{"class":"existing-section"}).appendTo(this._popupControls.modalScreen);this._popupControls.existingLibrarySearchContainer=$("<div/>",{"class":"searchContainer"}).appendTo(i);$("<div/>",{"class":"searchIntro",text:max7app.displayText("ADDTOLIBRARY_SEARCH_PROMPT")}).appendTo(this._popupControls.existingLibrarySearchContainer);r=$("<div/>",{"class":"filterInputContainer"});n._popupControls.filterInput=$("<input/>",{type:"text","class":"filterInput",placeholder:max7app.displayText("FIND_PLACEHOLDER")}).appendTo(r);r.appendTo(this._popupControls.existingLibrarySearchContainer);this._popupControls.libraryListElement=$("<div class='libraryListContainer' />").appendTo(i).filterablelist({getSearchResults:null,getInitialSearchResults:function(n){max7app.getCommonDataList("editableuserlibraries",function(t){n(t)})},searchResultRenderer:max7app.collectioneditor.searchResultRenderers.getResourceRenderer({showAddButton:!1,showRating:!1,showPreviewButton:!1}),searchInput:n._popupControls.filterInput,actionButtonClick:function(t,i){n._selectLibrary(t,i)}});t=$("<div/>",{"class":"libraryFolderSelectionContainer"});this._popupControls.libraryFolderSelectionIntro=$("<div/>",{"class":"libraryFolderSelectionIntro"});$("<img/>",{"class":"image",src:"/images/libraries/welcome.png"}).appendTo(this._popupControls.libraryFolderSelectionIntro);this._popupControls.libraryFolderSelectionIntroTextElement=$("<div/>",{"class":"text",text:max7app.displayText("ADD_TO_LIBRARY_CREATE_OR_FIND_PROMPT")}).appendTo(this._popupControls.libraryFolderSelectionIntro);this._popupControls.libraryFolderSelectionIntro.appendTo(t);this._popupControls.libraryFolderSelectionErrorElement=$("<div/>",{"class":"folderSelectionError",style:"display: none;"}).appendTo(t);this._popupControls.libraryFolderSelectionLoadingElement=$("<div/>",{"class":"folderSelectionLoader loadingdiv",style:"display: none;"}).appendTo(t);this._popupControls.libraryFolderSelectionElementContainer=$("<div/>",{"class":"folderSelectionElementContainer"}).appendTo(t);this._popupControls.libraryFolderSelectionElement=$("<div/>",{"class":"folderSelection",style:"display: none; max-height: "+this._popupLibraryFolderSelectionElementMaxHeight}).appendTo(this._popupControls.libraryFolderSelectionElementContainer);t.appendTo(n._popupControls.modalScreen);this._popupControls.buttonsContainer=$("<div/>",{"class":"buttonsContainer"});
3this._popupControls.autoErrorControl=$("<div/>",{"class":"autoErrorControl"}).appendTo(this._popupControls.buttonsContainer);this._popupControls.cancelButton=$("<button/>",{"class":"cancelButton modal-screen-cancel-button",text:max7app.displayText("CancelText")}).appendTo(this._popupControls.buttonsContainer).on("click",function(t){max7app.areInPlaceTranslationKeysPressed(t)||(t.stopPropagation(),t.preventDefault(),n.hidePopupScreen())});this._popupControls.saveButton=$("<button/>",{"class":"modal-screen-submit-button saveButton",text:max7app.displayText("AddButtonText")}).prop("disabled",!0).appendTo(this._popupControls.buttonsContainer).on("click",function(t){max7app.areInPlaceTranslationKeysPressed(t)||(t.stopPropagation(),t.preventDefault(),n._acceptCurrentItem())});this._popupControls.buttonsContainer.appendTo(this._popupControls.modalScreen)},_toggleLibraryFolderSelectionSection:function(n){n===2?(this._popupControls.libraryFolderSelectionElement.hide(),this._popupControls.libraryFolderSelectionErrorElement.hide(),this._popupControls.libraryFolderSelectionLoadingElement.show()):n===3?(this._popupControls.libraryFolderSelectionLoadingElement.hide(),this._popupControls.libraryFolderSelectionElement.hide(),this._popupControls.libraryFolderSelectionErrorElement.show()):n===1?(this._popupControls.libraryFolderSelectionLoadingElement.hide(),this._popupControls.libraryFolderSelectionErrorElement.hide(),this._popupControls.libraryFolderSelectionElement.show()):(this._popupControls.libraryFolderSelectionLoadingElement.hide(),this._popupControls.libraryFolderSelectionErrorElement.hide(),this._popupControls.libraryFolderSelectionElement.hide())},_selectLibrary:function(n,t){this._select({libraryId:n.ID,parentFolderId:null,subFolders:null,title:n.Title});this._popupControls.saveButton.prop("disabled",!1);t&&t.length&&(t.hasClass("selected")||(this._deselectLibraries(!1),t.addClass("selected")));var i=this;this._toggleLibraryFolderSelectionSection(2);max7app.apiCall({connection:"local",method:"libraries/GetLibraryContentsListForContentsTree",parameters:{library:n.ID,person:max7app.person.ID,filter:max7app.filterCultureCode,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:max7app.filterCultureCode},success:function(n){if($(i._popupControls.modalScreen).addClass("library-selected"),n.Contents.children.length>0?i._popupControls.libraryFolderSelectionIntroTextElement.text(max7app.displayText("ADDTOLIBRARY_LIBRARY_WITH_FOLDERS_SELECTED")):i._popupControls.libraryFolderSelectionIntroTextElement.html(max7app.displayText("ADDTOLIBRARY_LIBRARY_WITH_1_FOLDER_SELECTED")),i._toggleLibraryFolderSelectionSection(1),i._treeDataLoaded)i._popupControls.libraryFolderSelectionElement.libraryContentsTree("updateTree",{libraryID:n.ID,contents:n.Contents,canMoveNodes:!1});else i._popupControls.libraryFolderSelectionElement.libraryContentsTree({libraryID:n.ID,contents:n.Contents,editorClass:"folderSelectionEditor",canMoveNodes:!1}).on("librarycontentstreenodeselected",function(n,t){if(i._selectedLocation&&t&&t.node&&t.node.id){var r=t.node.id;i._selectedLocation.parentFolderId=r[0]==="F"?r.substring(1):r[0]==="L"?null:r}});i._treeDataLoaded=!0},error:function(){i._toggleLibraryFolderSelectionSection(3)},autoErrorHandler:{element:this._popupControls.libraryFolderSelectionErrorElement,showRetry:!0,showLoadingIcon:function(){i._toggleLibraryFolderSelectionSection(2)}}})},_deselectLibraries:function(n){this._popupControls.libraryListElement.find(".resource.selected").removeClass("selected");n&&this._popupControls.libraryFolderSelectionIntroTextElement.text(max7appdata.phrases.ADD_TO_LIBRARY_CREATE_OR_FIND_PROMPT)},trigger:function(){var n=this;n._onOpen();max7app.person===null?n._showPreLoginScreen():n._showAddToLibraryUIScreen()}});$.widget("max7.changetriggertextbox",{_create:function(){var n=this;if(!$(n.element).is("input")&&!$(n.element).is("textarea"))throw"changetriggertextbox may only be applied to input or textarea elements";n._currentValue=$(n.element).val();$(n.element).on("keydown",function(t){n._checkUpdate(t)}).on("keyup",function(t){n._checkUpdate(t)}).on("blur",function(t){n._checkUpdate(t)})},_destroy:function(){var n=this;$(n.element).off("keydown").off("keyup").off("blur")},setValue:function(n){var t=this;t._currentValue=n;$(t.element).val(n)},_checkUpdate:function(){var n=this,t=$(n.element).val();t!=n._currentValue&&(n._currentValue=t,n._triggerUpdate())},_triggerUpdate:function(){var n=this;n._trigger("change",null,{text:$(n.element).val()})}});max7app.api.resources={setFavorite:function(n,t,i){max7app.apiCall({connection:"jsonp",method:"Resources/SetFavorite",parameters:{userentity:max7app.userEntityId,resource:n,isfavorite:t},success:function(n){i&&i.success&&i.success(n)},error:function(n){i&&i.error&&i.error(n)}})},recordView:function(n,t){max7app.apiCall({connection:"jsonp",method:"resources/recordview",parameters:{user:max7app.userEntityId,resource:n,platformID:max7app.platformId,max7Client:1,channel:max7app.channelGuid?max7app.channelGuid:"",language:max7app.languageCode},success:function(n){t&&t.success&&t.success(n)},error:function(n){t&&t.error&&t.error(n)}})},rate:function(n,t,i){max7app.apiCall({connection:"jsonp",method:"resources/Rate",parameters:{userentity:max7app.userEntityId,resource:n,score:t},success:function(n){i&&i.success&&i.success(n)},error:function(n){i&&i.error&&i.error(n)}})},getResourceOfTheDay:function(n){max7app.apiCall({connection:"jsonp",method:"Resources/GetResourceOfTheDay",parameters:{culturecode:max7app.filterCultureCode,context:max7app.channelGuid,languagecode:max7app.languageCode},success:function(t){n&&n.success&&n.success(t)},error:function(t){n&&n.error&&n.error(t)}})}};$.widget("max7.favoritebutton",{options:{resourceId:null,isFavorite:!1},_create:function(){var n=this;this._isFavorite=n.options.isFavorite;this._updateDisplay();$(this.element).addClass("resourceFavoriteButton").on("click",function(t){t.stopPropagation();max7app.areInPlaceTranslationKeysPressed(t)||(n._isFavorite=!n._isFavorite,max7app.setResourceFavorite(n.options.resourceId,n._isFavorite),n._updateDisplay())})},_updateDisplay:function(){$(this.element).toggleClass("isFavorite",this._isFavorite).attr("title",max7app.displayText(this._isFavorite?"IN_MY_FAVORITES_TEXT":"ADD_TO_MY_FAVORITES_TEXT"))}});typeof Object.create!="function"&&(Object.create=function(n){function t(){}return t.prototype=n,new t});NotyObject={init:function(n){return this.options=$.extend({},$.noty.defaults,n),this.options.layout=this.options.custom?$.noty.layouts.inline:$.noty.layouts[this.options.layout],$.noty.themes[this.options.theme]?this.options.theme=$.noty.themes[this.options.theme]:n.themeClassName=this.options.theme,delete n.layout,delete n.theme,this.options=$.extend({},this.options,this.options.layout.options),this.options.id="noty_"+(new Date).getTime()*Math.floor(Math.random()*1e6),this.options=$.extend({},this.options,n),this._build(),this},_build:function(){var n=$('<div class="noty_bar noty_type_'+this.options.type+'"><\/div>').attr("id",this.options.id),t,i;n.append(this.options.template).find(".noty_text").html(this.options.text);this.$bar=this.options.layout.parent.object!=null?$(this.options.layout.parent.object).css(this.options.layout.parent.css).append(n):n;this.options.themeClassName&&this.$bar.addClass(this.options.themeClassName).addClass("noty_container_type_"+this.options.type);this.options.buttons&&(this.options.closeWith=[],this.options.timeout=!1,t=$("<div/>").addClass("noty_buttons"),this.options.layout.parent.object!=null?this.$bar.find(".noty_bar").append(t):this.$bar.append(t),i=this,$.each(this.options.buttons,function(n,t){var r=$("<button/>").addClass(t.addClass?t.addClass:"gray").html(t.text).attr("id",t.id?t.id:"button-"+n).appendTo(i.$bar.find(".noty_buttons")).on("click",function(n){$.isFunction(t.onClick)&&t.onClick.call(r,i,n)})}));this.$message=this.$bar.find(".noty_message");this.$closeButton=this.$bar.find(".noty_close");this.$buttons=this.$bar.find(".noty_buttons");$.noty.store[this.options.id]=this},show:function(){var n=this;if(n.options.custom?n.options.custom.find(n.options.layout.container.selector).append(n.$bar):$(n.options.layout.container.selector).append(n.$bar),n.options.theme&&n.options.theme.style&&n.options.theme.style.apply(n),$.type(n.options.layout.css)==="function"?this.options.layout.css.apply(n.$bar):n.$bar.css(this.options.layout.css||{}),n.$bar.addClass(n.options.layout.addClass),n.options.layout.container.style.apply($(n.options.layout.container.selector)),n.showing=!0,n.options.theme&&n.options.theme.style&&n.options.theme.callback.onShow.apply(this),$.inArray("click",n.options.closeWith)>-1)n.$bar.css("cursor","pointer").one("click",function(t){n.stopPropagation(t);n.options.callback.onCloseClick&&n.options.callback.onCloseClick.apply(n);n.close()});if($.inArray("hover",n.options.closeWith)>-1)n.$bar.one("mouseenter",function(){n.close()});if($.inArray("button",n.options.closeWith)>-1)n.$closeButton.one("click",function(t){n.stopPropagation(t);n.close()});if($.inArray("button",n.options.closeWith)==-1&&n.$closeButton.remove(),n.options.callback.onShow&&n.options.callback.onShow.apply(n),typeof n.options.animation.open=="string"){n.$bar.css("height",n.$bar.innerHe
3ight());n.$bar.show().addClass(n.options.animation.open).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){n.options.callback.afterShow&&n.options.callback.afterShow.apply(n);n.showing=!1;n.shown=!0})}else n.$bar.animate(n.options.animation.open,n.options.animation.speed,n.options.animation.easing,function(){n.options.callback.afterShow&&n.options.callback.afterShow.apply(n);n.showing=!1;n.shown=!0});return n.options.timeout&&n.$bar.delay(n.options.timeout).promise().done(function(){n.close()}),this},close:function(){var n,t;if(!this.closed&&(!this.$bar||!this.$bar.hasClass("i-am-closing-now"))){if(n=this,this.showing){n.$bar.queue(function(){n.close.apply(n)});return}if(!this.shown&&!this.showing){t=[];$.each($.noty.queue,function(i,r){r.options.id!=n.options.id&&t.push(r)});$.noty.queue=t;return}if(n.$bar.addClass("i-am-closing-now"),n.options.callback.onClose&&n.options.callback.onClose.apply(n),typeof n.options.animation.close=="string")n.$bar.addClass(n.options.animation.close).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){n.options.callback.afterClose&&n.options.callback.afterClose.apply(n);n.closeCleanUp()});else n.$bar.clearQueue().stop().animate(n.options.animation.close,n.options.animation.speed,n.options.animation.easing,function(){n.options.callback.afterClose&&n.options.callback.afterClose.apply(n)}).promise().done(function(){n.closeCleanUp()})}},closeCleanUp:function(){var n=this;if(n.options.modal&&($.notyRenderer.setModalCount(-1),$.notyRenderer.getModalCount()==0&&$(".noty_modal").fadeOut("fast",function(){$(this).remove()})),$.notyRenderer.setLayoutCountFor(n,-1),$.notyRenderer.getLayoutCountFor(n)==0&&$(n.options.layout.container.selector).remove(),typeof n.$bar!="undefined"&&n.$bar!=null)if(typeof n.options.animation.close=="string"){n.$bar.css("transition","all 100ms ease").css("border",0).css("margin",0).height(0);n.$bar.one("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){n.$bar.remove();n.$bar=null;n.closed=!0;n.options.theme.callback&&n.options.theme.callback.onClose&&n.options.theme.callback.onClose.apply(n)})}else n.$bar.remove(),n.$bar=null,n.closed=!0;delete $.noty.store[n.options.id];n.options.theme.callback&&n.options.theme.callback.onClose&&n.options.theme.callback.onClose.apply(n);n.options.dismissQueue||($.noty.ontap=!0,$.notyRenderer.render());n.options.maxVisible>0&&n.options.dismissQueue&&$.notyRenderer.render()},setText:function(n){return this.closed||(this.options.text=n,this.$bar.find(".noty_text").html(n)),this},setType:function(n){return this.closed||(this.options.type=n,this.options.theme.style.apply(this),this.options.theme.callback.onShow.apply(this)),this},setTimeout:function(n){if(!this.closed){var t=this;this.options.timeout=n;t.$bar.delay(t.options.timeout).promise().done(function(){t.close()})}return this},stopPropagation:function(n){n=n||window.event;typeof n.stopPropagation!="undefined"?n.stopPropagation():n.cancelBubble=!0},closed:!1,showing:!1,shown:!1};$.notyRenderer={};$.notyRenderer.init=function(n){var t=Object.create(NotyObject).init(n);return t.options.killer&&$.noty.closeAll(),t.options.force?$.noty.queue.unshift(t):$.noty.queue.push(t),$.notyRenderer.render(),$.noty.returns=="object"?t:t.options.id};$.notyRenderer.render=function(){var n=$.noty.queue[0];$.type(n)==="object"?n.options.dismissQueue?n.options.maxVisible>0?$(n.options.layout.container.selector+" li").length<n.options.maxVisible&&$.notyRenderer.show($.noty.queue.shift()):$.notyRenderer.show($.noty.queue.shift()):$.noty.ontap&&($.notyRenderer.show($.noty.queue.shift()),$.noty.ontap=!1):$.noty.ontap=!0};$.notyRenderer.show=function(n){n.options.modal&&($.notyRenderer.createModalFor(n),$.notyRenderer.setModalCount(1));n.options.custom?n.options.custom.find(n.options.layout.container.selector).length==0?n.options.custom.append($(n.options.layout.container.object).addClass("i-am-new")):n.options.custom.find(n.options.layout.container.selector).removeClass("i-am-new"):$(n.options.layout.container.selector).length==0?$("body").append($(n.options.layout.container.object).addClass("i-am-new")):$(n.options.layout.container.selector).removeClass("i-am-new");$.notyRenderer.setLayoutCountFor(n,1);n.show()};
3$.notyRenderer.createModalFor=function(n){if($(".noty_modal").length==0){var t=$("<div/>").addClass("noty_modal").addClass(n.options.theme).data("noty_modal_count",0);if(n.options.theme.modal&&n.options.theme.modal.css&&t.css(n.options.theme.modal.css),t.prependTo($("body")).fadeIn("fast"),$.inArray("backdrop",n.options.closeWith)>-1)t.on("click",function(){$.noty.closeAll()})}};$.notyRenderer.getLayoutCountFor=function(n){return $(n.options.layout.container.selector).data("noty_layout_count")||0};$.notyRenderer.setLayoutCountFor=function(n,t){return $(n.options.layout.container.selector).data("noty_layout_count",$.notyRenderer.getLayoutCountFor(n)+t)};$.notyRenderer.getModalCount=function(){return $(".noty_modal").data("noty_modal_count")||0};$.notyRenderer.setModalCount=function(n){return $(".noty_modal").data("noty_modal_count",$.notyRenderer.getModalCount()+n)};$.fn.noty=function(n){return n.custom=$(this),$.notyRenderer.init(n)};$.noty={};$.noty.queue=[];$.noty.ontap=!0;$.noty.layouts={};$.noty.themes={};$.noty.returns="object";$.noty.store={};$.noty.get=function(n){return $.noty.store.hasOwnProperty(n)?$.noty.store[n]:!1};$.noty.close=function(n){return $.noty.get(n)?$.noty.get(n).close():!1};$.noty.setText=function(n,t){return $.noty.get(n)?$.noty.get(n).setText(t):!1};$.noty.setType=function(n,t){return $.noty.get(n)?$.noty.get(n).setType(t):!1};$.noty.clearQueue=function(){$.noty.queue=[]};$.noty.closeAll=function(){$.noty.clearQueue();$.each($.noty.store,function(n,t){t.close()})};windowAlert=window.alert;$.noty.consumeAlert=function(n){window.alert=function(t){n?n.text=t:n={text:t};$.notyRenderer.init(n)}};$.noty.stopConsumeAlert=function(){window.alert=windowAlert};$.noty.defaults={layout:"top",theme:"defaultTheme",type:"alert",text:"",dismissQueue:!0,template:'<div class="noty_message"><span class="noty_text"><\/span><div class="noty_close"><\/div><\/div>',animation:{open:{height:"toggle"},close:{height:"toggle"},easing:"swing",speed:500},timeout:!1,force:!1,modal:!1,maxVisible:5,killer:!1,closeWith:["click"],callback:{onShow:function(){},afterShow:function(){},onClose:function(){},afterClose:function(){},onCloseClick:function(){}},buttons:!1};$(window).on("resize",function(){$.each($.noty.layouts,function(n,t){t.container.style.apply($(t.container.selector))})});window.noty=function(n){return $.notyRenderer.init(n)};$.noty.layouts.topRight={name:"topRight",options:{},container:{object:'<ul id="noty_topRight_layout_container" />',selector:"ul#noty_topRight_layout_container",style:function(){$(this).css({top:20,right:20,position:"fixed",width:"310px",height:"auto",margin:0,padding:0,listStyleType:"none",zIndex:1e7});window.innerWidth<600&&$(this).css({right:5})}},parent:{object:"<li />",selector:"li",css:{}},css:{display:"none",width:"310px"},addClass:""};$.noty.themes.max7={name:"max7",helpers:{borderFix:function(){if(this.options.dismissQueue){var n=this.options.layout.container.selector+" "+this.options.layout.parent.selector;switch(this.options.layout.name){case"top":$(n).css({borderRadius:"0px 0px 0px 0px"});
3$(n).last().css({borderRadius:"0px 0px 5px 5px"});break;case"topCenter":case"topLeft":case"topRight":case"bottomCenter":case"bottomLeft":case"bottomRight":case"center":case"centerLeft":case"centerRight":case"inline":$(n).css({borderRadius:"0px 0px 0px 0px"});$(n).first().css({"border-top-left-radius":"5px","border-top-right-radius":"5px"});$(n).last().css({"border-bottom-left-radius":"5px","border-bottom-right-radius":"5px"});break;case"bottom":$(n).css({borderRadius:"0px 0px 0px 0px"});$(n).first().css({borderRadius:"5px 5px 0px 0px"})}}}},modal:{css:{position:"fixed",width:"100%",height:"100%",backgroundColor:"#000",zIndex:1e4,opacity:.6,display:"none",left:0,top:0}},style:function(){this.$bar.css({overflow:"hidden"});this.$message.css({fontSize:"13px",lineHeight:"16px",textAlign:"center",padding:"8px 10px 9px",width:"auto",position:"relative"});this.$closeButton.css({position:"absolute",top:4,right:4,width:10,height:10,background:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAAxUlEQVR4AR3MPUoDURSA0e++uSkkOxC3IAOWNtaCIDaChfgXBMEZbQRByxCwk+BasgQRZLSYoLgDQbARxry8nyumPcVRKDfd0Aa8AsgDv1zp6pYd5jWOwhvebRTbzNNEw5BSsIpsj/kurQBnmk7sIFcCF5yyZPDRG6trQhujXYosaFoc+2f1MJ89uc76IND6F9BvlXUdpb6xwD2+4q3me3bysiHvtLYrUJto7PD/ve7LNHxSg/woN2kSz4txasBdhyiz3ugPGetTjm3XRokAAAAASUVORK5CYII=)",display:"none",cursor:"pointer"});this.$buttons.css({padding:5,textAlign:"right",borderTop:"1px solid #ccc",backgroundColor:"#fff"});this.$buttons.find("button").css({marginLeft:5});this.$buttons.find("button:first").css({marginLeft:0});this.$bar.on({mouseenter:function(){$(this).find(".noty_close").stop().fadeTo("normal",1)},mouseleave:function(){$(this).find(".noty_close").stop().fadeTo("normal",0)}});switch(this.options.layout.name){case"top":this.$bar.css({borderRadius:"0px 0px 5px 5px",borderBottom:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"});break;case"topCenter":case"center":case"bottomCenter":case"inline":this.$bar.css({borderRadius:"5px",border:"1px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"});this.$message.css({fontSize:"13px",textAlign:"center"});break;case"topLeft":case"topRight":case"bottomLeft":case"bottomRight":case"centerLeft":case"centerRight":this.$bar.css({borderRadius:"5px",border:"1px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"});this.$message.css({fontSize:"13px",textAlign:"left"});break;case"bottom":this.$bar.css({borderRadius:"5px 5px 0px 0px",borderTop:"2px solid #eee",borderLeft:"2px solid #eee",borderRight:"2px solid #eee",boxShadow:"0 -2px 4px rgba(0, 0, 0, 0.1)"});break;default:this.$bar.css({border:"2px solid #eee",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"})}switch(this.options.type){case"alert":case"notification":this.$bar.css({backgroundColor:"#FFF",borderColor:"#CCC",color:"#444"});break;case"warning":this.$bar.css({backgroundColor:"#FFEAA8",borderColor:"#FFC237",color:"#826200"});this.$buttons.css({borderTop:"1px solid #FFC237"});break;case"error":this.$bar.css({backgroundColor:"red",borderColor:"darkred",color:"#FFF"});this.$message.css({fontWeight:"bold"});this.$buttons.css({borderTop:"1px solid darkred"});break;case"information":this.$bar.css({backgroundColor:"#57B7E2",borderColor:"#0B90C4",color:"#FFF"});this.$buttons.css({borderTop:"1px solid #0B90C4"});break;case"success":this.$bar.css({backgroundColor:"#74b643",borderColor:"#50C24E",color:"white"});this.$buttons.css({borderTop:"1px /solid #50C24E"});break;default:this.$bar.css({backgroundColor:"#FFF",borderColor:"#CCC",color:"#444"})}},callback:{onShow:function(){$.noty.themes.max7.helpers.borderFix.apply(this)},onClose:function(){$.noty.themes.max7.helpers.borderFix.apply(this)}}};max7app.api.libraries={getContent:function(n,t,i,r,u){max7app.apiCall({connection:"local",method:"LibraryExplorer/GetLibraryContent",parameters:{libraryid:n,user:max7app.userEntityId,context:t,culture:i,language:max7app.languageCode,altlanguage:r},success:function(n){u&&u.success&&u.success(n)},error:function(n){u&&u.error&&u.error(n)}})},getFolderContent:function(n,t,i,r){max7app.apiCall({connection:"local",method:"LibraryExplorer/getfoldercontent",parameters:{folder:n,user:max7app.userEntityId,language:max7app.languageCode,altlanguage:i,culture:t,context:max7app.channelGuid},success:function(n){r&&r.success&&r.success(n)},error:function(n){r&&r.error&&r.error(n)}})},getTreeNodes:function(n,t,i,r,u,f,e,o){max7app.apiCall({connection:"json",method:"LibraryExplorer/gettreenodes",parameters:{parent:encodeURIComponent(n),userentity:max7app.userEntityId,currentLibrary:t,currentFolder:i,layoutMode:r,includeResources:u,culture:f,context:max7app.channelGuid,language:max7app.languageCode,altLanguage:e},success:function(n){o&&o.success&&o.success(n)},error:function(n){o&&o.error&&o.error(n)}})}};max7app.api.wiki={toHtml:function(n,t){max7app.apiCall({connection:"local",method:"Wiki/ToHtml",parameters:{text:n},success:function(n){t&&t.success&&t.success(n)},error:function(n){t&&t.error&&t.error(n)}})}};max7app.api.subscriptions={activateSubscription:function(n,t,i,r,u,f,e,o){max7app.apiCall({connection:"local",requestType:"POST",method:"subscriptions/add",data:{user:n||max7app.userEntityId,subscriptionType:t,additionalId:i,owningChannel:max7app.channelId,sourceLanguage:r,displayLanguage:u||max7app.languageCode,emailOverride:f,addingUser:max7app.userEntityId,addMethod:e},success:function(n){switch(n){case 0:f&&(max7app.userSubscriptionEmail=f);switch(t){case SUBSCRIPTIONTYPE_MAX7NEWS:max7app.userIsSubscribedToCh
3annelNewsletter=!0;break;case SUBSCRIPTIONTYPE_LIBRARYCONTENT:i===max7app.channelId&&(max7app.userIsSubscribedToCurrentChannel=!0);break;case SUBSCRIPTIONTYPE_MAX7CONTENT:max7app.channelId==0&&(max7app.userIsSubscribedToCurrentChannel=!0)}o&&o.success&&o.success(n);break;default:o&&o.error&&o.error({resultCode:n})}},error:function(n){o&&o.error&&o.error(n)}})},deactivateSubscription:function(n,t,i,r,u,f){max7app.apiCall({connection:"cors",method:"subscriptions/remove",data:{user:n||max7app.userEntityId,subscriptionType:t,additionalId:i,owningChannel:max7app.channelId,sourceLanguage:r,removingUser:max7app.userEntityId,removeMethod:u},success:function(n){f&&f.success&&f.success(n)},error:function(n){f&&f.error&&f.error(n)}})},getLibrarySubscriptionSummaryRows:function(n,t,i){return new Promise((r,u)=>{max7app.apiCall({method:"subscriptions/GetLibrarySubscriptionSummaryRows",parameters:{rows:n,userFilter:t,libraryFilter:i,language:max7app.languageCode},success:function(n){r(n)},error:function(n){u(n)}})})},getNewsletterLanguages:function(n){max7app.apiCall({method:"subscriptions/GetNewsletterLanguages",parameters:{language:max7app.languageCode},success:function(t){n&&n.success&&n.success(t)},error:function(t){n&&n.error&&n.error(t)}})},getNewsletterSummary:function(n){max7app.getUserAdminKey({success:function(t){max7app.apiCall({method:"subscriptions/GetNewsletterSummary",parameters:{userAdminKey:t},success:function(t){n&&n.success&&n.success(t)},error:function(t){n&&n.error&&n.error(t)}})}})},abortSendout:function(n,t){max7app.getUserAdminKey({success:function(i){max7app.apiCall({method:"subscriptions/AbortSendout",connection:"cors",data:{newsletter:n,userAdminKey:i},success:function(n){t&&t.success&&t.success(n)},error:function(n){t&&t.error&&t.error(n)}})}})},getUserEntityList:function(n,t,i){max7app.apiCall({clientstate:t,method:"subscriptions/getuserentitylist",parameters:{textfilter:n},success:function(n,t){i&&i.success&&i.success(n,t)},error:function(n,t){i&&i.error&&i.error(n,t)}})},getUserEntityData:function(n,t){max7app.apiCall({method:"subscriptions/getobject",parameters:{id:n,language:max7app.languageCode},success:function(n){t&&t.success&&t.success(n)},error:function(){t&&t.error&&t.error()}})},updateUserEntityEmail:function(n,t,i,r){max7app.getUserAdminKey({success:function(u){max7app.apiCall({method:"subscriptions/UpdateUserEntityEmail",connection:"cors",data:{id:n,email:t,updatePerson:i,userAdminKey:u},success:function(n){r&&r.success&&r.success(n)},error:function(){r&&r.error&&r.error()}})}})}}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.