/*
* XenForo discussion.min.js
* Copyright 2010-2019 XenForo Ltd.
* Released under the XenForo License Agreement: http://xenforo.com/license-agreement
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,g,f){c instanceof String&&(c=String(c));for(var k=c.length,a=0;a<k;a++){var b=c[a];if(g.call(f,b,a,c))return{i:a,v:b}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,g,f){c!=Array.prototype&&c!=Object.prototype&&(c[g]=f.value)};
$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,g,f,k){if(g){f=$jscomp.global;c=c.split(".");for(k=0;k<c.length-1;k++){var a=c[k];a in f||(f[a]={});f=f[a]}c=c[c.length-1];k=f[c];g=g(k);g!=k&&null!=g&&$jscomp.defineProperty(f,c,{configurable:!0,writable:!0,value:g})}};
$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,f){return $jscomp.findInternal(this,c,f).v}},"es6","es3");
!function(c,g,f,k){XenForo.QuickReply=function(a){if(0==c("#messageList").length)return console.error("Quick Reply not possible for %o, no #messageList found.",a);var b=c('input[name="last_date"]',a);b.data("load-value")&&b.val(Math.max(b.val(),b.data("load-value")));var d=XenForo.MultiSubmitFix(a);this.scrollAndFocus=function(){c(f).scrollTop(a.offset().top);var b=XenForo.getEditorInForm(a);if(!b)return!1;b.$editor?b.focus(!0):b.focus();return this};a.data("QuickReply",this).bind({AutoValidationBeforeSubmit:function(a){c(a.clickedSubmitButton).is('input[name="more_options"]')&&
(a.preventDefault(),a.returnValue=!0);setTimeout(function(){c("#messageList").find(".messagesSinceReplyingNotice").remove()},250)},AutoValidationComplete:function(b){b.ajaxData._redirectTarget&&(g.location=b.ajaxData._redirectTarget);c('input[name="last_date"]',a).val(b.ajaxData.lastDate);d&&d();a.find("input:submit").blur();new XenForo.ExtLoader(b.ajaxData,function(){c(b.ajaxData.templateHtml).each(function(){this.tagName&&c(this).xfInsert("appendTo",c("#messageList"))})});var e=c("#QuickReply").find("textarea");
e.val("");(e=e.data("XenForo.BbCodeWysiwygEditor"))&&e.resetEditor(null,!0);a.trigger("QuickReplyComplete");return!1},BbCodeWysiwygEditorAutoSaveComplete:function(a){var b=c("#messageList"),d=b.find(".messagesSinceReplyingNotice");a.ajaxData.newPostCount&&a.ajaxData.templateHtml?d.length?(d.remove(),c(a.ajaxData.templateHtml).appendTo(b).show().xfActivate()):c(a.ajaxData.templateHtml).xfInsert("appendTo",b):d.remove()}})};XenForo.QuickReplyTrigger=function(a){a.click(function(b){console.info("Quick Reply Trigger Click");
var d=null,e=null;b={};var h=null;a.is(".MultiQuote")?d=c(a.data("form")):(d=c("#QuickReply"),d.data("QuickReply").scrollAndFocus());h=new c.Event("QuickReplyDataPrepare");h.$trigger=a;h.queryData=b;c(f).trigger(h);e||(e=XenForo.ajax(a.data("posturl")||a.attr("href"),b,function(b,c){if(XenForo.hasResponseError(b))return!1;delete e;c=XenForo.getEditorInForm(d);if(!c)return!1;c.$editor?(c.insertHtml(b.quoteHtml),console.info("QuoteHTML: %s",b.quoteHtml),c.$editor.data("xenForoElastic")&&c.$editor.data("xenForoElastic")()):
c.val(c.val()+b.quote);a.is(".MultiQuote")&&d.trigger("MultiQuoteComplete")}));return!1})};XenForo.InlineMessageEditor=function(a){new XenForo.MultiSubmitFix(a);a.bind({AutoValidationBeforeSubmit:function(a){c(a.clickedSubmitButton).is('input[name="more_options"]')&&(a.preventDefault(),a.returnValue=!0)},AutoValidationComplete:function(b){var c=a.closest("div.xenOverlay").data("overlay");c.getTrigger().data("target");XenForo.hasTemplateHtml(b.ajaxData,"messagesTemplateHtml")||XenForo.hasTemplateHtml(b.ajaxData)?
(b.preventDefault(),c.close().getTrigger().data("XenForo.OverlayTrigger").deCache(),XenForo.showMessages(b.ajaxData,c.getTrigger(),"instant")):console.warn("No template HTML!")}})};XenForo.NewMessageLoader=function(a){var b=!1;a.click(function(d){d.preventDefault();b||(b=!0,XenForo.ajax(a.data("href")||a.attr("href"),{},function(a){if(XenForo.hasResponseError(a))return!1;var b=c("#QuickReply"),d=c("#messageList");c('input[name="last_date"]',b).val(a.lastDate);new XenForo.ExtLoader(a,function(){d.find(".messagesSinceReplyingNotice").remove();
c(a.templateHtml).each(function(){this.tagName&&c(this).xfInsert("appendTo",d)})})}).always(function(){b=!1}))})};XenForo.MessageLoader=function(a){a.click(function(b){b.preventDefault();var d=[];c(a.data("messageselector")).each(function(a,b){d.push(b.id)});d.length?XenForo.ajax(a.attr("href"),{messageIds:d},function(b,c){XenForo.showMessages(b,a,"fadeDown")}):console.warn("No messages found to load.")})};XenForo.showMessages=function(a,b,d){var e=function(a,b){switch(d){case "instant":d={show:"xfShow",
hide:"xfHide",speed:0};break;case "fadeIn":d={show:"xfFadeIn",hide:"xfFadeOut",speed:XenForo.speed.fast};break;default:d={show:"xfFadeDown",hide:"xfFadeUp",speed:XenForo.speed.normal}}c(a)[d.hide](d.speed/2,function(){c(b).xfInsert("replaceAll",a,d.show,d.speed)})};if(XenForo.hasResponseError(a))return!1;XenForo.hasTemplateHtml(a,"messagesTemplateHtml")?new XenForo.ExtLoader(a,function(){c.each(a.messagesTemplateHtml,e)}):XenForo.hasTemplateHtml(a)&&new XenForo.ExtLoader(a,function(){e(b.data("messageselector"),
a.templateHtml)})};XenForo.PollVoteForm=function(a){var b=function(b){new XenForo.ExtLoader(b,function(){var d=a.closest(".PollContainer");a.xfFadeUp(XenForo.speed.normal,function(){a.empty().remove();var e=c(b.templateHtml);e.is(".PollContainer")?e=e.children():e.find(".PollContainer").length&&(e=e.find(".PollContainer").children());e.xfInsert("appendTo",d);d.xfActivate()},XenForo.speed.normal,"swing")})};a.bind("AutoValidationComplete",function(a){a.preventDefault();XenForo.hasTemplateHtml(a.ajaxData)&&
b(a.ajaxData)});a.on("click",".PollChangeVote",function(a){a.preventDefault();XenForo.ajax(c(a.target).attr("href"),{},function(a){XenForo.hasTemplateHtml(a)&&b(a)},{method:"get"})});var d=a.data("max-votes")||0;if(1<d)a.on("click",".PollResponse",function(b){b=a.find(".PollResponse");var c=b.filter(":not(:checked)");b.length-c.length>=d?c.prop("disabled",!0):c.prop("disabled",!1)})};XenForo.MultiQuote=function(a){this.__construct(a)};XenForo.MultiQuote.prototype={__construct:function(a){this.$button=
a.click(c.context(this,"prepareOverlay"));this.$form=a.closest("form");this.cookieName=a.data("mq-cookie")||"MultiQuote";this.cookieValue=[];this.submitUrl=a.data("submiturl");this.$controls=new jQuery;this.getCookieValue();this.setButtonState();var b=this;this.$form.bind("MultiQuoteComplete",c.context(this,"reset"));this.$form.bind("MultiQuoteRemove MultiQuoteAdd",function(a,c){c&&c.messageId&&b.toggleControl(c.messageId,"MultiQuoteAdd"==a.type)});c(f).bind("QuickReplyDataPrepare",c.context(this,
"quickReplyDataPrepare"))},getCookieValue:function(){var a=c.getCookie(this.cookieName);this.cookieValue=null==a?[]:a.split(",")},setButtonState:function(){this.getCookieValue();this.cookieValue.length?this.$button.show():this.$button.hide()},addControl:function(a){a.click(c.context(this,"clickControl"));this.getCookieValue();this.setControlState(a,0<=c.inArray(a.data("messageid")+"",this.cookieValue),!0);this.$controls=this.$controls.add(a)},setControls:function(){var a=this;a.getCookieValue();this.$controls.each(function(){a.setControlState(c(this),
0<=c.inArray(c(this).data("messageid")+"",a.cookieValue))})},setControlState:function(a,b,c){var d=this.$button;if(b){d=d.data("remove")||"-";var h=!0}else d=d.data("add")||"+",h=!1;c&&a.hasClass("active")===h||a.toggleClass("active",b).find("span.symbol").text(d)},clickControl:function(a){a.preventDefault();var b;var d=c(a.target).closest("a.MultiQuoteControl");if(d.is(".QuoteSelected")){a=!0;var e=c("#QuoteSelected").data("quote-html");d.trigger("QuoteSelectedClicked")}else a=!d.is(".active"),e=
null;d=d.data("messageid");this.toggleControl(d,a,e);(b=this.$button.data(a?"add-message":"remove-message"))&&XenForo.alert(b,"",2E3)},toggleControl:function(a,b,d){this.getCookieValue();var e=null;a+="";0<a.indexOf("-")&&(e=a.split("-"),a=e[0],e=e[1]);var h=c.inArray(a,this.cookieValue);var f=this.$controls.filter(function(){return c(this).data("messageid")==a}).first();b?(f.length&&this.setControlState(f,!0),null!==d?this.storeSelectedQuote(a,d):this.removeQuotesFromStorage(a),0>h&&this.cookieValue.push(a)):
(this.removeQuotesFromStorage(a,e),this.getStorageForId(a)||(f.length&&this.setControlState(f,!1),0<=h&&this.cookieValue.splice(h,1)));0<this.cookieValue.length?c.setCookie(this.cookieName,this.cookieValue.join(",")):c.deleteCookie(this.cookieName);this.setButtonState()},storeSelectedQuote:function(a,b){var d=this.getStorageObject(),e=0;d[a]&&"object"==typeof d[a]||(d[a]={});c.each(d[a],function(a){e=a});e=parseInt(e,10)+1;d[a][e]=b;this.saveStorageObject(d)},removeQuotesFromStorage:function(a,b){var d=
this.getStorageObject();a+="";!b&&0<a.indexOf("-")&&(b=a.split("-"),a=b[0],b=b[1]);b?(delete d[a][b],c.isEmptyObject(d[a])&&delete d[a]):delete d[a];this.saveStorageObject(d)},getStorageObject:function(){if(!g.localStorage)return{};var a=null;try{a=JSON.parse(localStorage.getItem(this.cookieName))}catch(b){}if(null===a||"object"!==typeof a)a={};return a},getStorageForId:function(a){var b=this.getStorageObject();return b[a]&&"object"==typeof b[a]&&!c.isEmptyObject(b[a])?b[a]:null},getStorageObjectFlat:function(){var a=
{};c.each(this.getStorageObject(),function(b,d){"object"==typeof d&&c.each(d,function(c,d){a[b+"-"+c]=d})});return a},saveStorageObject:function(a){g.localStorage&&localStorage.setItem(this.cookieName,JSON.stringify(a))},prepareOverlay:function(a){var b=this.getStorageObjectFlat();c.each(b,function(a,c){b[a]=XenForo.unparseBbCode(c)});XenForo.ajax(this.$button.data("href"),{quoteSelections:b},function(a,b){XenForo.hasTemplateHtml(a)&&new XenForo.ExtLoader(a,function(a){a.noCache=!0;XenForo.createOverlay(null,
a.templateHtml,a).load()})})},quickReplyDataPrepare:function(a){if(a.$trigger.is(".MultiQuote")){var b=this.getStorageObjectFlat();c.each(b,function(a,c){b[a]=XenForo.unparseBbCode(c)});a.queryData.quoteSelections=b;a.queryData.postIds=c(a.$trigger.data("inputs")).map(function(){return this.value}).get()}},reset:function(){c.deleteCookie(this.cookieName);this.cookieValue=[];g.localStorage&&localStorage.removeItem(this.cookieName);this.setControls();this.setButtonState()}};XenForo.MultiQuoteControl=
function(a){var b=a.data("mq-target")||"#MultiQuote";(b=c(b).data("XenForo.MultiQuote"))&&b.addControl(a)};XenForo.MultiQuoteRemove=function(a){a.click(function(){var b=a.closest(".MultiQuoteItem"),d=b.find(".MultiQuoteId").val(),e=c(c("#MultiQuoteForm").data("form")),h=a.closest(".xenOverlay");d&&e.trigger("MultiQuoteRemove",{messageId:d});b.remove();h.length&&!h.find(".MultiQuoteItem").length&&h.overlay().close()})};XenForo.Sortable=function(a){a.sortable({forcePlaceholderSize:!0}).bind({sortupdate:function(a){},
dragstart:function(a){console.log("drag start, %o",a.target)},dragend:function(a){console.log("drag end")}})};XenForo.SelectQuotable=function(a){this.__construct(a)};XenForo.SelectQuotable.prototype={__construct:function(a){if(g.getSelection&&c("#QuickReply").length){this.$messageTextContainer=null;var b=this,d=!1,e,h=function(){e||b.processing||(e=setTimeout(function(){e=null;b._handleSelection()},100))};a.on("mousedown",function(){d=!0});a.on("mouseup",function(){d=!1;h()});c(f).on("selectionchange",
function(){d||h()});c(f).on("QuickReplyDataPrepare",function(a){var b=a.$trigger.closest("#QuoteSelected");b.length&&(a.queryData.quoteHtml=XenForo.unparseBbCode(b.data("quote-html")),a.$trigger.trigger("QuoteSelectedClicked"))})}},buttonClicked:function(){var a=g.getSelection();a.isCollapsed||(a.collapse(a.getRangeAt(0).commonAncestorContainer,0),this.hideQuoteButton())},_handleSelection:function(){this.processing=!0;var a=g.getSelection();this._isValidSelection(a)?this.showQuoteButton(a):this.hideQuoteButton();
var b=this;setTimeout(function(){b.processing=!1},0)},_isValidSelection:function(a){this.$messageTextContainer=null;if(a.isCollapsed||!a.rangeCount)return!1;a=a.getRangeAt(0);this._adjustRange(a);if(!c.trim(a.toString()).length&&!a.cloneContents().querySelectorAll("img").length)return!1;var b=c(a.commonAncestorContainer).closest(".SelectQuoteContainer");if(!b.length||!b.closest(".message").find("a.MultiQuoteControl, a.ReplyQuote").length||c(a.startContainer).closest(".bbCodeQuote, .NoSelectToQuote").length||
c(a.endContainer).closest(".bbCodeQuote, .NoSelectToQuote").length)return!1;this.$messageTextContainer=b;return!0},_adjustRange:function(a){var b=!1,d=!1;0==a.endOffset&&(d=c(a.endContainer),3!=a.endContainer.nodeType||a.endContainer.previousSibling||(d=d.parent()),d=d.is(".quote, .attribution, .bbCodeQuote"));d&&(d=c(a.endContainer).closest(".bbCodeQuote"),d.length&&(a.setEndBefore(d[0]),b=!0));b&&(b=g.getSelection(),b.removeAllRanges(),b.addRange(a))},showQuoteButton:function(a){var b=this.$messageTextContainer.closest("[id]").attr("id");
if(void 0===this.$button||this.$button.data("id")!==b)this.hideQuoteButton(),this.createButton(),this.$button.data("id",b);this.$button.data("quote-html",this.getSelectionHtml(a));b=this.$button.width();a=this.getButtonPositionMarker(a);var c=this.$messageTextContainer?this.$messageTextContainer.offset().left:0;a.left-b<c?this.$button[XenForo.isRTL()?"addClass":"removeClass"]("flipped").css("left",a.left-16):this.$button[XenForo.isRTL()?"removeClass":"addClass"]("flipped").css("left",a.left-b-5);
this.$button.css({position:"absolute",top:a.top+6}).show()},getButtonPositionMarker:function(a){var b=c("<span />");b.text(c.browser.opera?"x":"\u200b");var d=a.getRangeAt(0).cloneRange();a=d.getBoundingClientRect?d.getBoundingClientRect():null;d.collapse(!1);d.insertNode(b[0]);var e=0;do{d=!1;e++;b[0].parentNode&&"messageTextEndMarker"==b[0].parentNode.className&&(b.insertBefore(b[0].parentNode),d=!0);b[0].previousSibling&&3==b[0].previousSibling.nodeType&&0==c.trim(b[0].previousSibling.textContent).length&&
(b.insertBefore(b[0].previousSibling),d=!0);if(b[0].parentNode&&"LI"==b[0].parentNode.tagName&&!b[0].previousSibling){var h=b[0].parentNode;c(h).prev("li").length?(b.appendTo(c(h).prev("li")),d=!0):h.parentNode&&(b.insertBefore(h.parentNode),d=!0)}b[0].parentNode&&!b[0].previousSibling&&-1!=c.inArray(b[0].parentNode.tagName,["DIV","BLOCKQUOTE","PRE"])&&(b.insertBefore(b[0].parentNode),d=!0);b[0].previousSibling&&-1!=c.inArray(b[0].previousSibling.tagName,["OL","UL"])&&(c(b[0].previousSibling).find("li:last").append(b),
d=!0);b[0].previousSibling&&-1!=c.inArray(b[0].previousSibling.tagName,["DIV","BLOCKQUOTE","PRE"])&&(b.appendTo(b[0].previousSibling),d=!0);b[0].previousSibling&&"BR"==b[0].previousSibling.tagName&&(b.insertBefore(b[0].previousSibling),d=!0)}while(d&&5>e);var f=b.offset();d=b.height();b.parentsUntil("body").each(function(){var a=c(this);switch(a.css("overflow-x")){case "hidden":case "scroll":case "auto":var b=a.offset().left;a=b+a.outerWidth();f.left<b&&(f.left=b);a<f.left&&(f.left=a)}});e=b.parent();
b.remove();c.browser.msie||e[0].normalize();a&&!XenForo.isRTL()&&32<f.left-a.left&&(f.left-=16);f.top+=d;return f},createButton:function(){if(!this.$messageTextContainer.length)return!1;var a=this.$messageTextContainer.closest(".message");this.$button=c('<div id="QuoteSelected" class="xenTooltip"></div>').click(c.context(this,"hideQuoteButton")).append('<span class="arrow"></span>');var b=a.find("a.MultiQuoteControl").first().clone();b.length&&(b.addClass("QuoteSelected").attr("title","").on("QuoteSelectedClicked",
c.context(this,"buttonClicked")),b.find("span.symbol").text(c(".MultiQuoteWatcher").data("add")),new XenForo.MultiQuoteControl(b),this.$button.append(b),this.$button.append(f.createTextNode(" | ")));a=a.find("a.ReplyQuote").clone();a.addClass("QuoteSelected").attr("title","").on("QuoteSelectedClicked",c.context(this,"buttonClicked"));new XenForo.QuickReplyTrigger(a);this.$button.append(a);c(f.body).append(this.$button);var d=this,e=c(g).width();c(g).on("resize.SelectQuotable",function(a){a=c(g).width();
a!=e&&(e=a,d._handleSelection())});c(f).on("XFOverlay.SelectQuotable",function(a){d.hideQuoteButton();g.getSelection().collapseToEnd()})},hideQuoteButton:function(){void 0!==this.$button&&(this.$button.remove(),delete this.$button);c(g).off("resize.SelectQuotable");c(f).off("XFOverlay.SelectQuotable")},getSelectionHtml:function(a){var b=f.createElement("div"),c;var e=0;for(c=a.rangeCount;e<c;e++)b.appendChild(a.getRangeAt(e).cloneContents());return this.prepareSelectionHtml(b.innerHTML)},prepareSelectionHtml:function(a){return a}};
XenForo.unparseBbCode=function(a){var b=c(f.createElement("div"));b.html(a);console.log(b.find(".bbCodeQuote").length);b.find(".NoSelectToQuote").each(function(){c(this).remove()});c.each(["B","I","U"],function(a,e){b.find(e).each(function(){c(this).replaceWith("["+e+"]"+c(this).html()+"[/"+e+"]")})});b.find(".bbCodeQuote").each(function(){var a=c(this),b=a.find(".quote");b.length?a.replaceWith("<div>[QUOTE]"+b.html()+"[/QUOTE]</div>"):b.find(".quoteExpand").remove()});b.find(".bbCodeCode, .bbCodeHtml, .bbCodePHP").each(function(){var a=
c(this),b=c(this).find("div.type").first().text(),f="pre";""!==b&&(b=b.replace(/^(.+):$/,"$1"));a.is(".bbCodePHP")&&(f="code");a.replaceWith(a.find(f).first().attr("data-type",b))});b.find('div[style*="text-align"]').each(function(){var a=c(this).css("text-align").toUpperCase();c(this).replaceWith("["+a+"]"+c(this).html()+"[/"+a+"]")});b.find(".bbCodeSpoilerContainer").each(function(){var a=c(this).find(".bbCodeSpoilerButton");if(a.length&&(a=a.data("target"))){var b=c(this).find(a).html();$spoilerTitle=
c(this).find(".SpoilerTitle");a=$spoilerTitle.length?'="'+$spoilerTitle.text()+'"':"";c(this).replaceWith("[SPOILER"+a+"]"+b+"[/SPOILER]")}});console.info("HTML to be sent: %s",b.html());return b.html()};XenForo.register("#QuickReply","XenForo.QuickReply");XenForo.register("a.ReplyQuote, a.MultiQuote, a.QuoteSelected","XenForo.QuickReplyTrigger");XenForo.register("form.InlineMessageEditor","XenForo.InlineMessageEditor");XenForo.register("a.MessageLoader","XenForo.MessageLoader");XenForo.register("a.NewMessageLoader",
"XenForo.NewMessageLoader");XenForo.register("form.PollVoteForm","XenForo.PollVoteForm");XenForo.register(".MultiQuoteWatcher","XenForo.MultiQuote");XenForo.register("a.MultiQuoteControl","XenForo.MultiQuoteControl");XenForo.register("a.MultiQuoteRemove","XenForo.MultiQuoteRemove");XenForo.register(".Sortable","XenForo.Sortable");XenForo.register(".SelectQuotable","XenForo.SelectQuotable")}(jQuery,this,document);