define("core/utils/object/has",[],function(){"use strict";return function(a,b){return Object.prototype.hasOwnProperty.call(a,b)}}),define("core/utils/collection/each",["core/utils/object/has"],function(a){"use strict";return function(b,c){var d=b.length,e=Array.prototype.forEach;if(isNaN(d))for(var f in b)a(b,f)&&c(b[f],f,b);else if(e)e.call(b,c);else for(var g=0;d>g;g++)c(b[g],g,b)}}),define("core/utils/object/extend",["core/utils/collection/each","core/utils/object/has"],function(a,b){"use strict";return function(c){return a(Array.prototype.slice.call(arguments,1),function(a){for(var d in a)b(a,d)&&(c[d]=a[d])}),c}}),define("core/utils/url/serializeArgs",["require","exports","module","core/utils/collection/each"],function(a,b,c){"use strict";var d=a("core/utils/collection/each");c.exports=function(a){var b=[];return d(a,function(a,c){void 0!==a&&b.push(c+(null===a?"":"="+encodeURIComponent(a)))}),b.join("&")}}),define("core/utils/url/serialize",["require","exports","module","core/utils/url/serializeArgs"],function(a,b,c){"use strict";var d=a("core/utils/url/serializeArgs");c.exports=function e(a,b,c){if(b&&(-1===a.indexOf("?")?a+="?":"&"!==a.charAt(a.length-1)&&(a+="&"),a+=d(b)),c){var f={};return f[(new Date).getTime()]=null,e(a,f)}var g=a.length;return"&"===a.charAt(g-1)?a.slice(0,g-1):a}}),define("shared/urls",["require","core/utils/object/extend","core/utils/url/serialize"],function(a){"use strict";var b=a("core/utils/object/extend"),c=a("core/utils/url/serialize"),d="default",e={lounge:"http://disqus.com/embed/comments/",home:"https://disqus.com/home/".replace("home/","")},f=function(a,b){return/^http/.test(b)||(b="http:"),b+"//"+a.replace(/^\s*(\w+:)?\/\//,"")},g=function(a,g,h){var i=e[a];if(!i)throw new Error("Unknown app: "+a);var j=f(i,window.document.location.protocol),k=b({base:d},g||{}),l=h?"#"+encodeURIComponent(JSON.stringify(h)):"";return c(j,k)+l};return{BASE:d,apps:e,get:g,ensureHttpBasedProtocol:f}}),function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b=!!a&&"length"in a&&a.length,c=na.type(a);return"function"===c||na.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(na.isFunction(b))return na.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return na.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(xa.test(b))return na.filter(b,a,c);b=na.filter(b,a)}return na.grep(a,function(a){return na.inArray(a,b)>-1!==c})}function e(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function f(a){var b={};return na.each(a.match(Da)||[],function(a,c){b[c]=!0}),b}function g(){da.addEventListener?(da.removeEventListener("DOMContentLoaded",h),a.removeEventListener("load",h)):(da.detachEvent("onreadystatechange",h),a.detachEvent("onload",h))}function h(){(da.addEventListener||"load"===a.event.type||"complete"===da.readyState)&&(g(),na.ready())}function i(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(Ia,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:Ha.test(c)?na.parseJSON(c):c}catch(e){}na.data(a,b,c)}else c=void 0}return c}function j(a){var b;for(b in a)if(("data"!==b||!na.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function k(a,b,c,d){if(Ga(a)){var e,f,g=na.expando,h=a.nodeType,i=h?na.cache:a,j=h?a[g]:a[g]&&g;if(j&&i[j]&&(d||i[j].data)||void 0!==c||"string"!=typeof b)return j||(j=h?a[g]=ca.pop()||na.guid++:g),i[j]||(i[j]=h?{}:{toJSON:na.noop}),("object"==typeof b||"function"==typeof b)&&(d?i[j]=na.extend(i[j],b):i[j].data=na.extend(i[j].data,b)),f=i[j],d||(f.data||(f.data={}),f=f.data),void 0!==c&&(f[na.camelCase(b)]=c),"string"==typeof b?(e=f[b],null==e&&(e=f[na.camelCase(b)])):e=f,e}}function l(a,b,c){if(Ga(a)){var d,e,f=a.nodeType,g=f?na.cache:a,h=f?a[na.expando]:na.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){na.isArray(b)?b=b.concat(na.map(b,na.camelCase)):b in d?b=[b]:(b=na.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;for(;e--;)delete d[b[e]];if(c?!j(d):!na.isEmptyObject(d))return}(c||(delete g[h].data,j(g[h])))&&(f?na.cleanData([a],!0):la.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}function m(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return na.css(a,b,"")},i=h(),j=c&&c[3]||(na.cssNumber[b]?"":"px"),k=(na.cssNumber[b]||"px"!==j&&+i)&&Ka.exec(na.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,na.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}function n(a){var b=Sa.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function o(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||na.nodeName(d,b)?f.push(d):na.merge(f,o(d,b));return void 0===b||b&&na.nodeName(a,b)?na.merge([a],f):f}function p(a,b){for(var c,d=0;null!=(c=a[d]);d++)na._data(c,"globalEval",!b||na._data(b[d],"globalEval"))}function q(a){Oa.test(a.type)&&(a.defaultChecked=a.checked)}function r(a,b,c,d,e){for(var f,g,h,i,j,k,l,m=a.length,r=n(b),s=[],t=0;m>t;t++)if(g=a[t],g||0===g)if("object"===na.type(g))na.merge(s,g.nodeType?[g]:g);else if(Ua.test(g)){for(i=i||r.appendChild(b.createElement("div")),j=(Pa.exec(g)||["",""])[1].toLowerCase(),l=Ta[j]||Ta._default,i.innerHTML=l[1]+na.htmlPrefilter(g)+l[2],f=l[0];f--;)i=i.lastChild;if(!la.leadingWhitespace&&Ra.test(g)&&s.push(b.createTextNode(Ra.exec(g)[0])),!la.tbody)for(g="table"!==j||Va.test(g)?""!==l[1]||Va.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;f--;)na.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k);for(na.merge(s,i.childNodes),i.textContent="";i.firstChild;)i.removeChild(i.firstChild);i=r.lastChild}else s.push(b.createTextNode(g));for(i&&r.removeChild(i),la.appendChecked||na.grep(o(s,"input"),q),t=0;g=s[t++];)if(d&&na.inArray(g,d)>-1)e&&e.push(g);else if(h=na.contains(g.ownerDocument,g),i=o(r.appendChild(g),"script"),h&&p(i),c)for(f=0;g=i[f++];)Qa.test(g.type||"")&&c.push(g);return i=null,r}function s(){return!0}function t(){return!1}function u(){try{return da.activeElement}catch(a){}}function v(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)v(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=t;else if(!e)return a;return 1===f&&(g=e,e=function(a){return na().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=na.guid++)),a.each(function(){na.event.add(this,b,e,d,c)})}function w(a,b){return na.nodeName(a,"table")&&na.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function x(a){return a.type=(null!==na.find.attr(a,"type"))+"/"+a.type,a}function y(a){var b=eb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function z(a,b){if(1===b.nodeType&&na.hasData(a)){var c,d,e,f=na._data(a),g=na._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)na.event.add(b,c,h[c][d])}g.data&&(g.data=na.extend({},g.data))}}function A(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!la.noCloneEvent&&b[na.expando]){e=na._data(b);for(d in e.events)na.removeEvent(b,d,e.handle);b.removeAttribute(na.expando)}"script"===c&&b.text!==a.text?(x(b).text=a.text,y(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),la.html5Clone&&a.innerHTML&&!na.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Oa.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}function B(a,b,c,d){b=fa.apply([],b);var e,f,g,h,i,j,k=0,l=a.length,m=l-1,n=b[0],p=na.isFunction(n);if(p||l>1&&"string"==typeof n&&!la.checkClone&&db.test(n))return a.each(function(e){var f=a.eq(e);p&&(b[0]=n.call(this,e,f.html())),B(f,b,c,d)});if(l&&(j=r(b,a[0].ownerDocument,!1,a,d),e=j.firstChild,1===j.childNodes.length&&(j=e),e||d)){for(h=na.map(o(j,"script"),x),g=h.length;l>k;k++)f=j,k!==m&&(f=na.clone(f,!0,!0),g&&na.merge(h,o(f,"script"))),c.call(a[k],f,k);if(g)for(i=h[h.length-1].ownerDocument,na.map(h,y),k=0;g>k;k++)f=h[k],Qa.test(f.type||"")&&!na._data(f,"globalEval")&&na.contains(i,f)&&(f.src?na._evalUrl&&na._evalUrl(f.src):na.globalEval((f.text||f.textContent||f.innerHTML||"").replace(fb,"")));j=e=null}return a}function C(a,b,c){for(var d,e=b?na.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||na.cleanData(o(d)),d.parentNode&&(c&&na.contains(d.ownerDocument,d)&&p(o(d,"script")),d.parentNode.removeChild(d));return a}function D(a,b){var c=na(b.createElement(a)).appendTo(b.body),d=na.css(c[0],"display");return c.detach(),d}function E(a){var b=da,c=jb[a];return c||(c=D(a,b),"none"!==c&&c||(ib=(ib||na("'}function j(c){function e(b){var h=b.originalEvent.origin;if(d.urls.apiSecure.slice(0,h.length)===h){var j=JSON.parse(b.originalEvent.data);if(j.requestId===g){var k;0===j.code?(l.resolve(j),k=c.success):(l.reject(j),k=c.error),k=k||function(){},delete j.requestId,k(j),o.body.removeChild(f),o.body.removeChild(i),a(window).off("message",e)}}}c=b.defaults(c,q),c.secure&&(c.url=k(c.url));var f,g=b.uniqueId("ft_"),h=o.createElement("div"),i=o.createElement("form"),j="frame_"+g,l=new a.Deferred;return h.innerHTML=s.getIframe(j),f=h.childNodes[0],i.target=j,i.action=c.url.replace(".json",".pm"),i.method=c.method||"GET",c.data=b.extend(c.data,{callback:g,referrer:o.referrer}),b.each(c.data,function(a,c){a===!0?a=[1]:a===!1?a=[0]:null===a?a=[""]:b.isArray(a)||(a=[a]),b.each(a,function(a){var b=o.createElement("input");b.type="hidden",b.name=c,b.value=a,i.appendChild(b)})}),a(window).on("message",e),o.body.appendChild(f),o.body.appendChild(i),i.submit(),l.promise()}function k(a){return a.replace(/^(http:)?\/\//,"https://")}function l(c){c=b.defaults(c,q),c.secure&&(c.url=k(c.url)),c.traditional=!0;var f=window.location;p.href=c.url,(f.host!==p.host||f.protocol!==p.protocol)&&(c.xhrFields={withCredentials:!0}),c.omitDisqusApiKey||(c.data=c.data||{},window.FormData&&c.data instanceof window.FormData?c.url=e.serialize(c.url,{api_key:d.keys.api}):c.data.api_key=d.keys.api);var g=c.error;return c.error=function(a){s.trigger("error",a),b.isFunction(g)&&g(a)},a.ajax(c)}function m(a,c){c=c||{},c.url=n(a,{secure:c.secure}),c.omitDisqusApiKey||(c.data=b.extend(c.data||{},{api_key:d.keys.api})),s.trigger("call",c);var e=(g(c)?j:l)(c);return e&&e.always(b.bind(this.trigger,this,"complete",c)),e}function n(a,b){return b=b||{},/(https?:)?\/\//.test(a)?a:(void 0===b.secure?q.secure:b.secure)||"https:"===window.location.protocol?d.urls.apiSecure+a:d.urls.api+a}var o=window.document,p=o.createElement("a"),q={},r="withCredentials"in new window.XMLHttpRequest,s={ajax:l,call:m,getURL:n,defaults:function(a){var c,d,e;for(c in a)d=a[c],e=q[c],b.isObject(d)&&b.isObject(e)?b.extend(e,d):q[c]=d},headers:function(a){var c=b.extend({},q.headers,a);return q.headers=b.pick(c,Boolean),q.headers},useFormTransport:g,xhrSupportsCredentialedRequests:r,makeHttps:k,formTransport:j,getIframe:i};return b.extend(s,c.Events),s}),define("core/utils/urls",[],function(){"use strict";var a={},b=window.document.createElement("a");return a.getOrigin=function(a){b.href=a;var c=b.href.split("/");return c[0]+"//"+c[2]},a.getHostName=function(a){return b.href=a,b.hostname},a.getDomainPart=function(b,c){"undefined"==typeof c&&(c=0);var d=a.getHostName(b),e=d.split(".").reverse();return e[c]},a.getQuery=function(a){return b.href=a,b.search},a}),define("core/frameBus",["jquery","underscore","backbone","core/utils/urls"],function(a,b,c,d){"use strict";var e=window.opener||window.parent,f=window.name,g=window.document.referrer,h={};h.client=d.getOrigin(window.document.location.href),h.secureClient=h.client.replace(/^\w+:\/\//,"https://"),h.host=g?d.getOrigin(g):h.client;var i={origins:h,messageHandler:function(a){a=a.originalEvent;var b;try{b=JSON.parse(a.data)}catch(c){return}b.name&&"!"===b.name[0]&&a.origin!==h.client&&a.origin!==h.secureClient||"client"===b.scope&&i.trigger(b.name,b.data)},postMessage:function(a){a=JSON.stringify(a),e.postMessage(a,"*")},sendHostMessage:function(a,b){b=b||[],i.postMessage({scope:"host",sender:f,name:a,data:b})}};return b.extend(i,c.Events),a(window).on("message",i.messageHandler),a(window).on("unload",function(){i.sendHostMessage("die")}),window.DISQUS=window.DISQUS||{},window.DISQUS.Bus=i,i}),define("core/bus",["backbone","underscore","core/frameBus"],function(a,b,c){"use strict";var d=b.extend({},a.Events);return d.frame=c,d}),function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function d(a){ra.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function e(a,b){var c=!0;return l(function(){return c&&(d(a),c=!1),b.apply(this,arguments)},b)}function f(a,b){nb[a]||(d(b), nb[a]=!0)}function g(a,b){return function(c){return o(a.call(this,c),b)}}function h(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function i(){}function j(a,b){b!==!1&&E(a),m(this,a),this._d=new Date(+a._d)}function k(a){var b=x(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=ra.localeData(),this._bubble()}function l(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return b.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}function m(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Fa.length>0)for(c in Fa)d=Fa[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(a){return 0>a?Math.ceil(a):Math.floor(a)}function o(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthd;d++)(c&&a[d]!==b[d]||!c&&z(a[d])!==z(b[d]))&&g++;return g+f}function w(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=gb[a]||hb[b]||b}return a}function x(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&(b=w(c),b&&(d[b]=a[c]));return d}function y(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}ra[b]=function(e,f){var g,h,i=ra._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=ra().utc().set(d,a);return i.call(ra._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function z(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function A(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function B(a,b,c){return fa(ra([a,11,31+b-c]),b,c).week}function C(a){return D(a)?366:365}function D(a){return a%4===0&&a%100!==0||a%400===0}function E(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[ya]<0||a._a[ya]>11?ya:a._a[za]<1||a._a[za]>A(a._a[xa],a._a[ya])?za:a._a[Aa]<0||a._a[Aa]>23?Aa:a._a[Ba]<0||a._a[Ba]>59?Ba:a._a[Ca]<0||a._a[Ca]>59?Ca:a._a[Da]<0||a._a[Da]>999?Da:-1,a._pf._overflowDayOfYear&&(xa>b||b>za)&&(b=za),a._pf.overflow=b)}function F(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function G(a){return a?a.toLowerCase().replace("_","-"):a}function H(a){for(var b,c,d,e,f=0;f0;){if(d=I(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1)break;b--}f++}return null}function I(a){var b=null;if(!Ea[a]&&Ga)try{b=ra.locale(),require("./locale/"+a),ra.locale(b)}catch(c){}return Ea[a]}function J(a,b){return b._isUTC?ra(a).zone(b._offset||0):ra(a).local()}function K(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function L(a){var b,c,d=a.match(Ka);for(b=0,c=d.length;c>b;b++)mb[d[b]]?d[b]=mb[d[b]]:d[b]=K(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function M(a,b){return a.isValid()?(b=N(b,a.localeData()),ib[b]||(ib[b]=L(b)),ib[b](a)):a.localeData().invalidDate()}function N(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(La.lastIndex=0;d>=0&&La.test(a);)a=a.replace(La,c),La.lastIndex=0,d-=1;return a}function O(a,b){var c,d=b._strict;switch(a){case"Q":return Wa;case"DDDD":return Ya;case"YYYY":case"GGGG":case"gggg":return d?Za:Oa;case"Y":case"G":case"g":return _a;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?$a:Pa;case"S":if(d)return Wa;case"SS":if(d)return Xa;case"SSS":if(d)return Ya;case"DDD":return Na;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ra;case"a":case"A":return b._locale._meridiemParse;case"X":return Ua;case"Z":case"ZZ":return Sa;case"T":return Ta;case"SSSS":return Qa;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?Xa:Ma;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Ma;case"Do":return Va;default:return c=new RegExp(X(W(a.replace("\\","")),"i"))}}function P(a){a=a||"";var b=a.match(Sa)||[],c=b[b.length-1]||[],d=(c+"").match(eb)||["-",0,0],e=+(60*d[1])+z(d[2]);return"+"===d[0]?-e:e}function Q(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[ya]=3*(z(b)-1));break;case"M":case"MM":null!=b&&(e[ya]=z(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b),null!=d?e[ya]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[za]=z(b));break;case"Do":null!=b&&(e[za]=z(parseInt(b,10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=z(b));break;case"YY":e[xa]=ra.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[xa]=z(b);break;case"a":case"A":c._isPm=c._locale.isPM(b);break;case"H":case"HH":case"h":case"hh":e[Aa]=z(b);break;case"m":case"mm":e[Ba]=z(b);break;case"s":case"ss":e[Ca]=z(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Da]=z(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=P(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=z(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=ra.parseTwoDigitYear(b)}}function R(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[xa],fa(ra(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[xa],fa(ra(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=ga(d,e,f,h,g),a._a[xa]=i.year,a._dayOfYear=i.dayOfYear}function S(a){var c,d,e,f,g=[];if(!a._d){for(e=U(a),a._w&&null==a._a[za]&&null==a._a[ya]&&R(a),a._dayOfYear&&(f=b(a._a[xa],e[xa]),a._dayOfYear>C(f)&&(a._pf._overflowDayOfYear=!0),d=ba(f,0,a._dayOfYear),a._a[ya]=d.getUTCMonth(),a._a[za]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];a._d=(a._useUTC?ba:aa).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()+a._tzm)}}function T(a){var b;a._d||(b=x(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],S(a))}function U(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function V(a){if(a._f===ra.ISO_8601)return void Z(a);a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=""+a._i,h=g.length,i=0;for(d=N(a._f,a._locale).match(Ka)||[],b=0;b0&&a._pf.unusedInput.push(f),g=g.slice(g.indexOf(c)+c.length),i+=c.length),mb[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),Q(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=h-i,g.length>0&&a._pf.unusedInput.push(g),a._isPm&&a._a[Aa]<12&&(a._a[Aa]+=12),a._isPm===!1&&12===a._a[Aa]&&(a._a[Aa]=0),S(a),E(a)}function W(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function X(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Y(a){var b,d,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(NaN));for(f=0;fg)&&(e=g,d=b));l(a,d||b)}function Z(a){var b,c,d=a._i,e=ab.exec(d);if(e){for(a._pf.iso=!0,b=0,c=cb.length;c>b;b++)if(cb[b][1].exec(d)){a._f=cb[b][0]+(e[6]||" ");break}for(b=0,c=db.length;c>b;b++)if(db[b][1].exec(d)){a._f+=db[b][0];break}d.match(Sa)&&(a._f+="Z"),V(a)}else a._isValid=!1}function $(a){Z(a),a._isValid===!1&&(delete a._isValid,ra.createFromInputFallback(a))}function _(b){var c,d=b._i;d===a?b._d=new Date:u(d)?b._d=new Date(+d):null!==(c=Ha.exec(d))?b._d=new Date(+c[1]):"string"==typeof d?$(b):t(d)?(b._a=d.slice(0),S(b)):"object"==typeof d?T(b):"number"==typeof d?b._d=new Date(d):ra.createFromInputFallback(b)}function aa(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function ba(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ca(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function da(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function ea(a,b,c){var d=ra.duration(a).abs(),e=wa(d.as("s")),f=wa(d.as("m")),g=wa(d.as("h")),h=wa(d.as("d")),i=wa(d.as("M")),j=wa(d.as("y")),k=e0,k[4]=c,da.apply({},k)}function fa(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=ra(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ga(a,b,c,d,e){var f,g,h=ba(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:C(a-1)+g}}function ha(b){var c=b._i,d=b._f;return b._locale=b._locale||ra.localeData(b._l),null===c||d===a&&""===c?ra.invalid({nullInput:!0}):("string"==typeof c&&(b._i=c=b._locale.preparse(c)),ra.isMoment(c)?new j(c,!0):(d?t(d)?Y(b):V(b):_(b),new j(b)))}function ia(a,b){var c,d;if(1===b.length&&t(b[0])&&(b=b[0]),!b.length)return ra();for(c=b[0],d=1;d=0?"+":"-";return b+o(Math.abs(a),6)},gg:function(){return o(this.weekYear()%100,2)},gggg:function(){return o(this.weekYear(),4)},ggggg:function(){return o(this.weekYear(),5)},GG:function(){return o(this.isoWeekYear()%100,2)},GGGG:function(){return o(this.isoWeekYear(),4)},GGGGG:function(){return o(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return z(this.milliseconds()/100)},SS:function(){return o(z(this.milliseconds()/10),2)},SSS:function(){return o(this.milliseconds(),3)},SSSS:function(){return o(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+o(z(a/60),2)+":"+o(z(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+o(z(a/60),2)+o(z(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},nb={},ob=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];kb.length;)ta=kb.pop(),mb[ta+"o"]=h(mb[ta],ta);for(;lb.length;)ta=lb.pop(),mb[ta+ta]=g(mb[ta],2);mb.DDDD=g(mb.DDD,3),l(i.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=ra.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=ra([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return fa(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),ra=function(b,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=d,g._l=e,g._strict=f,g._isUTC=!1,g._pf=c(),ha(g)},ra.suppressDeprecationWarnings=!1,ra.createFromInputFallback=e("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i)}),ra.min=function(){var a=[].slice.call(arguments,0);return ia("isBefore",a)},ra.max=function(){var a=[].slice.call(arguments,0);return ia("isAfter",a)},ra.utc=function(b,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=d,g._strict=f,g._pf=c(),ha(g).utc()},ra.unix=function(a){return ra(1e3*a)},ra.duration=function(a,b){var c,d,e,f,g=a,h=null;return ra.isDuration(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=Ia.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:z(h[za])*c,h:z(h[Aa])*c,m:z(h[Ba])*c,s:z(h[Ca])*c,ms:z(h[Da])*c}):(h=Ja.exec(a))?(c="-"===h[1]?-1:1,e=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},g={y:e(h[2]),M:e(h[3]),d:e(h[4]),h:e(h[5]),m:e(h[6]),s:e(h[7]),w:e(h[8])}):"object"==typeof g&&("from"in g||"to"in g)&&(f=q(ra(g.from),ra(g.to)),g={},g.ms=f.milliseconds,g.M=f.months),d=new k(g),ra.isDuration(a)&&a.hasOwnProperty("_locale")&&(d._locale=a._locale),d},ra.version=ua,ra.defaultFormat=bb,ra.ISO_8601=function(){},ra.momentProperties=Fa,ra.updateOffset=function(){},ra.relativeTimeThreshold=function(b,c){return jb[b]===a?!1:c===a?jb[b]:(jb[b]=c,!0)},ra.lang=e("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return ra.locale(a,b)}),ra.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?ra.defineLocale(a,b):ra.localeData(a),c&&(ra.duration._locale=ra._locale=c)),ra._locale._abbr},ra.defineLocale=function(a,b){return null!==b?(b.abbr=a,Ea[a]||(Ea[a]=new i),Ea[a].set(b),ra.locale(a),Ea[a]):(delete Ea[a],null)},ra.langData=e("moment.langData is deprecated. Use moment.localeData instead.",function(a){return ra.localeData(a)}),ra.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return ra._locale;if(!t(a)){if(b=I(a))return b;a=[a]}return H(a)},ra.isMoment=function(a){return a instanceof j||null!=a&&a.hasOwnProperty("_isAMomentObject")},ra.isDuration=function(a){return a instanceof k};for(ta=ob.length-1;ta>=0;--ta)y(ob[ta]);ra.normalizeUnits=function(a){return w(a)},ra.invalid=function(a){var b=ra.utc(NaN);return null!=a?l(b._pf,a):b._pf.userInvalidated=!0,b},ra.parseZone=function(){return ra.apply(null,arguments).parseZone()},ra.parseTwoDigitYear=function(a){return z(a)+(z(a)>68?1900:2e3)},l(ra.fn=j.prototype,{clone:function(){return ra(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=ra(this).utc();return 00:!1},parsingFlags:function(){return l({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.zone(0,a)},local:function(a){return this._isUTC&&(this.zone(0,a),this._isUTC=!1,a&&this.add(this._d.getTimezoneOffset(),"m")),this},format:function(a){var b=M(this,a||ra.defaultFormat);return this.localeData().postformat(b)},add:r(1,"add"),subtract:r(-1,"subtract"),diff:function(a,b,c){var d,e,f=J(a,this),g=6e4*(this.zone()-f.zone());return b=w(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-ra(this).startOf("month")-(f-ra(f).startOf("month")))/d,e-=6e4*(this.zone()-ra(this).startOf("month").zone()-(f.zone()-ra(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:n(e)},from:function(a,b){return ra.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(ra(),a)},calendar:function(a){var b=a||ra(),c=J(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this))},isLeapYear:function(){return D(this.year())},isDST:function(){return this.zone()+ra(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+ra(a).startOf(b)},isSame:function(a,b){return b=b||"ms",+this.clone().startOf(b)===+J(a,this).startOf(b)},min:e("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){return a=ra.apply(null,arguments),this>a?this:a}),max:e("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=ra.apply(null,arguments),a>this?this:a}),zone:function(a,b){var c,d=this._offset||0;return null==a?this._isUTC?d:this._d.getTimezoneOffset():("string"==typeof a&&(a=P(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._d.getTimezoneOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.subtract(c,"m"),d!==a&&(!b||this._changeInProgress?s(this,ra.duration(d-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ra.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?ra(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return A(this.year(),this.month())},dayOfYear:function(a){var b=wa((ra(this).startOf("day")-ra(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=fa(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=fa(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=fa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return B(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return B(this.year(),a.dow,a.doy)},get:function(a){return a=w(a),this[a]()},set:function(a,b){return a=w(a),"function"==typeof this[a]&&this[a](b),this},locale:function(b){return b===a?this._locale._abbr:(this._locale=ra.localeData(b),this)},lang:e("moment().lang() is deprecated. Use moment().localeData() instead.",function(b){return b===a?this.localeData():(this._locale=ra.localeData(b),this)}),localeData:function(){return this._locale}}),ra.fn.millisecond=ra.fn.milliseconds=ma("Milliseconds",!1),ra.fn.second=ra.fn.seconds=ma("Seconds",!1),ra.fn.minute=ra.fn.minutes=ma("Minutes",!1),ra.fn.hour=ra.fn.hours=ma("Hours",!0),ra.fn.date=ma("Date",!0),ra.fn.dates=e("dates accessor is deprecated. Use date instead.",ma("Date",!0)),ra.fn.year=ma("FullYear",!0),ra.fn.years=e("years accessor is deprecated. Use year instead.",ma("FullYear",!0)),ra.fn.days=ra.fn.day,ra.fn.months=ra.fn.month,ra.fn.weeks=ra.fn.week,ra.fn.isoWeeks=ra.fn.isoWeek,ra.fn.quarters=ra.fn.quarter,ra.fn.toJSON=ra.fn.toISOString,l(ra.duration.fn=k.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=n(d/1e3),g.seconds=a%60,b=n(a/60),g.minutes=b%60,c=n(b/60),g.hours=c%24,e+=n(c/24),h=n(na(e)),e-=n(oa(h)),f+=n(e/30),e%=30,h+=n(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return n(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*z(this._months/12)},humanize:function(a){var b=ea(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=ra.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=ra.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=w(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=w(a),b=this._days+this._milliseconds/864e5,"month"===a||"year"===a)return c=this._months+12*na(b),"month"===a?c:c/12;switch(b+=oa(this._months/12),a){case"week":return b/7;case"day":return b;case"hour":return 24*b;case"minute":return 24*b*60;case"second":return 24*b*60*60;case"millisecond":return 24*b*60*60*1e3;default:throw new Error("Unknown unit "+a)}},lang:ra.fn.lang,locale:ra.fn.locale,toIsoString:e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale}});for(ta in fb)fb.hasOwnProperty(ta)&&pa(ta.toLowerCase());ra.duration.fn.asMilliseconds=function(){return this.as("ms")},ra.duration.fn.asSeconds=function(){return this.as("s")},ra.duration.fn.asMinutes=function(){return this.as("m")},ra.duration.fn.asHours=function(){return this.as("h")},ra.duration.fn.asDays=function(){return this.as("d")},ra.duration.fn.asWeeks=function(){return this.as("weeks")},ra.duration.fn.asMonths=function(){return this.as("M")},ra.duration.fn.asYears=function(){return this.as("y")},ra.locale("en",{ordinal:function(a){var b=a%10,c=1===z(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Ga?module.exports=ra:"function"==typeof define&&define.amd?(define("moment",["require","exports","module"],function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(va.moment=sa),ra}),qa(!0)):qa()}.call(this),define("core/time",[],function(){"use strict";function a(a){return a.indexOf("+")>=0?a:a+"+00:00"}var b="YYYY-MM-DDTHH:mm:ssZ";return{ISO_8601:b,assureTzOffset:a}}),define("core/utils/cookies",["underscore"],function(a){"use strict";var b=window.document,c={create:function(c,d,e){e||(e={});var f=c+"="+d+"; path="+(e.path||"/"),g=e.domain,h=e.expiresIn;if(g&&(f+="; domain=."+g),a.isNumber(h)){var i=new Date((new Date).getTime()+h);f+="; expires="+i.toGMTString()}b.cookie=f},read:function(a){for(var c,d=a+"=",e=b.cookie.split(";"),f=0;f0,staff:Boolean(parseInt(b[2],10)),tzOffset:b[5],username:b[1]}},b}),define("core/models/BaseUser",["backbone","core/config"],function(a,b){"use strict";var c=a.Model.extend({defaults:{about:null,avatar:{cache:b.urls.avatar.generic,permalink:b.urls.avatar.generic},connections:{},email:null,isAnonymous:!0,isFollowedBy:null,isFollowing:null,joinedAt:null,name:null,profileUrl:null,url:null,username:null,numPosts:null,numFollowing:null,numForumsFollowing:null,numFollowers:null,numLikesReceived:null},hasValidAvatar:function(a){var b=a?a.avatar:this.get("avatar");return b&&b.cache},isAnonymous:function(){return!this.get("id")},isRegistered:function(){return!this.isAnonymous()},validate:function(a){return this.hasValidAvatar(a)?void 0:"None of the avatar related properties can be null, undefined or empty on User models."},toJSON:function(){var b=a.Model.prototype.toJSON.apply(this,arguments);return b.thread={},this.hasValidAvatar()||(b.avatar=this.defaults.avatar),b.isRegistered=this.isRegistered(),b}});return c}),function(a,b){"use strict";"object"==typeof module&&module.exports&&"function"==typeof require?module.exports=b():"function"==typeof define&&"object"==typeof define.amd?define("loglevel",b):a.log=b()}(this,function(){"use strict";function a(a){return typeof console===h?!1:void 0!==console[a]?b(console,a):void 0!==console.log?b(console,"log"):g}function b(a,b){var c=a[b];if("function"==typeof c.bind)return c.bind(a);try{return Function.prototype.bind.call(c,a)}catch(d){return function(){return Function.prototype.apply.apply(c,[a,arguments])}}}function c(a,b,c){return function(){typeof console!==h&&(d.call(this,b,c),this[a].apply(this,arguments))}}function d(a,b){for(var c=0;cc?g:this.methodFactory(d,a,b)}}function e(b,d,e){return a(b)||c.apply(this,arguments)}function f(a,b,c){function f(a){var b=(i[a]||"silent").toUpperCase();try{return void(window.localStorage[l]=b)}catch(c){}try{window.document.cookie=encodeURIComponent(l)+"="+b+";"}catch(c){}}function g(){var a;try{a=window.localStorage[l]}catch(b){}if(typeof a===h)try{var c=window.document.cookie,d=c.indexOf(encodeURIComponent(l)+"=");d&&(a=/^([^;]+)/.exec(c.slice(d))[1])}catch(b){}return void 0===k.levels[a]&&(a=void 0),a}var j,k=this,l="loglevel";a&&(l+=":"+a),k.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},k.methodFactory=c||e,k.getLevel=function(){return j},k.setLevel=function(b,c){if("string"==typeof b&&void 0!==k.levels[b.toUpperCase()]&&(b=k.levels[b.toUpperCase()]),!("number"==typeof b&&b>=0&&b<=k.levels.SILENT))throw"log.setLevel() called with invalid level: "+b;return j=b,c!==!1&&f(b),d.call(k,b,a),typeof console===h&&bl.MAX_NAME_LEN&&j(d,"name",g.interpolate(k("Name must have less than %(maxLength)s characters."),{maxLength:l.MAX_NAME_LEN}))),c.location&&c.location.length>l.MAX_LOCATION_LEN&&j(d,"location",g.interpolate(k("Location must have less than %(maxLength)s characters."),{maxLength:l.MAX_LOCATION_LEN})),c.url&&(c.url.length>l.MAX_URL_LEN&&j(d,"url",g.interpolate(k("Site must have less than %(maxLength)s characters."),{maxLength:l.MAX_URL_LEN})),f.isUrl(c.url)||j(d,"url",k("Please enter a valid site."))),b.isEmpty(d)?void 0:d},prepareFetchOptions:function(a){a=a?b.clone(a):{};var c={};return this.get("id")?c.user=this.get("id"):this.get("username")&&(c.user="username:"+this.get("username")),b.extend(c,a.data),a.data=c,a},fetch:function(a){return a=this.prepareFetchOptions(a),i.prototype.fetch.call(this,a)},parse:function(a){return a.response||a},register:function(a){var b=this;return a=a||{},h.call("internal/users/register.json",{secure:!0,data:this.toRegisterJSON(),method:"POST",success:function(c){b.set(c.response),a.success&&a.success(c)},error:a.error})},saveAvatar:function(a){var b=new window.FormData;return b.append("avatar_file",a),b.append("api_key",d.keys.api),h.call("internal/users/updateAvatar.json",{method:"post",data:b,cache:!1,contentType:!1,processData:!1})},saveProfile:function(){return h.call("users/updateProfile.json",{method:"POST",data:{name:this.get("name"),about:this.get("about"),location:this.get("location"),url:this.get("url")}})},toRegisterJSON:function(){return b.pick(this.toJSON(),"display_name","email","password")},isSession:function(a){return a.user.id&&a.user.id===this.id},isEditable:function(a){return this.isSession(a)&&!this.get("remote")},toJSON:function(a){a=a||{};var b=i.prototype.toJSON.call(this),c=this.collection&&this.collection.thread;return b.thread.canModerate=Boolean(c&&c.isModerator(this)),a.session&&(b.isSession=this.isSession(a.session),b.isEditable=this.isEditable(a.session)),b},_changeFollowState:function(a){this.set({isFollowing:a,numFollowers:Math.max(0,this.get("numFollowers")+(a?1:-1))});var b="users/"+(a?"follow":"unfollow"),c=this;return h.call(b+".json",{data:{target:this.get("id")},method:"POST",success:function(a){c.trigger("sync",c,a,{})}})},follow:function(){return this._changeFollowState(!0)},unfollow:function(){return this._changeFollowState(!1)},_changeBlockState:function(a){var b="users/block/"+(a?"create":"delete"),c=this;return h.call(b+".json",{data:{user:this.get("id")},method:"POST",success:function(a){c.set(a.response)}})},block:function(){return this._changeBlockState(!0)},unblock:function(){return this._changeBlockState(!1)},toggleFollowState:function(){return this._changeFollowState(!this.get("isFollowing"))},registeredLessThan:function(a,b){var d=e.assureTzOffset(this.get("joinedAt")),f=c().subtract(a,b);return c(d).isAfter(f)},registeredToday:function(){return this.registeredLessThan(1,"day")},registeredThisWeek:function(){return this.registeredLessThan(1,"week")},shouldHomeOnboard:function(){return!this.get("homeOnboardingComplete")},setHomeOnboardComplete:function(a){this.updateFlags({homeOnboardingComplete:a}),a&&this.listenTo(this,"change:homeOnboardingComplete",b.bind(this.set,this,"homeOnboardingComplete",a,{silent:!0}))},updateFlags:function(a){return this.set(a),h.call("internal/users/updateFlags.json",{data:b.mapObject(a,function(a){return a?1:0}),method:"POST"})}},{MIN_PASSWORD_LEN:6,MIN_NAME_LEN:2,MAX_NAME_LEN:30,MAX_LOCATION_LEN:255,MAX_URL_LEN:200});return l}),define("core/models/Session",["jquery","underscore","backbone","moment","core/api","core/bus","core/config","core/time","core/utils","core/utils/cookies","core/utils/guid","core/utils/auth","core/models/BaseUser","core/models/User"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";var o=c.Model.extend({initialize:function(){this.fromCookie=b.once(this.fromCookie,this),this.user=this.getAnonUserInstance()},setUser:function(a){this.user&&this.stopListening(this.user),this.user=a,this.setIfNewUser(),this.listenTo(a,"all",this.trigger),this.trigger("change:id",a)},isLoggedOut:function(){return!this.isLoggedIn()},isKnownToBeLoggedOut:function(){return!this.fromCookie().id},fromCookie:function(){return l.getFromCookie()},isLoggedIn:function(){return Boolean(this.user.get("id"))},fetch:function(a){a=a||{};var c={};return c["_"+(new Date).getTime()]=1,e.call("users/details.json",{data:c,success:b.bind(function(b){b=b.response,b.id&&this.setUser(this.getUserInstance(b)),a.success&&a.success(b),a.complete&&a.complete(b)},this),error:b.bind(function(b){a.error&&a.error(b),a.complete&&a.complete(b)},this)})},getAnonUserInstance:function(a){return new m(a)},getUserInstance:function(a){return new n(a)},getCsrfToken:function(){var a=j.read("csrftoken");return a||(a=k.generate().replace(/\W/g,""),j.create("csrftoken",a,{expiresIn:31536e6})),a},authenticate:function(c){var d=this.authServices[c];if(d){if(b.isFunction(d))return d.call(this);f.trigger("uiAction:openLogin",c);var e=this.getAuthWindowArgs(d),g=d.url;g+=(g.indexOf("?")>-1?"&":"?")+a.param(e),this.openAuthWindow(g,d.width,d.height)}},authServices:{disqus:{url:g.urls.login,width:460,height:355},twitter:{url:g.urls.oauth.twitter,width:650,height:680,csrf:!0},facebook:{url:g.urls.oauth.facebook,width:550,height:300,csrf:!0},google:{url:g.urls.oauth.google,width:445,height:635,csrf:!0}},getAuthWindowArgs:function(a){var c={};return"https:"===window.location.protocol&&(c.redirect_secure=1),a.csrf&&(c.ctkn=this.getCsrfToken()),b.extend(c,a.params),c},openAuthWindow:function(a,b,c){return i.openWindow(a,"_blank",{width:b,height:c})},setIfNewUser:function(){var a=this.user.get("joinedAt");if(this.user.get("isAnonymous")||!a)return void this.user.set("joinedRecently",!1);var b=h.assureTzOffset(a);this.user.set("joinedRecently",d().subtract(10,"seconds").isBefore(b))}});return o}),define("core/UniqueModel",["underscore"],function(a){"use strict";function b(a,c,d){var e=b.pool(a),f=c&&c[a.prototype.idAttribute];if(!f)return new a(c,d);var g=b.get(a,f);return g?e[f].set(c):e[f]=new a(c,d),e[f]}return b.pool={},b.pool=function(a){var c=b.pool[a.__type__];if(!c)throw new Error("Model not registered. Use UniqueModel.addType");return c},b.get=function(a,c){return b.pool(a)[c]},b.set=function(a,c){var d=b.pool(a),e=c&&c.get(a.prototype.idAttribute);if(!e)return c;var f=b.get(a,e);return f?f.set(c.attributes):f=d[e]=c,f},b.addType=function(a,c){c.__type__&&b.pool[a]||(c.__type__=a,b.pool[a]={})},b.boundModel=function(c){var d=a.bind(b,b,c);return d.prototype=c.prototype,d},b.wrap=b.boundModel,b}),window.Modernizr=function(a,b,c){function d(a){o.cssText=a}function e(a,b){return typeof a===b}var f,g,h,i="2.6.2",j={},k=!0,l=b.documentElement,m="modernizr",n=b.createElement(m),o=n.style,p=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),q={},r=[],s=r.slice,t=function(a,c,d,e){var f,g,h,i,j=b.createElement("div"),k=b.body,n=k||b.createElement("body");if(parseInt(d,10))for(;d--;)h=b.createElement("div"),h.id=e?e[d]:m+(d+1),j.appendChild(h);return f=["­",'"].join(""),j.id=m,(k?j:n).innerHTML+=f,n.appendChild(j),k||(n.style.background="",n.style.overflow="hidden",i=l.style.overflow,l.style.overflow="hidden",l.appendChild(n)),g=c(j,a),k?j.parentNode.removeChild(j):(n.parentNode.removeChild(n),l.style.overflow=i),!!g},u={}.hasOwnProperty;h=e(u,"undefined")||e(u.call,"undefined")?function(a,b){return b in a&&e(a.constructor.prototype[b],"undefined")}:function(a,b){return u.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=s.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(s.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(s.call(arguments)))};return d}),q.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:t(["@media (",p.join("touch-enabled),("),m,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=9===a.offsetTop}),c},q.localstorage=function(){try{return localStorage.setItem(m,m),localStorage.removeItem(m),!0}catch(a){return!1}},q.sessionstorage=function(){try{return sessionStorage.setItem(m,m),sessionStorage.removeItem(m),!0}catch(a){return!1}};for(var v in q)h(q,v)&&(g=v.toLowerCase(),j[g]=q[v](),r.push((j[g]?"":"no-")+g));return j.addTest=function(a,b){if("object"==typeof a)for(var d in a)h(a,d)&&j.addTest(d,a[d]);else{if(a=a.toLowerCase(),j[a]!==c)return j;b="function"==typeof b?b():b,"undefined"!=typeof k&&k&&(l.className+=" "+(b?"":"no-")+a),j[a]=b}return j},d(""),n=f=null,j._version=i,j._prefixes=p,j.testStyles=t,l.className=l.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(k?" js "+r.join(" "):""),j}(this,this.document),Modernizr.addTest("contenteditable","contentEditable"in document.documentElement),define("modernizr",function(a){return function(){var b;return b||a.Modernizr}}(this)),define("core/WindowBus",["jquery","underscore","backbone","modernizr"],function(a,b,c,d){"use strict";var e=c.Model.extend({initialize:function(){d.localstorage&&a(window).on("storage",b.bind(this.onStorageEvent,this))},broadcast:function(a,b){if(d.localstorage){var c=JSON.stringify({name:a,data:b,time:(new Date).getTime()});try{window.localStorage.setItem(this.constructor.STORAGE_KEY,c)}catch(e){return}}},onStorageEvent:function(a){var b=a.originalEvent.key,c=a.originalEvent.newValue;if(c&&b===this.constructor.STORAGE_KEY)try{c=JSON.parse(c),this.trigger(c.name,c.data)}catch(d){return}}},{STORAGE_KEY:"disqus.bus"});return e}),define("core/utils/storage",[],function(){"use strict";var a=function(a){var b="_dsqstorage_";try{return a.localStorage.setItem(b,b),a.localStorage.getItem(b),a.localStorage.removeItem(b),!0}catch(c){return!1}}(window),b=function(){var a={};return{getItem:function(b){return a.hasOwnProperty(b)?a[b]:null},setItem:function(b,c){a[b]=String(c)},removeItem:function(b){delete a[b]},clear:function(){a={}}}}();return{get:function(a){var b=null;try{return b=this.backend.getItem(a),JSON.parse(b)}catch(c){return b}},set:function(a,b){try{this.backend.setItem(a,JSON.stringify(b))}catch(c){}},remove:function(a){this.backend.removeItem(a)},clear:function(){this.backend.clear()},backend:a?window.localStorage:b,isPersistent:a}}),define("common/cached-storage",["underscore","core/utils/storage"],function(a,b){"use strict";var c=function(a,b){this.namespace=a,this.ttl=b||300,this.cache=this.getFromStorage()};return a.extend(c.prototype,{getItem:function(a){var b=this.cache[a];if(b){if(!this.isExpired(b))return b.value;delete this.cache[a]}},getCurrentTime:function(){return Math.floor((new Date).getTime()/1e3)},persist:function(){b.set(this.namespace,this.cache)},getFromStorage:function(){var c=b.get(this.namespace);return a.isObject(c)?c:{}},isExpired:function(a){return this.getCurrentTime()>a.expiry},setItem:function(a,b){this.cache[a]={value:b,expiry:this.getCurrentTime()+this.ttl},this.persist()},removeItem:function(a){delete this.cache[a],this.persist()},getAll:function(){var b=a.chain(this.cache).map(function(a,b){return this.getItem(b)},this).compact().value();return this.persist(),b}}),c}),function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define("handlebars",[],b):"object"==typeof exports?exports.Handlebars=b():a.Handlebars=b()}(this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="",b(0)}([function(a,b,c){"use strict";function d(){var a=new h.HandlebarsEnvironment;return n.extend(a,h),a.SafeString=j["default"],a.Exception=l["default"],a.Utils=n,a.escapeExpression=n.escapeExpression,a.VM=p,a.template=function(b){return p.template(b,a)},a}var e=c(1)["default"],f=c(2)["default"];b.__esModule=!0;var g=c(3),h=e(g),i=c(17),j=f(i),k=c(5),l=f(k),m=c(4),n=e(m),o=c(18),p=e(o),q=c(19),r=f(q),s=d();s.create=d,r["default"](s),s["default"]=s,b["default"]=s,a.exports=b["default"]},function(a,b){"use strict";b["default"]=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b["default"]=a,b},b.__esModule=!0},function(a,b){"use strict";b["default"]=function(a){return a&&a.__esModule?a:{"default":a}},b.__esModule=!0},function(a,b,c){"use strict";function d(a,b,c){this.helpers=a||{},this.partials=b||{},this.decorators=c||{},i.registerDefaultHelpers(this),j.registerDefaultDecorators(this)}var e=c(2)["default"];b.__esModule=!0,b.HandlebarsEnvironment=d;var f=c(4),g=c(5),h=e(g),i=c(6),j=c(14),k=c(16),l=e(k),m="4.0.5";b.VERSION=m;var n=7;b.COMPILER_REVISION=n;var o={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};b.REVISION_CHANGES=o;var p="[object Object]";d.prototype={constructor:d,logger:l["default"],log:l["default"].log,registerHelper:function(a,b){if(f.toString.call(a)===p){if(b)throw new h["default"]("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){if(f.toString.call(a)===p)f.extend(this.partials,a);else{if("undefined"==typeof b)throw new h["default"]('Attempting to register a partial called "'+a+'" as undefined');this.partials[a]=b}},unregisterPartial:function(a){delete this.partials[a]},registerDecorator:function(a,b){if(f.toString.call(a)===p){if(b)throw new h["default"]("Arg not supported with multiple decorators");f.extend(this.decorators,a)}else this.decorators[a]=b},unregisterDecorator:function(a){delete this.decorators[a]}};var q=l["default"].log;b.log=q,b.createFrame=f.createFrame,b.logger=l["default"]},function(a,b){"use strict";function c(a){return k[a]}function d(a){for(var b=1;bc;c++)if(a[c]===b)return c;return-1}function f(a){if("string"!=typeof a){if(a&&a.toHTML)return a.toHTML();if(null==a)return"";if(!a)return a+"";a=""+a}return m.test(a)?a.replace(l,c):a}function g(a){return a||0===a?p(a)&&0===a.length?!0:!1:!0}function h(a){var b=d({},a);return b._parent=a,b}function i(a,b){return a.path=b,a}function j(a,b){return(a?a+".":"")+b}b.__esModule=!0,b.extend=d,b.indexOf=e,b.escapeExpression=f,b.isEmpty=g,b.createFrame=h,b.blockParams=i,b.appendContextPath=j;var k={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},l=/[&<>"'`=]/g,m=/[&<>"'`=]/,n=Object.prototype.toString;b.toString=n;var o=function(a){return"function"==typeof a};o(/x/)&&(b.isFunction=o=function(a){return"function"==typeof a&&"[object Function]"===n.call(a)}),b.isFunction=o;var p=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===n.call(a):!1};b.isArray=p},function(a,b){"use strict";function c(a,b){var e=b&&b.loc,f=void 0,g=void 0;e&&(f=e.start.line,g=e.start.column,a+=" - "+f+":"+g);for(var h=Error.prototype.constructor.call(this,a),i=0;i0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):e(this);if(c.data&&c.ids){var g=d.createFrame(c.data);g.contextPath=d.appendContextPath(c.data.contextPath,c.name),c={data:g}}return f(b,c)})},a.exports=b["default"]},function(a,b,c){"use strict";var d=c(2)["default"];b.__esModule=!0;var e=c(4),f=c(5),g=d(f);b["default"]=function(a){a.registerHelper("each",function(a,b){function c(b,c,f){j&&(j.key=b,j.index=c,j.first=0===c,j.last=!!f,k&&(j.contextPath=k+b)),i+=d(a[b],{data:j,blockParams:e.blockParams([a[b],b],[k+b,null])})}if(!b)throw new g["default"]("Must pass iterator to #each");var d=b.fn,f=b.inverse,h=0,i="",j=void 0,k=void 0;if(b.data&&b.ids&&(k=e.appendContextPath(b.data.contextPath,b.ids[0])+"."),e.isFunction(a)&&(a=a.call(this)),b.data&&(j=e.createFrame(b.data)),a&&"object"==typeof a)if(e.isArray(a))for(var l=a.length;l>h;h++)h in a&&c(h,h,h===a.length-1);else{var m=void 0;for(var n in a)a.hasOwnProperty(n)&&(void 0!==m&&c(m,h-1),m=n,h++);void 0!==m&&c(m,h-1,!0)}return 0===h&&(i=f(this)),i})},a.exports=b["default"]},function(a,b,c){"use strict";var d=c(2)["default"];b.__esModule=!0;var e=c(5),f=d(e);b["default"]=function(a){a.registerHelper("helperMissing",function(){if(1!==arguments.length)throw new f["default"]('Missing helper: "'+arguments[arguments.length-1].name+'"')})},a.exports=b["default"]},function(a,b,c){"use strict";b.__esModule=!0;var d=c(4);b["default"]=function(a){a.registerHelper("if",function(a,b){return d.isFunction(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||d.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})})},a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0,b["default"]=function(a){a.registerHelper("log",function(){for(var b=[void 0],c=arguments[arguments.length-1],d=0;d=0?b:parseInt(a,10)}return a},log:function(a){if(a=e.lookupLevel(a),"undefined"!=typeof console&&e.lookupLevel(e.level)<=a){var b=e.methodMap[a];console[b]||(b="log");for(var c=arguments.length,d=Array(c>1?c-1:0),f=1;c>f;f++)d[f-1]=arguments[f];console[b].apply(console,d)}}};b["default"]=e,a.exports=b["default"]},function(a,b){"use strict";function c(a){this.string=a}b.__esModule=!0,c.prototype.toString=c.prototype.toHTML=function(){return""+this.string},b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=r.COMPILER_REVISION;if(b!==c){if(c>b){var d=r.REVISION_CHANGES[c],e=r.REVISION_CHANGES[b];throw new q["default"]("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new q["default"]("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){function c(c,d,e){e.hash&&(d=o.extend({},d,e.hash),e.ids&&(e.ids[0]=!0)),c=b.VM.resolvePartial.call(this,c,d,e);var f=b.VM.invokePartial.call(this,c,d,e);if(null==f&&b.compile&&(e.partials[e.name]=b.compile(c,a.compilerOptions,b),f=e.partials[e.name](d,e)),null!=f){if(e.indent){for(var g=f.split("\n"),h=0,i=g.length;i>h&&(g[h]||h+1!==i);h++)g[h]=e.indent+g[h];f=g.join("\n")}return f}throw new q["default"]("The partial "+e.name+" could not be compiled when running in runtime-only mode")}function d(b){function c(b){return""+a.main(e,b,e.helpers,e.partials,g,i,h)}var f=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],g=f.data;d._setup(f),!f.partial&&a.useData&&(g=j(b,g));var h=void 0,i=a.useBlockParams?[]:void 0;return a.useDepths&&(h=f.depths?b!==f.depths[0]?[b].concat(f.depths):f.depths:[b]),(c=k(a.main,c,e,f.depths||[],g,i))(b,f)}if(!b)throw new q["default"]("No environment passed to template");if(!a||!a.main)throw new q["default"]("Unknown template object: "+typeof a);a.main.decorator=a.main_d,b.VM.checkRevision(a.compiler);var e={strict:function(a,b){if(!(b in a))throw new q["default"]('"'+b+'" not defined in '+a);return a[b]},lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:o.escapeExpression,invokePartial:c,fn:function(b){var c=a[b];return c.decorator=a[b+"_d"],c},programs:[],program:function(a,b,c,d,e){var g=this.programs[a],h=this.fn(a);return b||e||d||c?g=f(this,a,h,b,c,d,e):g||(g=this.programs[a]=f(this,a,h)),g},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=o.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler};return d.isTop=!0,d._setup=function(c){c.partial?(e.helpers=c.helpers,e.partials=c.partials,e.decorators=c.decorators):(e.helpers=e.merge(c.helpers,b.helpers),a.usePartial&&(e.partials=e.merge(c.partials,b.partials)),(a.usePartial||a.useDecorators)&&(e.decorators=e.merge(c.decorators,b.decorators)))},d._child=function(b,c,d,g){if(a.useBlockParams&&!d)throw new q["default"]("must pass block params");if(a.useDepths&&!g)throw new q["default"]("must pass parent depths");return f(e,b,a[b],c,0,d,g)},d}function f(a,b,c,d,e,f,g){function h(b){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],h=g;return g&&b!==g[0]&&(h=[b].concat(g)),c(a,b,a.helpers,a.partials,e.data||d,f&&[e.blockParams].concat(f),h)}return h=k(c,h,a,g,d,f),h.program=b,h.depth=g?g.length:0,h.blockParams=e||0,h}function g(a,b,c){return a?a.call||c.name||(c.name=a,a=c.partials[a]):a="@partial-block"===c.name?c.data["partial-block"]:c.partials[c.name],a}function h(a,b,c){c.partial=!0,c.ids&&(c.data.contextPath=c.ids[0]||c.data.contextPath);var d=void 0;if(c.fn&&c.fn!==i&&(c.data=r.createFrame(c.data),d=c.data["partial-block"]=c.fn,d.partials&&(c.partials=o.extend({},c.partials,d.partials))),void 0===a&&d&&(a=d),void 0===a)throw new q["default"]("The partial "+c.name+" could not be found");return a instanceof Function?a(b,c):void 0}function i(){return""}function j(a,b){return b&&"root"in b||(b=b?r.createFrame(b):{},b.root=a),b}function k(a,b,c,d,e,f){if(a.decorator){var g={};b=a.decorator(b,g,c,d&&d[0],e,f,d),o.extend(b,g)}return b}var l=c(1)["default"],m=c(2)["default"];b.__esModule=!0,b.checkRevision=d,b.template=e,b.wrapProgram=f,b.resolvePartial=g,b.invokePartial=h,b.noop=i;var n=c(4),o=l(n),p=c(5),q=m(p),r=c(3)},function(a,b){(function(c){"use strict";b.__esModule=!0,b["default"]=function(a){var b="undefined"!=typeof c?c:window,d=b.Handlebars;a.noConflict=function(){return b.Handlebars===a&&(b.Handlebars=d),a}},a.exports=b["default"]}).call(b,function(){return this}())}])}),define("core/extensions/helpers/eq",[],function(){"use strict";return function(a,b){return a===b}}),define("core/extensions/helpers/ne",[],function(){"use strict";return function(a,b){return a!==b}}),define("core/extensions/helpers/gt",[],function(){"use strict";return function(a,b){return a>b}}),define("core/extensions/helpers/lt",[],function(){"use strict";return function(a,b){return b>a}}),define("core/extensions/helpers/ge",[],function(){"use strict";return function(a,b){return a>=b}}),define("core/extensions/helpers/le",[],function(){"use strict";return function(a,b){return b>=a}}),define("core/extensions/helpers/typeof",[],function(){"use strict";return function(a,b){return typeof a===b}}),define("core/extensions/helpers/notNull",[],function(){"use strict";return function(a){return null!==a}}),define("core/extensions/helpers/any",[],function(){"use strict";return function(){for(var a=arguments.length,b=0;a-1>b;b++)if(arguments[b])return arguments[b]}}),define("core/extensions/helpers/if_any",[],function(){"use strict";return function(){for(var a=arguments.length,b=arguments[a-1],c=0;a-1>c;c++)if(arguments[c])return b.fn(this);return b.inverse(this)}}),define("core/extensions/helpers/if_all",[],function(){"use strict";return function(){for(var a=arguments.length,b=arguments[a-1],c=0;a-1>c;c++)if(!arguments[c])return b.inverse(this);return b.fn(this)}}),define("core/utils/hash",[],function(){"use strict";var a=function(a){var b,c,d,e=0;if(0===a.length)return e;for(b=0,c=a.length;c>b;b++)d=a.charCodeAt(b),e=(e<<5)-e+d,e|=0;return e};return{calculate:a}}),define("core/analytics/identity",["exports","core/utils/cookies","core/utils/guid","core/utils/hash","core/utils/fingerprint"],function(a,b,c,d,e){"use strict";var f=a.ImpressionManager=function(){this.prevImp=b.read(this.COOKIE_NAME),this.setImpressionId(c.generate()); };f.prototype.COOKIE_NAME="__jid",f.prototype.TTL=18e5,f.prototype.setImpressionId=function(a){this.impId=a,this.persist()},f.prototype.persist=function(){b.create(this.COOKIE_NAME,this.impId,{expiresIn:this.TTL})},a.impression=new f;var g=a.UniqueManager=function(){var a=b.read(this.COOKIE_NAME)||c.generate();b.create(this.COOKIE_NAME,a,{domain:window.location.host.split(":")[0],expiresIn:this.TTL}),this.value=a};g.prototype.COOKIE_NAME="disqus_unique",g.prototype.TTL=31536e6,g.prototype.isPersistent=function(){return b.read(this.COOKIE_NAME)===this.value},a.unique=new g,a.clientId=function(){var b,c=a.unique;return c.isPersistent()&&(b=c.value),b||e.get().toString()},a.clientPercent=function(){return Math.abs(d.calculate(a.clientId())%100)}}),define("core/switches",["underscore","remote/config","core/analytics/identity","core/utils/storage","core/utils/auth"],function(a,b,c,d,e){"use strict";var f="switch:",g={};return g._getKey=function(a){return f+a},g.disableFeature=function(a){d.set(this._getKey(a),!1)},g.unsetFeature=function(a){d.remove(this._getKey(a),!0)},g.forceFeature=function(a){d.set(this._getKey(a),!0)},g.isFeatureActive=function(f,g){var h=this._getKey(f),i=d.get(h);if(a.isBoolean(i))return i;var j=(b.lounge&&b.lounge.switches||{})[f];if(!j)return!1;var k=e.getFromCookie();return g=a.defaults(g||{},{percent:c.clientPercent()+1,user_id:k.id,username:k.username,is_staff:k.staff,is_moderator:k.isModerator}),a.any(j,function(b,c){return/percent$/.test(c)&&a.isNumber(b)?b>=g[c]:a.isArray(b)?a.contains(b,g[c]):b===g[c]})},g}),define("core/extensions/helpers/switch",["core/switches"],function(a){"use strict";return function(b){return a.isFeatureActive(b)}}),define("core/extensions/helpers/partial",["handlebars"],function(a){"use strict";return function(b,c){a.registerPartial(b,c.fn)}}),define("core/extensions/helpers/getPartial",["handlebars"],function(a){"use strict";return function(b,c,d){return"undefined"==typeof d&&(d=c,c=this,a.Utils.extend(c,d.hash)),new a.SafeString(a.partials[b](c,d))}}),define("core/extensions/helpers/gettext",["handlebars","core/strings"],function(a,b){"use strict";return function(){var c,d,e,f,g=arguments.length,h=arguments[g-1],i=h.hash,j=arguments[0],k=a.partials;j=b.get(j);for(e in i)i.hasOwnProperty(e)&&(d=new RegExp("%\\(("+e+")\\)s","gm"),c=i[e],f=c&&c.executePartial,f&&(c=k[c.partial].call(this,c.context,h)),void 0===c||null===c||"number"==typeof c&&isNaN(c)?c="":f||(c=a.Utils.escapeExpression(c)),j=j.replace(d,c.toString()));return new a.SafeString(j)}}),define("core/config/urls",["common/urls"],function(a){"use strict";return a}),define("core/extensions/helpers/urlfor",["core/config/urls"],function(a){"use strict";return function(b){for(var c=b.split("."),d=c.length,e=a,f=0;e.hasOwnProperty(c[f])&&d>f;)e=e[c[f]],f+=1;return e}}),define("core/extensions/helpers/html",["handlebars"],function(a){"use strict";return function(b){return new a.SafeString(b||"")}}),define("core/extensions/helpers/with",[],function(){"use strict";return function(){var a=arguments.length,b=arguments[a-1],c=arguments[0];return 3===a?(c={},c[arguments[0]]=arguments[1]):"_window_"===c&&(c=window),b.fn(c)}}),define("core/extensions/helpers/each",["handlebars"],function(a){"use strict";return function(b,c){var d,e,f,g=c.fn,h=c.inverse,i=0,j="";if(c.data&&(d=a.createFrame(c.data)),b&&"object"==typeof b)if("[object Array]"===Object.prototype.toString.call(b))for(f=b.length;f>i;i++)d&&(d.index=i,d.length=b.length),j+=g(b[i],{data:d});else for(e in b)b.hasOwnProperty(e)&&(d&&(d.key=e),j+=g(b[e],{data:d}),i+=1);return 0===i&&(j=h(this)),j}}),define("core/extensions/helpers/log",[],function(){"use strict";return function(a){console.log(a,this)}}),define("core/extensions/helpers/debug",[],function(){"use strict";return function(){}}),define("core/extensions/helpers/geturl",[],function(){"use strict";return window.geturl||function(a){return a}}),define("core/extensions/helpers/truncate",["handlebars"],function(a){"use strict";return function(b,c){return b.length<=c?b:new a.SafeString(a.Utils.escapeExpression(b.slice(0,c))+"…")}}),define("core/extensions/helpers/tag",["handlebars"],function(a){"use strict";return function(b,c){var d=["<"+b],e=c.hash.text;delete c.hash.text;for(var f in c.hash)c.hash.hasOwnProperty(f)&&d.push(" "+f+'="'+a.escapeExpression(c.hash[f])+'"');return d.push(">"+a.escapeExpression(e)+""),new a.SafeString(d.join(""))}}),define("core/extensions/helpers/now",["moment"],function(a){"use strict";return function(b){return a().format(b)}}),define("core/extensions/handlebars.helpers",["require","handlebars","./helpers/eq","./helpers/ne","./helpers/gt","./helpers/lt","./helpers/ge","./helpers/le","./helpers/typeof","./helpers/notNull","./helpers/any","./helpers/if_any","./helpers/if_all","./helpers/switch","./helpers/partial","./helpers/getPartial","./helpers/gettext","./helpers/urlfor","./helpers/html","./helpers/with","./helpers/each","./helpers/log","./helpers/debug","./helpers/geturl","./helpers/truncate","./helpers/tag","./helpers/now"],function(a){"use strict";var b=a("handlebars");return b.registerHelper("eq",a("./helpers/eq")),b.registerHelper("ne",a("./helpers/ne")),b.registerHelper("gt",a("./helpers/gt")),b.registerHelper("lt",a("./helpers/lt")),b.registerHelper("ge",a("./helpers/ge")),b.registerHelper("le",a("./helpers/le")),b.registerHelper("typeof",a("./helpers/typeof")),b.registerHelper("notNull",a("./helpers/notNull")),b.registerHelper("any",a("./helpers/any")),b.registerHelper("if_any",a("./helpers/if_any")),b.registerHelper("if_all",a("./helpers/if_all")),b.registerHelper("switch",a("./helpers/switch")),b.registerHelper("partial",a("./helpers/partial")),b.registerHelper("getPartial",a("./helpers/getPartial")),b.registerHelper("gettext",a("./helpers/gettext")),b.registerHelper("urlfor",a("./helpers/urlfor")),b.registerHelper("html",a("./helpers/html")),b.registerHelper("with",a("./helpers/with")),b.registerHelper("each",a("./helpers/each")),b.registerHelper("log",a("./helpers/log")),b.registerHelper("debug",a("./helpers/debug")),b.registerHelper("geturl",a("./helpers/geturl")),b.registerHelper("truncate",a("./helpers/truncate")),b.registerHelper("tag",a("./helpers/tag")),b.registerHelper("now",a("./helpers/now")),b}),define("common/templates",["handlebars","core/extensions/handlebars.helpers"],function(a){"use strict";function b(b,c){return a.partials[b](c||{})}function c(b){return a.partials[b]}return{render:b,getTemplate:c}}),define("lounge/views/recommend-button",["backbone","core/utils/storage","common/templates"],function(a,b,c){"use strict";var d=a.View.extend({className:"thread-likes",events:{"click [data-action=recommend]":"recommendHandler"},initialize:function(a){this.session=a.session,this.thread=a.thread,this.loggedOutRecommendFlag=this.session.getLoggedOutUserFlags().get(d.ONBOARDING_KEY),this.listenTo(this.thread,"change:userScore",this.render),this.listenTo(this.thread,"change:likes",this.render),this.listenTo(this.session,"change:id",this.startRecommendOnboarding),this.setTooltipEnabled()},setTooltipEnabled:function(){this.tooltipEnabled=this.session.isLoggedIn()?b.get(d.ONBOARDING_KEY):!this.loggedOutRecommendFlag.isRead()},render:function(){return this.$el.html(c.render("threadVotes",{thread:this.thread.toJSON(),user:this.session.toJSON(),loggedIn:this.session.isLoggedIn()})),this},startRecommendOnboarding:function(){this.session.user.get("joinedRecently")&&b.set(d.ONBOARDING_KEY,"true"),this.setTooltipEnabled()},recommendHandler:function(a){a.stopPropagation(),a.preventDefault();var b=0===this.thread.get("userScore");this.trigger(b?"vote:like":"vote:unlike"),this.thread.vote(b?1:0),this.toggleTooltip(b),this.tooltipEnabled&&b&&this.markAsSeen()},markAsSeen:function(){this.session.isLoggedIn()?b.remove(d.ONBOARDING_KEY):this.loggedOutRecommendFlag.markRead()},toggleTooltip:function(a){this.tooltipEnabled&&(a?this.$el.parent().addClass("open"):this.$el.parent().removeClass("open"))}},{ONBOARDING_KEY:"showRecommendOnboarding"});return d}),define("common/collections/LoggedOutCache",["backbone","common/cached-storage","lounge/views/recommend-button"],function(a,b,c){"use strict";var d=[{id:"welcome",title:"",body:""}],e=[{id:c.ONBOARDING_KEY}],f=new b("notes",7776e3),g=a.Model.extend({markRead:function(){f.setItem(this.id,!0)},isRead:function(){return Boolean(f.getItem(this.id))}}),h=a.Collection.extend({initialize:function(a,b){this.session=b.session},model:g,markAllRead:function(){return this.each(function(a){a.markRead()}),this.session.set("notificationCount",0),this},getUnread:function(){return this.filter(function(a){return!a.isRead()})}});return{storage:f,Collection:h,Model:g,LOGGED_OUT_NOTES:d,LOGGED_OUT_FLAGS:e}}),define("core/utils/html",["jquery","underscore"],function(a,b){"use strict";var c=function(){var c=a("
");return b.bind(c.html,c)}(),d=/<\/?p>|/gi;return{stripTags:function(b){return b=b.replace(d," ").replace(/<[\/\w!\[][^>]*>/g,"​"),a.trim(c(b).text().replace(/\u200b/g,""))},replaceAnchors:function(a,c){var d;try{d=(new window.DOMParser).parseFromString(a,"text/html")}catch(e){}return d||(d=window.document.implementation.createHTMLDocument(""),d.body.innerHTML=a),b.each(d.querySelectorAll("a"),function(a){var b=a.getAttribute("href")||"",d=a.innerHTML,e=c(a);0===b.indexOf(d.slice(0,-3))?d=e:b.length&&-1!==d.indexOf(b)?d=d.replace(b,e):d+=" "+e,a.insertAdjacentHTML("afterend",d),a.parentNode.removeChild(a)}),d.body.innerHTML.trim()}}}),define("core/advice",["underscore"],function(a){"use strict";function b(){a.each(["before","after","around"],function(a){this[a]=function(b,d){return"function"==typeof this[b]?this[b]=c[a](this[b],d):this[b]=d,this[b]}},this)}var c={around:function(b,c){return function(){var d=a.toArray(arguments);return c.apply(this,[a.bind(b,this)].concat(d))}},before:function(b,d){return c.around(b,function(){var b=a.toArray(arguments),c=b.shift();return d.apply(this,b),c.apply(this,b)})},after:function(b,d){return c.around(b,function(){var b=a.toArray(arguments),c=b.shift(),e=c.apply(this,b);return d.apply(this,b),e})}};return{withAdvice:b}}),define("core/models/mixins",["underscore","moment","core/time"],function(a,b,c){"use strict";function d(){this._getCreatedMoment=a.memoize(function(){var a=this.get("createdAt");if(a)return b(c.assureTzOffset(a),c.ISO_8601)},function(){return this.get("createdAt")}),this.getRelativeCreatedAt=function(){var a=this._getCreatedMoment();return a&&a.from(Number(new Date))},this.getFormattedCreatedAt=a.memoize(function(){var a=this._getCreatedMoment();return a&&a.format("LLLL")},function(){return this.get("createdAt")})}return{withCreatedAt:d}}),define("core/collections/UserCollection",["jquery","backbone","core/models/User"],function(a,b,c){"use strict";var d=b.Collection.extend({model:c,initialize:function(a,c){b.Collection.prototype.initialize.apply(this,arguments),this.thread=c&&c.thread},fetch:function(){return a.when(!0)}});return d}),define("core/collections/UpvotersUserCollection",["underscore","backbone","core/api","core/collections/UserCollection"],function(a,b,c,d){"use strict";var e=d.extend({LIMIT:50,url:function(){return c.getURL("posts/listUsersVotedPost")},initialize:function(a,b){this.postId=b.postId,this.threadId=b.threadId},fetch:function(c){return b.Collection.prototype.fetch.call(this,a.extend({data:{post:this.postId,thread:this.threadId,vote:1,limit:this.LIMIT}},c))}});return e}),define("core/models/Vote",["backbone"],function(a){"use strict";var b=a.Model.extend({defaults:{score:0}});return b}),define("core/collections/VoteCollection",["backbone","core/models/Vote"],function(a,b){"use strict";var c=a.Collection.extend({model:b});return c}),define("core/models/Post",["jquery","underscore","backbone","moment","core/config/urls","core/api","core/strings","core/time","core/utils","core/utils/html","core/advice","core/models/mixins","core/collections/UpvotersUserCollection","core/collections/VoteCollection"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){"use strict";var o=1e3,p=0,q=function(){var b=a.now();return o>b-p?!1:(p=b,!0)},r=g.get,s=c.Model.extend({upvotersCollectionClass:m,defaults:function(){return{createdAt:d().format(h.ISO_8601),dislikes:0,isApproved:!0,isDeleted:!1,isEdited:!1,isFlagged:!1,isFlaggedByUser:!1,isHighlighted:!1,isRealtime:!1,isImmediateReply:!1,isMinimized:null,hasMedia:!1,message:null,raw_message:null,likes:0,media:[],parent:null,points:0,depth:0,userScore:0}},initialize:function(){this.votes=new n},messageText:function(){var a=this.get("message");return a&&j.stripTags(a)},permalink:function(a,b){var c=this.id;if(!c||!a)return"";var d=b!==!1&&a.currentUrl||a.permalink(),e=window.document.createElement("a");return e.href=d,e.hash="#comment-"+c,e.href},shortLink:function(){return e.shortener+"/p/"+Number(this.id).toString(36)},twitterText:function(a){var b=140,c=this.author.get("name")||this.author.get("username");b-=c.length+3,b-=a.length+1,b-=2;var d=i.niceTruncate(this.messageText(),b);return'"'+d+'" — '+c},toJSON:function(a){var b=c.Model.prototype.toJSON.call(this);if(a){var d=a.session,e=a.thread;b.canBeEdited=this.canBeEdited(d,e),b.canBeRepliedTo=this.canBeRepliedTo(d,e),b.canBeShared=this.canBeShared(),b.permalink=this.permalink(e)}return b.shortLink=this.shortLink(),b.isMinimized=this.isMinimized(),b.plaintext=this.messageText(),b.relativeCreatedAt=this.getRelativeCreatedAt(),b.formattedCreatedAt=this.getFormattedCreatedAt(),b.cid=this.cid,b},isPublic:function(){return this.get("isHighlighted")||this.get("isSponsored")?!0:this.get("isDeleted")?!1:this.get("isApproved")},isMinimized:function(){return this.get("isHighlighted")?!1:this.get("isMinimized")===!1?!1:!this.get("isApproved")},isAuthorSessionUser:function(){return!1},canBeEdited:function(){return!1},canBeRepliedTo:function(){return!1},canBeShared:function(){return!1},validate:function(c){if(!this.id&&!c.id){if(b.isString(c.raw_message)){if(""===c.raw_message)return r("Comments can't be blank.");if(c.raw_message.length<2)return r("Comments must have at least 2 characters.")}return c.author_email&&(c.author_email=a.trim(c.author_email)),c.author_name&&(c.author_name=a.trim(c.author_name)),""===c.author_email&&""===c.author_name?r("Please sign in or enter a name and email address."):""===c.author_email||""===c.author_name?r("Please enter both a name and email address."):b.isString(c.author_email)&&!this.validateEmail(c.author_email)?r("Invalid email address format."):void 0}},validateEmail:function(a){return i.validateEmail(a)},report:function(){this.set("isFlagged",!0),f.call("posts/report.json",{data:{post:this.id},method:"POST"})},_highlight:function(a){this.set("isHighlighted",a),f.call("posts/"+(a?"highlight":"unhighlight")+".json",{data:{post:this.id},method:"POST"})},highlight:function(){this._highlight(!0)},unhighlight:function(){this._highlight(!1)},getThreadId:function(){return this.get("thread")},getUpvotersUserCollection:b.memoize(function(){var a=this.upvotersCollectionClass;return new a(void 0,{postId:this.id,threadId:this.getThreadId()})},function(){return this.id}),_vote:function(a,b,c){var d=a-b,e={likes:this.get("likes"),dislikes:this.get("dislikes"),points:this.get("points")};return 0===d?d:(a>0?(e.likes+=a,e.dislikes+=b):0>a?(e.dislikes-=a,e.likes-=b):b>0?e.likes-=b:e.dislikes+=b,e.points+=d,c&&this.getUpvotersUserCollection()[a>0?"add":"remove"](c),this.set(e),d)},vote:function(a){if(!q())return 0;var b=this,c=b._vote(a,b.get("userScore"));0!==c&&(b.set("userScore",a),f.call("posts/vote.json",{data:{post:b.id,vote:a},method:"POST",success:function(c){b.votes.add({id:c.response.id,score:a},{merge:!0})}}))},_delete:function(){return this.set({isApproved:!1,isDeleted:!0}),f.call("posts/remove.json",{data:{post:this.id},method:"POST"})},spam:function(){this.set({isApproved:!1,isDeleted:!0,isSpam:!0}),this.trigger("spam"),f.call("posts/spam.json",{data:{post:this.id},method:"POST"})},_create:function(a,b){var c=this,d=a.attributes,e={thread:d.thread,message:d.raw_message};d.parent&&(e.parent=d.parent),d.author_name&&(e.author_name=d.author_name,e.author_email=d.author_email);var g=b.uploadTokens;return g&&g.length&&(e.upload_token=g),f.call("posts/create.json",{data:e,method:"POST",success:function(a){c.set(a.response),b.success&&b.success()},error:b.error})},_update:function(a,b){var c=this,d=a.attributes,e={post:d.id,message:d.raw_message};return f.call("posts/update.json",{data:e,method:"POST",success:function(a){c.set(a.response),b.success&&b.success()},error:b.error})},_read:function(a,b){var c=this;return b=b||{},f.call("posts/details.json",{data:{post:c.id},method:"GET",success:function(a){c.set(a.response),b.success&&b.success()},error:b.error})},sync:function(a,b,c){c=c||{};var d=c.error;switch(d&&(c.error=function(a){var b={};try{b=JSON.parse(a.responseText)}catch(c){}d(b)}),a){case"create":return this._create(b,c);case"update":return this._update(b,c);case"delete":return this._delete();case"read":return this._read(b,c)}},storageKey:function(a){return this.isNew()&&this.getThreadId()?[a||"drafts","thread",this.getThreadId(),"parent",this.get("parent")||0].join(":"):void 0}},{formatMessage:function(){var a=/(?:\r\n|\r|\n){2,}/,c=/\r\n|\r|\n/;return function(d){var e=b.chain(d.split(a)).compact().value(),f=b.map(e,function(a){return b.chain(a.split(c)).compact().map(b.escape).join("
").value()}).join("

");return"

"+f+"

"}}()});return l.withCreatedAt.call(s.prototype),k.withAdvice.call(s.prototype),s.withAuthor=function(a){this.around("set",function(c,d,e,f){var g;if(null==d)return this;"object"==typeof d?(g=d,f=e):(g={},g[d]=e);var h=g.author;if(h){if(b.isString(h)||b.isNumber(h)){var i=h;h={},h[a.prototype.idAttribute||"id"]=i}this.author=new a(h),this.trigger("changeRelated:author"),delete g.author}return c.call(this,g,f)}),this.around("toJSON",function(a){var c=a.apply(this,b.rest(arguments));return this.author&&(c.author=this.author.toJSON()),c})},s.withMediaCollection=function(a){this.after("set",function(c){c&&"string"!=typeof c&&(b.isUndefined(c.media)||(this.media?this.media.reset(c.media):this.media=new a(c.media),delete c.media))}),this.around("toJSON",function(a){var c=a.apply(this,b.rest(arguments));return this.media&&(c.media=this.media.toJSON()),c})},s}),define("core/models/Thread",["underscore","backbone","loglevel","core/config/urls","core/utils","core/api","core/config","core/advice","core/UniqueModel","core/models/User"],function(a,b,c,d,e,f,g,h,i,j){"use strict";var k=b.Model,l=k.prototype,m=k.extend({defaults:{author:null,category:null,createdAt:null,forum:null,identifiers:[],ipAddress:null,isClosed:!1,isDeleted:!1,hasStreaming:!1,link:null,message:null,slug:null,title:null,userSubscription:!1,posts:0,likes:0,dislikes:0,userScore:0},initialize:function(a,b){b=b||{},this.moderators=b.moderators,this.forum=b.forum,this.on("change:userScore",function(){var a=this.get("userScore");a>0&&0===this.get("likes")&&this.set("likes",a)},this)},_vote:function(a,b){var c=a-b;return 0===c?c:(this.set("likes",this.get("likes")+c),c)},vote:function(a){var b=this,c=b._vote(a,b.get("userScore"));0!==c&&(this.set("userScore",a),f.call("threads/vote.json",{data:{thread:this.id,vote:a},method:"POST",success:function(a){a.response.id&&b.trigger("vote:success",a)}}))},fetch:function(a){var b,d=this,e=d.attributes;a=a||{},b=e.identifier?"ident:"+e.identifier:"link:"+e.url,f.call("threads/details.json",{data:{thread:b,forum:e.forum},success:function(b){d.set(b.response),a.success&&a.success()},error:function(){g.debug?d.save({},{success:a.success}):c.info("Couldn't find thread; not creating in production.")}})},_toggleState:function(a,b){b||(b={});var c=a?"open.json":"close.json";return this.set("isClosed",!a),f.call("threads/"+c,{method:"POST",data:{thread:this.id},success:b.success,error:b.error})},open:function(a){return this._toggleState(!0,a)},close:function(a){return this._toggleState(!1,a)},sync:function(){var a=this,b=a.attributes;f.call("threads/create.json",{data:{title:b.title,forum:b.forum,identifier:b.identifier,url:b.url},method:"POST",success:function(b){a.set(b.response)}})},incrementPostCount:function(a){var b=this.get("posts")+a;this.set("posts",b>0?b:0)},isModerator:function(b){var c;if(this.moderators)return c=b instanceof j||a.isObject(b)?b.id:b,c=parseInt(c,10),a(this.moderators).contains(c)},subscribe:function(a,b){a=a!==!1;var c=this.get("userSubscription");if(c!==a){a?this.set("userSubscription",b||!0):this.set("userSubscription",!1);var d=a?"subscribe.json":"unsubscribe.json",e={thread:this.id};return b?e.email=b:a||"string"!=typeof c||(e.email=c),f.call("threads/"+d,{data:e,method:"POST"})}},twitterText:function(a){var b=140-(a.length+1),c=this.get("clean_title");return c=e.niceTruncate(c,b)},permalink:function(){return this.get("url")||this.get("link")||this.currentUrl},shortLink:function(){return d.shortener+"/t/"+Number(this.id).toString(36)},toJSON:function(){var a=l.toJSON.call(this);return a.permalink=this.permalink(),a.shortLink=this.shortLink(),a},getDiscussionRoute:function(a){var b=["","home","discussion",this.forum.id,this.get("slug"),""];return a=a||this.forum.channel,a&&(a=a.attributes||a,b.splice(2,0,"channel",a.slug)),b.join("/")}});return h.withAdvice.call(m.prototype),m.withThreadVoteCollection=function(a){this.after("initialize",function(){this.votes=new a,this.on("vote:success",function(a){this.votes.get(a.response.id)||this.votes.add({id:a.response.id,score:a.response.vote,currentUser:!0})},this)})},m.withPostCollection=function(b){this.after("initialize",function(c){c=c||{},this.posts=new b(c.posts,{thread:this,cursor:c.postCursor,order:c.order,perPage:this.postsPerPage}),this.listenTo(this.posts,"add reset",function(b){b=b.models?b.models:[b],this.users&&a.each(b,function(a){this.users.get(a.author.id)||this.users.add(a.author)}),this.recalculatePostCount()}),this.listenTo(this.posts,"change:isDeleted change:isFlagged",function(a,b){b&&this.incrementPostCount(-1)})}),this.recalculatePostCount=function(){var a=this.get("posts");a>50||(a=this.posts.reduce(function(a,b){return b.isPublic()?a+1:a},0),this.set("posts",a))}},i.addType("Thread",m),m}),define("core/models/Forum",["backbone","core/UniqueModel","core/api"],function(a,b,c){"use strict";var d=a.Model.extend({defaults:{settings:{},followUrl:"forums/follow",unfollowUrl:"forums/unfollow",isFollowing:!1},initialize:function(a,b){b&&b.channel&&(this.channel=b.channel)},_changeFollowingState:function(a){return c.call(a,{method:"POST",data:{target:this.get("id")}})},follow:function(){return this.set("isFollowing",!0),this._changeFollowingState(this.get("followUrl"))},unfollow:function(){return this.set("isFollowing",!1),this._changeFollowingState(this.get("unfollowUrl"))},toggleFollowed:function(){if(this.channel&&this.channel.get("options").isCurationOnlyChannel)return this.channel.toggleFollowed();var a=this.get("isFollowing")?this.unfollow():this.follow();return this.trigger("toggled:isFollowing"),a}});return b.addType("Forum",d),d}),define("core/models/Media",["underscore","backbone","core/api","core/UniqueModel"],function(a,b,c,d){"use strict";var e=b.Model.extend({idAttribute:"url",defaults:{mediaType:null,html:"",htmlWidth:null,htmlHeight:null,thumbnailUrl:"",thumbnailWidth:null,thumbnailHeight:null,url:"",resolvedUrl:"",title:"",description:"",providerName:""},parse:function(a){return a.response},sync:function(b,d,e){if("read"!==b)throw new Error('Media models do not support methods other than "read".');return c.call("media/details.json",a.extend({method:"POST",data:{url:this.get("url")}},e))}},{MEDIA_TYPES:{IMAGE:"1",IMAGE_UPLOAD:"2",YOUTUBE_VIDEO:"3",WEBPAGE:"4",TWITTER_STATUS:"5",FACEBOOK_PAGE:"6",FACEBOOK_POST:"7",FACEBOOK_PHOTO:"8",FACEBOOK_VIDEO:"9",SOUNDCLOUD_SOUND:"10",GOOGLE_MAP:"11",VIMEO_VIDEO:"12",VINE_VIDEO:"14"},WEBPAGE_TYPES:["4","6","7"]});return d.addType("Media",e),e}),define("core/collections/MediaCollection",["backbone","core/models/Media"],function(a,b){"use strict";var c=a.Collection.extend({model:b});return c}),define("common/utils",["jquery","underscore","loglevel","common/urls","core/utils/cookies"],function(a,b,c,d,e){"use strict";var f=window.document,g={};g.globalUniqueId=function(a){return b.uniqueId(a)+"_"+Number(new Date)},g.addStylesheetRules=function(a){function c(){var e=b.find(f.styleSheets,function(a){var b=a.ownerNode||a.owningElement;return b.id===d});if(!e)return void setTimeout(c,50);for(var g=0,h=a.length;h>g;g++){var i=1,j=a[g],k=j[0],l="";"[object Array]"===Object.prototype.toString.call(j[1][0])&&(j=j[1],i=0);for(var m=j.length;m>i;i++){var n=j[i];l+=n[0]+":"+n[1]+(n[2]?" !important":"")+";\n"}e.insertRule?e.insertRule(k+"{"+l+"}",e.cssRules.length):e.addRule(k,l,-1)}}var d="css_"+(new Date).getTime(),e=f.createElement("style");e.id=d,f.getElementsByTagName("head")[0].appendChild(e),window.createPopup||e.appendChild(f.createTextNode("")),c()};var h=g.CORS={handler:function(a,b,c){a&&c>=200&&300>c?a():b&&(200>c||c>=300)&&b()},XHR2:function(a,b,c,d){var e=h.handler,f=new XMLHttpRequest;return f.open(a,b,!0),f.onreadystatechange=function(){f.readyState===XMLHttpRequest.DONE&&e(c,d,f.status)},f},XDR:function(a,c,d,e){if("GET"!==a&&"POST"!==a)return null;var f=h.handler,g=new XDomainRequest;return g.open(a,c),g.onload=b.bind(f,window,d,e,200),g.ontimeout=g.onerror=b.bind(f,window,d,e,500),g}};h.request=function(){return"withCredentials"in new XMLHttpRequest?h.XHR2:window.XDomainRequest?h.XDR:function(){return null}}(),g.isWindowClosed=function(a){if(!a)return!0;try{return a.closed||void 0===a.closed}catch(b){return!0}},g.truncate=function(a,b,c){return c=c||"...",a.length>b?a.slice(0,b)+c:a},g.extractDomainForCookies=function(a){return a.split("/")[2].replace(/:[0-9]+/,"")},g.cookies={domain:g.extractDomainForCookies(d.root),create:function(a,b){var c=31536e6;e.create(a,b,{domain:g.cookies.domain,expiresIn:c})},read:e.read,erase:function(a){e.erase(a,{domain:g.cookies.domain})}},g.updateURL=function(a,c){var d,e=f.createElement("a");return c=c||{},e.href=a,c.hostname&&c.hostname.match(/\.$/)&&(c.hostname+=e.hostname),d=b.extend({protocol:e.protocol,hostname:e.hostname,pathname:e.pathname,search:e.search},c),d.pathname.match(/^\//)||(d.pathname="/"+d.pathname),d.protocol+"//"+d.hostname+d.pathname+d.search},g.injectBaseElement=function(a,b){b=b||f;var c=b.getElementsByTagName("base")[0]||b.createElement("base");c.target="_parent",a?c.href=a:c.removeAttribute("href"),c.parentNode||(b.head||b.getElementsByTagName("head")[0]).appendChild(c)},g.syntaxHighlighter=function(){function c(){this.state=null,this.queue=[]}var d=1,e=2;return b.extend(c.prototype,{highlight:function(a){null===this.state&&this._load(),this.queue.push(a),this.state===e&&this.scheduleHighlight()},_highlight:function(b){var c=a(b).html();a(b).html(c.replace(/^
/,"")),this._hljs.highlightBlock(b),this.scheduleHighlight()},scheduleHighlight:function(){var a=this.queue.shift();a&&window.requestAnimationFrame(b.bind(this._highlight,this,a))},_load:function(){var a=this;a.state=d,require(["highlight"],function(b){a.state=e,a._hljs=b,a.scheduleHighlight()})}}),new c}();var i=a("html");g.getPageHeight=function(){return i.height()},g.calculatePositionFullscreen=function(){return{pageOffset:a(window).scrollTop(),height:f.documentElement.clientHeight,frameOffset:{left:0,top:0}}},g.clickShouldBeLogged=function(){var a={},c=/#.*/,d=function(a){var c=a.attr("data-tid");return c||(c=b.uniqueId(),a.attr("data-tid",c)),c};return function(b,e){if(b.isDefaultPrevented())return!1;if(!e.is("a"))return!1;var f=(e.attr("href")||"").replace(c,"");if(!f)return!1;var g=d(e),h=(new Date).getTime();return a[g]&&h-a[g]<500?void 0:(a[g]=h,!0)}}(),g.willOpenNewWindow=function(b,c){return c||(c=a(b.currentTarget)),"_blank"===c.attr("target")||b.ctrlKey||b.metaKey||b.shiftKey||b.altKey},g.triggerClick=function(a,b){var c,d,e=a[0],g={altKey:!1,button:0,ctrlKey:!1,metaKey:!1,shiftKey:!1};if(f.createEvent){if(c=f.createEvent("MouseEvents"),b)for(d in g)g.hasOwnProperty(d)&&b.hasOwnProperty(d)&&(g[d]=b[d]);c.initMouseEvent("click",!0,!0,window,0,0,0,0,0,g.ctrlKey,g.altKey,g.shiftKey,g.metaKey,0,null),e.dispatchEvent&&e.dispatchEvent(c)}else if(f.createEventObject){if(c=f.createEventObject(),c.eventType="click",b)for(d in g)g.hasOwnProperty(d)&&b.hasOwnProperty(d)&&(c[d]=b[d]);e.fireEvent("onclick",c)}},g.delayLinkClick=function(a,c){a.preventDefault(),b.delay(b.bind(g.triggerClick,this,c,a.originalEvent),100)},g.mixin=function(a,c,d){var e=a.prototype,f=b.extend({},c,d);if(b.defaults(e,f),b.defaults(e.events,f.events),void 0!==e.initialize&&void 0!==f.initialize){var g=e.initialize;e.initialize=function(){var a=g.apply(this,arguments);return f.initialize.apply(this,arguments),a}}return a},g.extractService=function(b,c){var d="[data-action^="+c+"]",e=a(b);e=e.is(d)&&e||e.closest(d);var f=e.attr("data-action")||":",g=f.split(":")[1];return g},g.getConfigFromHash=function(a){var d,e=a.location.hash;try{d=JSON.parse(decodeURIComponent(String(e).substr(1)))}catch(f){c.debug("Failed to parse config from URL hash",f)}return b.isObject(d)?d:{}};var j=/[<>]|:\/\//;return g.isPlainText=function(a){return!a.match(j)},g.isDNTEnabled=function(a){return a||(a=window),"1"===a.navigator.doNotTrack||"yes"===a.navigator.doNotTrack||"1"===a.navigator.msDoNotTrack},g.shouldSample=function(a){var b=parseInt(a,10);return b?b>100?!1:Math.random()50||(a=this.posts.buffer.reduce(function(a,b){return b.isPublic()?a+1:a},0),this.set("posts",a))},toJSON:function(){var a=this.get("forum"),b=c.isObject(a)?a.id:a;return c.extend(j.prototype.toJSON.apply(this,arguments),{homeUrl:r.apps.home+"home/discussions/"+b+"/"+this.get("slug")+"/"})}});j.withThreadVoteCollection.call(t.prototype,d.Collection);var u=t.extend({defaults:c.extend({postsInInterval:0,posts:0,topPost:null},t.prototype.defaults)}),v=i.extend({initialize:function(){i.prototype.initialize.apply(this,arguments);var b=a("common/collections");this.usersTyping=new b.TypingUserCollection},isAuthorSessionUser:function(a){return a.user.id&&this.author&&this.author.id?this.author.id===a.user.id:!1},canBeEdited:function(a,b){return!b.get("isClosed")&&!this.get("isDeleted")&&a.isLoggedIn()&&this.isAuthorSessionUser(a)&&this.get("raw_message")&&!this.get("isHighlighted")&&!this.get("isSponsored")},canBeRepliedTo:function(a,b){return!b.get("isClosed")&&a.get("canReply")&&!this.get("isDeleted")&&(this.get("isApproved")||b.isModerator(a.user))},canBeShared:function(){return!this.get("isDeleted")&&!this.get("isSponsored")},getParent:function(){var a=this.get("parent");if(a)return new g(v,{id:String(a)})}},{fetchContext:function(a,d,e){e=e||{};var h=b.Deferred();return f.call("posts/getContext.json",{method:"GET",data:{post:a},success:function(a){var b=c.filter(a.response,function(a){return a.thread===d.get("id")});return b?(c.each(b,function(a){a=new g(v,a),e.requestedByPermalink&&(a.requestedByPermalink=!0),d.posts.add(a)}),void h.resolve(b)):void h.reject()}}),h.promise()}});i.withAuthor.call(v.prototype,g.wrap(h)),i.withMediaCollection.call(v.prototype,l),g.addType("Post",v);var w=d.Model.extend({defaults:{user:null,message:null,parentId:null,immedReply:!1,createdAt:void 0},getVisibleParent:function(a){for(var b,c=this;c.get("parentId");){if(b=a.posts.get(c.get("parentId")))return b;if(c=a.queue.get(c.get("parentId")),!c)return null}return null},toPost:function(a){var b=this,c=a.posts.get(b.get("parentId")),d=c?c.get("depth")+1:0,e=new g(v,{id:b.id,thread:a.id,message:b.get("message"),parent:b.get("parentId"),depth:d,createdAt:b.get("createdAt"),isRealtime:!0,media:b.get("media"),isImmediateReply:b.get("immedReply")});return e.author=b.get("user"),e}}),x=d.Model.extend({defaults:{user:null,post:null,thread:null,client_context:null,typing:!0},idAttribute:"client_context",set:function(){return this.lastModified=new Date,d.Model.prototype.set.apply(this,arguments)},sync:function(){var a=this.toJSON(),b=m(q.realertime+"/api/typing",a);try{o.CORS.request("GET",b).send()}catch(c){}}},{make:function(a){return a.client_context||(a.client_context=n.generate()),new g(x,a)}});g.addType("TypingUser",x),c.extend(h.prototype,{getFollowing:function(){var b=a("common/collections/profile");return this.following||(this.following=new b.FollowingCollection(null,{user:this}))}}),g.addType("User",h);var y=h.extend({defaults:c.extend({numPosts:0},h.prototype.defaults)}),z=e.sessionstorage?"sessionStorage":null,A=d.UniqueModel(h,"User",z),B=d.UniqueModel(y,"User",z),C=d.Model.extend({});return{Forum:s,Thread:t,TopThread:u,Post:v,QueuedPost:w,TypingUser:x,User:h,TopUser:y,Switch:C,SyncedUser:A,SyncedTopUser:B}}),define("common/Session",["jquery","underscore","core/api","core/bus","core/config","core/models/Session","core/UniqueModel","core/utils/url/serialize","core/WindowBus","common/collections/LoggedOutCache","common/models","common/urls","common/utils"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";var n,o=new i,p=f.extend({_defaults:{canReply:!0,canModerate:!1,audienceSyncVerified:!1,sso:null},defaults:function(){var a=new j.Collection(j.LOGGED_OUT_NOTES,{session:this});return b.extend(this._defaults,{notificationCount:a.getUnread().length})},start:function(a){this.set(a),this.listenTo(o,"auth:success",this.fetch),this.listenTo(d.frame,{"!auth:success":function(a){a&&(a.sessionId&&c.headers({"X-Sessionid":a.sessionId}),a.message&&this.trigger("alert",a.message,{type:"info"}),a.logEvent&&d.trigger("uiAction:"+a.logEvent)),o.broadcast("auth:success"),this.fetch()}}),this.bindAudienceSyncHandlers()},stop:function(){this.stopListening(),this.off()},shouldFetchSession:function(){return Boolean(this.get("remoteAuthS3")||this.fromCookie().id)},getUserInstance:function(a){return new g(k.User,a)},toJSON:function(){var a=this.user.toJSON.apply(this.user,arguments);return a.thread.canReply=this.get("canReply"),a.thread.canModerate||(a.thread.canModerate=this.get("canModerate")),a},fetch:function(){var a=this.has("thread")?this.fetchThreadDetails(this.get("thread")):f.prototype.fetch.apply(this,arguments),b=this;return a.done(function(){b.set("notificationCount",0)}),a},fetchNotificationCount:function(){var b=this;return b.isLoggedIn()?c.call("timelines/getUnreadCount.json",{data:{type:"notifications",routingVersion:e.feedApiVersion}}).done(function(a){b.set("notificationCount",a.response)}):a.Deferred().resolve()},fetchThreadDetails:function(a){var d=this;d._request&&(d._request.abort(),d._request=null);var e={thread:a.id,post:a.posts.pluck("id")};return e["_"+(new Date).getTime()]=1,d._request=c.call("embed/threadDetails.json",{data:e,success:function(c){var e=c.response,f={};e.user&&b.extend(f,e.user,{votes:e.votes}),d.set(e.session),f.id?(d.setUser(new g(k.User,f)),a.users.add(d.user),e.thread&&(a.set("userScore",e.thread.userScore),a.set("userSubscription",e.thread.userSubscription))):d.setUser(d.getAnonUserInstance());var h=e.blockedUsers;h&&(b.isArray(h)||(h=b.keys(h)),b.each(h,function(a){new g(k.User,{id:a}).set({isBlocked:!0})}))},complete:function(){d._request=null}}),d._request},logout:function(){var a=this.get("sso");this.isSSO()&&a&&a.logout?d.frame.sendHostMessage("navigate",a.logout):this.locationReplace(h(l.logout,{redirect:window.location.href}))},locationReplace:function(a){window.location.replace(a)},isSSO:function(){return this.user&&"sso"===this.user.get("user_type")},getAuthWindowArgs:function(a){var c=f.prototype.getAuthWindowArgs.call(this,a);return b.defaults({forum:this.get("thread")&&this.get("thread").forum.id},c)},authServices:b.defaults({disqusDotcom:{url:l.dotcomLogin,width:478,height:590,params:{next:l.login+("https:"===window.location.protocol?"?redirect_secure=1":"")}},sso:function(){var a=this.get("sso"),c=parseInt(a.width||"800",10),e=parseInt(a.height||"500",10),f=this.openAuthWindow(a.url,c,e);!function g(){m.isWindowClosed(f)?d.frame.sendHostMessage("reload"):b.delay(g,500)}()}},f.prototype.authServices),bindAudienceSyncHandlers:function(){this.listenTo(this,"change:id change:audienceSyncVerified",function(){this.get("audienceSyncVerified")&&d.frame.sendHostMessage("session.identify",this.user.id)}),this.listenTo(d.frame,{"!audiencesync:grant":function(){this.set("audienceSyncVerified",!0)}})},getAudienceSyncUrl:function(){var a={client_id:this.get("apiKey"),response_type:"audiencesync",forum_id:this.get("thread").forum.id};return"https:"===window.location.protocol&&(a.ssl=1),h(l.authorize,a)},audienceSync:function(){this.openAuthWindow(this.getAudienceSyncUrl(),460,355)},needsAudienceSyncAuth:function(a){return a.get("settings").audienceSyncEnabled&&this.isLoggedIn()&&!this.get("audienceSyncVerified")},getLoggedOutUserFlags:function(){return this._loggedOutUserFlags?this._loggedOutUserFlags:(this._loggedOutUserFlags=new j.Collection(j.LOGGED_OUT_FLAGS,{session:this}),this._loggedOutUserFlags)}});return{get:function(){return n=n||new p},setDefaults:function(a){if(n)throw new Error("Session defaults cannot be changed after a session instance is created!");return p._defaults=b.extend(p.prototype._defaults,a),p._defaults},forget:function(){n&&(n.stop(),n=null)}}}),define("common/analytics/google",["require","common/keys","common/defines"],function(a,b,c){"use strict";var d,e=function(a){d=a},f=function(a){d?d(a):window._gaq.push(a)},g=function(){var d="";if(!c.debug||d){l(b.googleAnalytics),m(".disqus.com");var e=function(){};a([d?"ga-debug":"ga"],e,e)}},h={component:1,"package":2,forum:3,version:4,userType:5},i=function(a,b){f(["_setCustomVar",h[a],a,b])},j=function(){f(["_trackPageview"])},k=function(a,b,c){f(["_trackEvent",b,a,c,1])},l=function(a){f(["_setAccount",a])},m=function(a){f(["_setDomainName",a])};return window._gaq||(window._gaq=[]),g(),{setCaller:e,setAccount:l,setCustomVar:i,trackPageview:j,trackEvent:k,setDomainName:m}}),define("core/models/Channel",["underscore","backbone","core/UniqueModel","core/api","core/models/Forum","core/strings"],function(a,b,c,d,e,f){"use strict";var g=f.get,h=b.Model.extend({defaults:{primaryForum:{},slug:null,name:null,options:{},followUrl:"channels/follow",unfollowUrl:"channels/unfollow"},idAttribute:"slug",initialize:function(a,b){this.buildPrimaryForum(b),this.listenTo(this,"change:primaryForum",this.updatePrimaryForum),this.listenTo(this,"change:primaryCategory",this.updatePrimaryCategory)},buildPrimaryForum:function(){if(!this.primaryForum){var a=this.get("primaryForum");a&&(this.primaryForum=new c(e,a,{channel:this}),this.unset("primaryForum"))}},updatePrimaryForum:function(){var a=this.get("primaryForum");a&&(this.primaryForum||this.buildPrimaryForum(),this.primaryForum.set(a),this.unset("primaryForum"))},updatePrimaryCategory:function(){var a=this.get("primaryCategory"),b=this.primaryCategory;null===a?this.primaryCategory=void 0:b?b.set(a):this.primaryCategory=new c(h,a),this.unset("primaryCategory"),this.trigger("changeRelated:primaryCategory")},fetch:function(c){return c=c?a.clone(c):{},c.data=this.buildFetchData(c.data),b.Model.prototype.fetch.call(this,c)},buildFetchData:function(b){var c=b?a.clone(b):{};return this.id&&(c.channel=this.id),c},url:function(a){return d.getURL(this.constructor.URLS[a]||this.constructor.URLS.read)},sync:function(c,d,e){var f=d.attributes;e=a.extend({url:this.url(c),emulateHTTP:!0},e);var g={bannerColor:f.bannerColor,description:f.description,primaryCategory:d.primaryCategory&&d.primaryCategory.get("slug")||""};switch("default"===e.avatarType?g.avatar="":f.avatar&&!a.isString(f.avatar)&&(g.avatar=f.avatar),"file"!==e.bannerType?g.banner="":f.banner&&!a.isString(f.banner)&&(g.banner=f.banner),c){case"create":e.processData=!1,e.contentType=!1,g.name=f.name,e.data=this.toFormData(a.extend({},g,e.data));break;case"update":e.processData=!1,e.contentType=!1,g.channel=f.slug,e.data=this.toFormData(a.extend({},g,e.data))}return b.sync(c,d,e)},toFormData:function(b){return a.reduce(b,function(b,c,d){return b.append(d,a.isString(c)?c.trim():c),b},new window.FormData)},parse:function(a){return a.response||a},shouldFetch:function(){return!this.get("name")||!this.get("dateAdded")},ensureFetched:function(){this.shouldFetch()&&this.fetch()},validate:function(b){var c=[],d=b.name.trim();d.lengththis.constructor.MAX_NAME_LENGTH&&c.push({attrName:"name",message:f.interpolate(g("Name must have less than %(maxLength)s characters."),{maxLength:this.constructor.MAX_NAME_LENGTH})});var e=b.description.trim();return e.lengththis.constructor.MAX_DESCRIPTION_LENGTH&&c.push({attrName:"description",message:f.interpolate(g("Description must have less than %(maxLength)s characters."),{maxLength:this.constructor.MAX_DESCRIPTION_LENGTH})}),this.constructor.BANNER_COLORS[b.bannerColor]||c.push({attrName:"bannerColor",message:f.interpolate(g("Banner color must be one of "+a.invoke(a.values(this.constructor.BANNER_COLORS),"toLowerCase").join(", "))+".")}),a.isEmpty(c)?void 0:c},_changeFollowingState:function(b,c){return c=c||{},c.type="POST",c.data=a.extend({target:this.get("slug")},c.data),d.call(b,c)},follow:function(a){return this.primaryForum.set("isFollowing",!0),this._changeFollowingState(this.get("followUrl"),a)},unfollow:function(a){return this.primaryForum.set("isFollowing",!1),this._changeFollowingState(this.get("unfollowUrl"),a)},toggleFollowed:function(){if(this.get("options").isCurationOnlyChannel&&this.primaryForum){var a=this.primaryForum.get("isFollowing")?this.unfollow():this.follow();return this.primaryForum.trigger("toggled:isFollowing"),a}},toJSON:function(){var c=b.Model.prototype.toJSON.call(this);return a.defaults({primaryCategory:this.primaryCategory?this.primaryCategory.toJSON():{}},c)}},{URLS:{read:"channels/details",create:"channels/create",update:"channels/update"},BANNER_COLORS:{gray:g("Gray"),blue:g("Blue"),green:g("Green"),yellow:g("Yellow"),orange:g("Orange"),red:g("Red"),purple:g("Purple")},MIN_NAME_LENGTH:3,MAX_NAME_LENGTH:100,MIN_DESCRIPTION_LENGTH:5,MAX_DESCRIPTION_LENGTH:200});return c.addType("Channel",h),h}),define("core/utils/objectExpander",["underscore","core/UniqueModel","core/models/Channel","core/models/Thread"],function(a,b,c,d){"use strict";return{Channel:c,Thread:d,parseObject:function(b,c){return a.isString(c)?b[c]:c},buildThread:function(c,d){if(d instanceof this.Thread)return d;if(d=this.parseObject(c,d),a.isString(d.author)){var e=d.author.replace("auth.User?id=","");d.author=c["auth.User?id="+e]||e}return new b(this.Thread,d,{forum:this.parseObject(c,d.forum),author:d.author})},buildChannel:function(a,c){return c instanceof this.Channel?c:(c=this.parseObject(a,c),new b(this.Channel,c))}}}),define("core/collections/PaginatedCollection",["underscore","backbone"],function(a,b){"use strict";var c=b.Collection.extend({PER_PAGE:30,initialize:function(b,c){this.cid=a.uniqueId("collection"),c=c||{},this.cursor=c.cursor||{}},ensureFetched:a.memoize(function(){return this.fetch()},function(){return this.cid}),fetch:function(c){return c=c||{},c.data=a.defaults(c.data||{},{cursor:c.cursor||"",limit:c.PER_PAGE||this.PER_PAGE}),b.Collection.prototype.fetch.call(this,c)},hasPrev:function(){return this.cursor.hasPrev},hasNext:function(){return this.cursor.hasNext},next:function(b){return this.cursor.hasNext?this.fetch(a.extend({},b,{add:!0,remove:!0,cursor:this.cursor.next})):void this.trigger("nodata")},prev:function(b){return this.cursor.hasPrev?this.fetch(a.extend({},b,{add:!0,remove:!0,cursor:this.cursor.prev})):void this.trigger("nodata")},more:function(b){function c(a){e.push(a)}var d=this;if(b=b||{},!this.cursor.hasNext)return void d.trigger("nodata");var e=[];return this.on("add",c),this.fetch(a.extend({},b,{add:!0,remove:!1,cursor:this.cursor.next,limit:this.PER_PAGE,success:function(){d.trigger("add:many",e,d,b),d.off("add",c),b.success&&b.success.apply(this,arguments)}}))},parse:function(a){return this.cursor=a.cursor||{hasNext:!1},a.response},getLength:function(){return this.length}});return c}),define("core/collections/ChannelCollection",["underscore","core/collections/PaginatedCollection","core/UniqueModel","core/api","core/models/Channel","core/utils/objectExpander"],function(a,b,c,d,e,f){"use strict";var g=b.extend({url:d.getURL("channels/list"),model:c.boundModel(e),initialize:function(a,c){b.prototype.initialize.call(this,a,c),c=c||{},this.listName=c.listName},fetch:function(c){return c=c||{},this.listName&&(c.data=a.extend({listName:this.listName},c.data)),b.prototype.fetch.call(this,c)},parse:function(c){return c=b.prototype.parse.call(this,c),c.items?a.map(c.items,function(a){return f.buildChannel(c.objects,a.reference)}):c}});return g}),define("core/models/ThreadVote",["backbone"],function(a){"use strict";var b=a.Model.extend({defaults:{score:0}});return b}),define("common/collections",["underscore","backbone","moment","core/api","core/utils/objectExpander","core/collections/UserCollection","core/collections/PaginatedCollection","core/collections/ChannelCollection","core/models/ThreadVote","core/UniqueModel","common/models","common/cached-storage"],function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";var m=b.Collection.extend({model:i}),n=g.extend({PER_PAGE:50,model:j.wrap(k.Post),url:d.getURL("threads/listPostsThreaded"),initialize:function(a,b){g.prototype.initialize.apply(this,arguments),b=b||{},this.thread=b.thread,this.setOrder(b.order)},fetch:function(b){return b=b||{},a.extend(b,{data:{limit:this.PER_PAGE,thread:this.thread.id,forum:this.thread.get("forum"),order:this.getOrder()}}),g.prototype.fetch.call(this,b)},getOrder:function(){return this.order},setOrder:function(a){this.order=a}}),o=b.Collection.extend({collection:b.Collection,initialize:function(a,b){this.thread=b.thread,this.perPage=b.perPage||20,this.buffer=new this.collection(a,b),this.resetPage(),this.listenTo(this.buffer,"reset",this.resetPage)},resetPage:function(a,c,d){return c=this.buffer.slice(0,this.perPage),b.Collection.prototype.reset.call(this,c,d)},currentPage:function(){var a=Math.floor(this.length/this.perPage);return this.length%this.perPage&&(a+=1),a},setPageFor:function(a,b){var c=this.buffer.get(a),d=this.perPage;c&&(d=this.perPage*Math.floor(this.buffer.indexOf(c)/this.perPage+1)),this.add(this.buffer.slice(0,d),b)},hasNext:function(){return this.buffer.length>this.length||this.buffer.hasNext()},more:function(a){a=a||{};var b=this,c=b.length+this.perPage,d=a.success;a.success=function(){b.add(b.buffer.slice(0,c)),d&&d()},b.buffer.length0&&null===b.gc?void(b.gc=setInterval(a.bind(b.cleanup,b),6e4)):void(0>=c&&null!==b.gc&&(clearInterval(b.gc),b.gc=null))},b)},count:function(a){var b=this.filter(function(b){return!(a&&b.id===a)&&b.get("typing")});return b.length},cleanup:function(){var a=c();this.reset(this.filter(function(b){return a.diff(b.lastModified,"minutes")<5}))}}),s=g.extend({model:j.wrap(k.Post),url:d.getURL("users/listPostActivity")}),t=g.extend({model:k.Thread,url:d.getURL("timelines/ranked"),initialize:function(a,b){b=b||{},this.type=b.type,this.target=b.target},fetch:function(b){return b=b||{},b.data=a.extend({type:this.type,target:this.target},b.data),g.prototype.fetch.call(this,b)},parse:function(b){return b=g.prototype.parse.call(this,b),a.map(b.activities,function(a){return e.buildThread(b.objects,a.items[0].object)})}}),u=b.Collection.extend({model:k.SyncedTopUser,url:d.getURL("forums/listMostActiveUsers"),initialize:function(a,b){this.forum=b.forum,this.limit=b.limit},fetch:function(c){return b.Collection.prototype.fetch.call(this,a.extend({data:{forum:this.forum,limit:this.limit}},c))},parse:function(b){return a.filter(b.response,function(a){return parseFloat(a.rep)>.7?a:void 0})}});f.prototype.model=j.wrap(k.User);var v=b.Collection.extend({model:k.SyncedUser,url:d.getURL("forums/listModerators"),initialize:function(a,b){this.forum=b.forum},fetch:function(c){return b.Collection.prototype.fetch.call(this,a.extend({data:{forum:this.forum}},c))},parse:function(b){return a.map(b.response,function(a){return a.user})}});return{PaginatedCollection:g,UserCollection:f,ChannelCollection:h,PostCollection:n,SubpaginatedPostCollection:p,TypingUserCollection:r,TopUserCollection:u,RankedThreadCollection:t,ThreadVoteCollection:m,PostActivityCollection:s,QueuedPostCollection:q,ModeratorCollection:v}}),define("common/collections/profile",["core/api","common/models","common/collections"],function(a,b,c){"use strict";var d=c.PaginatedCollection.extend({initialize:function(a,b){this.user=b.user,c.PaginatedCollection.prototype.initialize.apply(this,arguments)},fetch:function(a){return a=a||{},a.data=a.data||{},a.data.user=this.user.id,c.PaginatedCollection.prototype.fetch.call(this,a)}}),e=d.extend({model:b.SyncedUser,url:a.getURL("users/listFollowing"),PER_PAGE:20});return{SessionPaginatedCollection:d,FollowingCollection:e}}),define("common/intelligence",["underscore","common/analytics/google"],function(a,b){"use strict";function c(a){return a.has("remote")?a.get("remote").domain:a.id?"disqus":"not_logged_in"}function d(a){return a.support_preferred?"plus":a.support_priority?"pro":a.support_vip?"vip":"free"}function e(){b.trackPageview()}function f(a,c){b.setCustomVar(a,c)}function g(){this.version="next",this.forum=null,this.userType=null}return g.prototype.init=function(a){a=a||{},f("component","embed"),a.version&&(this.version=a.version),f("version",this.version),a.forum&&(this.forum=a.forum,f("forum",a.forum)),a.features&&f("package",d(a.features)),this.setSession(a.session||"not_logged_in"),e()},g.prototype.setSession=function(b){var d=a.isString(b)?b:c(b);d!==this.userType&&(this.userType=d,f("userType",d))},g.prototype.trackEvent=function(a){b.trackEvent(a,this.version,this.forum)},{Intelligence:g,setCustomVar:f,trackPageview:e,getUserType:c,getPackageType:d}}),define("common/outboundlinkhandler",["jquery","underscore","common/utils"],function(a,b,c){"use strict";function d(){this.handlers=[],this.locked={},this.timeout=1e3}return b.extend(d.prototype,{handleClick:function(d){var e=a(d.currentTarget),f=this.getLinkTrackingId(e);if(this.shouldHandleClick(d,e,f)){var g=b.chain(this.handlers).map(function(a){return a[0].call(a[1],d,e)}).compact().value();c.willOpenNewWindow(d,e)||(d.preventDefault(),this.setLatestClick(f),this.delayNavigation(d,e,g))}},delayNavigation:function(d,e,f){this.lockLink(this.getLinkTrackingId(e));var g=b.bind(function(){this.isLatestClick(this.getLinkTrackingId(e))&&c.triggerClick(e,d.originalEvent)},this);b.delay(g,this.timeout),a.when.apply(a,f).always(g)},registerBeforeNavigationHandler:function(a,b){this.handlers.push([a,b])},getLinkTrackingId:function(a){var c=a.attr("data-tid");return c||(c=b.uniqueId(),a.attr("data-tid",c)),c},shouldHandleClick:function(a,b){if(!this.isLinkLocked(this.getLinkTrackingId(b))){if(a.isDefaultPrevented())return!1;if(!b.is("a"))return!1;var c=/#.*/,d=(b.attr("href")||"").replace(c,"");return d?!0:!1}},setLatestClick:function(a){this.latestLinkId=a},isLatestClick:function(a){return this.latestLinkId===a},lockLink:function(a){this.locked[a]=!0},isLinkLocked:function(a){return this.locked[a]}}),d}),define("common/views/mixins",["jquery","underscore","core/bus","common/Session"],function(a,b,c,d){"use strict";function e(){this._getStyleProperty=function(a){var b=this.forum.get("settings");return this.config.forceAutoStyles||"auto"===b[a]?this.config[a]:b[a]},this.getTypeface=function(){return this._getStyleProperty("typeface")},this.getColorScheme=function(){return this._getStyleProperty("colorScheme")},this.applyPublisherClasses=function(){var b=a("body");"serif"===this.getTypeface()&&b.addClass("serif"),"dark"===this.getColorScheme()&&b.addClass("dark")}}var f={proxyViewEvents:function(a){this.listenTo(a,"all",function(a){0===a.indexOf("uiAction:")&&this.trigger.apply(this,arguments)},this)}},g={updateUserAvatarHelper:function(b,c){a("img[data-user="+b+'][data-role="user-avatar"]').attr("src",c)},updateUserNameHelper:function(c,d){var e='[data-username="'+c+'"][data-role=username]';a("a"+e+", span"+e).html(b.escape(d))},bindProfileUIListeners:function(a){this.listenTo(a,{"change:avatar":function(){this.updateUserAvatarHelper(a.user.id,a.user.get("avatar").cache)},"change:name":function(){this.updateUserNameHelper(a.user.get("username"),a.user.get("name"))}})}},h={toggleFollow:function(b){b.preventDefault(),b.stopPropagation();var c=b&&a(b.target).closest("a[data-user]").attr("data-user"),e=this.collection&&c?this.collection.get(c):this.user,f=d.get();return f.isLoggedOut()?(this.trigger("authenticating"),this.listenToOnce(f,"change:id",function(){f.isLoggedIn()&&this.follow(e)}),void f.authenticate("disqusDotcom")):void(e.get("isFollowing")?this.unfollow(e):this.follow(e))},unfollow:function(a){a.unfollow(),c.trigger("uiAction:unfollowUser",a)},follow:function(a){a.follow(),c.trigger("uiAction:followUser",a)}};return{FollowButtonMixin:h,UiActionEventProxy:f,appliesPublisherClasses:e,ProfileHtmlHelpers:g}}),define("core/utils/isIframed",[],function(){"use strict";return function(a){try{return a.self!==a.top}catch(b){return!0}}}),define("common/views/popup",["jquery","underscore","backbone","core/bus","core/utils","core/utils/isIframed","common/utils","common/Session"],function(a,b,c,d,e,f,g,h){"use strict";var i=c.View.extend({el:window.document.body,events:{"click .overlay":"handleClick",keydown:"handleKeyPress","click [data-action=close]":"close"},initialize:function(){this.user=null,this.session=h.get(),this.fullscreen=!0,this.$overlay=this.$el.find(".overlay");var a=this;if(f(window))this.listenTo(d.frame,"init",this.bootstrap),this.listenTo(d.frame,"open",this._open);else{var b=g.getConfigFromHash(window);a.bootstrap(b),a.load(b)}},handleClick:function(b){a(b.target).closest(this.containerId).length||this.close()},handleKeyPress:function(a){return 27===a.which?(a.preventDefault(),a.stopPropagation(),void this.close()):void 0},open:function(){f(window)?d.frame.sendHostMessage("openReady"):this._open()},_open:function(){this.trigger("open"),this.$overlay.addClass("active"),window.focus()},close:function(){var a=this;if(a.fullscreen){a.$overlay.removeClass("active");var c=e.transitionEndEvent;c?a.$overlay.one(c,function(){a._closeWindow()}):b.defer(b.bind(a._closeWindow,a))}},_closeWindow:function(){f(window)?d.frame.sendHostMessage("close"):window.close()},bootstrap:a.noop,load:a.noop});return{PopupManager:i}}),function(a){"use strict";a("when",[],function(){function a(a,c,d,e){return b(a).then(c,d,e)}function b(a){var b,c;return a instanceof d?b=a:h(a)?(c=g(),a.then(function(a){c.resolve(a)},function(a){c.reject(a)},function(a){c.progress(a)}),b=c.promise):b=e(a),b}function c(b){return a(b,f)}function d(a){this.then=a}function e(a){var c=new d(function(c){try{return b(c?c(a):a)}catch(d){return f(d)}});return c}function f(a){var c=new d(function(c,d){try{return d?b(d(a)):f(a)}catch(e){return f(e)}});return c}function g(){function a(a,b,c){return m(a,b,c)}function c(a){return o(a)}function e(a){return o(f(a))}function h(a){return n(a)}var i,j,k,l,m,n,o;return j=new d(a),i={then:a,resolve:c,reject:e,progress:h,promise:j,resolver:{resolve:c,reject:e,progress:h}},k=[],l=[],m=function(a,b,c){var d,e;return d=g(),e="function"==typeof c?function(a){try{d.progress(c(a))}catch(b){d.progress(b)}}:function(a){d.progress(a)},k.push(function(c){c.then(a,b).then(d.resolve,d.reject,e)}),l.push(e),d.promise},n=function(a){return p(l,a),a},o=function(a){return a=b(a),m=a.then,o=b,n=r,p(k,a),l=k=v,a},i}function h(a){return a&&"function"==typeof a.then}function i(b,c,d,e,f){return q(2,arguments),a(b,function(b){function h(a){p(a)}function i(a){o(a)}var j,k,l,m,n,o,p,q,s,t;if(s=b.length>>>0,j=Math.max(0,Math.min(c,s)),l=[],k=s-j+1,m=[],n=g(),j)for(q=n.progress,p=function(a){m.push(a),--k||(o=p=r,n.reject(m))},o=function(a){l.push(a),--j||(o=p=r,n.resolve(l))},t=0;s>t;++t)t in b&&a(b[t],i,h,q);else n.resolve(l);return n.then(d,e,f)})}function j(a,b,c,d){function e(a){return b?b(a[0]):a[0]}return i(a,1,e,c,d)}function k(a,b,c,d){return q(1,arguments),m(a,s).then(b,c,d)}function l(){return m(arguments,s)}function m(b,c){return a(b,function(b){var d,e,f,h,i,j;if(f=e=b.length>>>0,d=[],j=g(),f)for(h=function(b,e){a(b,c).then(function(a){d[e]=a,--f||j.resolve(d)},j.reject)},i=0;e>i;i++)i in b?h(b[i],i):--f;else j.resolve(d);return j.promise})}function n(b,c){var d=u.call(arguments,1);return a(b,function(b){var e;return e=b.length,d[0]=function(b,d,f){return a(b,function(b){return a(d,function(a){return c(b,a,f,e)})})},t.apply(b,d)})}function o(b,c,d){var e=arguments.length>2;return a(b,function(a){ return a=e?d:a,c.resolve(a),a},function(a){return c.reject(a),f(a)},c.progress)}function p(a,b){for(var c,d=0;c=a[d++];)c(b)}function q(a,b){for(var c,d=b.length;d>a;)if(c=b[--d],null!=c&&"function"!=typeof c)throw new Error("arg "+d+" must be a function")}function r(){}function s(a){return a}var t,u,v;return a.defer=g,a.resolve=b,a.reject=c,a.join=l,a.all=k,a.map=m,a.reduce=n,a.any=j,a.some=i,a.chain=o,a.isPromise=h,d.prototype={always:function(a,b){return this.then(a,a,b)},otherwise:function(a){return this.then(v,a)},spread:function(a){return this.then(function(b){return k(b,function(b){return a.apply(v,b)})})}},u=[].slice,t=[].reduce||function(a){var b,c,d,e,f;if(f=0,b=Object(this),e=b.length>>>0,c=arguments,c.length<=1)for(;;){if(f in b){d=b[f++];break}if(++f>=e)throw new TypeError}else d=c[1];for(;e>f;++f)f in b&&(d=a(d,b[f],f,b));return d},a})}("function"==typeof define&&define.amd?define:function(a){"object"==typeof exports?module.exports=a():this.when=a()}),function(a,b){"use strict";function c(a,b){var c,d;b=b||{},a="raven"+a.substr(0,1).toUpperCase()+a.substr(1),document.createEvent?(c=document.createEvent("HTMLEvents"),c.initEvent(a,!0,!0)):(c=document.createEventObject(),c.eventType=a);for(d in b)l(b,d)&&(c[d]=b[d]);if(document.createEvent)document.dispatchEvent(c);else try{document.fireEvent("on"+c.eventType.toLowerCase(),c)}catch(e){}}function d(a){this.name="RavenConfigError",this.message=a}function e(a){var b=Y.exec(a),c={},e=7;try{for(;e--;)c[X[e]]=b[e]||""}catch(f){throw new d("Invalid DSN: "+a)}if(c.pass)throw new d("Do not specify your private key in the DSN!");return c}function f(a){return void 0===a}function g(a){return"function"==typeof a}function h(a){return"[object String]"===R.toString.call(a)}function i(a){return"object"==typeof a&&null!==a}function j(a){for(var b in a)return!1;return!0}function k(a){return i(a)&&"[object Error]"===R.toString.call(a)||a instanceof Error}function l(a,b){return R.hasOwnProperty.call(a,b)}function m(a,b){var c,d;if(f(a.length))for(c in a)l(a,c)&&b.call(null,c,a[c]);else if(d=a.length)for(c=0;d>c;c++)b.call(null,c,a[c])}function n(a,b){var d=[];a.stack&&a.stack.length&&m(a.stack,function(a,b){var c=o(b);c&&d.push(c)}),c("handle",{stackInfo:a,options:b}),q(a.name,a.message,a.url,a.lineno,d,b)}function o(a){if(a.url){var b,c={filename:a.url,lineno:a.line,colno:a.column,"function":a.func||"?"},d=p(a);if(d){var e=["pre_context","context_line","post_context"];for(b=3;b--;)c[e[b]]=d[b]}return c.in_app=!(P.includePaths.test&&!P.includePaths.test(c.filename)||/(Raven|TraceKit)\./.test(c["function"])||/raven\.(min\.)?js$/.test(c.filename)),c}}function p(a){if(a.context&&P.fetchContext){for(var b=a.context,c=~~(b.length/2),d=b.length,e=!1;d--;)if(b[d].length>300){e=!0;break}if(e){if(f(a.column))return;return[[],b[c].substr(a.column,50),[]]}return[b.slice(0,c),b[c],b.slice(c+1)]}}function q(a,b,c,d,e,f){var g,h;P.ignoreErrors.test&&P.ignoreErrors.test(b)||(b+="",b=s(b,P.maxMessageLength),h=a+": "+b,h=s(h,P.maxMessageLength),e&&e.length?(c=e[0].filename||c,e.reverse(),g={frames:e}):c&&(g={frames:[{filename:c,lineno:d,in_app:!0}]}),P.ignoreUrls.test&&P.ignoreUrls.test(c)||(!P.whitelistUrls.test||P.whitelistUrls.test(c))&&v(r({exception:{type:a,value:b},stacktrace:g,culprit:c,message:h},f)))}function r(a,b){return b?(m(b,function(b,c){a[b]=c}),a):a}function s(a,b){return a.length<=b?a:a.substr(0,b)+"…"}function t(){return+new Date}function u(){if(document.location&&document.location.href){var a={headers:{"User-Agent":navigator.userAgent}};return a.url=document.location.href,document.referrer&&(a.headers.Referer=document.referrer),a}}function v(a){var b={project:M,logger:P.logger,platform:"javascript"},d=u();d&&(b.request=d),a=r(b,a),a.tags=r(r({},P.tags),a.tags),a.extra=r(r({},P.extra),a.extra),a.extra=r({"session:duration":t()-U},a.extra),j(a.tags)&&delete a.tags,K&&(a.user=K),P.release&&(a.release=P.release),g(P.dataCallback)&&(a=P.dataCallback(a)||a),a&&!j(a)&&(!g(P.shouldSendCallback)||P.shouldSendCallback(a))&&(I=a.event_id||(a.event_id=A()),B("debug","Raven about to send:",a),y()&&(P.transport||w)({url:J,auth:{sentry_version:"4",sentry_client:"raven-js/"+W.VERSION,sentry_key:L},data:a,options:P,onSuccess:function(){c("success",{data:a,src:J})},onError:function(){c("failure",{data:a,src:J})}}))}function w(a){a.auth.sentry_data=JSON.stringify(a.data);var b=x(),c=a.url+"?"+D(a.auth);(a.options.crossOrigin||""===a.options.crossOrigin)&&(b.crossOrigin=a.options.crossOrigin),b.onload=a.onSuccess,b.onerror=b.onabort=a.onError,b.src=c}function x(){return document.createElement("img")}function y(){return O?J?!0:(Z||B("error","Error: Raven has not been configured."),Z=!0,!1):!1}function z(a){for(var b,c=[],d=0,e=a.length;e>d;d++)b=a[d],h(b)?c.push(b.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):b&&b.source&&c.push(b.source);return new RegExp(c.join("|"),"i")}function A(){var b=a.crypto||a.msCrypto;if(!f(b)&&b.getRandomValues){var c=new Uint16Array(8);b.getRandomValues(c),c[3]=4095&c[3]|16384,c[4]=16383&c[4]|32768;var d=function(a){for(var b=a.toString(16);b.length<4;)b="0"+b;return b};return d(c[0])+d(c[1])+d(c[2])+d(c[3])+d(c[4])+d(c[5])+d(c[6])+d(c[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})}function B(a){T[a]&&W.debug&&T[a].apply(S,F.call(arguments,1))}function C(){var b=a.RavenConfig;b&&W.config(b.dsn,b.config).install()}function D(a){var b=[];return m(a,function(a,c){b.push(encodeURIComponent(a)+"="+encodeURIComponent(c))}),b.join("&")}var E={remoteFetching:!1,collectWindowErrors:!0,linesOfContext:7,debug:!1},F=[].slice,G="?";E.wrap=function(a){function b(){try{return a.apply(this,arguments)}catch(b){throw E.report(b),b}}return b},E.report=function(){function c(a){h(),o.push(a)}function d(a){for(var b=o.length-1;b>=0;--b)o[b]===a&&o.splice(b,1)}function e(){i(),o=[]}function f(a,b){var c=null;if(!b||E.collectWindowErrors){for(var d in o)if(l(o,d))try{o[d].apply(null,[a].concat(F.call(arguments,2)))}catch(e){c=e}if(c)throw c}}function g(a,b,c,d,e){var g=null;if(r)E.computeStackTrace.augmentStackTraceWithInitialElement(r,b,c,a),j();else if(e)g=E.computeStackTrace(e),f(g,!0);else{var h={url:b,line:c,column:d};h.func=E.computeStackTrace.guessFunctionName(h.url,h.line),h.context=E.computeStackTrace.gatherContext(h.url,h.line),g={message:a,url:document.location.href,stack:[h]},f(g,!0)}return m?m.apply(this,arguments):!1}function h(){n||(m=a.onerror,a.onerror=g,n=!0)}function i(){n&&(a.onerror=m,n=!1,m=b)}function j(){var a=r,b=p;p=null,r=null,q=null,f.apply(null,[a,!1].concat(b))}function k(b,c){var d=F.call(arguments,1);if(r){if(q===b)return;j()}var e=E.computeStackTrace(b);if(r=e,q=b,p=d,a.setTimeout(function(){q===b&&j()},e.incomplete?2e3:0),c!==!1)throw b}var m,n,o=[],p=null,q=null,r=null;return k.subscribe=c,k.unsubscribe=d,k.uninstall=e,k}(),E.computeStackTrace=function(){function b(b){if(!E.remoteFetching)return"";try{var c=function(){try{return new a.XMLHttpRequest}catch(b){return new a.ActiveXObject("Microsoft.XMLHTTP")}},d=c();return d.open("GET",b,!1),d.send(""),d.responseText}catch(e){return""}}function c(a){if(!h(a))return[];if(!l(t,a)){var c="",d="";try{d=document.domain}catch(e){}-1!==a.indexOf(d)&&(c=b(a)),t[a]=c?c.split("\n"):[]}return t[a]}function d(a,b){var d,e=/function ([^(]*)\(([^)]*)\)/,g=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,h="",i=10,j=c(a);if(!j.length)return G;for(var k=0;i>k;++k)if(h=j[b-k]+h,!f(h)){if(d=g.exec(h))return d[1];if(d=e.exec(h))return d[1]}return G}function e(a,b){var d=c(a);if(!d.length)return null;var e=[],g=Math.floor(E.linesOfContext/2),h=g+E.linesOfContext%2,i=Math.max(0,b-g-1),j=Math.min(d.length,b+h-1);b-=1;for(var k=i;j>k;++k)f(d[k])||e.push(d[k]);return e.length>0?e:null}function g(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function i(a){return g(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function j(a,b){for(var d,e,f=0,g=b.length;g>f;++f)if((d=c(b[f])).length&&(d=d.join("\n"),e=a.exec(d)))return{url:b[f],line:d.substring(0,e.index).split("\n").length,column:e.index-d.lastIndexOf("\n",e.index)-1};return null}function k(a,b,d){var e,f=c(b),h=new RegExp("\\b"+g(a)+"\\b");return d-=1,f&&f.length>d&&(e=h.exec(f[d]))?e.index:null}function m(b){for(var c,d,e,f,h=[a.location.href],k=document.getElementsByTagName("script"),l=""+b,m=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,n=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,o=0;o):(\d+)(?::(\d+))?\)?\s*$/i,h=/^\s*(.*?)(?:\((.*?)\))?@((?:file|https?|chrome).*?):(\d+)(?::(\d+))?\s*$/i,i=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|http|https):.*?):(\d+)(?::(\d+))?\)?\s*$/i,j=a.stack.split("\n"),l=[],m=/^(.*) is undefined$/.exec(a.message),n=0,o=j.length;o>n;++n){if(b=h.exec(j[n]))c={url:b[3],func:b[1]||G,args:b[2]?b[2].split(","):"",line:+b[4],column:b[5]?+b[5]:null};else if(b=g.exec(j[n]))c={url:b[2],func:b[1]||G,line:+b[3],column:b[4]?+b[4]:null};else{if(!(b=i.exec(j[n])))continue;c={url:b[2],func:b[1]||G,line:+b[3],column:b[4]?+b[4]:null}}!c.func&&c.line&&(c.func=d(c.url,c.line)),c.line&&(c.context=e(c.url,c.line)),l.push(c)}return l.length?(l[0].line&&!l[0].column&&m?l[0].column=k(m[1],l[0].url,l[0].line):l[0].column||f(a.columnNumber)||(l[0].column=a.columnNumber+1),{name:a.name,message:a.message,url:document.location.href,stack:l}):null}}function o(a){var b=a.stacktrace;if(!f(a.stacktrace)&&a.stacktrace){for(var c,g=/ line (\d+), column (\d+) in (?:]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,h=b.split("\n"),i=[],j=0,k=h.length;k>j;j+=2)if(c=g.exec(h[j])){var l={line:+c[1],column:+c[2],func:c[3]||c[4],args:c[5]?c[5].split(","):[],url:c[6]};if(!l.func&&l.line&&(l.func=d(l.url,l.line)),l.line)try{l.context=e(l.url,l.line)}catch(m){}l.context||(l.context=[h[j+1]]),i.push(l)}return i.length?{name:a.name,message:a.message,url:document.location.href,stack:i}:null}}function p(b){var f=b.message.split("\n");if(f.length<4)return null;var g,h,k,m,n=/^\s*Line (\d+) of linked script ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i,o=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i,p=/^\s*Line (\d+) of function script\s*$/i,q=[],r=document.getElementsByTagName("script"),s=[];for(h in r)l(r,h)&&!r[h].src&&s.push(r[h]);for(h=2,k=f.length;k>h;h+=2){var t=null;if(g=n.exec(f[h]))t={url:g[2],func:g[3],line:+g[1]};else if(g=o.exec(f[h])){t={url:g[3],func:g[4]};var u=+g[1],v=s[g[2]-1];if(v&&(m=c(t.url))){m=m.join("\n");var w=m.indexOf(v.innerText);w>=0&&(t.line=u+m.substring(0,w).split("\n").length)}}else if(g=p.exec(f[h])){var x=a.location.href.replace(/#.*$/,""),y=g[1],z=new RegExp(i(f[h+1]));m=j(z,[x]),t={url:x,line:m?m.line:y,func:""}}if(t){t.func||(t.func=d(t.url,t.line));var A=e(t.url,t.line),B=A?A[Math.floor(A.length/2)]:null;A&&B.replace(/^\s*/,"")===f[h+1].replace(/^\s*/,"")?t.context=A:t.context=[f[h+1]],q.push(t)}}return q.length?{name:b.name,message:f[0],url:document.location.href,stack:q}:null}function q(a,b,c,f){var g={url:b,line:c};if(g.url&&g.line){a.incomplete=!1,g.func||(g.func=d(g.url,g.line)),g.context||(g.context=e(g.url,g.line));var h=/ '([^']+)' /.exec(f);if(h&&(g.column=k(h[1],g.url,g.line)),a.stack.length>0&&a.stack[0].url===g.url){if(a.stack[0].line===g.line)return!1;if(!a.stack[0].line&&a.stack[0].func===g.func)return a.stack[0].line=g.line,a.stack[0].context=g.context,!1}return a.stack.unshift(g),a.partial=!0,!0}return a.incomplete=!0,!1}function r(a,b){for(var c,e,f,g=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,h=[],i={},j=!1,l=r.caller;l&&!j;l=l.caller)if(l!==s&&l!==E.report){if(e={url:null,func:G,line:null,column:null},l.name?e.func=l.name:(c=g.exec(l.toString()))&&(e.func=c[1]),"undefined"==typeof e.func)try{e.func=c.input.substring(0,c.input.indexOf("{"))}catch(n){}if(f=m(l)){e.url=f.url,e.line=f.line,e.func===G&&(e.func=d(e.url,e.line));var o=/ '([^']+)' /.exec(a.message||a.description);o&&(e.column=k(o[1],f.url,f.line))}i[""+l]?j=!0:i[""+l]=!0,h.push(e)}b&&h.splice(0,b);var p={name:a.name,message:a.message,url:document.location.href,stack:h};return q(p,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),p}function s(a,b){var c=null;b=null==b?0:+b;try{if(c=o(a))return c}catch(d){if(E.debug)throw d}try{if(c=n(a))return c}catch(d){if(E.debug)throw d}try{if(c=p(a))return c}catch(d){if(E.debug)throw d}try{if(c=r(a,b+1))return c}catch(d){if(E.debug)throw d}return{name:a.name,message:a.message,url:document.location.href}}var t={};return s.augmentStackTraceWithInitialElement=q,s.computeStackTraceFromStackProp=n,s.guessFunctionName=d,s.gatherContext=e,s}();var H,I,J,K,L,M,N=a.Raven,O=!("object"!=typeof JSON||!JSON.stringify),P={logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],crossOrigin:"anonymous",collectWindowErrors:!0,tags:{},maxMessageLength:100,extra:{}},Q=!1,R=Object.prototype,S=a.console||{},T={},U=t();for(var V in S)T[V]=S[V];var W={VERSION:"1.1.22",debug:!0,noConflict:function(){return a.Raven=N,W},config:function(a,b){if(J)return B("error","Error: Raven has already been configured"),W;if(!a)return W;var c=e(a),d=c.path.lastIndexOf("/"),f=c.path.substr(1,d);return b&&m(b,function(a,b){P[a]=b}),P.ignoreErrors.push(/^Script error\.?$/),P.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),P.ignoreErrors=z(P.ignoreErrors),P.ignoreUrls=P.ignoreUrls.length?z(P.ignoreUrls):!1,P.whitelistUrls=P.whitelistUrls.length?z(P.whitelistUrls):!1,P.includePaths=z(P.includePaths),L=c.user,M=c.path.substr(d+1),J="//"+c.host+(c.port?":"+c.port:"")+"/"+f+"api/"+M+"/store/",c.protocol&&(J=c.protocol+":"+J),P.fetchContext&&(E.remoteFetching=!0),P.linesOfContext&&(E.linesOfContext=P.linesOfContext),E.collectWindowErrors=!!P.collectWindowErrors,W},install:function(){return y()&&!Q&&(E.report.subscribe(n),Q=!0),W},context:function(a,c,d){return g(a)&&(d=c||[],c=a,a=b),W.wrap(a,c).apply(this,d)},wrap:function(a,c){function d(){for(var b=[],d=arguments.length,e=!a||a&&a.deep!==!1;d--;)b[d]=e?W.wrap(a,arguments[d]):arguments[d];try{return c.apply(this,b)}catch(f){throw W.captureException(f,a),f}}if(f(c)&&!g(a))return a;if(g(a)&&(c=a,a=b),!g(c))return c;if(c.__raven__)return c;for(var e in c)l(c,e)&&(d[e]=c[e]);return d.__raven__=!0,d.__inner__=c,d},uninstall:function(){return E.report.uninstall(),Q=!1,W},captureException:function(a,b){if(!k(a))return W.captureMessage(a,b);H=a;try{var c=E.computeStackTrace(a);n(c,b)}catch(d){if(a!==d)throw d}return W},captureMessage:function(a,b){return P.ignoreErrors.test&&P.ignoreErrors.test(a)?void 0:(v(r({message:a+""},b)),W)},setUserContext:function(a){return K=a,W},setExtraContext:function(a){return P.extra=a||{},W},setTagsContext:function(a){return P.tags=a||{},W},setReleaseContext:function(a){return P.release=a,W},setDataCallback:function(a){return P.dataCallback=a,W},setShouldSendCallback:function(a){return P.shouldSendCallback=a,W},lastException:function(){return H},lastEventId:function(){return I},isSetup:function(){return y()}};W.setUser=W.setUserContext;var X="source protocol user pass host port path".split(" "),Y=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;d.prototype=new Error,d.prototype.constructor=d;var Z;C(),"function"==typeof define&&define.amd?(a.Raven=W,define("raven",[],function(){return W})):"object"==typeof module?module.exports=W:"object"==typeof exports?exports=W:a.Raven=W}("undefined"!=typeof window?window:this),function(){for(var a=0,b=["webkit","moz"],c=0;c