var __awaiter,__generator,viewModels,__extends,Bnet;(function(n){var t,i;(function(n){n[n.scrollinmodal=0]="scrollinmodal";n[n.scrolloutsidemodal=1]="scrolloutsidemodal"})(t=n.ModalOverflowTypes||(n.ModalOverflowTypes={}));i=function(){function i(i,r){this.modalId=i;this.content=r;this.closed=!1;this.includeCloseButton=!0;this.preventBodyScroll=!0;this.escKeyClosesModal=!0;this.modalParentSelector="body";this.overflowType=t.scrollinmodal;this.extraModalClass=[];this.beforeOpenCallback=function(){};this.afterOpenCallback=function(){};this.beforeCloseCallback=function(){};this.afterCloseCallback=function(){};this.isInitialized=!1;this.transitionDuration=0;this.modalOpenHtmlClass="modal-open";this.eventBinder=new n.EventBinder("modal-"+i)}return Object.defineProperty(i.prototype,"modalElement",{get:function(){return this.$modal},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"modalContentElement",{get:function(){return this.$modal.find(".modal-content")},enumerable:!0,configurable:!0}),i.prototype.initialize=function(){this.buildModal();this.populateContent(this.content);this.onModalCreated();this.isInitialized=!0},i.prototype.onModalCreated=function(){},i.prototype.addListeners=function(){var n=this;this.eventBinder.for(this.$modalContainer).on("click",function(t){var i=$(t.target);i.closest(".modal").length||n.close()});this.eventBinder.for(this.$modal.find(".button-close")).on("click",function(){n.close()});if(this.overflowType===t.scrollinmodal)this.eventBinder.for(this.$modal.find(".modal-content")).on("touchmove",function(t){n.preventTouchOverscroll(t)});this.eventBinder.for($(document)).on("keydown",function(t){n.onKeyDown(t.which)})},i.prototype.open=function(){var n=this;this.isInitialized||this.initialize();this.beforeOpenCallback();$(this.modalParentSelector).append(this.$modalContainer);this.setHtmlClass(!0);this.preventBodyScroll&&this.stopBodyFromScrolling();setTimeout(function(){n.$modalContainer.addClass("open")},1e3/60);setTimeout(function(){n.afterOpenCallback()},this.transitionDuration);this.addListeners()},i.prototype.close=function(){var t=this;if(!this.closed){if(this.closed=!0,this.$modalContainer.length===0)throw"Modal has not been initialized!";this.determineTransitionDuration();this.beforeCloseCallback();this.$modalContainer.removeClass("open");this.setHtmlClass(!1);setTimeout(function(){t.$modalContainer.remove();t.afterCloseCallback()},this.transitionDuration);this.eventBinder.destroy();this.stopLoading();setTimeout(function(){return n.Utilities.Modals.unlockBodyScroll()},250)}},i.prototype.populateContent=function(n){var t,i;n instanceof jQuery?(i=n,i.is("script[type='text/html']")?(t=i.html(),this.content=$(t)):this.content=i):(t=$.trim(n),t.charAt(0)!=="<"&&(t="<div>"+t+"<\/div>"),this.content=$(t));this.$modal&&this.$modal.find(".modal-content").html(this.content)},i.prototype.addHtmlAfterContent=function(t){var i=typeof t=="string"?t:n.Utilities.Html.getOuterHtml(t),r=this.$modalContainer.find(".modal-after-content");r.html(i)},i.prototype.buildModal=function(){var n=this.includeCloseButton?'<div class="button-close"><i class="material-icons">close<\/i><\/div>':"",i=this.overflowType===t.scrollinmodal?n:"",r=this.overflowType===t.scrolloutsidemodal?n:"",u='\n\t\t\t\t<div class="modal-container flex '+this.overflowType+" "+this.extraModalClass.join(" ")+'" id="modal-'+this.modalId+'" data-overflowtype="'+t[this.overflowType]+'">\n\t\t\t\t\t'+r+'\n\t\t\t\t\t<div class="modal">\n\t\t\t\t\t\t'+i+'\n\t\t\t\t\t\t<div class="modal-content"><\/div>\n\t\t\t\t\t\t<div class="modal-after-content"><\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t';this.$modalContainer=$(u);this.$modal=this.$modalContainer.find(".modal")},i.prototype.setHtmlClass=function(n){var t=this;n?$("html").addClass(this.modalOpenHtmlClass):setTimeout(function(){$("html").removeClass(t.modalOpenHtmlClass)},this.transitionDuration/2)},i.prototype.onKeyDown=function(n){n===27&&this.escKeyClosesModal&&this.close()},i.prototype.determineTransitionDuration=function(){var i=this.$modal.css("transition-duration"),t=i.match(/[0-9\.]+/g),n;t&&(n=0,t.map(function(t){var i=parseFloat(t);n=i>n?i:n}),this.transitionDuration=n*1e3)},i.prototype.stopBodyFromScrolling=function(){$("#modal-open-scrollbar-offset").length||n.Utilities.Modals.lockBodyScroll()},i.prototype.preventTouchOverscroll=function(n){var t=n.currentTarget;t.scrollTop===0?t.scrollTop=1:t.scrollHeight===t.scrollTop+t.offsetHeight&&(t.scrollTop-=1);t.offsetHeight===t.scrollHeight&&n.preventDefault()},i.prototype.startLoading=function(n){n===void 0&&(n=this.modalElement);this.$loadingElement=n;n.destinyLoader({startOnInit:!0,background:!1})},i.prototype.stopLoading=function(){this.$loadingElement?this.$loadingElement.destinyLoader("stop"):n.log("No $loadingElement found")},i}();n.Modal=i})(Bnet||(Bnet={})),function(n){var t;(function(t){function u(t,i,r,u,f){try{if(typeof f!="undefined"&&f!=null){var e=window.location.pathname,o=f.stack;n.trackEvent("Errors",e,o)}ServerVars.ShowErrorsInPage&&$("body").addClass("has-js-error")}catch(s){}}var i,r;(function(n){n[n.GoogleAnalytics=0]="GoogleAnalytics"})(i||(i={}));r=function(){function t(){}return t.prototype.userHasCookieConsent=function(){return typeof n.Utilities.User!="undefined"?n.Utilities.User.ConsentCookieIsEnabled()&&n.Utilities.User.CookieConsentIsCurrent():!1},t.prototype.loadTrackers=function(){},t.prototype.trackSession=function(){var i=n.Site.getPageData("SiteTagging"),r,t;if(i.SessionTracking)if(r=i.SessionTimeoutSeconds||1800,t=n.Utilities.SessionStorage.getItem("Session"),t){var e=moment(),u=JSON.parse(t),f={sessionId:u.sessionId,refreshDate:moment(u.refreshDate)};f.refreshDate.isBefore(e.add(r*-1,"seconds"))?this.createOrUpdateSession():this.createOrUpdateSession(f.sessionId)}else this.createOrUpdateSession()},t.prototype.createOrUpdateSession=function(t){var i={sessionId:t||n.Utilities.String.GenerateGuid(),refreshDate:moment()};n.Utilities.SessionStorage.setItem("Session",JSON.stringify(i))},t.Instance=new t,t}();t.BnetTracking=r;t.onError=u;window.onerror=function(t,i,r,u,f){try{n.Analytics.onError(t,i,r,u,f)}catch(e){}}})(t=n.Analytics||(n.Analytics={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){}return t.prototype.initialize=function(){this.consentValidity=n.Utilities.User.CookieConsentValidity();this.consentValidity!==n.Utilities.CookieConsentValidity.Current&&this.renderMessage()},t.prototype.renderMessage=function(){var i="#cookie-consent-template";this.consentValidity===n.Utilities.CookieConsentValidity.Expired&&(i="#cookie-consent-update-template");var r=$(i).html(),t=$(r);$("body").append(t);setTimeout(function(){return t.addClass("on")},100);$(".js-accept-button",t).on("click",function(){n.Utilities.User.SetConsentCookie();t.remove()})},t.Instance=new t,t}();t.CookieConsent=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){}return t.prototype.initialize=function(){var t=this;if(n.Utilities.User.isAuthenticated)return Promise.all([this.getPermissions(),this.getEmailValidationStatus(),this.getLocalStorageAlertVisibility()]).then(function(){t.isNotChild&&!t.emailIsVerified&&t.localStorageAllows&&t.renderAlert()})},t.prototype.addListeners=function(){var t=this;$(document).on("click",".globalAlertsBar.validate-email",function(){n.Site.PageController.Instance.redirect("7/"+Localizer.CurrentCultureName+"/User/Account/EmailSms")});$(document).on("click",".js-remove-email-bar",function(n){n.preventDefault();n.stopImmediatePropagation();t.removeBar();t.updateLocalStorageAlertVisibility(!1)})},t.prototype.getEmailValidationStatus=function(){var n=this;return bungieNetPlatform.userService.GetCurrentUserPromise().then(function(t){n.userDetail=t;n.emailIsVerified=t.emailStatus===9})},t.prototype.getPermissions=function(){var n=this;return bungieNetPlatform.companionpermissionService.GetPermission(Globals.CompanionPermission.NotAChild,function(t){n.isNotChild=t},function(){})},t.prototype.getLocalStorageAlertVisibility=function(){return n.Utilities.LocalStorage.getItem("show-email-validation-alert")?this.localStorageAllows=n.Utilities.LocalStorage.getItem("show-email-validation-alert")==="true":(n.Utilities.LocalStorage.setItem("show-email-validation-alert","true"),this.localStorageAllows=!0),Promise.resolve()},t.prototype.updateLocalStorageAlertVisibility=function(t){this.localStorageAllows=t;n.Utilities.LocalStorage.setItem("show-email-validation-alert",t.toString())},t.prototype.renderAlert=function(){var u=$("#alert-validateemail"),n,t,i,r;u.length===0||$("body").hasClass("HasPCMigrationAlert")||(n=$($("#alert-validateemail").html()),n.find("span").text(Localizer.Emails.VerifyYourEmail),t=$(".mainGlobalAlert"),t.length?($(n).insertBefore(t),$("body").addClass("HasTwoGlobalAlerts HasPCMigrationAlert")):($("body").addClass("HasPCMigrationAlert"),i=$("#explore-container"),r=$("#mainContent"),i.length?i.before(n):r.prepend(n)),this.addListeners())},t.prototype.removeBar=function(){$(".js-validate-email-global-alert").remove();$("body").removeClass("HasTwoGlobalAlerts HasPCMigrationAlert")},t.Instance=new t,t}();t.EmailValidationBar=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){this.eventName="fireteamUpdated"}return t.prototype.initialize=function(){this.addEventMuxSubscription();this.addEventListeners()},t.prototype.addEventMuxSubscription=function(){var t=this;n.EventMux.subscribe({eventType:Globals.RealTimeEventType.ClanFireteamUpdate,onUpdate:function(n){console.log(n);var i={fireteamUpdate:{isRemoved:n.update.isRemoved,membershipId:n.update.targetMembershipId,fireteamId:n.update.fireteamId,groupId:n.update.groupId}};$(document).trigger(t.eventName,i)}})},t.prototype.addEventListeners=function(){$(document).on(this.eventName,function(t,i){var r=i.fireteamUpdate;bungieNetPlatform.fireteamService.GetClanFireteam(r.groupId.toString(),r.fireteamId.toString(),function(t){var i=new n.ToastMessages.Client;i.show(n.ToastMessages.ToastMessageType.Info,Localizer.Format(Localizer.Clans.ahreflinkfireteamtitle,{link:"/"+Localizer.CurrentCultureName+"/ClanV2/Fireteam?groupId="+t.Summary.groupId+"&fireteamId="+t.Summary.fireteamId,title:t.Summary.title,action:r.isRemoved?Localizer.Clans.left:Localizer.Clans.joined}))},function(){})})},t}();t.FireteamUpdate=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){this.$footer=$("footer");this.initialize()}return t.prototype.initialize=function(){this.eventBinder=new n.EventBinder("retractableFooter");this.addTheTrigger();this.addListeners()},t.prototype.addTheTrigger=function(){this.$footer.prepend('<div class="js-footer footer-trigger">'+Localizer.Format(Localizer.Globals.copyright,{year:(new Date).getFullYear()})+' <div class="icon button gold small"><i class="material-icons">keyboard_arrow_up<\/i><\/div><\/div>')},t.prototype.addListeners=function(){var t=this;this.eventBinder.forDocument(".js-footer").on("click",function(i){if(i.preventDefault(),t.$footer.hasClass("open"))t.$footer.removeClass("open");else if(t.$footer.outerHeight()+100<$(window).height())t.$footer.addClass("open");else{var r=new n.Modal("footer",t.$footer);r.open()}})},t}();t.RetractableFooter=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t=function(){function n(){}return n.start=function(){this.$html.addClass("loaderbar-loading")},n.stop=function(){var n=this;this.$html.addClass("loaderbar-loaded");setTimeout(function(){n.$html.removeClass("loaderbar-loading");n.$html.removeClass("loaderbar-loaded")},1e3)},n.$html=$("html"),n}();n.LoaderBar=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(){this.pausedConversations=[];this.pauseAllConversations=!1}return i.prototype.initialize=function(){this.addEventMuxSubscriptions();this.toastClient=new n.ToastMessages.Client;this.setPausedConversations()},i.prototype.addEventMuxSubscriptions=function(){var t=this;n.EventMux.subscribe({eventType:Globals.RealTimeEventType.ConversationChanged,onUpdate:function(n){var i=n.update,r;i.conversationType==Globals.EventConversationType.Private&&(r=viewModels.loggedInUserModel().pmToastsEnabled(),r&&t.processToastEvent(i,!1));i.conversationType===Globals.EventConversationType.Clan&&t.processToastEvent(i,!0)}})},i.prototype.showToast=function(i,r,u,f,e,o){var c="",s=r.profilePicturePath,h;c=f&&e!=null?'<a href="/'+Localizer.CurrentCultureName+"/ClanV2/Conversation?chatId="+i+'" class="conversationUpdate">\n\t\t\t\t\t\t\t<span class="clanName">'+e.detail.name+": "+o+'<\/span>\n\t\t\t\t\t\t\t<span class="avatar" style="background-image:url('+s+')"><\/span>\n\t\t\t\t\t\t\t<strong>'+Localizer.Format(Localizer.Messages.displaynamesays,{displayName:r.displayName})+"<\/strong>\n\t\t\t\t\t\t\t<p>"+u+"<\/p>\n\t\t\t\t\t\t<\/a>":'<a href="#" data-messageid="'+i+'" class="btn_gotomessage conversationUpdate">\n\t\t\t\t\t\t\t<span class="avatar" style="background-image:url('+s+')"><\/span>\n\t\t\t\t\t\t\t<strong>'+Localizer.Format(Localizer.Messages.displaynamesays,{displayName:r.displayName})+"<\/strong>\n\t\t\t\t\t\t\t<p>"+u+"<\/p>\n\t\t\t\t\t\t<\/a>";this.toastClient.show(n.ToastMessages.ToastMessageType.Info,c);this.toastClient.maxConcurrentMessages=2;"Notification"in window&&Notification.prototype.permission==="granted"&&!document.hasFocus()&&(h=new Notification(Localizer.Messages.browsernewmessagenotificationtitle,{icon:s,body:u}),h.onclick=function(){t.UserNotify.NotificationPane.Instance.showConversation(i,e?t.UserNotify.MessagesType.GroupMessages:t.UserNotify.MessagesType.Messages);h.close()})},i.prototype.processToastEvent=function(t,i){var r=this,u=this.pausedConversations.indexOf(t.conversationId)>-1||this.pauseAllConversations;if(u){n.log("MessageUpdate: Conversation "+t.conversationId+" is paused, ignoring toast");return}t.senderMembershipId!==viewModels.loggedInUserModel().user.membershipId()&&bungieNetPlatform.userService.GetBungieNetUserById(t.senderMembershipId,function(n){i?typeof t.groupId!="undefined"&&t.groupId!=="0"&&bungieNetPlatform.groupV2Service.GetGroup(t.groupId,function(u){r.showToast(t.conversationId,n,t.preview,i,u,t.name)},function(){}):r.showToast(t.conversationId,n,t.preview,i)},function(){})},i.prototype.setPausedConversations=function(){var r=this,t,i;Modernizr.localstorage&&(t=n.Utilities.LocalStorage.getItem("chatToastSettings"),t&&(i=JSON.parse(t),i.length&&i.forEach(function(n){n.showToasts||r.pausedConversations.push(n.conversationId)})))},i.prototype.toggleIgnoreToastsForAllConversations=function(n){this.pauseAllConversations=n},i.prototype.ignoreToastsForConversationId=function(n){this.pausedConversations.push(n)},i.prototype.unignoreToastsForConversationId=function(n){var t=this.pausedConversations.indexOf(n);t>-1&&this.pausedConversations.splice(t,1)},i.prototype.isConversationToastIgnored=function(n){return this.pausedConversations.indexOf(n)>-1},i.Instance=new i,i}();t.MessageUpdate=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){}return t.prototype.initialize=function(){var n=this;viewModels.loggedInUserModelIsLoaded()?this.getMyClans():viewModels.loggedInUserModelIsLoaded.subscribe(function(){n.getMyClans()})},t.prototype.getMyClans=function(){var n=this;bungieNetPlatform.groupV2Service.GetGroupsForMember(Globals.BungieMembershipType.BungieNext,viewModels.loggedInUserModel().user.membershipId(),Globals.GroupsForMemberFilter.All,Globals.GroupType.Clan,function(t){t.results.length>1&&n.addClansToNav(t)},function(){})},t.prototype.addClansToNav=function(t){var r=n.Utilities.Enumerable.unique(t.results.map(function(n){return n.group.groupId})),i;r.length!==1&&(i=$(".nav_top [data-id=clan]"),i.length&&i.replaceWith(this.buildClansNavItems(t)))},t.prototype.buildClansNavItems=function(n){for(var t,u,r="",i=0;i<n.results.length;i++)t=n.results[i],u=this.getCrossSaveStatus(n,t),u==="activeClan"?r=this.buildClanNavItem(t,i+1,this.getCrossSaveStatus(n,t))+r:r+=this.buildClanNavItem(t,i+1,this.getCrossSaveStatus(n,t));return r},t.prototype.getCrossSaveStatus=function(n,t){var i="notCrossSaved";return t.member.destinyUserInfo.crossSaveOverride!=Globals.BungieMembershipType.None&&(i=n.areAllMembershipsInactive[t.group.groupId]?"inactiveClan":"activeClan"),i},t.prototype.buildClanNavItem=function(n,t,i){return i==="activeClan"?'\n\t\t\t\t<a data-id="clan_'+t+'" href= "/'+Localizer.CurrentCultureName+"/ClanV2/Chat?groupid="+n.group.groupId+'" class="cross-save">\n\t\t\t\t\t<img src="/img/theme/bungienet/icons/icon_cross_save_dark.png" alt="cross save icon" class="cross-save-icon icon" />\n\t\t\t\t\t<span>'+n.group.name+"<\/span>\n\t\t\t\t<\/a>":i==="inactiveClan"?'\n\t\t\t\t<a data-id="clan_'+t+'" href= "/'+Localizer.CurrentCultureName+"/ClanV2/Chat?groupid="+n.group.groupId+'" class="cross-save">\n\t\t\t\t\t<img src="/img/theme/bungienet/icons/icon_inactive_clan.png" alt="inactive clan icon" class="inactive-clan-icon icon" />\n\t\t\t\t\t<span style="opacity: 0.6">'+n.group.name+"<\/span>\n\t\t\t\t<\/a>":'\n\t\t\t\t<a data-id="clan_'+t+'" href= "/'+Localizer.CurrentCultureName+"/ClanV2/Chat?groupid="+n.group.groupId+'">\n\t\t\t\t\t<p class="platform-type" data-platform="'+Globals.BungieMembershipType[n.member.destinyUserInfo.membershipType]+'">\n\t\t\t\t\t\t'+Localizer.Shortplatforms[Globals.BungieMembershipType[n.member.destinyUserInfo.membershipType].toLowerCase()]+"\n\t\t\t\t\t<\/p>\n\t\t\t\t\t"+n.group.name+"\n\t\t\t\t<\/a>"},t.Instance=new t,t}();t.MyClan=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var u=function(){function u(n){this.ajaxSectionRegex=n;this.preventAjaxMode=!1;this.allowSamePathname=!1;this.scrollToTopOnAjaxLoad=!0;this.loadContent=!0;this.loadOutsideContent=!0;this.loadSubNav=!0;this.loadMainNavItems=!0;this.loadNavTop=!0;this.loadSidebar=!0;this.useCache=!0;this.beforeOnStateChange=function(){return!0};this.isLoadingPage=!1;this.appendCacheQuerystring="ajax=true";this.url=""+window.location.pathname+window.location.search;this.isSamePathname=!1;this.lastParsedUrl=window.location.pathname+window.location.search+window.location.hash;this.parseUrlTimer=null;this.forceRedirectUrlRegex=/\/Companion/gi;this.disableUiDuringLoad=!1;this.urlParsedCallback=function(){};this.onBeforeUnload=function(){return!1}}return u.prototype.initialize=function(){this.normalizeAjaxSectionRegex();this.unbindAll();this.handleRedirects();this.addListeners()},u.prototype.unbindAll=function(){$("*").unbind(".pagecontrol");$(document).unbind(".pagecontrol");$(window).unbind(".pagecontrol")},u.prototype.addListeners=function(){var n=this;$(document).on("click.pagecontrol","a:not(.exempt)[href]",function(t){return n.handleLinkClicks(t)});$(window).on({"popstate.pagecontrol statechange.pagecontrol":function(t){return n.onStateChange(t)},"hashchange.pagecontrol":function(t){return n.onStateChange(t)}})},u.prototype.onStateChange=function(t){var u=n.Utilities.Url.urlToAnchorElement(location.href),r,f;u.hash==""&&(r=i.doesLinkQualifyForAjax(u,null,this.ajaxSectionRegex),f=this.beforeOnStateChange(t,r),f)&&(r||(location.href=window.location.href),this.urlParserThrottle(t))},u.prototype.stateChange=function(t,i,r,u){r===void 0&&(r=!0);u===void 0&&(u=!1);var f=n.Utilities.Url.urlToAnchorElement(t);this.stateChangeAnchor(f,i,r,u)},u.prototype.stateChangeAnchor=function(t,r,u,f){var h=this,e,o,c,s,l;u===void 0&&(u=!0);f===void 0&&(f=!1);try{if(this.isLoadingPage=!0,t===undefined||t===null)throw"ERROR: No link specified. Cannot proceed with statechange";if(e=n.Utilities.Url.urlToAnchorElement(t),o=e.pathname,e.pathname.charAt(0)!=="/"&&(o="/"+o),!f&&(c=i.doesLinkQualifyForAjax(e,null,this.ajaxSectionRegex),!c)){n.warn("URL does not qualify for ajax loading. Redirecting...");location.href=e.href;return}s=""+o+e.search+e.hash;l=this.onBeforeUnload();l?n.Utilities.Modals.Confirm(Localizer.Messages.beforeunloadconfirmationmessage,n.ConfirmationReason.Warning,function(){h.processStateChange(r,u,s)},function(){h.isLoadingPage=!1}):this.processStateChange(r,u,s)}catch(a){n.log(a)}},u.prototype.processStateChange=function(n,t,i){n?history.replaceState({url:i},null,i):history.pushState({url:i},null,i);t&&$(window).trigger("statechange.pagecontrol")},u.prototype.redirect=function(t){if(Modernizr.localstorage&&window.history&&document.all){var i=n.Utilities.LocalStorage.getItem("history").toLowerCase()===t.toLowerCase();i?history.go(-1):window.location.href=t}else this.stateChange(t,!0)},u.prototype.replaceQuery=function(t){var i=typeof t=="string"?t:n.Utilities.Url.createQueryFromObject(t),r=window.location.pathname+i;this.redirect(r)},u.prototype.normalizeAjaxSectionRegex=function(){if(!this.ajaxSectionRegex){this.ajaxSectionRegex=new RegExp("NO AJAX SECTION REGEX DEFINED");return}var n=this.ajaxSectionRegex.source,t=n.replace("{locale}",Localizer.CurrentCultureName);this.ajaxSectionRegex=new RegExp(t)},u.prototype.handleLinkClicks=function(t){var r,u,f;return Modernizr.history?(r=t.currentTarget,u=n.Utilities.Url.urlToAnchorElement(r.href),this.isLoadingPage)?!0:(f=i.doesLinkQualifyForAjax(u,t,this.ajaxSectionRegex),!f)?!0:(t.which!==2&&(t.preventDefault(),r.search.indexOf("?c=")!==-1||r.search.indexOf("&c=")!==-1?window.location.reload():this.stateChangeAnchor(u,!1)),!1):!0},u.prototype.urlParserThrottle=function(t){var i=this;if(this.parseUrlTimer!==null){n.log("Attempted to run URL parse while one was already running");return}this.parseUrlTimer=setTimeout(function(){i.parseUrlTimer=null},100);viewModels.currentUrl(window.location);this.parseUrlAndLoad(t)},u.prototype.parseUrlAndLoad=function(t){var f=this.url,i,r,u;this.url=window.location.pathname+window.location.search;i=n.Utilities.Url.urlToAnchorElement(f);r=n.Utilities.Url.urlToAnchorElement(this.url);this.isSamePathname=i.pathname.toLowerCase()===r.pathname.toLowerCase();u=this.lastParsedUrl===window.location.pathname+window.location.search+window.location.hash;u?this.isLoadingPage=!1:window.location.search.match("_modal")||this.preventAjaxMode?this.isLoadingPage=!1:this.loadUrl(t);this.urlParsedCallback()},u.prototype.reloadPage=function(){this.isSamePathname=!1;this.url=this.lastParsedUrl;this.loadUrl()},u.prototype.loadUrl=function(n){var t=this,i,r;(!this.isSamePathname||this.allowSamePathname)&&(this.lastParsedUrl=window.location.pathname+window.location.search,setTimeout(function(){$("body").addClass("preload")},300),this.startLoading(),this.disableUiDuringLoad&&$("html").addClass("uiDisabled"),i=window.location.search.length?"&":"?",r=this.url+i+this.appendCacheQuerystring,this.onOldPageDestroyed(),$.ajax({url:r,cache:this.useCache,type:"GET",data:null,dataType:"html",success:function(i,r,u){t.processUrl(u);t.replaceContent(i);t.setViewModels();t.onNewPageCreated(n)},error:function(){history.replaceState({},null,"#");location.replace("")},statusCode:{302:function(){alert("302")}}}))},u.prototype.processUrl=function(t){var r=t.getResponseHeader("X-SelfUrl"),s=t.getResponseHeader("X-Error-Code"),i;if(s&&r){window.location.href=r;return}var h=new RegExp("(\\?|\\&)"+this.appendCacheQuerystring,"gi"),c=this.url.replace(h,""),u=n.Utilities.Url.urlToAnchorElement(r),f=n.Utilities.Url.getObjectFromQueryString(u.search);delete f.ajax;var l=n.Utilities.Url.createQueryFromObject(f),a=u.pathname+l,e=n.Utilities.Url.urlToAnchorElement(c),o=n.Utilities.Url.urlToAnchorElement(a);if(r.match(this.forceRedirectUrlRegex)){n.warn("Forced Redirect...");window.location.href=r;return}o.href!==e.href&&(i=o.href+e.hash,i.substr(0,4)!=="http"&&(i+=i.substr(0,1)==="/"?"":"/"),this.ajaxSectionRegex&&!i.match(this.ajaxSectionRegex)&&(window.location.href=i),history.replaceState({},"",i),this.url=i,this.lastParsedUrl=i);successRedirect=encodeURIComponent(this.lastParsedUrl)},u.prototype.replaceContent=function(i){var r=$("<output/>").append($(i)),f=i.match(/<body.*class=['"]([^"']+)['"].*>/),e,u,o;f&&(e=f[1],$("body").attr("class",e+" loadedViaAjax"));u=i.match(/<title>(.*)<\/title>/);u&&(o=$("<div/>").html(u[1]).text(),$("title").text(o));this.replaceElementContent("#ServerVarsPageData",r);this.loadContent&&this.replaceElementContent("#content",r);this.loadOutsideContent&&this.replaceElementContent("#outsideContent",r);this.loadSubNav&&this.replaceElementContent(".Sub_Nav",r);this.loadMainNavItems&&this.replaceElementContent("#nav-items",r);!n.Utilities.User.isAuthenticated&&this.loadNavTop&&this.replaceElementContent(".Nav_Top",r,!0,function(){t.Navigation.NavBar.Instance.initialize()});this.loadSidebar&&this.replaceElementContent("#sidebar",r,!1,function(n){$("body").toggleClass("NoSidebar",!n)});$("#content").removeClass("hide").css("visibility","visible").siblings(".page").addClass("hide")},u.prototype.replaceElementContent=function(n,t,i,r){var e;i===void 0&&(i=!0);r===void 0&&(r=function(){});var f=$(n),u=t.find(n).html(),o=t.find(n).attr("class");i?f.html(u?u:""):f.html(u);f.attr("class",o);e=u?!0:!1;r(e)},u.prototype.setViewModels=function(){var i=[$("#content"),$(".Sub_Nav")],r,u,n,t;for(this.loadSidebar&&i.push($("#sidebar")),r=ko.utils.domNodeDisposal.cleanExternalData,ko.utils.domNodeDisposal.cleanExternalData=function(){},u=i.length,n=0;n<u;n++)t=i[n],typeof t[0]!="undefined"&&(ko.cleanNode(t[0]),ko.applyBindings(viewModels,t[0]));ko.utils.domNodeDisposal.cleanExternalData=r},u.prototype.onNewPageCreated=function(n){t.loadedViaAjax=!0;this.unbindAll();$(document).trigger("newPageCreated");$(window).trigger("load");setTimeout(function(){$("body").removeClass("preload")},200);this.scrollToTopOnAjaxLoad&&(n&&n.type==="popstate"||$(window).scrollTop(0));this.stopLoading();this.initialize();t.Navigation.NavBar.Instance.initialize()},u.prototype.startLoading=function(){t.LoaderBar.start()},u.prototype.stopLoading=function(){t.LoaderBar.stop()},u.prototype.onOldPageDestroyed=function(){$(document).trigger("oldPageDestroyed");this.isLoadingPage=!1;this.disableUiDuringLoad&&$("html").removeClass("uiDisabled")},u.prototype.handleRedirects=function(){if(Modernizr.hashchange&&window.location.search.indexOf("nhc")===-1)if(window.location.hash.indexOf("?lc=")>-1){if(window.location.hash.indexOf("?lc=")>-1){var t=window.location.href.replace("?lc=","&lc=");u.Instance.redirect(t)}}else{$(window).on("beforeunload",function(){try{n.Utilities.LocalStorage.setItem("history",window.location.href)}catch(e){}});$(window).on("hashchange newPageCreated",function(){$("html").removeClass("uiDisabled");$("#btn_signOut").attr("href","/"+Localizer.CurrentCultureName+"/User/SignOut?bru="+encodeURIComponent(window.location.pathname+window.location.search+window.location.hash))})}},u.prototype.loadCustomSection=function(t,i,u,f,e,o,s){f===void 0&&(f=!0);e===void 0&&(e=null);switch(i){case r.PushState:history.pushState({},null,t);break;case r.ReplaceState:history.replaceState({},null,t)}var h=e!=null?e:t;n.Utilities.Ajax.loadUrlGetElement({url:h,elementSelectors:u,changeTitle:!1},function(n){var i=n,s,t,r;if(f)for(i=$(),s=typeof u=="string"?u.split(","):u,t=0,r=s;t<r.length;t++){var e=r[t],h=$(document).find(e),c=n.find(e);h.html(c.html());$.extend(i,$(document).find(e))}o(i)},s)},u.Instance=new u(window.ajaxSectionRegex),u}(),r,i;t.PageController=u,function(n){n[n.None=0]="None";n[n.PushState=1]="PushState";n[n.ReplaceState=2]="ReplaceState"}(r=t.UrlChangeType||(t.UrlChangeType={})),function(n){function i(n,t){if(n.href===window.location.href)return t.preventDefault(),!0}function r(n){return n.pathname===window.location.pathname&&(n.href.match("#")&&n.hash===window.location.hash||n.href.match("\\?")&&n.search===window.location.search)?!0:!1}function u(n){var t=n.host.match(":")?n.host.split(":")[0]:n.host,i=window.location.host.match(":")?window.location.host.split(":")[0]:window.location.host;return t!==i?!0:!1}function f(n){return n.pathname===window.location.pathname&&typeof n.hash!="undefined"&&n.hash!==""?!0:!1}function e(n,t){return typeof t=="undefined"||!n.href.match(t)?!1:!0}function o(n,o,s){return Modernizr.ie?!1:e(n,s)?o&&i(n,o)&&!t.PageController.Instance.allowSamePathname?!1:r(n)&&!t.PageController.Instance.allowSamePathname?!1:u(n)?!1:f(n)?!1:!0:!1}n.doesLinkQualifyForAjax=o}(i||(i={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){this.transferComplete=!1;this.transferInProgress=!1}return t.prototype.initialize=function(){var n=this;$("#alert-pcmigration").length>0&&this.getLocalStorageAlertVisibility().then(function(){n.showAlert()&&n.renderAlert()})},t.prototype.addListeners=function(){var t=this;$(document).on("click",".globalAlertsBar.pcmigration",function(){n.Site.PageController.Instance.redirect("/7/"+Localizer.CurrentCultureName+"/PCMove")});$(document).on("click",".globalAlertsBar.pcmigration .js-remove",function(n){n.stopImmediatePropagation();t.removeAlert()})},t.prototype.removeAlert=function(){$(".js-pcmigration-global-alert").remove();$("body.HasPCMigrationAlert").removeClass("HasPCMigrationAlert");this.updateLocalStorageAlertVisibility(!1)},t.prototype.renderAlert=function(){var t=$("#alert-pcmigration"),n;t.length===0||$("body").hasClass("HasPCMigrationAlert")||(n=$($("#alert-pcmigration").html()),n.find("span").text(this.populateMessage()),this.addClasses(n),this.appendToDom(n),this.addListeners())},t.prototype.populateMessage=function(){var n=Localizer.Pcmigration,t="";return n&&(t=n.OnDecember12020Battle),t},t.prototype.showAlert=function(){return this.localStorageAllows},t.prototype.addClasses=function(n){n.addClass("sunsetting")},t.prototype.appendToDom=function(n){var i=$(".globalAlertsBar"),t,r;i.length?$(".globalBar").length===0&&($(n).insertBefore(i),$("body").addClass("HasTwoGlobalAlerts HasPCMigrationAlert")):($("body").addClass("HasPCMigrationAlert"),t=$("#explore-container"),r=$("#mainContent"),t.length?t.before(n):r.prepend(n))},t.prototype.getLocalStorageAlertVisibility=function(){return(typeof n.Utilities.LocalStorage.getItem("show-pc-migration-sunset-alert")=="undefined"||n.Utilities.LocalStorage.getItem("show-pc-migration-sunset-alert")===null)&&n.Utilities.LocalStorage.setItem("show-pc-migration-sunset-alert","true"),this.localStorageAllows=n.Utilities.LocalStorage.getItem("show-pc-migration-sunset-alert")==="false"?!1:!0,Promise.resolve()},t.prototype.updateLocalStorageAlertVisibility=function(t){this.localStorageAllows=t;n.Utilities.LocalStorage.setItem("show-pc-migration-sunset-alert",t.toString())},t.Instance=new t,t}();t.PCMigrationGlobalAlert=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var i=function(){function t(){}return t.prototype.openModal=function(){return this.getLocalStorage(),this.showToUser?(this.modal=new n.Modal(this.modalId,$("#"+this.modalId).html()),this.addListeners(),this.modal.open(),!0):!1},t.prototype.addListeners=function(){},t.prototype.updateLocalStorage=function(t){n.Utilities.LocalStorage.setItem(this.localStorageKey,t?"true":"false")},t.prototype.getLocalStorage=function(){this.showToUser=!1||n.Utilities.LocalStorage.getItem(this.localStorageKey)!=="false"},t}(),r=function(t){function i(){var r=t.call(this)||this,i=n.Site.getPageData("PCMigration");return i!==null&&typeof i!="undefined"&&typeof i.PCMigrationBlizzardLocalStorageKey!="undefined"&&i.PCMigrationBlizzardLocalStorageKey!==""&&(r.localStorageKey=i.PCMigrationBlizzardLocalStorageKey),r.modalId="blizzardRedirectModal",r}return __extends(i,t),i.prototype.addListeners=function(){var t=this,i=new n.EventBinder(this.modalId);i.forDocument(".js-pc-migration-dismiss").on("click",function(){t.hideBlizzardModal();n.SignInTriggers.showAuthWindow(Globals.BungieCredentialType.BattleNetId)});i.forDocument(".js-pc-migration-learn-more").on("click",function(){t.hideBlizzardModal()})},i.prototype.hideBlizzardModal=function(){this.updateLocalStorage(!1);this.modal.close()},i}(i),u,f;t.BlizzardModal=r;u=function(t){function i(){var r=t.call(this)||this,i=n.Site.getPageData("PCMigration");return i!==null&&typeof i!="undefined"&&typeof i.PCMigrationSteamLocalStorageKey!="undefined"&&i.PCMigrationSteamLocalStorageKey!==""&&(r.localStorageKey=i.PCMigrationSteamLocalStorageKey),r.modalId="steamRedirectModal",r}return __extends(i,t),i.prototype.addListeners=function(){var t=new n.EventBinder(this.modalId)},i}(i);t.SteamModal=u;f=function(t){function i(){var n=t.call(this)||this;return n.modalId="blizzardRedirectModal",n}return __extends(i,t),i.prototype.initialize=function(){var t=this;if(n.Utilities.User.isAuthenticated)return Promise.all([this.getUserCredentials(),this.getLocalStorage(),]).then(function(){t.showToUser&&t.userHasBlizzard&&!t.userIsLinked&&(t.modal=new n.Modal(t.modalId,$("#"+t.modalId).html()),t.addListeners(),t.modal.open(),t.updateLocalStorage(!1))})},i.prototype.getUserCredentials=function(){var n=this;return bungieNetPlatform.userService.GetCredentialTypesForAccountPromise().then(function(t){typeof t.find(function(n){return n.credentialType===Globals.BungieCredentialType.BattleNetId})!="undefined"&&(n.userHasBlizzard=!0);typeof t.find(function(n){return n.credentialType===Globals.BungieCredentialType.SteamId})!="undefined"&&(n.userHasSteam=!0);n.userHasBlizzard&&n.userHasSteam&&(n.userIsLinked=!0)})},i}(r);t.BlizzardModalOpener=f})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){this.eventName="recruitThreadUpdated"}return t.prototype.initialize=function(){this.addEventMuxSubscription();this.addEventListeners()},t.prototype.addEventMuxSubscription=function(){var t=this;n.EventMux.subscribe({eventType:Globals.RealTimeEventType.RecruitThreadUpdate,onUpdate:function(n){var i={recruitThreadUpdate:{conversationId:n.conversationId,topicId:n.topicId,isRemoved:n.isRemoved,membershipId:n.targetMembershipId}};$(document).trigger(t.eventName,i)}})},t.prototype.addEventListeners=function(){$(document).on(this.eventName,function(t,i){var r=i.recruitThreadUpdate,u;typeof r.conversationId!="undefined"&&r.conversationId!==null&&r.conversationId!=="0"&&(u=new n.ToastMessages.Client,u.show(n.ToastMessages.ToastMessageType.Info,Localizer.Format(Localizer.Messages.yourfireteamisreadyadata,{conversationId:r.conversationId})))})},t}();t.RecruitThreadUpdate=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(t){function u(){h();moment.locale(Localizer.CurrentCultureName);e();t.PageController.Instance.initialize();c();ServerVars.MobileWebView||ServerVars.MinimalLayout||(n.EventMux.initialize(),n.NotificationCount.Manager.Instance.initialize(),t.MessageUpdate.Instance.initialize(),t.recruitThreadUpdate=new t.RecruitThreadUpdate,t.recruitThreadUpdate.initialize(),t.fireteamUpdate=new t.FireteamUpdate,t.fireteamUpdate.initialize(),t.streamingAlerts=new t.StreamingAlerts,t.streamingAlerts.initialize(),t.MyClan.Instance.initialize(),t.LocaleSelector.instance.initialize(),t.Navigation.NavBar.Instance.initialize(),n.NotificationCount.Manager.Instance.start(),n.SignInTriggers.Instance.bind(),t.CookieConsent.Instance.initialize());t.Forms.Instance.initialize();r()}function f(n){t.currentArea=n}function e(){$(window).on("load",function(){return o()})}function o(){$("body").addClass("loaded");Modernizr.generatedcontent||$(".bg_top").append("<span>You are using an unsupported browser, your experience may be less than optimal<\/span>")}function i(){n.UiKit.Base.Instance.initialize();t.EmailValidationBar.Instance.initialize();t.PageDataMembershipProvider.Instance.refresh();t.PageDataBuyButtonProvider.Instance.refresh();t.routeValues=t.getPageData("RouteValues");t.currentArea&&t.currentArea.initialize()}function s(){t.currentArea&&t.currentArea.destroy();n.UiKit.Base.Instance.destroy()}function h(){var f=Modernizr.ie&&!Modernizr.edge,t,i,r,u;f&&Modernizr.localstorage&&(t="seen-browser-support-modal",i=n.Utilities.LocalStorage.getItem(t)==="1",i||(n.Utilities.LocalStorage.setItem(t,"1"),r="\n\t\t\t\t\t"+Localizer.Messages.browsernotsupported+" <a href='"+ServerVars.BrowserSupportHelpArticleLink+"'>"+Localizer.Messages.browsersupportfindoutmore+"<\/a>\n\t\t\t\t",u=new n.Modal("browser-support",r),u.open()))}function c(){return __awaiter(this,void 0,void 0,function(){var i,r;return __generator(this,function(u){switch(u.label){case 0:if(!n.Utilities.User.isAuthenticated)return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,t.GlobalData.getCurrentUser()];case 2:return i=u.sent(),viewModels.loggedInUserModel(ko.mapping.fromJS(i)),viewModels.loggedInUserModelIsLoaded(!0),viewModels.loggedInUserModel().adultMode()&&($(".post_urlLinkOrImage").addClass("deferred"),$(".btn_hideImage").addClass("hide"),$(".ageGatePrompt").addClass("hide"),$(".ageGateContents").removeClass("hide")),[3,4];case 3:return r=u.sent(),n.error(r),[3,4];case 4:return[2]}})})}function l(n,t){return n in ServerVars.PageData?ServerVars.PageData[n]:t}function a(t){return t in ServerVars.PageData?ServerVars.PageData[t]:(n.warn(t+" is not available in PageData"),null)}function r(){$.easing.BnetEasing=function(n){return n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1};n.Utilities.Html.placeholderLocFix()}t.setCurrentArea=f;t.getPageDataOrDefault=l;t.getPageData=a;t.customFixes=r;var v=function(){function n(){}return n.IsWebViewMode=$("html").hasClass("WebViewMode"),n.IsDebug=ServerVars.Environment!=="live"&&ServerVars.Environment!=="beta",n}();t.Flags=v;$(document).ready(function(){typeof viewModels!="undefined"&&ko.applyBindings(viewModels);u();i();$("html").addClass("documentReady")});$(document).on("newPageCreated",function(){i()});$(document).on("oldPageDestroyed",function(){s()})})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var r=function(){function r(){this.isHomepage=$("body").hasClass("Homepage");this.isPubPage=window.location.href.indexOf(Localizer.CurrentCultureName+"/pub/")!==-1;this.modalSeenStorageKey="StreamingAlerts.HomepageModalSeenTime";this.dontShowModalTimeLimit=864e5;this.modalAutoOpenDelay=1.5*1e3}return Object.defineProperty(r.prototype,"isMobile",{get:function(){return Modernizr.mobile||n.Reactive.mobile.test()},enumerable:!0,configurable:!0}),r.prototype.initialize=function(){t.Flags.IsWebViewMode||this.isPubPage||(this.addListeners(),this.getStreamingAlerts())},r.prototype.addListeners=function(){var n=this;$(document).on("click","#streaming-alerts",function(){n.isMobile?window.location.href=n.getChannelLink(!1):n.openTwitchModal({muted:!1,openedAutomatically:!1})})},r.prototype.getChannelLink=function(n){if(!this.streamingAlert)return"";var t=n?"&muted":"&!muted";return location.protocol+"//player.twitch.tv/?channel="+this.streamingAlert.StreamInfo.ChannelName+t+"&volume=0.33"},r.prototype.getStreamingAlerts=function(){var n=this;bungieNetPlatform.coreService.GetGlobalAlerts(!0,function(t){n.processAlerts(t)},function(){})},r.prototype.processAlerts=function(n){for(var i,t=0;t<n.length;t++)if(i=n[t],i.AlertType===Globals.GlobalAlertType.StreamingAlert){this.streamingAlert=i;this.onStreamingAlertExists();continue}},r.prototype.onStreamingAlertExists=function(){var t=this,n=this.checkOrSetHasSeenModal(),r=!this.isHomepage||!n;i.show(r);n&&this.isHomepage&&!this.isMobile&&setTimeout(function(){t.openTwitchModal({muted:!0,openedAutomatically:!0})},this.modalAutoOpenDelay)},r.prototype.openTwitchModal=function(n){this.streamingAlertModal=new u(this);this.streamingAlertModal.open(n)},r.prototype.checkOrSetHasSeenModal=function(){var t=!0,i=n.Utilities.LocalStorage.getItem(this.modalSeenStorageKey),u;return i&&(u=parseInt(i,10),r.timeLimitExceeded(this.dontShowModalTimeLimit,u)||(t=!1)),t&&n.Utilities.LocalStorage.setItem(this.modalSeenStorageKey,performance.now().toString()),t},r.timeLimitExceeded=function(n,t){var i=performance.now(),r=i-t;return r>n},r}(),u,i;t.StreamingAlerts=r;u=function(n){function t(t){var i=n.call(this,"streaming-alert",null)||this;return i.streamingAlerts=t,i.maximumModalTrackingTimeout=3e5,i}return __extends(t,n),t.prototype.addListeners=function(){var t=this;n.prototype.addListeners.call(this);$(document).one("oldPageDestroyed",function(){clearTimeout(t.maximumModalTrackingTimer)});$(window).one("beforeUnload",function(){clearTimeout(t.maximumModalTrackingTimer)})},t.prototype.trackAutoModalTimer=function(n){var t=performance.now(),i=n.openedAutomatically?"auto-open":"manual-open";this.afterCloseCallback=function(){var n=(performance.now()-t)/1e3,i=n<5?"< 5 seconds":n>=5&&n<20?"5 - 20 seconds":n>=20&&n<60?"20 - 60 seconds":n>60&&n<300?"60 - 300 seconds":"> 300 seconds"};this.maximumModalTrackingTimer=setTimeout(function(){},this.maximumModalTrackingTimeout)},t.prototype.open=function(t){if(t){var i='\n\t\t\t\t<iframe src="'+this.streamingAlerts.getChannelLink(t.muted)+'" frameborder="0" scrolling="no" height="100%" width="100%" allowfullscreen><\/iframe>\n\t\t\t';this.populateContent(i);this.trackAutoModalTimer(t);n.prototype.open.call(this)}},t}(n.Modal),function(t){function o(n){n===void 0&&(n=!0);var t=s(),r=h(n),i=r?"streaming-alerts-transition":"";$("html").addClass("streaming-alerts-active "+i);t.addClass(i);setTimeout(function(){t.addClass("on")},u);setTimeout(function(){t.addClass("done")},f)}function s(){var t=$("#streaming-alerts-template").html(),n=$(t);return $("header").append(n),n}function h(n){var t=!0;return n&&(t=c(),t||(u=f=0)),t&&n}function c(){var t=!0,u=n.Utilities.SessionStorage.getItem(i),f;return u&&(f=parseInt(u,10),r.timeLimitExceeded(e,f)||(t=!1)),t&&n.Utilities.SessionStorage.setItem(i,performance.now().toString()),t}var i="StreamingAlerts.LastAnimatedTime",e=18e5,u=500,f=2500;t.show=o}(i||(i={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var r=function(){function n(n){this.subscriptionConstructor=n;this._subscriptions=[]}return Object.defineProperty(n.prototype,"subscriptions",{get:function(){return this._subscriptions},enumerable:!0,configurable:!0}),n.prototype.subscribe=function(n){var t=new this.subscriptionConstructor(this,n);return this._subscriptions.push(t),t},n.prototype.unsubscribe=function(n){var t=this._subscriptions.indexOf(n);t>-1&&this._subscriptions.splice(t,1)},n.prototype.broadcast=function(){for(var t,i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];t=this.getPayloadsToUpdate();this.updateSubscriptions(t)},n.prototype.updateSubscriptions=function(n){var t,i,r;if(n&&n.length>0)for(t=0,i=n;t<i.length;t++){r=i[t];r.getSubscription().params.onUpdate(r)}},n}(),t,i;n.Subscribable=r;t=function(){function n(n,t){this.subscribable=n;this.params=t}return n.prototype.unsubscribe=function(){this.subscribable.unsubscribe(this)},n}();n.Subscription=t;i=function(){function n(n){this.subscription=n}return n.prototype.getSubscription=function(){return this.subscription},n}();n.SubscriptionPayload=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(t){this.areaName=t;this.eventBinder=new n.EventBinder(t)}return Object.defineProperty(i.prototype,"currentPage",{get:function(){return this.pageInitialization.currentPage},enumerable:!0,configurable:!0}),i.prototype.initialize=function(){this.removeBindings();this.pageInitialization=new t.PageInitialization;this.addPages(this.pageInitialization);this.pageInitialization.initializePages();$("html").addClass("area-initialized")},i.prototype.removeBindings=function(){var n="."+this.areaName;$(window).unbind(n);$(document).unbind(n);$("*").unbind(n)},i.prototype.destroy=function(){this.pageInitialization.destroyPages();this.eventBinder.destroy()},i}();t.Area=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var i=function(){function n(t){this.eventNamespace=t;this.allBindings=[];this.countId=n.BinderCount++}return n.prototype.for=function(n,i){var r=typeof n=="string"?$(n):n;return new t(this,r,this.eventNamespace,i)},n.prototype.forDocument=function(n){return this.for($(document),n)},n.prototype.destroy=function(){this._destroy()},n.prototype._destroy=function(){this.allBindings.forEach(function(n){n.delegatedElementSelector?n.element.off(n.namespacedEvent,n.delegatedElementSelector):n.element.off(n.namespacedEvent)});this.allBindings=[]},n.BinderCount=0,n}(),t;n.EventBinder=i;t=function(){function t(n,t,i,r){this.binder=n;this.element=t;this.eventNamespace=i;this.delegatedElementSelector=r}return t.prototype.on=function(n,t){for(var u,r=n.split(" "),i=0,f=r.length;i<f;i++)u=r[i],u!==""&&this._on(r[i],t);return this},t.prototype.off=function(n){var i,t,r,u;for(n===void 0&&(n=""),i=n.split(" "),t=0,r=i.length;t<r;t++)u=i[t],u!==""&&this._off(i[t]);return this},t.prototype._on=function(t,i){var u=this._getNamespacedEventName(t),e={element:this.element,delegatedElementSelector:this.delegatedElementSelector,event:this._getNamespacedEventName(t),namespacedEvent:u,callback:i},f,r;if(n.Site.Flags.IsDebug&&(f=this._checkDuplicate(e),f)){n.error("Duplicate binding detected - rejecting binding for "+this.element.selector+" -> "+t+".",f);return}if(this.binder.allBindings.push(e),this.delegatedElementSelector)this.element.on(u,this.delegatedElementSelector,function(n){t!=="scroll"?i(n):window.requestAnimationFrame(function(){return i(n)})});else{r=!1;this.element.on(u,function(n){t!=="scroll"?i(n):(r||window.requestAnimationFrame(function(){i(n);r=!1}),r=!0)})}},t.prototype._off=function(n){var r=this._getNamespacedEventName(n),t,i;for(this.delegatedElementSelector?this.element.off(r,this.delegatedElementSelector):this.element.off(r),t=this.binder.allBindings.length-1;t>=0;t--)i=this.binder.allBindings[t],i.element[0]===this.element[0]&&i.event.match(r)&&i.delegatedElementSelector===this.delegatedElementSelector&&this.binder.allBindings.splice(t,1)},t.prototype._checkDuplicate=function(n){for(var t,i=0,r=this.binder.allBindings.length;i<r;i++)if(t=this.binder.allBindings[i],n.callback.toString()===t.callback.toString()&&n.element[0]===t.element[0]&&n.event===t.event&&n.delegatedElementSelector===t.delegatedElementSelector)return t;return null},t.prototype._getNamespacedEventName=function(n){return n+"."+this.eventNamespace+".eventBinder"+this.binder.countId},t}()}(Bnet||(Bnet={})),function(n){var t;(function(t){var r=function(){function r(){this.registeredControls=[]}return r.prototype.add=function(n,t){var r=new i(n,t);this.registeredControls.push(r)},r.prototype.initializePages=function(){var i=this;this.createPagesForBody(function(n){n.initialize();n.addListeners();i.currentPage=n});t.currentArea&&!this.currentPage&&n.warn("Area registered but no pages initialized. No pages matched the body selectors specified.")},r.prototype.destroyPages=function(){this.foreachInitializedPage(function(n){n.destroy()})},r.prototype.createPagesForBody=function(n){for(var i,u,t=0,r=this.registeredControls.length;t<r;t++)i=this.registeredControls[t],$("body").is(i.requiredSelector)&&(u=i.initialize(),n(u))},r.prototype.foreachInitializedPage=function(n){for(var i,t=0,r=this.registeredControls.length;t<r;t++)i=this.registeredControls[t],i.initializedPage&&n(i.initializedPage)},r}(),i;t.PageInitialization=r;i=function(){function n(n,t){this.requiredSelector=n;this.pageInitializerClosure=t;this.initialized=null}return n.prototype.initialize=function(){return this.initialized=this.pageInitializerClosure(),this.initialized},Object.defineProperty(n.prototype,"initializedPage",{get:function(){return this.initialized},enumerable:!0,configurable:!0}),n}()})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t=function(){function t(){}return Object.defineProperty(t.prototype,"eventBinder",{get:function(){return n.currentArea.eventBinder},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){},t}();n.PageInitializer=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){this.newMessageBannerVisible=ko.observable(!1);this.gatedMedia=ko.observableArray();this.adultMode=ko.observable(!1);this.loggedInMembershipId=ko.observable("0");this.whoIsTyping=ko.observable("")}return t.prototype.reset=function(){this.newMessageBannerVisible(!1);this.gatedMedia([]);this.whoIsTyping("")},t.prototype.isHidden=function(t){var i=n.Utilities.Enumerable.firstIndexOf(this.gatedMedia(),function(n){return n===t});return i!==-1},t.prototype.hide=function(n){this.isHidden(n)||this.gatedMedia.push(n)},t.prototype.show=function(t){var i=n.Utilities.Enumerable.firstIndexOf(this.gatedMedia(),function(n){return n===t});i>=0&&this.gatedMedia.splice(i,1)},t.prototype.parseSubjectJSON=function(n){var t={};try{t=JSON.parse(n)}catch(i){}return t},t.prototype.isMe=function(t){return t.memberFromId===n.Utilities.User.loggedInUserBnetMembershipId},t.prototype.isConsecutive=function(n,t){var r=t(),u=r.indexOf(n);if(u>0){var i=r[u-1],s=i.memberFromId===n.memberFromId,f=moment(n.dateSent),e=moment(i.dateSent),o=f.add(-5,"m").isBefore(e);if(i.memberFromId===n.memberFromId&&o)return!0}return!1},t.prototype.isLastConsecutive=function(n,t){var f=this.isConsecutive(n,t),i,r,u;if(!f)return!0;if(i=t(),r=i.indexOf(n),i.length>r+1){if(u=i[r+1],u.memberFromId!==n.memberFromId)return!0}else return!0;return!1},t.prototype.getMemberLinkFromSubject=function(t){if(t===void 0&&(t=""),t!=="")try{var i=JSON.parse(t),r=i[0].membershipId,u=i[0].membershipType,f=i[0].displayName;return"/"+Localizer.CurrentCultureName+"/Profile/"+u+"/"+r+"/"+f}catch(e){return n.error("There was an error parsing JSON subject in a message, the offending string is: "+t),t}else return t},t.prototype.getClanLink=function(n){return"/"+Localizer.CurrentCultureName+"/ClanV2/MyFireteams?groupId="+n},t.prototype.formatBody=function(t,i,r,u){return u===void 0&&(u=""),t=n.Utilities.Parse.messageLinks(t,i,this.loggedInMembershipId(),this.adultMode(),r,this.isHidden(i)),t=n.Utilities.Parse.parseBBCode(t,!0,!0),t=bungieNetPlatform.linkHelper.injectLinks(t),this.replaceEmptyUser(t,u)},t.prototype.getDisplayName=function(t){var i=t.displayName;return t.cachedBungieGlobalDisplayNameCode&&(i=i+"#"+n.Utilities.User.StandardizeBungieGlobalCode(t.cachedBungieGlobalDisplayNameCode)),i},t.prototype.replaceEmptyUser=function(n,t){var u=n,e=t?this.parseSubjectJSON(t):null,i;if(e&&n.indexOf("[user]")>-1&&(i=e[0],i)){var o=Localizer.Platforms[i.membershipType.ToString()],f=i.displayName?i.displayName:"",s=f&&o?f+" ["+o+"]":"",r=i.bungieGlobalDisplayName,h=f&&r?" (Bnet: "+i.bungieGlobalDisplayName+")":r?r:"";(s||r)&&(u=u.replace("[user]",s+r))}return u},t}(),r;t.UIViewModel=i;r=function(){function t(t,r){var u=this;this.client=t;this.selectors=r;this.autoScrolling=!1;this.stickToBottom=!0;this.canSubmitMessage=!0;this.$textInput=null;this.eventBinder=new n.EventBinder("chatUI");this.viewModel=new i;t.onSubmitStarted=function(){return u.submitStartedEvent()};t.onSubmitStopped=function(n,t){return u.submitStoppedEvent(n,t)};t.onWhoIsTypingChanged=function(n){return u.whoIsTypingChanged(n)};t.onLoadingStarted=function(){return u.handleLoadingState(!0)};t.onLoadingComplete=function(){return u.handleLoadingState(!1)}}return t.prototype.getViewModel=function(){return this.viewModel},t.prototype.reset=function(){this.autoScrolling=!1;this.stickToBottom=!0;this.viewModel.reset()},t.prototype.destroy=function(){this.eventBinder.destroy()},t.prototype.addListeners=function(){var n=this,t;this.setupScrolling();t=$(this.selectors.stableParentElement);this.eventBinder.for($(this.selectors.newMessageBanner)).on("click",function(){return n.scrollToBottom()});if(!Modernizr.mobile)this.eventBinder.for(t,this.selectors.chatMessageEditArea).on("keydown",function(t){if(t.which!==13||t.shiftKey)n.client.sendTyping();else if(t.preventDefault(),n.canSubmitMessage){var i=$(t.currentTarget);i.parent().find(".error").remove();n.validateAndSubmitMessage(i,i.val())}});this.eventBinder.for(t,this.selectors.submitButton).on("click",function(i){i.preventDefault();var r=t.find(n.selectors.chatMessageEditArea);n.validateAndSubmitMessage(r,r.val())});this.eventBinder.for(t,this.selectors.showGatedButton).on("click",function(t){var i=$(t.currentTarget),r=i.closest("[data-messageId]").attr("data-messageId");n.viewModel.hide(r)});this.eventBinder.for(t,this.selectors.hideGatedButton).on("click",function(t){t.preventDefault();t.stopImmediatePropagation();var i=$(t.currentTarget),r=i.attr("data-messageId");n.viewModel.show(r)});this.eventBinder.for(t,this.selectors.lightboxedImageTrigger).on("click",function(n){var t=n.currentTarget;n.preventDefault();n.stopImmediatePropagation();Utility.showMediaLightBox('<img class="img_lightbox" src="'+t.src+'" alt="" /><br /><a class="extraContent" href="'+t.src+'">'+t.src+"<\/a>")})},t.prototype.adjustScrollPositionAfterLoadingNewBatch=function(){this.client.olderMessagesAdded>0?this.scrollToSamePosition():(this.viewModel.newMessageBannerVisible(!this.stickToBottom),this.stickToBottom&&(Modernizr.touch&&$(this.selectors.chatContainer).css("overflow","auto"),this.scrollToBottom()))},t.prototype.handleLoadingState=function(n){n?$(this.selectors.chatContainer).destinyLoader({delayBeforeAppear:100}):($(this.selectors.chatContainer).destinyLoader("stop"),this.adjustScrollPositionAfterLoadingNewBatch())},t.prototype.handleScrolling=function(){var n=$(this.selectors.chatContainer);n.scrollTop()+n.innerHeight()+5>n[0].scrollHeight?(this.stickToBottom=!0,this.viewModel.newMessageBannerVisible(!1)):this.autoScrolling||(this.stickToBottom=!1);this.autoScrolling||n.scrollTop()!==0||this.client.loadMessages(!0,!1);this.autoScrolling=!1},t.prototype.submitStartedEvent=function(){if(this.clearInputArea(this.$textInput),this.canSubmitMessage=!1,this.selectors.chatMessageEditAreaContainer!==undefined&&this.selectors.chatMessageEditAreaContainer!==null){var n=$(this.selectors.chatMessageEditAreaContainer);n.destinyLoader({delayBeforeAppear:300,size:30,startOnInit:!0})}},t.prototype.submitStoppedEvent=function(t,i){if(this.canSubmitMessage=!0,this.selectors.chatMessageEditAreaContainer!==undefined&&this.selectors.chatMessageEditAreaContainer!==null){var r=$(this.selectors.chatMessageEditAreaContainer);r.destinyLoader("stop")}t!==null&&(n.Utilities.Modals.Alert(t),$.trim(this.$textInput.val())===""&&this.$textInput.val(i.body))},t.prototype.clearInputArea=function(n){n.val("");setTimeout(function(){n.focus()},1)},t.prototype.validateAndSubmitMessage=function(n,t){(this.$textInput=n,n.val()!==""&&this.isValidInput(n))&&(this.stickToBottom=!0,this.client.submitMessage(t),this.scrollToBottom())},t.prototype.scrollToBottom=function(){this.autoScrolling=!0;$(this.selectors.chatContainer).scrollTop($(this.selectors.chatMessageList).height()*3)},t.prototype.scrollToSamePosition=function(){for(var i,t=0,r=this.client.viewModel.messages,n=0;n<this.client.olderMessagesAdded;n++)i=$(this.selectors.chatMessageList+" [data-messageId="+r()[n].messageId+"]"),t+=i.outerHeight();this.client.olderMessagesAdded=0;this.autoScrolling=!0;$(this.selectors.chatContainer).scrollTop(t)},t.prototype.isValidInput=function(t){var f=this,i=n.Utilities.Validation.getErrors(t),u,r;if(i.length>0){for(u=function(n){var t=i[n].element,u=t.attr("data-errorMessage-"+i[n].type),e=t.get(0),r;$(".error").filter(function(){return $(f).data("for").get(0)===e}).length<1&&(r=$('<span class="error">'+u+"<\/span>"),t.focus().before(r),r.data("for",t))},r=0;r<i.length;r++)u(r);return!1}return!0},t.prototype.setupScrolling=function(){var t=this,n=$(this.selectors.chatContainer);this.eventBinder.for(n).on("scroll",function(){return t.handleScrolling()});n.customScroll({forcePreventBodyScroll:!0})},t.prototype.whoIsTypingChanged=function(n){viewModels.clanChatViewModel.chatUI().whoIsTyping(this.buildWhoIsTyping(n))},t.prototype.buildWhoIsTyping=function(n){var t="";switch(n.length){case 0:break;case 1:t=Localizer.Format(Localizer.Community.useristyping,{user:n[0].displayName});break;case 2:t=Localizer.Format(Localizer.Community.twousersaretyping,{user1:n[0].displayName,user2:n[1].displayName});break;case 3:t=Localizer.Format(Localizer.Community.threeusersaretyping,{user1:n[0].displayName,user2:n[1].displayName,user3:n[2].displayName});break;default:t=Localizer.Community.moreusersaretyping}return t},t}();t.ChatUI=r})(t=n.Chat||(n.Chat={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(t,i){this.client=t;this.params=i;this.eventBinder=new n.EventBinder("chatUI");this.stickToBottom=!0;this.autoScrolling=!1;this.canSubmitMessage=!0;this.messageListHeight=0;this.lastMessageCount=0;this.editorViewModel={textareaValue:"",showEditor:!1};this.chatViewModel={client:this.client.viewModel,newMessageBannerVisible:!1,gatedMedia:[],whoIsTyping:"",selfIsAdmin:!1}}return t.prototype.initialize=function(){this.vueInit();this.addListeners()},t.prototype.destroy=function(){this.eventBinder.destroy()},t.prototype.vueInit=function(){var t=this;this.chatVue=new Vue({data:this.chatViewModel,el:this.params.$conversationContainerElement[0],methods:{toggleGated:function(n){return t.toggleGated(n)},openLightbox:function(n){return t.openLightbox(n)},formatBody:function(n){return t.formatBody(n)},isMe:function(n){return t.isMe(n)},isConsecutive:function(n){return t.isConsecutive(n)},isLastConsecutive:function(n){return t.isLastConsecutive(n)},getUserProfileUrl:function(n){return t.getUserProfileUrl(n)},getTimestamp:function(n){return t.getMessageTimestamp(n)},getTimestampAgo:function(n){return t.getMessageTimestampAgo(n)},isWithinTimeThreshold:function(n){return t.isWithinTimeThreshold(n)},isVideo:function(t){return n.Utilities.Parse.messageIsVideo(t.body)},scrollToBottom:function(){return t.scrollToBottom()},onScroll:function(){return t.handleScrolling()},report:function(n){return t.report(n)},moderate:function(){return t.moderate()}}});this.editVue=new Vue({el:this.params.$editContainerElement[0],data:this.editorViewModel,methods:{onTextareaKeydown:function(n){return t.onTextareaKeydown(n)},submitMessage:function(){return t.submitMessage()}}})},t.prototype.showEditor=function(){this.editorViewModel.showEditor=!0},t.prototype.addListeners=function(){var n=this;this.client.subscribe({updateType:"onSubmitStarted",onUpdate:function(){return n.submitStartedEvent()}});this.client.subscribe({updateType:"onSubmitStopped",onUpdate:function(t){return n.submitStoppedEvent(t)}});this.client.subscribe({updateType:"onWhoIsTypingChanged",onUpdate:function(t){return n.whoIsTypingChanged(t)}});this.client.subscribe({updateType:"onLoadingStarted",onUpdate:function(){return n.handleLoadingState(!0)}});this.client.subscribe({updateType:"onLoadingComplete",onUpdate:function(){return n.handleLoadingState(!1)}})},t.prototype.handleScrolling=function(){var n=$(this.params.chatContainerSelector);n.scrollTop()+n.innerHeight()+5>n[0].scrollHeight?(this.stickToBottom=!0,this.chatViewModel.newMessageBannerVisible=!1):this.autoScrolling||(this.stickToBottom=!1);this.autoScrolling||n.scrollTop()!==0||this.client.loadMessages(!1,!0,!1);this.autoScrolling=!1},t.prototype.validateAndSubmitMessage=function(n){this.isValidInput(n)&&(this.stickToBottom=!0,this.client.submitMessage(this.editorViewModel.textareaValue),this.scrollToBottom())},t.prototype.scrollToBottom=function(){this.autoScrolling=!0;var n=$(this.params.chatContainerSelector);n.scrollTop(n[0].scrollHeight)},t.prototype.isValidInput=function(t){var f=this,i=n.Utilities.Validation.getErrors(t),u,r;if(i.length>0){for(u=function(n){var t=i[n].element,u=t.attr("data-errorMessage-"+i[n].type),e=t.get(0),r;$(".error").filter(function(){return $(f).data("for").get(0)===e}).length<1&&(r=$('<span class="error">'+u+"<\/span>"),t.focus().before(r),r.data("for",t))},r=0;r<i.length;r++)u(r);return!1}return!0},t.prototype.onTextareaKeydown=function(n){if(n.which!==13||n.shiftKey)this.client.sendTyping();else if(n.preventDefault(),this.canSubmitMessage){var t=$(n.currentTarget);t.parent().find(".error").remove();this.submitMessage(t)}},t.prototype.submitMessage=function(n){n===void 0&&(n=null);n=n||$(this.params.$editContainerElement.selector).find(this.params.inputSelector);this.validateAndSubmitMessage(n)},t.prototype.toggleGated=function(t){var i=n.Utilities.Enumerable.firstIndexOf(this.chatViewModel.gatedMedia,function(n){return n===t});i>=0?this.chatViewModel.gatedMedia.splice(i,1):this.chatViewModel.gatedMedia.push(t)},t.prototype.openLightbox=function(n){var t=n.currentTarget;Utility.showMediaLightBox('<img class="img_lightbox" src="'+t.src+'" alt="" /><br /><a class="extraContent" href="'+t.src+'">'+t.src+"<\/a>")},t.prototype.formatBody=function(t){var u=t.body,r=t.messageId,o=t.subject,f=this.client.viewModel.users[t.memberFromId],e=this.chatViewModel.gatedMedia.indexOf(r)>-1,i=n.Utilities.Parse.messageLinks(u,r,n.Utilities.User.loggedInUserBnetMembershipId,!1,f,e);return i=n.Utilities.Parse.parseBBCode(i,!0,!0),n.Utilities.Url.correctExternalLinks(i,!0)},t.prototype.isMe=function(n){return n.memberFromId===this.chatViewModel.client.signedInUser.membershipId},t.prototype.isWithinTimeThreshold=function(n){var t=this.client.viewModel.messages,i=t.indexOf(n);if(i>0){var r=t[i-1],u=moment(n.dateSent),f=moment(r.dateSent);return u.add(-5,"m").isBefore(f)}return!1},t.prototype.isConsecutive=function(n){var t=this.client.viewModel.messages,i=t.indexOf(n),r,u;return i>0&&(r=t[i-1],u=this.isWithinTimeThreshold(n),r.memberFromId===n.memberFromId&&u)?!0:!1},t.prototype.isLastConsecutive=function(n){var t=this.client.viewModel.messages,i=t.indexOf(n),r;if(t.length>i+1){if(r=t[i+1],r.memberFromId!==n.memberFromId)return!0}else return!0;return!1},t.prototype.getMessageTimestamp=function(n){return moment(n.dateSent).local().format("h:mma, ddd MMM Do, YYYY")},t.prototype.getMessageTimestampAgo=function(n){var t=moment(n.dateSent);return moment().subtract("7","days").isBefore(t)?moment(n.dateSent).fromNow():this.getMessageTimestamp(n)},t.prototype.getUserProfileUrl=function(n){return PageUrls.profilePage+"/254/"+n},t.prototype.buildWhoIsTyping=function(n){var t="";switch(n.length){case 0:break;case 1:t=Localizer.Format(Localizer.Community.useristyping,{user:n[0].displayName});break;case 2:t=Localizer.Format(Localizer.Community.twousersaretyping,{user1:n[0].displayName,user2:n[1].displayName});break;case 3:t=Localizer.Format(Localizer.Community.threeusersaretyping,{user1:n[0].displayName,user2:n[1].displayName,user3:n[2].displayName});break;default:t=Localizer.Community.moreusersaretyping}return t},t.prototype.adjustScrollPositionAfterLoadingNewBatch=function(){var n=this;Vue.nextTick(function(){n.client.olderMessagesAdded>0?n.scrollToSamePosition():(n.chatViewModel.newMessageBannerVisible=!n.stickToBottom&&n.lastMessageCount<n.client.viewModel.messages.length,n.stickToBottom&&(Modernizr.touch&&$(n.params.chatContainerSelector).css("overflow","auto"),n.scrollToBottom()))})},t.prototype.scrollToSamePosition=function(){var n=$(this.params.chatContainerSelector),t=this.messageListHeight,i=n[0].scrollHeight,r=i-t;n.scrollTop(r)},t.prototype.submitStartedEvent=function(){this.editorViewModel.textareaValue="";this.canSubmitMessage=!1;$(this.params.messageLoadingElementSelector).destinyLoader({delayBeforeAppear:300,size:30,startOnInit:!0})},t.prototype.submitStoppedEvent=function(t){this.canSubmitMessage=!0;$(this.params.messageLoadingElementSelector).destinyLoader("stop");t.error!==null&&(n.Utilities.Modals.Alert(t.error),t.originalInput&&$.trim(this.editorViewModel.textareaValue)===""&&(this.editorViewModel.textareaValue=t.originalInput.body))},t.prototype.whoIsTypingChanged=function(n){this.chatViewModel.whoIsTyping=this.buildWhoIsTyping(n.typers)},t.prototype.handleLoadingState=function(n){n?$(this.params.chatContainerSelector).destinyLoader({delayBeforeAppear:100}):($(this.params.chatContainerSelector).destinyLoader("stop"),this.adjustScrollPositionAfterLoadingNewBatch());this.messageListHeight=$(this.params.chatContainerSelector)[0].scrollHeight;n||(this.lastMessageCount=this.client.viewModel.messages.length)},t.prototype.report=function(t){n.Utilities.User.reportMessage(t,null)},t.prototype.moderate=function(){},t}();t.ChatUIVue=i})(t=n.Chat||(n.Chat={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function n(n){this.conversationId=n;this.messages=ko.observableArray();this.users={};this.newConversationParticipantsMembershipIds=[];this.userCount=ko.observable(0);this.isLoadingOlder=ko.observable(!1);this.isSending=ko.observable(!1);this.userNotificationPreference=ko.observable(!1)}return n.prototype.reset=function(){this.messages([]);this.users={};this.newConversationParticipantsMembershipIds=[]},n.prototype.updateUserCount=function(){this.userCount(Object.keys(this.users).length)},n.prototype.isConsecutive=function(n){console.log(n)},n}(),r;t.ChatViewModel=i;r=function(){function r(n,r){r===void 0&&(r="-1");var u=this;this.signedInUser=n;this.conversationId=r;this.loading=!1;this.hasMoreOlder=!0;this.reloadWhenDone=!1;this.autoReloadCount=0;this.lastTyping=0;this.PlaceholderMessageID="p";this.whoIsTypingManager=new t.WhoIsTypingManager;this.newMessageLength=0;this.olderMessagesAdded=0;this.onWhoIsTypingChanged=null;this.onConversationCreated=null;this.whoIsTypingManager.whoIsTypingChanged=function(n){if(u.onWhoIsTypingChanged!=null)u.onWhoIsTypingChanged(n)};this.viewModel=new i(this.conversationId)}return Object.defineProperty(r.prototype,"isExistingConversation",{get:function(){return this.conversationId!=="-1"},enumerable:!0,configurable:!0}),r.prototype.reset=function(){this.loading=!1;this.hasMoreOlder=!0;this.reloadWhenDone=!1;this.autoReloadCount=0;this.newMessageLength=0;this.olderMessagesAdded=0;this.viewModel.reset()},r.prototype.start=function(){this.addEventMuxSubscriptions();this.viewModel.conversationId&&this.loadMessages(!1,!1)},r.prototype.destroy=function(){n.EventMux.unsubscribe(this.conversationChangeSubscription);n.EventMux.unsubscribe(this.typingSubscription)},r.prototype.addEventMuxSubscriptions=function(){var t=this;this.conversationChangeSubscription=n.EventMux.subscribe({eventType:Globals.RealTimeEventType.ConversationChanged,onUpdate:function(n){var i=n.update;parseInt(t.viewModel.conversationId,10)===parseInt(i.conversationId,10)&&t.loadMessages(!1,!0)}});this.typingSubscription=n.EventMux.subscribe({eventType:Globals.RealTimeEventType.Typing,onUpdate:function(n){var i=n.update;parseInt(t.viewModel.conversationId,10)===parseInt(i.conversationId,10)&&t.whoIsTypingManager.addTyper(i.whoIsTyping)}})},r.prototype.sendTyping=function(){var n=(new Date).getTime(),t;n-this.lastTyping>5e3&&(this.lastTyping=n,t={conversationId:this.conversationId},bungieNetPlatform.messageService.UserIsTyping(t,function(){},function(){}))},r.prototype.onSubmitMessageStarted=function(){this.lastTyping=0;this.viewModel.isSending(!0);this.onSubmitStarted!=null&&this.onSubmitStarted()},r.prototype.onSubmitMessageStopped=function(n,t){if(this.viewModel.isSending(!1),this.onSubmitStopped!=null)this.onSubmitStopped(n,t)},r.prototype.submitMessage=function(n){var i=this,t;if(!this.viewModel.isSending()||n!==""){if(this.onSubmitMessageStarted(),!this.isExistingConversation){this.createConversation(n);return}this.addMessageLocally(n);t={body:n,subject:"",conversationId:this.viewModel.conversationId};bungieNetPlatform.messageService.SaveMessageV4(t,function(){return i.onSubmitMessageStopped(null,null)},function(n){return i.onSubmitMessageStopped(n,t)})}},r.prototype.createConversation=function(t){var i=this;bungieNetPlatform.messageService.CreateConversationV2({body:t,membersToId:this.viewModel.newConversationParticipantsMembershipIds.concat([n.Utilities.User.loggedInUserBnetMembershipId]),subject:""},function(n){return i.onSuccessfulConversationCreation(n)},function(n){return i.onFailureToStartConversation(n)})},r.prototype.onSuccessfulConversationCreation=function(n){this.viewModel.conversationId=n.conversationId;this.onSubmitMessageStopped(null,null);this.onConversationCreated(n);this.reset();this.start()},r.prototype.onFailureToStartConversation=function(n){this.onSubmitMessageStopped(n,null)},r.prototype.addMessageLocally=function(t){this.viewModel.users[this.signedInUser.membershipId]=this.signedInUser;var i={messageId:this.PlaceholderMessageID,conversationId:"0",dateSent:moment().format("YYYY-MM-DDTHH:mm:ssZ"),subject:"",body:n.Utilities.String.htmlEncode(t),isAutoResponse:!1,memberFromId:this.signedInUser.membershipId,isDeleted:!1,fromServer:!1,folderId:null,systemId:null,invitationId:null};this.viewModel.messages.push(i)},r.prototype.startLoading=function(n){this.loading=!0;this.onLoadingStarted&&this.onLoadingStarted();this.viewModel.isLoadingOlder(n)},r.prototype.onLoadingStopped=function(){this.loading=!1;this.viewModel.isLoadingOlder(!1);this.onLoadingComplete&&this.onLoadingComplete()},r.prototype.getOldestMessageId=function(){for(var n="9223372036854775807",i=this.viewModel.messages(),t=0;t<i.length;t++)if(n=i[t].messageId,n!==this.PlaceholderMessageID)break;return n},r.prototype.getNewestMessageId=function(){for(var n="0",i=this.viewModel.messages(),t=i.length-1;t>=0;t--)if(n=i[t].messageId,n!==this.PlaceholderMessageID)break;return n},r.prototype.loadMessages=function(n,t){var u=this,r,i,f;if(this.loading){this.reloadWhenDone=t;return}if(r="9223372036854775807",i="0",n){if(!this.hasMoreOlder)return;r=this.getOldestMessageId()}else i=this.getNewestMessageId();this.startLoading(n);f=this.viewModel.conversationId;bungieNetPlatform.messageService.GetConversationThreadV3(f,1,0,r,i==="p"?"0":i,function(t){return u.onMessagesLoaded(n,i,t)},function(){return u.onLoadingStopped()})},r.prototype.onMessagesLoaded=function(n,t,i){var u,r;if(n&&(this.olderMessagesAdded=i.results.length),this.newMessageLength=this.viewModel.messages().length+i.results.length,this.viewModel.users=$.extend(this.viewModel.users,i.users),this.viewModel.updateUserCount(),this.viewModel.userNotificationPreference(i.userNotificationPreference),u=this.viewModel.messages,n)for(this.hasMoreOlder=i.hasMore,r=0;r<i.results.length;r++)u.unshift(this.markAsFromServer(i.results[r]));else{for(this.removePlaceholderMessages(u),r=i.results.length-1;r>=0;r--)this.removeTyper(i.results[r].memberFromId),u.push(this.markAsFromServer(i.results[r]));i.hasMore&&t!=="0"&&(this.reloadWhenDone=!0)}this.reloadWhenDone?(this.reloadWhenDone=!1,this.autoReloadCount++,this.autoReloadCount<20?this.loadMessages(n,!1):this.autoReloadCount=0):this.autoReloadCount=0;this.onLoadingStopped()},r.prototype.removeTyper=function(n){n!=="0"&&typeof this.viewModel.users[n]!="undefined"&&this.whoIsTypingManager.removeTyper(this.viewModel.users[n].displayName)},r.prototype.markAsFromServer=function(n){return n.fromServer=!0,n},r.prototype.removePlaceholderMessages=function(n){while(n().length>0&&!n()[n().length-1].fromServer)n.pop()},r}();t.Client=r})(t=n.Chat||(n.Chat={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var i=function(n){function t(t,i){var r=n.call(this,t)||this;return r.error=null,r.originalInput=null,r.typers=null,r.result=null,i&&(r.error=i.error||null,r.originalInput=i.originalInput||null,r.typers=i.typers||null,r.result=i.result||null),r}return __extends(t,n),t}(n.Site.SubscriptionPayload),r,u;t.ChatClientPayload=i;r=function(n){function t(t,i){return n.call(this,t,i)||this}return __extends(t,n),t}(n.Site.Subscription);u=function(u){function f(){var n=u.call(this,r)||this;return n._viewModel={messages:[],users:{},newConversationParticipantsMembershipIds:[],isLoadingOlder:!1,isSending:!1,signedInUser:null,userNotificationPreference:!1},n._vmReset=$.extend({},n._viewModel),n.loading=!1,n.hasMoreOlder=!0,n.reloadWhenDone=!1,n.autoReloadCount=0,n.PlaceholderMessageID="p",n.lastTyping=0,n.whoIsTypingManager=new t.WhoIsTypingManager,n.newMessageLength=0,n.olderMessagesAdded=0,n}return __extends(f,u),Object.defineProperty(f.prototype,"viewModel",{get:function(){return this._viewModel},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isExistingConversation",{get:function(){return this.conversationId!==null},enumerable:!0,configurable:!0}),f.prototype.reset=function(){this.destroy();this.loading=!1;this.hasMoreOlder=!0;this.reloadWhenDone=!1;this.autoReloadCount=0;this.newMessageLength=0;this.olderMessagesAdded=0;for(var n in this._viewModel.users)this._viewModel.users.hasOwnProperty(n)&&Vue.delete(this._viewModel.users,n);this._viewModel.messages.splice(0,this._viewModel.messages.length);this._viewModel.newConversationParticipantsMembershipIds.splice(0,this._viewModel.newConversationParticipantsMembershipIds.length);this._viewModel.isLoadingOlder=!1;this._viewModel.isSending=!1;this._viewModel.userNotificationPreference=!1},f.prototype.start=function(n){n===void 0&&(n=null);this.reset();this.viewModel.signedInUser=ko.mapping.toJS(viewModels.loggedInUserModel().user);this.conversationId=n;this.addEventMuxSubscriptions();this.conversationId&&this.loadMessages(!0,!1,!1)},f.prototype.destroy=function(){n.EventMux.unsubscribe(this.conversationChangeSubscription);n.EventMux.unsubscribe(this.typingSubscription)},f.prototype.loadMessages=function(n,t,i){var f=this,u,r;if(this.loading){this.reloadWhenDone=i;return}if(u="9223372036854775807",r="0",!n)if(t){if(!this.hasMoreOlder)return;u=this.getOldestMessageId()}else r=this.getNewestMessageId();this.startLoading(t);bungieNetPlatform.messageService.GetConversationThreadV3(this.conversationId,1,0,u,r==="p"?"0":r,function(n){return f.onMessagesLoaded(t,r,n)},function(){return f.onLoadingStopped()})},f.prototype.submitMessage=function(n){var i=this,t;if(!this.viewModel.isSending||n!==""){if(this.onSubmitMessageStarted(),!this.isExistingConversation){this.createConversation(n);return}this.addMessageLocally(n);t={body:n,subject:"",conversationId:this.conversationId};bungieNetPlatform.messageService.SaveMessageV4(t,function(){return i.onSubmitMessageStopped(null,null)},function(n){return i.onSubmitMessageStopped(n,t)})}},f.prototype.sendTyping=function(){var n=(new Date).getTime(),t;n-this.lastTyping>5e3&&(this.lastTyping=n,t={conversationId:this.conversationId},bungieNetPlatform.messageService.UserIsTyping(t,function(){},function(){}))},f.prototype.addEventMuxSubscriptions=function(){var t=this;this.conversationChangeSubscription=n.EventMux.subscribe({eventType:Globals.RealTimeEventType.ConversationChanged,onUpdate:function(n){var i=n.update;t.conversationId===i.conversationId&&t.loadMessages(!1,!1,!0)}});this.typingSubscription=n.EventMux.subscribe({eventType:Globals.RealTimeEventType.Typing,onUpdate:function(n){var i=n.update;t.conversationId===i.conversationId&&t.whoIsTypingManager.addTyper(i.whoIsTyping)}})},f.prototype.onMessagesLoaded=function(t,i,r){var f,u,o,e;if(t&&(this.olderMessagesAdded=r.results.length),this.newMessageLength=this._viewModel.messages.length+r.results.length,this._viewModel.users=$.extend(this._viewModel.users,r.users),this._viewModel.userNotificationPreference=r.userNotificationPreference,f=this._viewModel.messages,t)for(this.hasMoreOlder=r.hasMore,u=0;u<r.results.length;u++)f.unshift(this.markAsFromServer(r.results[u]));else{for(this.removePlaceholderMessages(f),o=function(){var t=r.results[u],i;e.removeTyper(t.memberFromId);i=n.Utilities.Enumerable.any(f,function(n){return n.messageId===t.messageId});i||f.push(e.markAsFromServer(t))},e=this,u=r.results.length-1;u>=0;u--)o();r.hasMore&&i!=="0"&&(this.reloadWhenDone=!0)}this.reloadWhenDone?(this.reloadWhenDone=!1,this.autoReloadCount++,this.autoReloadCount<20?this.loadMessages(!1,t,!1):this.autoReloadCount=0):this.autoReloadCount=0;this.onLoadingStopped()},f.prototype.addMessageLocally=function(t){this.viewModel.users[this.viewModel.signedInUser.membershipId]=this.viewModel.signedInUser;var i={messageId:this.PlaceholderMessageID,conversationId:"0",dateSent:moment().format("YYYY-MM-DDTHH:mm:ssZ"),subject:"",body:n.Utilities.String.htmlEncode(t),isAutoResponse:!1,memberFromId:this.viewModel.signedInUser.membershipId,isDeleted:!1,fromServer:!1,folderId:null,systemId:null,invitationId:null};this.viewModel.messages.push(i)},f.prototype.startLoading=function(n){this.loading=!0;this.broadcast("onLoadingStarted");this._viewModel.isLoadingOlder=n},f.prototype.onLoadingStopped=function(){this.loading=!1;this._viewModel.isLoadingOlder=!1;this.broadcast("onLoadingComplete")},f.prototype.onSubmitMessageStopped=function(n,t){this.viewModel.isSending=!1;this.broadcast("onSubmitStopped",{error:n,originalInput:t})},f.prototype.onSubmitMessageStarted=function(){this.lastTyping=0;this.viewModel.isSending=!0;this.broadcast("onSubmitStarted")},f.prototype.onSuccessfulConversationCreation=function(n){this.conversationId=n.conversationId;this.onSubmitMessageStopped(null,null);this.broadcast("onConversationCreated",{result:n});this.start(n.conversationId)},f.prototype.onFailureToStartConversation=function(n){this.onSubmitMessageStopped(n,null)},f.prototype.getOldestMessageId=function(){for(var n="9223372036854775807",i=this._viewModel.messages,t=0,r=i.length;t<r;t++)if(n=i[t].messageId,n!==this.PlaceholderMessageID)break;return n},f.prototype.getNewestMessageId=function(){for(var n="0",i=this._viewModel.messages,t=i.length-1;t>=0;t--)if(n=i[t].messageId,n!==this.PlaceholderMessageID)break;return n},f.prototype.removeTyper=function(n){n!=="0"&&typeof this._viewModel.users[n]!="undefined"&&this.whoIsTypingManager.removeTyper(this._viewModel.users[n].displayName)},f.prototype.markAsFromServer=function(n){return n.fromServer=!0,n},f.prototype.removePlaceholderMessages=function(n){while(n.length>0&&!n[n.length-1].fromServer)n.pop()},f.prototype.createConversation=function(t){var i=this;bungieNetPlatform.messageService.CreateConversationV2({body:t,membersToId:this.viewModel.newConversationParticipantsMembershipIds.concat([n.Utilities.User.loggedInUserBnetMembershipId]),subject:""},function(n){return i.onSuccessfulConversationCreation(n)},function(n){return i.onFailureToStartConversation(n)})},f.prototype.getPayloadsToUpdate=function(n,t){for(var u,f=[],r=0,e=this.subscriptions;r<e.length;r++)u=e[r],u.params.updateType===n&&f.push(new i(u,t));return f},f.prototype.broadcast=function(n,t){var i=this.getPayloadsToUpdate(n,t);this.updateSubscriptions(i)},f}(n.Site.Subscribable);t.ClientVue=u})(t=n.Chat||(n.Chat={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var r=function(t){function i(n){var i=t.call(this,"ModerateChatModal",n)||this;return i.isReporter=viewModels.isReporter(),i.includeCloseButton=!1,i}return __extends(i,t),i.openReportModal=function(n,t,i){var f=$("#reportChatModal-template").html(),r;f!=null&&(r=new u(f,n,t,i),r.open(),r.addListenersForModal())},i.openModerateModal=function(n,t){var r=$("#moderateChatModal-template").html(),i;r!=null&&(i=new f(r,n,t),i.open(),i.addListenersForModal())},i.prototype.addListenersForModal=function(){var n=this;this.eventBinder.forDocument(".btn_cancel").on("click",function(){n.close()})},i.prototype.applyBanHistory=function(t,i){var r=this;t.html(Localizer.Helptext.adminloadingdisciplinehistory);bungieNetPlatform.adminService.GetRecentDisciplineAndFlagHistoryForMember(i,7,function(n){for(var i,e,u="",f=0;f<n.results.length;f++)i=n.results[f],e=new Date(i.dateResolved),u+="<strong>"+e.toLocaleDateString()+" "+e.toLocaleTimeString()+"<\/strong>: "+r.getLocalizedReportResult(i.result)+" on a "+r.getLocalizedReportItemType(i.reportedItemType)+" for "+Localizer.Mute[i.reason],u+=i.banDurationInDays>0&&i.banDurationInDays<1e6?" ("+i.banDurationInDays+" day ban).<br />":".<br />";u===""&&(u=Localizer.Helptext.adminnodisciplinehistoryfound);t.html(u)},function(t){n.Utilities.Modals.Alert(Localizer.Helptext.adminerrordisciplinehistory+" "+t.errorMessage)})},i.prototype.getLocalizedReportResult=function(n){var t="";switch(n){case Globals.ReportResolutionStatus.Unresolved:t=Localizer.Helptext.reportresolutionstatusunresolved;break;case Globals.ReportResolutionStatus.Innocent:t=Localizer.Helptext.reportresolutionstatusinnocent;break;case Globals.ReportResolutionStatus.GuiltyBan:t=Localizer.Helptext.reportresolutionstatusguiltyban;break;case Globals.ReportResolutionStatus.GuiltyBlastBan:t=Localizer.Helptext.reportresolutionstatusguiltyblastban;break;case Globals.ReportResolutionStatus.GuiltyWarn:t=Localizer.Helptext.reportresolutionstatusguiltywarn;break;case Globals.ReportResolutionStatus.GuiltyAlias:t=Localizer.Helptext.reportresolutionstatusguiltyalias;break;case Globals.ReportResolutionStatus.ResolveNoAction:t=Localizer.Helptext.reportresolutionstatusresolvenoaction;break;default:t=Localizer.Helptext.reportresolutionstatusunknown}return t},i.prototype.getLocalizedReportItemType=function(n){var t="";switch(n){case Globals.IgnoredItemType.Post:t=Localizer.Helptext.ignoreditemtypepost;break;case Globals.IgnoredItemType.Group:t=Localizer.Helptext.ignoreditemtypegroup;break;case Globals.IgnoredItemType.User:t=Localizer.Helptext.ignoreditemtypeuser;break;case Globals.IgnoredItemType.Tag:t=Localizer.Helptext.ignoreditemtypetag;break;case Globals.IgnoredItemType.GroupProfile:t=Localizer.Helptext.ignoreditemtypegroupprofile;break;case Globals.IgnoredItemType.UserProfile:t=Localizer.Helptext.ignoreditemtypeuserprofile;break;case Globals.IgnoredItemType.UserPrivateMessage:t=Localizer.Helptext.ignoreditemtypeuserprivatemessage;break;case Globals.IgnoredItemType.GroupWallPost:t=Localizer.Helptext.ignoreditemtypegroupwallpost;break;case Globals.IgnoredItemType.PrivateMessage:t=Localizer.Helptext.ignoreditemtypeprivatemessage;break;default:t=Localizer.Helptext.ignoreditemtypeunknown}return t},i}(n.Modal),u,f,i;t.ModerateModal=r;u=function(t){function r(n,i,r,u){var f=t.call(this,n)||this;return f.membershipId=i,f.messageText=r,f.messageId=u,f.setupModalContent(n,i,r,u),f}return __extends(r,t),r.prototype.setupModalContent=function(n,t){this.isReporter&&this.applyBanHistory($(".banHistoryElement"),t)},r.prototype.addListenersForModal=function(){var r=this;t.prototype.addListenersForModal.call(this);this.eventBinder.forDocument(".btn_msgreport").on("click",function(){var t=new n.UiKit.FormKit.DropdownItem("msgreport_reason").val(),u=r.isReporter?new n.UiKit.FormKit.DropdownItem("mod_punishment").val():null;i.report(t,"",u,!1,r.membershipId,r.messageText,r.messageId,function(){});r.close()})},r}(r);t.ReportMessageModal=u;f=function(n){function t(t,i,r){var u=n.call(this,t)||this;return u.groupId=i,u.messageId=r,u.setModalContent(i,r),u}return __extends(t,n),t.prototype.setModalContent=function(){},t.prototype.addListenersForModal=function(){var t=this;n.prototype.addListenersForModal.call(this);this.eventBinder.forDocument(".btn_groupWallModerate").on("click",function(n){n.preventDefault();i.moderate(t.groupId,t.messageId,function(){$("li[data-messageId="+t.messageId+"]").hide()});t.close()})},t}(r);t.ModerateMessageModal=f;i=function(){function t(){}return t.report=function(t,i,r,u,f,e,o,s){var h={ignoredItemId:o,ignoredItemType:Globals.IgnoredItemType.GroupWallPost,comment:i,reason:t,itemContextId:o,itemContextType:Globals.IgnoredItemType.GroupWallPost,requestedPunishment:r,requestedBlastBan:u};bungieNetPlatform.ignoreService.FlagItem(h,function(){n.Utilities.Modals.Alert(Localizer.Community.thankyouforyourwallreport);s()},function(t){n.Utilities.Modals.Alert(t)})},t.moderate=function(t,i,r){bungieNetPlatform.messageService.ModerateGroupWall(t,i,function(){r()},function(t){n.Utilities.Modals.Alert(t)})},t}();t.ModerateModalActions=i})(t=n.Chat||(n.Chat={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){this.maxTypers=10;this.typingFrequency=5e3;this.activeTimerId=0;this.typers=[];this.whoIsTypingChanged=null}return t.prototype.addTyper=function(t){var f=this,i=!1,r=(new Date).getTime(),u=n.Utilities.Enumerable.firstIndexOf(this.typers,function(n){return n.displayName===t});u>=0?this.typers[u].lastTyping=r:this.typers.length<this.maxTypers&&(this.typers.push({displayName:t,lastTyping:r}),i=!0);this.removeOldTypers()&&(i=!0);i&&this.onWhoIsTypingChanged();this.activeTimerId===0&&(this.activeTimerId=setInterval(function(){f.processWhoIsTypingTimeout()},1e3))},t.prototype.removeTyper=function(t){var i=n.Utilities.Enumerable.firstIndexOf(this.typers,function(n){return n.displayName===t});i>=0&&(this.typers.splice(i,1),this.onWhoIsTypingChanged())},t.prototype.processWhoIsTypingTimeout=function(){this.removeOldTypers()&&this.onWhoIsTypingChanged();this.typers.length===0&&(clearTimeout(this.activeTimerId),this.activeTimerId=0)},t.prototype.onWhoIsTypingChanged=function(){this.whoIsTypingChanged!=null&&this.whoIsTypingChanged(this.typers)},t.prototype.removeOldTypers=function(){for(var n=0,t=!1,i=(new Date).getTime()-(this.typingFrequency+1e3);n<this.typers.length;)this.typers[n].lastTyping<i?(this.typers.splice(n,1),t=!0):n++;return t},t}();t.WhoIsTypingManager=i})(t=n.Chat||(n.Chat={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(){var n=this;this.logging=!0;this.lastSeqStored=0;this.storageValues={OverlordTabReplaced:0};this.log=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};this.warn=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};this.error=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};this.disableLogging=function(){n.log=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.warn=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.error=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]}}}return i.prototype.initialize=function(){if(this.logging&&this.bindLogging(),Modernizr.localstorage||i.error("Cannot instantiate - localStorage is not available!"),this.storage=new t.Storage,this.subManager=new t.SubManager,!this.isAuthed){n.warn("User is not authenticated. Resetting and disabling");this.storage.destroy();return}this.tabManager=new t.TabManager},i.prototype.isCurrentTabOverlord=function(){return this.tabManager.isCurrentTabOverlord()},i.prototype.subscribe=function(n){return this.subManager?this.subManager.subscribe(n):(i.error("EventMux not instantiated - cannot subscribe"),null)},i.prototype.unsubscribe=function(n){this.subManager.unsubscribe(n)},Object.defineProperty(i.prototype,"isAuthed",{get:function(){return n.Utilities.User.isAuthenticated},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isActive",{get:function(){return this.tabManager.isActive()},enumerable:!0,configurable:!0}),i.prototype.bindLogging=function(){this.log=Function.prototype.bind.call(n.base_verbose,console,"EventMux: ");this.warn=Function.prototype.bind.call(n.base_warn,console,"EventMux: ");this.error=Function.prototype.bind.call(n.base_error,console,"EventMux: ")},i.Instance=new i,i.log=Function.prototype.bind.call(i.Instance.log,console),i.warn=Function.prototype.bind.call(i.Instance.warn,console),i.error=Function.prototype.bind.call(i.Instance.error,console),i}();t.eventMuxInstance=i.Instance})(t=n.RealTime||(n.RealTime={}))}(Bnet||(Bnet={})),function(n){n.EventMux=n.RealTime.eventMuxInstance}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(n,t){this.tabId=n;this.tabReplacedCallback=t;this.requestTimeout=ServerVars.RealTimeHeartBeat||90;this.ackNext=0;this.failures=0;this.getRequested=!1;this.isReplaced=!1;this.errorTimeoutLeeway=5;this.errorTimeoutReductionAmount=10;this.pendingGets=0;this.failureTimer=null;this.errorGetTimeout=null}return i.prototype.startGets=function(){this.getRequested||(this.getRequested=!0,this.performRealTimeGet())},i.prototype.isActive=function(){return n.EventMux.storage.getItem(t.Storage.storageKeys.IsActive)==="true"},i.prototype.performRealTimeGet=function(){var t=this,i;if(!n.EventMux.isCurrentTabOverlord()){n.EventMux.error("[ChannelClient] Something tried to run a GET, but this tab isn't the overlord!");return}if(this.isReplaced){n.EventMux.error("[ChannelClient] Something tried to run a GET, but this tab was replaced!");return}if(!Modernizr.localstorage){n.EventMux.error("[ChannelClient] Cannot perform get - localStorage is not available! Disabling EventMux.");this.toggleActive(!1);return}clearTimeout(this.errorGetTimeout);bungieNetPlatform.notificationService.GetRealTimeEvents!==undefined&&n.EventMux.isAuthed?(n.EventMux.log("[ChannelClient]["+moment().format("HH:mm:ss")+"] Performing GET from Tab "+this.tabId),this.toggleActive(!0),this.setFailureTimer(),this.pendingGets++,i=bungieNetPlatform.notificationService.GetRealTimeEvents(this.ackNext,this.tabId,this.requestTimeout,function(i){if(t.pendingGets--,!n.EventMux.isCurrentTabOverlord){n.EventMux.warn("[ChannelClient]["+moment().format("HH:mm:ss")+"] Get succeeded, but this tab is no longer overlord! Throwing out results...");return}if(n.EventMux.log("[ChannelClient]["+moment().format("HH:mm:ss")+"] GET Succeeded",i),i.replaced){n.EventMux.warn("[ChannelClient] This channel was replaced! Refresh to establish a new channel.");t.onTabReplaced();return}t.onGetSuccess(i)},function(i,r,u){if(t.pendingGets--,t.clearFailureTimer(),!n.EventMux.isCurrentTabOverlord){n.EventMux.warn("[ChannelClient]["+moment().format("HH:mm:ss")+"] Get failed, but this tab is no longer overlord! Throwing out results...");return}t.onGetFailure(i,u)})):(this.toggleActive(!1),n.EventMux.warn("[ChannelClient] Real time events are disabled or user is not authenticated!"))},i.prototype.onTabReplaced=function(){this.isReplaced=!0;this.tabReplacedCallback()},i.prototype.resetChannelClient=function(){n.EventMux.log("[ChannelClient] Server sequence reset, resetting channel client...");this.ackNext=0;n.EventMux.storage.setItem(t.Storage.storageKeys.StoredResponse,JSON.stringify({}));n.EventMux.storage.setItem(t.Storage.storageKeys.LastSeqStored,String(0));n.EventMux.lastSeqStored=0},i.prototype.onGetSuccess=function(i){var r,u,o,s,f;this.ackNext>i.seq&&this.resetChannelClient();this.ackNext=i.seq;this.tabId=i.tab||this.tabId;n.EventMux.log("[ChannelClient] Storing GET results...");var h=n.EventMux.storage.getItem(t.Storage.storageKeys.StoredResponse),e=h?JSON.parse(h):{},c=Object.keys(e),l=c.length;if(l>2){for(r=9007199254740991,u=0;u<l;u++)o=parseInt(c[u]),r=o<r?o:r;delete e[r]}s=e;f=i.seq;s[f]=i;n.EventMux.storage.setItem(t.Storage.storageKeys.LastSeqStored,f.toString());n.EventMux.lastSeqStored=f;n.EventMux.storage.setItem(t.Storage.storageKeys.StoredResponse,JSON.stringify(s),!0);this.pendingGets===0&&this.performRealTimeGet()},i.prototype.onGetFailure=function(t,i){var e=this,r=!0,u,f;switch(t.errorCode){case 2:switch(i.status){case 0:r=!1;i.abort();n.EventMux.error("[ChannelClient] Request failed, event request cancelled.");break;case 524:r=!0;this.reduceTimerDueToTimeout()}break;case 5:case 99:r=!1;n.EventMux.error("[ChannelClient] Events suspended.");break;case 51:r=!1;n.EventMux.log("[ChannelClient] Throttle Exceeded, Events suspended.");break;default:n.EventMux.error("[ChannelClient] GET failed, code "+t.errorCode+': "'+t.errorMessage+'"')}r?(u=Math.max(Math.pow(2,this.failures),10),f=u*1e3,n.EventMux.log("[ChannelClient] GET will try again in "+u+" seconds."),this.errorGetTimeout=setTimeout(function(){e.performRealTimeGet()},f)):this.toggleActive(!1);this.failures++},i.prototype.toggleActive=function(i){var r=i.toString();this.isActive().toString()!==r&&n.EventMux.log("[ChannelClient] Toggling active state to "+r);n.EventMux.storage.setItem(t.Storage.storageKeys.IsActive,r)},i.prototype.setFailureTimer=function(){var n=this;this.clearFailureTimer();this.failureTimer=setTimeout(function(){n.reduceTimerDueToTimeout();n.performRealTimeGet()},(this.requestTimeout+this.errorTimeoutLeeway)*1e3)},i.prototype.clearFailureTimer=function(){clearTimeout(this.failureTimer)},i.prototype.reduceTimerDueToTimeout=function(){var n=Math.max(15,this.requestTimeout-this.errorTimeoutReductionAmount);this.requestTimeout=n},i}();t.ChannelClient=i})(t=n.RealTime||(n.RealTime={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function t(){this.failures=0;this.callbacks=[];this.setupListeners()}return t.prototype.setupListeners=function(){var n=this;$(window).on("storage customStorage",function(t,i){var r=t.type==="storage"?t.originalEvent.key:i;r.match(/eventmux/gi)&&n.callbacks.map(function(n){n()})})},t.prototype.addCallback=function(n){n===void 0&&(n=function(){});this.callbacks.push(n)},t.prototype.setItem=function(t,i,r){r===void 0&&(r=!1);r=r!=undefined?r:!1;var u=n.Utilities.LocalStorage.setItem(t,i);return r&&$(window).trigger("customStorage","eventMux"),u},t.prototype.sessionSetItem=function(t,i){return n.Utilities.SessionStorage.setItem(t,i)},t.prototype.getItem=function(t){return n.Utilities.LocalStorage.getItem(t)},t.prototype.sessionGetItem=function(t){return n.Utilities.SessionStorage.getItem(t)},t.prototype.removeItem=function(t,i){i===void 0&&(i=!1);i=i!=undefined?i:!1;var r=n.Utilities.LocalStorage.removeItem(t);return i&&$(window).trigger("customStorage"),r},t.prototype.destroy=function(){this.removeItem(t.storageKeys.IsActive);this.removeItem(t.storageKeys.LastSeqStored);this.removeItem(t.storageKeys.OverlordTabId);this.removeItem(t.storageKeys.OverlordTabProofPoll);this.removeItem(t.storageKeys.StoredResponse);this.removeItem(t.storageKeys.TabId);this.removeItem(t.storageKeys.UnloadFlag)},t.storageKeys={OverlordTabId:"eventMux.overlordTabId",OverlordTabProofPoll:"eventMux.overlordTabProofPoll",StoredResponse:"eventMux.storedResponse",LastSeqStored:"eventMux.lastStoredSeq",TabId:"eventMux.tabId",UnloadFlag:"eventMux.unloadFlag",IsActive:"eventMux.isActive"},t}();t.Storage=i})(t=n.RealTime||(n.RealTime={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var i=function(t){function i(i,r){var u=t.call(this,i,r)||this;return u.eventName=Globals.RealTimeEventType[u.params.eventType],n.EventMux.log("[EventMuxSubscription] Registered for: "+u.eventName),u}return __extends(i,t),i}(n.Site.Subscription);t.EventMuxSubscription=i})(t=n.RealTime||(n.RealTime={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var i=function(n){function t(t,i){var r=n.call(this,t)||this;return r.update=i,r}return __extends(t,n),t}(n.Site.SubscriptionPayload),r;t.EventMuxUpdatePayload=i;r=function(r){function u(){var i=r.call(this,t.EventMuxSubscription)||this;return i.lastSeqParsed=0,n.EventMux.storage.addCallback(function(){i.broadcast()}),i}return __extends(u,r),u.prototype.getPayloadsToUpdate=function(){var l=[],p=n.EventMux.storage.getItem(t.Storage.storageKeys.StoredResponse),a=JSON.parse(p),u=n.EventMux.lastSeqStored,r,f,v,e,o,y,s,h,c;if(this.lastSeqParsed===u)return[];for((this.lastSeqParsed===0||this.lastSeqParsed>u)&&(this.lastSeqParsed=u-1),r=this.lastSeqParsed+1;r<=u;r++){if(r in a&&(f=a[r],"events"in f))for(v=f.events.length,e=0;e<v;e++)for(o=f.events[e],y=Globals.RealTimeEventType[o.eventType],n.EventMux.log("[EventMuxSubscription] Update found for ["+y+"] at seq "+r),s=0,h=this.subscriptions;s<h.length;s++)c=h[s],o.eventType===c.params.eventType&&l.push(new i(c,o));this.lastSeqParsed=r}return l},u}(n.Site.Subscribable);t.SubManager=r})(t=n.RealTime||(n.RealTime={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(){var t=this;this.sessionStorageAvailable=Modernizr.sessionstorage;this.tabId=null;this.overlordTabId=null;this.overlordTabProofPollTimeout=null;this.overlordTabProofPollInterval=15e3;this.minionTabCheckTimeout=null;this.minionTabCheckInterval=3e4;n.EventMux.storage.addCallback(function(){t.onStorageUpdate()});this.setupTabId(function(){t.onTabIdSetupComplete(!0)});this.setupListeners()}return i.prototype.setupListeners=function(){var n=this,t=!1;window.addEventListener("beforeunload",function(){t||(t=!0,n.setUnloadFlag(),n.retireSelfAsOverload())});window.addEventListener("unload",function(){t||(t=!0,n.setUnloadFlag(),n.retireSelfAsOverload())})},i.prototype.isActive=function(){return this.channelClient.isActive()},i.prototype.setupTabId=function(t){t===void 0&&(t=function(){});n.EventMux.log("[TabManager] Setting up Tab ID");this.getStoredTabId();this.tabId===null?this.setNewTabId(t):t()},i.prototype.getStoredTabId=function(){if(this.sessionStorageAvailable){var i=n.Utilities.SessionStorage.getItem(t.Storage.storageKeys.UnloadFlag)==="true";i?(this.unsetUnloadFlag(),this.tabId=n.Utilities.SessionStorage.getItem(t.Storage.storageKeys.TabId),this.tabId!==null&&(this.tabId==0?this.tabId=null:n.EventMux.log("[TabManager] Tab ID acquired from sessionStorage"))):n.EventMux.log("[TabManager] Tab was never unloaded, setting new tab instead")}},i.prototype.setUnloadFlag=function(){n.EventMux.storage.sessionSetItem(t.Storage.storageKeys.UnloadFlag,(!0).toString())},i.prototype.unsetUnloadFlag=function(){n.EventMux.storage.sessionSetItem(t.Storage.storageKeys.UnloadFlag,(!1).toString())},i.prototype.setNewTabId=function(i){i===void 0&&(i=function(){});this.tabId=this.generateId();this.sessionStorageAvailable&&n.Utilities.SessionStorage.setItem(t.Storage.storageKeys.TabId,String(this.tabId));n.EventMux.log("[TabManager] New Tab ID generated!");i()},i.prototype.clearTabId=function(){this.tabId=null;this.sessionStorageAvailable&&(n.Utilities.SessionStorage.removeItem(t.Storage.storageKeys.TabId),n.EventMux.log("[TabManager] Tab ID cleared from sessionStorage"))},i.prototype.onTabIdSetupComplete=function(){var i=this;this.channelClient=new t.ChannelClient(this.tabId,function(){i.setOverlordAsReplaced()});this.tryGetSetOverlordTabTimer(!0);n.EventMux.log("[TabManager] Tab ID set to "+this.tabId)},i.prototype.tryGetSetOverlordTab=function(i){i=i||!1;clearTimeout(this.overlordTabProofPollTimeout);clearTimeout(this.minionTabCheckTimeout);var r=n.EventMux.storage.getItem(t.Storage.storageKeys.OverlordTabId),u=i&&r===n.EventMux.storageValues.OverlordTabReplaced;r===null||u?(i&&n.EventMux.log("[TabManager] There was an overlord tab, but it was replaced. This tab will take over as overlord."),r=this.setCurrentTabToOverlord()):n.EventMux.log("[TabManager] Overlord tab ID : "+r);this.overlordTabId=r;this.overlordTabId===this.tabId?this.onOverlordTabSet():(n.EventMux.log("[TabManager] This tab is a minion "),this.minionTabCheckForOverlord())},i.prototype.tryGetSetOverlordTabTimer=function(n){var t=this;setTimeout(function(){t.tryGetSetOverlordTab(n)},Math.random()*2e3)},i.prototype.setCurrentTabToOverlord=function(){var i=this.tabId;return n.EventMux.storage.setItem(t.Storage.storageKeys.OverlordTabId,String(i)),n.EventMux.log("[TabManager] Set new overlord tab ID : "+i),i},i.prototype.onOverlordTabSet=function(){this.channelClient.startGets();this.overlordTabProofPoll()},i.prototype.overlordTabProofPoll=function(){var r=this,i;clearTimeout(this.overlordTabProofPollTimeout);i=performance.now();n.EventMux.storage.setItem(t.Storage.storageKeys.OverlordTabProofPoll,i.toString());this.overlordTabProofPollTimeout=setTimeout(function(){r.overlordTabProofPoll()},this.overlordTabProofPollInterval)},i.prototype.minionTabCheckForOverlord=function(){var u=this;clearTimeout(this.minionTabCheckTimeout);var i=!0,r=parseInt(n.EventMux.storage.getItem(t.Storage.storageKeys.OverlordTabProofPoll)),f=isNaN(r),e=performance.now()-r>this.minionTabCheckInterval,o=this.overlordTabId===0;(f||e||o)&&(i=!1);i||(n.EventMux.warn("[TabManager] Overlord tab no longer exists!"),n.EventMux.storage.removeItem(t.Storage.storageKeys.OverlordTabId),this.tryGetSetOverlordTabTimer(!1));this.minionTabCheckTimeout=setTimeout(function(){u.minionTabCheckForOverlord()},this.minionTabCheckInterval)},i.prototype.onStorageUpdate=function(){var u=this,r,i;if(!n.EventMux.isActive){n.EventMux.warn("[TabManager] EventMux is no longer active. Disabling storage updates and overlord proof time poll.");this.onStorageUpdate=function(){};clearTimeout(this.overlordTabProofPollTimeout);return}r=n.EventMux.storage.getItem(t.Storage.storageKeys.LastSeqStored);n.EventMux.lastSeqStored=parseInt(r);i=n.EventMux.storage.getItem(t.Storage.storageKeys.OverlordTabId);i===null?this.tryGetSetOverlordTabTimer(!1):this.tabId===n.EventMux.storageValues.OverlordTabReplaced&&i!==n.EventMux.storageValues.OverlordTabReplaced&&(n.EventMux.log("[TabManager] This tab used to be an overlord, but was replaced. Making it into a minion..."),this.setNewTabId(function(){u.onTabIdSetupComplete(!1)}))},i.prototype.retireSelfAsOverload=function(){var i=n.EventMux.storage.getItem(t.Storage.storageKeys.OverlordTabId);i===this.tabId?(this.overlordTabId=null,n.EventMux.storage.removeItem(t.Storage.storageKeys.OverlordTabId),n.EventMux.log("[TabManager] Tab "+this.tabId+" has retired itself as overlord")):n.EventMux.warn("[TabManager] Tab "+this.tabId+" cannot retire because it is not overlord! Overlord tab is currently: "+i)},i.prototype.setOverlordAsReplaced=function(){var i=n.EventMux.storage.getItem(t.Storage.storageKeys.OverlordTabId);i===this.tabId?(n.EventMux.warn("[TabManager] Overlord tab has been replaced!"),this.tabId=n.EventMux.storageValues.OverlordTabReplaced,n.EventMux.storage.setItem(t.Storage.storageKeys.OverlordTabId,String(n.EventMux.storageValues.OverlordTabReplaced))):n.EventMux.warn("[TabManager] Cannot set overlord as replaced, because this tab is not the overlord")},i.prototype.generateId=function(){var n,t,i,r;return"crypto"in window?(t=new Uint32Array(1),n=crypto.getRandomValues(t)[0]):(i=new Date,r=new Date((new Date).getFullYear().toString()),n=i.getTime()-r.getTime()),n=n&2147483647,n.toString()},i.prototype.isCurrentTabOverlord=function(){return this.tabId===this.overlordTabId},i}();t.TabManager=i})(t=n.RealTime||(n.RealTime={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t=function(){function t(){}return t.prototype.initialize=function(){$(document).off(".companionforms");this.inputs=new n.CompanionTextType(".companion-text-input","input");this.inputs.initialize();this.textareas=new n.CompanionTextType(".companion-textarea","textarea");this.textareas.initialize();this.selects=new n.CompanionSelect;this.selects.initialize()},t.Instance=new t,t}();n.Forms=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t=function(){function n(){this.inputContainerSelector=".companion-select";this.inputTag="select"}return Object.defineProperty(n.prototype,"inputSelector",{get:function(){return this.inputContainerSelector+" "+this.inputTag},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){this.setExistingInputs();this.addListeners()},n.prototype.addListeners=function(){var n=this;$(document).on("click touchend",".companion-select .select-box",function(t){n.onSelectBoxClick(t.currentTarget)});$(document).on("click touchend",".companion-select .select-box .current-option .select-option",function(t){n.onSelectBoxClick(t.currentTarget);return!1});$(document).on("click touchend",".companion-select .select-box .select-option",function(t){if($(t.currentTarget).closest(".current-option").length)return!1;var i=$(t.currentTarget).attr("data-value"),r=$(t.currentTarget).closest(".companion-select");n.onSelectOption(i,r);return!1});$(document).on("change",".companion-select select",function(t){if(t.isTrigger!==3)n.onChange(t.currentTarget)});$(document).on("click",function(t){$(t.currentTarget).closest(".companion-select").length===0&&n.closeDropdown()})},n.prototype.setExistingInputs=function(){var t=this,n=$(this.inputSelector);n.length&&n.each(function(n,i){var r=$(i),u=r.parents(t.inputContainerSelector),f=r.val();u.toggleClass("has-value",f!=="")})},n.prototype.onSelectBoxClick=function(n){this.toggleOpenClose(n)},n.prototype.onSelectOption=function(n,t){var i=t.find(".select-option[data-value='"+n+"']").first(),f=i.clone(),e=t.find(".select-box"),r=t.find(".current-option"),u=t.find("select");r.find(".select-option").remove();r.append(f);u.val(i.data("value"));u.trigger("change");this.closeDropdown(e)},n.prototype.onChange=function(n){var t=$(n).closest(".companion-select");this.onSelectOption(n.value,t)},n.prototype.closeDropdown=function(n){n===void 0&&(n=null);n?n.removeClass("open"):$(".companion-select .select-box").removeClass("open")},n.prototype.openDropdown=function(n){if(!n.hasClass("open")){setTimeout(function(){n.addClass("open")},Modernizr.mobile?250:0);return}},n.prototype.toggleOpenClose=function(n){var i=$(n),t=i.is(".select-box")?i:$(n).parents(".select-box");t.hasClass("open")?this.closeDropdown(t):this.openDropdown(t)},n}();n.CompanionSelect=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t=function(){function n(n,t){this.inputContainerSelector=n;this.inputTag=t}return Object.defineProperty(n.prototype,"inputSelector",{get:function(){return this.inputContainerSelector+" "+this.inputTag},enumerable:!0,configurable:!0}),n.prototype.initialize=function(){this.setExistingInputs();this.addListeners()},n.prototype.addListeners=function(){var n=this;$(document).on("change.companionforms, keyup.companionforms",this.inputSelector,function(t){n.onChange(t.currentTarget)});$(document).on("focus.companionforms",this.inputSelector,function(t){n.onFocus(t.currentTarget)});$(document).on("blur.companionforms",this.inputSelector,function(t){n.onBlur(t.currentTarget)});$(document).on("click.companionforms",this.inputContainerSelector+" .fa",function(t){n.onClear(t.currentTarget)})},n.prototype.setExistingInputs=function(){var t=this,n=$(this.inputSelector);n.length&&n.each(function(n,i){var r=$(i),u=r.parents(t.inputContainerSelector),f=r.val();u.toggleClass("has-value",f.length>0);u.toggleClass("focused",r.is("[autofocus]"))})},n.prototype.onChange=function(n){var t=$(n).val();$(n).closest(this.inputContainerSelector).toggleClass("has-value",t.length>0)},n.prototype.onBlur=function(n){$(n).closest(this.inputContainerSelector).removeClass("focused")},n.prototype.onFocus=function(n){$(n).closest(this.inputContainerSelector).addClass("focused")},n.prototype.onClear=function(n){$(n).siblings(this.inputTag).val("").trigger("keyup").focus()},n}();n.CompanionTextType=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){n.BuyButton={FetchEntitlements:!1};var t=function(){function t(){}return t.prototype.refresh=function(){var t=n.getPageData("BuyButton");t&&(n.BuyButton=t)},t.Instance=new t,t}();n.PageDataBuyButtonProvider=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){n.log=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.logData=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.warn=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.error=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.verbose=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.base_log=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.base_verbose=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.base_log_data=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.base_warn=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]};n.base_error=function(){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n]}}(Bnet||(Bnet={})),function(n){var t;(function(t){function i(){Vue.config.debug=!0;Function.prototype.bind&&(Modernizr.ie?(n.base_log=Function.prototype.bind.call(console.log,console),n.base_verbose=Function.prototype.bind.call(console.debug,console),n.base_warn=Function.prototype.bind.call(console.warn,console),n.base_error=Function.prototype.bind.call(console.error,console),n.log=Function.prototype.bind.call(n.base_log,console),n.verbose=Function.prototype.bind.call(n.base_verbose,console),n.warn=Function.prototype.bind.call(n.base_warn,console),n.error=Function.prototype.bind.call(n.base_error,console)):(n.base_log=Function.prototype.bind.call(console.log,console),n.base_verbose=Function.prototype.bind.call(console.debug,console),n.base_warn=Function.prototype.bind.call(console.warn,console),n.base_error=Function.prototype.bind.call(console.error,console),n.log=Function.prototype.bind.call(n.base_log,console,""),n.verbose=Function.prototype.bind.call(n.base_verbose,console,""),n.warn=Function.prototype.bind.call(n.base_warn,console,""),n.error=Function.prototype.bind.call(n.base_error,console,"")))}function r(){n.log=function(){};n.warn=function(){};n.error=function(){}}t.enableLogging=i;t.disableLogging=r})(t=n.Debugging||(n.Debugging={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){function e(){var r=jQuery.prototype.on,s=jQuery.prototype.off,n,e;i=!0;n=function(i,e,s,h,c){var a=this,l=u(a,i,e,s,h),v,y,w,p,b;if(i instanceof Object){for(v in i)i.hasOwnProperty(v)&&v.indexOf(".eventBinder")===-1&&n.apply(a,[v,e,i[v]]);return a}if(i.indexOf(".eventBinder")>-1)return r.apply(a,[i,e,s,h,c]);for(y=0,w=t.existingBindings.length;y<w;y++)if(p=t.existingBindings[y],b=f(l,p),b){var k=l.element.selector||l.element.toString(),d=l.extraElements?"->"+l.extraElements:"",g={newBinding:l,existingBinding:p};o(g,k,d,i)}return t.existingBindings.push(l),r.apply(a,[i,e,s,h,c])};e=function(n,i,r){for(var c,l,a,v,h=this,e=u(h,n,i,function(){},null),o=t.existingBindings.length-1;o>=0;o--)c=t.existingBindings[o],l=f(e,c,!0),l&&(t.existingBindings.splice(o,1),a=e.element.selector||e.element[0].toString(),v=e.extraElements?"->"+e.extraElements:"");return s.apply(h,[n,i,r])};jQuery.prototype.on=n;jQuery.prototype.off=e}function u(n,t,i,r,u){var o=typeof t=="string"?t:null;!o&&t instanceof Object&&(o=Object.keys(t).join(" "));for(var s=typeof i=="string"?i:null,f=0,h=0,e=o.split(" "),c=s?s.split(","):[],f=0,h=e.length;f<h;f++)e[f]=e[f].split(".")[0];return{element:$(n),extraElements:$.map(c,$.trim),events:$.map(e,$.trim),handler:u||r||i}}function f(t,i,r){var u,f,e,o;return(r===void 0&&(r=!1),u=i.element.is(t.element),u&&(f=n.Utilities.Enumerable.intersection(i.extraElements,t.extraElements),(f.length>0||t.extraElements.length===0||i.extraElements.length===0)&&(e=n.Utilities.Enumerable.intersection(i.events,t.events),e.length>0&&(o=t.handler.toString()===i.handler.toString(),o||r))))?!0:!1}function o(t,u,f,e){if(i){if(r>100){n.error("Duplicate bindings have exceed 100. No more logging. Fix it!");i=!1;return}r++;n.warn("DUPLICATE BINDING DETECTED of "+u+f+".on("+e+")",t)}}t.existingBindings=[];var i=!1,r=0;t.preventJQueryDoubleBind=e;ServerVars.VerboseConsoleLogs&&(t.enableLogging(),t.preventJQueryDoubleBind())})(t=n.Debugging||(n.Debugging={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){n.OnPageUser={CanChangeThisUserData:!1,IsLoggedInAccount:!1,MembershipData:{destinyMemberships:[],bungieNetUser:null},OnPageCharacterId:"0",OnPageMembershipId:"0",OnPageMembershipType:Globals.BungieMembershipType.None,OnPageOrRecentCharacter:null,OnPageOrRecentDestinyProfile:null,PrivacyStatus:{CanReadPrivateUserDestinyData:!1,Privacy:Globals.BNetAccountPrivacy.Default}};var t=function(){function t(){}return t.prototype.refresh=function(){var t=n.getPageData("OnPageUser");t&&(n.OnPageUser=t)},t.Instance=new t,t}();n.PageDataMembershipProvider=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(t){var i=function(){function i(){}return Object.defineProperty(i,"CurrentUser",{get:function(){return this._currentUser},enumerable:!0,configurable:!0}),i.getBungieFriendsByCurrentUser=function(i){return i===void 0&&(i=!0),__awaiter(this,void 0,void 0,function(){var r=this;return __generator(this,function(){return this.getUsersFriendsByCurrentUserItem=this.getUsersFriendsByCurrentUserItem||new t.GlobalDataItem("getUsersFriendsByCurrentUser",i,t.GlobalDataModificationType.Replace,function(){return new Promise(function(t,i){n.Utilities.User.isAuthenticated?bungieNetPlatform.socialService.GetFriendList(function(n){return t(n)},function(t){return n.error(t)}):i(r.REJECT_NOT_AUTHENTICATED)})}),[2,this.getUsersFriendsByCurrentUserItem.getPromise()]})})},i.getConversations=function(i,r,u){return i===void 0&&(i=!0),r===void 0&&(r=1),u===void 0&&(u=t.GlobalDataModificationType.Extend),__awaiter(this,void 0,void 0,function(){var f=this;return __generator(this,function(){return this.conversationPageLast=r,this.getConversationsItem?(this.getConversationsItem.setPage(r),this.getConversationsItem.setUseCached(i),this.getConversationsItem.setDataModificationType(u)):this.getConversationsItem=new t.GlobalDataItemPaged(r,"getConversations",i,u,function(){return new Promise(function(t,i){n.Utilities.User.isAuthenticated?bungieNetPlatform.messageService.GetConversationsV5(f.conversationPageLast,Globals.TemplateFormat.BNet,function(n){t(n)},function(n){return i(n)}):i(f.REJECT_NOT_AUTHENTICATED)})}),[2,this.getConversationsItem.getPromise()]})})},i.getGroupConversations=function(i,r,u){return r===void 0&&(r=1),u===void 0&&(u=t.GlobalDataModificationType.Extend),__awaiter(this,void 0,void 0,function(){var f=this;return __generator(this,function(){return this.getGroupConversationsItem=this.getGroupConversationsItem||new t.GlobalDataItemPaged(r,"getConversations",!1,u,function(){return new Promise(function(t,u){n.Utilities.User.isAuthenticated?bungieNetPlatform.messageService.GetGroupConversationsV2(i,r,Globals.TemplateFormat.BNet,function(n){return t(n)},function(n){return u(n)}):u(f.REJECT_NOT_AUTHENTICATED)})}),[2,this.getGroupConversationsItem.getPromise()]})})},i.getNotifications=function(){return __awaiter(this,void 0,void 0,function(){var i=this;return __generator(this,function(){return this.getNotificationsItem=this.getNotificationsItem||new t.GlobalDataItem("getNotifications",!1,t.GlobalDataModificationType.Replace,function(){return new Promise(function(t,r){n.Utilities.User.isAuthenticated?bungieNetPlatform.notificationService.GetRecentNotifications(Globals.TemplateFormat.BNet,function(n){return t(n)},function(n){return r(n)}):r(i.REJECT_NOT_AUTHENTICATED)})}),[2,this.getNotificationsItem.getPromise()]})})},i.getCurrentUser=function(){return __awaiter(this,void 0,void 0,function(){var i=this;return __generator(this,function(){return this.getCurrentUserItem=this.getCurrentUserItem||new t.GlobalDataItem("getCurrentUser",!0,t.GlobalDataModificationType.Replace,function(){return new Promise(function(t,r){n.Utilities.User.isAuthenticated?bungieNetPlatform.userService.GetCurrentUser(function(n){i._currentUser=n;t(n)},function(n){return r(n)}):r(i.REJECT_NOT_AUTHENTICATED)})}),[2,this.getCurrentUserItem.getPromise()]})})},i.getUserClans=function(i){return __awaiter(this,void 0,void 0,function(){var r=this;return __generator(this,function(){return this.getUserClansItem=this.getUserClansItem||new t.GlobalDataItem("getCurrentUserClans",!0,t.GlobalDataModificationType.Replace,function(){return new Promise(function(t,u){n.Utilities.User.isAuthenticated?bungieNetPlatform.groupV2Service.GetGroupsForMember(Globals.BungieMembershipType.BungieNext,i,Globals.GroupsForMemberFilter.All,Globals.GroupType.Clan,function(n){return t(n.results.filter(function(n,t,i){return i.findIndex(function(t){return t.group.groupId===n.group.groupId})===t}))},function(n){return u(n)}):u(r.REJECT_NOT_AUTHENTICATED)})}),[2,this.getUserClansItem.getPromise()]})})},i._currentUser=null,i.REJECT_NOT_AUTHENTICATED="This data cannot be accessed without authentication",i.conversationPageLast=1,i}();t.GlobalData=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(n){var t,i;(function(n){n[n.Replace=0]="Replace";n[n.Extend=1]="Extend"})(t=n.GlobalDataModificationType||(n.GlobalDataModificationType={}));i=function(){function n(n,t,i,r){this.identifier=n;this.useCached=t;this.dataModificationMethod=i;this.promiseCreator=r;this.data=null}return Object.defineProperty(n.prototype,"existingData",{get:function(){return this.data},enumerable:!0,configurable:!0}),n.prototype.getPromise=function(){return __awaiter(this,void 0,void 0,function(){var i,t=this;return __generator(this,function(){return this.identifier in n.MidFlightItems?[2,n.MidFlightItems[this.identifier]]:(i=new Promise(function(i,r){var u=t.tryGetExistingData(),f;u&&t.useCached?(i(u),delete n.MidFlightItems[t.identifier]):(f=t.promiseCreator(),f.then(function(r){t.modifyData(r);delete n.MidFlightItems[t.identifier];i(t.data)}).catch(function(i){delete n.MidFlightItems[t.identifier];r(i)}))}),n.MidFlightItems[this.identifier]=i,[2,i])})})},n.prototype.setData=function(n){this.data=n},n.prototype.extendExistingData=function(n){this.data?$.extend(this.data,n):this.data=n},n.prototype.tryGetExistingData=function(){return this.data?this.data:null},n.prototype.modifyData=function(n){this.dataModificationMethod===t.Extend?this.extendExistingData(n):this.setData(n)},n.prototype.setUseCached=function(n){this.useCached=n},n.prototype.setDataModificationType=function(n){this.dataModificationMethod=n},n.MidFlightItems={},n}();n.GlobalDataItem=i})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(n){var t=function(n){function t(t,i,r,u,f){var e=n.call(this,i,r,u,f)||this;return e.addPage=t,e}return __extends(t,n),t.prototype.tryGetExistingData=function(){return this.addPage<=t.highestRequestedPage&&this.existingData&&this.useCached?this.existingData:(this.addPage>t.highestRequestedPage&&(t.highestRequestedPage=this.addPage),null)},t.prototype.extendExistingData=function(n){this.data?(this.data.results=this.data.results.concat(n.results),this.data.hasMore=n.hasMore,this.data.totalResults=n.totalResults,this.data.useTotalResults=n.useTotalResults):this.data=n},t.prototype.setPage=function(n){this.addPage=n},t.highestRequestedPage=1,t}(n.GlobalDataItem);n.GlobalDataItemPaged=t})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i,r;(function(n){n[n.none=0]="none";n[n.de=1]="de";n[n.en=2]="en";n[n.es=3]="es";n[n.fr=4]="fr";n[n.it=5]="it";n[n["pt-br"]=6]="pt-br";n[n.ja=7]="ja";n[n["es-mx"]=8]="es-mx";n[n.ru=9]="ru";n[n.pl=10]="pl";n[n["zh-chs"]=11]="zh-chs";n[n["zh-cht"]=12]="zh-cht";n[n.ko=13]="ko"})(i=t.Locales||(t.Locales={}));r=function(){function t(i,r){return this.currentUrlLocaleString=i,this.browserLocaleString=r,this.isOpen=!1,this.$languageSelector=$("#select_language"),t.instance&&n.error("LocaleSelector is already initialized"),t.instance}return t.prototype.initialize=function(){this.currentUrlLocale=t.stringToLocale(this.currentUrlLocaleString);this.browserLocale=t.stringToLocale(this.browserLocaleString);var n=Cookies.GetInMulti("bungleloc","lc");this.cookieLocale=t.stringToLocale(n);this.addListeners();this.evaluateLocale();this.setLanguageSelector(this.currentUrlLocale)},t.prototype.addListeners=function(){var n=this;$(document).on("click",function(t){n.isOpen&&!$(".locale-selector")[0].contains(t.target)&&n.toggleSelector(!1)});$(".js-locale-selector-trigger").on("click",function(){n.toggleSelector()});$(".js-locale-item").on("click",function(i){var u=$(i.currentTarget).data("locale"),r=t.stringToLocale(u);n.setLanguageSelector(r);n.setLocaleAndRedirect(r,!1,!0);n.toggleSelector(!1)})},t.prototype.toggleSelector=function(n){var t=n!==undefined?n:!this.isOpen;this.isOpen=t;$(".js-locale-selector").toggleClass("open",this.isOpen)},t.stringToLocale=function(n){if(typeof n=="string")n=n.toLowerCase();else return n;return n&&n in i?i[n]:i.none},t.prototype.setLanguageSelector=function(n){var t=i[n];$(".js-locale-item").removeClass("current");$('.js-locale-item[data-locale="'+t+'"]').addClass("current")},t.prototype.evaluateLocale=function(){bungieNetPlatform.platformSettings.mockContent||bungieNetPlatform.platformSettings.isFirehose||(this.cookieLocale!==i.none&&this.cookieLocale!==this.currentUrlLocale?this.redirectToLocale(this.cookieLocale):this.currentUrlLocale===i.none&&(this.currentUrlLocale=i.en,this.browserLocale!==this.currentUrlLocale&&this.redirectToLocale(this.browserLocale)))},t.prototype.redirectToLocale=function(n){var r;if(n!==i.none&&(r=this.isValidLocale(n),r)){var t=i[n],u=/(^\/[A-Za-z]{2}\/|^\/[A-Za-z]{2}-[A-Za-z]{2,3}\/|^\/[A-Za-z]{2}$|^\/[A-Za-z]{2}-[A-Za-z]{2,3}$)/,f=/^\/7_[^\/]*(\/[A-Za-z]{2}\/|\/[A-Za-z]{2}-[A-Za-z]{2,3}\/|\/[A-Za-z]{2}$|\/[A-Za-z]{2}-[A-Za-z]{2,3}$)/,e=window.location.href;e=location.pathname.match(u)?window.location.pathname.replace(u,"/"+t+"/")+window.location.search+window.location.hash:location.pathname.match(f)?window.location.pathname.replace(f,"/"+t+"/")+window.location.search+window.location.hash:"/"+t+window.location.pathname+window.location.search+window.location.hash;location.href=e}},t.prototype.setLocale=function(n,t,r){var f=i[n],u;(r||this.cookieLocale!==i.none)&&(u=new Date,u.setFullYear(u.getFullYear()+7),Cookies.SetMultiWithExpires("bungleloc",u,{lc:f,lcin:t}))},t.prototype.setLocaleAndRedirect=function(n,t,i){this.setLocale(n,t,i);this.redirectToLocale(n)},t.prototype.isValidLocale=function(n){var t=i[n],r=Localizer.validLocales.find(function(n){return n.name===t});return!!r},t.instance=new t(Localizer.CurrentCultureName,Localizer.CurrentBrowserCultureName),t}();t.LocaleSelector=r})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t,i;(function(n){n[n.None=0]="None";n[n.Warning=1]="Warning";n[n.Information=2]="Information";n[n.Question=3]="Question"})(t=n.ConfirmationReason||(n.ConfirmationReason={}));i=function(n){function i(t,i,r,u,f){f===void 0&&(f=function(){});var e=n.call(this,"confirmation-"+t,r)||this;return e.confirmLabel=Localizer.Actions.confirmdialogbutton,e.cancelLabel=Localizer.Actions.canceldialogbutton,e.includeCloseButton=!1,e.closeOnConfirm=!0,e.reason=i,e.confirmCallback=u,e.cancelCallback=f,e}return __extends(i,n),i.prototype.addListeners=function(){var t=this;n.prototype.addListeners.call(this);this.$modalContainer.find(".button.confirm").on("click",function(){return t.confirmSelected()});this.$modalContainer.find(".button.cancel").on("click",function(){return t.cancelSelected()})},i.prototype.confirmSelected=function(){this.closeOnConfirm&&this.close();this.confirmCallback!==undefined&&this.confirmCallback()},i.prototype.cancelSelected=function(){this.close();this.cancelCallback!==undefined&&this.cancelCallback()},i.prototype.populateAfterContent=function(){var n='<div class="button text cancel">'+this.cancelLabel+'<\/div>\n\t\t\t\t <div class="button text confirm gold">'+this.confirmLabel+"<\/div>";this.addHtmlAfterContent(n);this.$modal.addClass("confirmation")},i.prototype.populateContent=function(t){var i=$("<div class='confirmation-message'/>").append(t);n.prototype.populateContent.call(this,i);this.$modal.find(".modal-content").prepend(this.getReasonHtml());this.populateAfterContent()},i.prototype.getReasonHtml=function(){var n="";switch(this.reason){case t.Warning:n="<div class='reason warning'><i class=\"material-icons\">warning<\/i><\/div>";break;case t.Question:n="<div class='reason question'><i class=\"material-icons\">help<\/i><\/div>";break;case t.Information:n="<div class='reason information'><i class=\"material-icons\">info<\/i><\/div>"}return n},i}(n.Modal);n.ConfirmationModal=i}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t=function(n){function t(t,i){var u=this,r=i;return i.errorMessage!==undefined&&(r=i.errorMessage),n.call(this,"error-"+t,r)||this}return __extends(t,n),t.prototype.addListeners=function(){n.prototype.addListeners.call(this)},t.prototype.populateAfterContent=function(){},t.prototype.populateContent=function(t){var i=$("<div class='error-message'/>").append(t);n.prototype.populateContent.call(this,i);this.$modal.find(".modal-content").prepend(this.getReasonHtml());this.$modal.addClass("error")},t.prototype.getReasonHtml=function(){return"<div class='reason error'><i class=\"material-icons\">error<\/i><\/div>"},t}(n.Modal);n.ErrorModal=t}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(t){var i;(function(i){var r=function(){function i(){this.initialized=!1;this.eventBinder=new n.EventBinder("AccountPane");this.accountPaneVueData={userDetail:null,userClans:null,isLoadingSlowly:!1};this.$sidebar=$("#account-sidebar");this.$outerContainer=$("#account-pane");this.$html=$("html");this.sidebarOpenClass="account-open";this.accountLoadedClass="account-sidebar-loaded";this.sidebarIsOpen=!1}return i.prototype.initialize=function(){n.Utilities.User.isAuthenticated&&!this.initialized&&(this.initialized=!0,this.eventBinder.destroy(),this.addListeners(),this.vueInit())},i.prototype.addListeners=function(){var n=this;if(Modernizr.mobile){this.adjustSidebarHeightForMobile();this.eventBinder.for($(window)).on("load resize",function(){return n.adjustSidebarHeightForMobile()})}},i.prototype.vueInit=function(){var t=this;this.accountPaneVue=new Vue({el:$("#account-sidebar")[0],data:this.accountPaneVueData,methods:{getProfileLink:function(){return t.getProfileLink()},getProfileThemePath:function(){return t.getProfileThemePath()},getUserClans:function(){return t.getUserClans()},isNewAccount:function(){return t.isNewAccount()},isReporter:function(){return t.isReporter()},isUserEditor:function(){return t.isUserEditor()},isAdminHistoryViewer:function(){return t.isAdminHistoryViewer()},isCommunityContentCurator:function(){return t.isCommunityContentCurator()},isPlayerSupport:function(){return t.isPlayerSupport()},standardizeBungieGlobalCode:function(t){return n.Utilities.User.StandardizeBungieGlobalCode(t)}}})},i.prototype.open=function(t){var i=this;t===void 0&&(t="");this.sidebarIsOpen||(this.$html.addClass(this.sidebarOpenClass),n.Utilities.Modals.lockBodyScroll(!0),this.sidebarIsOpen=!0,this.loadData(),window.requestAnimationFrame(function(){i.eventBinder.for($(document)).on("click.close-account touchend.close-account",function(n){var t=$(n.target),r=$.contains(document,t[0]);r&&t.closest("#account-sidebar, .user-menu-avatar").length===0&&window.requestAnimationFrame(function(){return i.close()})})}))},i.prototype.loadData=function(){return __awaiter(this,void 0,void 0,function(){var i,r,u,f,e=this;return __generator(this,function(o){switch(o.label){case 0:i=setTimeout(function(){e.accountPaneVueData.isLoadingSlowly=!0},500);o.label=1;case 1:return o.trys.push([1,4,,5]),r=this.accountPaneVueData,[4,t.GlobalData.getCurrentUser()];case 2:return r.userDetail=o.sent(),u=this.accountPaneVueData,[4,t.GlobalData.getUserClans(this.accountPaneVueData.userDetail.user.membershipId)];case 3:return u.userClans=o.sent(),[3,5];case 4:return f=o.sent(),n.error(f),[3,5];case 5:return clearTimeout(i),this.accountPaneVueData.isLoadingSlowly=!1,this.$html.addClass(this.accountLoadedClass),[2]}})})},i.prototype.close=function(t){t===void 0&&(t=!1);(this.sidebarIsOpen||t)&&(this.$html.removeClass(this.sidebarOpenClass).removeClass(this.accountLoadedClass),n.Utilities.Modals.unlockBodyScroll(),this.sidebarIsOpen=!1,this.eventBinder.for($(document)).off(".close-account"))},i.prototype.adjustSidebarHeightForMobile=function(){if(this.sidebarIsOpen){var n=window.innerHeight-$("nav.Nav_Top").height();$("#notifications-sidebar").height(n)}},i.prototype.getProfileLink=function(){return this.accountPaneVueData.userDetail?PageUrls.profilePage+"/"+Globals.BungieMembershipType.BungieNext+"/"+this.accountPaneVueData.userDetail.user.membershipId:PageUrls.profilePage},i.prototype.getProfileThemePath=function(){return this.accountPaneVueData.userDetail?"/img/UserThemes/"+this.accountPaneVueData.userDetail.user.profileThemeName+"/mobiletheme.jpg":"rgba(0,0,0,0.25)"},i.prototype.getUserClans=function(){if(this.accountPaneVueData.userClans){var t=n.Utilities.Enumerable.select(this.accountPaneVueData.userClans,function(n){return n.group.name});return t.join(", ")}return""},i.prototype.isNewAccount=function(){return typeof this.accountPaneVueData.userDetail.user.firstAccess!="undefined"&&this.accountPaneVueData.userDetail.user.firstAccess!==""&&moment().diff(moment(this.accountPaneVueData.userDetail.user.firstAccess),"days")<15},i.prototype.isReporter=function(){return n.Utilities.User.checkAcl(Globals.AclEnum.BNextForumNinja)&&!n.Utilities.User.checkAcl(Globals.AclEnum.Tiger2Ban)&&!n.Utilities.User.checkAcl(Globals.AclEnum.BNextUltraBan)},i.prototype.isUserEditor=function(){return n.Utilities.User.checkAcl(Globals.AclEnum.BNextEditUsers)&&!n.Utilities.User.checkAcl(Globals.AclEnum.Tiger2Ban)&&!n.Utilities.User.checkAcl(Globals.AclEnum.BNextUltraBan)},i.prototype.isAdminHistoryViewer=function(){return n.Utilities.User.checkAcl(Globals.AclEnum.BNextAdminHistory)&&!n.Utilities.User.checkAcl(Globals.AclEnum.Tiger2Ban)&&!n.Utilities.User.checkAcl(Globals.AclEnum.BNextUltraBan)},i.prototype.isCommunityContentCurator=function(){return n.Utilities.User.checkAcl(Globals.AclEnum.BNextCommunityContentCurator)&&!n.Utilities.User.checkAcl(Globals.AclEnum.Tiger2Ban)&&!n.Utilities.User.checkAcl(Globals.AclEnum.BNextUltraBan)},i.prototype.isPlayerSupport=function(){return n.Utilities.User.checkAcl(Globals.AclEnum.BNextPlayerSupport)&&!n.Utilities.User.checkAcl(Globals.AclEnum.Tiger2Ban)&&!n.Utilities.User.checkAcl(Globals.AclEnum.BNextUltraBan)},i.Instance=new i,i}();i.AccountPane=r})(i=t.Navigation||(t.Navigation={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(t){var i;(function(i){var r=function(){function r(){this.initialized=!1;this.eventBinder=new n.EventBinder("topnav");this.avatarVueData={userDetail:null,bungieName:null};this.mobileClickEventType="ontouchstart"in window?"touchend":"click";this.lastScrollTop=0;this.headerOn=!1}return r.prototype.initialize=function(){this.eventBinder.destroy();this.addListeners();this.checkAuthentication();this.onScroll();this.searchEnabled=!0;this.initialized||(this.initAvatarVue(),t.UserNotify.NotificationPane.Instance.initialize(),i.AccountPane.Instance.initialize());this.initialized=!0},r.prototype.addListeners=function(){var t=this;this.eventBinder.for($(window)).on("scroll",function(){return t.onScroll()});this.eventBinder.for($(".small-menu")).on("click",function(){$(document).off(t.mobileClickEventType+".closeMenu");t.toggleMenu()});this.eventBinder.for($("#nav-items .nav-bucket .expand, #nav-items .nav-bucket a[href*='javascript']")).on("click",function(n){var i=$(n.currentTarget).parents(".nav-bucket");t.menuExpand(i)});this.eventBinder.for($(".js-sign-in ")).on("click",function(){t.toggleMenu(!1);var i=new n.Modal("sign-in-options",$("#sign-in-options").html());i.open()})},r.prototype.disableSearchButton=function(){this.searchEnabled=!1},r.prototype.showDeprecatedNotifications=function(){$(".deprecated-notifications").addClass("force-visible")},r.prototype.toggleMenu=function(t){var i=this,r=$("html").hasClass("nav-open");if(r||t!==undefined&&!t)n.Utilities.Modals.unlockBodyScroll(),$("html").removeClass("nav-open"),$(document).off(this.mobileClickEventType+".closeMenu");else{n.Utilities.Modals.lockBodyScroll();$("html").addClass("nav-open");$(document).on(this.mobileClickEventType+".closeMenu",function(n){var t=$(n.target);t.is(".small-menu")||t.closest("#nav-items").length!==0||($(document).off(i.mobileClickEventType+".closeMenu"),n.preventDefault(),n.stopImmediatePropagation(),$("#nav-items .nav-bucket").removeClass("open"),$("html").hasClass("nav-open")&&$("html").removeClass("nav-open"))})}},r.prototype.menuExpand=function(n){n.hasClass("open")?n.removeClass("open"):($("#nav-items .nav-bucket").removeClass("open"),n.addClass("open"))},r.prototype.checkAuthentication=function(){n.Utilities.User.isAuthenticated?($("#btn_signOut").attr("href","/"+Localizer.CurrentCultureName+"/User/SignOut?bru="+encodeURIComponent(window.location.pathname+window.location.search+window.location.hash)),$(".Nav_Top .signedIn").show(),$(".Nav_Top .signedOut").hide()):($(".Nav_Top .signedIn").hide(),$(".Nav_Top .signedOut").show())},r.prototype.onScroll=function(){var t=$("html"),i=window.scrollY||document.documentElement.scrollTop,u=i>this.lastScrollTop,r;this.lastScrollTop=i;n.Reactive.mobile.test()?(r=u&&i>100,t.toggleClass("scroll-hidden",r)):t.removeClass("scroll-hidden");i>60?this.headerOn||(t.addClass("solid-header"),this.headerOn=!0):this.headerOn&&(t.removeClass("solid-header"),this.headerOn=!1)},r.prototype.initAvatarVue=function(){return __awaiter(this,void 0,void 0,function(){var r;return __generator(this,function(u){switch(u.label){case 0:return(this.avatarVue=new Vue({el:$(".Nav_Top .user-menu-avatar")[0],data:this.avatarVueData,methods:{openAccountSidebar:function(){return i.AccountPane.Instance.open()}}}),!n.Utilities.User.isAuthenticated)?[3,2]:(r=this.avatarVueData,[4,t.GlobalData.getCurrentUser()]);case 1:r.userDetail=u.sent();this.avatarVueData.bungieName=this.avatarVueData.userDetail.user.cachedBungieGlobalDisplayName||this.avatarVueData.userDetail.user.displayName;u.label=2;case 2:return[2]}})})},r.Instance=new r,r}();i.NavBar=r})(i=t.Navigation||(t.Navigation={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t=function(){function t(){this.signInUrl="/User/SignIn/";this.joinUpUrl="/User/JoinUp"}return t.prototype.bind=function(){var i=this,t=new n.EventBinder("sign-in-triggers");t.forDocument("a[href*='"+this.signInUrl+"']").on("click",function(n){return i.handleLinkClicks(n)});t.forDocument(".js-joinUp").on("click",function(){window.location.href="/SignIn"})},t.prototype.handleLinkClicks=function(t){var r=this,i;if(t.preventDefault(),i=$(t.currentTarget),!this.showInterrupt(i))var e=typeof this.steamModal!="undefined"&&typeof this.steamModal.modal!="undefined"&&this.steamModal.modal.modalContentElement.find(i).length,u=i.attr("href"),f=window.open(u,"loginui","height=760, width=790, left=550, top=150, menubar=no, location=no, resizable=no, scrollbars=yes, status=no, toolbar=no",!1),o=setInterval(function(){(!f||f.closed)&&(setTimeout(function(){n.Utilities.User.isAuthenticated&&e?(typeof r.steamModal!="undefined"&&r.steamModal.updateLocalStorage(!1),u.indexOf("SteamId")===-1?window.location.href="/"+Localizer.CurrentCultureName+"/Profile/Settings/254/"+n.Utilities.User.loggedInUserBnetMembershipId+"?category=Accounts#list_linkAccounts":window.location.reload()):window.location.reload()},500),clearInterval(o))},500)},t.prototype.showInterrupt=function(t){var i=n.Site.getPageData("PCMigration");return typeof i!="undefined"&&typeof i.PCMigrationLoginInterrupt!="undefined"&&!i.PCMigrationLoginInterrupt?!1:t.hasClass("prepcmigration")&&(t.hasClass("steam")||t.hasClass("js-steam"))?(this.steamModal=new n.Site.SteamModal,this.steamModal.openModal()):!1},t.showAuthWindow=function(n){var i="/"+Localizer.CurrentCultureName+"/User/SignIn/"+Globals.BungieCredentialType[n]+"?flowStart=1",t=window.open(i,"loginui","height=760, width=790, left=550, top=150, menubar=no, location=no, resizable=no, scrollbars=yes, status=no, toolbar=no",!1),r=setInterval(function(){(!t||t.closed)&&(setTimeout(function(){window.location.reload()},500),clearInterval(r))},500)},t.Instance=new t,t}();n.SignInTriggers=t}(Bnet||(Bnet={})),function(n){var t;(function(t){var i;(function(t){var i,r;(function(n){n[n.Messages=0]="Messages";n[n.GroupMessages=1]="GroupMessages"})(i=t.MessagesType||(t.MessagesType={}));r=function(){function r(n,i){var r=this;this.messagesType=n;this.updateUrlWhenOpeningConversation=i;this.messagesList=new t.MessagesList(this.eventBinder,this.messagesType,this.updateUrlWhenOpeningConversation,function(n){return r.onMessagesListFirstLoad(n)})}return r.prototype.initialize=function(){this.$messagesContainer=this.messagesType===i.Messages?$(".js-messages-container"):$(".js-group-messages-container");this.eventBinder=new n.EventBinder("messages");this.messagesList.initialize();this.addListeners()},r.prototype.addListeners=function(){var n=this;this.eventBinder.for(this.$messagesContainer.find(".js-new-message-button")).on("click",function(){return n.composeNewMessage()})},r.prototype.hideMessageDetail=function(){this.$messagesContainer.removeClass("show-detail");this.messagesList.hideMessageDetail()},r.prototype.loadMessages=function(){this.messagesList.loadMessages(!1)},r.prototype.composeNewMessage=function(){this.messagesList.composeNewMessage()},r.prototype.showMessageDetail=function(n){this.messagesList.showMessageDetail(n)},r.prototype.newMessageToUser=function(n){this.messagesList.composeNewMessageToUser(n)},r.prototype.newMessageToUsers=function(n){this.messagesList.composeNewMessageToUsers(n)},r.prototype.onMessagesListFirstLoad=function(t){var i,r,u,f;this.updateUrlWhenOpeningConversation&&t&&t.length>0&&(i=null,r=n.Utilities.Url.getQueryStringValue("conversation","#"),r&&(u=n.Utilities.Enumerable.firstOrDefault(t,function(n){return n.message.detail.conversationId===r}),u&&(i=r)),i||(f=t[0],i=f.message.detail.conversationId),this.messagesList.showMessageDetail(i))},r}();t.Messages=r})(i=t.UserNotify||(t.UserNotify={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(t){var i;(function(i){var r=function(){function r(t,r,u,f){this.eventBinder=t;this.messagesType=r;this.updateUrlWhenOpeningConversation=u;this.onFirstLoad=f;this.currentMembershipId=n.Utilities.User.loggedInUserBnetMembershipId;this.messageDetail=new i.MessageDetail;this.$messagesContainer=this.messagesType===i.MessagesType.Messages?$(".js-messages-container"):$(".js-group-messages-container")}return r.prototype.initialize=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(){return this.initializeMessagesList(),this.subscribeToNewMessages(),this.loadMessages(),[2]})})},r.prototype.subscribeToNewMessages=function(){var t=this;n.EventMux.subscribe({eventType:Globals.RealTimeEventType.ConversationChanged,onUpdate:function(n){return t.processConversationUpdates(n)}})},r.prototype.processConversationUpdates=function(n){return __awaiter(this,void 0,void 0,function(){var u,i,f,t,r;return __generator(this,function(){for(u=!1,i=0,f=this.messagesListView.items;i<f.length;i++)t=f[i],t.message.detail.conversationId===n.update.conversationId&&(t.message.detail.lastMessageSent=moment().format(),t.message.detail.body=n.update.preview,this.currentMessageData&&this.currentMessageData.message.detail.conversationId===t.message.detail.conversationId||(t.message.detail.isRead=!1),r=this.getTwoLineItemFromMessage(t.message),t.subtitle=r.subtitle,t.message.detail.lastMessageSent=r.message.detail.lastMessageSent,t.flairCoin.text=r.flairCoin.text,u=!0);return u?this.messagesListView.sort():this.loadMessages(!1),[2]})})},r.prototype.initializeMessagesList=function(){var t=this,r=this.messagesType===i.MessagesType.Messages?"messages-list":"group-messages-list",u=this.messagesType===i.MessagesType.Messages?"message-item-template":"group-message-item-template";this.messagesListView=new n.UiKit.ControlKit.ListView(r,{templateName:u,vueData:{items:[]},vueTemplateMethods:{getParticipants:function(n){return t.getParticipants(n)},getTimestamp:function(n){return t.getTimestamp(n)},getAvatars:function(n){return t.getAvatars(n)},showMessageDetail:function(n){return t.showMessageDetail(n.message.detail.conversationId)},isUnread:function(n){return t.isUnread(n)}},optionalItemParams:{sort:function(n,t){var i=moment(n.message.detail.lastMessageSent),r=moment(t.message.detail.lastMessageSent),u=i.isAfter(r);return u?-1:1}}});this.messagesListView.initialize()},r.prototype.loadMessages=function(n){var i=this,t;n===void 0&&(n=!0);n||(this.allResults=null);t=1;this.messagesListView.on("scrollToBottom",function(){t++;i.getMessagePage(n,t);i.allResults.hasMore||i.messagesListView.off("scrollToBottom")});this.getMessagePage(n,t)},r.prototype.getMessagePage=function(n,r){return __awaiter(this,void 0,void 0,function(){var u,e,o,f;return __generator(this,function(s){switch(s.label){case 0:return(u=n?t.GlobalDataModificationType.Extend:t.GlobalDataModificationType.Replace,!(this.messagesType===i.MessagesType.Messages))?[3,2]:(e=this,[4,t.GlobalData.getConversations(n,r,u)]);case 1:return e.allResults=s.sent(),[3,4];case 2:return o=this,[4,t.GlobalData.getGroupConversations(Globals.GroupType.General,r,u)];case 3:o.allResults=s.sent();s.label=4;case 4:if(f=this.getTwoLineItemsFromAllMessages(this.allResults.results),this.messagesListView.setItems(f),r===1&&this.onFirstLoad)this.onFirstLoad(f);return this.conversationIdToOpenOnMessageLoad&&(this.showMessageDetail(this.conversationIdToOpenOnMessageLoad),this.conversationIdToOpenOnMessageLoad=null),[2]}})})},r.prototype.showMessageDetail=function(t){if(t){if(this.currentMessageData){if(this.currentMessageData.message.detail.conversationId===t)return;this.currentMessageData.isCurrent=!1}if(this.messageDetail.destroy(),this.messagesListView.items.length>0){var i=n.Utilities.Enumerable.firstOrDefault(this.messagesListView.items,function(n){return n.message.detail.conversationId===t});i&&(this.currentMessageData=i,this.currentMessageData.isCurrent=!0,this.currentMessageData.message.detail.isRead=!0,this.messageDetail.newInstance(this.messagesType,i.message.detail.conversationId,this.updateUrlWhenOpeningConversation))}else this.conversationIdToOpenOnMessageLoad=t}else this.messageDetail.newInstance(this.messagesType)},r.prototype.isUnread=function(n){return n.message.detail.lastRead!==n.message.detail.lastMessageSent},r.prototype.composeNewMessage=function(){this.currentMessageData=null;this.messagesListView.items.forEach(function(n){n.isCurrent&&(n.isCurrent=!1)});this.messageDetail.destroy();this.messageDetail.newInstance(this.messagesType)},r.prototype.composeNewMessageToUser=function(i){return __awaiter(this,void 0,void 0,function(){var u,r;return __generator(this,function(f){switch(f.label){case 0:return this.messageDetail.destroy(),[4,t.GlobalData.getConversations(!0,1)];case 1:return u=f.sent(),r=n.Utilities.Enumerable.firstOrDefault(u.results,function(t){var r=n.Utilities.Enumerable.any(t.participants,function(t){return t.membershipId!==i.membershipId&&t.membershipId!==n.Utilities.User.loggedInUserBnetMembershipId});return t.participants.length===2&&!r}),r?this.messageDetail.newInstance(this.messagesType,r.detail.conversationId):(this.messageDetail.newInstance(this.messagesType),this.messageDetail.addParticipantFromUser(i)),[2]}})})},r.prototype.composeNewMessageToUsers=function(n){var t,i,r;for(this.messageDetail.destroy(),this.messageDetail.newInstance(this.messagesType),t=0,i=n;t<i.length;t++)r=i[t],this.messageDetail.addParticipantFromUser(r)},r.prototype.hideMessageDetail=function(){this.currentMessageData&&(this.currentMessageData.isCurrent=!1,this.currentMessageData=null);this.$messagesContainer.removeClass("show-detail")},r.prototype.getAvatars=function(n){for(var t,f,i=[],r=0,u=n.participants;r<u.length;r++)if((t=u[r],t.membershipId!==this.currentMembershipId)&&(t.membershipId in this.allResults.users&&(f=this.allResults.users[t.membershipId],i.push(f.profilePicturePath)),i.length>=4))break;return i},r.prototype.getParticipants=function(n){for(var t,f,r=[],i=0,u=n.participants;i<u.length;i++)(t=u[i],t.membershipId!==this.currentMembershipId)&&t.membershipId in this.allResults.users&&(f=this.allResults.users[t.membershipId],r.push(f.displayName));return r.join(", ")},r.prototype.getTimestamp=function(t){return n.Utilities.DateTime.toTimestamp(t.detail.lastMessageSent)},r.prototype.getTwoLineItemsFromAllMessages=function(n){for(var u,i=[],t=0,r=n;t<r.length;t++)u=r[t],i.push(this.getTwoLineItemFromMessage(u));return i},r.prototype.getTwoLineItemFromMessage=function(n){var t=null;if(this.messagesType===i.MessagesType.Messages)t={isCurrent:!1,title:this.getParticipants(n),subtitle:n.detail.body,iconCoin:{imagePath:this.getAvatars(n)[0]},flairCoin:{text:this.getTimestamp(n)},message:n};else{var r=this.allResults.groups[n.detail.ownerEntityId],u=this.allResults.users[n.detail.memberFromId],f=u?u.displayName+": "+n.detail.body:n.detail.body;r&&(t={isCurrent:!1,title:r.name,subtitle:f,iconCoin:{imagePath:r.avatarPath},flairCoin:{text:this.getTimestamp(n)},message:n})}return t},r}();i.MessagesList=r})(i=t.UserNotify||(t.UserNotify={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(t){var i;(function(i){var r=function(){function r(){this.chatClient=null;this.chatUI=null;this.messageMetadata={messagesType:0,metadata:null,hasRun:!1,composeParticipantsOptions:[],addedParticipants:[],conversationOptionsVisible:!1,showSearchAllUsers:!1,toText:""};this.eventBinder=new n.EventBinder("message-detail");this.hasRun=!1}return r.prototype.newInstance=function(u,f,e){var o=this,s;e===void 0&&(e=!1);this.destroy();this.messagesType=u;this.messagesContainerSelector=u===i.MessagesType.Messages?".js-messages-container":".js-group-messages-container";this.$messagesContainer=$(this.messagesContainerSelector);this.messageMetadata.messagesType=u;this.hasRun||(this.vueInit(),this.addListeners(),this.messageMetadata.hasRun=!0,this.hasRun=!0);this.conversationId=f;this.$messagesContainer.addClass("show-detail");this.conversationId?(clearTimeout(r.metadataRemovalTimer),this.getConversationDetails(),this.messageMetadata.composeParticipantsOptions=[],this.messageMetadata.addedParticipants=[]):setTimeout(function(){if(o.messageMetadata.addedParticipants.length===0){var t=new n.UiKit.FormKit.InputBoxItem("edit-participants");if(t.exists){t.on("clear",function(){o.messageMetadata.toText=""});setTimeout(function(){return t.focus()},100)}}o.chatUI.showEditor()},250);e&&(s=n.Utilities.Url.createQueryFromObject({conversation:f,messagesType:u},"#"),t.PageController.Instance.stateChange(s,!0,!1,!0));this.chatClientInit();t.MessageUpdate.Instance.ignoreToastsForConversationId(f)},r.prototype.destroy=function(){var n=this;clearTimeout(r.metadataRemovalTimer);this.hasRun&&(r.metadataRemovalTimer=setTimeout(function(){n.messageMetadata.metadata=null},250),this.messageMetadata.conversationOptionsVisible=!1,this.chatClient.destroy(),this.chatUI.destroy());this.conversationId&&t.MessageUpdate.Instance.unignoreToastsForConversationId(this.conversationId);this.messageMetadata.addedParticipants=[];this.messageMetadata.composeParticipantsOptions=[]},r.prototype.vueInit=function(){var t=this;this.messageMetadataVue=new Vue({el:this.$messagesContainer.find(".js-conversation-metadata")[0],data:this.messageMetadata,methods:{getParticipants:function(n){return t.getParticipants(n)},updateParticipantSuggestions:function(){return t.updateParticipantSuggestions()},hideMessageDetail:function(){return t.hideMessageDetail()},addParticipant:function(n){return t.addParticipant(n)},removeParticipant:function(n){return t.removeParticipant(n)},toggleConversationOptions:function(){return t.toggleConversationOptions()},getUserProfileUrl:function(n){return t.getUserProfileUrl(n)},getOneLineItemParticipants:function(n){return t.getOneLineItemParticipants(n)},searchAllUsers:function(){return t.searchAllUsers()},leaveConversation:function(){return t.leaveConversation()},popOutConversation:function(){return t.popOutConversation()}}});this.chatClient=new n.Chat.ClientVue;this.chatClient.subscribe({updateType:"onConversationCreated",onUpdate:function(n){n.result&&t.newInstance(i.MessagesType.Messages,n.result.conversationId)}});this.chatUI=new n.Chat.ChatUIVue(this.chatClient,{$conversationContainerElement:this.$messagesContainer.find(".js-conversation-container"),$editContainerElement:this.$messagesContainer.find(".js-edit-message-container"),chatContainerSelector:this.messagesContainerSelector+" .js-message-list",messageLoadingElementSelector:this.messagesContainerSelector+" .js-edit-container",inputSelector:this.messagesContainerSelector+" .js-compose"});this.chatUI.initialize()},r.prototype.addListeners=function(){var n=this;this.eventBinder.for($(document),".js-compose").on("focus",function(){n.messageMetadata.composeParticipantsOptions=[]})},r.prototype.getConversationDetails=function(){var t=this;bungieNetPlatform.messageService.GetConversationByIdV2(this.conversationId,Globals.TemplateFormat.BNet,function(n){t.messageMetadata.metadata=n},function(t){n.Utilities.Modals.Alert(t)})},r.prototype.chatClientInit=function(){var n=this.conversationId?this.conversationId:undefined;this.chatClient.start(n);this.chatUI.showEditor()},r.prototype.getParticipants=function(t){var u,r,o,f,e,s;if(!t)return"";if(u="",this.messagesType===i.MessagesType.Messages){for(r="",o=n.Utilities.Enumerable.where(t.users,function(t){return t.membershipId!==n.Utilities.User.loggedInUserBnetMembershipId}),f=0,e=o;f<e.length;f++)s=e[f],r.length>0&&(r+=", "),r+=s.displayName;u=r}else t.group&&(u=t.group.name);return u},r.prototype.updateParticipantSuggestions=function(){return __awaiter(this,void 0,void 0,function(){var r,u,i,f=this;return __generator(this,function(e){switch(e.label){case 0:return[4,t.GlobalData.getBungieFriendsByCurrentUser()];case 1:return r=e.sent(),u=r.friends,this.messageMetadata.toText.length>0&&(u=n.Utilities.Enumerable.where(r.friends,function(t){return n.Utilities.String.contains(t.bungieNetUser.displayName,f.messageMetadata.toText,n.StringCompareOptions.IgnoreCase|n.StringCompareOptions.IgnoreDiacritics)})),i=[],u.forEach(function(t){var u=n.Utilities.Enumerable.any(f.messageMetadata.addedParticipants,function(n){return n.membershipId===t.bungieNetUser.membershipId}),r;u||(r=t.bungieNetUser,i.push(f.getParticipantData(r.membershipId,r.cachedBungieGlobalDisplayName,r.cachedBungieGlobalDisplayNameCode,r.profilePicturePath)))}),this.messageMetadata.composeParticipantsOptions=i,i.length===0&&(this.messageMetadata.showSearchAllUsers=!0),[2]}})})},r.prototype.hideMessageDetail=function(){this.destroy();i.NotificationPane.Instance.messages&&i.NotificationPane.Instance.messages.hideMessageDetail();i.NotificationPane.Instance.groupMessages&&i.NotificationPane.Instance.groupMessages.hideMessageDetail()},r.prototype.addParticipant=function(t){var i,r,u;this.messageMetadata.addedParticipants=this.messageMetadata.addedParticipants||[];i=this.messageMetadata.addedParticipants;r=n.Utilities.Enumerable.any(this.messageMetadata.addedParticipants,function(n){return n.displayName===t.displayName});r||i.push(t);u=n.Utilities.Enumerable.select(i,function(n){return n.membershipId});this.chatClient.viewModel.newConversationParticipantsMembershipIds=u;this.messageMetadata.composeParticipantsOptions=[];this.messageMetadata.toText=""},r.prototype.addParticipantFromUser=function(n){var t=this.getParticipantData(n.membershipId,n.cachedBungieGlobalDisplayName,n.cachedBungieGlobalDisplayNameCode,n.profilePicturePath);this.addParticipant(t)},r.prototype.removeParticipant=function(t){var i=this.messageMetadata.addedParticipants,r;i.splice(i.indexOf(t),1);r=n.Utilities.Enumerable.select(i,function(n){return n.membershipId});this.chatClient.viewModel.newConversationParticipantsMembershipIds=r},r.prototype.getParticipantData=function(t,i,r,u){return{membershipId:t,title:i,displayName:i,flairCoin:{text:n.Utilities.User.StandardizeBungieGlobalCode(r)},iconCoin:{imagePath:n.Utilities.String.isNullOrWhiteSpace(u)?"/img/profile/avatars/default_avatar.gif":u}}},r.prototype.getUserProfileUrl=function(n){return PageUrls.profilePage+"/254/"+n},r.prototype.getOneLineItemParticipants=function(n){for(var r,t,u=[],i=0,f=n;i<f.length;i++)r=f[i],r.membershipId!==this.chatClient.viewModel.signedInUser.membershipId&&(t=this.messageMetadata.metadata.users[r.membershipId],u.push({membershipId:t.membershipId,displayName:t.displayName,title:t.displayName,iconCoin:{imagePath:t.profilePicturePath}}));return u},r.prototype.toggleConversationOptions=function(){this.messageMetadata.conversationOptionsVisible=!this.messageMetadata.conversationOptionsVisible},r.prototype.searchAllUsers=function(){var t=this;this.messageMetadata.showSearchAllUsers=!1;bungieNetPlatform.userService.SearchByGlobalNamePost({displayNamePrefix:this.messageMetadata.toText},0,function(i){var r=[];i.searchResults.forEach(function(i){var u=n.Utilities.Enumerable.any(t.messageMetadata.addedParticipants,function(n){return n.membershipId===i.bungieNetMembershipId});u||r.push(t.getParticipantData(i.bungieNetMembershipId,i.bungieGlobalDisplayName,i.bungieGlobalDisplayNameCode,""))});t.messageMetadata.composeParticipantsOptions=r},function(t){return n.Utilities.Modals.Alert(t)})},r.prototype.leaveConversation=function(){var t=this;bungieNetPlatform.messageService.LeaveConversation(this.conversationId,function(){n.Site.UserNotify.NotificationPane.Instance.messages.loadMessages();t.hideMessageDetail()},function(t){return n.Utilities.Modals.Alert(t)})},r.prototype.popOutConversation=function(){var n="/"+Localizer.CurrentCultureName+"/Messages/#conversation="+this.conversationId+"&messagesType="+this.messagesType;window.open(n,"popOutConversation","height=790,width=627,menubar=no,location=no,resizable=yes,scrollbars=no,status=no,toolbar=no")},r.metadataRemovalTimer=0,r}();i.MessageDetail=r})(i=t.UserNotify||(t.UserNotify={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})};__generator=this&&this.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},function(n){var t;(function(t){var i;(function(i){var r=function(){function i(){var t=this;this.$container=$(".js-notifications-container");this.eventBinder=new n.EventBinder("notifications");this.data={templateName:"notification-item",response:null,vueTemplateMethods:{getNotificationLink:function(n){return t.getNotificationLink(n)}},vueData:{items:null}}}return i.prototype.initialize=function(){this.vueInit();this.addListeners()},i.prototype.addListeners=function(){var n=this;this.eventBinder.for(".js-clear-notifications").on("click",function(){return n.clearNotifications()})},i.prototype.getData=function(){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(i){switch(i.label){case 0:return n=this.data,[4,t.GlobalData.getNotifications()];case 1:return n.response=i.sent(),this.data.vueData.items=this.makeNotificationUiData(this.data.response),[2]}})})},i.prototype.vueInit=function(){this.listView=new n.UiKit.ControlKit.ListView("notifications-list",this.data);this.listView.initialize()},i.prototype.makeNotificationUiData=function(n){for(var t,r=[],i=0,u=n.notifications;i<u.length;i++)t=u[i],r.push({notification:t,title:t.relatedItemDetail,subtitle:moment(t.createdDate).local().fromNow(),iconCoin:this.getNotificationIcon(t)});return r},i.prototype.clearNotifications=function(){var t=this;bungieNetPlatform.notificationService.ResetNotification(function(){t.data.vueData.items=[]},function(t){return n.Utilities.Modals.Alert(t)})},i.prototype.getNotificationIcon=function(t){var i="info",r=n.UiKit.CompanionKit.IconFont.Material;switch(t.notificationType){case Globals.NotificationType.MESSAGE:i="message";break;case Globals.NotificationType.FORUM_REPLY:i="forum";break;case Globals.NotificationType.COMMUNITY_CONTENT_LIKE:case Globals.NotificationType.COMMUNITY_CONTENT_APPROVED:case Globals.NotificationType.FORUM_LIKE:i="thumb_up";break;case Globals.NotificationType.SETTINGS_CHANGE:i="settings";break;case Globals.NotificationType.NEW_ACTIVITY_ROLLUP:case Globals.NotificationType.FOLLOW_USER_ACTIVITY:case Globals.NotificationType.FRIEND_USER_ACTIVITY:case Globals.NotificationType.FOLLOWED:i="public";break;case Globals.NotificationType.GROUP_ACCEPTANCE:case Globals.NotificationType.GROUP_JOIN_REQUEST:case Globals.NotificationType.GROUP_OPEN_JOIN:case Globals.NotificationType.GROUP_ALLIANCE_JOIN_REQUESTED:case Globals.NotificationType.GROUP_ALLIANCE_JOIN_REJECTED:case Globals.NotificationType.GROUP_ALLIANCE_JOIN_APPROVED:case Globals.NotificationType.GROUP_ALLIANCE_BROKEN:case Globals.NotificationType.GROUP_DENIAL:case Globals.NotificationType.GROUP_ALLIANCE_INVITE_REQUESTED:case Globals.NotificationType.GROUP_ALLIANCE_INVITE_REJECTED:case Globals.NotificationType.GROUP_ALLIANCE_INVITE_APPROVED:case Globals.NotificationType.GROUP_FOLLOWED_BY_GROUP:case Globals.NotificationType.GROUP_INDIVIDUAL_INVITE:case Globals.NotificationType.GROUP_SYSTEM_CHAT_MESSAGE:case Globals.NotificationType.GROUP_CHAT_MESSAGE:case Globals.NotificationType.CLAN_DISABLED:i="group";break;case Globals.NotificationType.GRIMOIRE_UNOBSERVED_CARDS:case Globals.NotificationType.RAF_NEWBIE_NEEDS_TO_PLAY_TTK:case Globals.NotificationType.RAF_TTK_QUEST_READY:i='<i class="icon-logodestiny">';r=n.UiKit.CompanionKit.IconFont.Bungle;break;case Globals.NotificationType.RECRUIT_THREAD_READY:case Globals.NotificationType.RECRUIT_THREAD_KICKED:case Globals.NotificationType.RECRUIT_THREAD_CANCELED:i='<i class="icon-companionfindfireteam">';r=n.UiKit.CompanionKit.IconFont.Bungle;break;case Globals.NotificationType.SUPPORT_FORM_RECEIVED:i="live_help";break;case Globals.NotificationType.APPLICATION_AUTHORIZED:i="perm_device_information";break;case Globals.NotificationType.USER_PROFILE_BANNED:case Globals.NotificationType.USER_MESSAGE_BANNED:case Globals.NotificationType.GROUP_PROFILE_WARNED:case Globals.NotificationType.GROUP_PROFILE_BANNED:case Globals.NotificationType.GROUP_PROFILE_BANNED_PERMANENT:case Globals.NotificationType.WARNED:case Globals.NotificationType.GROUP_WALL_BANNED:case Globals.NotificationType.BANNED_PERMANENT:case Globals.NotificationType.USER_PROFILE_BANNED_PERMANENT:case Globals.NotificationType.USER_MESSAGE_BANNED_PERMANENT:case Globals.NotificationType.GROUP_WALL_BANNED_PERMANENT:case Globals.NotificationType.GROUP_BANNED:case Globals.NotificationType.BANNED:case Globals.NotificationType.UNBANNED:i="error"}return{iconName:i,iconFont:r}},i.prototype.getNotificationLink=function(n){return"/"+Localizer.CurrentCultureName+"/Notification/"+n.notification.notificationId},i}();i.Notifications=r})(i=t.UserNotify||(t.UserNotify={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var i;(function(t){var i=function(n){function t(){var t=n.call(this,"notifications","")||this;return t.content=$("#notifications-template").html(),t}return __extends(t,n),t.prototype.open=function(){n.prototype.open.call(this)},t.prototype.addListeners=function(){n.prototype.addListeners.call(this)},t}(n.Modal);t.NotificationsModal=i})(i=t.UserNotify||(t.UserNotify={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i;(function(t){var i,r;(function(n){n[n.None=0]="None";n[n.Messages=1]="Messages";n[n.GroupMessages=2]="GroupMessages";n[n.Notifications=3]="Notifications"})(i=t.NotificationTabs||(t.NotificationTabs={}));r=function(){function r(){this.initialized=!1;this.eventBinder=new n.EventBinder("notifications-pane");this.$html=$("html");this.sidebarOpenClass="notifications-open";this.sidebarIsOpen=!1;this.isMessagesPage=!1;this.isMessagesFrame=!1;this.pageTitle=document.title;this.badgeData={allNotificationCount:0};this.notificationTabData={messageCount:0,notificationCount:0}}return Object.defineProperty(r.prototype,"$outerContainer",{get:function(){return this.isMessagesPage?$("#messages-container"):$("#notifications-sidebar")},enumerable:!0,configurable:!0}),r.prototype.initialize=function(){var u,r,f;n.Utilities.User.isAuthenticated&&!this.initialized&&(this.initialized=!0,this.eventBinder.destroy(),this.isMessagesPage=$("body.Messages").length>0,this.isMessagesFrame=!!location.search.match("iframe"),this.addListeners(),this.countsSubscription(),this.prepareHtml(),this.vueInit(),this.isMessagesPage&&(u=n.Utilities.Url.getQueryStringValue("tab"),r=i.Messages,u?r=i[u]:(f=Number(n.Utilities.Url.getQueryStringValue("messagesType","#")),f===t.MessagesType.GroupMessages&&(r=i.GroupMessages)),this.open(r)))},r.prototype.addListeners=function(){var n=this;this.eventBinder.for($(window)).on("popstate",function(){n.sidebarIsOpen&&n.close()});this.eventBinder.for($(document),".toast-message").on("click",function(t){var u=$(t.currentTarget),r=u.find(".btn_gotomessage"),i;r.length>0&&(i=r.attr("data-messageid"),i&&(n.open(),n.messages.showMessageDetail(i)))});this.eventBinder.for(this.$outerContainer,".tab").on("click",function(t){var r=$(t.currentTarget),u=r.attr("data-tab"),f=i[u];n.activateTab(f)});if(Modernizr.mobile){this.adjustSidebarHeightForMobile();this.eventBinder.for($(window)).on("load resize",function(){return n.adjustSidebarHeightForMobile()})}},r.prototype.countsSubscription=function(){var t=this;n.NotificationCount.Manager.Instance.viewModel.subscribe({onUpdate:function(n){return t.onNotificationUpdate(n)}})},r.prototype.setPageTitle=function(n){document.title=n>0?"("+n+") "+this.pageTitle:this.pageTitle},r.prototype.prepareHtml=function(){var t=$("#notifications-template").html(),n;this.$outerContainer.html(t);n=this.$outerContainer.find(".notifications-container");ko.cleanNode(n[0]);ko.applyBindings(viewModels,n[0])},r.prototype.activateTab=function(n){var r,u,f;n===i.Notifications?(this.notifications||(this.notifications=new t.Notifications,this.notifications.initialize()),this.notifications.getData()):n!==i.Messages||this.messages?n!==i.GroupMessages||this.groupMessages||(r=this.isMessagesPage&&!this.isMessagesFrame,this.groupMessages=new t.Messages(t.MessagesType.GroupMessages,r),this.groupMessages.initialize()):(r=this.isMessagesPage&&!this.isMessagesFrame,this.messages=new t.Messages(t.MessagesType.Messages,r),this.messages.initialize());u=i[n];f=this.$outerContainer;f.find(".tab.active, .tab-contents.active").removeClass("active");f.find(".tab[data-tab='"+u+"'], .tab-contents[data-tab='"+u+"']").addClass("active")},r.prototype.onNotificationUpdate=function(n){var t=n.counts.messages+n.counts.notifications;this.setPageTitle(t);this.badgeData.allNotificationCount=t;this.notificationTabData.messageCount=n.counts.messages;this.notificationTabData.notificationCount=n.counts.notifications},r.prototype.vueInit=function(){var n=this;this.badgeVue=new Vue({el:$(".js-notification-badges")[0],data:this.badgeData,methods:{toggleNotifications:function(t){return t.preventDefault(),n.toggle(),!1}}});this.notificationTabsVue=new Vue({el:$(".js-notification-pane-tabs")[0],data:this.notificationTabData})},r.prototype.open=function(t){var r=this;t===void 0&&(t=i.None);this.sidebarIsOpen||(this.isMessagesPage||this.$html.addClass(this.sidebarOpenClass),n.Utilities.Modals.lockBodyScroll(!0),this.sidebarIsOpen=!0,window.requestAnimationFrame(function(){r.eventBinder.for($(document)).on("click.close-notifications touchend.close-notifications",function(n){var t=$(n.target),i=$.contains(document,t[0]);i&&t.closest("#notifications-sidebar, #messages-container, .modal-container").length===0&&window.requestAnimationFrame(function(){return r.close()})})}));t===i.None&&(t=i.Messages);this.notificationTabData.messageCount=n.NotificationCount.ViewModel.counts.messages;this.notificationTabData.notificationCount=n.NotificationCount.ViewModel.counts.notifications;this.activateTab(t)},r.prototype.close=function(t){t===void 0&&(t=!1);(this.sidebarIsOpen||t)&&(this.$html.removeClass(this.sidebarOpenClass),n.Utilities.Modals.unlockBodyScroll(),this.sidebarIsOpen=!1,this.messages&&this.messages.hideMessageDetail(),this.eventBinder.for($(document)).off(".close-notifications"))},r.prototype.toggle=function(){this.isMessagesPage||(this.sidebarIsOpen?this.close():this.open())},r.prototype.showConversation=function(n,r){var u=i.Messages;r===t.MessagesType.GroupMessages&&(u=i.GroupMessages);this.open(u);this.messages.showMessageDetail(n)},r.prototype.newMessageToUser=function(n){this.open(i.Messages);this.messages.newMessageToUser(n)},r.prototype.newMessageToUsers=function(n){this.open(i.Messages);this.messages.newMessageToUsers(n)},r.prototype.adjustSidebarHeightForMobile=function(){var n=window.innerHeight-$("nav.Nav_Top").height();$("#notifications-sidebar").height(n)},r.Instance=new r,r}();t.NotificationPane=r})(i=t.UserNotify||(t.UserNotify={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(n){(this.notificationsToCache=[],this.localStorageKeyPrefix="liveUpdateItems.",this.isCountCachedLocalStorageKey="isCountCached",this.countExpireLocalStorageKey="countExpire",this.notificationSource="cache",Modernizr.localstorage)&&(this.notificationsToCache=[t.NotificationTypes.Announcements,t.NotificationTypes.GroupMessageCount,t.NotificationTypes.MessageCount,t.NotificationTypes.NotificationCount,t.NotificationTypes.OnlineFriendCount,t.NotificationTypes.ProviderNeedsReauth],this.distributor=n)}return i.prototype.initialize=function(){this.addListeners()},i.prototype.gatherCachedItems=function(){for(var r,u,f=[],i=0;i<this.notificationsToCache.length;i++)r=t.NotificationTypes[this.notificationsToCache[i]],n.Utilities.LocalStorage.getItem(this.localStorageKeyPrefix+r)!==null&&(u=JSON.parse(n.Utilities.LocalStorage.getItem(this.localStorageKeyPrefix+r)),u.source=this.notificationSource,f.push(u));return f},i.prototype.updateNotificationDistributor=function(){for(var t=this.gatherCachedItems(),n=0;n<t.length;n++)this.distributor.broadcast(t[n])},i.prototype.addListeners=function(){for(var i=this,r=0;r<this.notificationsToCache.length;r++)this.distributor.subscribe({notificationType:this.notificationsToCache[r],onUpdate:function(r){var u=r.notification,f;u.source!==i.notificationSource&&(f=t.NotificationTypes[u.notificationType],u.source=i.notificationSource,n.Utilities.LocalStorage.setItem(i.localStorageKeyPrefix+f,JSON.stringify(u)),i.setLocalStorageSettings())}})},i.prototype.millisecondsUntilCacheExpires=function(){var i,t,r;return Modernizr.localstorage?(i=n.Utilities.LocalStorage.getItem(this.localStorageKeyPrefix+this.isCountCachedLocalStorageKey)!==null?!0:!1,i&&(t=n.Utilities.LocalStorage.getItem(this.localStorageKeyPrefix+this.countExpireLocalStorageKey),t!==null))?(r=(new Date).getTime(),t-r):0:ServerVars.GetCountsInterval},i.prototype.hasCacheExpired=function(){var i,t;try{return i=n.Utilities.LocalStorage.getItem(this.localStorageKeyPrefix+this.isCountCachedLocalStorageKey)!==null,t=n.Utilities.LocalStorage.getItem(this.localStorageKeyPrefix+this.countExpireLocalStorageKey),t!==null?!i||(new Date).getTime()>t:!0}catch(r){return!0}},i.prototype.setLocalStorageSettings=function(){var t=(new Date).getTime()+ServerVars.GetCountsInterval-2e3,i=this.localStorageKeyPrefix+this.isCountCachedLocalStorageKey,r=this.localStorageKeyPrefix+this.countExpireLocalStorageKey;n.Utilities.LocalStorage.setItem(i,"1");n.Utilities.LocalStorage.setItem(r,t.toString())},i}();t.CacheDataSource=i})(t=n.NotificationCount||(n.NotificationCount={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var f,i,r,u;(function(n){n[n.OnlineFriendCount=0]="OnlineFriendCount";n[n.NotificationCount=1]="NotificationCount";n[n.MessageCount=2]="MessageCount";n[n.GroupMessageCount=3]="GroupMessageCount";n[n.ProviderNeedsReauth=4]="ProviderNeedsReauth";n[n.Announcements=5]="Announcements"})(f=t.NotificationTypes||(t.NotificationTypes={}));i=function(n){function t(){return n.call(this,r)||this}return __extends(t,n),t.prototype.getPayloadsToUpdate=function(n){for(var t,r,f=[],i=0,e=this.subscriptions;i<e.length;i++)t=e[i],r=void 0,r=t.params.notificationType instanceof Array?t.params.notificationType.indexOf(n.notificationType)>0:t.params.notificationType===n.notificationType,r&&f.push(new u(t,n));return f},t.prototype.broadcast=function(n){var t=this.getPayloadsToUpdate(n);this.updateSubscriptions(t)},t}(n.Site.Subscribable);t.Distributor=i;r=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t}(n.Site.Subscription);u=function(n){function t(t,i){var r=n.call(this,t)||this;return r.notification=i,r}return __extends(t,n),t}(n.Site.SubscriptionPayload)})(t=n.NotificationCount||(n.NotificationCount={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(n){this.notificationSource="eventing";this.distributor=n;this.friendCounts={Xuid:0,Psnid:0}}return i.prototype.initialize=function(){this.addListeners()},i.prototype.addListeners=function(){var i=this;n.EventMux.subscribe({eventType:Globals.RealTimeEventType.NotificationsChanged,onUpdate:function(n){var r=n.update,u={source:i.notificationSource,notificationType:t.NotificationTypes.NotificationCount,notificationCount:r.notificationCount};i.distributor.broadcast(u)}});n.EventMux.subscribe({eventType:Globals.RealTimeEventType.MessageCounts,onUpdate:function(n){var r=n.update,f={source:i.notificationSource,notificationType:t.NotificationTypes.MessageCount,messageCount:r.privateMessageCount},u;i.distributor.broadcast(f);u={source:i.notificationSource,notificationType:t.NotificationTypes.GroupMessageCount,groupMessageCount:r.externalMessageCount};i.distributor.broadcast(u)}});n.EventMux.subscribe({eventType:Globals.RealTimeEventType.FriendCounts,onUpdate:function(n){var r=n.update,u,f,e;r.friendCounts.Xuid!==undefined&&(i.friendCounts.Xuid=r.friendCounts.Xuid);r.friendCounts.Psnid!==undefined&&(i.friendCounts.Psnid=r.friendCounts.Psnid);u=i.friendCounts.Xuid+i.friendCounts.Psnid;f={source:i.notificationSource,notificationType:t.NotificationTypes.OnlineFriendCount,onlineFriendCount:u};i.distributor.broadcast(f);e={source:i.notificationSource,notificationType:t.NotificationTypes.ProviderNeedsReauth,providersNeedingReauth:r.needsReauth};i.distributor.broadcast(e)}});n.EventMux.subscribe({eventType:Globals.RealTimeEventType.Announcements,onUpdate:function(n){var r=n.update,u={source:i.notificationSource,notificationType:t.NotificationTypes.Announcements,acks:r.announcements};i.distributor.broadcast(u)}})},i}();t.EventDataSource=i})(t=n.NotificationCount||(n.NotificationCount={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(){this.distributor=new t.Distributor}return i.prototype.initialize=function(){this.cacheDataSource=new t.CacheDataSource(this.distributor);this.pollingDataSource=new t.PollingDataSource(this.distributor,this);this.eventDataSource=new t.EventDataSource(this.distributor);this.viewModel=new t.ViewModel(this.distributor);this.cacheDataSource.initialize();this.pollingDataSource.initialize();this.eventDataSource.initialize();this.viewModel.initialize()},i.prototype.start=function(){this.cacheDataSource.updateNotificationDistributor();this.initializePolling()},i.prototype.initializePolling=function(){this.cacheDataSource.hasCacheExpired()?this.pollingDataSource.getCounts():this.pollingDataSource.nextGetCounts()},i.prototype.getPollingTimeoutInMilliseconds=function(){var n=this.cacheDataSource.millisecondsUntilCacheExpires();return n<0&&(n=0),n+2e3},i.prototype.forceGetCounts=function(){this.pollingDataSource.getCounts()},i.prototype.broadcastUpdates=function(n){this.distributor.broadcast(n)},i.prototype.broadcastAllUpdates=function(t,i){i&&n.EventMux.isActive||(t.notificationCount?this.broadcastUpdates({source:"fixup",notificationType:n.NotificationCount.NotificationTypes.NotificationCount,notificationCount:t.notificationCount}):typeof t.messageCount!="undefined"?this.broadcastUpdates({source:"fixup",notificationType:n.NotificationCount.NotificationTypes.MessageCount,messageCount:t.messageCount}):typeof t.groupMessageCount!="undefined"&&this.broadcastUpdates({source:"fixup",notificationType:n.NotificationCount.NotificationTypes.GroupMessageCount,messageCount:t.groupMessageCount}))},i.Instance=new i,i}();t.Manager=i})(t=n.NotificationCount||(n.NotificationCount={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i=function(){function i(n,t){this.notificationSource="polling";this.distributor=n;this.pollingTimeoutComputationProvider=t;this.enabled=ServerVars.GetCountsEnabled}return i.prototype.initialize=function(){this.addListeners()},i.prototype.isAuthenticated=function(){return n.EventMux.isAuthed},i.prototype.getCounts=function(){var n=this;this.enabled&&!this.isPageHidden()&&this.isAuthenticated()&&(this.stopPolling(),bungieNetPlatform.userService.GetCountsForCurrentUser(function(i){var f={source:n.notificationSource,notificationType:t.NotificationTypes.ProviderNeedsReauth,providersNeedingReauth:i.providersNeedingReauth},r,u;n.distributor.broadcast(f);r={source:n.notificationSource,notificationType:t.NotificationTypes.NotificationCount,notificationCount:i.notificationCount};n.distributor.broadcast(r);u={source:n.notificationSource,notificationType:t.NotificationTypes.MessageCount,messageCount:i.messageCount};n.distributor.broadcast(u);n.nextGetCounts()},function(t){t.errorCode===Globals.PlatformErrorCodes.WebAuthRequired||t.errorCode===Globals.PlatformErrorCodes.SystemDisabled?n.enabled=!1:n.nextGetCounts()}))},i.prototype.isPageHidden=function(){return $("html").hasClass("hidden")},i.prototype.addListeners=function(){var n=this;$(document).on("browserWindowIsRevealing",function(){n.nextGetCounts()});$(document).on("browserWindowIsHiding",function(){n.stopPolling()})},i.prototype.nextGetCounts=function(){var t=this,n;this.enabled&&(this.stopPolling(),n=this.pollingTimeoutComputationProvider.getPollingTimeoutInMilliseconds(),this.getCountsUpdateTimer=setTimeout(function(){t.getCounts()},n))},i.prototype.stopPolling=function(){clearTimeout(this.getCountsUpdateTimer)},i}();t.PollingDataSource=i})(t=n.NotificationCount||(n.NotificationCount={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}();viewModels=viewModels||{};viewModels.newNotifications=ko.observable(0);viewModels.unreadMessages=ko.observable(0);viewModels.unreadGroupMessages=ko.observable(0);viewModels.onlineFriendCount=ko.observable(0);viewModels.acks=ko.observable({}),function(n){var t;(function(t){var u=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t}(n.Site.Subscription),i=function(n){function t(t,i){var r=n.call(this,t)||this;return r.counts=i,r}return __extends(t,n),t}(n.Site.SubscriptionPayload),r;t.NotificationCountPayload=i;r=function(n){function r(t){var i=n.call(this,u)||this;return i.distributor=t,i}return __extends(r,n),r.prototype.initialize=function(){this.addSubscriptions()},r.prototype.notificationCount=function(n){r.counts.notifications=n.notificationCount;this.broadcast()},r.prototype.messageCount=function(n){r.counts.messages=n.messageCount;this.broadcast()},r.prototype.groupMessageCount=function(n){r.counts.groupMessages=n.groupMessageCount;this.broadcast()},r.prototype.onlineFriendCount=function(n){r.counts.onlineFriends=n.onlineFriendCount;this.broadcast()},r.prototype.acks=function(n){r.counts.acks=n.acks;this.broadcast()},r.prototype.providersNeedingReauth=function(n){var t=n.providersNeedingReauth,i;if(t&&t.length>0)for(i=0;i<t.length;i++)t[i]===Globals.BungieCredentialType.Psnid?$(".reauthPSN.hide").length&&$(".reauthPSN.hide").removeClass("hide"):t[i]==Globals.BungieCredentialType.Xuid&&$(".reauthXbox.hide").length&&$(".reauthXbox.hide").removeClass("hide")},r.prototype.addSubscriptions=function(){var n=this;this.distributor.subscribe({onUpdate:function(t){return n.notificationCount(t.notification)},notificationType:t.NotificationTypes.NotificationCount});this.distributor.subscribe({onUpdate:function(t){return n.messageCount(t.notification)},notificationType:t.NotificationTypes.MessageCount});this.distributor.subscribe({onUpdate:function(t){return n.groupMessageCount(t.notification)},notificationType:t.NotificationTypes.GroupMessageCount});this.distributor.subscribe({onUpdate:function(t){return n.onlineFriendCount(t.notification)},notificationType:t.NotificationTypes.OnlineFriendCount});this.distributor.subscribe({onUpdate:function(t){return n.providersNeedingReauth(t.notification)},notificationType:t.NotificationTypes.ProviderNeedsReauth});this.distributor.subscribe({onUpdate:function(t){return n.acks(t.notification)},notificationType:t.NotificationTypes.Announcements})},r.prototype.getPayloadsToUpdate=function(){for(var f,t=[],n=0,u=this.subscriptions;n<u.length;n++)f=u[n],t.push(new i(f,r.counts));return t},r.counts={notifications:0,messages:0,groupMessages:0,onlineFriends:0,acks:{}},r}(n.Site.Subscribable);t.ViewModel=r})(t=n.NotificationCount||(n.NotificationCount={}))}(Bnet||(Bnet={}));__extends=this&&this.__extends||function(){var n=function(t,i){return n=Object.setPrototypeOf||{__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)}}(),function(n){var t;(function(t){var i;(function(i){var r=function(n){function r(){var t=n.call(this,"search-container","")||this;return t.content=$("#search-container-template").html(),t.originalUrl=window.location.href,t}return __extends(r,n),r.prototype.open=function(){var t=this;n.prototype.open.call(this);this.pane=new i.SearchPane;this.pane.initialize();this.pane.searchInput.focus();this.paneVueModel=new Vue({el:$("#search-container .view-all")[0],data:this.pane.paneDataModel,computed:{searchUrl:function(){return t.pane.searchUrl}}})},r.prototype.close=function(){n.prototype.close.call(this);t.PageController.Instance.stateChange(this.originalUrl,!0,!1,!0)},r}(n.Modal);i.SearchModal=r})(i=t.Search||(t.Search={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(t){var i;(function(i){var r,u,f;(function(n){n[n.None=0]="None";n[n.Items=1]="Items";n[n.Activities=2]="Activities";n[n.Support=3]="Support";n[n.Users=4]="Users";n[n.News=5]="News";n[n.Clans=6]="Clans";n[n.DestinyPlayers=7]="DestinyPlayers"})(r=i.SearchTabs||(i.SearchTabs={}));u=function(){function t(t,i,r,u,f,e,o){this.minimumSearchTermLength=t;this.resultListElementIdentifier=i;this.resultListTemplateName=r;this.tabSelector=u;this.tab=f;this.searchPaneDataModel=e;this.searchAction=o;this.lastSearchTerm="";this.showTab=!0;this.hasResults=!1;this.isCurrentTab=!1;this.hasSearched=!1;this.hasMore=!1;this.isLoading=!1;this.knownResultCount=0;this.currentPage=1;this.searchPaneModel=e;this.enabled=!0;var s=$(this.tabSelector).attr("data-enabled");s!=="true"&&(this.enabled=!1,this.showTab=!1);this.listView=new n.UiKit.ControlKit.ListView(i,{templateName:r,vueData:{items:[]},vueTemplateMethods:{},optionalItemParams:{}})}return t.prototype.initialize=function(){var n=this;this.vueModel=new Vue({el:$(this.tabSelector)[0],data:this,computed:{showSearchResults:function(){return n.hasSearched&&!n.isLoading&&n.knownResultCount>0}}});this.listView.initialize()},t.prototype.showPage=function(){return this.hasResults&&(this.hasMore||this.currentPage>1)},t.prototype.isUpdateCurrent=function(n,t,i){return n===t&&this.currentPage===i},t.prototype.setItems=function(n,t){t==1?this.listView.setItems(n):this.listView.addItems(n)},t.prototype.search=function(n){var t=this;return!this.enabled||n.length<this.minimumSearchTermLength?new Promise(function(i){t.actOnUpdateCurrent(n,n,1,!1,!1,0,0,function(){t.setItems([],1)});var r={};r[t.tab]=0;i(r)}):(this.lastSearchTerm=n,this.searchAction(this.currentPage,n,this))},t.prototype.actOnError=function(n,t,i,r){var u=this;r.isUpdateCurrent(n,t,i)&&r.actOnUpdateCurrent(n,t,i,!1,!0,0,0,function(){u.setItems([],1)})},t.prototype.actOnUpdateCurrent=function(n,t,i,r,u,f,e,o){this.isUpdateCurrent(n,t,i)&&(o(),this.currentPage=i,this.hasResults=u,this.hasMore=r,this.isLoading=!1,this.hasSearched=!0,this.knownResultCount=(i-1)*f+e,this.showTab=this.knownResultCount>0||this.isOnlyTab,this.setAsCurrentTab(),this.searchPaneModel.hasNextPage=this.hasMore)},t.prototype.setAsCurrentTab=function(){var u,n,t,i;if(this.searchPaneModel.currentTabModel!==this){this.isCurrentTab=!0;this.currentPage=this.searchPaneModel.currentPage;this.searchPaneModel.currentTab=this.tab;this.searchPaneModel.currentTabModel=this;this.searchPaneModel.hasResults=this.currentPage>1||this.hasResults;this.searchPaneModel.hasPreviousPage=this.currentPage>1;this.searchPaneModel.hasNextPage=this.hasMore;this.searchPaneModel.showPage=this.hasResults&&(this.hasMore||this.currentPage>1);for(u in this.searchPaneModel.searchResultModels)n=this.searchPaneModel.searchResultModels[u],n!==this&&(n.currentPage=1,n.isCurrentTab=!1);t=r[this.tab];i=$("#search-container");i.find(".tab.active, .tab-contents.active").removeClass("active");i.find(".tab[data-tab='"+t+"'], .tab-contents[data-tab='"+t+"']").addClass("active")}},t}();i.SearchResultSummaryModel=u;f=function(){function i(){this.eventBinder=new n.EventBinder("search");this.searchModal=null;this.paneDataModel={currentTab:r.None,currentPage:1,currentValue:"",hasPreviousPage:!1,hasNextPage:!1,hasResults:!1,showPage:!1,currentTabModel:null,searchResultModels:{},onlyTab:r.None}}return i.prototype.initialize=function(){this.paneDataModel.currentValue=t.getPageDataOrDefault("Query","");this.paneDataModel.currentPage=t.getPageDataOrDefault("Page",1);this.paneDataModel.onlyTab=t.getPageDataOrDefault("Type",r.None);this.paneDataModel.currentTab=this.paneDataModel.onlyTab;this.paneDataModel.currentTab==r.None&&(this.paneDataModel.currentTab=r.News);this.paneDataModel.hasPreviousPage=this.paneDataModel.currentPage>1;this.paneDataModel.hasNextPage=!1;this.paneDataModel.hasResults=!1;this.$outerContainer=$("#search-container");this.searchInput=new n.UiKit.FormKit.InputBoxItem("search-input");this.eventBinder.destroy();this.addListeners();this.prepareHtml();this.vueInit();this.paneDataModel.currentValue!==""&&this.searchInput.setValue(this.paneDataModel.currentValue);this.activateTab(this.paneDataModel.currentTab)},Object.defineProperty(i.prototype,"currentValue",{get:function(){return this.searchInput.value},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"searchUrl",{get:function(){return"/"+Localizer.CurrentCultureName+"/Search?query="+this.currentValue+"&type="+this.paneDataModel.onlyTab},enumerable:!0,configurable:!0}),i.prototype.activateTab=function(n){this.activateTabUi(n);this.onInputReady()},i.prototype.activateTabUi=function(n){var t=this.paneDataModel.searchResultModels[n];t.setAsCurrentTab()},i.prototype.setCurrentValue=function(){var n=this.paneDataModel.searchResultModels,t,i;for(t in n)n.hasOwnProperty(t)&&(i=n[t],i.isLoading=!0)},i.prototype.setLoadingComplete=function(){var n,t,i;$(".list-item-container").destinyLoader("stop");n=this.paneDataModel.searchResultModels;for(t in n)n.hasOwnProperty(t)&&(i=n[t],i.isLoading=!1)},i.prototype.addListeners=function(){var n=this;this.eventBinder.for($("#search-container input")).on("keyup",function(){var t=n.currentValue;n.paneDataModel.currentPage>1&&(n.paneDataModel.currentPage=n.paneDataModel.currentTabModel.currentPage=1,n.paneDataModel.hasPreviousPage=n.paneDataModel.currentPage>1);n.setCurrentValue(t)});this.searchInput.on("keyup",function(t){return n.onSearchKeyUp(t.event)});this.eventBinder.for(this.$outerContainer,".tab").on("click",function(t){var i=$(t.currentTarget),u=i.attr("data-tab"),f=r[u];n.activateTabUi(f)})},i.prototype.prepareHtml=function(){var n=$("#search-template").html();this.$outerContainer.html(n)},i.prototype.onSearchKeyUp=function(t){var i=this;t.which!==n.Key.Escape&&(n.Utilities.String.isNullOrWhiteSpace(this.currentValue)?this.onInputReady():n.Utilities.Input.delayCallbackAfterInput("search-delay",function(){return i.onInputReady()},500))},i.prototype.vueInit=function(){var t=this,i,f;this.paneDataModel.searchResultModels[r.News]=new u(3,"news-list","news-item-template",".search-results-template .tabs-container .tabs .news",r.News,this.paneDataModel,function(i,u,f){if(!n.Utilities.String.isNullOrWhiteSpace(u))return new Promise(function(n){bungieNetPlatform.contentService.SearchContentWithText(Localizer.CurrentCultureName,!1,"News",null,i,u,"WebGlobal",function(i){f.actOnUpdateCurrent(t.currentValue,u,i.query.currentPage,i.hasMore,i.results.length>0,i.query.itemsPerPage,i.results.length,function(){f.setItems(t.buildTwoLineItemsFromNews(i),i.query.currentPage)});var e={};e[r.News]=i.results.length;n(e)},function(){f.actOnError(t.currentValue,u,i,f);var e={};e[r.News]=0;n(e)})})});this.paneDataModel.searchResultModels[r.Support]=new u(3,"support-list","support-item-template",".search-results-template .tabs-container .tabs .support",r.Support,this.paneDataModel,function(i,u,f){if(!n.Utilities.String.isNullOrWhiteSpace(u))return new Promise(function(n){bungieNetPlatform.contentService.SearchContentWithText(Localizer.CurrentCultureName,!1,"Help HelpStep",null,i,u,"WebGlobal",function(i){f.actOnUpdateCurrent(t.currentValue,u,i.query.currentPage,i.hasMore,i.results.length>0,i.query.itemsPerPage,i.results.length,function(){f.setItems(t.buildTwoLineItemsFromSupport(i),i.query.currentPage)});var e={};e[r.Support]=i.results.length;n(e)},function(){f.actOnError(t.currentValue,u,i,f);var e={};e[r.Support]=0;n(e)})})});this.paneDataModel.searchResultModels[r.Users]=new u(3,"users-list","users-item-template",".search-results-template .tabs-container .tabs .users",r.Users,this.paneDataModel,function(i,u,f){if(!n.Utilities.String.isNullOrWhiteSpace(u))return new Promise(function(n){var e=1;bungieNetPlatform.userService.SearchByGlobalNamePrefix(u,i-e,function(i){f.actOnUpdateCurrent(t.currentValue,u,i.page+e,i.hasMore,i.searchResults.length>0,50,i.searchResults.length,function(){f.setItems(t.buildTwoLineItemsFromUsers(i),i.page+e)});var o={};o[r.Users]=i.searchResults.length;n(o)},function(){f.actOnError(t.currentValue,u,i,f);var e={};e[r.Users]=0;n(e)})})});this.paneDataModel.searchResultModels[r.DestinyPlayers]=new u(3,"destinyplayers-list","destinyplayers-item-template",".search-results-template .tabs-container .tabs .destinyplayers",r.DestinyPlayers,this.paneDataModel,function(i,u,f){if(!n.Utilities.String.isNullOrWhiteSpace(u)){var e=u.split("#");return new Promise(function(n){bungieNetPlatform.destiny2Service.SearchDestinyPlayerByBungieName({displayName:e[0]?e[0]:"",displayNameCode:e[1]?parseInt(e[1],10):0},Globals.BungieMembershipType.All,function(i){f.actOnUpdateCurrent(t.currentValue,u,1,!1,i.length>0,i.length,i.length,function(){f.setItems(t.buildTwoLineItemsFromDestinyPlayers(i),1)});var e={};e[r.DestinyPlayers]=i.length;n(e)},function(){f.actOnError(t.currentValue,u,i,f);var e={};e[r.DestinyPlayers]=0;n(e)})})}});this.paneDataModel.searchResultModels[r.Activities]=new u(3,"activities-list","activities-item-template",".search-results-template .tabs-container .tabs .activities",r.Activities,this.paneDataModel,function(i,u,f){return n.Utilities.String.isNullOrWhiteSpace(u)?null:new Promise(function(n){bungieNetPlatform.destiny2Service.SearchDestinyEntities("DestinyActivityDefinition",u,i-1,function(i){f.actOnUpdateCurrent(t.currentValue,u,i.results.query.currentPage+1,i.results.hasMore,i.results.results.length>0,i.results.query.itemsPerPage,i.results.results.length,function(){f.setItems(t.buildTwoLineItemsFromDestinyEntity(i.results),i.results.query.currentPage+1)});var e={};e[r.Activities]=i.results.results.length;n(e)},function(){f.actOnError(t.currentValue,u,i,f);var e={};e[r.Activities]=0;n(e)})})});this.paneDataModel.searchResultModels[r.Items]=new u(2,"items-list","items-item-template",".search-results-template .tabs-container .tabs .items",r.Items,this.paneDataModel,function(i,u,f){if(!n.Utilities.String.isNullOrWhiteSpace(u))return new Promise(function(n){bungieNetPlatform.destiny2Service.SearchDestinyEntities("DestinyInventoryItemDefinition",u,i-1,function(i){f.actOnUpdateCurrent(t.currentValue,u,i.results.query.currentPage+1,i.results.hasMore,i.results.results.length>0,i.results.query.itemsPerPage,i.results.results.length,function(){f.setItems(t.buildTwoLineItemsFromDestinyEntity(i.results),i.results.query.currentPage+1)});var e={};e[r.Items]=i.results.results.length;n(e)},function(){f.actOnError(t.currentValue,u,i,f);var e={};e[r.Items]=0;n(e)})})});this.paneDataModel.searchResultModels[r.Clans]=new u(3,"clans-list","clans-item-template",".search-results-template .tabs-container .tabs .clans",r.Clans,this.paneDataModel,function(i,u,f){if(!n.Utilities.String.isNullOrWhiteSpace(u))return new Promise(function(n){var e={name:u,groupType:Globals.GroupType.Clan,creationDate:Globals.GroupDateRange.All,sortBy:Globals.GroupSortBy.Id,groupMemberCountFilter:null,localeFilter:null,tagText:null,currentPage:i,itemsPerPage:25,requestContinuationToken:null};bungieNetPlatform.groupV2Service.GroupSearch(e,function(i){f.actOnUpdateCurrent(t.currentValue,u,i.query.currentPage,i.hasMore,i.results.length>0,i.query.itemsPerPage,i.results.length,function(){f.setItems(t.buildTwoLineItemsFromGroup(i),i.query.currentPage)});var e={};e[r.Clans]=i.results.length;n(e)},function(){f.actOnError(t.currentValue,u,i,f);var e={};e[r.Clans]=0;n(e)})})});n.Utilities.Enumerable.foreach(this.paneDataModel.searchResultModels,function(n){n.initialize()});i=$(".page-options");i.length>0&&(f=new Vue({el:i[0],data:this.paneDataModel,methods:{gotoPreviousPage:function(){return t.gotoPreviousPage()},gotoNextPage:function(){return t.gotoNextPage()}}}))},i.prototype.gotoPreviousPage=function(){this.paneDataModel.currentTabModel.currentPage--;this.paneDataModel.currentPage=this.paneDataModel.currentTabModel.currentPage;this.paneDataModel.hasPreviousPage=this.paneDataModel.currentPage>1;$(window).scrollTop(0);this.onInputReady()},i.prototype.gotoNextPage=function(){this.paneDataModel.currentTabModel.currentPage++;this.paneDataModel.currentPage=this.paneDataModel.currentTabModel.currentPage;this.paneDataModel.hasPreviousPage=this.paneDataModel.currentPage>1;this.onInputReady()},i.prototype.onInputReady=function(){var u=this,e=t.routeValues?t.routeValues.controller.toLowerCase()==="search":!0,i,r,f;t.PageController.Instance.stateChange(this.searchUrl,e,!1,!0);n.Utilities.String.isNullOrWhiteSpace(this.currentValue)?this.$outerContainer.removeClass("active"):this.$outerContainer.hasClass("active")||this.$outerContainer.addClass("active");i=this.paneDataModel.searchResultModels;r=[];for(f in i)this.startSearchOnModel(i[f],r);Promise.all(r).then(function(n){for(var t,i,s=n.sort(function(n,t){var i=Number(Object.keys(n)[0]),r=Number(Object.keys(t)[0]);return i-r}),f=0,e=!1,r=0,o=s;r<o.length;r++){t=o[r];for(i in t)t[i]>0&&(f+=t[i],e||(u.activateTabUi(Number(i)),e=!0))}u.$outerContainer.toggleClass("no-results",f===0)}).catch(function(t){n.error(t)})},i.prototype.startSearchOnModel=function(n,t){if(n.lastSearchTerm!==this.currentValue||n.isCurrentTab){var i=n.search(this.currentValue);t.push(i)}},i.prototype.buildTwoLineItemsFromUsers=function(n){for(var r=[],i=0,u=n.searchResults;i<u.length;i++){var t=u[i],f=t.bungieNetMembershipId?t.bungieNetMembershipId:t.destinyMemberships[0].membershipId,o=t.bungieNetMembershipId?Globals.BungieMembershipType.BungieNext:t.destinyMemberships[0].membershipType,e="/7/"+Localizer.CurrentCultureName+"/User/Profile/"+o+"/"+f,s=t.bungieGlobalDisplayNameCode?"#"+t.bungieGlobalDisplayNameCode.toString().padStart(4,"0"):"",h="<a href="+e+' data-displayName="" data-membershipId="'+f+'" class="flyoutExempt">'+t.bungieGlobalDisplayName+s+"<\/a>";r.push({href:e,title:h,subtitle:"",iconCoin:{imagePath:"/img/profile/avatars/default_avatar.gif"},flairCoin:{text:""}})}return r},i.prototype.buildTwoLineItemsFromDestinyPlayers=function(n){for(var r=[],i=0,u=n;i<u.length;i++){var t=u[i],f="/7/"+Localizer.CurrentCultureName+"/User/Profile/"+t.membershipType+"/"+t.membershipId,e='<a href="'+f+'" data-displayName="" data-membershipId="'+t.membershipId+'" class="flyoutExempt">\n\t\t\t\t\t\t'+t.bungieGlobalDisplayName+"\n\t\t\t\t\t\t<\/a>";r.push({href:f,title:e,subtitle:"",iconCoin:{imagePath:t.iconPath},flairCoin:{text:""}})}return r},i.prototype.buildTwoLineItemsFromDestinyEntity=function(n){for(var t,f,r=[],i=0,u=n.results;i<u.length;i++)t=u[i],f="/"+Localizer.CurrentCultureName+"/Explore/Detail/"+t.entityType+"/"+t.hash,r.push({href:f,title:t.displayProperties.name,subtitle:t.displayProperties.description,iconCoin:{imagePath:t.displayProperties.icon},flairCoin:{text:""}});return r},i.prototype.buildTwoLineItemsFromGroup=function(n){for(var t,r=[],i=0,u=n.results;i<u.length;i++)t=u[i],r.push({href:"/"+Localizer.CurrentCultureName+"/ClanV2/Chat?groupId="+t.groupId,title:t.name,subtitle:t.motto});return r},i.prototype.buildTwoLineItemsFromTopics=function(t){for(var f,r=[],e=function(i){var u=t.authors.find(function(n){return n.membershipId===i.authorMembershipId}),e,f,o,s,h,c;if(u){if(e=" // ",i.tags)for(f=0,o=i.tags;f<o.length;f++)s=o[f],h=s.replace("#",""),e+='<a href="/'+Localizer.CurrentCultureName+"/Forums/Topics?tg="+h+'">'+s+"<\/a> ";c=n.Utilities.DateTime.toTimestamp(i.creationDate)+' // <a data-membershipid="'+u.membershipId+'" href="'+PageUrls.profilePage+"/254/"+u.membershipId+'">'+u.displayName+"<\/a>"+e;r.push({href:"/"+Localizer.CurrentCultureName+"/Forums/Post/"+i.postId+"?sort=0&page=0",title:i.subject,subtitle:c,iconCoin:{imagePath:u.profilePicturePath},flairCoin:{text:n.Utilities.DateTime.toTimestamp(i.creationDate)}})}},i=0,u=t.results;i<u.length;i++)f=u[i],e(f);return r},i.prototype.buildTwoLineItemsFromNews=function(t){for(var i,u=[],r=0,f=t.results;r<f.length;r++)i=f[r],u.push({href:"/"+Localizer.CurrentCultureName+"/News/Article/"+i.contentId,title:i.properties.Title,subtitle:i.properties.Subtitle,iconCoin:{imagePath:i.properties.ArticleBanner},flairCoin:{text:n.Utilities.DateTime.toTimestamp(i.creationDate)}});return u},i.prototype.buildTwoLineItemsFromSupport=function(t){for(var i,r=[],u=0,f=t.results;u<f.length;u++)i=f[u],i.cType==="Help"?r.push({href:"/"+Localizer.CurrentCultureName+"/Help/Article/"+i.contentId,title:'<a href="/'+Localizer.CurrentCultureName+"/Help/Article/"+i.contentId+'">'+i.properties.Title+"<\/a>",subtitle:i.properties.ShortAnswer,flairCoin:{text:n.Utilities.DateTime.toTimestamp(i.creationDate)}}):i.cType==="HelpStep"&&r.push({href:"/"+Localizer.CurrentCultureName+"/Support/Troubleshoot?oid="+i.contentId,title:i.properties.Title,subtitle:"",flairCoin:{text:n.Utilities.DateTime.toTimestamp(i.creationDate)}});return r},i}();i.SearchPane=f})(i=t.Search||(t.Search={}))})(t=n.Site||(n.Site={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t=function(){function t(){this.maxConcurrentMessages=6;this.messageQueue=[];this.ui=new n.UI(this)}return t.prototype.show=function(n,i,r,u){u===void 0&&(u=function(){});var f={messageType:n,text:i,timeout:r||t.messageTimeout,onMessageHideCallback:u,id:Date.now()};this.messageQueue.push(f);this.processQueue()},t.prototype.removeMessageFromQueue=function(n){for(var i,r=this.messageQueue.length,t=0;t<r;t++)if(i=this.messageQueue[t],i.id===n.id){this.messageQueue.splice(t,1);break}},t.prototype.processQueue=function(){for(var n,r=this,u=this.messageQueue.length,i=0,t=0;t<u;t++)(n=this.messageQueue[t],i+=n.active?1:0,n.active||i>=this.maxConcurrentMessages)||(n.active=!0,this.ui.showMessage(n,function(){r.processQueue()}))},t.messageTimeout=5e3,t}();n.Client=t})(t=n.ToastMessages||(n.ToastMessages={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t;(function(n){n[n.Info=0]="Info";n[n.Warning=1]="Warning";n[n.Error=2]="Error"})(t=n.ToastMessageType||(n.ToastMessageType={}))})(t=n.ToastMessages||(n.ToastMessages={}))}(Bnet||(Bnet={})),function(n){var t;(function(n){var t=function(){function t(n){this.client=n;this.$messageTemplate=$("#toast-message-template");this.$toastContainer=$("#toast-container");this.messageTemplateHtml=this.$messageTemplate.html()}return t.prototype.showMessage=function(n,t){var r=this,i,u,f;t===void 0&&(t=function(){});i=$(this.messageTemplateHtml);u=this.getMessageTypeClass(n.messageType)+"-message";i.addClass(u.toLowerCase());i.find(".text").html(n.text);this.$toastContainer.append(i);setTimeout(function(){i.addClass("on")},50);f=setTimeout(function(){r.hideMessage(n,i);n.onMessageHideCallback()},n.timeout);i.on("click",function(){r.onMessageClick(n,i)})},t.prototype.onMessageClick=function(n,t){this.hideMessage(n,t)},t.prototype.hideMessage=function(n,t){t.removeClass("on").addClass("off");setTimeout(function(){t.remove()},500);this.client.removeMessageFromQueue(n)},t.prototype.getMessageTypeClass=function(t){return n.ToastMessageType[t]},t}();n.UI=t})(t=n.ToastMessages||(n.ToastMessages={}))}(Bnet||(Bnet={}))