From function, 5 Months ago, written in Plain Text.
Embed
  1. function _toConsumableArray(a) {
  2.   if (Array.isArray(a)) {
  3.     for (var b = 0, c = Array(a.length); b < a.length; b++) c[b] = a[b];
  4.     return c
  5.   }
  6.   return Array.from(a)
  7. }
  8. function _classCallCheck(a, b) {
  9.   if (!(a instanceof b)) throw new TypeError('Cannot call a class as a function')
  10. }
  11. function _classCallCheck(a, b) {
  12.   if (!(a instanceof b)) throw new TypeError('Cannot call a class as a function')
  13. }
  14. function _toConsumableArray(a) {
  15.   if (Array.isArray(a)) {
  16.     for (var b = 0, c = Array(a.length); b < a.length; b++) c[b] = a[b];
  17.     return c
  18.   }
  19.   return Array.from(a)
  20. }
  21. function _objectWithoutProperties(a, b) {
  22.   var c = {
  23.   };
  24.   for (var d in a) b.indexOf(d) >= 0 || Object.prototype.hasOwnProperty.call(a, d) && (c[d] = a[d]);
  25.   return c
  26. }
  27. define('core/utils/getEmbeddedData', [
  28. ], function () {
  29.   'use strict';
  30.   return function (a) {
  31.     var b = window.document.getElementById('disqus-' + a);
  32.     try {
  33.       return b && JSON.parse(b.textContent || b.innerHTML)
  34.     } catch (c) {
  35.       return null
  36.     }
  37.   }
  38. }),
  39. define('core/utils/cookies', [
  40. ], function () {
  41.   'use strict';
  42.   var a = {
  43.     _doc: window.document,
  44.     create: function (b, c, d) {
  45.       d || (d = {
  46.       });
  47.       var e = b + '=' + c + '; path=' + (d.path || '/'),
  48.       f = d.domain,
  49.       g = d.expiresIn;
  50.       if (f && (e += '; domain=.' + f), '[object Number]' === Object.prototype.toString.call(g)) {
  51.         var h = new Date((new Date).getTime() + g);
  52.         e += '; expires=' + h.toGMTString()
  53.       }
  54.       'https:' === a._doc.location.protocol && (e += '; secure'),
  55.       e += '; SameSite=None',
  56.       a._doc.cookie = e
  57.     },
  58.     read: function (b) {
  59.       for (var c, d = b + '=', e = a._doc.cookie.split(';'), f = 0; f < e.length; f++) if (c = e[f].replace(/^\s+/, ''), 0 === c.indexOf(d)) return c.substring(d.length);
  60.       return null
  61.     },
  62.     erase: function (b, c) {
  63.       var d = {
  64.       };
  65.       for (var e in c) c.hasOwnProperty(e) && (d[e] = c[e]);
  66.       return d.expiresIn = - 1,
  67.       a.create(b, '', d)
  68.     },
  69.     supported: function () {
  70.       return a.create('cookie_support', '1'),
  71.       '1' === a.read('cookie_support') && (a.erase('cookie_support'), !0)
  72.     }
  73.   };
  74.   return a
  75. }),
  76. define('core/utils/fingerprint', [
  77. ], function () {
  78.   'use strict';
  79.   function a(a) {
  80.     a = a || {
  81.     };
  82.     var b = a.Math || window.Math,
  83.     c = a.Date || window.Date;
  84.     try {
  85.       var d = (new c).getTimezoneOffset(),
  86.       e = 1,
  87.       f = window.screen;
  88.       f && f.availWidth ? e = f.availWidth * f.availHeight + f.colorDepth : f && f.width && (e = f.width * f.height);
  89.       var g = window.document.documentElement,
  90.       h = g.clientWidth * g.clientHeight;
  91.       return b.abs(17 * d + 25 * e - h)
  92.     } catch (i) {
  93.       return 1
  94.     }
  95.   }
  96.   return {
  97.     get: a
  98.   }
  99. }),
  100. define('core/utils/guid', [
  101.   'core/utils/fingerprint'
  102. ], function (a) {
  103.   'use strict';
  104.   function b(a) {
  105.     a = a || {
  106.     };
  107.     var b = a.Uint32Array || window.Uint32Array,
  108.     c = a.crypto || window.crypto,
  109.     d = a.Math || window.Math;
  110.     try {
  111.       var e = new b(1);
  112.       return c.getRandomValues(e),
  113.       e[0]
  114.     } catch (f) {
  115.       return d.floor(1000000000 * d.random())
  116.     }
  117.   }
  118.   function c() {
  119.     var a = window.performance,
  120.     b = a && a.timing;
  121.     if (!b) return 100000;
  122.     var c = b.domainLookupEnd - b.domainLookupStart,
  123.     d = b.connectEnd - b.connectStart,
  124.     e = b.responseStart - b.navigationStart;
  125.     return 11 * c + 13 * d + 17 * e
  126.   }
  127.   function d(d) {
  128.     d = d || {
  129.     };
  130.     var e = d.Math || window.Math,
  131.     f = Number((new Date).getTime().toString().substring(3)),
  132.     g = e.abs(f + c() - a.get()).toString(32);
  133.     return g += b(d).toString(32)
  134.   }
  135.   return {
  136.     generate: d
  137.   }
  138. }),
  139. define('core/utils/hash', [
  140. ], function () {
  141.   'use strict';
  142.   var a = function (a) {
  143.     var b,
  144.     c,
  145.     d,
  146.     e = 0;
  147.     if (0 === a.length) return e;
  148.     for (b = 0, c = a.length; b < c; b++) d = a.charCodeAt(b),
  149.     e = (e << 5) - e + d,
  150.     e |= 0;
  151.     return e
  152.   };
  153.   return {
  154.     calculate: a
  155.   }
  156. }),
  157. define('core/analytics/identity', [
  158.   'exports',
  159.   'core/utils/cookies',
  160.   'core/utils/guid',
  161.   'core/utils/hash',
  162.   'core/utils/fingerprint'
  163. ], function (a, b, c, d, e) {
  164.   'use strict';
  165.   var f = !1,
  166.   g = a.ImpressionManager = function () {
  167.     this.isPrivate = !0,
  168.     this.impId = c.generate()
  169.   };
  170.   g.prototype.COOKIE_NAME = '__jid',
  171.   g.prototype.TTL = 1800000,
  172.   g.prototype.init = function (a) {
  173.     this.isPrivate = a && a.isPrivate,
  174.     this.isPrivate || (this.prevImp = b.read(this.COOKIE_NAME)),
  175.     this.persist()
  176.   },
  177.   g.prototype.setImpressionId = function (a) {
  178.     this.impId = a,
  179.     this.persist()
  180.   },
  181.   g.prototype.persist = function () {
  182.     return this.isPrivate ? void b.erase(this.COOKIE_NAME) : void b.create(this.COOKIE_NAME, this.impId, {
  183.       expiresIn: this.TTL
  184.     })
  185.   };
  186.   var h = a.UniqueManager = function () {
  187.     this.isPrivate = !0
  188.   };
  189.   h.prototype.COOKIE_NAME = 'disqus_unique',
  190.   h.prototype.TTL = 31536000000,
  191.   h.prototype.init = function (a) {
  192.     return this.isPrivate = a && a.isPrivate,
  193.     this.isPrivate ? void b.erase(this.COOKIE_NAME, {
  194.       domain: window.location.host.split(':') [0]
  195.     }) : (this.value = b.read(this.COOKIE_NAME) || c.generate(), void b.create(this.COOKIE_NAME, this.value, {
  196.       domain: window.location.host.split(':') [0],
  197.       expiresIn: this.TTL
  198.     }))
  199.   },
  200.   h.prototype.isPersistent = function () {
  201.     return !this.isPrivate && b.read(this.COOKIE_NAME) === this.value
  202.   },
  203.   a.init = function (b, c) {
  204.     f && !c || (a.impression.init(b), a.unique.init(b), f = !0)
  205.   },
  206.   a.reset = function () {
  207.     f = !1,
  208.     a.impression = new g,
  209.     a.unique = new h
  210.   },
  211.   a.reset(),
  212.   a.clientId = function () {
  213.     var b,
  214.     c = a.unique;
  215.     return c.isPersistent() && (b = c.value),
  216.     b || e.get().toString()
  217.   },
  218.   a.getPercentBucketForString = function (a, b) {
  219.     var c = 100,
  220.     e = Math.abs(d.calculate(a));
  221.     if (b) {
  222.       var f = Math.pow(10, b);
  223.       return e % (c * f) / f
  224.     }
  225.     return e % c
  226.   },
  227.   a.clientPercent = function () {
  228.     return a.getPercentBucketForString(a.clientId())
  229.   }
  230. }),
  231. define('core/config/urls', [
  232.   'common/urls'
  233. ], function (a) {
  234.   'use strict';
  235.   return a
  236. }),
  237. define('core/analytics/jester', [
  238.   'jquery',
  239.   'underscore',
  240.   'backbone',
  241.   'core/analytics/identity',
  242.   'core/config/urls'
  243. ], function (a, b, c, d, e) {
  244.   'use strict';
  245.   var f = c.Model.extend({
  246.     url: e.jester + '/event.js',
  247.     defaults: {
  248.       experiment: 'default',
  249.       variant: 'control'
  250.     },
  251.     setHostReferrer: function (a) {
  252.       a ? a.indexOf('http') === - 1 || this.set('page_referrer', a) : this.set('page_referrer', 'direct')
  253.     },
  254.     decoratePayload: function (c) {
  255.       c.event || (c.event = 'activity'),
  256.       c = b.extend(this.toJSON(), c),
  257.       b.extend(c, {
  258.         imp: d.impression.impId,
  259.         prev_imp: d.impression.prevImp
  260.       }),
  261.       c.section || (c.section = 'default'),
  262.       c.area || (c.area = 'n/a');
  263.       var e = a.param(c).length;
  264.       if (e > 2048 && this.has('page_referrer')) {
  265.         var f = window.document.createElement('a');
  266.         f.href = this.get('page_referrer');
  267.         var g = f.hostname;
  268.         g && (c.page_referrer_domain = g),
  269.         delete c.page_referrer
  270.       }
  271.       return c
  272.     },
  273.     emit: function (c) {
  274.       return a.ajax({
  275.         url: b.result(this, 'url'),
  276.         data: this.decoratePayload(c),
  277.         dataType: 'script',
  278.         cache: !0
  279.       })
  280.     }
  281.   }),
  282.   g = function (b) {
  283.     var c = new window.Image;
  284.     return c.src = e.jester + '/stat.gif?' + a.param({
  285.       event: b
  286.     }),
  287.     c
  288.   },
  289.   h = function (c, d) {
  290.     if (!b.any(d, function (a) {
  291.       return a < 0
  292.     })) {
  293.       b.each(d, function (a, b) {
  294.         d[b] = Math.round(a)
  295.       });
  296.       var f = new window.Image;
  297.       return f.src = e.jester + '/telemetry/' + c + '.gif?' + a.param(d),
  298.       f
  299.     }
  300.   },
  301.   i = new f;
  302.   return i.setHostReferrer(window.document.referrer),
  303.   {
  304.     ActivityClient: f,
  305.     client: i,
  306.     logStat: g,
  307.     telemetry: h
  308.   }
  309. }),
  310. define('core/utils/urls', [
  311. ], function () {
  312.   'use strict';
  313.   var a = {
  314.   },
  315.   b = window.document.createElement('a');
  316.   return a.getOrigin = function (a) {
  317.     b.href = a;
  318.     var c = b.href.split('/');
  319.     return c[0] + '//' + c[2]
  320.   },
  321.   a.getHostName = function (a) {
  322.     return b.href = a,
  323.     b.hostname
  324.   },
  325.   a.getDomainPart = function (b, c) {
  326.     'undefined' == typeof c && (c = 0);
  327.     var d = a.getHostName(b),
  328.     e = d.split('.').reverse();
  329.     return e[c]
  330.   },
  331.   a.getQuery = function (a) {
  332.     return b.href = a,
  333.     b.search
  334.   },
  335.   a.getPathname = function (a) {
  336.     return b.href = a,
  337.     b.pathname
  338.   },
  339.   a
  340. }),
  341. define('core/frameBus', [
  342.   'jquery',
  343.   'underscore',
  344.   'backbone',
  345.   'core/utils/urls'
  346. ], function (a, b, c, d) {
  347.   'use strict';
  348.   var e = window.opener || window.parent,
  349.   f = window.name,
  350.   g = window.document.referrer,
  351.   h = {
  352.   };
  353.   h.client = d.getOrigin(window.document.location.href),
  354.   h.secureClient = h.client.replace(/^\w+:\/\//, 'https://'),
  355.   h.host = g ? d.getOrigin(g) : h.client;
  356.   var i = {
  357.     origins: h,
  358.     messageHandler: function (a) {
  359.       a = a.originalEvent;
  360.       var b;
  361.       try {
  362.         b = JSON.parse(a.data)
  363.       } catch (c) {
  364.         return
  365.       }
  366.       b.name && '!' === b.name[0] && a.origin !== h.client && a.origin !== h.secureClient || 'client' === b.scope && i.trigger(b.name, b.data)
  367.     },
  368.     postMessage: function (a) {
  369.       a = JSON.stringify(a),
  370.       e.postMessage(a, '*')
  371.     },
  372.     sendHostMessage: function (a, b) {
  373.       b = b || [
  374.       ],
  375.       i.postMessage({
  376.         scope: 'host',
  377.         sender: f,
  378.         name: a,
  379.         data: b
  380.       })
  381.     }
  382.   };
  383.   return b.extend(i, c.Events),
  384.   a(window).on('message', i.messageHandler),
  385.   a(window).on('unload', function () {
  386.     i.sendHostMessage('die')
  387.   }),
  388.   window.DISQUS = window.DISQUS || {
  389.   },
  390.   window.DISQUS.Bus = i,
  391.   i
  392. }),
  393. define('core/bus', [
  394.   'backbone',
  395.   'underscore',
  396.   'core/frameBus'
  397. ], function (a, b, c) {
  398.   'use strict';
  399.   var d = b.extend({
  400.   }, a.Events);
  401.   return d.frame = c,
  402.   d
  403. }),
  404. define('core/utils/storage', [
  405. ], function () {
  406.   'use strict';
  407.   var a = function (a) {
  408.     var b = '_dsqstorage_';
  409.     try {
  410.       return a.localStorage.setItem(b, b),
  411.       a.localStorage.getItem(b),
  412.       a.localStorage.removeItem(b),
  413.       !0
  414.     } catch (c) {
  415.       return !1
  416.     }
  417.   }(window),
  418.   b = function () {
  419.     var a = {
  420.     };
  421.     return {
  422.       getItem: function (b) {
  423.         return a.hasOwnProperty(b) ? a[b] : null
  424.       },
  425.       setItem: function (b, c) {
  426.         a[b] = String(c)
  427.       },
  428.       removeItem: function (b) {
  429.         delete a[b]
  430.       },
  431.       clear: function () {
  432.         a = {
  433.         }
  434.       }
  435.     }
  436.   }();
  437.   return {
  438.     get: function (a) {
  439.       var b = null;
  440.       try {
  441.         return b = this.backend.getItem(a),
  442.         JSON.parse(b)
  443.       } catch (c) {
  444.         return b
  445.       }
  446.     },
  447.     set: function (a, b) {
  448.       try {
  449.         this.backend.setItem(a, JSON.stringify(b))
  450.       } catch (c) {
  451.       }
  452.     },
  453.     remove: function (a) {
  454.       try {
  455.         this.backend.removeItem(a)
  456.       } catch (b) {
  457.       }
  458.     },
  459.     clear: function () {
  460.       try {
  461.         this.backend.clear()
  462.       } catch (a) {
  463.       }
  464.     },
  465.     backend: a ? window.localStorage : b,
  466.     isPersistent: a
  467.   }
  468. }),
  469. define('core/utils/auth', [
  470.   'core/utils/cookies'
  471. ], function (a) {
  472.   'use strict';
  473.   var b = {
  474.   },
  475.   c = 'disqusauth';
  476.   return b.getFromCookie = function () {
  477.     var b = (a.read(c) || '').replace(/"/g, '').split('|');
  478.     !b || b[1] && b[6] || (b = [
  479.     ], a.erase(c, {
  480.     }));
  481.     var d = parseInt(b[6] || '0', 10);
  482.     return {
  483.       avatarUrl: b[7] ? decodeURIComponent(b[7]) : void 0,
  484.       datetimeFormatting: parseInt(b[4], 10) ? 'absolute' : 'relative',
  485.       id: d,
  486.       isModerator: parseInt(b[8], 10) > 0,
  487.       staff: Boolean(parseInt(b[2], 10)),
  488.       tzOffset: b[5],
  489.       username: b[1],
  490.       isAuthenticated: Boolean(d && '0' !== d)
  491.     }
  492.   },
  493.   b
  494. }),
  495. define('core/switches', [
  496.   'underscore',
  497.   'remote/config',
  498.   'core/analytics/identity',
  499.   'core/utils/storage',
  500.   'core/utils/auth'
  501. ], function (a, b, c, d, e) {
  502.   'use strict';
  503.   var f = 'switch:',
  504.   g = {
  505.   },
  506.   h = {
  507.   };
  508.   return h._getKey = function (a) {
  509.     return f + a
  510.   },
  511.   h.disableFeature = function (a) {
  512.     g[a] = !1
  513.   },
  514.   h.resetFeature = function (a) {
  515.     g[a] = null
  516.   },
  517.   h.forceFeature = function (a) {
  518.     g[a] = !0
  519.   },
  520.   h.getSwitchContext = function (a) {
  521.     var c = d.get(this._getKey(a));
  522.     if (null !== c) return c;
  523.     var e = g[a];
  524.     return null != e ? e : (b.lounge && b.lounge.switches || {
  525.     }) [a]
  526.   },
  527.   h.isFeatureActive = function (b, d) {
  528.     var f = h.getSwitchContext(b);
  529.     if (a.isBoolean(f)) return f;
  530.     if (!f) return !1;
  531.     var g = e.getFromCookie(),
  532.     i = {
  533.       percent: c.clientPercent(),
  534.       user_id: g.id,
  535.       username: g.username,
  536.       is_staff: g.staff,
  537.       is_moderator: g.isModerator
  538.     },
  539.     j = a.defaults(d || {
  540.     }, i);
  541.     return a.any(f, function (b, d) {
  542.       var e = j[d];
  543.       if (/percent$/.test(d) && a.isNumber(b)) {
  544.         if (a.isNumber(e)) return b > e;
  545.         if (a.isString(e)) {
  546.           var f = 0;
  547.           return b !== Math.round(b) && (f = b.toString().split('.').pop().length),
  548.           b > c.getPercentBucketForString(e, f)
  549.         }
  550.         return !1
  551.       }
  552.       return a.isArray(b) ? a.contains(b, e) : b === e
  553.     })
  554.   },
  555.   h
  556. }),
  557. define('core/utils/url/serializeArgs', [
  558.   'require',
  559.   'exports',
  560.   'module',
  561.   'core/utils/collection/each'
  562. ], function (a, b, c) {
  563.   'use strict';
  564.   var d = a('core/utils/collection/each');
  565.   c.exports = function (a) {
  566.     var b = [
  567.     ];
  568.     return d(a, function (a, c) {
  569.       void 0 !== a && b.push(encodeURIComponent(c) + (null === a ? '' : '=' + encodeURIComponent(a)))
  570.     }),
  571.     b.join('&')
  572.   }
  573. }),
  574. define('core/utils/url/serialize', [
  575.   'require',
  576.   'exports',
  577.   'module',
  578.   'core/utils/url/serializeArgs'
  579. ], function (a, b, c) {
  580.   'use strict';
  581.   var d = a('core/utils/url/serializeArgs');
  582.   c.exports = function e(a, b, c) {
  583.     if (b && (a.indexOf('?') === - 1 ? a += '?' : '&' !== a.charAt(a.length - 1) && (a += '&'), a += d(b)), c) {
  584.       var f = {
  585.       };
  586.       return f[(new Date).getTime()] = null,
  587.       e(a, f)
  588.     }
  589.     var g = a.length;
  590.     return '&' === a.charAt(g - 1) ? a.slice(0, g - 1) : a
  591.   }
  592. }),
  593. define('core/utils/isAdBlockEnabled', [
  594. ], function () {
  595.   'use strict';
  596.   function a() {
  597.     var a = d.createElement('div');
  598.     return a.setAttribute('class', 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links ad-text adSense adBlock adContent adBanner'),
  599.     a.setAttribute('style', 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;'),
  600.     a
  601.   }
  602.   function b(a) {
  603.     if (null === a.offsetParent || 0 === a.offsetHeight || 0 === a.offsetLeft || 0 === a.offsetTop || 0 === a.offsetWidth || 0 === a.clientHeight || 0 === a.clientWidth) return !0;
  604.     if (void 0 !== window.getComputedStyle) {
  605.       var b = window.getComputedStyle(a, null);
  606.       if (b && ('none' === b.getPropertyValue('display') || 'hidden' === b.getPropertyValue('visibility'))) return !0
  607.     }
  608.     return !1
  609.   }
  610.   var c = 100,
  611.   d = window.document;
  612.   return function (e) {
  613.     var f = a();
  614.     d.body.appendChild(f),
  615.     setTimeout(function () {
  616.       var a = b(f);
  617.       d.body.removeChild(f),
  618.       e(a)
  619.     }, c)
  620.   }
  621. }),
  622. define('core/utils/html/toRGBColorString', [
  623. ], function () {
  624.   'use strict';
  625.   var a = 'Color components should be numbers.';
  626.   return function (b) {
  627.     var c = Number(b.red),
  628.     d = Number(b.green),
  629.     e = Number(b.blue);
  630.     if (isNaN(c) || isNaN(d) || isNaN(e)) throw new Error(a);
  631.     var f = 'rgb',
  632.     g = [
  633.       c,
  634.       d,
  635.       e
  636.     ],
  637.     h = b.alpha;
  638.     if (h) {
  639.       if (h = Number(h), isNaN(h)) throw new Error(a);
  640.       f += 'a',
  641.       g.push(h)
  642.     }
  643.     return f + '(' + g + ')'
  644.   }
  645. }),
  646. define('core/utils/lang/isString', [
  647. ], function () {
  648.   'use strict';
  649.   return function (a) {
  650.     return '[object String]' === Object.prototype.toString.call(a)
  651.   }
  652. }),
  653. define('core/utils/html/setInlineStyle', [
  654.   'require',
  655.   'core/utils/collection/each',
  656.   'core/utils/lang/isString',
  657.   'core/utils/object/extend'
  658. ], function (a) {
  659.   'use strict';
  660.   function b(a) {
  661.     return a.replace(/\s+/g, '').toLowerCase()
  662.   }
  663.   var c = a('core/utils/collection/each'),
  664.   d = a('core/utils/lang/isString'),
  665.   e = a('core/utils/object/extend');
  666.   return function (a, f, g) {
  667.     var h = {
  668.     };
  669.     d(f) ? h[f] = g : h = f;
  670.     var i = e({
  671.     }, h);
  672.     c(i, function (a, c) {
  673.       var d = b(c);
  674.       d !== c && (delete i[c], i[d] = a),
  675.       null === a && (i[d] = ''),
  676.       void 0 === a && delete i[d]
  677.     });
  678.     var j = a.style;
  679.     c(i, function (a, b) {
  680.       j.setProperty(b, String(a), 'important')
  681.     })
  682.   }
  683. }),
  684. define('core/utils/html/parseColor', [
  685.   'require',
  686.   'core/utils/html/setInlineStyle'
  687. ], function (a) {
  688.   'use strict';
  689.   function b(a) {
  690.     return a.replace(/\s+/g, '').toLowerCase()
  691.   }
  692.   function c(a) {
  693.     return a = a.replace(/^#([a-f0-9])([a-f0-9])([a-f0-9])$/, '#$1$1$2$2$3$3'),
  694.     a = a.slice(1),
  695.     {
  696.       red: parseInt(a.slice(0, 2), 16),
  697.       green: parseInt(a.slice(2, 4), 16),
  698.       blue: parseInt(a.slice(4, 6), 16)
  699.     }
  700.   }
  701.   function d(a) {
  702.     var b = a.match(/^rgb\((\d+),(\d+),(\d+)\)$/);
  703.     return {
  704.       red: parseInt(b[1], 10),
  705.       green: parseInt(b[2], 10),
  706.       blue: parseInt(b[3], 10)
  707.     }
  708.   }
  709.   function e(a) {
  710.     var b = a.match(/^rgba\((\d+),(\d+),(\d+),([\d.]+)\)$/);
  711.     return {
  712.       red: parseInt(b[1], 10),
  713.       green: parseInt(b[2], 10),
  714.       blue: parseInt(b[3], 10),
  715.       alpha: parseFloat(b[4])
  716.     }
  717.   }
  718.   function f(a, b, c, d) {
  719.     return b = window.document.createElement(b),
  720.     h(b, {
  721.       visibility: 'hidden',
  722.       color: c
  723.     }),
  724.     a.appendChild(b),
  725.     c = d(b),
  726.     a.removeChild(b),
  727.     c
  728.   }
  729.   function g(a, c) {
  730.     c = c || {
  731.     };
  732.     var e = c.container || window.document.body;
  733.     return window.getComputedStyle ? (a = f(e, 'span', a, function (a) {
  734.       return window.getComputedStyle(a, null).getPropertyValue('color')
  735.     }), d(b(a))) : (a = f(e, 'textarea', a, function (a) {
  736.       return a.createTextRange().queryCommandValue('ForeColor')
  737.     }), {
  738.       red: 255 & a,
  739.       blue: a >>> 16,
  740.       green: (65280 & a) >>> 8
  741.     })
  742.   }
  743.   var h = a('core/utils/html/setInlineStyle');
  744.   return function (a, f) {
  745.     a = b(a);
  746.     var h;
  747.     if ('transparent' === a) return {
  748.       red: 0,
  749.       green: 0,
  750.       blue: 0,
  751.       alpha: 0
  752.     };
  753.     if ('#' === a.charAt(0)) h = c;
  754.      else if ('rgba(' === a.slice(0, 5)) h = e;
  755.      else if ('rgb(' === a.slice(0, 4)) h = d;
  756.      else {
  757.       if (!/^[a-z]+$/.test(a)) throw new Error('parseColor received unparseable color: ' + a);
  758.       h = g
  759.     }
  760.     return h(a, f)
  761.   }
  762. }),
  763. define('core/host/globalFromSandbox', [
  764.   'require'
  765. ], function (a) {
  766.   'use strict';
  767.   var b = window.document,
  768.   c = b.createElement('iframe');
  769.   return c.style.display = 'none',
  770.   function (a, d) {
  771.     var e = d && d[a] || null;
  772.     try {
  773.       return c.parentNode !== b.body && b.body.appendChild(c),
  774.       c.contentWindow[a] || e
  775.     } catch (f) {
  776.       return e
  777.     }
  778.   }
  779. }),
  780. define('core/host/utils', [
  781.   'require',
  782.   'core/utils/browser',
  783.   'core/utils/lang/isString',
  784.   'core/utils/html/getCurrentStyle',
  785.   'core/utils/html/parseColor',
  786.   'core/host/globalFromSandbox'
  787. ], function (a) {
  788.   'use strict';
  789.   function b(a) {
  790.     for (var b = [
  791.       /(https?:)?\/\/(www\.)?disqus\.com\/forums\/([\w_-]+)/i,
  792.       /(https?:)?\/\/(www\.)?([\w_-]+)\.disqus\.com/i,
  793.       /(https?:)?\/\/(www\.)?dev\.disqus\.org\/forums\/([\w_-]+)/i,
  794.       /(https?:)?\/\/(www\.)?([\w_-]+)\.dev\.disqus\.org/i
  795.     ], c = 0; c < b.length; c++) {
  796.       var d = a.match(b[c]);
  797.       if (d && d.length && 4 === d.length) return d[3]
  798.     }
  799.     return null
  800.   }
  801.   function c(a, c, d) {
  802.     var e = a.querySelector('script[src*="disqus"][src$="' + c + '"]');
  803.     if (e) {
  804.       var f = e.getAttribute ? e.getAttribute('src') : e.src;
  805.       d = d || b;
  806.       var g = d(f);
  807.       return g ? g.toLowerCase() : null
  808.     }
  809.     return null
  810.   }
  811.   function d(a, b) {
  812.     var c,
  813.     d,
  814.     e = 0,
  815.     f = new Array(a.length);
  816.     for (c = 0; c <= a.length; c++) for (f[c] = new Array(b.length), d = 0; d <= b.length; d++) f[c][d] = 0;
  817.     for (c = 0; c < a.length; c++) for (d = 0; d < b.length; d++) a[c] === b[d] && (f[c + 1][d + 1] = f[c][d] + 1, f[c + 1][d + 1] > e && (e = f[c + 1][d + 1]));
  818.     return e
  819.   }
  820.   function e() {
  821.     for (var a = t.getElementsByTagName('h1'), b = t.title, c = b.length, e = b, f = 0.6, g = function (a) {
  822.       var g,
  823.       h = a.textContent || a.innerText;
  824.       null !== h && void 0 !== h && (g = d(b, h) / c, g > f && (f = g, e = h))
  825.     }, h = 0; h < a.length; h++) g(a[h]);
  826.     return e
  827.   }
  828.   function f(a) {
  829.     return a.toLowerCase().replace(/^\s+|\s+$/g, '').replace(/['"]/g, '')
  830.   }
  831.   function g(a) {
  832.     var b = 0,
  833.     c = 1,
  834.     d = 2;
  835.     if (!s('atob') || !s('requestAnimationFrame')) return c;
  836.     try {
  837.       a.postMessage('ping', '*')
  838.     } catch (e) {
  839.       return d
  840.     }
  841.     return b
  842.   }
  843.   function h(a, b, c) {
  844.     c = c || b;
  845.     var d = q(a, b, c);
  846.     return !d || /color/i.test(b) && 0 === r(d).alpha ? a && h(a.parentNode, b, c) || d : d || null
  847.   }
  848.   function i(a, b, c, d) {
  849.     p(b) && (b = t.createElement(b));
  850.     var e = null;
  851.     return b.style.visibility = 'hidden',
  852.     a.appendChild(b),
  853.     e = h(b, c, d),
  854.     a.removeChild(b),
  855.     e
  856.   }
  857.   function j(a) {
  858.     for (var b, c = i(a, 'span', 'font-family', 'fontFamily'), d = c.split(','), e = {
  859.       courier: 1,
  860.       times: 1,
  861.       'times new roman': 1,
  862.       georgia: 1,
  863.       palatino: 1,
  864.       serif: 1
  865.     }, g = 0; g < d.length; g++) if (b = f(d[g]), e.hasOwnProperty(b)) return !0;
  866.     return !1
  867.   }
  868.   function k(a) {
  869.     var b = t.createElement('a');
  870.     return b.href = Number(new Date),
  871.     r(i(a, b, 'color'), {
  872.       container: a
  873.     })
  874.   }
  875.   function l(a) {
  876.     var b = a.red,
  877.     c = a.green,
  878.     d = a.blue;
  879.     if (a.hasOwnProperty('alpha')) {
  880.       var e = a.alpha,
  881.       f = function (a) {
  882.         return Math.round(a * e + 255 * (1 - e))
  883.       };
  884.       b = f(b),
  885.       c = f(c),
  886.       d = f(d)
  887.     }
  888.     return (299 * b + 587 * c + 114 * d) / 1000
  889.   }
  890.   function m(a) {
  891.     var b = i(a, 'span', 'background-color', 'backgroundColor'),
  892.     c = r(b, {
  893.       container: a
  894.     });
  895.     return 0 === c.alpha ? 'light' : l(c) < 128 ? 'dark' : 'light'
  896.   }
  897.   function n(a) {
  898.     var b = k(a);
  899.     return 0 === b.alpha ? 'light' : l(b) < 128 ? 'dark' : 'light'
  900.   }
  901.   var o = a('core/utils/browser'),
  902.   p = a('core/utils/lang/isString'),
  903.   q = a('core/utils/html/getCurrentStyle'),
  904.   r = a('core/utils/html/parseColor'),
  905.   s = a('core/host/globalFromSandbox'),
  906.   t = window.document,
  907.   u = function () {
  908.     var a,
  909.     b,
  910.     c = function () {
  911.       return !1
  912.     };
  913.     if ('hidden' in t) a = 'hidden',
  914.     b = 'visibilitychange';
  915.      else {
  916.       if (!('webkitHidden' in t)) return {
  917.         isHidden: c,
  918.         listen: c,
  919.         stopListening: c
  920.       };
  921.       a = 'webkitHidden',
  922.       b = 'webkitvisibilitychange'
  923.     }
  924.     return {
  925.       isHidden: function () {
  926.         return t[a]
  927.       },
  928.       listen: function (a) {
  929.         return t.addEventListener(b, a)
  930.       },
  931.       stopListening: function (a) {
  932.         return t.removeEventListener(b, a)
  933.       }
  934.     }
  935.   }(),
  936.   v = function () {
  937.     var a = t.createElement('div');
  938.     a.style.visibility = 'hidden',
  939.     a.style.width = '100px',
  940.     a.style.msOverflowStyle = 'scrollbar',
  941.     t.body.appendChild(a);
  942.     var b = a.offsetWidth;
  943.     a.style.overflow = 'scroll';
  944.     var c = t.createElement('div');
  945.     c.style.width = '100%',
  946.     a.appendChild(c);
  947.     var d = c.offsetWidth;
  948.     return a.parentNode.removeChild(a),
  949.     b - d
  950.   },
  951.   w = {
  952.     getItem: function (a) {
  953.       try {
  954.         return window.localStorage.getItem(a)
  955.       } catch (b) {
  956.       }
  957.     },
  958.     setItem: function (a, b) {
  959.       try {
  960.         return window.localStorage.setItem(a, b)
  961.       } catch (c) {
  962.       }
  963.     }
  964.   },
  965.   x = 1,
  966.   y = function (a) {
  967.     if (a.nodeType === x) {
  968.       var b = q(a, 'max-height', 'maxHeight'),
  969.       c = q(a, 'overflow-y', 'overflowY');
  970.       return b && 'none' !== b && c && 'visible' !== c
  971.     }
  972.   },
  973.   z = 4,
  974.   A = function (a) {
  975.     if (a.nodeType === x) return a.scrollHeight - a.clientHeight > z
  976.   },
  977.   B = function () {
  978.     if (t.querySelector) {
  979.       var a = t.querySelector('link[rel=canonical]');
  980.       if (a) return a.href
  981.     }
  982.   };
  983.   return {
  984.     MAX_Z_INDEX: 2147483647,
  985.     getShortnameFromUrl: b,
  986.     getForum: c,
  987.     guessThreadTitle: e,
  988.     getContrastYIQ: l,
  989.     getColorScheme: m,
  990.     getElementStyle: i,
  991.     getAnchorColor: k,
  992.     getAnchorColorScheme: n,
  993.     normalizeFontValue: f,
  994.     isSerif: j,
  995.     getBrowserSupport: g,
  996.     pageVisibility: u,
  997.     getScrollbarWidth: v,
  998.     browser: o,
  999.     storage: w,
  1000.     appearsToHideContent: y,
  1001.     hasOverflow: A,
  1002.     getCanonicalUrl: B
  1003.   }
  1004. }),
  1005. define('common/utils', [
  1006.   'jquery',
  1007.   'underscore',
  1008.   'loglevel',
  1009.   'common/main',
  1010.   'common/urls',
  1011.   'core/host/utils',
  1012.   'core/utils/cookies',
  1013.   'core/utils/html/parseColor'
  1014. ], function (a, b, c, d, e, f, g, h) {
  1015.   'use strict';
  1016.   var i = window.document,
  1017.   j = {
  1018.   };
  1019.   j.globalUniqueId = function (a) {
  1020.     return b.uniqueId(a) + '_' + Number(new Date)
  1021.   },
  1022.   j.setPublisherColor = function (a) {
  1023.     i.documentElement.style.setProperty('--publisher-color', a);
  1024.     var b = f.getContrastYIQ(h(a));
  1025.     b > 5 && b < 250 && i.documentElement.style.setProperty('--publisher-color-safe', a)
  1026.   },
  1027.   j.addStylesheetRules = function (a) {
  1028.     function c() {
  1029.       var e = b.find(i.styleSheets, function (a) {
  1030.         var b = a.ownerNode || a.owningElement;
  1031.         return b.id === d
  1032.       });
  1033.       if (!e) return void setTimeout(c, 50);
  1034.       for (var f = 0, g = a.length; f < g; f++) {
  1035.         var h = 1,
  1036.         j = a[f],
  1037.         k = j[0],
  1038.         l = '';
  1039.         '[object Array]' === Object.prototype.toString.call(j[1][0]) && (j = j[1], h = 0);
  1040.         for (var m = j.length; h < m; h++) {
  1041.           var n = j[h];
  1042.           l += n[0] + ':' + n[1] + (n[2] ? ' !important' : '') + ';\n'
  1043.         }
  1044.         e.insertRule ? e.insertRule(k + '{' + l + '}', e.cssRules.length) : e.addRule(k, l, - 1)
  1045.       }
  1046.     }
  1047.     var d = 'css_' + (new Date).getTime(),
  1048.     e = i.createElement('style');
  1049.     e.id = d,
  1050.     i.getElementsByTagName('head') [0].appendChild(e),
  1051.     window.createPopup || e.appendChild(i.createTextNode('')),
  1052.     c()
  1053.   };
  1054.   var k = j.CORS = {
  1055.     handler: function (a, b, c) {
  1056.       a && c >= 200 && c < 300 ? a() : b && (c < 200 || c >= 300) && b()
  1057.     },
  1058.     XHR2: function (a, b, c, d) {
  1059.       var e = k.handler,
  1060.       f = new window.XMLHttpRequest;
  1061.       return f.open(a, b, !0),
  1062.       f.onreadystatechange = function () {
  1063.         f.readyState === window.XMLHttpRequest.DONE && e(c, d, f.status)
  1064.       },
  1065.       f
  1066.     }
  1067.   };
  1068.   k.request = function () {
  1069.     return 'withCredentials' in new window.XMLHttpRequest ? k.XHR2 : function () {
  1070.       return null
  1071.     }
  1072.   }(),
  1073.   j.isWindowClosed = function (a) {
  1074.     if (!a) return !0;
  1075.     try {
  1076.       return a.closed || void 0 === a.closed
  1077.     } catch (b) {
  1078.       return !0
  1079.     }
  1080.   },
  1081.   j.truncate = function (a, b, c) {
  1082.     return c = c || '...',
  1083.     a.length > b ? a.slice(0, b) + c : a
  1084.   },
  1085.   j.extractDomainForCookies = function (a) {
  1086.     return a.split('/') [2].replace(/:[0-9]+/, '')
  1087.   },
  1088.   j.cookies = {
  1089.     domain: j.extractDomainForCookies(e.root),
  1090.     create: function (a, b) {
  1091.       var c = 31536000000;
  1092.       g.create(a, b, {
  1093.         domain: j.cookies.domain,
  1094.         expiresIn: c
  1095.       })
  1096.     },
  1097.     read: g.read,
  1098.     erase: function (a) {
  1099.       g.erase(a, {
  1100.         domain: j.cookies.domain
  1101.       })
  1102.     }
  1103.   },
  1104.   j.updateURL = function (a, c) {
  1105.     var d,
  1106.     e = i.createElement('a');
  1107.     return c = c || {
  1108.     },
  1109.     e.href = a,
  1110.     c.hostname && c.hostname.match(/\.$/) && (c.hostname += e.hostname),
  1111.     d = b.extend({
  1112.       protocol: e.protocol,
  1113.       hostname: e.hostname,
  1114.       pathname: e.pathname,
  1115.       search: e.search
  1116.     }, c),
  1117.     d.pathname.match(/^\//) || (d.pathname = '/' + d.pathname),
  1118.     d.protocol + '//' + d.hostname + d.pathname + d.search
  1119.   },
  1120.   j.injectBaseElement = function (a, b) {
  1121.     b = b || i;
  1122.     var c = b.getElementsByTagName('base') [0] || b.createElement('base');
  1123.     c.target = '_parent',
  1124.     a ? c.href = a : c.removeAttribute('href'),
  1125.     c.parentNode || (b.head || b.getElementsByTagName('head') [0]).appendChild(c)
  1126.   },
  1127.   j.syntaxHighlighter = function () {
  1128.     var c = 1,
  1129.     e = 2,
  1130.     f = null,
  1131.     g = null,
  1132.     h = [
  1133.     ],
  1134.     i = {
  1135.       highlight: function (a) {
  1136.         null === g && i._load(),
  1137.         h.push(a),
  1138.         g === e && i.scheduleHighlight()
  1139.       },
  1140.       _highlight: function (b) {
  1141.         var c = a(b).html();
  1142.         a(b).html(c.replace(/^<br>/, '')),
  1143.         f.highlightBlock(b),
  1144.         i.scheduleHighlight()
  1145.       },
  1146.       scheduleHighlight: function () {
  1147.         var a = h.shift();
  1148.         a && window.requestAnimationFrame(b.bind(i._highlight, i, a))
  1149.       },
  1150.       _load: function () {
  1151.         g = c,
  1152.         d.loadCss('https://c.disquscdn.com/next/embed/styles/highlight.3128dd90ecaebd8542ac3442033f3f00.css'),
  1153.         require(['common/vendor_extensions/highlight'], function (a) {
  1154.           g = e,
  1155.           f = a,
  1156.           i.scheduleHighlight()
  1157.         })
  1158.       }
  1159.     };
  1160.     return i
  1161.   }();
  1162.   var l = a('html');
  1163.   j.getPageHeight = function () {
  1164.     var b = a('#tos__message'),
  1165.     c = b.outerHeight();
  1166.     return c && (c += b.offset().top),
  1167.     Math.max(c, l.height())
  1168.   },
  1169.   j.calculatePositionFullscreen = function () {
  1170.     return {
  1171.       pageOffset: a(window).scrollTop(),
  1172.       height: i.documentElement.clientHeight,
  1173.       frameOffset: {
  1174.         left: 0,
  1175.         top: 0
  1176.       }
  1177.     }
  1178.   },
  1179.   j.triggerClick = function (a, b) {
  1180.     var c,
  1181.     d,
  1182.     e = a[0],
  1183.     f = {
  1184.       altKey: !1,
  1185.       button: 0,
  1186.       ctrlKey: !1,
  1187.       metaKey: !1,
  1188.       shiftKey: !1
  1189.     };
  1190.     if (i.createEvent) {
  1191.       if (c = i.createEvent('MouseEvents'), b) for (d in f) f.hasOwnProperty(d) && b.hasOwnProperty(d) && (f[d] = b[d]);
  1192.       c.initMouseEvent('click', !0, !0, window, 0, 0, 0, 0, 0, f.ctrlKey, f.altKey, f.shiftKey, f.metaKey, 0, null),
  1193.       e.dispatchEvent && e.dispatchEvent(c)
  1194.     } else if (i.createEventObject) {
  1195.       if (c = i.createEventObject(), c.eventType = 'click', b) for (d in f) f.hasOwnProperty(d) && b.hasOwnProperty(d) && (c[d] = b[d]);
  1196.       e.fireEvent('onclick', c)
  1197.     }
  1198.   },
  1199.   j.delayLinkClick = function (a, c) {
  1200.     a.preventDefault(),
  1201.     b.delay(b.bind(j.triggerClick, this, c, a.originalEvent), 100)
  1202.   },
  1203.   j.mixin = function (a, c, d) {
  1204.     var e = a.prototype,
  1205.     f = b.extend({
  1206.     }, c, d);
  1207.     if (b.defaults(e, f), b.defaults(e.events, f.events), void 0 !== e.initialize && void 0 !== f.initialize) {
  1208.       var g = e.initialize;
  1209.       e.initialize = function () {
  1210.         var a = g.apply(this, arguments);
  1211.         return f.initialize.apply(this, arguments),
  1212.         a
  1213.       }
  1214.     }
  1215.     return a
  1216.   },
  1217.   j.extractService = function (b, c) {
  1218.     var d = '[data-action^=' + c + ']',
  1219.     e = a(b);
  1220.     e = e.is(d) && e || e.closest(d);
  1221.     var f = e.attr('data-action') || ':',
  1222.     g = f.split(':') [1];
  1223.     return g
  1224.   },
  1225.   j.getConfigFromHash = function (a) {
  1226.     var d,
  1227.     e = a.location.hash;
  1228.     try {
  1229.       d = JSON.parse(decodeURIComponent(String(e).substr(1)))
  1230.     } catch (f) {
  1231.       c.debug('Failed to parse config from URL hash', f)
  1232.     }
  1233.     return b.isObject(d) ? d : {
  1234.     }
  1235.   };
  1236.   var m = /[<>]|:\/\//;
  1237.   return j.isPlainText = function (a) {
  1238.     return !a.match(m)
  1239.   },
  1240.   j.isDNTEnabled = function (a) {
  1241.     return a || (a = window),
  1242.     '1' === a.navigator.doNotTrack || 'yes' === a.navigator.doNotTrack || '1' === a.navigator.msDoNotTrack
  1243.   },
  1244.   j.shouldSample = function (a) {
  1245.     var b = parseInt(a, 10);
  1246.     return !!b && (!(b > 100) && Math.random() < b / 100)
  1247.   },
  1248.   j.decorate = function () {
  1249.     var a,
  1250.     c = b.toArray(arguments),
  1251.     d = c.pop();
  1252.     return b.isFunction(d) || (a = d, d = c.pop()),
  1253.     b.reduceRight(c, function (b, c) {
  1254.       return c.call(a || this, b)
  1255.     }, function () {
  1256.       return d.apply(a || this, arguments)
  1257.     })
  1258.   },
  1259.   j
  1260. }),
  1261. define('lounge/common', [
  1262. ], function () {
  1263.   'use strict';
  1264.   var a,
  1265.   b = function (b) {
  1266.     a = b
  1267.   },
  1268.   c = function () {
  1269.     return a
  1270.   };
  1271.   return {
  1272.     setLounge: b,
  1273.     getLounge: c
  1274.   }
  1275. });
  1276. var _extends = Object.assign || function (a) {
  1277.   for (var b = 1; b < arguments.length; b++) {
  1278.     var c = arguments[b];
  1279.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  1280.   }
  1281.   return a
  1282. };
  1283. define('lounge/tracking', [
  1284.   'jquery',
  1285.   'underscore',
  1286.   'raven',
  1287.   'core/analytics/identity',
  1288.   'core/analytics/jester',
  1289.   'core/bus',
  1290.   'common/urls',
  1291.   'core/switches',
  1292.   'core/utils',
  1293.   'core/utils/hash',
  1294.   'core/utils/url/serialize',
  1295.   'core/utils/isAdBlockEnabled',
  1296.   'core/utils/html/toRGBColorString',
  1297.   'remote/config',
  1298.   'common/utils',
  1299.   'common/main',
  1300.   'lounge/common'
  1301. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) {
  1302.   'use strict';
  1303.   function r(n, q) {
  1304.     function r(a, c, f) {
  1305.       var i = {
  1306.         abe: f ? '1' : '0',
  1307.         embed_hidden: q.config.isBehindClick ? '1' : '0',
  1308.         integration: q.config.integration,
  1309.         load_time: Number(new Date) - p.timings.initStart - (p.timings.renderStart && p.timings.bootstrapStart ? p.timings.renderStart - p.timings.bootstrapStart : 0)
  1310.       };
  1311.       if (h.isFeatureActive('init_embed_activity')) b.extend(i, {
  1312.         verb: 'load',
  1313.         object_type: 'product',
  1314.         object_id: 'embed'
  1315.       }),
  1316.       e.client.emit(i);
  1317.        else {
  1318.         var j = a.user.id,
  1319.         l = o.isDNTEnabled();
  1320.         b.extend(i, {
  1321.           event: 'init_embed',
  1322.           thread: C,
  1323.           forum: z,
  1324.           forum_id: A,
  1325.           imp: d.impression.impId,
  1326.           prev_imp: d.impression.prevImp,
  1327.           thread_slug: B.get('slug'),
  1328.           user_type: a.user.get('user_type') || 'anon',
  1329.           referrer: n.document.referrer,
  1330.           theme: 'next',
  1331.           dnt: l ? '1' : '0',
  1332.           tracking_enabled: c ? '1' : '0'
  1333.         }, q.config.experiment),
  1334.         j && '0' !== j && (i.user_id = j);
  1335.         var m = y.get('settings');
  1336.         m && b.has(m, 'adsProductLinksEnabled') && b.extend(i, {
  1337.           promoted_enabled: m.adsProductLinksEnabled,
  1338.           max_enabled: m.adsPositionTopEnabled
  1339.         }),
  1340.         (new n.Image).src = k(g.jester + '/event.gif', i, !1)
  1341.       }
  1342.       if (B.isModerator(a.user)) {
  1343.         var r = n.document.createElement('iframe');
  1344.         r.src = 'https://disqusads.com/enable-logging',
  1345.         r.style.display = 'none',
  1346.         n.document.body.appendChild(r)
  1347.       }
  1348.     }
  1349.     function t(a) {
  1350.       w = !0,
  1351.       x = a,
  1352.       s.shouldTrack(y, q.session.user) && (d.init({
  1353.       }, !0), s.load3rdParties(B, q))
  1354.     }
  1355.     var y = q.forum,
  1356.     z = y.id,
  1357.     A = y.get('pk'),
  1358.     B = q.thread,
  1359.     C = B.id;
  1360.     q.session.on('change:id', function (a) {
  1361.       e.client.set('user_id', a.id)
  1362.     }),
  1363.     q.session.once('change:id', function () {
  1364.       var b = this,
  1365.       c = s.shouldTrack(y, this.user),
  1366.       e = s.shouldTrack(y, this.user, !0);
  1367.       if (q.config.isPrivate && this.user && this.user.get('hasAcceptedGdprTerms') && d.init({
  1368.         isPrivate: !1
  1369.       }, !0), c && s.load3rdParties(B, q), !v && y.get('settings').adsEnabled && h.isFeatureActive('zyncOnly') && e) {
  1370.         var j = (new Date).getTime();
  1371.         a('body').append(a('<img>').hide().attr('src', g.zyncPixelImage + '&cid=c' + d.unique.value + '&cache_buster=' + j)),
  1372.         v = !0
  1373.       }
  1374.       l(function (a) {
  1375.         r(b, c, a)
  1376.       }),
  1377.       f.frame.sendHostMessage('tracking:init', {
  1378.         shouldTrack: c,
  1379.         isMobile: i.isMobileUserAgent(n),
  1380.         hostIdentityActive: h.isFeatureActive('hostIdentityActive', {
  1381.           forum: y.id,
  1382.           forum_percent: y.id
  1383.         }),
  1384.         liveConnectActive: e && h.isFeatureActive('liveConnectActive', {
  1385.           forum: y.id,
  1386.           forum_percent: y.id
  1387.         }),
  1388.         unique: d.unique.value
  1389.       })
  1390.     }),
  1391.     e.client.set({
  1392.       product: 'embed',
  1393.       thread: C,
  1394.       thread_id: C,
  1395.       forum: z,
  1396.       forum_id: A,
  1397.       zone: 'thread',
  1398.       version: p.version
  1399.     }),
  1400.     q.once('bootstrap:complete', function () {
  1401.       e.client.set({
  1402.         page_url: q.config.referrer
  1403.       });
  1404.       var a = q.config.experiment;
  1405.       a && e.client.set({
  1406.         experiment: a.experiment,
  1407.         variant: a.variant,
  1408.         service: a.service
  1409.       }),
  1410.       e.client.setHostReferrer(q.config.hostReferrer)
  1411.     });
  1412.     var D = {
  1413.       inViewport: function () {
  1414.         var c = q.config,
  1415.         d = {
  1416.           color_scheme: c.colorScheme,
  1417.           anchor_color: m(c.anchorColor),
  1418.           typeface: c.typeface,
  1419.           width: a(n.document).width()
  1420.         },
  1421.         f = {
  1422.           gpc: window.navigator.globalPrivacyControl ? 1 : 0
  1423.         };
  1424.         q.meta.topics && (f.topics = q.meta.topics.map(function (a) {
  1425.           return a.topic.toString()
  1426.         }).join(',')),
  1427.         d = b.pick(d, function (a, c) {
  1428.           switch (c) {
  1429.             case 'width':
  1430.               return b.isNumber(a);
  1431.             default:
  1432.               return b.isString(a) && '' !== a
  1433.           }
  1434.         }),
  1435.         e.client.emit({
  1436.           verb: 'view',
  1437.           object_type: 'product',
  1438.           object_id: 'embed',
  1439.           extra_data: JSON.stringify(_extends({
  1440.           }, d, f))
  1441.         }),
  1442.         q.off('inViewport')
  1443.       },
  1444.       'uiCallback:postCreated': function (a, c) {
  1445.         c = c || {
  1446.         },
  1447.         b.extend(c, {
  1448.           object_type: 'post',
  1449.           object_id: a.id,
  1450.           verb: 'post'
  1451.         }),
  1452.         a.has('parent') && (c.target_type = 'post', c.target_id = a.get('parent')),
  1453.         e.client.emit(c)
  1454.       },
  1455.       'uiCallback:postUpdated': function (a, c) {
  1456.         c = c || {
  1457.         },
  1458.         b.extend(c, {
  1459.           object_type: 'post',
  1460.           object_id: a.id,
  1461.           verb: 'update'
  1462.         }),
  1463.         e.client.emit(c)
  1464.       },
  1465.       'uiAction:postStartUpdate': function (a, c) {
  1466.         c = c || {
  1467.         },
  1468.         b.extend(c, {
  1469.           verb: 'click',
  1470.           adjective: 'edit',
  1471.           object_type: 'link',
  1472.           object_id: a.id
  1473.         }),
  1474.         e.client.emit(c)
  1475.       },
  1476.       'uiAction:seeMore': function (a) {
  1477.         e.client.emit({
  1478.           verb: 'open',
  1479.           object_type: 'section',
  1480.           object_id: 'thread/page-' + a
  1481.         })
  1482.       },
  1483.       'uiAction:seeMoreChildren': function (a) {
  1484.         e.client.emit({
  1485.           verb: 'click',
  1486.           object_type: 'link',
  1487.           object_id: 'show_more_comments',
  1488.           area: s.getEventTrackingArea(a)
  1489.         })
  1490.       },
  1491.       'uiAction:postUpvote': function (a, b) {
  1492.         e.client.emit({
  1493.           verb: 'like',
  1494.           object_type: 'post',
  1495.           object_id: a.id,
  1496.           area: s.getEventTrackingArea(b)
  1497.         })
  1498.       },
  1499.       'uiAction:postUnvote': function (a, b) {
  1500.         e.client.emit({
  1501.           verb: 'unlike',
  1502.           object_type: 'post',
  1503.           object_id: a.id,
  1504.           area: s.getEventTrackingArea(b)
  1505.         })
  1506.       },
  1507.       'uiAction:postDownvote': function (a, b) {
  1508.         e.client.emit({
  1509.           verb: 'dislike',
  1510.           object_type: 'post',
  1511.           object_id: a.id,
  1512.           area: s.getEventTrackingArea(b)
  1513.         })
  1514.       },
  1515.       'uiAction:threadUnlike': function () {
  1516.         e.client.emit({
  1517.           verb: 'unlike',
  1518.           object_type: 'thread',
  1519.           zone: 'thread'
  1520.         })
  1521.       },
  1522.       'uiAction:threadLike': function () {
  1523.         e.client.emit({
  1524.           verb: 'like',
  1525.           object_type: 'thread'
  1526.         })
  1527.       },
  1528.       'uiAction:postShare': function (a, b) {
  1529.         e.client.emit({
  1530.           verb: 'share',
  1531.           object_type: 'post',
  1532.           object_id: a.id,
  1533.           target_type: 'service',
  1534.           target_id: b
  1535.         })
  1536.       },
  1537.       'uiAction:threadShare': function (a) {
  1538.         e.client.emit({
  1539.           verb: 'share',
  1540.           object_type: 'thread',
  1541.           target_type: 'service',
  1542.           target_id: a
  1543.         })
  1544.       },
  1545.       'uiAction:clickLink': function (a, b) {
  1546.         e.client.emit({
  1547.           verb: 'click',
  1548.           object_type: 'link',
  1549.           object_id: a[0].href,
  1550.           area: s.getEventTrackingArea(b)
  1551.         })
  1552.       },
  1553.       'uiAction:followUser': function (a) {
  1554.         e.client.emit({
  1555.           verb: 'follow',
  1556.           object_type: 'user',
  1557.           object_id: a.id
  1558.         })
  1559.       },
  1560.       'uiAction:unfollowUser': function (a) {
  1561.         e.client.emit({
  1562.           verb: 'stop-following',
  1563.           object_type: 'user',
  1564.           object_id: a.id
  1565.         })
  1566.       },
  1567.       'uiAction:openLogin': function (a) {
  1568.         e.client.emit({
  1569.           verb: 'open',
  1570.           object_type: 'login',
  1571.           object_id: a
  1572.         })
  1573.       },
  1574.       'uiAction:onboardAlertShow': function () {
  1575.         e.client.emit({
  1576.           verb: 'view',
  1577.           object_type: 'area',
  1578.           object_id: 'onboard_alert'
  1579.         })
  1580.       },
  1581.       'uiAction:onboardAlertDismiss': function () {
  1582.         e.client.emit({
  1583.           verb: 'close',
  1584.           object_type: 'area',
  1585.           object_id: 'onboard_alert'
  1586.         })
  1587.       },
  1588.       'uiAction:openHome': function (a, b) {
  1589.         e.client.emit({
  1590.           verb: 'open',
  1591.           object_type: 'product',
  1592.           object_id: b ? 'bridge' : 'home',
  1593.           section: a
  1594.         })
  1595.       },
  1596.       'uiAction:viewBanUser': function () {
  1597.         e.client.emit({
  1598.           verb: 'view',
  1599.           object_type: 'area',
  1600.           object_id: 'ban_user'
  1601.         })
  1602.       },
  1603.       'uiAction:clickBanUser': function (a) {
  1604.         e.client.emit({
  1605.           verb: 'click',
  1606.           object_type: 'button',
  1607.           object_id: 'ban_user',
  1608.           extra_data: a
  1609.         })
  1610.       },
  1611.       'uiAction:viewFlagPost': function () {
  1612.         e.client.emit({
  1613.           verb: 'view',
  1614.           object_type: 'area',
  1615.           object_id: 'flag_post'
  1616.         })
  1617.       },
  1618.       'uiAction:clickFlagPost': function () {
  1619.         e.client.emit({
  1620.           verb: 'click',
  1621.           object_type: 'button',
  1622.           object_id: 'flag_post'
  1623.         })
  1624.       },
  1625.       'uiAction:viewBlockUser': function () {
  1626.         e.client.emit({
  1627.           verb: 'view',
  1628.           object_type: 'area',
  1629.           object_id: 'block_user'
  1630.         })
  1631.       },
  1632.       'uiAction:clickBlockUser': function () {
  1633.         e.client.emit({
  1634.           verb: 'click',
  1635.           object_type: 'button',
  1636.           object_id: 'block_user'
  1637.         })
  1638.       },
  1639.       'uiAction:viewUpgradeCard': function () {
  1640.         e.client.emit({
  1641.           verb: 'hover',
  1642.           object_type: 'icon',
  1643.           object_id: 'disqus_pro',
  1644.           organization_id: y.get('organizationId')
  1645.         })
  1646.       },
  1647.       'uiAction:clickUpgrade': function () {
  1648.         e.client.emit({
  1649.           verb: 'click',
  1650.           object_type: 'button',
  1651.           object_id: 'subscriptions',
  1652.           organization_id: y.get('organizationId')
  1653.         })
  1654.       },
  1655.       'uiAction:clickCommentPolicy': function (a) {
  1656.         e.client.emit({
  1657.           verb: 'click',
  1658.           object_type: 'link',
  1659.           section: 'comment_policy',
  1660.           object_id: a
  1661.         })
  1662.       },
  1663.       'uiAction:clickThreadPremoderate': function () {
  1664.         e.client.emit({
  1665.           verb: 'click',
  1666.           object_type: 'button',
  1667.           object_id: 'premoderate_thread'
  1668.         })
  1669.       },
  1670.       viewActivity: function (a, b) {
  1671.         var c = {
  1672.           verb: 'view',
  1673.           object_type: a,
  1674.           object_id: b
  1675.         };
  1676.         e.client.emit(c)
  1677.       },
  1678.       'uiAction:loadEmailSubscriptionPrompt': function (a) {
  1679.         e.client.emit({
  1680.           verb: 'load',
  1681.           object_type: 'section',
  1682.           object_id: 'email_subscriptions',
  1683.           section: 'email_subscriptions',
  1684.           extra_data: JSON.stringify({
  1685.             user_verified: Boolean(q.session.user && q.session.user.get('isVerified')),
  1686.             email_subscription_prompt: a
  1687.           })
  1688.         })
  1689.       },
  1690.       'uiAction:viewEmailSubscriptionPrompt': function (a) {
  1691.         e.client.emit({
  1692.           verb: 'view',
  1693.           object_type: 'section',
  1694.           object_id: 'email_subscriptions',
  1695.           section: 'email_subscriptions',
  1696.           extra_data: JSON.stringify({
  1697.             user_verified: Boolean(q.session.user && q.session.user.get('isVerified')),
  1698.             email_subscription_prompt: a
  1699.           })
  1700.         })
  1701.       },
  1702.       'uiAction:clickEmailSubscriptionPromptSubscribe': function (a) {
  1703.         e.client.emit({
  1704.           verb: 'click',
  1705.           object_type: 'button',
  1706.           object_id: 'subscribe',
  1707.           section: 'email_subscriptions',
  1708.           extra_data: JSON.stringify({
  1709.             user_verified: Boolean(q.session.user && q.session.user.get('isVerified')),
  1710.             email_subscription_prompt: a
  1711.           })
  1712.         })
  1713.       },
  1714.       'uiAction:clickEmailSubscriptionPromptDismiss': function (a) {
  1715.         e.client.emit({
  1716.           verb: 'click',
  1717.           object_type: 'button',
  1718.           object_id: 'hide_this_message',
  1719.           section: 'email_subscriptions',
  1720.           extra_data: JSON.stringify({
  1721.             user_verified: Boolean(q.session.user && q.session.user.get('isVerified')),
  1722.             email_subscription_prompt: a
  1723.           })
  1724.         })
  1725.       },
  1726.       'uiAction:viewReactionsPromotion': function () {
  1727.         e.client.emit({
  1728.           verb: 'view',
  1729.           object_type: 'section',
  1730.           object_id: 'reactions_onboarding',
  1731.           zone: 'thread',
  1732.           section: 'reactions_onboarding'
  1733.         })
  1734.       },
  1735.       'uiAction:reactionsEnable': function () {
  1736.         e.client.emit({
  1737.           verb: 'click',
  1738.           object_type: 'button',
  1739.           object_id: 'enable_reactions',
  1740.           zone: 'thread',
  1741.           section: 'reactions_onboarding'
  1742.         })
  1743.       },
  1744.       'uiAction:reactionsDefer': function () {
  1745.         e.client.emit({
  1746.           verb: 'click',
  1747.           object_type: 'button',
  1748.           object_id: 'maybe_later',
  1749.           zone: 'thread',
  1750.           section: 'reactions_onboarding'
  1751.         })
  1752.       },
  1753.       'uiAction:reactionsVote': function (a) {
  1754.         e.client.emit({
  1755.           verb: 'vote',
  1756.           object_type: 'thread',
  1757.           adjective: a.get('text'),
  1758.           zone: 'thread',
  1759.           section: 'reactions',
  1760.           extra_data: JSON.stringify({
  1761.             reaction_id: a.id
  1762.           })
  1763.         })
  1764.       },
  1765.       'uiAction:gifsClickButton': function () {
  1766.         e.client.emit({
  1767.           verb: 'click',
  1768.           object_type: 'button',
  1769.           adjective: 'gif_picker',
  1770.           object_id: 'thread',
  1771.           zone: 'thread'
  1772.         })
  1773.       },
  1774.       'uiAction:gifsScrollToBottom': function () {
  1775.         e.client.emit({
  1776.           verb: 'view',
  1777.           adverb: 'results',
  1778.           object_type: 'zone',
  1779.           adjective: 'end',
  1780.           object_id: 'thread',
  1781.           zone: 'thread'
  1782.         })
  1783.       },
  1784.       'uiAction:loadLiveComments': function () {
  1785.         e.client.emit({
  1786.           verb: 'click',
  1787.           adverb: 'comments',
  1788.           object_type: 'notification',
  1789.           adjective: 'realtime',
  1790.           object_id: 'thread',
  1791.           zone: 'thread'
  1792.         })
  1793.       },
  1794.       'uiAction:loadLiveReplies': function () {
  1795.         e.client.emit({
  1796.           verb: 'click',
  1797.           adverb: 'replies',
  1798.           object_type: 'notification',
  1799.           adjective: 'realtime',
  1800.           object_id: 'thread',
  1801.           zone: 'thread'
  1802.         })
  1803.       },
  1804.       'uiAction:clickBadge': function (a, b) {
  1805.         e.client.emit({
  1806.           verb: 'click',
  1807.           object_type: 'badge',
  1808.           object_id: b,
  1809.           section: 'profile/badges',
  1810.           zone: 'thread',
  1811.           area: s.getEventTrackingArea(a)
  1812.         })
  1813.       },
  1814.       'uiAction:viewBadgeModal': function () {
  1815.         e.client.emit({
  1816.           verb: 'view',
  1817.           object_type: 'modal',
  1818.           object_id: 'badge',
  1819.           section: 'manage_badges',
  1820.           zone: 'thread'
  1821.         })
  1822.       },
  1823.       'uiAction:awardBadge': function (a) {
  1824.         e.client.emit({
  1825.           verb: 'award',
  1826.           object_type: 'badge',
  1827.           object_id: a,
  1828.           section: 'manage_badges',
  1829.           zone: 'thread'
  1830.         })
  1831.       },
  1832.       'uiAction:removeBadge': function (a) {
  1833.         e.client.emit({
  1834.           verb: 'remove',
  1835.           object_type: 'badge',
  1836.           object_id: a,
  1837.           section: 'manage_badges',
  1838.           zone: 'thread'
  1839.         })
  1840.       },
  1841.       'uiAction:behindClickButton': function () {
  1842.         e.client.emit({
  1843.           verb: 'click',
  1844.           object_type: 'button',
  1845.           adjective: 'behind_click',
  1846.           object_id: 'thread',
  1847.           zone: 'thread'
  1848.         })
  1849.       },
  1850.       'uiAction:toggleClassicDisqus': function (a) {
  1851.         e.client.emit({
  1852.           verb: 'click',
  1853.           object_type: 'button',
  1854.           adjective: a,
  1855.           object_id: 'toggle_classic_disqus',
  1856.           zone: 'thread'
  1857.         })
  1858.       }
  1859.     };
  1860.     q.on(D),
  1861.     f.on(D),
  1862.     f.frame.once('cmp.consent', t),
  1863.     f.frame.once('tracking.hostIdentity', function (b) {
  1864.       if (!u) {
  1865.         var e = [
  1866.           j.calculate(b.domain),
  1867.           b.id,
  1868.           d.unique.value
  1869.         ],
  1870.         f = a('body'),
  1871.         h = g.logger + '/1/' + n.btoa(JSON.stringify(e));
  1872.         try {
  1873.           f.append(a('<img>').hide().attr('src', h))
  1874.         } catch (i) {
  1875.           c.captureException(i)
  1876.         }
  1877.         u = !0
  1878.       }
  1879.     })
  1880.   }
  1881.   var s = {
  1882.   },
  1883.   t = !1,
  1884.   u = !1,
  1885.   v = !1,
  1886.   w = !1,
  1887.   x = {
  1888.   };
  1889.   return s.init = function (a) {
  1890.     r(window, a)
  1891.   },
  1892.   s.getEventTrackingArea = function (b) {
  1893.     return a(b.currentTarget).closest('[data-tracking-area]').attr('data-tracking-area')
  1894.   },
  1895.   s.load3rdParties = function (d, f) {
  1896.     if (g.glitter && !t) {
  1897.       var h = n.lounge.tracking || {
  1898.       },
  1899.       i = h.iframe_limit || 0,
  1900.       j = {
  1901.         postCount: d.get('posts') || 0,
  1902.         likeCount: d.get('likes') || 0,
  1903.         postVoteCount: b.reduce(d.posts.pluck('likes'), function (a, b) {
  1904.           return a + b
  1905.         }, 0),
  1906.         referrer: encodeURIComponent(f.config.referrer),
  1907.         tcString: x.tcString || ''
  1908.       };
  1909.       a.ajax({
  1910.         dataType: 'jsonp',
  1911.         cache: !0,
  1912.         url: g.glitter,
  1913.         data: {
  1914.           forum_shortname: d.forum.id,
  1915.           thread_id: d.id,
  1916.           referer: f.config.hostReferrer,
  1917.           tc: x.tcString || ''
  1918.         },
  1919.         jsonpCallback: 'dsqGlitterResponseHandler',
  1920.         success: function (d) {
  1921.           var f = a('body');
  1922.           b.each(d, function (d) {
  1923.             if (!('img' !== d.type && 'iframe' !== d.type || 'iframe' === d.type && (i -= 1, i < 0))) {
  1924.               var g;
  1925.               try {
  1926.                 g = d.url.replace(/\{\{(.+?)\}\}/g, function (a, c) {
  1927.                   var d = c.trim();
  1928.                   if (!j.hasOwnProperty(d)) throw new Error('Unknown template variable in tracker URL: ' + d);
  1929.                   return b.escape(j[d])
  1930.                 });
  1931.                 var h = a('<' + d.type + '>').hide().attr('src', g);
  1932.                 d.logging && h.on('load', function () {
  1933.                   e.logStat('glitter.loaded.' + d.logging)
  1934.                 }),
  1935.                 f.append(h)
  1936.               } catch (k) {
  1937.                 c.captureException(k)
  1938.               }
  1939.             }
  1940.           })
  1941.         },
  1942.         error: function () {
  1943.           e.logStat('glitter.error')
  1944.         }
  1945.       }),
  1946.       t = !0
  1947.     }
  1948.   },
  1949.   s.shouldTrack = function (a, b) {
  1950.     var c = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
  1951.     return !(Boolean(a && a.get('settings').disable3rdPartyTrackers ^ c) || b && b.get('disable3rdPartyTrackers') || '1' === o.cookies.read('disqus_tracking_optout') || o.isDNTEnabled() || s.isPrivate(b))
  1952.   },
  1953.   s.isPrivate = function (a) {
  1954.     return q.getLounge().config.isPrivate && (!a || !a.get('hasAcceptedGdprTerms')) && !w
  1955.   },
  1956.   s.reset = function () {
  1957.     t = !1,
  1958.     u = !1,
  1959.     v = !1,
  1960.     w = !1,
  1961.     x = {
  1962.     }
  1963.   },
  1964.   s
  1965. }),
  1966. define('common/jsxUtils', [
  1967.   'underscore'
  1968. ], function (a) {
  1969.   'use strict';
  1970.   return {
  1971.     append: function (b, c) {
  1972.       var d = function e(c) {
  1973.         if (null !== c) return a.isArray(c) ? void c.forEach(e) : a.isElement(c) || c && c.nodeType === window.Node.DOCUMENT_FRAGMENT_NODE ? void b.appendChild(c) : void b.appendChild(window.document.createTextNode(c))
  1974.       };
  1975.       d(c)
  1976.     }
  1977.   }
  1978. });
  1979. var _extends = Object.assign || function (a) {
  1980.   for (var b = 1; b < arguments.length; b++) {
  1981.     var c = arguments[b];
  1982.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  1983.   }
  1984.   return a
  1985. };
  1986. define('react', [
  1987.   'jquery',
  1988.   'underscore',
  1989.   'common/jsxUtils'
  1990. ], function (a, b, c) {
  1991.   'use strict';
  1992.   var d = window.document;
  1993.   return {
  1994.     createElement: function (e, f) {
  1995.       for (var g = arguments.length, h = Array(g > 2 ? g - 2 : 0), i = 2; i < g; i++) h[i - 2] = arguments[i];
  1996.       if ('function' == typeof e) {
  1997.         h.length > 0 && (f = _extends({
  1998.           children: 1 === h.length ? h[0] : h
  1999.         }, f));
  2000.         var j = e(f);
  2001.         if (b.isArray(j)) {
  2002.           var k = d.createDocumentFragment();
  2003.           return c.append(k, j),
  2004.           k
  2005.         }
  2006.         return j
  2007.       }
  2008.       if ('string' != typeof e) throw new Error('Unknown type');
  2009.       var l = d.createElement(e),
  2010.       m = !1;
  2011.       return f && Object.keys(f).forEach(function (b) {
  2012.         var c = f[b];
  2013.         if (/^(?:data-|aria-|role$)/.test(b)) null !== c && l.setAttribute(b, c);
  2014.          else if ('dangerouslySetInnerHTML' === b) m = !0,
  2015.         l.innerHTML = c && c.__html || '';
  2016.          else if ('style' === b) Object.keys(c).forEach(function (a) {
  2017.           l.style[a] = c[a]
  2018.         });
  2019.          else if (/^on[A-Z]/.test(b)) c && a(l).on(b.slice(2).toLowerCase(), c);
  2020.          else if ('key' === b);
  2021.          else try {
  2022.           l[b] = c
  2023.         } catch (d) {
  2024.         }
  2025.       }),
  2026.       m || c.append(l, h),
  2027.       l
  2028.     }
  2029.   }
  2030. }),
  2031. define('react-dom', [
  2032.   'common/jsxUtils'
  2033. ], function (a) {
  2034.   'use strict';
  2035.   return {
  2036.     render: function (b, c, d) {
  2037.       return c && (c.innerHTML = '', a.append(c, b)),
  2038.       d && d(),
  2039.       null
  2040.     }
  2041.   }
  2042. }),
  2043. define('core/shared/urls', [
  2044.   'require',
  2045.   'core/utils/object/extend',
  2046.   'core/utils/url/serialize',
  2047.   'core/utils/url/serializeArgs'
  2048. ], function (a) {
  2049.   'use strict';
  2050.   var b = a('core/utils/object/extend'),
  2051.   c = a('core/utils/url/serialize'),
  2052.   d = a('core/utils/url/serializeArgs'),
  2053.   e = 'default',
  2054.   f = {
  2055.     lounge: 'http://disqus.com/embed/comments/',
  2056.     home: 'https://disqus.com/home/'.replace('home/', ''),
  2057.     recommendations: 'http://disqus.com/recommendations/'
  2058.   },
  2059.   g = function (a) {
  2060.     return 'https://' + a.replace(/^\s*(\w+:)?\/\//, '')
  2061.   },
  2062.   h = function (a, h, i, j) {
  2063.     var k = f[a];
  2064.     if (!k) throw new Error('Unknown app: ' + a);
  2065.     'preview' === e && j && (e += '-' + j);
  2066.     var l = g(k),
  2067.     m = b({
  2068.       base: e
  2069.     }, h || {
  2070.     }),
  2071.     n = i ? '#' + d(i) : '';
  2072.     return c(l, m) + n
  2073.   };
  2074.   return {
  2075.     BASE: e,
  2076.     apps: f,
  2077.     get: h,
  2078.     ensureHTTPSProtocol: g
  2079.   }
  2080. }),
  2081. define('core/apps/BaseApp', [
  2082.   'require',
  2083.   'core/Events',
  2084.   'core/utils/object/extend',
  2085.   'core/utils/object/has',
  2086.   'core/utils/uniqueId'
  2087. ], function (a) {
  2088.   'use strict';
  2089.   var b = a('core/Events'),
  2090.   c = a('core/utils/object/extend'),
  2091.   d = a('core/utils/object/has'),
  2092.   e = a('core/utils/uniqueId'),
  2093.   f = function (a) {
  2094.     this.uid = e('dsq-app'),
  2095.     this.settings = a || {
  2096.     };
  2097.     var b = [
  2098.     ],
  2099.     c = this.constructor.prototype;
  2100.     do b.unshift(c),
  2101.     c = c.constructor.__super__;
  2102.     while (c);
  2103.     for (var f = 0, g = b.length; f < g; f++) c = b[f],
  2104.     d(c, 'events') && this.on(c.events, this),
  2105.     d(c, 'onceEvents') && this.once(c.onceEvents, this)
  2106.   };
  2107.   return c(f.prototype, b),
  2108.   f.prototype.destroy = function () {
  2109.     this.off(),
  2110.     this.stopListening()
  2111.   },
  2112.   f.extend = function (a, b) {
  2113.     var e,
  2114.     f = this;
  2115.     e = a && d(a, 'constructor') ? a.constructor : function () {
  2116.       return f.apply(this, arguments)
  2117.     },
  2118.     c(e, f, b);
  2119.     var g = function () {
  2120.       this.constructor = e
  2121.     };
  2122.     return g.prototype = f.prototype,
  2123.     e.prototype = new g,
  2124.     a && c(e.prototype, a),
  2125.     e.__super__ = f.prototype,
  2126.     e
  2127.   },
  2128.   f
  2129. }),
  2130. define('core/common/kernel/utils', [
  2131.   'require'
  2132. ], function (a) {
  2133.   'use strict';
  2134.   function b(a) {
  2135.     return e.getElementById(a) || e.body || e.documentElement
  2136.   }
  2137.   function c(a) {
  2138.     return f.href = a,
  2139.     f.hostname
  2140.   }
  2141.   function d(a, b) {
  2142.     b = b || e.documentElement;
  2143.     for (var c = a, d = 0, f = 0; c && c !== b; ) d += c.offsetLeft,
  2144.     f += c.offsetTop,
  2145.     c = c.offsetParent;
  2146.     return {
  2147.       top: f,
  2148.       left: d,
  2149.       height: a.offsetHeight,
  2150.       width: a.offsetWidth
  2151.     }
  2152.   }
  2153.   var e = window.document,
  2154.   f = e.createElement('a');
  2155.   return {
  2156.     getContainer: b,
  2157.     getHost: c,
  2158.     getOffset: d
  2159.   }
  2160. }),
  2161. define('core/host/json', [
  2162.   'require',
  2163.   'core/host/globalFromSandbox'
  2164. ], function (a) {
  2165.   'use strict';
  2166.   var b,
  2167.   c = window,
  2168.   d = a('core/host/globalFromSandbox');
  2169.   return b = '[object JSON]' === c.Object.prototype.toString.call(c.JSON) ? c.JSON : d('JSON', c),
  2170.   b ? b : {
  2171.   }
  2172. }),
  2173. define('core/common/kernel/WindowBase', [
  2174.   'require',
  2175.   'core/Events',
  2176.   'core/utils/object/extend',
  2177.   'core/utils/uniqueId',
  2178.   'core/common/kernel/utils',
  2179.   'core/host/json'
  2180. ], function (a) {
  2181.   'use strict';
  2182.   var b = a('core/Events'),
  2183.   c = a('core/utils/object/extend'),
  2184.   d = a('core/utils/uniqueId'),
  2185.   e = a('core/common/kernel/utils'),
  2186.   f = a('core/host/json'),
  2187.   g = function (a) {
  2188.     a = a || {
  2189.     },
  2190.     this.state = g.INIT,
  2191.     this.uid = a.uid || d('dsq-frame'),
  2192.     this.origin = a.origin,
  2193.     a.useSourcelessFrame ? this.host = e.getHost(window.location.href) : this.host = e.getHost(this.origin),
  2194.     this.target = a.target,
  2195.     this.sandbox = a.sandbox,
  2196.     this.window = null,
  2197.     g.windows[this.uid] = this,
  2198.     this.on('ready', function () {
  2199.       this.state = g.READY
  2200.     }, this),
  2201.     this.on('die', function () {
  2202.       this.state = g.KILLED
  2203.     }, this)
  2204.   };
  2205.   return c(g, {
  2206.     INIT: 0,
  2207.     READY: 1,
  2208.     KILLED: 2,
  2209.     windows: {
  2210.     },
  2211.     postMessage: function (a, b, c) {
  2212.       return a.postMessage(b, c)
  2213.     }
  2214.   }),
  2215.   c(g.prototype, b),
  2216.   g.prototype.requiresWindow = function (a) {
  2217.     var b = this;
  2218.     return function () {
  2219.       var c = Array.prototype.slice.call(arguments),
  2220.       d = function () {
  2221.         var e = b.window;
  2222.         e ? a.apply(b, c) : setTimeout(d, 500)
  2223.       };
  2224.       b.isReady() ? d() : b.on('ready', d)
  2225.     }
  2226.   },
  2227.   g.prototype.sendMessage = function (a, b) {
  2228.     var c = f.stringify({
  2229.       scope: 'client',
  2230.       name: a,
  2231.       data: b
  2232.     });
  2233.     this.requiresWindow(function (a) {
  2234.       g.postMessage(this.window, a, this.origin)
  2235.     }) (c)
  2236.   },
  2237.   g.prototype.hide = function () {
  2238.   },
  2239.   g.prototype.show = function () {
  2240.   },
  2241.   g.prototype.url = function () {
  2242.     return this.target
  2243.   },
  2244.   g.prototype.destroy = function () {
  2245.     this.state = g.KILLED,
  2246.     this.off()
  2247.   },
  2248.   g.prototype.isReady = function () {
  2249.     return this.state === g.READY
  2250.   },
  2251.   g.prototype.isKilled = function () {
  2252.     return this.state === g.KILLED
  2253.   },
  2254.   g
  2255. }),
  2256. define('core/common/kernel/Iframe', [
  2257.   'require',
  2258.   'core/utils/html/setInlineStyle',
  2259.   'core/utils/object/extend',
  2260.   'core/common/kernel/WindowBase',
  2261.   'core/common/kernel/utils'
  2262. ], function (a) {
  2263.   'use strict';
  2264.   var b = a('core/utils/html/setInlineStyle'),
  2265.   c = a('core/utils/object/extend'),
  2266.   d = a('core/common/kernel/WindowBase'),
  2267.   e = a('core/common/kernel/utils'),
  2268.   f = window.document,
  2269.   g = function (a) {
  2270.     d.call(this, a),
  2271.     this.styles = a.styles || {
  2272.     },
  2273.     this.tabIndex = a.tabIndex || 0,
  2274.     this.title = a.title || 'Disqus',
  2275.     this.sandbox = a.sandbox,
  2276.     this.container = a.container,
  2277.     this.elem = null
  2278.   };
  2279.   return c(g.prototype, d.prototype),
  2280.   g.prototype.load = function () {
  2281.     var a = this.elem = f.createElement('iframe');
  2282.     a.setAttribute('id', this.uid),
  2283.     a.setAttribute('name', this.uid),
  2284.     a.setAttribute('allowTransparency', 'true'),
  2285.     a.setAttribute('frameBorder', '0'),
  2286.     a.setAttribute('scrolling', 'no'),
  2287.     this.role && a.setAttribute('role', this.role),
  2288.     a.setAttribute('tabindex', this.tabIndex),
  2289.     a.setAttribute('title', this.title),
  2290.     'string' == typeof this.sandbox && a.setAttribute('sandbox', this.sandbox),
  2291.     this.setInlineStyle(this.styles)
  2292.   },
  2293.   g.prototype.getOffset = function (a) {
  2294.     return e.getOffset(this.elem, a)
  2295.   },
  2296.   g.prototype.setInlineStyle = function (a, c) {
  2297.     return b(this.elem, a, c)
  2298.   },
  2299.   g.prototype.removeInlineStyle = function (a) {
  2300.     var b = this.elem.style;
  2301.     return 'removeProperty' in b ? void b.removeProperty(a) : void (b[a] = '')
  2302.   },
  2303.   g.prototype.hide = function () {
  2304.     this.setInlineStyle('display', 'none')
  2305.   },
  2306.   g.prototype.show = function () {
  2307.     this.removeInlineStyle('display')
  2308.   },
  2309.   g.prototype.destroy = function () {
  2310.     return this.elem && this.elem.parentNode && (this.elem.parentNode.removeChild(this.elem), this.elem = null),
  2311.     d.prototype.destroy.call(this)
  2312.   },
  2313.   g
  2314. }),
  2315. define('core/host/kernel', [
  2316.   'require',
  2317.   'exports',
  2318.   'module',
  2319.   'core/Events',
  2320.   'core/utils/lang/isString',
  2321.   'core/utils/object/has',
  2322.   'core/utils/object/extend',
  2323.   'core/common/kernel/Iframe',
  2324.   'core/common/kernel/utils',
  2325.   'core/common/kernel/WindowBase',
  2326.   'core/host/json',
  2327.   'core/utils/function/throttle'
  2328. ], function (a, b) {
  2329.   'use strict';
  2330.   var c = a('core/Events'),
  2331.   d = a('core/utils/lang/isString'),
  2332.   e = a('core/utils/object/has'),
  2333.   f = a('core/utils/object/extend'),
  2334.   g = a('core/common/kernel/Iframe'),
  2335.   h = a('core/common/kernel/utils'),
  2336.   i = a('core/common/kernel/WindowBase'),
  2337.   j = a('core/host/json'),
  2338.   k = window.document;
  2339.   b.throttle = a('core/utils/function/throttle'),
  2340.   window.addEventListener('message', function (a) {
  2341.     var c;
  2342.     try {
  2343.       c = j.parse(a.data)
  2344.     } catch (d) {
  2345.       return
  2346.     }
  2347.     var f = c.sender,
  2348.     g = e(i.windows, f) && i.windows[f];
  2349.     g && h.getHost(a.origin) === g.host && (a.origin !== g.origin && (g.origin = a.origin), 'host' === c.scope && g.trigger(c.name, c.data), 'error' === c.name && b.trigger('error', c.data))
  2350.   }),
  2351.   window.addEventListener('hashchange', function () {
  2352.     b.trigger('window.hashchange', {
  2353.       hash: window.location.hash
  2354.     })
  2355.   }),
  2356.   window.addEventListener('resize', b.throttle(function () {
  2357.     b.trigger('window.resize')
  2358.   }, 250, 50)),
  2359.   k.addEventListener('mousemove', b.throttle(function () {
  2360.     b.trigger('window.mousemove')
  2361.   }, 250, 50));
  2362.   var l = function () {
  2363.     b.trigger('window.scroll')
  2364.   };
  2365.   window.addEventListener('scroll', b.throttle(l, 250, 50), !1),
  2366.   k.addEventListener('click', function () {
  2367.     b.trigger('window.click')
  2368.   });
  2369.   var m = b.Popup = function (a) {
  2370.     a.uid = a.windowName,
  2371.     i.call(this, a)
  2372.   };
  2373.   f(m.prototype, i.prototype),
  2374.   m.prototype.load = function () {
  2375.     var a = this.window = window.open('', this.uid || '_blank');
  2376.     a.location = this.url()
  2377.   },
  2378.   m.prototype.isKilled = function () {
  2379.     return i.prototype.isKilled() || this.window.closed
  2380.   };
  2381.   var n = b.Channel = function (a) {
  2382.     var b = this;
  2383.     b.window = null,
  2384.     g.call(b, a),
  2385.     this.insertBeforeEl = a.insertBeforeEl,
  2386.     this.insertAfterEl = a.insertAfterEl,
  2387.     b.useSourcelessFrame = a.useSourcelessFrame,
  2388.     b.styles = f({
  2389.       width: '1px',
  2390.       'min-width': '100%',
  2391.       border: 'none',
  2392.       overflow: 'hidden',
  2393.       height: '0'
  2394.     }, a.styles || {
  2395.     })
  2396.   };
  2397.   f(n.prototype, g.prototype),
  2398.   n.prototype.load = function (a) {
  2399.     var b = this;
  2400.     g.prototype.load.call(b);
  2401.     var c = b.elem;
  2402.     if (c.setAttribute('width', '100%'), b.useSourcelessFrame) {
  2403.       var e = function () {
  2404.         var a = new window.XMLHttpRequest;
  2405.         a.open('GET', b.url()),
  2406.         a.onreadystatechange = function () {
  2407.           c.contentWindow && a.readyState === c.contentWindow.XMLHttpRequest.DONE && 200 === a.status && (c.contentWindow.document.open(), c.contentWindow.document.write(a.responseText), c.contentWindow.document.close())
  2408.         },
  2409.         a.send()
  2410.       };
  2411.       b.on('redirect', function (a) {
  2412.         b.target = a,
  2413.         e()
  2414.       }),
  2415.       e()
  2416.     } else c.setAttribute('src', b.url());
  2417.     c.addEventListener('load', function () {
  2418.       b.window = c.contentWindow,
  2419.       a && a()
  2420.     });
  2421.     var f = d(b.container) ? h.getContainer(b.container) : b.container,
  2422.     i = (b.insertAfterEl ? b.insertAfterEl.nextSibling : b.insertBeforeEl) || null;
  2423.     f.insertBefore(c, i)
  2424.   },
  2425.   n.prototype.destroy = function () {
  2426.     return this.window = null,
  2427.     g.prototype.destroy.call(this)
  2428.   },
  2429.   b.on = c.on,
  2430.   b.off = c.off,
  2431.   b.trigger = c.trigger
  2432. }),
  2433. define('core/apps/WindowedApp', [
  2434.   'require',
  2435.   'core/utils/object/extend',
  2436.   'core/shared/urls',
  2437.   'core/apps/BaseApp',
  2438.   'core/host/kernel'
  2439. ], function (a) {
  2440.   'use strict';
  2441.   var b = a('core/utils/object/extend'),
  2442.   c = a('core/shared/urls'),
  2443.   d = a('core/apps/BaseApp'),
  2444.   e = a('core/host/kernel'),
  2445.   f = window.document,
  2446.   g = d.extend({
  2447.     name: null,
  2448.     loaderVersion: null,
  2449.     frame: null,
  2450.     origin: c.ensureHTTPSProtocol('https://disqus.com'),
  2451.     state: null,
  2452.     getUrl: function (a, d) {
  2453.       return this.loaderVersion && (d = b({
  2454.         version: this.loaderVersion
  2455.       }, d)),
  2456.       c.ensureHTTPSProtocol(c.get(this.name, a, d, this.settings.previewVersion))
  2457.     },
  2458.     getFrameSettings: function () {
  2459.       var a = {
  2460.         target: this.getUrl(),
  2461.         origin: this.origin,
  2462.         uid: this.uid,
  2463.         sandbox: this.sandbox
  2464.       },
  2465.       b = this.settings;
  2466.       return b.windowName ? a.windowName = b.windowName : a.container = b.container || f.body,
  2467.       b.styles && (a.styles = b.styles),
  2468.       a.useSourcelessFrame = b.useSourcelessFrame,
  2469.       a
  2470.     },
  2471.     getFrame: function () {
  2472.       var a = this.getFrameSettings(),
  2473.       b = a.windowName ? e.Popup : e.Channel;
  2474.       return new b(a)
  2475.     },
  2476.     setState: function (a) {
  2477.       var b = this.constructor;
  2478.       return a in b.states && (this.state = b.states[a], void this.trigger('state:' + a))
  2479.     },
  2480.     init: function () {
  2481.       var a,
  2482.       b = this;
  2483.       b.frame = a = this.getFrame(),
  2484.       b.listenTo(a, 'all', function (c, d) {
  2485.         b.trigger('frame:' + c, d, a)
  2486.       }),
  2487.       b.listenTo(a, 'resize', function (a) {
  2488.         b.lastResizedHeight = a.height
  2489.       }),
  2490.       b.trigger('change:frame', a),
  2491.       b.frame.load(function () {
  2492.         b.setState('LOADED')
  2493.       }),
  2494.       b.setState('INIT')
  2495.     },
  2496.     destroy: function () {
  2497.       var a = this.frame;
  2498.       a && (this.stopListening(a), a.destroy()),
  2499.       this.setState('KILLED'),
  2500.       this.frame = null,
  2501.       d.prototype.destroy.call(this)
  2502.     },
  2503.     events: {
  2504.       'frame:ready': function () {
  2505.         this.setState('READY')
  2506.       }
  2507.     }
  2508.   }, {
  2509.     states: {
  2510.       INIT: 0,
  2511.       LOADED: 1,
  2512.       READY: 2,
  2513.       RUNNING: 3,
  2514.       KILLED: 4
  2515.     }
  2516.   });
  2517.   return g
  2518. }),
  2519. define('core/utils/OnceTimer', [
  2520.   'require',
  2521.   'exports',
  2522.   'module'
  2523. ], function (a, b, c) {
  2524.   'use strict';
  2525.   c.exports = function (a, b) {
  2526.     var c = null,
  2527.     d = !1;
  2528.     this.start = function () {
  2529.       d || (c = setTimeout(function () {
  2530.         d = !0,
  2531.         a()
  2532.       }, b))
  2533.     },
  2534.     this.clear = function () {
  2535.       clearTimeout(c)
  2536.     }
  2537.   }
  2538. }),
  2539. define('core/utils/html/toHexColorString', [
  2540. ], function () {
  2541.   'use strict';
  2542.   function a(a) {
  2543.     if (a = Number(a), isNaN(a) || a > 255) throw new Error('Color components should be numbers less than 256');
  2544.     return a = a.toString(16),
  2545.     1 === a.length ? '0' + a : String(a)
  2546.   }
  2547.   return function (b) {
  2548.     return '#' + a(b.red) + a(b.green) + a(b.blue)
  2549.   }
  2550. }),
  2551. define('core/utils/sandbox', [
  2552. ], function () {
  2553.   'use strict';
  2554.   var a = [
  2555.     'allow-forms',
  2556.     'allow-pointer-lock',
  2557.     'allow-popups',
  2558.     'allow-same-origin',
  2559.     'allow-scripts',
  2560.     'allow-top-navigation'
  2561.   ],
  2562.   b = function (b) {
  2563.     return b ? a.reduce(function (a, c) {
  2564.       return b[c] && (a += c + ' '),
  2565.       a
  2566.     }, '').trim() : ''
  2567.   };
  2568.   return {
  2569.     getAttribute: b
  2570.   }
  2571. }),
  2572. define('core/utils/url/parseQueryString', [
  2573.   'core/utils/collection/each'
  2574. ], function (a) {
  2575.   'use strict';
  2576.   return function (b) {
  2577.     'undefined' == typeof b && (b = window.location.search);
  2578.     var c = {
  2579.     };
  2580.     return a(b.substr(1).split('&'), function (a) {
  2581.       var b = a.split('=').map(function (a) {
  2582.         return decodeURIComponent(a.replace(/\+/g, '%20'))
  2583.       });
  2584.       b[0] && (c[b[0]] = b[1])
  2585.     }),
  2586.     c
  2587.   }
  2588. }),
  2589. define('core/analytics/reporting', [
  2590.   'require',
  2591.   'core/utils/collection/each',
  2592.   'core/utils/url/serialize',
  2593.   'core/config/urls'
  2594. ], function (a) {
  2595.   'use strict';
  2596.   function b(a) {
  2597.     var b = a.split('.'),
  2598.     c = b.length > 2 ? b[b.length - 2] : '';
  2599.     return c.match(/^[0-9a-f]{32}$/i) && c
  2600.   }
  2601.   function c(a) {
  2602.     (new window.Image).src = g(i + '/stat.gif', {
  2603.       event: a
  2604.     })
  2605.   }
  2606.   function d(a) {
  2607.     (new window.Image).src = g(i + '/event.gif', a)
  2608.   }
  2609.   function e(a) {
  2610.     var b = new window.URLSearchParams;
  2611.     f(a, function (a, c) {
  2612.       void 0 !== a && b.append(c, a)
  2613.     });
  2614.     var c = new window.XMLHttpRequest;
  2615.     c.open('POST', i + '/event.json', !0),
  2616.     c.withCredentials = !0,
  2617.     c.send(b)
  2618.   }
  2619.   var f = a('core/utils/collection/each'),
  2620.   g = a('core/utils/url/serialize'),
  2621.   h = a('core/config/urls'),
  2622.   i = h.jester;
  2623.   return {
  2624.     getLoaderVersionFromUrl: b,
  2625.     logStat: c,
  2626.     reportJester: d,
  2627.     reportJesterPOST: e
  2628.   }
  2629. }),
  2630. define('core/ads/safeFrameUtils', [
  2631. ], function () {
  2632.   'use strict';
  2633.   var a = function (a) {
  2634.     return null !== a && !isNaN(Number(a)) && isFinite(a)
  2635.   },
  2636.   b = function (a) {
  2637.     return Math.min.apply(Math, _toConsumableArray(a)) || 0
  2638.   },
  2639.   c = function (a) {
  2640.     return Math.max.apply(Math, _toConsumableArray(a)) || 0
  2641.   };
  2642.   return {
  2643.     min: b,
  2644.     max: c,
  2645.     isNumeric: a
  2646.   }
  2647. });
  2648. var _createClass = function () {
  2649.   function a(a, b) {
  2650.     for (var c = 0; c < b.length; c++) {
  2651.       var d = b[c];
  2652.       d.enumerable = d.enumerable || !1,
  2653.       d.configurable = !0,
  2654.       'value' in d && (d.writable = !0),
  2655.       Object.defineProperty(a, d.key, d)
  2656.     }
  2657.   }
  2658.   return function (b, c, d) {
  2659.     return c && a(b.prototype, c),
  2660.     d && a(b, d),
  2661.     b
  2662.   }
  2663. }();
  2664. define('core/ads/NodeRect', [
  2665.   'core/ads/safeFrameUtils'
  2666. ], function (a) {
  2667.   'use strict';
  2668.   var b = function () {
  2669.     function b() {
  2670.       return _classCallCheck(this, b),
  2671.       1 !== arguments.length || a.isNumeric(arguments[0]) ? void this.fromArray(arguments) : Array.isArray(arguments[0]) ? this.fromArray(arguments[0]) : this.fromObject(arguments[0])
  2672.     }
  2673.     return _createClass(b, [
  2674.       {
  2675.         key: 'fromArray',
  2676.         value: function (a) {
  2677.           this.reset(),
  2678.           a.length >= 6 ? (this.top = a[0], this.right = a[1], this.bottom = a[2], this.left = a[3], this.width = a[4], this.height = a[5]) : a.length >= 4 ? (this.top = a[0], this.right = a[1], this.bottom = a[2], this.left = a[3]) : 3 === a.length ? (this.top = a[0], this.right = a[1], this.bottom = a[2], this.left = 0) : 2 === a.length ? (this.top = a[0], this.right = a[1], this.bottom = a[0], this.left = a[1]) : (this.top = a[0], this.right = a[0], this.bottom = a[0], this.left = a[0]),
  2679.           this.update()
  2680.         }
  2681.       },
  2682.       {
  2683.         key: 'fromObject',
  2684.         value: function (a) {
  2685.           return this.fromArray([a.top,
  2686.           a.right,
  2687.           a.bottom,
  2688.           a.left,
  2689.           a.width,
  2690.           a.height])
  2691.         }
  2692.       },
  2693.       {
  2694.         key: 'update',
  2695.         value: function () {
  2696.           this.width || (this.width = this.right - this.left),
  2697.           this.height || (this.height = this.bottom - this.top)
  2698.         }
  2699.       },
  2700.       {
  2701.         key: 'reset',
  2702.         value: function (a) {
  2703.           a = a || 0,
  2704.           this.top = a,
  2705.           this.right = a,
  2706.           this.bottom = a,
  2707.           this.left = a,
  2708.           this.width = a,
  2709.           this.height = a
  2710.         }
  2711.       },
  2712.       {
  2713.         key: 'getArea',
  2714.         value: function () {
  2715.           return (this.right - this.left) * (this.bottom - this.top)
  2716.         }
  2717.       }
  2718.     ]),
  2719.     b
  2720.   }();
  2721.   return b.getOverlapRect = function (c, d) {
  2722.     var e = a.max([c.left,
  2723.     d.left]),
  2724.     f = a.min([c.left + c.width,
  2725.     d.left + d.width]),
  2726.     g = a.max([c.top,
  2727.     d.top]),
  2728.     h = a.min([c.top + c.height,
  2729.     d.top + d.height]);
  2730.     return f >= e && h >= g && new b(g, f, h, e, f - e, h - g)
  2731.   },
  2732.   b.getOverlapArea = function (b, c) {
  2733.     var d = a.max([0,
  2734.     a.min([b.right,
  2735.     c.right]) - a.max([b.left,
  2736.     c.left])]),
  2737.     e = a.max([0,
  2738.     a.min([b.bottom,
  2739.     c.bottom]) - a.max([b.top,
  2740.     c.top])]);
  2741.     return d * e
  2742.   },
  2743.   b
  2744. }),
  2745. define('core/ads/domUtils', [
  2746.   'core/ads/NodeRect'
  2747. ], function (a) {
  2748.   'use strict';
  2749.   var b = 9,
  2750.   c = function (a) {
  2751.     return a && a.parentNode
  2752.   },
  2753.   d = function (a, b) {
  2754.     if (!a) return null;
  2755.     var c = window.document.defaultView.getComputedStyle(a);
  2756.     return b && c.hasOwnProperty(b) ? c[b] : c
  2757.   },
  2758.   e = function () {
  2759.     return {
  2760.       x: window.pageXOffset,
  2761.       y: window.pageYOffset
  2762.     }
  2763.   },
  2764.   f = function (b) {
  2765.     var c = void 0;
  2766.     if (b && b.style) {
  2767.       var d = b.style.display;
  2768.       b.style.display = 'block',
  2769.       c = b.getBoundingClientRect(),
  2770.       b.style.display = d,
  2771.       c = new a(c);
  2772.       var f = e();
  2773.       c.left += f.x,
  2774.       c.right += f.x,
  2775.       c.top += f.y,
  2776.       c.bottom += f.y
  2777.     } else c = new a(0);
  2778.     return c
  2779.   },
  2780.   g = function (a, b) {
  2781.     var c = f(a);
  2782.     if (b) {
  2783.       var d = f(b);
  2784.       c.top = d.top - d.top + b.scrollTop,
  2785.       c.bottom = c.top + c.height + b.scrollTop,
  2786.       c.left = c.left - d.left + b.scrollLeft,
  2787.       c.right = c.left + c.width + b.scrollLeft
  2788.     }
  2789.     return c
  2790.   },
  2791.   h = function () {
  2792.     var b = e(),
  2793.     c = b.y,
  2794.     d = b.x + window.innerWidth,
  2795.     f = b.y + window.innerHeight,
  2796.     g = b.x,
  2797.     h = window.innerWidth,
  2798.     i = window.innerHeight;
  2799.     return new a(c, d, f, g, h, i)
  2800.   },
  2801.   i = function (a) {
  2802.     try {
  2803.       return a.nodeType === b ? a : a.ownerDocument
  2804.     } catch (c) {
  2805.       return null
  2806.     }
  2807.   },
  2808.   j = function (a) {
  2809.     var b = i(a),
  2810.     c = void 0;
  2811.     try {
  2812.       b && (c = b.parentWindow || b.defaultView || window)
  2813.     } catch (d) {
  2814.       c = window
  2815.     }
  2816.     return c
  2817.   },
  2818.   k = function (b) {
  2819.     var c = j(b),
  2820.     d = new a(0, c.innerWidth, c.innerHeight, 0, c.innerWidth, c.innerHeight),
  2821.     f = e();
  2822.     return d.left += f.x,
  2823.     d.right += f.x,
  2824.     d.top += f.y,
  2825.     d.bottom += f.y,
  2826.     d
  2827.   },
  2828.   l = function (a) {
  2829.     var b = i(a);
  2830.     if (b) return b.documentElement || b.body
  2831.   },
  2832.   m = function (b) {
  2833.     var c = l(b) || {
  2834.     },
  2835.     d = new a;
  2836.     return d.right = d.width = c.scrollWidth || 0,
  2837.     d.bottom = d.height = c.scrollHeight || 0,
  2838.     d
  2839.   },
  2840.   n = function (a, b) {
  2841.     for (; b; ) {
  2842.       if (b === a) return !0;
  2843.       b = b.parentNode
  2844.     }
  2845.     return !1
  2846.   },
  2847.   o = function (a) {
  2848.     var b = d(a);
  2849.     return 'inline-block' === b.display || 'none' !== b['float'] || 'absolute' === b.position || 'fixed' === b.position || 'auto' !== b.width || 'auto' !== b.height
  2850.   },
  2851.   p = function (a) {
  2852.     var b = d(a),
  2853.     c = {
  2854.     };
  2855.     return 'scroll' === b.overflowX || 'auto' === b.overflowX ? c.xscroll = a.offsetWidth - a.clientWidth : c.xscroll = 0,
  2856.     'scroll' === b.overflowY || 'auto' === b.overflowY ? c.yscroll = a.offsetHeight - a.clientHeight : c.yscroll = 0,
  2857.     c.xhidden = 'hidden' === b.overflowX,
  2858.     c.yhidden = 'hidden' === b.overflowY,
  2859.     c
  2860.   },
  2861.   q = function (a) {
  2862.     var b = d(a);
  2863.     return !!(b.clip && 'auto' !== b.clip || b.clipPath && 'none' !== b.clipPath)
  2864.   };
  2865.   return {
  2866.     getParentNode: c,
  2867.     getWindow: j,
  2868.     getScroll: e,
  2869.     getRect: f,
  2870.     getRectRelativeTo: g,
  2871.     getViewportRect: h,
  2872.     getDocument: i,
  2873.     getWindowRect: k,
  2874.     getRootNode: l,
  2875.     getRootRect: m,
  2876.     getNodeStyle: d,
  2877.     isParentOf: n,
  2878.     hasLayout: o,
  2879.     getNodeOverflow: p,
  2880.     isNodeClipped: q
  2881.   }
  2882. });
  2883. var _createClass = function () {
  2884.   function a(a, b) {
  2885.     for (var c = 0; c < b.length; c++) {
  2886.       var d = b[c];
  2887.       d.enumerable = d.enumerable || !1,
  2888.       d.configurable = !0,
  2889.       'value' in d && (d.writable = !0),
  2890.       Object.defineProperty(a, d.key, d)
  2891.     }
  2892.   }
  2893.   return function (b, c, d) {
  2894.     return c && a(b.prototype, c),
  2895.     d && a(b, d),
  2896.     b
  2897.   }
  2898. }();
  2899. define('core/ads/Geom', [
  2900.   'core/ads/domUtils',
  2901.   'core/ads/safeFrameUtils'
  2902. ], function (a, b) {
  2903.   'use strict';
  2904.   var c = 1,
  2905.   d = function () {
  2906.     function d(b) {
  2907.       _classCallCheck(this, d),
  2908.       this.node = b,
  2909.       this.document = a.getDocument(b),
  2910.       this.window = a.getWindow(b),
  2911.       this.root = a.getRootNode(b),
  2912.       this.ref = this.getRefNode(b.parentNode)
  2913.     }
  2914.     return _createClass(d, [
  2915.       {
  2916.         key: 'getRefNode',
  2917.         value: function (b) {
  2918.           for (; b && b.nodeType === c; ) {
  2919.             var d = a.getNodeStyle(b);
  2920.             if (a.hasLayout(b) || 'block' === d.display || 'none' !== d.clear) {
  2921.               var e = a.getNodeOverflow(b);
  2922.               if (e.xscroll || e.yscroll || e.xhidden || e.yhidden) return b;
  2923.               if (a.isNodeClipped(b)) return b
  2924.             }
  2925.             b = b.parentNode
  2926.           }
  2927.           return this.root
  2928.         }
  2929.       },
  2930.       {
  2931.         key: 'getNodesOver',
  2932.         value: function (d, e) {
  2933.           e = e || 1;
  2934.           var f = [
  2935.           ],
  2936.           g = a.getRect(d),
  2937.           h = a.getRect(this.ref),
  2938.           i = a.getViewportRect(d);
  2939.           if (!window.document.elementFromPoint) return f;
  2940.           for (var j = {
  2941.             top: b.max([g.top,
  2942.             h.top]) - i.top,
  2943.             right: b.min([g.right,
  2944.             h.right]) - i.left,
  2945.             bottom: b.min([g.bottom,
  2946.             h.bottom]) - i.top,
  2947.             left: b.max([g.left,
  2948.             h.left]) - i.left
  2949.           }, k = (j.right - j.left) / 10, l = (j.bottom - j.top) / 10, m = j.left; m < j.right; m += k) for (var n = j.top; n < j.bottom; n += l) {
  2950.             for (var o = window.document.elementFromPoint(m, n); o && o.nodeType === c; ) {
  2951.               var p = a.getNodeStyle(o);
  2952.               if (a.hasLayout(o) || 'block' === p.display || 'none' !== p.clear) break;
  2953.               o = o.parentNode
  2954.             }
  2955.             o && o.nodeType === c && o !== this.node && o !== this.root && !a.isParentOf(o, this.node) && (f.push(o), f.length >= e && (m = j.right, n = j.bottom))
  2956.           }
  2957.           return f
  2958.         }
  2959.       },
  2960.       {
  2961.         key: 'getWindowGeom',
  2962.         value: function () {
  2963.           var a = this.window.innerHeight || 0,
  2964.           b = this.window.innerWidth || 0,
  2965.           c = this.window.screenY || this.window.screenTop || 0,
  2966.           d = c + a,
  2967.           e = this.window.screenX || this.window.screenLeft || 0,
  2968.           f = e + b;
  2969.           return {
  2970.             t: c,
  2971.             r: f,
  2972.             b: d,
  2973.             l: e,
  2974.             w: b,
  2975.             h: a
  2976.           }
  2977.         }
  2978.       },
  2979.       {
  2980.         key: 'getSelfGeom',
  2981.         value: function () {
  2982.           var c = a.getRect(this.node),
  2983.           d = a.getRect(this.ref),
  2984.           e = a.getNodeStyle(this.node),
  2985.           f = a.getWindowRect(this.node),
  2986.           g = c.width,
  2987.           h = c.height;
  2988.           this.ref !== this.root && (g = b.max([0,
  2989.           b.min([c.right,
  2990.           d.right]) - b.max([c.left,
  2991.           d.left])]), h = b.max([0,
  2992.           b.min([c.bottom,
  2993.           d.bottom]) - b.max([c.top,
  2994.           d.top])]));
  2995.           var i = b.max([0,
  2996.           b.min(c.right, f.right) - b.max([c.left,
  2997.           f.left])]),
  2998.           j = b.max([0,
  2999.           b.min([c.bottom,
  3000.           f.bottom]) - b.max([c.top,
  3001.           f.top])]),
  3002.           k = b.min([g,
  3003.           i]),
  3004.           l = b.min([h,
  3005.           j]),
  3006.           m = c.width ? k / c.width : 0,
  3007.           n = c.height ? l / c.height : 0,
  3008.           o = k * l / (c.width * c.height),
  3009.           p = 1,
  3010.           q = this.getNodesOver(this.node, p);
  3011.           if (q.length) {
  3012.             var r = a.getRect(q[0]),
  3013.             s = b.max([0,
  3014.             b.min([r.right,
  3015.             c.right]) - b.max([r.left,
  3016.             c.left])]),
  3017.             t = b.max([0,
  3018.             b.min([r.bottom,
  3019.             c.bottom]) - b.max([r.top,
  3020.             c.top])]);
  3021.             o = b.max([0,
  3022.             (k * l - s * t) / (c.width * c.height)])
  3023.           }
  3024.           var u = a.getScroll();
  3025.           return {
  3026.             t: c.top - u.y,
  3027.             r: c.right - u.x,
  3028.             b: c.bottom - u.y,
  3029.             l: c.left - u.x,
  3030.             z: e.zIndex,
  3031.             w: c.width,
  3032.             h: c.height,
  3033.             xiv: 1 === m ? '1' : Number(m).toFixed(2),
  3034.             yiv: 1 === n ? '1' : Number(n).toFixed(2),
  3035.             iv: 1 === o ? '1' : Number(o).toFixed(2)
  3036.           }
  3037.         }
  3038.       },
  3039.       {
  3040.         key: 'getExpandGeom',
  3041.         value: function () {
  3042.           var c = a.getRect(this.ref),
  3043.           d = a.getRect(this.node),
  3044.           e = a.getWindowRect(this.node),
  3045.           f = {
  3046.             top: b.max([c.top,
  3047.             e.top]),
  3048.             right: b.min([c.right,
  3049.             e.right]),
  3050.             bottom: b.min([c.bottom,
  3051.             e.bottom]),
  3052.             left: b.max([c.left,
  3053.             e.left])
  3054.           },
  3055.           g = a.getNodeOverflow(this.ref);
  3056.           return {
  3057.             t: b.max([0,
  3058.             d.top - f.top]),
  3059.             r: b.max([0,
  3060.             f.right - d.right]),
  3061.             b: b.max([0,
  3062.             f.bottom - d.bottom]),
  3063.             l: b.max([0,
  3064.             d.left - f.left]),
  3065.             xs: Boolean(g.yscroll),
  3066.             yx: Boolean(g.xscroll)
  3067.           }
  3068.         }
  3069.       },
  3070.       {
  3071.         key: 'getGeom',
  3072.         value: function () {
  3073.           return {
  3074.             win: this.getWindowGeom(),
  3075.             self: this.getSelfGeom(),
  3076.             exp: this.getExpandGeom()
  3077.           }
  3078.         }
  3079.       }
  3080.     ]),
  3081.     d
  3082.   }(),
  3083.   e = {
  3084.     get: function (a) {
  3085.       var b = new d(a);
  3086.       return b.getGeom()
  3087.     }
  3088.   };
  3089.   return e
  3090. }),
  3091. define('core/ads/ads', [
  3092.   'require',
  3093.   'core/shared/urls',
  3094.   'core/apps/WindowedApp',
  3095.   'core/host/json',
  3096.   'stance/main',
  3097.   'stance/utils',
  3098.   'core/common/kernel/WindowBase',
  3099.   'core/utils/OnceTimer',
  3100.   'core/utils/html/toHexColorString',
  3101.   'core/utils/object/extend',
  3102.   'core/utils/sandbox',
  3103.   'core/utils/url/parseQueryString',
  3104.   'core/utils/url/serialize',
  3105.   'core/utils/urls',
  3106.   'core/utils/urls',
  3107.   'core/analytics/reporting',
  3108.   'core/ads/Geom'
  3109. ], function (a) {
  3110.   'use strict';
  3111.   var b = a('core/shared/urls'),
  3112.   c = a('core/apps/WindowedApp'),
  3113.   d = a('core/host/json'),
  3114.   e = a('stance/main'),
  3115.   f = a('stance/utils'),
  3116.   g = a('core/common/kernel/WindowBase'),
  3117.   h = a('core/utils/OnceTimer'),
  3118.   i = a('core/utils/html/toHexColorString'),
  3119.   j = a('core/utils/object/extend'),
  3120.   k = a('core/utils/sandbox'),
  3121.   l = a('core/utils/url/parseQueryString'),
  3122.   m = a('core/utils/url/serialize'),
  3123.   n = a('core/utils/urls').getOrigin,
  3124.   o = a('core/utils/urls').getQuery,
  3125.   p = a('core/analytics/reporting'),
  3126.   q = a('core/ads/Geom'),
  3127.   r = c.extend({
  3128.     name: 'ads',
  3129.     origin: void 0,
  3130.     onceEvents: {
  3131.       'view:enter': function () {
  3132.         this._reportLegacy({
  3133.           verb: 'view',
  3134.           adverb: '0ms-no50perc'
  3135.         })
  3136.       },
  3137.       'view:iab': function () {
  3138.         this._reportLegacy({
  3139.           verb: 'view',
  3140.           adverb: 'iab-scroll'
  3141.         })
  3142.       }
  3143.     },
  3144.     events: {
  3145.       'frame:ready': function (a) {
  3146.         this.forumId = a.forumId,
  3147.         this._reportLegacy({
  3148.           verb: 'load',
  3149.           extra_data: a.extraData,
  3150.           advertisement_id: a.advertisement_id,
  3151.           provider: a.provider
  3152.         }),
  3153.         this.bindViewEvents(),
  3154.         this.triggerGeomUpdate()
  3155.       },
  3156.       'frame:resize': function (a) {
  3157.         this.frame.setInlineStyle('height', a.height + 'px'),
  3158.         0 === a.height ? this.trigger('ad-placement-empty') : (a.adWidth && this.frame.setInlineStyle('width', a.adWidth + 'px'), this.trigger('ad-placement-filled')),
  3159.         this.triggerGeomUpdate()
  3160.       },
  3161.       'frame:click': function () {
  3162.         this._reportOnce({
  3163.           verb: 'click'
  3164.         }, 'click')
  3165.       },
  3166.       'frame:hover': function () {
  3167.         this._reportOnce({
  3168.           verb: 'hover'
  3169.         }, 'hover')
  3170.       },
  3171.       'frame:error-provider-not-ready': function (a) {
  3172.         this._reportLegacy({
  3173.           verb: 'fail',
  3174.           object_type: 'provider',
  3175.           object_id: a.provider || this.getProvider(),
  3176.           adverb: 'provider_not_ready'
  3177.         })
  3178.       },
  3179.       'frame:error-no-height': function (a) {
  3180.         this._reportLegacy({
  3181.           verb: 'fail',
  3182.           object_type: 'provider',
  3183.           object_id: a.provider || this.getProvider(),
  3184.           adverb: 'no_height'
  3185.         })
  3186.       },
  3187.       'frame:clearSandbox': function () {
  3188.         this.frame.elem.hasAttribute('sandbox') && this.frame.elem.removeAttribute('sandbox')
  3189.       },
  3190.       'frame:$sf-init': function () {
  3191.         this.settings.isOnHostPage && (this.isSafeframe = !0)
  3192.       },
  3193.       'frame:error': function (a) {
  3194.         this.settings.isOnHostPage && this.postMessageDirect({
  3195.           event: 'error',
  3196.           data: {
  3197.             error: a
  3198.           }
  3199.         })
  3200.       }
  3201.     },
  3202.     constructor: function () {
  3203.       c.apply(this, arguments),
  3204.       this.origin = n(this.settings.adUrl),
  3205.       this._reportOnceHistory = {
  3206.       },
  3207.       this.settings.isOnHostPage && (this.detectLazyload = this.detectLazyload.bind(this), window.addEventListener('scroll', this.detectLazyload));
  3208.       var a = this.settings.adUrl.indexOf('/ads-iframe/taboola/') >= 0;
  3209.       this.settings.useSourcelessFrame = this.settings.sourcelessIframe && this.settings.isOnHostPage && (!this.settings.defaultPlacementUrl || !this.settings.adBlockEnabled) && !a
  3210.     },
  3211.     init: function () {
  3212.       if (this.settings.forum = l(o(this.settings.adUrl)).shortname, this.settings.forum) {
  3213.         var a = window.navigator && window.navigator.userAgent || window.navigator && window.navigator.vendor || window.opera,
  3214.         d = this.settings.disableAdsIos && /iP(hone|od|ad)/.test(a) || this.settings.disableAdsAndroid && /Android/.test(a),
  3215.         e = this.settings.disableAds,
  3216.         f = this.settings.isInHome || this.settings.isOnHostPage && 0 === window.location.href.indexOf(b.apps.home);
  3217.         if (!f && e && this.settings.canDisableAds || d) return void this.trigger('prevented-ad-load');
  3218.         this._reportOnce({
  3219.           verb: 'call',
  3220.           object_type: 'provider',
  3221.           object_id: this.getProvider(),
  3222.           adjective: 1
  3223.         }, 'call'),
  3224.         this.settings.sandboxAds && (this.sandbox = k.getAttribute({
  3225.           'allow-scripts': !0,
  3226.           'allow-same-origin': !0,
  3227.           'allow-forms': !0,
  3228.           'allow-popups': !0
  3229.         })),
  3230.         c.prototype.init.call(this)
  3231.       }
  3232.     },
  3233.     detectLazyload: function () {
  3234.       if (this.frame && this.settings.isOnHostPage) {
  3235.         var a = this.frame.elem.getBoundingClientRect().top,
  3236.         b = a - window.innerHeight,
  3237.         c = window.innerHeight * this.settings.lazyloadViewports;
  3238.         b < c && (this.postMessageDirect({
  3239.           event: 'lazyload'
  3240.         }), window.removeEventListener('scroll', this.detectLazyload))
  3241.       }
  3242.     },
  3243.     getProvider: function () {
  3244.       if (this._provider) return this._provider;
  3245.       var a = this.settings.adUrl.match(/provider=(\w+)/);
  3246.       return a && (this._provider = a[1]),
  3247.       this._provider
  3248.     },
  3249.     getUrl: function () {
  3250.       var a,
  3251.       b = this.settings;
  3252.       return a = 'inthreaddisqusadstxt' === b.experiment.experiment && 'active' === b.experiment.variant && 'inthread' === b.placement ? window.document.location.href : b.isOnHostPage ? b.url || window.document.location.href : b.url || b.referrer,
  3253.       m(b.adUrl, {
  3254.         anchorColor: i(b.anchorColor),
  3255.         colorScheme: b.colorScheme,
  3256.         sourceUrl: a,
  3257.         typeface: b.typeface,
  3258.         canonicalUrl: b.canonicalUrl,
  3259.         disqus_version: b.version,
  3260.         deviceWidth: b.deviceWidth,
  3261.         maxWidth: b.maxWidth
  3262.       })
  3263.     },
  3264.     triggerGeomUpdate: function () {
  3265.       if (this.frame.elem && this.isSafeframe && this.settings.isOnHostPage) {
  3266.         var a = q.get(this.frame.elem);
  3267.         this.postMessageDirect({
  3268.           event: 'geom-update',
  3269.           data: {
  3270.             geom: a
  3271.           }
  3272.         })
  3273.       }
  3274.     },
  3275.     bindViewEvents: function () {
  3276.       if (!this._viewEventsBound) {
  3277.         this._viewEventsBound = !0,
  3278.         e.bindWindowEvents(!0);
  3279.         var a = this,
  3280.         b = function (b, c) {
  3281.           a.postMessageDirect({
  3282.             event: b,
  3283.             percentViewable: c
  3284.           })
  3285.         },
  3286.         c = 1000,
  3287.         d = new h(function () {
  3288.           a.trigger('view:iab'),
  3289.           b('view:iab')
  3290.         }, c),
  3291.         g = !1;
  3292.         this.listenTo(e({
  3293.           el: this.frame.elem
  3294.         }), {
  3295.           enter: function () {
  3296.             a.trigger('view:enter'),
  3297.             b('view:enter'),
  3298.             a.triggerGeomUpdate()
  3299.           },
  3300.           exit: function () {
  3301.             b('view:exit'),
  3302.             g && (g = !1, b('view:50out'), d.clear()),
  3303.             a.triggerGeomUpdate()
  3304.           },
  3305.           visible: function (c, e) {
  3306.             var h = f.visiblePercent(e, c.offset()),
  3307.             i = 50;
  3308.             h >= i && !g ? (g = !0, b('view:50in'), d.start()) : h < i && g && (g = !1, b('view:50out'), d.clear()),
  3309.             b('view', h),
  3310.             a.triggerGeomUpdate()
  3311.           }
  3312.         })
  3313.       }
  3314.     },
  3315.     postMessageDirect: function (a) {
  3316.       this.frame.requiresWindow(function (a) {
  3317.         var b = d.stringify(j({
  3318.         }, a, {
  3319.           space: 'disqus'
  3320.         }));
  3321.         g.postMessage(this.window, b, this.origin),
  3322.         g.postMessage(this.window, 'disqus.' + a.event, this.origin)
  3323.       }) (a)
  3324.     },
  3325.     _report: function (a) {
  3326.       var b = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {
  3327.       },
  3328.       c = this.settings,
  3329.       d = b.provider || this.getProvider();
  3330.       a.forum_id = c.forumId || this.forumId;
  3331.       var e;
  3332.       e = c.placement && c.placement.indexOf('timeline') > - 1 ? 'home' : 'recommendations' === c.placement ? 'recommendations' : 'embed';
  3333.       var f = b.usePOST ? 'reportJesterPOST' : 'reportJester';
  3334.       p[f](j({
  3335.         imp: c.impressionId,
  3336.         experiment: c.experiment.experiment,
  3337.         variant: c.experiment.variant,
  3338.         service: c.experiment.service,
  3339.         area: c.placement,
  3340.         product: e,
  3341.         forum: c.forum,
  3342.         zone: 'thread',
  3343.         version: c.loaderVersion,
  3344.         page_url: c.referrer || window.document.location.href,
  3345.         page_referrer: c.hostReferrer || window.document.referrer,
  3346.         object_type: 'advertisement',
  3347.         provider: d,
  3348.         event: 'activity'
  3349.       }, a))
  3350.     },
  3351.     _reportLegacy: function (a) {
  3352.       var b = this.settings;
  3353.       this._report(j({
  3354.         ad_product_name: 'iab_display',
  3355.         ad_product_layout: 'iab_display',
  3356.         bin: 'embed:promoted_discovery:' + b.experiment.service + ':' + b.experiment.experiment + ':' + b.experiment.variant,
  3357.         object_id: a.advertisement_id ? '[' + a.advertisement_id + ']' : '',
  3358.         section: 'default'
  3359.       }, a))
  3360.     },
  3361.     _reportOnce: function (a, b) {
  3362.       this._reportOnceHistory[b] || (this._reportLegacy(a), this._reportOnceHistory[b] = !0);
  3363.     },
  3364.     getFrameSettings: function () {
  3365.       var a = c.prototype.getFrameSettings.call(this);
  3366.       return a.insertBeforeEl = this.settings.insertBeforeEl,
  3367.       a.insertAfterEl = this.settings.insertAfterEl,
  3368.       a
  3369.     }
  3370.   }),
  3371.   s = function (a) {
  3372.     return a = a || {
  3373.     },
  3374.     a.experiment || (a.experiment = {
  3375.       experiment: a.experimentName,
  3376.       variant: a.experimentVariant,
  3377.       service: a.experimentService
  3378.     }),
  3379.     new r(a)
  3380.   };
  3381.   return {
  3382.     Ads: s
  3383.   }
  3384. }),
  3385. define('core/api', [
  3386.   'jquery',
  3387.   'underscore',
  3388.   'backbone',
  3389.   'core/config',
  3390.   'core/utils'
  3391. ], function (a, b, c, d, e) {
  3392.   'use strict';
  3393.   function f(a) {
  3394.     return l.href = a,
  3395.     l.origin || l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '')
  3396.   }
  3397.   function g(a) {
  3398.     return a.replace(/^(http:)?\/\//, 'https://')
  3399.   }
  3400.   function h(c) {
  3401.     c = b.defaults(c, m),
  3402.     c.traditional = !0,
  3403.     f(window.location.href) !== f(c.url) && (c.xhrFields = {
  3404.       withCredentials: !0
  3405.     }),
  3406.     c.omitDisqusApiKey || (c.data = c.data || {
  3407.     }, window.FormData && c.data instanceof window.FormData ? c.url = e.serialize(c.url, {
  3408.       api_key: d.keys.api
  3409.     }) : c.data.api_key = d.keys.api);
  3410.     var g = c.error;
  3411.     return c.error = function (a) {
  3412.       n.trigger('error', a),
  3413.       b.isFunction(g) && g(a)
  3414.     },
  3415.     a.ajax(c)
  3416.   }
  3417.   function i(a) {
  3418.     return /(https?:)?\/\//.test(a) ? g(a) : d.urls.api + a
  3419.   }
  3420.   function j(a, c) {
  3421.     return c = c || {
  3422.     },
  3423.     c.url = i(a),
  3424.     c.omitDisqusApiKey || (c.data = b.extend(c.data || {
  3425.     }, {
  3426.       api_key: d.keys.api
  3427.     })),
  3428.     n.trigger('call', c),
  3429.     h(c).always(b.bind(this.trigger, this, 'complete', c))
  3430.   }
  3431.   var k = window.document,
  3432.   l = k.createElement('a'),
  3433.   m = {
  3434.   },
  3435.   n = {
  3436.     ERROR_CODES: {
  3437.       OBJ_NOT_FOUND: 8,
  3438.       MAX_ITEMS_REACHED: 24
  3439.     },
  3440.     ajax: h,
  3441.     call: j,
  3442.     getURL: i,
  3443.     defaults: function (a) {
  3444.       Object.keys(a).forEach(function (c) {
  3445.         var d = a[c],
  3446.         e = m[c];
  3447.         b.isObject(d) && b.isObject(e) ? b.extend(e, d) : m[c] = d
  3448.       })
  3449.     },
  3450.     headers: function (a) {
  3451.       var c = b.extend({
  3452.       }, m.headers, a);
  3453.       return m.headers = b.pick(c, Boolean),
  3454.       m.headers
  3455.     },
  3456.     makeHttps: g
  3457.   };
  3458.   return b.extend(n, c.Events),
  3459.   n
  3460. }),
  3461. define('core/mediaConfig', [
  3462.   'underscore',
  3463.   'backbone'
  3464. ], function (a, b) {
  3465.   'use strict';
  3466.   function c() {
  3467.     var b = window.document.body.offsetWidth,
  3468.     c = d,
  3469.     e = c.length;
  3470.     return a.find(c, function (a, d) {
  3471.       return d + 1 === e || Math.abs(c[d + 1] - b) > Math.abs(c[d] - b)
  3472.     })
  3473.   }
  3474.   var d = [
  3475.     320,
  3476.     480,
  3477.     600,
  3478.     800
  3479.   ],
  3480.   e = new b.Model({
  3481.     collapsed: !1,
  3482.     defaultIframeHeight: 300,
  3483.     mediaPersistedWidths: d,
  3484.     loadedThumbnailWidth: c()
  3485.   });
  3486.   return e.findClosestThumbnailSize = c,
  3487.   e
  3488. }),
  3489. define('core/mixins/appliesPublisherClasses', [
  3490.   'jquery',
  3491.   'underscore',
  3492.   'core/switches',
  3493.   'remote/config'
  3494. ], function (a, b, c, d) {
  3495.   'use strict';
  3496.   function e() {
  3497.     this._getStyleProperty = function (a) {
  3498.       var b = this.forum.get(a);
  3499.       return this.config.forceAutoStyles || 'auto' === b ? this.config[a] : b
  3500.     },
  3501.     this.getTypeface = function () {
  3502.       return this._getStyleProperty('typeface')
  3503.     },
  3504.     this.getColorScheme = function () {
  3505.       return this._getStyleProperty('colorScheme')
  3506.     },
  3507.     this.getAnchorColorScheme = function () {
  3508.       return this.config.anchorColorScheme
  3509.     },
  3510.     this.getFont = function () {
  3511.       return this.forum.get('customFont')
  3512.     },
  3513.     this.convertFontToClass = function (a) {
  3514.       return a ? a.toLowerCase().replace(/\+/g, '-') : ''
  3515.     },
  3516.     this.convertFontToStyle = function (a) {
  3517.       return a ? a.replace(/\+/g, ' ') : ''
  3518.     },
  3519.     this.isFontAllowed = function (a) {
  3520.       return !(!a || !d.lounge.font_options) && d.lounge.font_options.some(function (b) {
  3521.         return a === b.name
  3522.       })
  3523.     },
  3524.     this.downloadFont = function (a) {
  3525.       var b = window.document,
  3526.       c = b.createElement('style');
  3527.       c.type = 'text/css';
  3528.       var d = this.convertFontToClass(a.name),
  3529.       e = this.convertFontToStyle(a.name),
  3530.       f = a.category,
  3531.       g = '@import url("https://fonts.googleapis.com/css2?family=' + a.name + ':ital,wght@0,400;0,500;0,600;0,700;1,400;1,700&display=swap"); ',
  3532.       h = [
  3533.         '',
  3534.         'input',
  3535.         'select',
  3536.         'textarea'
  3537.       ].map(function (a) {
  3538.         return 'body.' + d + ' ' + a
  3539.       }).join(', ');
  3540.       g += h + ' { font-family: ' + e + ', ' + f + '; }',
  3541.       c.styleSheet ? c.styleSheet.cssText = g : c.appendChild(b.createTextNode(g));
  3542.       var i = b.head || b.getElementsByTagName('head') [0] || b.body;
  3543.       i.appendChild(c)
  3544.     },
  3545.     this.applyPublisherClasses = function () {
  3546.       var e = a('body'),
  3547.       f = this.getFont();
  3548.       !f && c.isFeatureActive('embed_refresh', {
  3549.         forum: this.forum.id
  3550.       }) && 'sans-serif' === this.getTypeface() && (f = 'Roboto');
  3551.       var g = f && b.find(d.lounge.font_options, function (a) {
  3552.         return a.name === f
  3553.       });
  3554.       g ? (this.downloadFont(g), e.addClass(this.convertFontToClass(g.name))) : 'serif' === this.getTypeface() ? e.addClass('serif') : e.addClass('sans-serif'),
  3555.       'dark' === this.getColorScheme() && e.addClass('dark'),
  3556.       c.isFeatureActive('embed_refresh', {
  3557.         forum: this.forum.id
  3558.       }) && ('dark' === this.getAnchorColorScheme() ? e.addClass('dark-anchor') : e.addClass('light-anchor'))
  3559.     }
  3560.   }
  3561.   return e
  3562. }),
  3563. define('core/templates/handlebars.partials', [
  3564.   'handlebars'
  3565. ], function (a) {
  3566.   a.registerPartial('cardGuestUser', a.template({
  3567.     1: function (a, b, c, d, e) {
  3568.       var f,
  3569.       g = null != b ? b : a.nullContext || {
  3570.       },
  3571.       h = a.lambda,
  3572.       i = a.escapeExpression;
  3573.       return '<li class="user ' + (null != (f = c['if'].call(g, null != b ? b.highlight : b, {
  3574.         name: 'if',
  3575.         hash: {
  3576.         },
  3577.         fn: a.program(2, e, 0),
  3578.         inverse: a.noop,
  3579.         data: e,
  3580.         loc: {
  3581.           start: {
  3582.             line: 2,
  3583.             column: 16
  3584.           },
  3585.           end: {
  3586.             line: 2,
  3587.             column: 49
  3588.           }
  3589.         }
  3590.       })) ? f : '') + '" data-role="guest">\n<span class="avatar ' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  3591.         name: 'if',
  3592.         hash: {
  3593.         },
  3594.         fn: a.program(4, e, 0),
  3595.         inverse: a.noop,
  3596.         data: e,
  3597.         loc: {
  3598.           start: {
  3599.             line: 3,
  3600.             column: 20
  3601.           },
  3602.           end: {
  3603.             line: 3,
  3604.             column: 66
  3605.           }
  3606.         }
  3607.       })) ? f : '') + '" title="' + i(h(null != b ? b.guestText : b, b)) + '">\n' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  3608.         name: 'if',
  3609.         hash: {
  3610.         },
  3611.         fn: a.program(6, e, 0),
  3612.         inverse: a.program(8, e, 0),
  3613.         data: e,
  3614.         loc: {
  3615.           start: {
  3616.             line: 4,
  3617.             column: 0
  3618.           },
  3619.           end: {
  3620.             line: 8,
  3621.             column: 7
  3622.           }
  3623.         }
  3624.       })) ? f : '') + '</span>\n<span class="username ' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  3625.         name: 'if',
  3626.         hash: {
  3627.         },
  3628.         fn: a.program(10, e, 0),
  3629.         inverse: a.noop,
  3630.         data: e,
  3631.         loc: {
  3632.           start: {
  3633.             line: 10,
  3634.             column: 22
  3635.           },
  3636.           end: {
  3637.             line: 10,
  3638.             column: 70
  3639.           }
  3640.         }
  3641.       })) ? f : '') + '" title="' + i(h(null != b ? b.guestText : b, b)) + '">\n' + i(h(null != b ? b.guestText : b, b)) + '\n</span>\n</li>\n'
  3642.     },
  3643.     2: function (a, b, c, d, e) {
  3644.       return 'highlight'
  3645.     },
  3646.     4: function (a, b, c, d, e) {
  3647.       return 'avatar--refresh'
  3648.     },
  3649.     6: function (a, b, c, d, e) {
  3650.       return '<div class="initials initials--small">G</div>\n'
  3651.     },
  3652.     8: function (a, b, c, d, e) {
  3653.       var f = a.escapeExpression;
  3654.       return '<img src="' + f(a.lambda(null != b ? b.guestAvatarUrl : b, b)) + '" alt="' + f(c.gettext.call(null != b ? b : a.nullContext || {
  3655.       }, 'Avatar', {
  3656.         name: 'gettext',
  3657.         hash: {
  3658.         },
  3659.         data: e,
  3660.         loc: {
  3661.           start: {
  3662.             line: 7,
  3663.             column: 35
  3664.           },
  3665.           end: {
  3666.             line: 7,
  3667.             column: 55
  3668.           }
  3669.         }
  3670.       })) + '" />\n'
  3671.     },
  3672.     10: function (a, b, c, d, e) {
  3673.       return 'username--refresh'
  3674.     },
  3675.     compiler: [
  3676.       8,
  3677.       '>= 4.3.0'
  3678.     ],
  3679.     main: function (a, b, c, d, e) {
  3680.       var f;
  3681.       return null != (f = c['if'].call(null != b ? b : a.nullContext || {
  3682.       }, null != b ? b.guestCount : b, {
  3683.         name: 'if',
  3684.         hash: {
  3685.         },
  3686.         fn: a.program(1, e, 0),
  3687.         inverse: a.noop,
  3688.         data: e,
  3689.         loc: {
  3690.           start: {
  3691.             line: 1,
  3692.             column: 0
  3693.           },
  3694.           end: {
  3695.             line: 14,
  3696.             column: 7
  3697.           }
  3698.         }
  3699.       })) ? f : ''
  3700.     },
  3701.     useData: !0
  3702.   })),
  3703.   a.registerPartial('cardGuestVoterText', a.template({
  3704.     1: function (a, b, c, d, e) {
  3705.       return ' ' + a.escapeExpression(c.gettext.call(null != b ? b : a.nullContext || {
  3706.       }, '%(guestCount)s Guest Votes', {
  3707.         name: 'gettext',
  3708.         hash: {
  3709.           guestCount: null != b ? b.guestCount : b
  3710.         },
  3711.         data: e,
  3712.         loc: {
  3713.           start: {
  3714.             line: 1,
  3715.             column: 26
  3716.           },
  3717.           end: {
  3718.             line: 1,
  3719.             column: 90
  3720.           }
  3721.         }
  3722.       })) + ' '
  3723.     },
  3724.     3: function (a, b, c, d, e) {
  3725.       return ' ' + a.escapeExpression(c.gettext.call(null != b ? b : a.nullContext || {
  3726.       }, '1 Guest Vote', {
  3727.         name: 'gettext',
  3728.         hash: {
  3729.         },
  3730.         data: e,
  3731.         loc: {
  3732.           start: {
  3733.             line: 1,
  3734.             column: 100
  3735.           },
  3736.           end: {
  3737.             line: 1,
  3738.             column: 126
  3739.           }
  3740.         }
  3741.       })) + ' '
  3742.     },
  3743.     compiler: [
  3744.       8,
  3745.       '>= 4.3.0'
  3746.     ],
  3747.     main: function (a, b, c, d, e) {
  3748.       var f,
  3749.       g = null != b ? b : a.nullContext || {
  3750.       };
  3751.       return (null != (f = c['if'].call(g, c.gt.call(g, null != b ? b.guestCount : b, 1, {
  3752.         name: 'gt',
  3753.         hash: {
  3754.         },
  3755.         data: e,
  3756.         loc: {
  3757.           start: {
  3758.             line: 1,
  3759.             column: 6
  3760.           },
  3761.           end: {
  3762.             line: 1,
  3763.             column: 23
  3764.           }
  3765.         }
  3766.       }), {
  3767.         name: 'if',
  3768.         hash: {
  3769.         },
  3770.         fn: a.program(1, e, 0),
  3771.         inverse: a.program(3, e, 0),
  3772.         data: e,
  3773.         loc: {
  3774.           start: {
  3775.             line: 1,
  3776.             column: 0
  3777.           },
  3778.           end: {
  3779.             line: 1,
  3780.             column: 134
  3781.           }
  3782.         }
  3783.       })) ? f : '') + '\n'
  3784.     },
  3785.     useData: !0
  3786.   })),
  3787.   a.registerPartial('cardOtherUserText', a.template({
  3788.     1: function (a, b, c, d, e) {
  3789.       return ' ' + a.escapeExpression(c.gettext.call(null != b ? b : a.nullContext || {
  3790.       }, '%(guestCount)s Others', {
  3791.         name: 'gettext',
  3792.         hash: {
  3793.           guestCount: null != b ? b.guestCount : b
  3794.         },
  3795.         data: e,
  3796.         loc: {
  3797.           start: {
  3798.             line: 1,
  3799.             column: 26
  3800.           },
  3801.           end: {
  3802.             line: 1,
  3803.             column: 85
  3804.           }
  3805.         }
  3806.       })) + ' '
  3807.     },
  3808.     3: function (a, b, c, d, e) {
  3809.       return ' ' + a.escapeExpression(c.gettext.call(null != b ? b : a.nullContext || {
  3810.       }, '1 Other', {
  3811.         name: 'gettext',
  3812.         hash: {
  3813.         },
  3814.         data: e,
  3815.         loc: {
  3816.           start: {
  3817.             line: 1,
  3818.             column: 95
  3819.           },
  3820.           end: {
  3821.             line: 1,
  3822.             column: 116
  3823.           }
  3824.         }
  3825.       })) + ' '
  3826.     },
  3827.     compiler: [
  3828.       8,
  3829.       '>= 4.3.0'
  3830.     ],
  3831.     main: function (a, b, c, d, e) {
  3832.       var f,
  3833.       g = null != b ? b : a.nullContext || {
  3834.       };
  3835.       return (null != (f = c['if'].call(g, c.gt.call(g, null != b ? b.guestCount : b, 1, {
  3836.         name: 'gt',
  3837.         hash: {
  3838.         },
  3839.         data: e,
  3840.         loc: {
  3841.           start: {
  3842.             line: 1,
  3843.             column: 6
  3844.           },
  3845.           end: {
  3846.             line: 1,
  3847.             column: 23
  3848.           }
  3849.         }
  3850.       }), {
  3851.         name: 'if',
  3852.         hash: {
  3853.         },
  3854.         fn: a.program(1, e, 0),
  3855.         inverse: a.program(3, e, 0),
  3856.         data: e,
  3857.         loc: {
  3858.           start: {
  3859.             line: 1,
  3860.             column: 0
  3861.           },
  3862.           end: {
  3863.             line: 1,
  3864.             column: 124
  3865.           }
  3866.         }
  3867.       })) ? f : '') + '\n'
  3868.     },
  3869.     useData: !0
  3870.   })),
  3871.   a.registerPartial('cardUser', a.template({
  3872.     1: function (a, b, c, d, e) {
  3873.       return 'highlight'
  3874.     },
  3875.     3: function (a, b, c, d, e) {
  3876.       return 'data-action="profile"'
  3877.     },
  3878.     5: function (a, b, c, d, e) {
  3879.       var f,
  3880.       g = null != b ? b : a.nullContext || {
  3881.       };
  3882.       return '<span class="avatar ' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  3883.         name: 'if',
  3884.         hash: {
  3885.         },
  3886.         fn: a.program(6, e, 0),
  3887.         inverse: a.noop,
  3888.         data: e,
  3889.         loc: {
  3890.           start: {
  3891.             line: 4,
  3892.             column: 20
  3893.           },
  3894.           end: {
  3895.             line: 4,
  3896.             column: 66
  3897.           }
  3898.         }
  3899.       })) ? f : '') + '">\n' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  3900.         name: 'if',
  3901.         hash: {
  3902.         },
  3903.         fn: a.program(8, e, 0),
  3904.         inverse: a.program(9, e, 0),
  3905.         data: e,
  3906.         loc: {
  3907.           start: {
  3908.             line: 5,
  3909.             column: 0
  3910.           },
  3911.           end: {
  3912.             line: 13,
  3913.             column: 7
  3914.           }
  3915.         }
  3916.       })) ? f : '') + '</span>\n<span class="username ' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  3917.         name: 'if',
  3918.         hash: {
  3919.         },
  3920.         fn: a.program(13, e, 0),
  3921.         inverse: a.noop,
  3922.         data: e,
  3923.         loc: {
  3924.           start: {
  3925.             line: 15,
  3926.             column: 22
  3927.           },
  3928.           end: {
  3929.             line: 15,
  3930.             column: 70
  3931.           }
  3932.         }
  3933.       })) ? f : '') + '">\n' + a.escapeExpression(a.lambda(null != b ? b.name : b, b)) + '\n</span>\n'
  3934.     },
  3935.     6: function (a, b, c, d, e) {
  3936.       return 'avatar--refresh'
  3937.     },
  3938.     8: function (a, b, c, d, e) {
  3939.       var f;
  3940.       return null != (f = c['if'].call(null != b ? b : a.nullContext || {
  3941.       }, null != (f = null != b ? b.avatar : b) ? f.isCustom : f, {
  3942.         name: 'if',
  3943.         hash: {
  3944.         },
  3945.         fn: a.program(9, e, 0),
  3946.         inverse: a.program(11, e, 0),
  3947.         data: e,
  3948.         loc: {
  3949.           start: {
  3950.             line: 6,
  3951.             column: 0
  3952.           },
  3953.           end: {
  3954.             line: 10,
  3955.             column: 7
  3956.           }
  3957.         }
  3958.       })) ? f : ''
  3959.     },
  3960.     9: function (a, b, c, d, e) {
  3961.       var f,
  3962.       g = a.escapeExpression;
  3963.       return '<img src="' + g(a.lambda(null != (f = null != b ? b.avatar : b) ? f.cache : f, b)) + '" alt="' + g(c.gettext.call(null != b ? b : a.nullContext || {
  3964.       }, 'Avatar', {
  3965.         name: 'gettext',
  3966.         hash: {
  3967.         },
  3968.         data: e,
  3969.         loc: {
  3970.           start: {
  3971.             line: 7,
  3972.             column: 33
  3973.           },
  3974.           end: {
  3975.             line: 7,
  3976.             column: 53
  3977.           }
  3978.         }
  3979.       })) + '" />\n'
  3980.     },
  3981.     11: function (a, b, c, d, e) {
  3982.       return '<div class="initials initials--small">' + a.escapeExpression(a.lambda(null != b ? b.initials : b, b)) + '</div>\n'
  3983.     },
  3984.     13: function (a, b, c, d, e) {
  3985.       return 'username--refresh'
  3986.     },
  3987.     15: function (a, b, c, d, e) {
  3988.       var f,
  3989.       g = null != b ? b : a.nullContext || {
  3990.       },
  3991.       h = a.lambda,
  3992.       i = a.escapeExpression;
  3993.       return '<a class="avatar ' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  3994.         name: 'if',
  3995.         hash: {
  3996.         },
  3997.         fn: a.program(6, e, 0),
  3998.         inverse: a.noop,
  3999.         data: e,
  4000.         loc: {
  4001.           start: {
  4002.             line: 19,
  4003.             column: 17
  4004.           },
  4005.           end: {
  4006.             line: 19,
  4007.             column: 63
  4008.           }
  4009.         }
  4010.       })) ? f : '') + '" href="' + i(h(null != b ? b.profileUrl : b, b)) + '" title="' + i(h(null != b ? b.name : b, b)) + '" target="_blank" rel="noopener noreferrer">\n' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  4011.         name: 'if',
  4012.         hash: {
  4013.         },
  4014.         fn: a.program(8, e, 0),
  4015.         inverse: a.program(9, e, 0),
  4016.         data: e,
  4017.         loc: {
  4018.           start: {
  4019.             line: 20,
  4020.             column: 0
  4021.           },
  4022.           end: {
  4023.             line: 28,
  4024.             column: 7
  4025.           }
  4026.         }
  4027.       })) ? f : '') + '</a>\n<a class="username ' + (null != (f = c['if'].call(g, null != b ? b.isRefreshEnabled : b, {
  4028.         name: 'if',
  4029.         hash: {
  4030.         },
  4031.         fn: a.program(13, e, 0),
  4032.         inverse: a.noop,
  4033.         data: e,
  4034.         loc: {
  4035.           start: {
  4036.             line: 30,
  4037.             column: 19
  4038.           },
  4039.           end: {
  4040.             line: 30,
  4041.             column: 67
  4042.           }
  4043.         }
  4044.       })) ? f : '') + '" href="' + i(h(null != b ? b.profileUrl : b, b)) + '" title="' + i(h(null != b ? b.name : b, b)) + '" target="_blank" rel="noopener noreferrer">\n' + i(h(null != b ? b.name : b, b)) + '\n</a>\n'
  4045.     },
  4046.     compiler: [
  4047.       8,
  4048.       '>= 4.3.0'
  4049.     ],
  4050.     main: function (a, b, c, d, e) {
  4051.       var f,
  4052.       g = null != b ? b : a.nullContext || {
  4053.       };
  4054.       return '<li class="user ' + (null != (f = c['if'].call(g, null != b ? b.highlight : b, {
  4055.         name: 'if',
  4056.         hash: {
  4057.         },
  4058.         fn: a.program(1, e, 0),
  4059.         inverse: a.noop,
  4060.         data: e,
  4061.         loc: {
  4062.           start: {
  4063.             line: 1,
  4064.             column: 16
  4065.           },
  4066.           end: {
  4067.             line: 1,
  4068.             column: 49
  4069.           }
  4070.         }
  4071.       })) ? f : '') + '" ' + (null != (f = c.unless.call(g, c['switch'].call(g, 'sso_less_branding', {
  4072.         name: 'switch',
  4073.         hash: {
  4074.           forum: null != b ? b.forumId : b
  4075.         },
  4076.         data: e,
  4077.         loc: {
  4078.           start: {
  4079.             line: 1,
  4080.             column: 61
  4081.           },
  4082.           end: {
  4083.             line: 1,
  4084.             column: 103
  4085.           }
  4086.         }
  4087.       }), {
  4088.         name: 'unless',
  4089.         hash: {
  4090.         },
  4091.         fn: a.program(3, e, 0),
  4092.         inverse: a.noop,
  4093.         data: e,
  4094.         loc: {
  4095.           start: {
  4096.             line: 1,
  4097.             column: 51
  4098.           },
  4099.           end: {
  4100.             line: 1,
  4101.             column: 137
  4102.           }
  4103.         }
  4104.       })) ? f : '') + ' data-username="' + a.escapeExpression(a.lambda(null != b ? b.username : b, b)) + '">\n' + (null != (f = c.if_all.call(g, c['switch'].call(g, 'sso_less_branding', {
  4105.         name: 'switch',
  4106.         hash: {
  4107.           forum: null != b ? b.forumId : b
  4108.         },
  4109.         data: e,
  4110.         loc: {
  4111.           start: {
  4112.             line: 3,
  4113.             column: 10
  4114.           },
  4115.           end: {
  4116.             line: 3,
  4117.             column: 52
  4118.           }
  4119.         }
  4120.       }), c.ne.call(g, null != b ? b.isSSOProfileUrl : b, !0, {
  4121.         name: 'ne',
  4122.         hash: {
  4123.         },
  4124.         data: e,
  4125.         loc: {
  4126.           start: {
  4127.             line: 3,
  4128.             column: 53
  4129.           },
  4130.           end: {
  4131.             line: 3,
  4132.             column: 78
  4133.           }
  4134.         }
  4135.       }), {
  4136.         name: 'if_all',
  4137.         hash: {
  4138.         },
  4139.         fn: a.program(5, e, 0),
  4140.         inverse: a.program(15, e, 0),
  4141.         data: e,
  4142.         loc: {
  4143.           start: {
  4144.             line: 3,
  4145.             column: 0
  4146.           },
  4147.           end: {
  4148.             line: 33,
  4149.             column: 11
  4150.           }
  4151.         }
  4152.       })) ? f : '') + '</li>\n'
  4153.     },
  4154.     useData: !0
  4155.   })),
  4156.   a.registerPartial('carouselArrowLeft', a.template({
  4157.     compiler: [
  4158.       8,
  4159.       '>= 4.3.0'
  4160.     ],
  4161.     main: function (a, b, c, d, e) {
  4162.       return '<button class="carousel-control carousel-control__previous"><span class="icon icon-right-bracket icon-flipped"></span></button>\n'
  4163.     },
  4164.     useData: !0
  4165.   })),
  4166.   a.registerPartial('carouselArrowRight', a.template({
  4167.     compiler: [
  4168.       8,
  4169.       '>= 4.3.0'
  4170.     ],
  4171.     main: function (a, b, c, d, e) {
  4172.       return '<button class="carousel-control carousel-control__next"><span class="icon icon-right-bracket"></span></button>\n'
  4173.     },
  4174.     useData: !0
  4175.   })),
  4176.   a.registerPartial('channelsHeader', a.template({
  4177.     compiler: [
  4178.       8,
  4179.       '>= 4.3.0'
  4180.     ],
  4181.     main: function (a, b, c, d, e) {
  4182.       var f = null != b ? b : a.nullContext || {
  4183.       },
  4184.       g = a.escapeExpression;
  4185.       return '<div class="channel-homepage-cover">\n<div class="channel-homepage-cover--header">\n<div class="align-inline spacing-top">\n<div class="module-header__icon icon-colorful spacing-right">\n<svg class="icon-discover" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 18 18" enable-background="new 0 0 18 18" xml:space="preserve" width="26" height="26"><rect x="14" width="4" height="4" class="dot"/><rect x="14" y="7" width="4" height="4" class="dot"/><rect x="14" y="14" width="4" height="4" class="dot"/><rect x="7" width="4" height="4" class="dot"/><rect x="7" y="7" width="4" height="4" class="dot"/><rect x="7" y="14" width="4" height="4" class="dot"/><rect width="4" height="4" class="dot"/><rect y="7" width="4" height="4" class="dot"/><rect y="14" width="4" height="4" class="dot"/></g></svg>\n</div>\n<div class="module-header__title">\n<h1 class="text-larger text-darker">' + g(c.gettext.call(f, 'Channels', {
  4186.         name: 'gettext',
  4187.         hash: {
  4188.         },
  4189.         data: e,
  4190.         loc: {
  4191.           start: {
  4192.             line: 8,
  4193.             column: 36
  4194.           },
  4195.           end: {
  4196.             line: 8,
  4197.             column: 58
  4198.           }
  4199.         }
  4200.       })) + '</h1>\n</div>\n</div>\n<p class="text-medium text-gray spacing-bottom-narrow">' + g(c.gettext.call(f, 'Places to start your own discussions.', {
  4201.         name: 'gettext',
  4202.         hash: {
  4203.         },
  4204.         data: e,
  4205.         loc: {
  4206.           start: {
  4207.             line: 11,
  4208.             column: 55
  4209.           },
  4210.           end: {
  4211.             line: 11,
  4212.             column: 106
  4213.           }
  4214.         }
  4215.       })) + '</p>\n</div>\n<div class="metadata-hidden visible-lg spacing-left-small">\n<button\nclass="button button-fill--brand"\ntitle=' + g(c.gettext.call(f, 'Info', {
  4216.         name: 'gettext',
  4217.         hash: {
  4218.         },
  4219.         data: e,
  4220.         loc: {
  4221.           start: {
  4222.             line: 16,
  4223.             column: 6
  4224.           },
  4225.           end: {
  4226.             line: 16,
  4227.             column: 24
  4228.           }
  4229.         }
  4230.       })) + '\ndata-action="show-metadata">\n' + g(c.gettext.call(f, 'About', {
  4231.         name: 'gettext',
  4232.         hash: {
  4233.         },
  4234.         data: e,
  4235.         loc: {
  4236.           start: {
  4237.             line: 18,
  4238.             column: 0
  4239.           },
  4240.           end: {
  4241.             line: 18,
  4242.             column: 19
  4243.           }
  4244.         }
  4245.       })) + '\n</button>\n</div>\n</div>\n<div class="metadata-visible channels-metadata-visible">\n<button\nclass="spacing-top-small link-gray-darker pull-left channels-hide-metadata"\ntitle=' + g(c.gettext.call(f, 'Feed', {
  4246.         name: 'gettext',
  4247.         hash: {
  4248.         },
  4249.         data: e,
  4250.         loc: {
  4251.           start: {
  4252.             line: 25,
  4253.             column: 6
  4254.           },
  4255.           end: {
  4256.             line: 25,
  4257.             column: 24
  4258.           }
  4259.         }
  4260.       })) + '\ndata-action="hide-metadata">\n<span class="icon icon-left-bracket text-large icon__position"></span>\n</button>\n<h1 class="text-largest text-center">' + g(c.gettext.call(f, 'About Channels', {
  4261.         name: 'gettext',
  4262.         hash: {
  4263.         },
  4264.         data: e,
  4265.         loc: {
  4266.           start: {
  4267.             line: 29,
  4268.             column: 37
  4269.           },
  4270.           end: {
  4271.             line: 29,
  4272.             column: 65
  4273.           }
  4274.         }
  4275.       })) + '</h1>\n</div>\n'
  4276.     },
  4277.     useData: !0
  4278.   })),
  4279.   a.registerPartial('genericFollowButton', a.template({
  4280.     1: function (a, b, c, d, e) {
  4281.       return ' active'
  4282.     },
  4283.     3: function (a, b, c, d, e) {
  4284.       var f;
  4285.       return null != (f = c.unless.call(null != b ? b : a.nullContext || {
  4286.       }, null != b ? b.isFollowing : b, {
  4287.         name: 'unless',
  4288.         hash: {
  4289.         },
  4290.         fn: a.program(4, e, 0),
  4291.         inverse: a.noop,
  4292.         data: e,
  4293.         loc: {
  4294.           start: {
  4295.             line: 1,
  4296.             column: 85
  4297.           },
  4298.           end: {
  4299.             line: 1,
  4300.             column: 127
  4301.           }
  4302.         }
  4303.       })) ? f : ''
  4304.     },
  4305.     4: function (a, b, c, d, e) {
  4306.       return 'disabled'
  4307.     },
  4308.     compiler: [
  4309.       8,
  4310.       '>= 4.3.0'
  4311.     ],
  4312.     main: function (a, b, c, d, e) {
  4313.       var f,
  4314.       g = null != b ? b : a.nullContext || {
  4315.       },
  4316.       h = a.escapeExpression;
  4317.       return '<button class="button btn-follow' + (null != (f = c['if'].call(g, null != b ? b.isFollowing : b, {
  4318.         name: 'if',
  4319.         hash: {
  4320.         },
  4321.         fn: a.program(1, e, 0),
  4322.         inverse: a.noop,
  4323.         data: e,
  4324.         loc: {
  4325.           start: {
  4326.             line: 1,
  4327.             column: 32
  4328.           },
  4329.           end: {
  4330.             line: 1,
  4331.             column: 65
  4332.           }
  4333.         }
  4334.       })) ? f : '') + '" ' + (null != (f = c['if'].call(g, null != b ? b.isBlocking : b, {
  4335.         name: 'if',
  4336.         hash: {
  4337.         },
  4338.         fn: a.program(3, e, 0),
  4339.         inverse: a.noop,
  4340.         data: e,
  4341.         loc: {
  4342.           start: {
  4343.             line: 1,
  4344.             column: 67
  4345.           },
  4346.           end: {
  4347.             line: 1,
  4348.             column: 134
  4349.           }
  4350.         }
  4351.       })) ? f : '') + ' data-action="toggle-follow">\n<span class="symbol-default"><span class="icon-plus"></span></span><span class="text-default">' + h(c.gettext.call(g, 'Follow', {
  4352.         name: 'gettext',
  4353.         hash: {
  4354.         },
  4355.         data: e,
  4356.         loc: {
  4357.           start: {
  4358.             line: 3,
  4359.             column: 94
  4360.           },
  4361.           end: {
  4362.             line: 3,
  4363.             column: 114
  4364.           }
  4365.         }
  4366.       })) + '</span><span class="symbol-following"><span class="icon-checkmark"></span></span><span class="text-following">' + h(c.gettext.call(g, 'Following', {
  4367.         name: 'gettext',
  4368.         hash: {
  4369.         },
  4370.         data: e,
  4371.         loc: {
  4372.           start: {
  4373.             line: 3,
  4374.             column: 224
  4375.           },
  4376.           end: {
  4377.             line: 3,
  4378.             column: 247
  4379.           }
  4380.         }
  4381.       })) + '</span>\n</button>\n'
  4382.     },
  4383.     useData: !0
  4384.   }))
  4385. }),
  4386. define('core/extensions/helpers/eq', [
  4387. ], function () {
  4388.   'use strict';
  4389.   return function (a, b) {
  4390.     return a === b
  4391.   }
  4392. }),
  4393. define('core/extensions/helpers/ne', [
  4394. ], function () {
  4395.   'use strict';
  4396.   return function (a, b) {
  4397.     return a !== b
  4398.   }
  4399. }),
  4400. define('core/extensions/helpers/gt', [
  4401. ], function () {
  4402.   'use strict';
  4403.   return function (a, b) {
  4404.     return a > b
  4405.   }
  4406. }),
  4407. define('core/extensions/helpers/lt', [
  4408. ], function () {
  4409.   'use strict';
  4410.   return function (a, b) {
  4411.     return a < b
  4412.   }
  4413. }),
  4414. define('core/extensions/helpers/ge', [
  4415. ], function () {
  4416.   'use strict';
  4417.   return function (a, b) {
  4418.     return a >= b
  4419.   }
  4420. }),
  4421. define('core/extensions/helpers/le', [
  4422. ], function () {
  4423.   'use strict';
  4424.   return function (a, b) {
  4425.     return a <= b
  4426.   }
  4427. }),
  4428. define('core/extensions/helpers/typeof', [
  4429. ], function () {
  4430.   'use strict';
  4431.   return function (a, b) {
  4432.     return typeof a === b
  4433.   }
  4434. }),
  4435. define('core/extensions/helpers/notNull', [
  4436. ], function () {
  4437.   'use strict';
  4438.   return function (a) {
  4439.     return null !== a
  4440.   }
  4441. }),
  4442. define('core/extensions/helpers/any', [
  4443. ], function () {
  4444.   'use strict';
  4445.   return function () {
  4446.     for (var a = arguments.length, b = 0; b < a - 1; b++) if (arguments[b]) return arguments[b]
  4447.   }
  4448. }),
  4449. define('core/extensions/helpers/if_any', [
  4450. ], function () {
  4451.   'use strict';
  4452.   return function () {
  4453.     for (var a = arguments.length, b = arguments[a - 1], c = 0; c < a - 1; c++) if (arguments[c]) return b.fn(this);
  4454.     return b.inverse(this)
  4455.   }
  4456. }),
  4457. define('core/extensions/helpers/if_all', [
  4458. ], function () {
  4459.   'use strict';
  4460.   return function () {
  4461.     for (var a = arguments.length, b = arguments[a - 1], c = 0; c < a - 1; c++) if (!arguments[c]) return b.inverse(this);
  4462.     return b.fn(this)
  4463.   }
  4464. }),
  4465. define('core/extensions/helpers/switch', [
  4466.   'core/switches',
  4467.   'core/utils/object/extend'
  4468. ], function (a, b) {
  4469.   'use strict';
  4470.   return function (c, d) {
  4471.     return a.isFeatureActive(c, b({
  4472.     }, d.hash))
  4473.   }
  4474. }),
  4475. define('core/extensions/helpers/partial', [
  4476.   'handlebars'
  4477. ], function (a) {
  4478.   'use strict';
  4479.   return function (b, c) {
  4480.     a.registerPartial(b, c.fn)
  4481.   }
  4482. }),
  4483. define('core/extensions/helpers/getPartial', [
  4484.   'handlebars'
  4485. ], function (a) {
  4486.   'use strict';
  4487.   return function (b, c, d) {
  4488.     return 'undefined' == typeof d && (d = c, c = this, a.Utils.extend(c, d.hash)),
  4489.     new a.SafeString(a.partials[b](c, d))
  4490.   }
  4491. }),
  4492. define('core/extensions/helpers/gettext', [
  4493.   'handlebars',
  4494.   'core/strings'
  4495. ], function (a, b) {
  4496.   'use strict';
  4497.   return function () {
  4498.     var c,
  4499.     d,
  4500.     e,
  4501.     f,
  4502.     g = arguments.length,
  4503.     h = arguments[g - 1],
  4504.     i = h.hash,
  4505.     j = arguments[0],
  4506.     k = a.partials;
  4507.     j = a.Utils.escapeExpression(b.get(j));
  4508.     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()));
  4509.     return new a.SafeString(j)
  4510.   }
  4511. }),
  4512. define('core/utils/object/get', [
  4513. ], function () {
  4514.   'use strict';
  4515.   return function (a, b, c) {
  4516.     for (var d = 0, e = b.length; a && d < e; ) a = a[b[d]],
  4517.     d += 1;
  4518.     return d < e || void 0 === a ? c : a
  4519.   }
  4520. }),
  4521. define('core/extensions/helpers/urlfor', [
  4522.   'core/config/urls',
  4523.   'core/utils/object/get'
  4524. ], function (a, b) {
  4525.   'use strict';
  4526.   return function (c) {
  4527.     return b(a, c.split('.'))
  4528.   }
  4529. }),
  4530. define('core/extensions/helpers/html', [
  4531.   'handlebars'
  4532. ], function (a) {
  4533.   'use strict';
  4534.   return function (b) {
  4535.     return new a.SafeString(b || '')
  4536.   }
  4537. }),
  4538. define('core/extensions/helpers/with', [
  4539. ], function () {
  4540.   'use strict';
  4541.   return function () {
  4542.     var a = arguments.length,
  4543.     b = arguments[a - 1],
  4544.     c = arguments[0];
  4545.     return 3 === a ? (c = {
  4546.     }, c[arguments[0]] = arguments[1]) : '_window_' === c && (c = window),
  4547.     b.fn(c)
  4548.   }
  4549. }),
  4550. define('core/extensions/helpers/each', [
  4551.   'handlebars'
  4552. ], function (a) {
  4553.   'use strict';
  4554.   return function (b, c) {
  4555.     var d,
  4556.     e,
  4557.     f,
  4558.     g = c.fn,
  4559.     h = c.inverse,
  4560.     i = 0,
  4561.     j = '';
  4562.     if (c.data && (d = a.createFrame(c.data)), b && 'object' == typeof b) if ('[object Array]' === Object.prototype.toString.call(b)) for (f = b.length; i < f; i++) d && (d.index = i, d.length = b.length),
  4563.     j += g(b[i], {
  4564.       data: d
  4565.     });
  4566.      else for (e in b) b.hasOwnProperty(e) && (d && (d.key = e), j += g(b[e], {
  4567.       data: d
  4568.     }), i += 1);
  4569.     return 0 === i && (j = h(this)),
  4570.     j
  4571.   }
  4572. }),
  4573. define('core/extensions/helpers/log', [
  4574. ], function () {
  4575.   'use strict';
  4576.   return function (a) {
  4577.     console.log(a, this)
  4578.   }
  4579. }),
  4580. define('core/extensions/helpers/debug', [
  4581. ], function () {
  4582.   'use strict';
  4583.   return function () {
  4584.   }
  4585. }),
  4586. define('core/extensions/helpers/geturl', [
  4587. ], function () {
  4588.   'use strict';
  4589.   return window.geturl || function (a) {
  4590.     return a
  4591.   }
  4592. }),
  4593. define('core/extensions/helpers/tag', [
  4594.   'handlebars'
  4595. ], function (a) {
  4596.   'use strict';
  4597.   return function (b, c) {
  4598.     var d = [
  4599.       '<' + b
  4600.     ],
  4601.     e = c.hash.text;
  4602.     delete c.hash.text;
  4603.     for (var f in c.hash) c.hash.hasOwnProperty(f) && d.push(' ' + f + '="' + a.escapeExpression(c.hash[f]) + '"');
  4604.     return d.push('>' + a.escapeExpression(e) + '</' + b + '>'),
  4605.     new a.SafeString(d.join(''))
  4606.   }
  4607. }),
  4608. define('core/extensions/helpers/now', [
  4609.   'moment'
  4610. ], function (a) {
  4611.   'use strict';
  4612.   return function (b) {
  4613.     return a().format(b)
  4614.   }
  4615. }),
  4616. define('core/extensions/helpers/ternary', [
  4617. ], function () {
  4618.   'use strict';
  4619.   return function (a, b, c) {
  4620.     return a ? b : c
  4621.   }
  4622. }),
  4623. define('core/extensions/handlebars.helpers', [
  4624.   'require',
  4625.   'handlebars',
  4626.   './helpers/eq',
  4627.   './helpers/ne',
  4628.   './helpers/gt',
  4629.   './helpers/lt',
  4630.   './helpers/ge',
  4631.   './helpers/le',
  4632.   './helpers/typeof',
  4633.   './helpers/notNull',
  4634.   './helpers/any',
  4635.   './helpers/if_any',
  4636.   './helpers/if_all',
  4637.   './helpers/switch',
  4638.   './helpers/partial',
  4639.   './helpers/getPartial',
  4640.   './helpers/gettext',
  4641.   './helpers/urlfor',
  4642.   './helpers/html',
  4643.   './helpers/with',
  4644.   './helpers/each',
  4645.   './helpers/log',
  4646.   './helpers/debug',
  4647.   './helpers/geturl',
  4648.   './helpers/tag',
  4649.   './helpers/now',
  4650.   './helpers/ternary'
  4651. ], function (a) {
  4652.   'use strict';
  4653.   var b = a('handlebars');
  4654.   return b.registerHelper('eq', a('./helpers/eq')),
  4655.   b.registerHelper('ne', a('./helpers/ne')),
  4656.   b.registerHelper('gt', a('./helpers/gt')),
  4657.   b.registerHelper('lt', a('./helpers/lt')),
  4658.   b.registerHelper('ge', a('./helpers/ge')),
  4659.   b.registerHelper('le', a('./helpers/le')),
  4660.   b.registerHelper('typeof', a('./helpers/typeof')),
  4661.   b.registerHelper('notNull', a('./helpers/notNull')),
  4662.   b.registerHelper('any', a('./helpers/any')),
  4663.   b.registerHelper('if_any', a('./helpers/if_any')),
  4664.   b.registerHelper('if_all', a('./helpers/if_all')),
  4665.   b.registerHelper('switch', a('./helpers/switch')),
  4666.   b.registerHelper('partial', a('./helpers/partial')),
  4667.   b.registerHelper('getPartial', a('./helpers/getPartial')),
  4668.   b.registerHelper('gettext', a('./helpers/gettext')),
  4669.   b.registerHelper('urlfor', a('./helpers/urlfor')),
  4670.   b.registerHelper('html', a('./helpers/html')),
  4671.   b.registerHelper('with', a('./helpers/with')),
  4672.   b.registerHelper('each', a('./helpers/each')),
  4673.   b.registerHelper('log', a('./helpers/log')),
  4674.   b.registerHelper('debug', a('./helpers/debug')),
  4675.   b.registerHelper('geturl', a('./helpers/geturl')),
  4676.   b.registerHelper('tag', a('./helpers/tag')),
  4677.   b.registerHelper('now', a('./helpers/now')),
  4678.   b.registerHelper('ternary', a('./helpers/ternary')),
  4679.   b
  4680. }),
  4681. define('core/templates/alert', [
  4682.   'handlebars',
  4683.   'core/templates/handlebars.partials',
  4684.   'core/extensions/handlebars.helpers'
  4685. ], function (a) {
  4686.   return a.template({
  4687.     1: function (a, b, c, d, e) {
  4688.       return '<span class="icon icon-' + a.escapeExpression(a.lambda(null != b ? b.iconType : b, b)) + '"></span>\n'
  4689.     },
  4690.     3: function (a, b, c, d, e) {
  4691.       var f;
  4692.       return (null != (f = a.lambda(null != b ? b.message : b, b)) ? f : '') + '\n'
  4693.     },
  4694.     5: function (a, b, c, d, e) {
  4695.       return a.escapeExpression(a.lambda(null != b ? b.message : b, b)) + '\n'
  4696.     },
  4697.     compiler: [
  4698.       8,
  4699.       '>= 4.3.0'
  4700.     ],
  4701.     main: function (a, b, c, d, e) {
  4702.       var f,
  4703.       g = null != b ? b : a.nullContext || {
  4704.       };
  4705.       return '<a class="close" data-action="dismiss" title="' + a.escapeExpression(c.gettext.call(g, 'Dismiss', {
  4706.         name: 'gettext',
  4707.         hash: {
  4708.         },
  4709.         data: e,
  4710.         loc: {
  4711.           start: {
  4712.             line: 1,
  4713.             column: 46
  4714.           },
  4715.           end: {
  4716.             line: 1,
  4717.             column: 67
  4718.           }
  4719.         }
  4720.       })) + '">×</a>\n<span>\n' + (null != (f = c['if'].call(g, null != b ? b.icon : b, {
  4721.         name: 'if',
  4722.         hash: {
  4723.         },
  4724.         fn: a.program(1, e, 0),
  4725.         inverse: a.noop,
  4726.         data: e,
  4727.         loc: {
  4728.           start: {
  4729.             line: 3,
  4730.             column: 0
  4731.           },
  4732.           end: {
  4733.             line: 5,
  4734.             column: 7
  4735.           }
  4736.         }
  4737.       })) ? f : '') + (null != (f = c['if'].call(g, null != b ? b.safe : b, {
  4738.         name: 'if',
  4739.         hash: {
  4740.         },
  4741.         fn: a.program(3, e, 0),
  4742.         inverse: a.program(5, e, 0),
  4743.         data: e,
  4744.         loc: {
  4745.           start: {
  4746.             line: 6,
  4747.             column: 0
  4748.           },
  4749.           end: {
  4750.             line: 10,
  4751.             column: 7
  4752.           }
  4753.         }
  4754.       })) ? f : '') + '</span>\n'
  4755.     },
  4756.     useData: !0
  4757.   })
  4758. }),
  4759. define('core/views/AlertView', [
  4760.   'backbone',
  4761.   'core/templates/alert'
  4762. ], function (a, b) {
  4763.   'use strict';
  4764.   var c = a.View.extend({
  4765.     defaultClassName: 'alert',
  4766.     events: {
  4767.       'click [data-action=dismiss]': 'dismiss'
  4768.     },
  4769.     initialize: function (a) {
  4770.       this.options = a,
  4771.       this.message = a.message,
  4772.       this.safe = a.safe,
  4773.       this.type = a.type,
  4774.       this.className = a.className || this.defaultClassName
  4775.     },
  4776.     render: function () {
  4777.       var a = this.$el;
  4778.       return a.html(b({
  4779.         message: this.message,
  4780.         safe: this.safe,
  4781.         icon: Boolean(this.type),
  4782.         iconType: 'error' === this.type || 'warn' === this.type ? 'warning' : this.type
  4783.       })),
  4784.       a.attr('class', this.className),
  4785.       this.type && a.addClass(this.type),
  4786.       this
  4787.     },
  4788.     dismiss: function (a) {
  4789.       a && a.preventDefault && a.preventDefault(),
  4790.       this.remove(),
  4791.       this.trigger('dismiss')
  4792.     }
  4793.   });
  4794.   return c
  4795. }),
  4796. define('core/mixins/withAlert', [
  4797.   'underscore',
  4798.   'core/views/AlertView'
  4799. ], function (a, b) {
  4800.   'use strict';
  4801.   var c = {
  4802.     alert: function (c, d) {
  4803.       a.isObject(d) || (d = {
  4804.       });
  4805.       var e = d.target || this._alertSelector;
  4806.       this.dismissAlert();
  4807.       var f = this._alert = new b(a.extend({
  4808.         message: c
  4809.       }, d));
  4810.       if (this.listenToOnce(this._alert, 'dismiss', function () {
  4811.         this._alert = null
  4812.       }), f.render(), e) {
  4813.         var g = this.$el.find(e);
  4814.         g.length ? g.prepend(f.el) : this.listenToOnce(this, 'threadView:render', function () {
  4815.           return this.alert(c, d)
  4816.         })
  4817.       } else this.el.parentNode && this.el.parentNode.insertBefore(f.el, this.el);
  4818.       return f
  4819.     },
  4820.     dismissAlert: function (a) {
  4821.       this._alert && (a && !a(this._alert) || (this.stopListening(this._alert), this._alert.dismiss(), this._alert = null))
  4822.     },
  4823.     getAlert: function () {
  4824.       return this._alert || null
  4825.     },
  4826.     setAlertSelector: function (a) {
  4827.       this._alertSelector = a
  4828.     }
  4829.   },
  4830.   d = function () {
  4831.     return a.extend(this, c)
  4832.   };
  4833.   return d
  4834. }),
  4835. define('core/models/ThreadVote', [
  4836.   'backbone'
  4837. ], function (a) {
  4838.   'use strict';
  4839.   var b = a.Model.extend({
  4840.     defaults: {
  4841.       score: 0
  4842.     }
  4843.   });
  4844.   return b
  4845. }),
  4846. define('core/models/Vote', [
  4847.   'backbone'
  4848. ], function (a) {
  4849.   'use strict';
  4850.   var b = a.Model.extend({
  4851.     defaults: {
  4852.       score: 0
  4853.     }
  4854.   });
  4855.   return b
  4856. }),
  4857. define('core/constants/voteConstants', [
  4858.   'exports'
  4859. ], function (a) {
  4860.   'use strict';
  4861.   a.VOTING_TYPES = {
  4862.     DETAILED: 0,
  4863.     DOWNVOTE_LIMITED: 1,
  4864.     DOWNVOTE_DISABLED: 2,
  4865.     DISABLED: 3
  4866.   },
  4867.   a.DEFAULT_VOTING_TYPE = a.VOTING_TYPES.DETAILED
  4868. }),
  4869. define('core/time', [
  4870. ], function () {
  4871.   'use strict';
  4872.   function a(a) {
  4873.     return a.indexOf('+') >= 0 ? a : a + '+00:00'
  4874.   }
  4875.   var b = 'YYYY-MM-DDTHH:mm:ssZ';
  4876.   return {
  4877.     ISO_8601: b,
  4878.     assureTzOffset: a
  4879.   }
  4880. }),
  4881. define('core/models/BaseUser', [
  4882.   'backbone',
  4883.   'core/config'
  4884. ], function (a, b) {
  4885.   'use strict';
  4886.   var c = a.Model.extend({
  4887.     defaults: {
  4888.       about: null,
  4889.       avatar: {
  4890.         cache: b.urls.avatar.generic,
  4891.         permalink: b.urls.avatar.generic
  4892.       },
  4893.       connections: {
  4894.       },
  4895.       badges: [
  4896.       ],
  4897.       email: null,
  4898.       isAnonymous: !0,
  4899.       isFollowedBy: null,
  4900.       isFollowing: null,
  4901.       joinedAt: null,
  4902.       name: null,
  4903.       profileUrl: null,
  4904.       url: null,
  4905.       username: null,
  4906.       numPosts: null,
  4907.       numFollowing: null,
  4908.       numForumsFollowing: null,
  4909.       numFollowers: null,
  4910.       numLikesReceived: null,
  4911.       isFlagged: null
  4912.     },
  4913.     hasValidAvatar: function (a) {
  4914.       var b = a ? a.avatar : this.get('avatar');
  4915.       return b && b.cache
  4916.     },
  4917.     isAnonymous: function () {
  4918.       return !this.get('id')
  4919.     },
  4920.     isRegistered: function () {
  4921.       return !this.isAnonymous()
  4922.     },
  4923.     validate: function (a) {
  4924.       if (!this.hasValidAvatar(a)) return 'None of the avatar related properties can be null, undefined or empty on User models.'
  4925.     },
  4926.     toJSON: function () {
  4927.       var b = a.Model.prototype.toJSON.apply(this, arguments);
  4928.       return b.thread = {
  4929.       },
  4930.       this.hasValidAvatar() || (b.avatar = this.defaults.avatar),
  4931.       b.isRegistered = this.isRegistered(),
  4932.       b
  4933.     }
  4934.   });
  4935.   return c
  4936. }),
  4937. define('core/models/User', [
  4938.   'jquery',
  4939.   'underscore',
  4940.   'moment',
  4941.   'core/config',
  4942.   'core/time',
  4943.   'core/utils',
  4944.   'core/strings',
  4945.   'core/switches',
  4946.   'core/api',
  4947.   'core/models/BaseUser'
  4948. ], function (a, b, c, d, e, f, g, h, i, j) {
  4949.   'use strict';
  4950.   function k(a, b, c) {
  4951.     a[b] = a[b] || [
  4952.     ],
  4953.     a[b].push(c)
  4954.   }
  4955.   var l = g.get,
  4956.   m = j.extend({
  4957.     url: i.getURL('users/details'),
  4958.     validate: function (c) {
  4959.       var d = {
  4960.       };
  4961.       if (c.display_name && (c.display_name = a.trim(c.display_name)), c.display_name || k(d, 'display_name', l('Please enter your name.')), c.email || k(d, 'email', l('Please enter your email address.')), f.validateEmail(c.email) || k(d, 'email', l('Invalid email address.')), this.isNew() && (c.password ? c.password.length < m.MIN_PASSWORD_LEN && k(d, 'password', l('Password must have at least 6 characters.')) : k(d, 'password', l('Please enter a password.'))), c.name && (c.name.length < m.MIN_NAME_LEN && k(d, 'name', g.interpolate(l('Name must have at least %(minLength)s characters.'), {
  4962.         minLength: m.MIN_NAME_LEN
  4963.       })), c.name.length > m.MAX_NAME_LEN && k(d, 'name', g.interpolate(l('Name must have less than %(maxLength)s characters.'), {
  4964.         maxLength: m.MAX_NAME_LEN
  4965.       }))), c.location && c.location.length > m.MAX_LOCATION_LEN && k(d, 'location', g.interpolate(l('Location must have less than %(maxLength)s characters.'), {
  4966.         maxLength: m.MAX_LOCATION_LEN
  4967.       })), c.url && (c.url.length > m.MAX_URL_LEN && k(d, 'url', g.interpolate(l('Site must have less than %(maxLength)s characters.'), {
  4968.         maxLength: m.MAX_URL_LEN
  4969.       })), f.isUrl(c.url) || k(d, 'url', l('Please enter a valid site.'))), !b.isEmpty(d)) return d
  4970.     },
  4971.     prepareFetchOptions: function (a) {
  4972.       a = a ? b.clone(a) : {
  4973.       };
  4974.       var c = {
  4975.       };
  4976.       return this.get('id') ? c.user = this.get('id') : this.get('username') && (c.user = 'username:' + this.get('username')),
  4977.       b.extend(c, a.data),
  4978.       a.data = c,
  4979.       a
  4980.     },
  4981.     fetch: function (a) {
  4982.       return a = this.prepareFetchOptions(a),
  4983.       j.prototype.fetch.call(this, a)
  4984.     },
  4985.     parse: function (a) {
  4986.       var b = a.response || a;
  4987.       return b = this.handleBadgesUpdate(b)
  4988.     },
  4989.     register: function (a) {
  4990.       var c = this;
  4991.       return a = a || {
  4992.       },
  4993.       i.call('internal/users/register.json', {
  4994.         data: b.extend(this.toRegisterJSON(), {
  4995.           gRecaptchaResponse: a.gRecaptchaResponse
  4996.         }),
  4997.         method: 'POST',
  4998.         success: function (d) {
  4999.           i.call('users/acceptTerms', {
  5000.             method: 'POST'
  5001.           }),
  5002.           c.set(b.extend({
  5003.           }, d.response, {
  5004.             hasAcceptedGdprTerms: !0
  5005.           })),
  5006.           a.success && a.success(d)
  5007.         },
  5008.         error: a.error
  5009.       })
  5010.     },
  5011.     saveAvatar: function (a) {
  5012.       var b = new window.FormData;
  5013.       return b.append('avatar_file', a),
  5014.       b.append('api_key', d.keys.api),
  5015.       i.call('internal/users/updateAvatar.json', {
  5016.         method: 'post',
  5017.         data: b,
  5018.         cache: !1,
  5019.         contentType: !1,
  5020.         processData: !1
  5021.       })
  5022.     },
  5023.     saveProfile: function () {
  5024.       return i.call('users/updateProfile.json', {
  5025.         method: 'POST',
  5026.         data: {
  5027.           name: this.get('name'),
  5028.           about: this.get('about'),
  5029.           location: this.get('location'),
  5030.           url: this.get('url')
  5031.         }
  5032.       })
  5033.     },
  5034.     toRegisterJSON: function () {
  5035.       return b.pick(this.toJSON(), 'display_name', 'email', 'password')
  5036.     },
  5037.     isSession: function (a) {
  5038.       return a.user.id && a.user.id === this.id
  5039.     },
  5040.     isEditable: function (a) {
  5041.       return this.isSession(a) && !this.get('remote')
  5042.     },
  5043.     toJSON: function (a) {
  5044.       a = a || {
  5045.       };
  5046.       var b = j.prototype.toJSON.call(this),
  5047.       c = this.collection && this.collection.thread;
  5048.       return b.thread.canModerate = Boolean(c && c.isModerator(this)),
  5049.       b.thread.isOP = Boolean(c && c.isOP(this)),
  5050.       a.session && (b.isSession = this.isSession(a.session), b.isEditable = this.isEditable(a.session)),
  5051.       b
  5052.     },
  5053.     _changeFollowState: function (a) {
  5054.       this.set({
  5055.         isFollowing: a,
  5056.         numFollowers: Math.max(0, this.get('numFollowers') + (a ? 1 : - 1))
  5057.       });
  5058.       var b = 'users/' + (a ? 'follow' : 'unfollow'),
  5059.       c = this;
  5060.       return i.call(b + '.json', {
  5061.         data: {
  5062.           target: this.get('id')
  5063.         },
  5064.         method: 'POST',
  5065.         success: function (a) {
  5066.           c.trigger('sync', c, a, {
  5067.           })
  5068.         }
  5069.       })
  5070.     },
  5071.     follow: function () {
  5072.       return this._changeFollowState(!0)
  5073.     },
  5074.     unfollow: function () {
  5075.       return this._changeFollowState(!1)
  5076.     },
  5077.     _changeBlockState: function (a) {
  5078.       var b = 'users/block/' + (a ? 'create' : 'delete'),
  5079.       c = this;
  5080.       return i.call(b + '.json', {
  5081.         data: {
  5082.           user: this.get('id')
  5083.         },
  5084.         method: 'POST',
  5085.         success: function (a) {
  5086.           c.set(a.response)
  5087.         }
  5088.       })
  5089.     },
  5090.     block: function () {
  5091.       return this._changeBlockState(!0)
  5092.     },
  5093.     unblock: function () {
  5094.       return this._changeBlockState(!1)
  5095.     },
  5096.     report: function (a) {
  5097.       var b = this;
  5098.       return i.call('users/report.json', {
  5099.         data: {
  5100.           reason: a,
  5101.           user: this.get('id')
  5102.         },
  5103.         method: 'POST',
  5104.         success: function () {
  5105.           b.set('isFlagged', !0)
  5106.         }
  5107.       })
  5108.     },
  5109.     toggleFollowState: function () {
  5110.       return this._changeFollowState(!this.get('isFollowing'))
  5111.     },
  5112.     registeredLessThan: function (a, b) {
  5113.       var d = e.assureTzOffset(this.get('joinedAt')),
  5114.       f = c().subtract(a, b);
  5115.       return c(d).isAfter(f)
  5116.     },
  5117.     registeredToday: function () {
  5118.       return this.registeredLessThan(1, 'day')
  5119.     },
  5120.     registeredThisWeek: function () {
  5121.       return this.registeredLessThan(1, 'week')
  5122.     },
  5123.     shouldHomeOnboard: function () {
  5124.       return !this.get('homeOnboardingComplete') && !h.isFeatureActive('onboarding_without_channels')
  5125.     },
  5126.     setHomeOnboardComplete: function (a) {
  5127.       this.updateFlags({
  5128.         homeOnboardingComplete: a
  5129.       }),
  5130.       a && this.listenTo(this, 'change:homeOnboardingComplete', b.bind(this.set, this, 'homeOnboardingComplete', a, {
  5131.         silent: !0
  5132.       }))
  5133.     },
  5134.     handleBadgesUpdate: function (a) {
  5135.       if (this.collection && this.collection.thread && this.collection.thread.forum && this.collection.thread.forum.get('badges')) {
  5136.         var b = this.collection.thread.forum.get('badges');
  5137.         a.badges = a.badges ? a.badges.filter(function (a) {
  5138.           return b[a.id]
  5139.         }) : [
  5140.         ]
  5141.       }
  5142.       return a
  5143.     },
  5144.     updateFlags: function (a) {
  5145.       return this.set(a),
  5146.       i.call('internal/users/updateFlags.json', {
  5147.         data: b.mapObject(a, function (a) {
  5148.           return a ? 1 : 0
  5149.         }),
  5150.         method: 'POST'
  5151.       })
  5152.     }
  5153.   }, {
  5154.     MIN_PASSWORD_LEN: 6,
  5155.     MIN_NAME_LEN: 2,
  5156.     MAX_NAME_LEN: 30,
  5157.     MAX_LOCATION_LEN: 255,
  5158.     MAX_URL_LEN: 200
  5159.   });
  5160.   return m
  5161. }),
  5162. define('core/utils/html', [
  5163. ], function () {
  5164.   'use strict';
  5165.   var a = '...',
  5166.   b = a.length,
  5167.   c = function (a) {
  5168.     var b;
  5169.     try {
  5170.       b = (new window.DOMParser).parseFromString('<!doctype html><meta charset=utf-8><title> </title>', 'text/html')
  5171.     } catch (c) {
  5172.     }
  5173.     return b || (b = window.document.implementation.createHTMLDocument('')),
  5174.     b.body && (b.body.innerHTML = a),
  5175.     b
  5176.   };
  5177.   return {
  5178.     stripTags: function (a) {
  5179.       var b = c(a).body;
  5180.       return (b.textContent || b.innerText).replace(/\r?\n/g, ' ')
  5181.     },
  5182.     replaceAnchors: function (a, d) {
  5183.       var e = c(a);
  5184.       return [].forEach.call(e.querySelectorAll('a'), function (a) {
  5185.         var c = a.getAttribute('href') || '',
  5186.         e = a.innerHTML,
  5187.         f = d(a);
  5188.         0 === c.indexOf(e.slice(0, - b)) ? e = f : c.length && e.indexOf(c) !== - 1 ? e = e.replace(c, f) : e += ' ' + f,
  5189.         a.insertAdjacentHTML('afterend', e),
  5190.         a.parentNode.removeChild(a)
  5191.       }),
  5192.       e.body.innerHTML.trim()
  5193.     }
  5194.   }
  5195. }),
  5196. define('core/advice', [
  5197.   'underscore'
  5198. ], function (a) {
  5199.   'use strict';
  5200.   function b() {
  5201.     a.each(['before',
  5202.     'after',
  5203.     'around'], function (a) {
  5204.       this[a] = function (b, d) {
  5205.         return 'function' == typeof this[b] ? this[b] = c[a](this[b], d) : this[b] = d,
  5206.         this[b]
  5207.       }
  5208.     }, this)
  5209.   }
  5210.   var c = {
  5211.     around: function (b, c) {
  5212.       return function () {
  5213.         var d = a.toArray(arguments);
  5214.         return c.apply(this, [
  5215.           a.bind(b, this)
  5216.         ].concat(d))
  5217.       }
  5218.     },
  5219.     before: function (b, d) {
  5220.       return c.around(b, function () {
  5221.         var b = a.toArray(arguments),
  5222.         c = b.shift();
  5223.         return d.apply(this, b),
  5224.         c.apply(this, b)
  5225.       })
  5226.     },
  5227.     after: function (b, d) {
  5228.       return c.around(b, function () {
  5229.         var b = a.toArray(arguments),
  5230.         c = b.shift(),
  5231.         e = c.apply(this, b);
  5232.         return d.apply(this, b),
  5233.         e
  5234.       })
  5235.     }
  5236.   };
  5237.   return {
  5238.     withAdvice: b
  5239.   }
  5240. }),
  5241. define('core/models/mixins', [
  5242.   'underscore',
  5243.   'moment',
  5244.   'core/time'
  5245. ], function (a, b, c) {
  5246.   'use strict';
  5247.   function d() {
  5248.     b.locale('en', {
  5249.       relativeTime: {
  5250.         future: '%s from now',
  5251.         past: '%s ago',
  5252.         s: 'a few seconds',
  5253.         ss: '%d seconds',
  5254.         m: 'a minute',
  5255.         mm: '%d minutes',
  5256.         h: 'an hour',
  5257.         hh: '%d hours',
  5258.         d: 'a day',
  5259.         dd: '%d days',
  5260.         M: 'a month',
  5261.         MM: '%d months',
  5262.         y: 'a year',
  5263.         yy: '%d years'
  5264.       }
  5265.     }),
  5266.     this._getCreatedMoment = a.memoize(function (a) {
  5267.       var d = this.get(a || 'createdAt');
  5268.       if (d) return b(c.assureTzOffset(d), c.ISO_8601)
  5269.     }, function (a) {
  5270.       return this.get(a || 'createdAt')
  5271.     }),
  5272.     this.getRelativeCreatedAt = function (a) {
  5273.       var b = this._getCreatedMoment(a);
  5274.       return b && b.from(Number(new Date))
  5275.     },
  5276.     this.getFormattedCreatedAt = a.memoize(function (a) {
  5277.       var b = this._getCreatedMoment(a);
  5278.       return b && b.format('LLLL')
  5279.     }, function (a) {
  5280.       return this.get(a || 'createdAt')
  5281.     })
  5282.   }
  5283.   return {
  5284.     withCreatedAt: d
  5285.   }
  5286. }),
  5287. define('core/collections/UserCollection', [
  5288.   'jquery',
  5289.   'backbone',
  5290.   'core/models/User'
  5291. ], function (a, b, c) {
  5292.   'use strict';
  5293.   var d = b.Collection.extend({
  5294.     model: c,
  5295.     initialize: function (a, c) {
  5296.       b.Collection.prototype.initialize.apply(this, arguments),
  5297.       this.thread = c && c.thread
  5298.     },
  5299.     fetch: function () {
  5300.       return a.when(!0)
  5301.     }
  5302.   });
  5303.   return d
  5304. }),
  5305. define('core/collections/VotersUserCollection', [
  5306.   'underscore',
  5307.   'backbone',
  5308.   'core/api',
  5309.   'core/collections/UserCollection'
  5310. ], function (a, b, c, d) {
  5311.   'use strict';
  5312.   var e = d.extend({
  5313.     LIMIT: 50,
  5314.     url: function () {
  5315.       return c.getURL('posts/listUsersVotedPost')
  5316.     },
  5317.     initialize: function (a, b) {
  5318.       this.postId = b.postId,
  5319.       this.threadId = b.threadId
  5320.     },
  5321.     fetch: function (c) {
  5322.       return b.Collection.prototype.fetch.call(this, a.extend({
  5323.         data: {
  5324.           post: this.postId,
  5325.           thread: this.threadId,
  5326.           vote: c.vote,
  5327.           limit: this.LIMIT
  5328.         }
  5329.       }, c))
  5330.     }
  5331.   });
  5332.   return e
  5333. }),
  5334. define('core/collections/VoteCollection', [
  5335.   'backbone',
  5336.   'core/models/Vote'
  5337. ], function (a, b) {
  5338.   'use strict';
  5339.   var c = a.Collection.extend({
  5340.     model: b
  5341.   });
  5342.   return c
  5343. }),
  5344. define('core/models/Post', [
  5345.   'jquery',
  5346.   'underscore',
  5347.   'backbone',
  5348.   'moment',
  5349.   'core/config/urls',
  5350.   'core/api',
  5351.   'core/strings',
  5352.   'core/time',
  5353.   'core/utils',
  5354.   'core/utils/html',
  5355.   'core/advice',
  5356.   'remote/config',
  5357.   'core/models/mixins',
  5358.   'core/collections/VotersUserCollection',
  5359.   'core/collections/VoteCollection'
  5360. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) {
  5361.   'use strict';
  5362.   var p = 1000,
  5363.   q = 0,
  5364.   r = 25000,
  5365.   s = function () {
  5366.     var b = a.now();
  5367.     return !(b - q < p) && (q = b, !0)
  5368.   },
  5369.   t = g.get,
  5370.   u = c.Model.extend({
  5371.     votersCollectionClass: n,
  5372.     defaults: function () {
  5373.       return {
  5374.         createdAt: d().format(h.ISO_8601),
  5375.         editableUntil: d().add(l.max_post_edit_days, 'days').format(h.ISO_8601),
  5376.         dislikes: 0,
  5377.         isApproved: !0,
  5378.         isDeleted: !1,
  5379.         isEdited: !1,
  5380.         isFlagged: !1,
  5381.         isFlaggedByUser: !1,
  5382.         isHighlighted: !1,
  5383.         isRealtime: !1,
  5384.         isImmediateReply: !1,
  5385.         isMinimized: null,
  5386.         hasMedia: !1,
  5387.         message: null,
  5388.         raw_message: null,
  5389.         likes: 0,
  5390.         media: [
  5391.         ],
  5392.         parent: null,
  5393.         points: 0,
  5394.         depth: 0,
  5395.         userScore: 0,
  5396.         rating: null
  5397.       }
  5398.     },
  5399.     initialize: function () {
  5400.       this.votes = new o
  5401.     },
  5402.     messageText: function () {
  5403.       var a = this.get('message');
  5404.       return a && j.stripTags(a)
  5405.     },
  5406.     permalink: function (a, b) {
  5407.       var c = this.id;
  5408.       if (!c || !a) return '';
  5409.       var d = b !== !1 && a.currentUrl || a.permalink(),
  5410.       e = window.document.createElement('a');
  5411.       return e.href = d,
  5412.       e.hash = '#comment-' + c,
  5413.       e.href
  5414.     },
  5415.     shortLink: function () {
  5416.       return e.shortener + '/p/' + Number(this.id).toString(36)
  5417.     },
  5418.     twitterText: function (a) {
  5419.       var b = 140,
  5420.       c = this.author.get('name') || this.author.get('username');
  5421.       b -= c.length + 3,
  5422.       b -= a.length + 1,
  5423.       b -= 2;
  5424.       var d = i.niceTruncate(this.messageText(), b);
  5425.       return '"' + d + '" — ' + c
  5426.     },
  5427.     toJSON: function (a) {
  5428.       var b = c.Model.prototype.toJSON.call(this);
  5429.       if (a) {
  5430.         var d = a.session,
  5431.         e = a.thread;
  5432.         b.canBeEdited = this.canBeEdited(d, e),
  5433.         b.canBeRepliedTo = this.canBeRepliedTo(d, e),
  5434.         b.canBeShared = this.canBeShared(),
  5435.         b.permalink = this.permalink(e)
  5436.       }
  5437.       return b.shortLink = this.shortLink(),
  5438.       b.isMinimized = this.isMinimized(),
  5439.       b.plaintext = this.messageText(),
  5440.       b.relativeCreatedAt = this.getRelativeCreatedAt(),
  5441.       b.formattedCreatedAt = this.getFormattedCreatedAt(),
  5442.       b.cid = this.cid,
  5443.       b
  5444.     },
  5445.     isPublic: function () {
  5446.       return !(!this.get('isHighlighted') && !this.get('isSponsored')) || !this.get('isDeleted') && this.get('isApproved')
  5447.     },
  5448.     isMinimized: function () {
  5449.       return !this.get('isHighlighted') && (this.get('isMinimized') !== !1 && !this.get('isApproved'))
  5450.     },
  5451.     isAuthorSessionUser: function () {
  5452.       return !1
  5453.     },
  5454.     canBeEdited: function () {
  5455.       return !1
  5456.     },
  5457.     canBeRepliedTo: function () {
  5458.       return !1
  5459.     },
  5460.     canBeShared: function () {
  5461.       return !1
  5462.     },
  5463.     validateMessage: function (a) {
  5464.       if (b.isString(a.raw_message)) {
  5465.         if ('' === a.raw_message) return t('Comments can\'t be blank.');
  5466.         if (a.raw_message.length < 2) return t('Comments must have at least 2 characters.');
  5467.         if (a.raw_message.length > r) return g.interpolate(t('Comments can\'t be longer than %(maxLength)s characters (currently %(currentLength)s characters).'), {
  5468.           maxLength: r,
  5469.           currentLength: a.raw_message.length
  5470.         })
  5471.       }
  5472.     },
  5473.     validate: function (c) {
  5474.       if (!this.id && !c.id) {
  5475.         var d = this.validateMessage(c);
  5476.         return d ? d : (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 ? t('Please sign in or enter a name and email address.') : '' === c.author_email || '' === c.author_name ? t('Please enter both a name and email address.') : b.isString(c.author_email) && !this.validateEmail(c.author_email) ? t('Invalid email address format.') : void 0)
  5477.       }
  5478.     },
  5479.     validateEmail: function (a) {
  5480.       return i.validateEmail(a)
  5481.     },
  5482.     report: function (a) {
  5483.       this.set('isFlagged', !0);
  5484.       var b = {
  5485.         post: this.id
  5486.       };
  5487.       a && (b.reason = a),
  5488.       f.call('posts/report.json', {
  5489.         data: b,
  5490.         method: 'POST'
  5491.       })
  5492.     },
  5493.     _highlight: function (a) {
  5494.       this.set('isHighlighted', a),
  5495.       f.call('posts/' + (a ? 'highlight' : 'unhighlight') + '.json', {
  5496.         data: {
  5497.           post: this.id
  5498.         },
  5499.         method: 'POST'
  5500.       })
  5501.     },
  5502.     highlight: function () {
  5503.       this._highlight(!0)
  5504.     },
  5505.     unhighlight: function () {
  5506.       this._highlight(!1)
  5507.     },
  5508.     getThreadId: function () {
  5509.       return this.get('thread')
  5510.     },
  5511.     getUpvotersUserCollection: b.memoize(function () {
  5512.       var a = this.votersCollectionClass;
  5513.       return new a((void 0), {
  5514.         postId: this.id,
  5515.         threadId: this.getThreadId()
  5516.       })
  5517.     }, function () {
  5518.       return [this.id,
  5519.       '1'].join('')
  5520.     }),
  5521.     getDownvotersUserCollection: b.memoize(function () {
  5522.       var a = this.votersCollectionClass;
  5523.       return new a((void 0), {
  5524.         postId: this.id,
  5525.         threadId: this.getThreadId()
  5526.       })
  5527.     }, function () {
  5528.       return [this.id,
  5529.       '-1'].join('')
  5530.     }),
  5531.     _vote: function (a, b, c) {
  5532.       var d = a - b,
  5533.       e = {
  5534.         likes: this.get('likes'),
  5535.         dislikes: this.get('dislikes'),
  5536.         points: this.get('points')
  5537.       };
  5538.       return 0 === d ? d : (a > 0 ? (e.likes += a, e.dislikes += b) : a < 0 ? (e.dislikes -= a, e.likes -= b) : b > 0 ? e.likes -= b : e.dislikes += b, e.points += d, c && (1 === a ? (this.getUpvotersUserCollection().add(c), this.getDownvotersUserCollection().remove(c)) : (this.getDownvotersUserCollection().add(c), this.getUpvotersUserCollection().remove(c))), this.set(e), d)
  5539.     },
  5540.     vote: function (a) {
  5541.       if (!s()) return 0;
  5542.       var b = this,
  5543.       c = b._vote(a, b.get('userScore'));
  5544.       if (0 !== c) {
  5545.         var d = b.author ? b.author.get('numLikesReceived') : 0;
  5546.         1 === b.get('userScore') ? d -= 1 : 1 === a && (d += 1),
  5547.         b.set('userScore', a),
  5548.         f.call('posts/vote.json', {
  5549.           data: {
  5550.             post: b.id,
  5551.             vote: a
  5552.           },
  5553.           method: 'POST',
  5554.           success: function (c) {
  5555.             b.votes.add({
  5556.               id: c.response.id,
  5557.               score: a
  5558.             }, {
  5559.               merge: !0
  5560.             }),
  5561.             b.author && b.author.set('numLikesReceived', d)
  5562.           }
  5563.         })
  5564.       }
  5565.     },
  5566.     _delete: function () {
  5567.       return this.set({
  5568.         isApproved: !1,
  5569.         isDeleted: !0
  5570.       }),
  5571.       f.call('posts/remove.json', {
  5572.         data: {
  5573.           post: this.id
  5574.         },
  5575.         method: 'POST'
  5576.       })
  5577.     },
  5578.     spam: function () {
  5579.       this.set({
  5580.         isApproved: !1,
  5581.         isDeleted: !0,
  5582.         isSpam: !0
  5583.       }),
  5584.       this.trigger('spam'),
  5585.       f.call('posts/spam.json', {
  5586.         data: {
  5587.           post: this.id
  5588.         },
  5589.         method: 'POST'
  5590.       })
  5591.     },
  5592.     _create: function (a, b) {
  5593.       var c = this,
  5594.       d = a.attributes,
  5595.       e = {
  5596.         thread: d.thread,
  5597.         message: d.raw_message,
  5598.         rating: d.rating
  5599.       };
  5600.       return d.parent && (e.parent = d.parent),
  5601.       d.author_name && (e.author_name = d.author_name, e.author_email = d.author_email),
  5602.       f.call('posts/create.json', {
  5603.         data: e,
  5604.         method: 'POST',
  5605.         success: function (a) {
  5606.           c.set(a.response),
  5607.           b.success && b.success()
  5608.         },
  5609.         error: b.error
  5610.       })
  5611.     },
  5612.     _update: function (a, b) {
  5613.       var c = this,
  5614.       d = a.attributes,
  5615.       e = {
  5616.         post: d.id,
  5617.         message: d.raw_message,
  5618.         rating: d.rating
  5619.       };
  5620.       return f.call('posts/update.json', {
  5621.         data: e,
  5622.         method: 'POST',
  5623.         success: function (a) {
  5624.           c.set(a.response),
  5625.           b.success && b.success()
  5626.         },
  5627.         error: b.error
  5628.       })
  5629.     },
  5630.     _read: function (a, b) {
  5631.       var c = this;
  5632.       return b = b || {
  5633.       },
  5634.       f.call('posts/details.json', {
  5635.         data: {
  5636.           post: c.id
  5637.         },
  5638.         method: 'GET',
  5639.         success: function (a) {
  5640.           b.isHighlighted && !a.response.isHighlighted && (a.response.isHighlighted = !0),
  5641.           c.set(a.response),
  5642.           b.success && b.success()
  5643.         },
  5644.         error: b.error
  5645.       })
  5646.     },
  5647.     sync: function (a, b, c) {
  5648.       c = c || {
  5649.       };
  5650.       var d = c.error;
  5651.       switch (d && (c.error = function (a) {
  5652.           var b = {
  5653.           };
  5654.           try {
  5655.             b = JSON.parse(a.responseText)
  5656.           } catch (c) {
  5657.           }
  5658.           d(b)
  5659.         }), a) {
  5660.         case 'create':
  5661.           return this._create(b, c);
  5662.         case 'update':
  5663.           return this._update(b, c);
  5664.         case 'delete':
  5665.           return this._delete();
  5666.         case 'read':
  5667.           return this._read(b, c);
  5668.         default:
  5669.           return null
  5670.       }
  5671.     },
  5672.     storageKey: function () {
  5673.       if (this.isNew() && this.getThreadId()) return ['drafts',
  5674.       'thread',
  5675.       this.getThreadId(),
  5676.       'parent',
  5677.       this.get('parent') || 0].join(':')
  5678.     }
  5679.   }, {
  5680.     formatMessage: function () {
  5681.       var a = /(?:\r\n|\r|\n){2,}/,
  5682.       c = /\r\n|\r|\n/;
  5683.       return function (d) {
  5684.         var e = b.chain(d.split(a)).compact().value(),
  5685.         f = b.map(e, function (a) {
  5686.           return b.chain(a.split(c)).compact().map(b.escape).join('<br>').value()
  5687.         }).join('</p><p>');
  5688.         return '<p>' + f + '</p>'
  5689.       }
  5690.     }()
  5691.   });
  5692.   return m.withCreatedAt.call(u.prototype),
  5693.   k.withAdvice.call(u.prototype),
  5694.   u.withAuthor = function (a) {
  5695.     this.around('set', function (c, d, e, f) {
  5696.       var g;
  5697.       if (null == d) return this;
  5698.       'object' == typeof d ? (g = d, f = e) : (g = {
  5699.       }, g[d] = e);
  5700.       var h = g.author;
  5701.       if (h) {
  5702.         if (b.isString(h) || b.isNumber(h)) {
  5703.           var i = h;
  5704.           h = {
  5705.           },
  5706.           h[a.prototype.idAttribute || 'id'] = i
  5707.         }
  5708.         var j = this.collection || this.author && this.author.collection,
  5709.         k = j && j.thread && j.thread.forum;
  5710.         if (this.author && this.author.get('badges').length && this.author.get('badges') [0].id) h.badges = this.author.get('badges');
  5711.          else if (k && k.get('badges') && h.badges) {
  5712.           var l = [
  5713.           ],
  5714.           m = h.badges || [
  5715.           ],
  5716.           n = k.get('badges');
  5717.           m.forEach(function (a) {
  5718.             n[a] && l.push(n[a])
  5719.           }),
  5720.           h.badges = l
  5721.         }
  5722.         this.author = new a(h),
  5723.         this.trigger('changeRelated:author'),
  5724.         delete g.author
  5725.       }
  5726.       return c.call(this, g, f)
  5727.     }),
  5728.     this.around('toJSON', function (a) {
  5729.       var c = a.apply(this, b.rest(arguments));
  5730.       return this.author && (c.author = this.author.toJSON()),
  5731.       c
  5732.     })
  5733.   },
  5734.   u.withMediaCollection = function (a) {
  5735.     this.after('set', function (c) {
  5736.       c && 'string' != typeof c && (b.isUndefined(c.media) || (this.media ? this.media.reset(c.media) : this.media = new a(c.media), delete c.media))
  5737.     }),
  5738.     this.around('toJSON', function (a) {
  5739.       var c = a.apply(this, b.rest(arguments));
  5740.       return this.media && (c.media = this.media.toJSON()),
  5741.       c
  5742.     })
  5743.   },
  5744.   u
  5745. }),
  5746. define('core/utils/threadRatingsHelpers', [
  5747.   'core/utils/object/get'
  5748. ], function (a) {
  5749.   'use strict';
  5750.   var b = {
  5751.   };
  5752.   return b.isThreadRatingsEnabled = function (b, c) {
  5753.     return !!(b && b.forum && c && c.id === b.forum) && Boolean(a(b, [
  5754.       'ratingsEnabled'
  5755.     ]) && a(c, [
  5756.       'settings',
  5757.       'threadRatingsEnabled'
  5758.     ]) && a(c, [
  5759.       'features',
  5760.       'threadRatings'
  5761.     ]))
  5762.   },
  5763.   b.isThreadModelRatingsEnabled = function (a) {
  5764.     if (!a || !a.forum) return !1;
  5765.     var b = a.forum.get('settings'),
  5766.     c = a.forum.get('features');
  5767.     return Boolean(a.get('ratingsEnabled') && b && b.threadRatingsEnabled && c && c.threadRatings)
  5768.   },
  5769.   b.isForumRatingsEnabled = function (b) {
  5770.     return !!b && Boolean(a(b, [
  5771.       'settings',
  5772.       'threadRatingsEnabled'
  5773.     ]) && a(b, [
  5774.       'features',
  5775.       'threadRatings'
  5776.     ]))
  5777.   },
  5778.   b.isForumModelRatingsEnabled = function (a) {
  5779.     if (!a) return !1;
  5780.     var b = a.get('settings'),
  5781.     c = a.get('features');
  5782.     return Boolean(b && b.threadRatingsEnabled && c && c.threadRatings)
  5783.   },
  5784.   b
  5785. }),
  5786. define('core/models/Thread', [
  5787.   'underscore',
  5788.   'backbone',
  5789.   'loglevel',
  5790.   'core/config/urls',
  5791.   'core/utils',
  5792.   'core/api',
  5793.   'core/config',
  5794.   'core/advice',
  5795.   'core/UniqueModel',
  5796.   'core/utils/threadRatingsHelpers',
  5797.   'core/models/User'
  5798. ], function (a, b, c, d, e, f, g, h, i, j, k) {
  5799.   'use strict';
  5800.   var l = b.Model,
  5801.   m = l.prototype,
  5802.   n = l.extend({
  5803.     defaults: {
  5804.       author: null,
  5805.       category: null,
  5806.       createdAt: null,
  5807.       forum: null,
  5808.       identifiers: [
  5809.       ],
  5810.       ipAddress: null,
  5811.       isClosed: !1,
  5812.       isDeleted: !1,
  5813.       hasStreaming: !1,
  5814.       link: null,
  5815.       message: null,
  5816.       slug: null,
  5817.       title: null,
  5818.       userSubscription: !1,
  5819.       posts: 0,
  5820.       likes: 0,
  5821.       dislikes: 0,
  5822.       userScore: 0
  5823.     },
  5824.     initialize: function (a, b) {
  5825.       b = b || {
  5826.       },
  5827.       this.moderators = b.moderators,
  5828.       this.forum = b.forum,
  5829.       this.on('change:userScore', function () {
  5830.         var a = this.get('userScore');
  5831.         a > 0 && 0 === this.get('likes') && this.set('likes', a)
  5832.       }, this)
  5833.     },
  5834.     _vote: function (a, b) {
  5835.       var c = a - b;
  5836.       return 0 === c ? c : (this.set('likes', this.get('likes') + c), c)
  5837.     },
  5838.     vote: function (a) {
  5839.       var b = this,
  5840.       c = b._vote(a, b.get('userScore'));
  5841.       0 !== c && (this.set('userScore', a), f.call('threads/vote.json', {
  5842.         data: {
  5843.           thread: this.id,
  5844.           vote: a
  5845.         },
  5846.         method: 'POST',
  5847.         success: function (a) {
  5848.           a.response.id && b.trigger('vote:success', a)
  5849.         }
  5850.       }))
  5851.     },
  5852.     fetch: function (a) {
  5853.       var b,
  5854.       d = this,
  5855.       e = d.attributes;
  5856.       a = a || {
  5857.       },
  5858.       b = e.identifier ? 'ident:' + e.identifier : 'link:' + e.url,
  5859.       f.call('threads/details.json', {
  5860.         data: {
  5861.           thread: b,
  5862.           forum: e.forum
  5863.         },
  5864.         success: function (b) {
  5865.           d.set(b.response),
  5866.           a.success && a.success()
  5867.         },
  5868.         error: function () {
  5869.           g.debug ? d.save({
  5870.           }, {
  5871.             success: a.success
  5872.           }) : c.info('Couldn\'t find thread; not creating in production.')
  5873.         }
  5874.       })
  5875.     },
  5876.     _toggleState: function (a, b) {
  5877.       b || (b = {
  5878.       });
  5879.       var c = a ? 'open.json' : 'close.json';
  5880.       return this.set('isClosed', !a),
  5881.       f.call('threads/' + c, {
  5882.         method: 'POST',
  5883.         data: {
  5884.           thread: this.id
  5885.         },
  5886.         success: b.success,
  5887.         error: b.error
  5888.       })
  5889.     },
  5890.     open: function (a) {
  5891.       return this._toggleState(!0, a)
  5892.     },
  5893.     close: function (a) {
  5894.       return this._toggleState(!1, a)
  5895.     },
  5896.     premoderate: function (b, c) {
  5897.       return this.set('validateAllPosts', b),
  5898.       f.call('threads/update', a.extend({
  5899.       }, c, {
  5900.         method: 'POST',
  5901.         data: a.extend({
  5902.           thread: this.id,
  5903.           validateAllPosts: b ? 1 : 0
  5904.         }, c && c.data)
  5905.       }))
  5906.     },
  5907.     sync: function () {
  5908.       var a = this,
  5909.       b = a.attributes;
  5910.       f.call('threads/create.json', {
  5911.         data: {
  5912.           title: b.title,
  5913.           forum: b.forum,
  5914.           identifier: b.identifier,
  5915.           url: b.url
  5916.         },
  5917.         method: 'POST',
  5918.         success: function (b) {
  5919.           a.set(b.response)
  5920.         }
  5921.       })
  5922.     },
  5923.     fetchRatings: function () {
  5924.       var a = this,
  5925.       b = {
  5926.         thread: a.id
  5927.       };
  5928.       return f.call('threads/ratingsSummary.json', {
  5929.         data: b,
  5930.         method: 'GET',
  5931.         success: function (b) {
  5932.           a.set('ratings', b.response)
  5933.         }
  5934.       })
  5935.     },
  5936.     toggleRatingsEnabled: function () {
  5937.       var a = this;
  5938.       if (j.isForumModelRatingsEnabled(a.forum)) {
  5939.         var b = a.get('ratingsEnabled'),
  5940.         c = {
  5941.           thread: a.id,
  5942.           ratingsEnabled: b ? 0 : 1
  5943.         };
  5944.         return a.set('ratingsEnabled', !b),
  5945.         f.call('threads/update.json', {
  5946.           data: c,
  5947.           method: 'POST'
  5948.         })
  5949.       }
  5950.     },
  5951.     incrementPostCount: function (a) {
  5952.       var b = this.get('posts') + a;
  5953.       this.set('posts', b > 0 ? b : 0)
  5954.     },
  5955.     isModerator: function (b) {
  5956.       var c;
  5957.       if (this.moderators) return c = b instanceof k || a.isObject(b) ? b.id : b,
  5958.       c = parseInt(c, 10),
  5959.       a(this.moderators).contains(c)
  5960.     },
  5961.     isOP: function (b) {
  5962.       var c = b instanceof k || a.isObject(b) ? b.id : b;
  5963.       return this.get('author') === c
  5964.     },
  5965.     subscribe: function (a) {
  5966.       a = a !== !1;
  5967.       var b = this.get('userSubscription');
  5968.       if (b !== a) {
  5969.         this.set('userSubscription', a);
  5970.         var c = a ? 'subscribe.json' : 'unsubscribe.json',
  5971.         d = {
  5972.           thread: this.id
  5973.         };
  5974.         return f.call('threads/' + c, {
  5975.           data: d,
  5976.           method: 'POST'
  5977.         })
  5978.       }
  5979.     },
  5980.     twitterText: function (a) {
  5981.       var b = 140 - (a.length + 1),
  5982.       c = this.get('clean_title');
  5983.       return c = e.niceTruncate(c, b)
  5984.     },
  5985.     permalink: function () {
  5986.       return this.get('url') || this.get('link') || this.currentUrl
  5987.     },
  5988.     shortLink: function () {
  5989.       return d.shortener + '/t/' + Number(this.id).toString(36)
  5990.     },
  5991.     toJSON: function () {
  5992.       var a = m.toJSON.call(this);
  5993.       return a.permalink = this.permalink(),
  5994.       a.shortLink = this.shortLink(),
  5995.       a
  5996.     },
  5997.     getDiscussionRoute: function (a) {
  5998.       var b = [
  5999.         '',
  6000.         'home',
  6001.         'discussion',
  6002.         this.forum.id,
  6003.         this.get('slug'),
  6004.         ''
  6005.       ];
  6006.       return a = a || this.forum.channel,
  6007.       a && (a = a.attributes || a, b.splice(2, 0, 'channel', a.slug), b.splice(1, 1)),
  6008.       b.join('/')
  6009.     }
  6010.   });
  6011.   return h.withAdvice.call(n.prototype),
  6012.   n.withThreadVoteCollection = function (a) {
  6013.     this.after('initialize', function () {
  6014.       this.votes = new a,
  6015.       this.on('vote:success', function (a) {
  6016.         this.votes.get(a.response.id) || this.votes.add({
  6017.           id: a.response.id,
  6018.           score: a.response.vote,
  6019.           currentUser: !0
  6020.         })
  6021.       }, this)
  6022.     })
  6023.   },
  6024.   n.withPostCollection = function (b) {
  6025.     this.after('initialize', function (c) {
  6026.       c = c || {
  6027.       },
  6028.       this.posts = new b(c.posts, {
  6029.         thread: this,
  6030.         cursor: c.postCursor,
  6031.         order: c.order,
  6032.         perPage: this.postsPerPage
  6033.       }),
  6034.       this.listenTo(this.posts, 'add reset', function (b) {
  6035.         b = b.models ? b.models : [
  6036.           b
  6037.         ],
  6038.         this.users && a.each(b, function (a) {
  6039.           this.users.get(a.author.id) || this.users.add(a.author)
  6040.         }),
  6041.         this.recalculatePostCount()
  6042.       }),
  6043.       this.listenTo(this.posts, 'change:isDeleted change:isFlagged', function (a, b) {
  6044.         b && this.incrementPostCount( - 1)
  6045.       })
  6046.     }),
  6047.     this.recalculatePostCount = function () {
  6048.       var a = this.get('posts');
  6049.       a > 50 || (a = this.posts.reduce(function (a, b) {
  6050.         return b.isPublic() ? a + 1 : a
  6051.       }, 0), this.set('posts', a))
  6052.     }
  6053.   },
  6054.   i.addType('Thread', n),
  6055.   n
  6056. }),
  6057. define('core/models/Forum', [
  6058.   'backbone',
  6059.   'core/UniqueModel',
  6060.   'core/api'
  6061. ], function (a, b, c) {
  6062.   'use strict';
  6063.   var d = a.Model.extend({
  6064.     defaults: {
  6065.       settings: {
  6066.       },
  6067.       badges: [
  6068.       ],
  6069.       followUrl: 'forums/follow',
  6070.       unfollowUrl: 'forums/unfollow',
  6071.       isFollowing: !1
  6072.     },
  6073.     initialize: function (a, b) {
  6074.       b && b.channel && (this.channel = b.channel),
  6075.       this.getFeatures(),
  6076.       this.on('change:id', this.getFeatures),
  6077.       this.on('change:id', this.getBadges)
  6078.     },
  6079.     _changeFollowingState: function (a) {
  6080.       return c.call(a, {
  6081.         method: 'POST',
  6082.         data: {
  6083.           target: this.get('id')
  6084.         }
  6085.       })
  6086.     },
  6087.     follow: function () {
  6088.       return this.set('isFollowing', !0),
  6089.       this._changeFollowingState(this.get('followUrl'))
  6090.     },
  6091.     unfollow: function () {
  6092.       return this.set('isFollowing', !1),
  6093.       this._changeFollowingState(this.get('unfollowUrl'))
  6094.     },
  6095.     toggleFollowed: function () {
  6096.       if (this.channel && this.channel.get('options').isCurationOnlyChannel) return this.channel.toggleFollowed();
  6097.       var a = this.get('isFollowing') ? this.unfollow() : this.follow();
  6098.       return this.trigger('toggled:isFollowing'),
  6099.       a
  6100.     },
  6101.     getFeatures: function () {
  6102.       var a = this;
  6103.       a.id && c.call('forums/details', {
  6104.         data: {
  6105.           forum: this.id,
  6106.           attach: 'forumFeatures'
  6107.         },
  6108.         success: function (b) {
  6109.           b && b.response && a.set('features', b.response.features)
  6110.         }
  6111.       })
  6112.     },
  6113.     getBadges: function () {
  6114.       if (this.id && this.get('badges')) {
  6115.         var a = {
  6116.         },
  6117.         b = {
  6118.         };
  6119.         b.id = this.get('pk'),
  6120.         b.url = this.get('id'),
  6121.         this.get('badges').forEach(function (c) {
  6122.           c.forum = b,
  6123.           a[c.id] = c
  6124.         }),
  6125.         this.set('badges', a)
  6126.       }
  6127.     }
  6128.   });
  6129.   return b.addType('Forum', d),
  6130.   d
  6131. }),
  6132. define('core/models/Media', [
  6133.   'underscore',
  6134.   'backbone',
  6135.   'core/api',
  6136.   'core/UniqueModel'
  6137. ], function (a, b, c, d) {
  6138.   'use strict';
  6139.   var e = b.Model.extend({
  6140.     idAttribute: 'url',
  6141.     defaults: {
  6142.       mediaType: null,
  6143.       html: '',
  6144.       htmlWidth: null,
  6145.       htmlHeight: null,
  6146.       thumbnailUrl: '',
  6147.       thumbnailWidth: null,
  6148.       thumbnailHeight: null,
  6149.       url: '',
  6150.       urlRedirect: '',
  6151.       resolvedUrl: '',
  6152.       resolvedUrlRedirect: '',
  6153.       title: '',
  6154.       description: '',
  6155.       providerName: ''
  6156.     },
  6157.     parse: function (a) {
  6158.       return a.response
  6159.     },
  6160.     sync: function (b, d, e) {
  6161.       if ('read' !== b) throw new Error('Media models do not support methods other than "read".');
  6162.       return c.call('media/details.json', a.extend({
  6163.         method: 'POST',
  6164.         data: {
  6165.           url: this.get('url'),
  6166.           forum: e.forum
  6167.         }
  6168.       }, e))
  6169.     }
  6170.   }, {
  6171.     MEDIA_TYPES: {
  6172.       IMAGE: '1',
  6173.       IMAGE_UPLOAD: '2',
  6174.       YOUTUBE_VIDEO: '3',
  6175.       WEBPAGE: '4',
  6176.       TWITTER_STATUS: '5',
  6177.       FACEBOOK_PAGE: '6',
  6178.       FACEBOOK_POST: '7',
  6179.       FACEBOOK_PHOTO: '8',
  6180.       FACEBOOK_VIDEO: '9',
  6181.       SOUNDCLOUD_SOUND: '10',
  6182.       GOOGLE_MAP: '11',
  6183.       VIMEO_VIDEO: '12',
  6184.       VINE_VIDEO: '14',
  6185.       GIF_VIDEO: '15',
  6186.       MP4_VIDEO: '16'
  6187.     },
  6188.     WEBPAGE_TYPES: [
  6189.       '4',
  6190.       '6',
  6191.       '7'
  6192.     ]
  6193.   });
  6194.   return d.addType('Media', e),
  6195.   e
  6196. }),
  6197. define('core/collections/MediaCollection', [
  6198.   'backbone',
  6199.   'core/models/Media'
  6200. ], function (a, b) {
  6201.   'use strict';
  6202.   var c = a.Collection.extend({
  6203.     model: b
  6204.   });
  6205.   return c
  6206. }),
  6207. define('core/utils/sso', [
  6208. ], function () {
  6209.   'use strict';
  6210.   var a = function (a) {
  6211.     var b = a;
  6212.     return b && (b = String(b), 0 === b.indexOf('//') && (b = 'https:' + b), /https?:\/\//.test(b) || (b = null), /\{username\}/.test(b) || (b = null)),
  6213.     b
  6214.   },
  6215.   b = function (a, b) {
  6216.     return a.replace(/\{username\}/gi, encodeURIComponent(b))
  6217.   };
  6218.   return {
  6219.     getProfileUrlTemplate: a,
  6220.     getProfileUrl: b
  6221.   }
  6222. }),
  6223. define('common/collections/VotersUserCollection', [
  6224.   'core/collections/VotersUserCollection'
  6225. ], function (a) {
  6226.   'use strict';
  6227.   var b = a.extend({
  6228.     initialize: function (b, c) {
  6229.       a.prototype.initialize.call(this, b, c);
  6230.       var d = require('common/Session');
  6231.       this.session = d.get()
  6232.     },
  6233.     parse: function (a) {
  6234.       return this.session.get('canModerate') && a.response && a.response.forEach(function (a) {
  6235.         a.isBlocking = !1
  6236.       }),
  6237.       a.response
  6238.     }
  6239.   });
  6240.   return b
  6241. }),
  6242. define('common/models', [
  6243.   'require',
  6244.   'jquery',
  6245.   'underscore',
  6246.   'backbone',
  6247.   'modernizr',
  6248.   'core/api',
  6249.   'core/UniqueModel',
  6250.   'core/models/User',
  6251.   'core/models/Post',
  6252.   'core/models/Thread',
  6253.   'core/models/Forum',
  6254.   'core/collections/MediaCollection',
  6255.   'core/utils/object/get',
  6256.   'core/utils/sso',
  6257.   'core/utils/url/serialize',
  6258.   'core/utils/guid',
  6259.   'common/utils',
  6260.   'core/utils',
  6261.   'common/urls',
  6262.   'core/shared/urls',
  6263.   'common/collections/VotersUserCollection',
  6264.   'backbone.uniquemodel'
  6265. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) {
  6266.   'use strict';
  6267.   var v = k.extend({
  6268.     defaults: {
  6269.       settings: {
  6270.       }
  6271.     },
  6272.     toJSON: function () {
  6273.       return c.extend(d.Model.prototype.toJSON.apply(this, arguments), {
  6274.         homeUrl: t.apps.home + 'home/forums/' + this.id + '/'
  6275.       })
  6276.     }
  6277.   }),
  6278.   w = j.extend({
  6279.     initialize: function (b, d) {
  6280.       j.prototype.initialize.apply(this, arguments),
  6281.       d = d || {
  6282.       };
  6283.       var e = this,
  6284.       f = a('common/collections');
  6285.       e.users = new f.UserCollection(d.users, {
  6286.         thread: e
  6287.       }),
  6288.       e.forum && (e.moderatorList = new f.ModeratorCollection(null, {
  6289.         forum: e.forum.get('id')
  6290.       })),
  6291.       e.posts = new f.SubpaginatedPostCollection(d.posts, {
  6292.         thread: e,
  6293.         cursor: d.postCursor,
  6294.         order: d.order,
  6295.         perPage: r.isMobileUserAgent() ? 20 : 50
  6296.       }),
  6297.       e.votes = new f.ThreadVoteCollection,
  6298.       e.posts.on('add reset', function (a) {
  6299.         a = a.models ? a.models : [
  6300.           a
  6301.         ],
  6302.         c.each(a, function (a) {
  6303.           e.users.get(a.author.id) || e.users.add(a.author)
  6304.         }),
  6305.         e.recalculatePostCount()
  6306.       }),
  6307.       e.listenTo(e.posts, 'change:isDeleted change:isFlagged', function (a, b) {
  6308.         b && e.incrementPostCount( - 1)
  6309.       }),
  6310.       e.queue = new f.QueuedPostCollection(null, {
  6311.         thread: e
  6312.       })
  6313.     },
  6314.     recalculatePostCount: function () {
  6315.       var a = this.get('posts');
  6316.       a > 50 || (a = this.posts.buffer.reduce(function (a, b) {
  6317.         var c = b.isPublic() && (!b.get('sb') || b.isAuthorSessionUser());
  6318.         return c ? a + 1 : a
  6319.       }, 0), this.set('posts', a))
  6320.     },
  6321.     toJSON: function () {
  6322.       var a = this.get('forum'),
  6323.       b = c.isObject(a) ? a.id : a;
  6324.       return c.extend(j.prototype.toJSON.apply(this, arguments), {
  6325.         homeUrl: t.apps.home + 'home/discussions/' + b + '/' + this.get('slug') + '/'
  6326.       })
  6327.     }
  6328.   });
  6329.   j.withThreadVoteCollection.call(w.prototype, d.Collection);
  6330.   var x = i.extend({
  6331.     votersCollectionClass: u,
  6332.     initialize: function () {
  6333.       i.prototype.initialize.apply(this, arguments);
  6334.       var b = a('common/collections');
  6335.       this.usersTyping = new b.TypingUserCollection
  6336.     },
  6337.     isAuthorSessionUser: function (b) {
  6338.       var c = a('common/Session'),
  6339.       d = m(b, [
  6340.         'user',
  6341.         'id'
  6342.       ]) || c.fromCookie().id;
  6343.       return !!(d && this.author && this.author.id) && this.author.id.toString() === d.toString()
  6344.     },
  6345.     canBeEdited: function (a, b) {
  6346.       var c = this.get('editableUntil'),
  6347.       d = (new Date).toISOString();
  6348.       return !b.get('isClosed') && !this.get('isDeleted') && a.isLoggedIn() && this.isAuthorSessionUser(a) && this.get('raw_message') && !this.get('isHighlighted') && !this.get('isSponsored') && d < c
  6349.     },
  6350.     canBeRepliedTo: function (a, b) {
  6351.       return !b.get('isClosed') && a.get('canReply') && !this.get('isDeleted') && (this.get('isApproved') || b.isModerator(a.user))
  6352.     },
  6353.     canBeShared: function () {
  6354.       return !this.get('isDeleted') && !this.get('isSponsored')
  6355.     },
  6356.     getParent: function () {
  6357.       var a = this.get('parent');
  6358.       if (a) return new g(x, {
  6359.         id: String(a)
  6360.       })
  6361.     }
  6362.   }, {
  6363.     fetchContext: function (a, d, e) {
  6364.       e = e || {
  6365.       };
  6366.       var h = b.Deferred();
  6367.       return f.call('posts/getContext.json', {
  6368.         method: 'GET',
  6369.         data: {
  6370.           post: a,
  6371.           order: d.posts.buffer.order
  6372.         },
  6373.         success: function (a) {
  6374.           var b = c.filter(a.response, function (a) {
  6375.             return a.thread === d.get('id')
  6376.           });
  6377.           return b ? (c.each(b, function (a) {
  6378.             d.posts.get(a.id) && delete a.hasMore,
  6379.             a = new g(x, a),
  6380.             e.requestedByPermalink && (a.requestedByPermalink = !0),
  6381.             d.posts.add(a)
  6382.           }), void h.resolve(b)) : void h.reject()
  6383.         }
  6384.       }),
  6385.       h.promise()
  6386.     }
  6387.   });
  6388.   i.withAuthor.call(x.prototype, g.wrap(h)),
  6389.   i.withMediaCollection.call(x.prototype, l),
  6390.   g.addType('Post', x);
  6391.   var y = d.Model.extend({
  6392.     defaults: {
  6393.       user: null,
  6394.       message: null,
  6395.       parentId: null,
  6396.       immedReply: !1,
  6397.       createdAt: void 0
  6398.     },
  6399.     getVisibleParent: function (a) {
  6400.       for (var b, c = this; c.get('parentId'); ) {
  6401.         if (b = a.posts.get(c.get('parentId'))) return b;
  6402.         if (c = a.queue.get(c.get('parentId')), !c) return null
  6403.       }
  6404.       return null
  6405.     },
  6406.     toPost: function (a) {
  6407.       var b = this,
  6408.       c = a.posts.get(b.get('parentId')),
  6409.       d = c ? c.get('depth') + 1 : 0,
  6410.       e = new g(x, {
  6411.         id: b.id,
  6412.         forum: a.get('forum'),
  6413.         thread: a.id,
  6414.         message: b.get('message'),
  6415.         parent: b.get('parentId'),
  6416.         depth: d,
  6417.         createdAt: b.get('createdAt'),
  6418.         isRealtime: !0,
  6419.         media: b.get('media'),
  6420.         isImmediateReply: b.get('immedReply')
  6421.       });
  6422.       return e.author = b.get('user'),
  6423.       e
  6424.     }
  6425.   }),
  6426.   z = d.Model.extend({
  6427.     defaults: {
  6428.       user: null,
  6429.       post: null,
  6430.       thread: null,
  6431.       client_context: null,
  6432.       typing: !0
  6433.     },
  6434.     idAttribute: 'client_context',
  6435.     set: function () {
  6436.       return this.lastModified = new Date,
  6437.       d.Model.prototype.set.apply(this, arguments)
  6438.     },
  6439.     sync: function () {
  6440.       var a = this.toJSON(),
  6441.       b = o(s.realertime + '/api/typing', a);
  6442.       try {
  6443.         q.CORS.request('GET', b).send()
  6444.       } catch (c) {
  6445.       }
  6446.     }
  6447.   }, {
  6448.     make: function (a) {
  6449.       return a.client_context || (a.client_context = p.generate()),
  6450.       new g(z, a)
  6451.     }
  6452.   });
  6453.   g.addType('TypingUser', z);
  6454.   var A = h.prototype.toJSON;
  6455.   c.extend(h.prototype, {
  6456.     getFollowing: function () {
  6457.       var b = a('common/collections/profile');
  6458.       return this.following || (this.following = new b.FollowingCollection(null, {
  6459.         user: this
  6460.       }))
  6461.     },
  6462.     hasDisqusProfileUrl: function () {
  6463.       var a = A.apply(this, arguments);
  6464.       if (!a.profileUrl) return !1;
  6465.       var b = a.profileUrl.match(/^https?:\/\/([^/?#]+)(?:[/?#]|$)/i);
  6466.       return b && b.length >= 2 && ('disqus.com' === b[1] || 'dev.disqus.org:8000' === b[1])
  6467.     },
  6468.     toJSON: function () {
  6469.       var b = A.apply(this, arguments),
  6470.       c = a('common/Session'),
  6471.       d = c.get(),
  6472.       e = n.getProfileUrlTemplate(d && d.get('sso') && d.get('sso').profile_url),
  6473.       f = this.hasDisqusProfileUrl();
  6474.       return b.isSSOProfileUrl = !f || Boolean(e),
  6475.       f && e && (b.profileUrl = n.getProfileUrl(e, b.name)),
  6476.       b
  6477.     }
  6478.   }),
  6479.   g.addType('User', h);
  6480.   var B = h.extend({
  6481.     defaults: c.extend({
  6482.       numPosts: 0
  6483.     }, h.prototype.defaults)
  6484.   }),
  6485.   C = e.sessionstorage ? 'sessionStorage' : null,
  6486.   D = d.UniqueModel(h, 'User', C),
  6487.   E = d.UniqueModel(B, 'User', C),
  6488.   F = d.Model.extend({
  6489.   }),
  6490.   G = d.Model.extend({
  6491.     defaults: {
  6492.       id: '',
  6493.       title: '',
  6494.       rating: 'g',
  6495.       'default': {
  6496.         url: '',
  6497.         height: '',
  6498.         width: ''
  6499.       },
  6500.       fixedWidth200: {
  6501.         url: '',
  6502.         height: '',
  6503.         width: ''
  6504.       },
  6505.       fixedWidth100: {
  6506.         url: '',
  6507.         height: '',
  6508.         width: ''
  6509.       }
  6510.     }
  6511.   });
  6512.   return {
  6513.     Forum: v,
  6514.     Thread: w,
  6515.     Post: x,
  6516.     QueuedPost: y,
  6517.     TypingUser: z,
  6518.     User: h,
  6519.     TopUser: B,
  6520.     Switch: F,
  6521.     SyncedUser: D,
  6522.     SyncedTopUser: E,
  6523.     GifObject: G
  6524.   }
  6525. }),
  6526. define('core/models/Channel', [
  6527.   'underscore',
  6528.   'backbone',
  6529.   'core/UniqueModel',
  6530.   'core/api',
  6531.   'core/models/Forum',
  6532.   'core/strings'
  6533. ], function (a, b, c, d, e, f) {
  6534.   'use strict';
  6535.   var g = f.get,
  6536.   h = b.Model.extend({
  6537.     defaults: {
  6538.       primaryForum: {
  6539.       },
  6540.       slug: null,
  6541.       name: null,
  6542.       options: {
  6543.       },
  6544.       followUrl: 'channels/follow',
  6545.       unfollowUrl: 'channels/unfollow'
  6546.     },
  6547.     idAttribute: 'slug',
  6548.     initialize: function (a, b) {
  6549.       this.buildPrimaryForum(b),
  6550.       this.listenTo(this, 'change:primaryForum', this.updatePrimaryForum),
  6551.       this.listenTo(this, 'change:primaryCategory', this.updatePrimaryCategory)
  6552.     },
  6553.     buildPrimaryForum: function () {
  6554.       if (!this.primaryForum) {
  6555.         var a = this.get('primaryForum');
  6556.         a && (this.primaryForum = new c(e, a, {
  6557.           channel: this
  6558.         }), this.unset('primaryForum'))
  6559.       }
  6560.     },
  6561.     updatePrimaryForum: function () {
  6562.       var a = this.get('primaryForum');
  6563.       a && (this.primaryForum || this.buildPrimaryForum(), this.primaryForum.set(a), this.unset('primaryForum'))
  6564.     },
  6565.     updatePrimaryCategory: function () {
  6566.       var a = this.get('primaryCategory'),
  6567.       b = this.primaryCategory;
  6568.       null === a ? this.primaryCategory = void 0 : b ? b.set(a) : this.primaryCategory = new c(h, a),
  6569.       this.unset('primaryCategory'),
  6570.       this.trigger('changeRelated:primaryCategory')
  6571.     },
  6572.     fetch: function (c) {
  6573.       return c = c ? a.clone(c) : {
  6574.       },
  6575.       c.data = this.buildFetchData(c.data),
  6576.       b.Model.prototype.fetch.call(this, c)
  6577.     },
  6578.     buildFetchData: function (b) {
  6579.       var c = b ? a.clone(b) : {
  6580.       };
  6581.       return this.id && (c.channel = this.id),
  6582.       c
  6583.     },
  6584.     url: function (a) {
  6585.       return d.getURL(this.constructor.URLS[a] || this.constructor.URLS.read)
  6586.     },
  6587.     sync: function (c, d, e) {
  6588.       var f = d.attributes;
  6589.       e = a.extend({
  6590.         url: this.url(c),
  6591.         emulateHTTP: !0
  6592.       }, e);
  6593.       var g = {
  6594.         bannerColor: f.bannerColor,
  6595.         description: f.description,
  6596.         primaryCategory: d.primaryCategory && d.primaryCategory.get('slug') || ''
  6597.       };
  6598.       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) {
  6599.         case 'create':
  6600.           e.processData = !1,
  6601.           e.contentType = !1,
  6602.           g.name = f.name,
  6603.           e.data = this.toFormData(a.extend({
  6604.           }, g, e.data));
  6605.           break;
  6606.         case 'update':
  6607.           e.processData = !1,
  6608.           e.contentType = !1,
  6609.           g.channel = f.slug,
  6610.           e.data = this.toFormData(a.extend({
  6611.           }, g, e.data))
  6612.       }
  6613.       return b.sync(c, d, e)
  6614.     },
  6615.     toFormData: function (b) {
  6616.       return a.reduce(b, function (b, c, d) {
  6617.         return b.append(d, a.isString(c) ? c.trim() : c),
  6618.         b
  6619.       }, new window.FormData)
  6620.     },
  6621.     parse: function (a) {
  6622.       return a.response || a
  6623.     },
  6624.     shouldFetch: function () {
  6625.       return !this.get('name') || !this.get('dateAdded')
  6626.     },
  6627.     ensureFetched: function () {
  6628.       this.shouldFetch() && this.fetch()
  6629.     },
  6630.     validate: function (b) {
  6631.       var c = [
  6632.       ],
  6633.       d = b.name.trim();
  6634.       d.length < this.constructor.MIN_NAME_LENGTH ? c.push({
  6635.         attrName: 'name',
  6636.         message: f.interpolate(g('Name must have at least %(minLength)s characters.'), {
  6637.           minLength: this.constructor.MIN_NAME_LENGTH
  6638.         })
  6639.       }) : d.length > this.constructor.MAX_NAME_LENGTH && c.push({
  6640.         attrName: 'name',
  6641.         message: f.interpolate(g('Name must have less than %(maxLength)s characters.'), {
  6642.           maxLength: this.constructor.MAX_NAME_LENGTH
  6643.         })
  6644.       });
  6645.       var e = b.description.trim();
  6646.       if (e.length < this.constructor.MIN_DESCRIPTION_LENGTH ? c.push({
  6647.         attrName: 'description',
  6648.         message: f.interpolate(g('Description must have at least %(minLength)s characters.'), {
  6649.           minLength: this.constructor.MIN_DESCRIPTION_LENGTH
  6650.         })
  6651.       }) : e.length > this.constructor.MAX_DESCRIPTION_LENGTH && c.push({
  6652.         attrName: 'description',
  6653.         message: f.interpolate(g('Description must have less than %(maxLength)s characters.'), {
  6654.           maxLength: this.constructor.MAX_DESCRIPTION_LENGTH
  6655.         })
  6656.       }), this.constructor.BANNER_COLORS[b.bannerColor] || c.push({
  6657.         attrName: 'bannerColor',
  6658.         message: f.interpolate(g('Banner color must be one of ' + a.invoke(a.values(this.constructor.BANNER_COLORS), 'toLowerCase').join(', ')) + '.')
  6659.       }), !a.isEmpty(c)) return c
  6660.     },
  6661.     _changeFollowingState: function (b, c) {
  6662.       return c = c || {
  6663.       },
  6664.       c.type = 'POST',
  6665.       c.data = a.extend({
  6666.         target: this.get('slug')
  6667.       }, c.data),
  6668.       d.call(b, c)
  6669.     },
  6670.     follow: function (a) {
  6671.       return this.primaryForum.set('isFollowing', !0),
  6672.       this._changeFollowingState(this.get('followUrl'), a)
  6673.     },
  6674.     unfollow: function (a) {
  6675.       return this.primaryForum.set('isFollowing', !1),
  6676.       this._changeFollowingState(this.get('unfollowUrl'), a)
  6677.     },
  6678.     toggleFollowed: function () {
  6679.       if (this.get('options').isCurationOnlyChannel && this.primaryForum) {
  6680.         var a = this.primaryForum.get('isFollowing') ? this.unfollow() : this.follow();
  6681.         return this.primaryForum.trigger('toggled:isFollowing'),
  6682.         a
  6683.       }
  6684.     },
  6685.     toJSON: function () {
  6686.       var c = b.Model.prototype.toJSON.call(this);
  6687.       return a.defaults({
  6688.         primaryCategory: this.primaryCategory ? this.primaryCategory.toJSON() : {
  6689.         }
  6690.       }, c)
  6691.     }
  6692.   }, {
  6693.     URLS: {
  6694.       read: 'channels/details',
  6695.       create: 'channels/create',
  6696.       update: 'channels/update'
  6697.     },
  6698.     BANNER_COLORS: {
  6699.       gray: g('Gray'),
  6700.       blue: g('Blue'),
  6701.       green: g('Green'),
  6702.       yellow: g('Yellow'),
  6703.       orange: g('Orange'),
  6704.       red: g('Red'),
  6705.       purple: g('Purple')
  6706.     },
  6707.     MIN_NAME_LENGTH: 3,
  6708.     MAX_NAME_LENGTH: 100,
  6709.     MIN_DESCRIPTION_LENGTH: 5,
  6710.     MAX_DESCRIPTION_LENGTH: 200
  6711.   });
  6712.   return c.addType('Channel', h),
  6713.   h
  6714. }),
  6715. define('core/utils/objectExpander', [
  6716.   'underscore',
  6717.   'core/UniqueModel',
  6718.   'core/models/Channel',
  6719.   'core/models/Thread'
  6720. ], function (a, b, c, d) {
  6721.   'use strict';
  6722.   return {
  6723.     Channel: c,
  6724.     Thread: d,
  6725.     parseObject: function (b, c) {
  6726.       return a.isString(c) ? b[c] : c
  6727.     },
  6728.     buildThread: function (c, d) {
  6729.       if (d instanceof this.Thread) return d;
  6730.       if (d = this.parseObject(c, d), a.isString(d.author)) {
  6731.         var e = d.author.replace('auth.User?id=', '');
  6732.         d.author = c['auth.User?id=' + e] || e
  6733.       }
  6734.       return new b(this.Thread, d, {
  6735.         forum: this.parseObject(c, d.forum),
  6736.         author: d.author
  6737.       })
  6738.     },
  6739.     buildChannel: function (a, c) {
  6740.       return c instanceof this.Channel ? c : (c = this.parseObject(a, c), new b(this.Channel, c))
  6741.     }
  6742.   }
  6743. }),
  6744. define('core/collections/PaginatedCollection', [
  6745.   'underscore',
  6746.   'backbone'
  6747. ], function (a, b) {
  6748.   'use strict';
  6749.   var c = b.Collection.extend({
  6750.     PER_PAGE: 30,
  6751.     initialize: function (b, c) {
  6752.       this.cid = a.uniqueId('collection'),
  6753.       c = c || {
  6754.       },
  6755.       this.cursor = c.cursor || {
  6756.       }
  6757.     },
  6758.     ensureFetched: a.memoize(function () {
  6759.       return this.fetch()
  6760.     }, function () {
  6761.       return this.cid
  6762.     }),
  6763.     fetch: function (c) {
  6764.       return c = c || {
  6765.       },
  6766.       c.data = a.defaults(c.data || {
  6767.       }, {
  6768.         cursor: c.cursor || '',
  6769.         limit: c.limit || this.PER_PAGE
  6770.       }),
  6771.       b.Collection.prototype.fetch.call(this, c)
  6772.     },
  6773.     hasPrev: function () {
  6774.       return this.cursor.hasPrev
  6775.     },
  6776.     hasNext: function () {
  6777.       return this.cursor.hasNext
  6778.     },
  6779.     next: function (b) {
  6780.       return this.cursor.hasNext ? this.fetch(a.extend({
  6781.       }, b, {
  6782.         add: !0,
  6783.         remove: !0,
  6784.         cursor: this.cursor.next
  6785.       })) : void this.trigger('nodata')
  6786.     },
  6787.     prev: function (b) {
  6788.       return this.cursor.hasPrev ? this.fetch(a.extend({
  6789.       }, b, {
  6790.         add: !0,
  6791.         remove: !0,
  6792.         cursor: this.cursor.prev
  6793.       })) : void this.trigger('nodata')
  6794.     },
  6795.     more: function (b) {
  6796.       function c(a) {
  6797.         f.push(a)
  6798.       }
  6799.       var d = this;
  6800.       if (b = b || {
  6801.       }, b.post ? !b.post.attributes.hasMore : !this.cursor.hasNext) return void d.trigger('nodata');
  6802.       var e,
  6803.       f = [
  6804.       ];
  6805.       if (b.post) {
  6806.         var g = this.postCursors[b.post.id];
  6807.         e = g && g.cursor ? g.cursor.next : ''
  6808.       } else e = this.cursor.next;
  6809.       return this.on('add', c),
  6810.       this.fetch(a.extend({
  6811.       }, b, {
  6812.         add: !0,
  6813.         remove: !1,
  6814.         cursor: e,
  6815.         limit: this.PER_PAGE || this.perPage,
  6816.         success: function () {
  6817.           d.trigger('add:many', f, d, b),
  6818.           d.off('add', c),
  6819.           b.success && b.success.apply(this, arguments)
  6820.         }
  6821.       }))
  6822.     },
  6823.     parse: function (c) {
  6824.       return Array.isArray(c) && a.every(c, function (a) {
  6825.         return a instanceof b.Model
  6826.       }) ? c : (this.cursor = c.cursor || {
  6827.         hasNext: !1
  6828.       }, c.response)
  6829.     },
  6830.     getLength: function () {
  6831.       return this.length
  6832.     }
  6833.   });
  6834.   return c
  6835. }),
  6836. define('core/collections/ChannelCollection', [
  6837.   'underscore',
  6838.   'core/collections/PaginatedCollection',
  6839.   'core/UniqueModel',
  6840.   'core/api',
  6841.   'core/models/Channel',
  6842.   'core/utils/objectExpander'
  6843. ], function (a, b, c, d, e, f) {
  6844.   'use strict';
  6845.   var g = b.extend({
  6846.     url: d.getURL('channels/list'),
  6847.     model: c.boundModel(e),
  6848.     initialize: function (a, c) {
  6849.       b.prototype.initialize.call(this, a, c),
  6850.       c = c || {
  6851.       },
  6852.       this.listName = c.listName
  6853.     },
  6854.     fetch: function (c) {
  6855.       return c = c || {
  6856.       },
  6857.       this.listName && (c.data = a.extend({
  6858.         listName: this.listName
  6859.       }, c.data)),
  6860.       b.prototype.fetch.call(this, c)
  6861.     },
  6862.     parse: function (c) {
  6863.       return c = b.prototype.parse.call(this, c),
  6864.       c.items ? a.map(c.items, function (a) {
  6865.         return f.buildChannel(c.objects, a.reference)
  6866.       }) : c
  6867.     }
  6868.   });
  6869.   return g
  6870. }),
  6871. define('core/common/cached-storage', [
  6872.   'underscore',
  6873.   'core/utils/storage'
  6874. ], function (a, b) {
  6875.   'use strict';
  6876.   var c = function (a, b) {
  6877.     this.namespace = a,
  6878.     this.ttl = b || 300,
  6879.     this.cache = this.getFromStorage()
  6880.   };
  6881.   return a.extend(c.prototype, {
  6882.     getItem: function (a) {
  6883.       var b = this.cache[a];
  6884.       if (b) {
  6885.         if (!this.isExpired(b)) return b.value;
  6886.         delete this.cache[a]
  6887.       }
  6888.     },
  6889.     getCurrentTime: function () {
  6890.       return Math.floor((new Date).getTime() / 1000)
  6891.     },
  6892.     persist: function () {
  6893.       b.set(this.namespace, this.cache)
  6894.     },
  6895.     getFromStorage: function () {
  6896.       var c = b.get(this.namespace);
  6897.       return a.isObject(c) ? c : {
  6898.       }
  6899.     },
  6900.     isExpired: function (a) {
  6901.       return this.getCurrentTime() > a.expiry
  6902.     },
  6903.     setItem: function (a, b) {
  6904.       this.cache[a] = {
  6905.         value: b,
  6906.         expiry: this.getCurrentTime() + this.ttl
  6907.       },
  6908.       this.persist()
  6909.     },
  6910.     removeItem: function (a) {
  6911.       delete this.cache[a],
  6912.       this.persist()
  6913.     },
  6914.     getAll: function () {
  6915.       var b = a.chain(this.cache).map(function (a, b) {
  6916.         return this.getItem(b)
  6917.       }, this).compact().value();
  6918.       return this.persist(),
  6919.       b
  6920.     }
  6921.   }),
  6922.   c
  6923. }),
  6924. define('common/collections', [
  6925.   'underscore',
  6926.   'backbone',
  6927.   'moment',
  6928.   'core/api',
  6929.   'core/utils/objectExpander',
  6930.   'core/utils/storage',
  6931.   'core/collections/UserCollection',
  6932.   'core/collections/PaginatedCollection',
  6933.   'core/collections/ChannelCollection',
  6934.   'core/models/ThreadVote',
  6935.   'core/UniqueModel',
  6936.   'common/models',
  6937.   'core/common/cached-storage',
  6938.   'core/constants/voteConstants',
  6939.   'lounge/common'
  6940. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) {
  6941.   'use strict';
  6942.   var p = b.Collection.extend({
  6943.     model: j
  6944.   }),
  6945.   q = h.extend({
  6946.     PER_PAGE: 50,
  6947.     model: k.wrap(l.Post),
  6948.     url: d.getURL('threads/listPostsThreaded'),
  6949.     initialize: function (a, b) {
  6950.       h.prototype.initialize.apply(this, arguments),
  6951.       b = b || {
  6952.       },
  6953.       this.thread = b.thread,
  6954.       this.setOrder(b.order)
  6955.     },
  6956.     fetch: function (b) {
  6957.       return b = b || {
  6958.       },
  6959.       a.extend(b, {
  6960.         data: {
  6961.           limit: this.PER_PAGE,
  6962.           thread: this.thread.id,
  6963.           forum: this.thread.get('forum'),
  6964.           order: this.getOrder()
  6965.         }
  6966.       }),
  6967.       h.prototype.fetch.call(this, b)
  6968.     },
  6969.     getOrder: function () {
  6970.       return this.order
  6971.     },
  6972.     setOrder: function (a) {
  6973.       'popular' === a && this.thread.forum.get('votingType') === n.VOTING_TYPES.DISABLED ? this.order = 'desc' : this.order = a
  6974.     }
  6975.   }),
  6976.   r = b.Collection.extend({
  6977.     collection: b.Collection,
  6978.     initialize: function (a, b) {
  6979.       this.lounge = o.getLounge(),
  6980.       this.thread = b.thread,
  6981.       this.perPage = b.perPage || 20,
  6982.       this.buffer = new this.collection(a, b),
  6983.       this.resetPage(),
  6984.       this.listenTo(this.buffer, 'reset', this.resetPage)
  6985.     },
  6986.     resetPage: function (c, d) {
  6987.       d = d || {
  6988.       };
  6989.       var e = a.isUndefined(d.customThreadLength) ? this.perPage : Math.min(d.customThreadLength, this.perPage),
  6990.       f = this.buffer.slice(0, e);
  6991.       return this.postCursors = {
  6992.       },
  6993.       this.fetchedReplies = 0,
  6994.       this.trigger('set:done', f),
  6995.       b.Collection.prototype.reset.call(this, f, d)
  6996.     },
  6997.     currentPage: function () {
  6998.       var a = Math.floor((this.length - this.fetchedReplies) / this.perPage);
  6999.       return (this.length - this.fetchedReplies) % this.perPage && (a += 1),
  7000.       a
  7001.     },
  7002.     setPageFor: function (a, b) {
  7003.       var c = this.buffer.get(a),
  7004.       d = this.perPage;
  7005.       c && (d = this.perPage * Math.floor(this.buffer.indexOf(c) / this.perPage + 1)),
  7006.       this.add(this.buffer.slice(0, d), b)
  7007.     },
  7008.     hasNext: function () {
  7009.       return this.buffer.length > this.length || this.buffer.hasNext()
  7010.     },
  7011.     more: function (a) {
  7012.       a = a || {
  7013.       };
  7014.       var b = this,
  7015.       c = b.length + b.perPage,
  7016.       d = a.success;
  7017.       a.success = function () {
  7018.         a.post || b.add(b.buffer.slice(0, c)),
  7019.         b.trigger('set:done', b.models),
  7020.         d && d()
  7021.       };
  7022.       var e = a.post ? b.get(a.post.id) : null;
  7023.       e && e.attributes.hasMore ? b.collection.prototype.more.call(b, a) : !e && b.buffer.length < b.length + b.perPage && b.buffer.hasNext() ? (b.add(b.buffer.slice(0, c)), b.buffer.more(a)) : a.success()
  7024.     }
  7025.   });
  7026.   a.each(['setOrder',
  7027.   'getOrder',
  7028.   'reset'], function (a) {
  7029.     r.prototype[a] = function () {
  7030.       return this.buffer[a].apply(this.buffer, arguments)
  7031.     }
  7032.   }),
  7033.   a.each(['add',
  7034.   'remove'], function (a) {
  7035.     r.prototype[a] = function () {
  7036.       return this.buffer[a].apply(this.buffer, arguments),
  7037.       b.Collection.prototype[a].apply(this, arguments)
  7038.     }
  7039.   });
  7040.   var s = r.extend({
  7041.     model: q.prototype.model,
  7042.     collection: q,
  7043.     initialize: function () {
  7044.       r.prototype.initialize.apply(this, arguments),
  7045.       this.postCursors = {
  7046.       },
  7047.       this.fetchedReplies = 0,
  7048.       this.submittedPostsCache = new m('submitted_posts_cache'),
  7049.       this.on('set:done', this.mapStartPosts)
  7050.     },
  7051.     restoreFromCache: function () {
  7052.       var b = this.submittedPostsCache.getAll(),
  7053.       c = this;
  7054.       this.add(a.chain(b).reject(function (a) {
  7055.         return c.thread.get('id') !== a.thread || a.parent && !c.get(a.parent)
  7056.       }).map(function (a) {
  7057.         return a.isCached = !0,
  7058.         a
  7059.       }).value())
  7060.     },
  7061.     removeFromCache: function (a) {
  7062.       this.submittedPostsCache.removeItem(a.id)
  7063.     },
  7064.     saveToCache: function (a) {
  7065.       this.submittedPostsCache.setItem(a.id, a.toJSON())
  7066.     },
  7067.     mapStartPosts: function (c) {
  7068.       if (null !== c) {
  7069.         var d = this;
  7070.         c = Array.isArray(c) ? c : [
  7071.           c
  7072.         ],
  7073.         a.forEach(c.slice().reverse(), function (a) {
  7074.           var c = a instanceof b.Model ? a.get('parent') : a.parent;
  7075.           c && !d.postCursors[c] && (d.postCursors[c] = Object.defineProperty({
  7076.           }, 'startPost', {
  7077.             value: a.id,
  7078.             writeable: !1
  7079.           }))
  7080.         })
  7081.       }
  7082.     },
  7083.     fetch: function (c) {
  7084.       if (c = c || {
  7085.       }, !c.post) return this.buffer.fetch(c);
  7086.       var e = this;
  7087.       return c = a.extend({
  7088.         url: d.getURL('posts/getDescendants'),
  7089.         data: {
  7090.           limit: c.limit || this.perPage,
  7091.           order: this.getOrder(),
  7092.           post: c.post.id,
  7093.           start_post: this.postCursors[c.post.id] ? e.postCursors[c.post.id].startPost : '',
  7094.           cursor: c.cursor || ''
  7095.         }
  7096.       }, c),
  7097.       b.Collection.prototype.fetch.call(e, c)
  7098.     },
  7099.     parse: function (a, b) {
  7100.       if (!(b.url && b.url.indexOf('posts/getDescendants') > - 1)) return this.buffer.parse(a, b);
  7101.       this.postCursors[b.data.post] || (this.postCursors[b.data.post] = {
  7102.       }),
  7103.       this.postCursors[b.data.post].cursor = a.cursor,
  7104.       b.post.set('hasMore', a.cursor.hasNext),
  7105.       this.fetchedReplies += a.response.length;
  7106.       var c = this.buffer.indexOf(b.post),
  7107.       d = this.getDescendantsFromBuffer(b.post);
  7108.       return d && this.add(d, {
  7109.         at: c
  7110.       }),
  7111.       this.buffer.add(a.response, {
  7112.         at: c + d.length
  7113.       }),
  7114.       a.response
  7115.     },
  7116.     getDescendantsFromBuffer: function (b) {
  7117.       var c = {
  7118.       };
  7119.       c[b.id] = b;
  7120.       var d = this.buffer.slice(this.buffer.indexOf(b) + 1);
  7121.       return a.some(d, function (a) {
  7122.         var b = a.get('parent');
  7123.         return !b || !c[b] || (c[a.id] = a, !1)
  7124.       }),
  7125.       a.values(c)
  7126.     }
  7127.   }),
  7128.   t = b.Collection.extend({
  7129.     model: l.QueuedPost,
  7130.     initialize: function (a, b) {
  7131.       var c = this;
  7132.       c.thread = b.thread,
  7133.       c.counters = {
  7134.         comments: 0,
  7135.         replies: {
  7136.         }
  7137.       },
  7138.       c.on('add', function (a) {
  7139.         var b = a.getVisibleParent(c.thread),
  7140.         d = c.counters.replies;
  7141.         b ? (d[b.id] = (d[b.id] || 0) + 1, b.id === a.get('parentId') && a.set('immedReply', !0)) : c.counters.comments += 1
  7142.       })
  7143.     },
  7144.     comparator: function (a) {
  7145.       return parseInt(a.id, 10)
  7146.     },
  7147.     isDescendant: function (b, c) {
  7148.       var d = b.get('parentId'),
  7149.       e = d ? this.get(d) : null,
  7150.       f = {
  7151.       };
  7152.       for (a.each(c, function (a) {
  7153.         f[a] = !0
  7154.       }); e; ) {
  7155.         if (f[e.get('id')] === !0) return !0;
  7156.         d = e.get('parentId'),
  7157.         e = d ? this.get(d) : null
  7158.       }
  7159.       return !1
  7160.     },
  7161.     drain: function D(b) {
  7162.       function c(a) {
  7163.         var b = [
  7164.         ];
  7165.         e.each(function (a) {
  7166.           null === a.get('parentId') && b.push(a.get('id'))
  7167.         }),
  7168.         e.reset(e.filter(function (c) {
  7169.           return null === c.get('parentId') || e.isDescendant(c, b) ? void a(c) : c
  7170.         })),
  7171.         e.counters.comments = 0
  7172.       }
  7173.       function d(c) {
  7174.         var d,
  7175.         f = [
  7176.         ];
  7177.         d = e.filter(function (a) {
  7178.           var c = a.getVisibleParent(e.thread);
  7179.           return c && c.get('id') === b ? void f.push(a) : a
  7180.         }),
  7181.         f = a.sortBy(f, function (a) {
  7182.           return parseInt(a.get('id'), 10)
  7183.         }),
  7184.         a.each(f, function (a) {
  7185.           c(a)
  7186.         }),
  7187.         e.reset(d),
  7188.         e.counters.replies[b] = 0
  7189.       }
  7190.       var e = this,
  7191.       D = b ? d : c;
  7192.       return D(function (a) {
  7193.         e.thread.posts.add(a.toPost(e.thread))
  7194.       })
  7195.     }
  7196.   }),
  7197.   u = b.Collection.extend({
  7198.     models: l.TypingUser,
  7199.     initialize: function () {
  7200.       var b = this;
  7201.       b.gc = null,
  7202.       b.on('add remove reset', function () {
  7203.         var c = b.count();
  7204.         return c > 0 && null === b.gc ? void (b.gc = setInterval(a.bind(b.cleanup, b), 60000)) : void (c <= 0 && null !== b.gc && (clearInterval(b.gc), b.gc = null))
  7205.       }, b)
  7206.     },
  7207.     count: function (a) {
  7208.       var b = this.filter(function (b) {
  7209.         return !(a && b.id === a) && b.get('typing')
  7210.       });
  7211.       return b.length
  7212.     },
  7213.     cleanup: function () {
  7214.       var a = c();
  7215.       this.reset(this.filter(function (b) {
  7216.         return a.diff(b.lastModified, 'minutes') < 5
  7217.       }))
  7218.     }
  7219.   }),
  7220.   v = h.extend({
  7221.     model: k.wrap(l.Post),
  7222.     url: d.getURL('users/listPostActivity')
  7223.   }),
  7224.   w = h.extend({
  7225.     model: l.Thread,
  7226.     url: d.getURL('timelines/ranked'),
  7227.     initialize: function (a, b) {
  7228.       b = b || {
  7229.       },
  7230.       this.type = b.type,
  7231.       this.target = b.target
  7232.     },
  7233.     fetch: function (b) {
  7234.       return b = b || {
  7235.       },
  7236.       b.data = a.extend({
  7237.         type: this.type,
  7238.         target: this.target
  7239.       }, b.data),
  7240.       h.prototype.fetch.call(this, b)
  7241.     },
  7242.     parse: function (b) {
  7243.       return b = h.prototype.parse.call(this, b),
  7244.       a.map(b.activities, function (a) {
  7245.         return e.buildThread(b.objects, a.items[0].object)
  7246.       })
  7247.     }
  7248.   }),
  7249.   x = b.Collection.extend({
  7250.     model: l.SyncedTopUser,
  7251.     url: d.getURL('forums/listMostActiveUsers'),
  7252.     initialize: function (a, b) {
  7253.       this.forum = b.forum,
  7254.       this.limit = b.limit
  7255.     },
  7256.     fetch: function (c) {
  7257.       return b.Collection.prototype.fetch.call(this, a.extend({
  7258.         data: {
  7259.           forum: this.forum,
  7260.           limit: this.limit
  7261.         }
  7262.       }, c))
  7263.     },
  7264.     parse: function (b) {
  7265.       return a.filter(b.response, function (a) {
  7266.         if (parseFloat(a.rep) > 0.7) return a
  7267.       })
  7268.     }
  7269.   });
  7270.   g.prototype.model = k.wrap(l.User);
  7271.   var y = b.Collection.extend({
  7272.     model: l.SyncedUser,
  7273.     url: d.getURL('forums/listModerators'),
  7274.     initialize: function (a, b) {
  7275.       this.forum = b.forum
  7276.     },
  7277.     fetch: function (c) {
  7278.       return b.Collection.prototype.fetch.call(this, a.extend({
  7279.         data: {
  7280.           forum: this.forum
  7281.         }
  7282.       }, c))
  7283.     },
  7284.     parse: function (b) {
  7285.       return a.map(b.response, function (a) {
  7286.         return a.user
  7287.       })
  7288.     }
  7289.   }),
  7290.   z = 'reaction-vote',
  7291.   A = b.Collection.extend({
  7292.     url: d.getURL('threadReactions/loadReactions'),
  7293.     initialize: function (a, b) {
  7294.       this.thread = b.thread,
  7295.       this.enabled = Boolean(a.length),
  7296.       this.eligible = Boolean(b.eligible),
  7297.       this.userIsAnonymous = b.userIsAnonymous
  7298.     },
  7299.     fetch: function (c) {
  7300.       return b.Collection.prototype.fetch.call(this, a.extend({
  7301.         data: {
  7302.           thread: this.thread.id
  7303.         }
  7304.       }, c))
  7305.     },
  7306.     parse: function (a) {
  7307.       var b = a.response,
  7308.       c = b.reactions,
  7309.       d = b.selected && b.selected.id;
  7310.       if (!d && this.userIsAnonymous) {
  7311.         var e = f.get(z);
  7312.         d = e && e[this.thread.get('id')]
  7313.       }
  7314.       if (d) {
  7315.         var g = c.filter(function (a) {
  7316.           return a.id === d
  7317.         });
  7318.         g.length && (g[0].isSelected = !0, g[0].votes || (g[0].votes = 1))
  7319.       }
  7320.       return this.enabled = Boolean(c.length),
  7321.       this.eligible = b.eligible,
  7322.       this.prompt = b.prompt,
  7323.       c
  7324.     },
  7325.     toggleEnabled: function () {
  7326.       var a = this;
  7327.       d.call('threadReactions/disableForThread', {
  7328.         method: 'POST',
  7329.         data: {
  7330.           thread: this.thread.get('id'),
  7331.           enable: this.enabled ? 0 : 1
  7332.         },
  7333.         success: function () {
  7334.           a.enabled = !a.enabled,
  7335.           a.trigger('change:enabled'),
  7336.           a.enabled && !a.length && a.fetch()
  7337.         }
  7338.       })
  7339.     },
  7340.     vote: function (b, c) {
  7341.       var e = this.at(b);
  7342.       if (e && !e.get('isSelected')) {
  7343.         c = c || {
  7344.         },
  7345.         this.trigger('vote:start');
  7346.         var g = this;
  7347.         d.call('threadReactions/vote', a.extend({
  7348.         }, c, {
  7349.           method: 'POST',
  7350.           data: {
  7351.             thread: this.thread.get('id'),
  7352.             reaction: e.get('id')
  7353.           },
  7354.           success: function () {
  7355.             if (g.forEach(function (a, c) {
  7356.               var d = c === b,
  7357.               e = a.get('votes');
  7358.               d && (e += 1),
  7359.               a.get('isSelected') && (e = Math.max(0, e - 1)),
  7360.               a.set({
  7361.                 isSelected: d,
  7362.                 votes: e
  7363.               })
  7364.             }, g), g.trigger('vote:end'), g.userIsAnonymous) {
  7365.               var a = f.get(z) || {
  7366.               };
  7367.               a[g.thread.get('id')] = e.get('id'),
  7368.               f.set(z, a)
  7369.             }
  7370.             c.success && c.success()
  7371.           },
  7372.           error: function () {
  7373.             g.trigger('vote:end'),
  7374.             c.error && c.error()
  7375.           }
  7376.         }))
  7377.       }
  7378.     }
  7379.   }),
  7380.   B = b.Collection.extend({
  7381.     url: d.getURL('gifs/search'),
  7382.     model: l.GifObject,
  7383.     query: null,
  7384.     page: null,
  7385.     fetch: function (c) {
  7386.       return c.query === this.query ? this.page += 1 : this.page = 1,
  7387.       b.Collection.prototype.fetch.call(this, a.extend({
  7388.         data: {
  7389.           forum: c.forum,
  7390.           query: c.query,
  7391.           page: this.page
  7392.         }
  7393.       }, c))
  7394.     },
  7395.     parse: function (a, b) {
  7396.       var c = a.response,
  7397.       d = this.toJSON();
  7398.       return b.query === this.query ? d.concat(c) : (this.query = b.query, c)
  7399.     },
  7400.     reset: function () {
  7401.       return this.query = null,
  7402.       this.page = null,
  7403.       b.Collection.prototype.reset.call(this)
  7404.     }
  7405.   }),
  7406.   C = b.Collection.extend({
  7407.     url: d.getURL('mentions/listUsers'),
  7408.     model: l.SyncedUser,
  7409.     LIMIT: 5,
  7410.     query: null,
  7411.     cursor: null,
  7412.     initialize: function (a, b) {
  7413.       this.threadId = b && b.threadId
  7414.     },
  7415.     fetch: function (c) {
  7416.       var d = this.cursor && this.cursor.hasNext;
  7417.       if (this.query !== c.query || d) return b.Collection.prototype.fetch.call(this, a.extend({
  7418.         data: {
  7419.           thread: this.threadId,
  7420.           cursor: c.next && d && this.cursor.next ? this.cursor.next.slice(2) : null,
  7421.           query: c.query,
  7422.           limit: c.limit || this.LIMIT
  7423.         }
  7424.       }, c))
  7425.     },
  7426.     parse: function (a, c) {
  7427.       var d = a.response,
  7428.       e = a.cursor,
  7429.       f = this.toJSON();
  7430.       return f = c.query === this.query ? f.concat(d) : d,
  7431.       this.query = c.query,
  7432.       this.cursor = e,
  7433.       this.set(f),
  7434.       b.Collection.prototype.parse.call(this, f),
  7435.       f
  7436.     },
  7437.     reset: function () {
  7438.       return this.query = null,
  7439.       this.cursor = null,
  7440.       b.Collection.prototype.reset.call(this)
  7441.     }
  7442.   });
  7443.   return {
  7444.     PaginatedCollection: h,
  7445.     UserCollection: g,
  7446.     ChannelCollection: i,
  7447.     PostCollection: q,
  7448.     SubpaginatedPostCollection: s,
  7449.     TypingUserCollection: u,
  7450.     TopUserCollection: x,
  7451.     RankedThreadCollection: w,
  7452.     ThreadVoteCollection: p,
  7453.     PostActivityCollection: v,
  7454.     QueuedPostCollection: t,
  7455.     ModeratorCollection: y,
  7456.     ReactionsCollection: A,
  7457.     GifObjectsCollection: B,
  7458.     UserSuggestionsCollection: C
  7459.   }
  7460. }),
  7461. define('core/constants/storageConstants', [
  7462.   'exports'
  7463. ], function (a) {
  7464.   'use strict';
  7465.   a.STORAGE_KEY_SESSION_ID = 'sessionId'
  7466. }),
  7467. define('core/models/Session', [
  7468.   'jquery',
  7469.   'underscore',
  7470.   'backbone',
  7471.   'moment',
  7472.   'core/api',
  7473.   'core/bus',
  7474.   'core/config',
  7475.   'core/constants/storageConstants',
  7476.   'core/time',
  7477.   'core/utils',
  7478.   'core/utils/cookies',
  7479.   'core/utils/guid',
  7480.   'core/utils/auth',
  7481.   'core/utils/storage',
  7482.   'core/models/BaseUser',
  7483.   'core/models/User'
  7484. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
  7485.   'use strict';
  7486.   var q = function () {
  7487.     return m.getFromCookie()
  7488.   },
  7489.   r = function () {
  7490.     return n.get(h.STORAGE_KEY_SESSION_ID)
  7491.   },
  7492.   s = c.Model.extend({
  7493.     initialize: function () {
  7494.       this.constructor.fromCookie = b.once(q),
  7495.       this.user = this.getAnonUserInstance()
  7496.     },
  7497.     setUser: function (a) {
  7498.       this.user && this.stopListening(this.user),
  7499.       this.user = a,
  7500.       this.setIfNewUser(),
  7501.       this.listenTo(a, 'all', this.trigger),
  7502.       this.trigger('change:id', a)
  7503.     },
  7504.     isLoggedOut: function () {
  7505.       return !this.isLoggedIn()
  7506.     },
  7507.     isLoggedIn: function () {
  7508.       return Boolean(this.user.get('id'))
  7509.     },
  7510.     fetch: function (a) {
  7511.       var c = a || {
  7512.       };
  7513.       return e.call('users/details.json', {
  7514.         data: c.data,
  7515.         success: b.bind(function (a) {
  7516.           a = a.response,
  7517.           a.id && this.setUser(this.getUserInstance(a)),
  7518.           c.success && c.success(a),
  7519.           c.complete && c.complete(a)
  7520.         }, this),
  7521.         error: function (a) {
  7522.           c.error && c.error(a),
  7523.           c.complete && c.complete(a)
  7524.         }
  7525.       })
  7526.     },
  7527.     getAnonUserInstance: function (a) {
  7528.       return new o(a)
  7529.     },
  7530.     getUserInstance: function (a) {
  7531.       return new p(a)
  7532.     },
  7533.     getCsrfToken: function () {
  7534.       var a = k.read('csrftoken');
  7535.       return a || (a = l.generate().replace(/\W/g, ''), k.create('csrftoken', a, {
  7536.         domain: window.location.hostname,
  7537.         expiresIn: 31536000000
  7538.       })),
  7539.       a
  7540.     },
  7541.     authenticate: function (c) {
  7542.       var d = this.authServices[c];
  7543.       if (d) {
  7544.         if (b.isFunction(d)) return d.call(this);
  7545.         f.trigger('uiAction:openLogin', c);
  7546.         var e = this.getAuthWindowArgs(d),
  7547.         g = d.url;
  7548.         g += (g.indexOf('?') > - 1 ? '&' : '?') + a.param(e),
  7549.         this.openAuthWindow(g, d.width, d.height)
  7550.       }
  7551.     },
  7552.     authServices: {
  7553.       disqus: {
  7554.         url: g.urls.login,
  7555.         width: 460,
  7556.         height: 355,
  7557.         attachExperiment: !0
  7558.       },
  7559.       twitter: {
  7560.         url: g.urls.oauth.twitter,
  7561.         width: 650,
  7562.         height: 680,
  7563.         csrf: !0,
  7564.         attachExperiment: !0
  7565.       },
  7566.       facebook: {
  7567.         url: g.urls.oauth.facebook,
  7568.         width: 550,
  7569.         height: 320,
  7570.         csrf: !0,
  7571.         attachExperiment: !0
  7572.       },
  7573.       google: {
  7574.         url: g.urls.oauth.google,
  7575.         width: 445,
  7576.         height: 635,
  7577.         csrf: !0,
  7578.         attachExperiment: !0
  7579.       },
  7580.       microsoft: {
  7581.         url: g.urls.oauth.microsoft,
  7582.         width: 650,
  7583.         height: 635,
  7584.         csrf: !0,
  7585.         attachExperiment: !0
  7586.       },
  7587.       apple: {
  7588.         url: g.urls.oauth.apple,
  7589.         width: 445,
  7590.         height: 750,
  7591.         csrf: !0,
  7592.         attachExperiment: !0
  7593.       }
  7594.     },
  7595.     getAuthWindowArgs: function (a) {
  7596.       var c = {
  7597.       };
  7598.       return a.csrf && (c.ctkn = this.getCsrfToken()),
  7599.       b.extend(c, a.params),
  7600.       c
  7601.     },
  7602.     openAuthWindow: function (a, b, c) {
  7603.       return j.openWindow(a, '_blank', {
  7604.         width: b,
  7605.         height: c
  7606.       })
  7607.     },
  7608.     setIfNewUser: function () {
  7609.       var a = this.user.get('joinedAt');
  7610.       if (this.user.get('isAnonymous') || !a) return void this.user.set('joinedRecently', !1);
  7611.       var b = i.assureTzOffset(a);
  7612.       this.user.set('joinedRecently', d().subtract(10, 'seconds').isBefore(b))
  7613.     }
  7614.   });
  7615.   return s.fromCookie = q,
  7616.   s.fromLocalStorage = r,
  7617.   s.isKnownToBeLoggedOut = function () {
  7618.     return !s.fromCookie().id && !s.fromLocalStorage()
  7619.   },
  7620.   s
  7621. }),
  7622. define('core/WindowBus', [
  7623.   'jquery',
  7624.   'underscore',
  7625.   'backbone',
  7626.   'modernizr'
  7627. ], function (a, b, c, d) {
  7628.   'use strict';
  7629.   var e = c.Model.extend({
  7630.     initialize: function () {
  7631.       d.localstorage && a(window).on('storage', b.bind(this.onStorageEvent, this))
  7632.     },
  7633.     broadcast: function (a, b) {
  7634.       if (d.localstorage) {
  7635.         var c = JSON.stringify({
  7636.           name: a,
  7637.           data: b,
  7638.           time: (new Date).getTime()
  7639.         });
  7640.         try {
  7641.           window.localStorage.setItem(this.constructor.STORAGE_KEY, c)
  7642.         } catch (e) {
  7643.         }
  7644.       }
  7645.     },
  7646.     onStorageEvent: function (a) {
  7647.       var b = a.originalEvent.key,
  7648.       c = a.originalEvent.newValue;
  7649.       if (c && b === this.constructor.STORAGE_KEY) try {
  7650.         c = JSON.parse(c),
  7651.         this.trigger(c.name, c.data)
  7652.       } catch (d) {
  7653.       }
  7654.     }
  7655.   }, {
  7656.     STORAGE_KEY: 'disqus.bus'
  7657.   });
  7658.   return e
  7659. }),
  7660. define('templates/lounge/threadVotes', [
  7661.   'react',
  7662.   'core/config/urls',
  7663.   'core/strings',
  7664.   'core/switches',
  7665.   'core/utils/object/get'
  7666. ], function (a, b, c, d, e) {
  7667.   'use strict';
  7668.   var f = c.gettext,
  7669.   g = function (c) {
  7670.     var g = c.thread && c.thread.forum,
  7671.     h = d.isFeatureActive('embed_refresh', {
  7672.       forum: g
  7673.     }),
  7674.     i = h && d.isFeatureActive('embed_refresh_v2', {
  7675.       forum: g
  7676.     }),
  7677.     j = h ? 'favorite-button-toggle' : 'dropdown-toggle',
  7678.     k = h ? 'label-count-refresh' : 'label-count',
  7679.     l = i ? 'favorite-icon favorite-icon--refresh-v2' : 'favorite-icon',
  7680.     m = function () {
  7681.       return i ? a.createElement('span', {
  7682.         className: 'label label-default'
  7683.       }, a.createElement('span', {
  7684.         className: l + ' icon-heart-empty'
  7685.       })) : h ? null : a.createElement('span', {
  7686.         className: 'label label-default'
  7687.       }, a.createElement('span', {
  7688.         className: 'favorite-icon icon-heart-empty'
  7689.       }))
  7690.     },
  7691.     n = function () {
  7692.       return i ? a.createElement('span', {
  7693.         className: 'label label-favorited'
  7694.       }, a.createElement('span', {
  7695.         className: l + ' icon-heart'
  7696.       })) : h ? null : a.createElement('span', {
  7697.         className: 'label label-favorited'
  7698.       }, a.createElement('span', {
  7699.         className: 'favorite-icon icon-heart'
  7700.       }))
  7701.     },
  7702.     o = function () {
  7703.       return h && !i ? a.createElement('div', {
  7704.         className: 'favorite-icon-wrapper'
  7705.       }, a.createElement('i', {
  7706.         className: 'favorite-icon-refresh'
  7707.       })) : null
  7708.     };
  7709.     return a.createElement('div', null, a.createElement('a', {
  7710.       href: '#',
  7711.       'data-action': 'favorite',
  7712.       title: f('Favorite this discussion'),
  7713.       className: j + ' ' + (i ? j + '--v2' : '') + ' ' + (e(c.thread, [
  7714.         'userScore'
  7715.       ]) ? 'upvoted' : ''),
  7716.       'aria-label': f('Favorite this discussion')
  7717.     }, m(), n(), o(), ' ', e(c.thread, [
  7718.       'likes'
  7719.     ]) ? a.createElement('span', {
  7720.       className: 'label ' + k + ' ' + (i ? k + '--v2' : '')
  7721.     }, e(c.thread, [
  7722.       'likes'
  7723.     ], null)) : null), a.createElement('ul', {
  7724.       className: 'dropdown-menu dropdown-menu--coachmark pull-right'
  7725.     }, a.createElement('li', null, c.loggedIn ? a.createElement('div', null, a.createElement('h2', {
  7726.       className: 'coachmark__heading'
  7727.     }, f('Your 1st favorited discussion!')), a.createElement('p', {
  7728.       className: 'coachmark__description'
  7729.     }, f('Favoriting means this is a discussion worth sharing. It gets shared to your followers\' %(Disqus)s feeds if you log in, and gives the creator kudos!', {
  7730.       Disqus: 'Disqus'
  7731.     }))) : a.createElement('div', null, a.createElement('h2', {
  7732.       className: 'coachmark__heading'
  7733.     }, f('Discussion Favorited!')), a.createElement('p', {
  7734.       className: 'coachmark__description'
  7735.     }, f('Favoriting means this is a discussion worth sharing. It gets shared to your followers\' %(Disqus)s feeds, and gives the creator kudos!', {
  7736.       Disqus: 'Disqus'
  7737.     }))), ' ', a.createElement('a', {
  7738.       href: (b.root || '') + '/home/?utm_source=disqus_embed&utm_content=recommend_btn',
  7739.       className: 'btn btn-primary coachmark__button',
  7740.       target: '_blank',
  7741.       rel: 'noopener noreferrer'
  7742.     }, f(c.loggedIn ? 'See Your Feed' : 'Find More Discussions')))))
  7743.   };
  7744.   return g
  7745. }),
  7746. define('lounge/views/favorite-button', [
  7747.   'backbone',
  7748.   'core/utils/storage',
  7749.   'templates/lounge/threadVotes'
  7750. ], function (a, b, c) {
  7751.   'use strict';
  7752.   var d = a.View.extend({
  7753.     className: 'thread-likes',
  7754.     events: {
  7755.       'click [data-action=favorite]': 'favoriteHandler'
  7756.     },
  7757.     initialize: function (a) {
  7758.       this.session = a.session,
  7759.       this.thread = a.thread,
  7760.       this.loggedOutFavoriteFlag = this.session.getLoggedOutUserFlags().get(d.ONBOARDING_KEY),
  7761.       this.listenTo(this.thread, 'change:userScore', this.render),
  7762.       this.listenTo(this.thread, 'change:likes', this.render),
  7763.       this.listenTo(this.session, 'change:id', this.startFavoriteOnboarding),
  7764.       this.setTooltipEnabled()
  7765.     },
  7766.     setTooltipEnabled: function () {
  7767.       this.tooltipEnabled = this.session.isLoggedIn() ? b.get(d.ONBOARDING_KEY) : !this.loggedOutFavoriteFlag.isRead()
  7768.     },
  7769.     render: function () {
  7770.       return this.$el.html(c({
  7771.         thread: this.thread.toJSON(),
  7772.         user: this.session.toJSON(),
  7773.         loggedIn: this.session.isLoggedIn()
  7774.       })),
  7775.       this
  7776.     },
  7777.     startFavoriteOnboarding: function () {
  7778.       this.session.user.get('joinedRecently') && b.set(d.ONBOARDING_KEY, 'true'),
  7779.       this.setTooltipEnabled()
  7780.     },
  7781.     favoriteHandler: function (a) {
  7782.       a.stopPropagation(),
  7783.       a.preventDefault();
  7784.       var b = 0 === this.thread.get('userScore');
  7785.       this.trigger(b ? 'vote:like' : 'vote:unlike'),
  7786.       this.thread.vote(b ? 1 : 0),
  7787.       this.toggleTooltip(b),
  7788.       this.tooltipEnabled && b && this.markAsSeen()
  7789.     },
  7790.     markAsSeen: function () {
  7791.       this.session.isLoggedIn() ? b.remove(d.ONBOARDING_KEY) : this.loggedOutFavoriteFlag.markRead()
  7792.     },
  7793.     toggleTooltip: function (a) {
  7794.       this.tooltipEnabled && (a ? this.$el.parent().addClass('open') : this.$el.parent().removeClass('open'))
  7795.     }
  7796.   }, {
  7797.     ONBOARDING_KEY: 'showRecommendOnboarding'
  7798.   });
  7799.   return d
  7800. }),
  7801. define('common/collections/LoggedOutCache', [
  7802.   'backbone',
  7803.   'core/common/cached-storage',
  7804.   'lounge/views/favorite-button'
  7805. ], function (a, b, c) {
  7806.   'use strict';
  7807.   var d = [
  7808.     {
  7809.       id: 'welcome',
  7810.       title: '',
  7811.       body: ''
  7812.     }
  7813.   ],
  7814.   e = [
  7815.     {
  7816.       id: c.ONBOARDING_KEY
  7817.     }
  7818.   ],
  7819.   f = new b('notes', 7776000),
  7820.   g = a.Model.extend({
  7821.     markRead: function () {
  7822.       f.setItem(this.id, !0)
  7823.     },
  7824.     isRead: function () {
  7825.       return Boolean(f.getItem(this.id))
  7826.     }
  7827.   }),
  7828.   h = a.Collection.extend({
  7829.     initialize: function (a, b) {
  7830.       this.session = b.session
  7831.     },
  7832.     model: g,
  7833.     markAllRead: function () {
  7834.       return this.each(function (a) {
  7835.         a.markRead()
  7836.       }),
  7837.       this.session.set('notificationCount', 0),
  7838.       this
  7839.     },
  7840.     getUnread: function () {
  7841.       return this.filter(function (a) {
  7842.         return !a.isRead()
  7843.       })
  7844.     }
  7845.   });
  7846.   return {
  7847.     storage: f,
  7848.     Collection: h,
  7849.     Model: g,
  7850.     LOGGED_OUT_NOTES: d,
  7851.     LOGGED_OUT_FLAGS: e
  7852.   }
  7853. }),
  7854. define('common/Session', [
  7855.   'jquery',
  7856.   'underscore',
  7857.   'core/analytics/jester',
  7858.   'core/api',
  7859.   'core/bus',
  7860.   'core/config',
  7861.   'core/constants/storageConstants',
  7862.   'common/models',
  7863.   'common/urls',
  7864.   'core/models/Session',
  7865.   'core/switches',
  7866.   'core/UniqueModel',
  7867.   'core/utils/cookies',
  7868.   'core/utils/url/serialize',
  7869.   'core/WindowBus',
  7870.   'core/utils/storage',
  7871.   'common/collections/LoggedOutCache',
  7872.   'common/keys',
  7873.   'common/utils',
  7874.   'lounge/common',
  7875.   'lounge/tracking'
  7876. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) {
  7877.   'use strict';
  7878.   var v,
  7879.   w = 3500,
  7880.   x = {
  7881.   },
  7882.   y = new o,
  7883.   z = j.extend({
  7884.     _defaults: {
  7885.       canReply: !0,
  7886.       canModerate: !1,
  7887.       audienceSyncVerified: !1,
  7888.       sso: null
  7889.     },
  7890.     socialLoginProviders: {
  7891.       facebook: function () {
  7892.         var b = a.Deferred();
  7893.         return require(['fb'], b.resolve.bind(b), b.reject.bind(b)),
  7894.         b.promise().then(function () {
  7895.           window.FB.init({
  7896.             appId: r.facebook,
  7897.             xfbml: !1,
  7898.             status: !0,
  7899.             version: 'v2.8'
  7900.           });
  7901.           var b = a.Deferred();
  7902.           return window.FB.getLoginStatus(function (a) {
  7903.             'connected' === a.status ? b.resolve(a) : b.reject()
  7904.           }),
  7905.           b.promise()
  7906.         }).then(function (a) {
  7907.           c.logStat('lounge.auto_login.fb');
  7908.           var b = a.authResponse;
  7909.           return {
  7910.             grant_type: 'urn:disqus:params:oauth:grant-type:facebook-login',
  7911.             client_id: r.embedAPI,
  7912.             expires: b.expiresIn,
  7913.             fb_access_token: b.accessToken
  7914.           }
  7915.         })
  7916.       },
  7917.       google: function () {
  7918.         var b = a.Deferred();
  7919.         return require(['gapi'], function (a) {
  7920.           setTimeout(b.reject.bind(b), w),
  7921.           a.load('auth2', b.resolve.bind(b, a))
  7922.         }, b.reject.bind(b)),
  7923.         b.promise().then(function (b) {
  7924.           var c = b.auth2.init({
  7925.             client_id: r.google,
  7926.             fetch_basic_profile: !1,
  7927.             scope: 'profile email'
  7928.           }),
  7929.           d = a.Deferred();
  7930.           return c.then(function () {
  7931.             c.isSignedIn.get() ? d.resolve(c.currentUser.get()) : d.reject()
  7932.           }),
  7933.           d.promise()
  7934.         }).then(function (a) {
  7935.           c.logStat('lounge.auto_login.google');
  7936.           var b = a.getAuthResponse();
  7937.           return {
  7938.             grant_type: 'urn:disqus:params:oauth:grant-type:google-login',
  7939.             client_id: r.embedAPI,
  7940.             expires: b.expires_in,
  7941.             google_access_token: JSON.stringify(b)
  7942.           }
  7943.         })
  7944.       }
  7945.     },
  7946.     initialize: function () {
  7947.       z.__super__.initialize.apply(this, arguments),
  7948.       !x.fromCookie().isAuthenticated && this.getSessionId() && d.headers({
  7949.         'X-Sessionid': this.getSessionId()
  7950.       })
  7951.     },
  7952.     setSessionId: function (a) {
  7953.       p.set(g.STORAGE_KEY_SESSION_ID, a)
  7954.     },
  7955.     removeSessionId: function () {
  7956.       p.remove(g.STORAGE_KEY_SESSION_ID)
  7957.     },
  7958.     getSessionId: function () {
  7959.       return p.get(g.STORAGE_KEY_SESSION_ID)
  7960.     },
  7961.     defaults: function () {
  7962.       var a = new q.Collection(q.LOGGED_OUT_NOTES, {
  7963.         session: this
  7964.       });
  7965.       return b.extend(this._defaults, {
  7966.         notificationCount: a.getUnread().length
  7967.       })
  7968.     },
  7969.     start: function (b) {
  7970.       var c = b || {
  7971.       };
  7972.       if (this.set(c), this.listenTo(y, 'auth:success', this.fetch), this.listenTo(e.frame, {
  7973.         '!auth:success': function (a) {
  7974.           a && (a.sessionId && (d.headers({
  7975.             'X-Sessionid': a.sessionId
  7976.           }), x.fromCookie().isAuthenticated || this.setSessionId(a.sessionId)), a.message && this.trigger('alert', a.message, {
  7977.             type: 'info'
  7978.           }), a.logEvent && e.trigger('uiAction:' + a.logEvent)),
  7979.           y.broadcast('auth:success'),
  7980.           this.fetch()
  7981.         }
  7982.       }), this.bindAudienceSyncHandlers(), this.shouldFetchSession()) this.fetch();
  7983.        else if (m.read('no_auto_login') || u.isPrivate()) this.loginAsAnon();
  7984.        else {
  7985.         var f = this.socialLoginProviders,
  7986.         g = !1,
  7987.         h = 0,
  7988.         i = a.Deferred(),
  7989.         j = Object.keys(f).map(function (a) {
  7990.           return f[a].call(this)
  7991.         }, this),
  7992.         k = function (a) {
  7993.           g || (g = !0, i.resolve(a))
  7994.         },
  7995.         l = function (a) {
  7996.           h += 1,
  7997.           h === j.length && i.reject(a)
  7998.         };
  7999.         j.forEach(function (a) {
  8000.           a.then(k).fail(l)
  8001.         }),
  8002.         i.promise().then(function (b) {
  8003.           return a.post('https://disqus.com/api/oauth/2.0/access_token/', b)
  8004.         }).then(function (a) {
  8005.           this.fetch({
  8006.             data: {
  8007.               access_token: a.access_token
  8008.             }
  8009.           })
  8010.         }.bind(this)).fail(this.loginAsAnon.bind(this))
  8011.       }
  8012.     },
  8013.     stop: function () {
  8014.       this.stopListening(),
  8015.       this.off()
  8016.     },
  8017.     loginAsAnon: function () {
  8018.       this.setUser(this.getAnonUserInstance())
  8019.     },
  8020.     shouldFetchSession: function () {
  8021.       return Boolean(this.get('remoteAuthS3') || x.fromCookie().id || this.getSessionId())
  8022.     },
  8023.     getUserInstance: function (a) {
  8024.       return new l(h.User, a)
  8025.     },
  8026.     toJSON: function () {
  8027.       var a = this.user.toJSON.apply(this.user, arguments);
  8028.       return a.thread.canReply = this.get('canReply'),
  8029.       a.thread.canModerate || (a.thread.canModerate = this.get('canModerate')),
  8030.       a
  8031.     },
  8032.     fetch: function (a) {
  8033.       var b = this,
  8034.       c = a || {
  8035.       };
  8036.       b.has('thread') && (c.thread = b.get('thread'));
  8037.       var d = c.thread ? b.fetchThreadDetails(c) : j.prototype.fetch.call(b, c);
  8038.       return d.done(function () {
  8039.         b.set('notificationCount', 0)
  8040.       }),
  8041.       d
  8042.     },
  8043.     fetchNotificationCount: function () {
  8044.       var b = this;
  8045.       return b.isLoggedIn() ? d.call('timelines/getUnreadCount.json', {
  8046.         data: {
  8047.           type: 'notifications',
  8048.           routingVersion: f.feedApiVersion
  8049.         }
  8050.       }).done(function (a) {
  8051.         b.set('notificationCount', a.response)
  8052.       }) : a.Deferred().resolve()
  8053.     },
  8054.     fetchThreadDetails: function (a) {
  8055.       var c = this,
  8056.       e = a.thread;
  8057.       c._request && (c._request.abort(), c._request = null);
  8058.       var f = {
  8059.         thread: e.id,
  8060.         post: e.posts.pluck('id')
  8061.       };
  8062.       return c._request = d.call('embed/threadDetails.json', {
  8063.         data: f,
  8064.         success: function (a) {
  8065.           var d = a.response,
  8066.           f = {
  8067.           };
  8068.           if (d.user && (b.extend(f, d.user, {
  8069.             votes: d.votes
  8070.           }), f = b.omit(f, 'badges')), d.blockedUsers || d.blockingUsers) {
  8071.             var g = d.session.canModerate ? new Set(d.blockedUsers) : new Set([].concat(_toConsumableArray(d.blockedUsers), _toConsumableArray(d.blockingUsers)));
  8072.             b.extend(f, d.user, {
  8073.               blockedUserIdSet: g
  8074.             }),
  8075.             f.blockedUserIdSet.forEach(function (a) {
  8076.               new l(h.User, {
  8077.                 id: a
  8078.               }).set({
  8079.                 isBlocked: !0
  8080.               })
  8081.             })
  8082.           }
  8083.           var i = c.get('thread') && c.get('thread').forum && c.get('thread').forum.id;
  8084.           k.isFeatureActive('embed_refresh', {
  8085.             forum: i
  8086.           }) && d.followingUsers && (b.extend(f, d.user, {
  8087.             followingUserIdSet: new Set(d.followingUsers)
  8088.           }), f.followingUserIdSet.forEach(function (a) {
  8089.             return new l(h.User, {
  8090.               id: a,
  8091.               isFollowing: !0
  8092.             })
  8093.           })),
  8094.           c.set(d.session),
  8095.           f.id ? (c.setUser(new l(h.User, f)), e.users.add(c.user), d.thread && (e.set('userScore', d.thread.userScore), e.set('userSubscription', d.thread.userSubscription), e.set('userRating', d.thread.userRating))) : c.loginAsAnon(),
  8096.           c.trigger('fetchThreadDetails:success')
  8097.         },
  8098.         complete: function () {
  8099.           c._request = null
  8100.         }
  8101.       }),
  8102.       c._request
  8103.     },
  8104.     logout: function () {
  8105.       this.removeSessionId();
  8106.       var a = this.get('sso');
  8107.       this.isSSO() && a && a.logout ? e.frame.sendHostMessage('navigate', a.logout) : this.locationReplace(n(i.logout, {
  8108.         redirect: window.location.href
  8109.       }))
  8110.     },
  8111.     locationReplace: function (a) {
  8112.       window.location.replace(a)
  8113.     },
  8114.     isSSO: function () {
  8115.       return this.user && 'sso' === this.user.get('user_type')
  8116.     },
  8117.     getAuthWindowArgs: function (a) {
  8118.       var c = j.prototype.getAuthWindowArgs.call(this, a),
  8119.       d = t.getLounge().config;
  8120.       if (a.attachExperiment && d && d.experiment) {
  8121.         var e = d.experiment;
  8122.         c.evs = window.btoa([e.experiment,
  8123.         e.variant,
  8124.         e.service].join(':'))
  8125.       }
  8126.       return b.defaults({
  8127.         forum: this.get('thread') && this.get('thread').forum.id
  8128.       }, c)
  8129.     },
  8130.     openAuthWindow: function (a, b, c) {
  8131.       try {
  8132.         var d = this.get('thread'),
  8133.         e = d && d.currentUrl;
  8134.         window.sessionStorage && e && window.sessionStorage.setItem('discussionUrl', e)
  8135.       } catch (f) {
  8136.       }
  8137.       return j.prototype.openAuthWindow.call(this, a, b, c)
  8138.     },
  8139.     authServices: b.defaults({
  8140.       disqusDotcom: {
  8141.         url: i.dotcomLogin,
  8142.         width: 478,
  8143.         height: 590,
  8144.         params: {
  8145.           next: i.login
  8146.         },
  8147.         attachExperiment: !0
  8148.       },
  8149.       sso: function A() {
  8150.         var A = this.get('sso'),
  8151.         a = parseInt(A.width || '800', 10),
  8152.         c = parseInt(A.height || '500', 10),
  8153.         d = this.openAuthWindow(A.url, a, c);
  8154.         !function f() {
  8155.           s.isWindowClosed(d) ? e.frame.sendHostMessage('reload') : b.delay(f, 500)
  8156.         }()
  8157.       }
  8158.     }, j.prototype.authServices),
  8159.     bindAudienceSyncHandlers: function () {
  8160.       this.listenTo(this, 'change:id change:audienceSyncVerified', function () {
  8161.         this.get('audienceSyncVerified') && e.frame.sendHostMessage('session.identify', this.user.id)
  8162.       }),
  8163.       this.listenTo(e.frame, {
  8164.         '!audiencesync:grant': function () {
  8165.           this.set('audienceSyncVerified', !0)
  8166.         }
  8167.       })
  8168.     },
  8169.     getAudienceSyncUrl: function () {
  8170.       var a = {
  8171.         client_id: this.get('apiKey'),
  8172.         response_type: 'audiencesync',
  8173.         forum_id: this.get('thread').forum.id
  8174.       };
  8175.       return 'https:' === window.location.protocol && (a.ssl = 1),
  8176.       n(i.authorize, a)
  8177.     },
  8178.     getRecaptchaKey: function () {
  8179.       return this.get('recaptchaPublicKey')
  8180.     },
  8181.     audienceSync: function () {
  8182.       this.openAuthWindow(this.getAudienceSyncUrl(), 460, 355)
  8183.     },
  8184.     needsAudienceSyncAuth: function (a) {
  8185.       return a.get('settings').audienceSyncEnabled && this.isLoggedIn() && !this.get('audienceSyncVerified')
  8186.     },
  8187.     getLoggedOutUserFlags: function () {
  8188.       return this._loggedOutUserFlags ? this._loggedOutUserFlags : (this._loggedOutUserFlags = new q.Collection(q.LOGGED_OUT_FLAGS, {
  8189.         session: this
  8190.       }), this._loggedOutUserFlags)
  8191.     }
  8192.   });
  8193.   return b.extend(x, b.chain(z).keys().map(function (a) {
  8194.     return [a,
  8195.     z[a]]
  8196.   }).object().value(), {
  8197.     get: function () {
  8198.       return v = v || new z
  8199.     },
  8200.     setDefaults: function (a) {
  8201.       if (v) throw new Error('Session defaults cannot be changed after a session instance is created!');
  8202.       return z._defaults = b.extend(z.prototype._defaults, a),
  8203.       z._defaults
  8204.     },
  8205.     forget: function () {
  8206.       v && (v.stop(), v = null)
  8207.     }
  8208.   }),
  8209.   x
  8210. }),
  8211. define('common/views/mixins', [
  8212.   'jquery',
  8213.   'underscore',
  8214.   'core/bus',
  8215.   'core/UniqueModel',
  8216.   'common/models',
  8217.   'common/Session'
  8218. ], function (a, b, c, d, e, f) {
  8219.   'use strict';
  8220.   var g = {
  8221.     proxyViewEvents: function (a) {
  8222.       this.listenTo(a, 'all', function (a) {
  8223.         0 === a.indexOf('uiAction:') && this.trigger.apply(this, arguments)
  8224.       }, this)
  8225.     }
  8226.   },
  8227.   h = {
  8228.     updateUserAvatarHelper: function (b, c) {
  8229.       a('img[data-user=' + b + '][data-role="user-avatar"]').attr('src', c)
  8230.     },
  8231.     updateUserNameHelper: function (c, d) {
  8232.       var e = '[data-username="' + c + '"][data-role=username]';
  8233.       a('a' + e + ', span' + e).html(b.escape(d))
  8234.     },
  8235.     bindProfileUIListeners: function (a) {
  8236.       this.listenTo(a, {
  8237.         'change:avatar': function () {
  8238.           this.updateUserAvatarHelper(a.user.id, a.user.get('avatar').cache)
  8239.         },
  8240.         'change:name': function () {
  8241.           this.updateUserNameHelper(a.user.get('username'), a.user.get('name'))
  8242.         }
  8243.       })
  8244.     }
  8245.   },
  8246.   i = {
  8247.     toggleFollow: function (b) {
  8248.       b.preventDefault(),
  8249.       b.stopPropagation();
  8250.       var c,
  8251.       g = b && a(b.target).closest('a[data-user]').attr('data-user');
  8252.       c = this.collection && g ? this.collection.get(g) : this.user ? this.user : d.get(e.User, g);
  8253.       var h = f.get();
  8254.       return h.isLoggedOut() ? (this.trigger('authenticating'), this.listenToOnce(h, 'change:id', function () {
  8255.         h.isLoggedIn() && this.follow(c)
  8256.       }), h.get('sso') && h.get('sso').url ? void h.authenticate('sso') : void h.authenticate('disqusDotcom')) : void (c.get('isFollowing') ? this.unfollow(c) : this.follow(c))
  8257.     },
  8258.     unfollow: function (a) {
  8259.       a.unfollow(),
  8260.       c.trigger('uiAction:unfollowUser', a)
  8261.     },
  8262.     follow: function (a) {
  8263.       a.follow(),
  8264.       c.trigger('uiAction:followUser', a)
  8265.     }
  8266.   };
  8267.   return {
  8268.     FollowButtonMixin: i,
  8269.     UiActionEventProxy: g,
  8270.     ProfileHtmlHelpers: h
  8271.   }
  8272. }),
  8273. define('core/utils/isIframed', [
  8274. ], function () {
  8275.   'use strict';
  8276.   return function (a) {
  8277.     try {
  8278.       return a.self !== a.top
  8279.     } catch (b) {
  8280.       return !0
  8281.     }
  8282.   }
  8283. }),
  8284. define('core/utils/addElement', [
  8285. ], function () {
  8286.   'use strict';
  8287.   var a = window.document;
  8288.   return function (b, c, d) {
  8289.     var e = a.createElement(c);
  8290.     return d && Object.keys(d).forEach(function (a) {
  8291.       e.setAttribute(a, d[a])
  8292.     }),
  8293.     b.appendChild(e),
  8294.     e
  8295.   }
  8296. }),
  8297. define('core/utils/isMediaTradecraftAdEnabled', [
  8298.   'core/utils/url/parseQueryString',
  8299.   'core/switches',
  8300.   'core/utils/addElement'
  8301. ], function (a, b, c) {
  8302.   'use strict';
  8303.   function d() {
  8304.     var b = a();
  8305.     if (!window.isMtcAdded) {
  8306.       window.isMtcAdded = !0;
  8307.       var d = window.document.head;
  8308.       c(d, 'link', {
  8309.         rel: 'preconnect',
  8310.         href: 'https://01.cdn.mediatradecraft.com/',
  8311.         crossorigin: ''
  8312.       }),
  8313.       c(d, 'link', {
  8314.         rel: 'dns-prefetch',
  8315.         href: 'https://01.cdn.mediatradecraft.com/'
  8316.       }),
  8317.       c(d, 'link', {
  8318.         rel: 'preconnect',
  8319.         href: 'https://securepubads.g.doubleclick.net/',
  8320.         crossorigin: ''
  8321.       }),
  8322.       c(d, 'link', {
  8323.         rel: 'dns-prefetch',
  8324.         href: 'https://securepubads.g.doubleclick.net/'
  8325.       }),
  8326.       c(d, 'link', {
  8327.         rel: 'preconnect',
  8328.         href: 'https://c.amazon-adsystem.com/',
  8329.         crossorigin: ''
  8330.       }),
  8331.       c(d, 'link', {
  8332.         rel: 'dns-prefetch',
  8333.         href: 'https://c.amazon-adsystem.com/'
  8334.       }),
  8335.       c(d, 'link', {
  8336.         rel: 'preconnect',
  8337.         href: 'https://micro.rubiconproject.com/',
  8338.         crossorigin: ''
  8339.       }),
  8340.       c(d, 'link', {
  8341.         rel: 'dns-prefetch',
  8342.         href: 'https://micro.rubiconproject.com/'
  8343.       }),
  8344.       c(d, 'script', {
  8345.         src: 'https://c.amazon-adsystem.com/aax2/apstag.js',
  8346.         async: 'true'
  8347.       }),
  8348.       c(d, 'script', {
  8349.         src: 'https://securepubads.g.doubleclick.net/tag/js/gpt.js',
  8350.         async: 'true'
  8351.       }),
  8352.       'true' === b.mtctest && 'true' !== b.mtcprod ? (c(d, 'script', {
  8353.         src: 'https://01.cdn.mediatradecraft.com/disqus/stg/main.js',
  8354.         async: 'true'
  8355.       }), c(d, 'link', {
  8356.         href: 'https://01.cdn.mediatradecraft.com/disqus/stg/main.css',
  8357.         media: 'print',
  8358.         onload: 'this.media=\'all\'',
  8359.         rel: 'stylesheet'
  8360.       })) : (c(d, 'script', {
  8361.         src: 'https://01.cdn.mediatradecraft.com/disqus/main.js',
  8362.         async: 'true'
  8363.       }), c(d, 'link', {
  8364.         href: 'https://01.cdn.mediatradecraft.com/disqus/main.css',
  8365.         media: 'print',
  8366.         onload: 'this.media=\'all\'',
  8367.         rel: 'stylesheet'
  8368.       }))
  8369.     }
  8370.   }
  8371.   return function (c, e) {
  8372.     var f = a();
  8373.     if ('false' === f.mtctest) return !1;
  8374.     var g = (!e || !e.channelId || 'true' === f.mtctest || b.isFeatureActive('mtc_ads_channels')) && (c && 'mtcdisabled' === c.experiment.experiment && 'active' === c.experiment.variant || 'true' === f.mtctest || b.isFeatureActive('mtc_ads'));
  8375.     return g ? d() : window.isMtcAdded && location.reload(),
  8376.     g
  8377.   }
  8378. }),
  8379. define('core/viglink', [
  8380.   'remote/config'
  8381. ], function (a) {
  8382.   'use strict';
  8383.   var b = {
  8384.   },
  8385.   c = null;
  8386.   return b.resetVersion = function () {
  8387.     c = null
  8388.   },
  8389.   b.forceVersion = function (a) {
  8390.     c = a
  8391.   },
  8392.   b.getVersion = function () {
  8393.     return c ? c : a.lounge && a.lounge.viglink && a.lounge.viglink.version || 'none'
  8394.   },
  8395.   b.getExperimentVersion = function () {
  8396.     return a.lounge && a.lounge.viglink && a.lounge.viglink.experiment_version || 'none'
  8397.   },
  8398.   b
  8399. }),
  8400. define('common/outboundlinkhandler', [
  8401.   'jquery',
  8402.   'underscore',
  8403.   'core/utils',
  8404.   'common/utils'
  8405. ], function (a, b, c, d) {
  8406.   'use strict';
  8407.   function e() {
  8408.     this.handlers = [
  8409.     ],
  8410.     this.locked = {
  8411.     },
  8412.     this.timeout = 1000
  8413.   }
  8414.   return b.extend(e.prototype, {
  8415.     handleClick: function (d) {
  8416.       var e = a(d.currentTarget),
  8417.       f = this.getLinkTrackingId(e);
  8418.       if (this.shouldHandleClick(d, e, f)) {
  8419.         var g = b.chain(this.handlers).map(function (a) {
  8420.           return a[0].call(a[1], d, e)
  8421.         }).compact().value();
  8422.         c.willOpenNewWindow(d, e) || (d.preventDefault(), this.setLatestClick(f), this.delayNavigation(d, e, g))
  8423.       }
  8424.     },
  8425.     delayNavigation: function (c, e, f) {
  8426.       this.lockLink(this.getLinkTrackingId(e));
  8427.       var g = b.bind(function () {
  8428.         this.isLatestClick(this.getLinkTrackingId(e)) && d.triggerClick(e, c.originalEvent)
  8429.       }, this);
  8430.       b.delay(g, this.timeout),
  8431.       a.when.apply(a, f).always(g)
  8432.     },
  8433.     registerBeforeNavigationHandler: function (a, b) {
  8434.       this.handlers.push([a,
  8435.       b])
  8436.     },
  8437.     getLinkTrackingId: function (a) {
  8438.       var c = a.attr('data-tid');
  8439.       return c || (c = b.uniqueId(), a.attr('data-tid', c)),
  8440.       c
  8441.     },
  8442.     shouldHandleClick: function (a, b) {
  8443.       if (!this.isLinkLocked(this.getLinkTrackingId(b))) {
  8444.         if (a.isDefaultPrevented()) return !1;
  8445.         if (!b.is('a')) return !1;
  8446.         var c = /#.*/,
  8447.         d = (b.attr('href') || '').replace(c, '');
  8448.         return !!d
  8449.       }
  8450.     },
  8451.     setLatestClick: function (a) {
  8452.       this.latestLinkId = a
  8453.     },
  8454.     isLatestClick: function (a) {
  8455.       return this.latestLinkId === a
  8456.     },
  8457.     lockLink: function (a) {
  8458.       this.locked[a] = !0
  8459.     },
  8460.     isLinkLocked: function (a) {
  8461.       return this.locked[a]
  8462.     }
  8463.   }),
  8464.   e
  8465. }),
  8466. define('core/mixins/withEmailVerifyLink', [
  8467.   'jquery',
  8468.   'underscore',
  8469.   'core/config',
  8470.   'core/utils'
  8471. ], function (a, b, c, d) {
  8472.   'use strict';
  8473.   var e = d.preventDefaultHandler,
  8474.   f = {
  8475.     events: {
  8476.       'click [data-action=verify-email]': 'showVerifyEmailPopup'
  8477.     },
  8478.     showVerifyEmailPopup: e(function (b) {
  8479.       var e = a(b.target).attr('data-forum'),
  8480.       f = c.urls.verifyEmail;
  8481.       return e && (f = f + '?f=' + e),
  8482.       d.openWindow(f, '_blank', {
  8483.         width: 460,
  8484.         height: 355
  8485.       })
  8486.     })
  8487.   };
  8488.   return function () {
  8489.     this.events = b.defaults({
  8490.     }, this.events, f.events),
  8491.     b.extend(this, b.pick(f, 'showVerifyEmailPopup'))
  8492.   }
  8493. }),
  8494. define('core/constants/behindClickConstants', [
  8495.   'exports',
  8496.   'core/strings'
  8497. ], function (a, b) {
  8498.   'use strict';
  8499.   var c = b.get;
  8500.   a.DEFAULT_BUTTON_TEXT = b.interpolate(c('Show Comments (%(count)s)'), {
  8501.     count: '{postCount}'
  8502.   })
  8503. }),
  8504. define('core/templates/react/BehindClickTemplate', [
  8505.   'react',
  8506.   'core/constants/behindClickConstants'
  8507. ], function (a, b) {
  8508.   'use strict';
  8509.   function c(a) {
  8510.     if (!a || a.indexOf(':') === - 1) return {
  8511.     };
  8512.     var b = {
  8513.     },
  8514.     c = a.split(';');
  8515.     return c.forEach(function (a) {
  8516.       var c = a.split(':').map(function (a) {
  8517.         return a.trim()
  8518.       });
  8519.       if (c[0].indexOf('-') > 0) {
  8520.         var d = c[0].split('-');
  8521.         c[0] = d[0] + d[1].charAt(0).toUpperCase() + d[1].slice(1)
  8522.       }
  8523.       b[c.splice(0, 1) [0]] = c.join(':')
  8524.     }),
  8525.     b
  8526.   }
  8527.   function d(a, b) {
  8528.     return a ? a.replace('{postCount}', b.toLocaleString()) : a
  8529.   }
  8530.   var e = function (e) {
  8531.     var f = e.postCount,
  8532.     g = e.buttonText,
  8533.     h = e.buttonCSS,
  8534.     i = e.titleEnabled,
  8535.     j = e.titleText,
  8536.     k = e.titleCSS;
  8537.     return a.createElement('div', {
  8538.       id: 'behind-click__container'
  8539.     }, i ? a.createElement('h3', {
  8540.       id: 'behind-click__title',
  8541.       style: c(k)
  8542.     }, d(j, f)) : null, a.createElement('button', {
  8543.       id: 'thread-visibility__button',
  8544.       className: 'btn alert',
  8545.       'data-action': 'toggle-thread-visibility',
  8546.       style: c(h)
  8547.     }, g ? d(g, f) : d(b.DEFAULT_BUTTON_TEXT, f)))
  8548.   };
  8549.   return e
  8550. }),
  8551. define('templates/lounge/partials/badgesMessage', [
  8552.   'react',
  8553.   'core/strings',
  8554.   'core/switches',
  8555.   'core/bus'
  8556. ], function (a, b, c, d) {
  8557.   'use strict';
  8558.   var e = b.gettext,
  8559.   f = function (b) {
  8560.     var c = b.url;
  8561.     return a.createElement('a', {
  8562.       href: c,
  8563.       target: '_blank',
  8564.       rel: 'noopener noreferrer',
  8565.       className: 'policy-link publisher-anchor-color',
  8566.       onClick: function (a) {
  8567.         a.stopPropagation(),
  8568.         d.trigger('uiAction:clickBadgesMessage', c)
  8569.       }
  8570.     }, e('See the available badges'))
  8571.   },
  8572.   g = function (b) {
  8573.     var d = b.forum,
  8574.     g = b.forumBadgesLink,
  8575.     h = c.isFeatureActive('embed_refresh', {
  8576.       forum: d.id
  8577.     }),
  8578.     i = h ? 'comment-policy-refresh' : 'comment-policy',
  8579.     j = h ? 'comment-policy-refresh__text' : 'comment-policy-text',
  8580.     k = h ? 'comment-policy-refresh__heading' : 'comment-policy-text text-bold',
  8581.     l = h ? 'comment-policy-refresh__link' : 'comment-policy-link';
  8582.     return a.createElement('div', {
  8583.       id: 'badges-message',
  8584.       className: 'badges-message ' + i + ' publisher-anchor-color'
  8585.     }, a.createElement('span', {
  8586.       'data-action': 'close-badges-message',
  8587.       className: 'badges-message-close',
  8588.       tabIndex: '0'
  8589.     }), a.createElement('div', {
  8590.       className: 'content'
  8591.     }, a.createElement('p', {
  8592.       className: k
  8593.     }, e('Earn badges on %(forumName)s!', {
  8594.       forumName: d.name
  8595.     })), a.createElement('p', {
  8596.       className: j
  8597.     }, e('Badges are awarded for commenting, receiving upvotes, and other conditions established by the publisher. Awarded badges will be displayed next to your name in comments on this site as well as on your profile.'), a.createElement('p', {
  8598.       className: l
  8599.     }, a.createElement(f, {
  8600.       url: g,
  8601.       isRefreshEnabled: h
  8602.     })))), a.createElement('span', {
  8603.       'aria-hidden': 'true',
  8604.       className: 'badges-message-icon'
  8605.     }))
  8606.   };
  8607.   return g
  8608. }),
  8609. define('templates/lounge/partials/commentPolicy', [
  8610.   'react',
  8611.   'core/strings',
  8612.   'core/bus',
  8613.   'core/switches'
  8614. ], function (a, b, c, d) {
  8615.   'use strict';
  8616.   var e = b.gettext,
  8617.   f = function (b) {
  8618.     var d = b.url,
  8619.     e = b.className,
  8620.     f = void 0 === e ? '' : e,
  8621.     g = b.children,
  8622.     h = b.isRefreshEnabled,
  8623.     i = h ? 'comment-policy-refresh__link' : 'comment-policy-link';
  8624.     return a.createElement('a', {
  8625.       href: d,
  8626.       target: '_blank',
  8627.       rel: 'noopener noreferrer',
  8628.       className: f + ' ' + i,
  8629.       onClick: function (a) {
  8630.         a.stopPropagation(),
  8631.         c.trigger('uiAction:clickCommentPolicy', d)
  8632.       }
  8633.     }, g)
  8634.   },
  8635.   g = function (b) {
  8636.     var c = b.forum,
  8637.     d = b.isRefreshEnabled;
  8638.     if (!c.commentPolicyLink) return null;
  8639.     var g = e('Please read our %(commentPolicyLink)s before commenting.', {
  8640.       commentPolicyLink: a.createElement(f, {
  8641.         url: c.commentPolicyLink,
  8642.         isRefreshEnabled: d
  8643.       }, e('Comment Policy'))
  8644.     });
  8645.     return g
  8646.   },
  8647.   h = function (b) {
  8648.     var c = b.forum,
  8649.     f = b.isPolicyAccepted,
  8650.     h = d.isFeatureActive('embed_refresh', {
  8651.       forum: c.id
  8652.     }),
  8653.     i = h && d.isFeatureActive('embed_refresh_v2', {
  8654.       forum: c.id
  8655.     }),
  8656.     j = h ? 'comment-policy-refresh ' + (i ? 'comment-policy-refresh--v2' : '') : 'comment-policy',
  8657.     k = h ? 'comment-policy-refresh__text' : 'comment-policy-text',
  8658.     l = h ? 'comment-policy-refresh__heading' : 'comment-policy-text text-bold';
  8659.     return a.createElement('div', {
  8660.       id: 'comment-policy',
  8661.       className: j + ' publisher-anchor-color ' + (f ? 'hidden' : '')
  8662.     }, a.createElement('div', {
  8663.       className: 'content'
  8664.     }, a.createElement('p', {
  8665.       className: l
  8666.     }, e('%(forumName)s Comment Policy', {
  8667.       forumName: c.name
  8668.     })), a.createElement('p', {
  8669.       className: k
  8670.     }, c.commentPolicyText || null, a.createElement('p', {
  8671.       className: 'comment-policy-refresh__prompt'
  8672.     }, a.createElement(g, {
  8673.       forum: c,
  8674.       isRefreshEnabled: h
  8675.     })))), h ? a.createElement('button', {
  8676.       className: 'btn comment-policy-refresh__button publisher-background-color',
  8677.       'data-action': 'accept-comment-policy'
  8678.     }, e('Got it')) : a.createElement('span', {
  8679.       'aria-hidden': 'true',
  8680.       className: 'icon icon-chat-bubble'
  8681.     }))
  8682.   };
  8683.   return h
  8684. }),
  8685. define('core/templates/react/ThreadTemplate', [
  8686.   'react',
  8687.   'core/constants/voteConstants',
  8688.   'core/strings',
  8689.   'core/switches',
  8690.   'core/utils/object/get',
  8691.   'templates/lounge/partials/badgesMessage',
  8692.   'templates/lounge/partials/commentPolicy'
  8693. ], function (a, b, c, d, e, f, g) {
  8694.   'use strict';
  8695.   var h = c.gettext,
  8696.   i = function (b) {
  8697.     var c = d.isFeatureActive('embed_refresh', {
  8698.       forum: b.forum.id
  8699.     }),
  8700.     e = c && d.isFeatureActive('embed_refresh_v2', {
  8701.       forum: b.forum.id
  8702.     }),
  8703.     f = !1,
  8704.     i = c ? 'disqus-footer__wrapper disqus-footer__wrapper--refresh' : 'disqus-footer__wrapper',
  8705.     j = c ? 'load-more-refresh ' + (e ? 'load-more-refresh--v2' : '') : 'load-more',
  8706.     k = c ? 'btn load-more-refresh__button ' + (e ? '' : 'publisher-background-color-refresh') : 'btn load-more__button',
  8707.     l = c ? 'alert alert--realtime alert--realtime--refresh ' + (e ? 'alert--realtime--refresh-v2' : '') : 'alert alert--realtime',
  8708.     m = (b.forum.commentPolicyText || b.forum.commentPolicyLink) && !b.isPolicyAccepted,
  8709.     n = a.createElement('button', {
  8710.       className: l,
  8711.       style: {
  8712.         display: 'none'
  8713.       },
  8714.       'data-role': 'realtime-notification'
  8715.     }),
  8716.     o = f ? null : a.createElement('div', {
  8717.       id: 'highlighted-post',
  8718.       'data-tracking-area': 'highlighted',
  8719.       className: 'highlighted-post'
  8720.     });
  8721.     return a.createElement('div', {
  8722.       id: 'thread__wrapper'
  8723.     }, a.createElement('div', {
  8724.       id: 'placement-top',
  8725.       'data-tracking-area': 'discovery-north'
  8726.     }), a.createElement('div', {
  8727.       id: 'onboard',
  8728.       'data-tracking-area': 'onboard'
  8729.     }), m && c ? a.createElement(g, {
  8730.       forum: b.forum,
  8731.       isPolicyAccepted: b.isPolicyAccepted
  8732.     }) : null, a.createElement('div', {
  8733.       id: 'reactions__container'
  8734.     }), a.createElement('div', {
  8735.       id: 'ratings__container'
  8736.     }), m && !c ? a.createElement(g, {
  8737.       forum: b.forum,
  8738.       isPolicyAccepted: b.isPolicyAccepted
  8739.     }) : null, a.createElement('div', {
  8740.       id: 'badges-message__container'
  8741.     }), c ? null : o, a.createElement('div', {
  8742.       id: 'global-alert'
  8743.     }), a.createElement('div', {
  8744.       id: 'tos__container'
  8745.     }), b.inHome ? null : a.createElement('header', {
  8746.       id: 'main-nav',
  8747.       'data-tracking-area': 'main-nav'
  8748.     }), a.createElement('section', {
  8749.       id: 'conversation',
  8750.       'data-role': 'main',
  8751.       'data-tracking-area': 'main'
  8752.     }, a.createElement('div', {
  8753.       id: 'posts'
  8754.     }, a.createElement('div', {
  8755.       id: 'form',
  8756.       className: 'textarea-outer-wrapper--top-level'
  8757.     }), c ? null : n, a.createElement('div', {
  8758.       id: 'email-signup'
  8759.     }), a.createElement('div', {
  8760.       id: 'secondary-navigation'
  8761.     }), a.createElement('div', {
  8762.       id: 'no-posts',
  8763.       style: {
  8764.         display: 'none'
  8765.       }
  8766.     }), c ? o : null, c ? n : null, f ? a.createElement('div', {
  8767.       id: 'embed_v2-thread'
  8768.     }) : a.createElement('ul', {
  8769.       id: 'post-list',
  8770.       className: 'post-list loading'
  8771.     }), a.createElement('div', {
  8772.       className: j,
  8773.       'data-role': 'more',
  8774.       style: {
  8775.         display: 'none'
  8776.       }
  8777.     }, a.createElement('a', {
  8778.       href: '#',
  8779.       'data-action': 'more-posts',
  8780.       className: k
  8781.     }, h('Load more comments'))))), a.createElement('div', {
  8782.       id: 'placement-bottom',
  8783.       'data-tracking-area': 'discovery-south'
  8784.     }), b.hideFooter ? null : a.createElement('footer', {
  8785.       id: 'footer',
  8786.       'data-tracking-area': 'footer',
  8787.       className: i
  8788.     }))
  8789.   };
  8790.   return i
  8791. }),
  8792. define('lounge/menu-handler', [
  8793.   'jquery',
  8794.   'core/bus'
  8795. ], function (a, b) {
  8796.   'use strict';
  8797.   return {
  8798.     init: function (c) {
  8799.       function d() {
  8800.         a('.dropdown').removeClass('open')
  8801.       }
  8802.       a('html').on('click', d),
  8803.       a('body').delegate('[data-toggle]', 'click', function (b) {
  8804.         b.stopPropagation(),
  8805.         b.preventDefault();
  8806.         var e = a(b.currentTarget),
  8807.         f = e.closest('.' + e.attr('data-toggle')),
  8808.         g = 'disabled' !== f.attr('data-dropdown') && !f.hasClass('open');
  8809.         if (f.attr('data-dropdown', 'enabled'), d(), g) {
  8810.           f.addClass('open');
  8811.           var h = f.data('view-id');
  8812.           h && c.trigger('opened:' + h, f)
  8813.         }
  8814.       }),
  8815.       b.frame.on('window.click', d)
  8816.     }
  8817.   }
  8818. }),
  8819. define('lounge/mixins', [
  8820.   'core/utils/url/serialize',
  8821.   'core/strings'
  8822. ], function (a, b) {
  8823.   'use strict';
  8824.   var c = b.gettext,
  8825.   d = {
  8826.     _sharePopup: function (a, b) {
  8827.       return window.open(a, '_blank', b || 'width=550,height=520')
  8828.     },
  8829.     share: function (a) {
  8830.       this.sharers[a].call(this)
  8831.     },
  8832.     sharers: {
  8833.       twitter: function () {
  8834.         var b = 'https://twitter.com/intent/tweet',
  8835.         c = this.model.shortLink();
  8836.         this._sharePopup(a(b, {
  8837.           url: c,
  8838.           text: this.model.twitterText(c)
  8839.         }))
  8840.       },
  8841.       facebook: function () {
  8842.         this._sharePopup(a('https://www.facebook.com/sharer.php', {
  8843.           u: this.model.shortLink()
  8844.         }), 'width=655,height=352')
  8845.       },
  8846.       email: function () {
  8847.         window.location.href = a('mailto:', {
  8848.           subject: c('Somebody has shared this with you on Disqus'),
  8849.           body: c('Check out this discussion') + ': ' + this.model.shortLink()
  8850.         })
  8851.       }
  8852.     }
  8853.   },
  8854.   e = function () {
  8855.     function a() {
  8856.       return this.collapseTarget && this.collapseTarget.length || (this.collapseTarget = this.collapseTargetSelector ? this[this.collapseScope].find(this.collapseTargetSelector) : this[this.collapseScope]),
  8857.       this.collapseTarget
  8858.     }
  8859.     function b() {
  8860.       var b = this;
  8861.       if (b.isCollapseAllowed) {
  8862.         var c = a.call(b);
  8863.         c && c.length && (c.height(b.collapsedHeight), e.call(b))
  8864.       }
  8865.     }
  8866.     function c(a) {
  8867.       var b = this;
  8868.       if (b.collapseTarget && b.collapseTarget.length) {
  8869.         var c = b.collapseTarget;
  8870.         c.css('height', 'auto'),
  8871.         c.css('maxHeight', 'none'),
  8872.         f.call(b),
  8873.         a || (b.isCollapseAllowed = !1)
  8874.       }
  8875.     }
  8876.     function d() {
  8877.       return this.seeMoreButton && this.seeMoreButton.length || (this.seeMoreButton = a.call(this).siblings('[data-action=see-more]')),
  8878.       this.seeMoreButton
  8879.     }
  8880.     function e() {
  8881.       var a = this;
  8882.       d.call(this).removeClass('hidden').on('click', function () {
  8883.         a.expand()
  8884.       })
  8885.     }
  8886.     function f() {
  8887.       d.call(this).addClass('hidden').off('click')
  8888.     }
  8889.     return function (a) {
  8890.       var d = this;
  8891.       d.isCollapseAllowed = !0,
  8892.       d.collapsedHeight = a.collapsedHeight,
  8893.       d.collapseTargetSelector = a.collapseTargetSelector,
  8894.       d.collapseScope = a.collapseScope || '$el',
  8895.       d.collapse = b,
  8896.       d.expand = c
  8897.     }
  8898.   }();
  8899.   return {
  8900.     ShareMixin: d,
  8901.     asCollapsible: e
  8902.   }
  8903. }),
  8904. define('lounge/realtime', [
  8905.   'underscore',
  8906.   'backbone',
  8907.   'loglevel',
  8908.   'remote/config',
  8909.   'common/urls',
  8910.   'core/utils/url/serialize',
  8911.   'common/utils'
  8912. ], function (a, b, c, d, e, f, g) {
  8913.   'use strict';
  8914.   function h() {
  8915.     s.apply(this, arguments),
  8916.     this.marker = 0,
  8917.     this.interval = m,
  8918.     this._boundOnError = a.bind(this.onError, this),
  8919.     this._boundOnLoad = a.bind(this.onLoad, this),
  8920.     this._boundOnProgress = a.bind(this.onProgress, this)
  8921.   }
  8922.   function i() {
  8923.     s.apply(this, arguments),
  8924.     this.handshakeSuccess = null,
  8925.     this.interval = m,
  8926.     this.handshakeFails = 0,
  8927.     this._boundOnOpen = a.bind(this.onOpen, this),
  8928.     this._boundError = a.bind(this.onError, this),
  8929.     this._boundClose = a.bind(this.onClose, this),
  8930.     this._boundMessage = a.compose(a.bind(this.onMessage, this), function (a) {
  8931.       return JSON.parse(a.data)
  8932.     })
  8933.   }
  8934.   var j = d.lounge.REALTIME || {
  8935.   },
  8936.   k = j.EXP_BASE || 2,
  8937.   l = j.BACKOFF_LIMIT || 300,
  8938.   m = j.BACKOFF_INTERVAL || 1,
  8939.   n = j.MAX_HANDSHAKE_FAILS || 1,
  8940.   o = j.WEBSOCKETS_ENABLED !== !1 && window.WebSocket && 2 === window.WebSocket.CLOSING,
  8941.   p = j.XHR_ENABLED !== !1,
  8942.   q = function () {
  8943.   },
  8944.   r = function () {
  8945.     throw new Error('Pipe class cannot be used directly.')
  8946.   },
  8947.   s = function (b) {
  8948.     this.channel = b,
  8949.     this.connection = null,
  8950.     this.paused = !1,
  8951.     this._msgBuffer = [
  8952.     ],
  8953.     this._boundOpen = a.bind(this.open, this)
  8954.   };
  8955.   a.extend(s.prototype, b.Events, {
  8956.     getUrl: function (b) {
  8957.       var c = {
  8958.       };
  8959.       return a.extend(c, b),
  8960.       f(this.baseUrl + this.channel, c)
  8961.     },
  8962.     onMessage: function (a) {
  8963.       var b = a.message_type,
  8964.       d = a.firehose_id;
  8965.       this.lastEventId = d,
  8966.       c.debug('RT: new message:', b, d);
  8967.       var e = {
  8968.         type: b,
  8969.         data: a.message_body,
  8970.         lastEventId: d
  8971.       };
  8972.       this.trigger(b, e)
  8973.     },
  8974.     _msgToBuffer: function () {
  8975.       this._msgBuffer.push(a.toArray(arguments))
  8976.     },
  8977.     pause: function (a) {
  8978.       this.paused || (this.paused = !0, this._trigger = this.trigger, this.trigger = a === !1 ? q : this._msgToBuffer, c.debug('RT: paused, buffered: %s', a !== !1))
  8979.     },
  8980.     resume: function () {
  8981.       if (this.paused) {
  8982.         this.paused = !1,
  8983.         this.trigger = this._trigger,
  8984.         c.debug('RT: resumed, buffered messages: %s', this._msgBuffer.length);
  8985.         for (var a; a = this._msgBuffer.shift(); ) this.trigger.apply(this, a)
  8986.       }
  8987.     },
  8988.     open: r,
  8989.     close: function () {
  8990.       var a = this.connection;
  8991.       return !!a && (this.connection = null, a)
  8992.     }
  8993.   }),
  8994.   a.extend(h.prototype, s.prototype, {
  8995.     baseUrl: e.realertime + '/api/2/',
  8996.     onError: function () {
  8997.       this.connection && (this.connection = null, this.trigger('error', this), this.interval <= l && (this.interval *= k), c.info('RT: Connection error, backing off %s secs', this.interval), a.delay(this._boundOpen, 1000 * this.interval))
  8998.     },
  8999.     onLoad: function () {
  9000.       this.connection && (this.connection = null, this.trigger('success', this), a.defer(this._boundOpen))
  9001.     },
  9002.     onProgress: function () {
  9003.       if (this.connection) {
  9004.         var a,
  9005.         b,
  9006.         d,
  9007.         e,
  9008.         f = this.connection.responseText,
  9009.         g = 0;
  9010.         if (f && !(this.marker >= f.length)) {
  9011.           a = f.slice(this.marker).split('\n');
  9012.           for (var h = a.length, i = 0; i < h; i++) if (b = a[i], g += b.length + 1, d = b.replace(/^\s+|\s+$/g, '')) {
  9013.             try {
  9014.               e = JSON.parse(d)
  9015.             } catch (j) {
  9016.               if (i === h - 1) {
  9017.                 g -= b.length + 1;
  9018.                 break
  9019.               }
  9020.               c.debug('RT: unable to parse: ', d, b);
  9021.               continue
  9022.             }
  9023.             this.onMessage(e)
  9024.           } else c.debug('RT: ignoring empty row...');
  9025.           g > 0 && (this.marker += g - 1)
  9026.         }
  9027.       }
  9028.     },
  9029.     open: function () {
  9030.       this.close();
  9031.       var a = this.connection = g.CORS.request('GET', this.getUrl(), this._boundOnLoad, this._boundOnError);
  9032.       if (!a) return void c.debug('RT: Cannot use any cross-domain request tool with StreamPipe. Bailing out.');
  9033.       a.onprogress = this._boundOnProgress,
  9034.       this.connection = a,
  9035.       this.marker = 0;
  9036.       try {
  9037.         a.send()
  9038.       } catch (b) {
  9039.         this.connection = null,
  9040.         c.debug('RT: Attempt to send a CORS request failed.')
  9041.       }
  9042.     },
  9043.     close: function () {
  9044.       var a = s.prototype.close.apply(this);
  9045.       return a && a.abort()
  9046.     }
  9047.   }),
  9048.   a.extend(i.prototype, s.prototype, {
  9049.     baseUrl: 'wss:' + e.realertime + '/ws/2/',
  9050.     onOpen: function () {
  9051.       c.debug('RT: [Socket] Connection established.'),
  9052.       this.handshakeSuccess = !0
  9053.     },
  9054.     onError: function () {
  9055.       if (!this.handshakeSuccess) {
  9056.         if (this.handshakeFails >= n) return c.debug('RT: [Socket] Error before open, bailing out.'),
  9057.         void this.trigger('fail');
  9058.         this.handshakeFails += 1
  9059.       }
  9060.       this.connection && (this.connection = null, this.trigger('error'), this.interval <= l && (this.interval *= k), c.error('RT: Connection error, backing off %s secs', this.interval), a.delay(this._boundOpen, 1000 * this.interval))
  9061.     },
  9062.     onClose: function (a) {
  9063.       if (this.connection) {
  9064.         if (!a.wasClean) return this.onError();
  9065.         this.connection = null,
  9066.         c.debug('RT: [Socket] Connection closed. Restarting...'),
  9067.         this.trigger('close'),
  9068.         this.open()
  9069.       }
  9070.     },
  9071.     open: function () {
  9072.       this.close();
  9073.       try {
  9074.         this.connection = new window.WebSocket(this.getUrl())
  9075.       } catch (a) {
  9076.         return this.onError()
  9077.       }
  9078.       var b = this.connection;
  9079.       b.onopen = this._boundOnOpen,
  9080.       b.onerror = this._boundError,
  9081.       b.onmessage = this._boundMessage,
  9082.       b.onclose = this._boundClose
  9083.     },
  9084.     close: function () {
  9085.       var a = s.prototype.close.apply(this);
  9086.       return a && a.close()
  9087.     }
  9088.   });
  9089.   var t = {
  9090.     _wsSupported: o,
  9091.     initialize: function (b, c, d) {
  9092.       this.close(),
  9093.       this._initArgs = [
  9094.         b,
  9095.         c,
  9096.         d
  9097.       ];
  9098.       var e = this._wsSupported,
  9099.       f = e && i || p && h;
  9100.       if (f) {
  9101.         var g = this.pipe = new f(b);
  9102.         a.chain(c).pairs().each(function (a) {
  9103.           g.on(a[0], a[1], d)
  9104.         }),
  9105.         e && g.on('fail', function () {
  9106.           this._wsSupported = !1,
  9107.           g.off(),
  9108.           this.initialize.apply(this, this._initArgs)
  9109.         }, this),
  9110.         g.open()
  9111.       }
  9112.     },
  9113.     pause: function (a) {
  9114.       this.pipe && this.pipe.pause(a)
  9115.     },
  9116.     resume: function () {
  9117.       this.pipe && this.pipe.resume()
  9118.     },
  9119.     close: function () {
  9120.       this.pipe && (this.pipe.close(), this.pipe = null)
  9121.     }
  9122.   };
  9123.   return window.addEventListener('unload', a.bind(t.close, t)),
  9124.   {
  9125.     Pipe: s,
  9126.     StreamPipe: h,
  9127.     SocketPipe: i,
  9128.     Manager: t,
  9129.     MAX_HANDSHAKE_FAILS: n
  9130.   }
  9131. }),
  9132. define('lounge/views/badges-message', [
  9133.   'jquery',
  9134.   'underscore',
  9135.   'backbone',
  9136.   'react',
  9137.   'react-dom',
  9138.   'core/switches',
  9139.   'core/common/cached-storage',
  9140.   'templates/lounge/partials/badgesMessage'
  9141. ], function (a, b, c, d, e, f, g, h) {
  9142.   'use strict';
  9143.   var i = new g('badges-message', 7776000);
  9144.   i.getAll();
  9145.   var j = c.View.extend({
  9146.     events: {
  9147.       'click [data-action=close-badges-message]': 'handleDismiss',
  9148.       'keyup [data-action=close-badges-message]': 'handleDismiss'
  9149.     },
  9150.     initialize: function (a) {
  9151.       b.extend(this, b.pick(a, [
  9152.         'forum',
  9153.         'session'
  9154.       ])),
  9155.       this.model = new c.Model({
  9156.         dismissed: Boolean(i.getItem(this.forum.id))
  9157.       }),
  9158.       this.handleDismiss = this.handleDismiss.bind(this),
  9159.       this.listenTo(this.model, 'change', this.render)
  9160.     },
  9161.     handleDismiss: function (a) {
  9162.       var b = 13;
  9163.       if (!a.keyCode || a.keyCode === b) return this.model.set('dismissed', !0),
  9164.       i.setItem(this.forum.id, !0),
  9165.       Promise.resolve()
  9166.     },
  9167.     render: function () {
  9168.       var a = this.forum.get('badges');
  9169.       if (!a || !Object.keys(a).length || this.model.get('dismissed')) return this.$el.empty(),
  9170.       this;
  9171.       var b = '//disqus.com/home/forum/' + this.forum.get('id') + '/badges';
  9172.       return e.render(d.createElement(h, {
  9173.         forum: this.forum.toJSON(),
  9174.         forumBadgesLink: b
  9175.       }), this.el),
  9176.       this
  9177.     }
  9178.   });
  9179.   return j
  9180. }),
  9181. define('core/templates/react/aet/EmailSignupComplete', [
  9182.   'react',
  9183.   'core/switches'
  9184. ], function (a, b) {
  9185.   'use strict';
  9186.   var c = function (c) {
  9187.     var d = c.forum,
  9188.     e = c.isVerified,
  9189.     f = c.onDismiss;
  9190.     return a.createElement('div', {
  9191.       className: 'newsletter-box spacing-bottom-large text-center'
  9192.     }, a.createElement('div', {
  9193.       className: b.isFeatureActive('embed_refresh', {
  9194.         forum: d.name
  9195.       }) ? 'text-large spacing-bottom-small' : 'text-medium spacing-bottom-small'
  9196.     }, a.createElement('strong', null, 'Thanks for subscribing!')), e ? a.createElement('div', {
  9197.       className: 'spacing-bottom-small'
  9198.     }, (d.aetBannerConfirmation || '').split('\n').map(function (b, c) {
  9199.       return a.createElement('div', {
  9200.         key: c
  9201.       }, b)
  9202.     })) : a.createElement('div', {
  9203.       className: 'spacing-bottom-small'
  9204.     }, 'To begin receiving email updates from ', d.name, ', please click the link in the confirmation email we\'ve sent to your inbox.'), a.createElement('a', {
  9205.       className: 'newsletter-box__hide',
  9206.       href: '#',
  9207.       onClick: function (a) {
  9208.         a.preventDefault(),
  9209.         f()
  9210.       }
  9211.     }, 'Dismiss this message'))
  9212.   };
  9213.   return c
  9214. }),
  9215. define('core/templates/react/aet/EmailSignupForm', [
  9216.   'react',
  9217.   'core/strings',
  9218.   'core/switches'
  9219. ], function (a, b, c) {
  9220.   'use strict';
  9221.   var d = b.gettext,
  9222.   e = function (b) {
  9223.     var e = b.forum,
  9224.     f = b.isLoading,
  9225.     g = b.isLoggedIn,
  9226.     h = b.onDismiss,
  9227.     i = b.onSubscribe,
  9228.     j = b.allowEmpty;
  9229.     return a.createElement('div', {
  9230.       className: 'newsletter-box spacing-bottom-large'
  9231.     }, a.createElement('div', {
  9232.       className: c.isFeatureActive('embed_refresh', {
  9233.         forum: e.name
  9234.       }) ? 'text-large spacing-bottom-small' : 'text-medium spacing-bottom-small'
  9235.     }, a.createElement('strong', null, e.aetBannerTitle)), g ? a.createElement('button', {
  9236.       className: 'button button-fill--brand button-padding-wider pull-right',
  9237.       disabled: f,
  9238.       onClick: function () {
  9239.         i && i()
  9240.       }
  9241.     }, 'Subscribe') : null, a.createElement('div', {
  9242.       className: 'spacing-bottom'
  9243.     }, (e.aetBannerDescription || '').split('\n').map(function (b, c) {
  9244.       return a.createElement('div', {
  9245.         key: c
  9246.       }, b)
  9247.     })), a.createElement('div', {
  9248.       className: 'align align--wrap'
  9249.     }, g ? null : a.createElement('form', {
  9250.       className: 'align__item--grow',
  9251.       onSubmit: function (a) {
  9252.         a.preventDefault();
  9253.         var b = a.target.elements.email.value.trim();
  9254.         (b || j) && i && i(b)
  9255.       }
  9256.     }, a.createElement('div', {
  9257.       className: 'newsletter-box__input-group'
  9258.     }, a.createElement('span', {
  9259.       className: 'icon icon-mail text-large newsletter-box__input-group__icon'
  9260.     }), a.createElement('input', {
  9261.       type: 'email',
  9262.       name: 'email',
  9263.       placeholder: d('Enter email address'),
  9264.       'aria-label': 'Enter your email address here to opt into receiving a weekly digest of the latest articles from this publisher'
  9265.     })), a.createElement('input', {
  9266.       type: 'submit',
  9267.       className: 'button button-fill--brand button-padding-wider newsletter-box__submit',
  9268.       disabled: f,
  9269.       value: d('Subscribe'),
  9270.       'aria-label': 'Submit your email address'
  9271.     })), a.createElement('a', {
  9272.       href: '#',
  9273.       className: 'newsletter-box__hide publisher-anchor-color',
  9274.       onClick: function (a) {
  9275.         a.preventDefault(),
  9276.         h && h()
  9277.       }
  9278.     }, d('Hide this message'))))
  9279.   };
  9280.   return e
  9281. }),
  9282. define('lounge/views/email-signup', [
  9283.   'backbone',
  9284.   'react',
  9285.   'react-dom',
  9286.   'stance',
  9287.   'core/api',
  9288.   'core/bus',
  9289.   'core/templates/react/aet/EmailSignupComplete',
  9290.   'core/templates/react/aet/EmailSignupForm',
  9291.   'core/common/cached-storage'
  9292. ], function (a, b, c, d, e, f, g, h, i) {
  9293.   'use strict';
  9294.   var j = 0,
  9295.   k = 2,
  9296.   l = new i('aet-dismiss');
  9297.   l.getAll();
  9298.   var m = a.View.extend({
  9299.     initialize: function (b) {
  9300.       var c = b.forum,
  9301.       d = b.session;
  9302.       this.forum = c,
  9303.       this.session = d,
  9304.       this.model = new a.Model({
  9305.         dismissed: Boolean(l.getItem(this.forum.id)),
  9306.         loading: !1,
  9307.         signupComplete: !1
  9308.       }),
  9309.       this._isFirstRender = !0,
  9310.       this.handleCompleteDismiss = this.handleCompleteDismiss.bind(this),
  9311.       this.handleDismiss = this.handleDismiss.bind(this),
  9312.       this.handleSubscribe = this.handleSubscribe.bind(this),
  9313.       this.listenTo(this.model, 'change', this.render),
  9314.       this.listenTo(this.session, 'change', this.render)
  9315.     },
  9316.     getTrackingCopy: function () {
  9317.       return {
  9318.         title: this.forum.get('aetBannerTitle'),
  9319.         description_copy: this.forum.get('aetBannerDescription'),
  9320.         confirmation_copy: this.forum.get('aetBannerConfirmation')
  9321.       }
  9322.     },
  9323.     isLoggedIn: function () {
  9324.       return Boolean(this.session.user && this.session.user.id)
  9325.     },
  9326.     handleDismiss: function () {
  9327.       return this.model.set('dismissed', !0),
  9328.       f.trigger('uiAction:clickEmailSubscriptionPromptDismiss', this.getTrackingCopy()),
  9329.       this.isLoggedIn() ? Promise.resolve(e.call('aet/dismiss', {
  9330.         data: {
  9331.           forum: this.forum.id
  9332.         },
  9333.         method: 'POST'
  9334.       })) : (l.setItem(this.forum.id, !0), Promise.resolve())
  9335.     },
  9336.     handleCompleteDismiss: function () {
  9337.       this.model.set('dismissed', !0)
  9338.     },
  9339.     handleSubscribe: function () {
  9340.       var a = this,
  9341.       b = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
  9342.       if (!this.model.get('loading')) return f.trigger('uiAction:clickEmailSubscriptionPromptSubscribe', this.getTrackingCopy()),
  9343.       this.model.set('loading', !0),
  9344.       Promise.resolve(b ? e.call('aet/anonymousSubscribe', {
  9345.         data: {
  9346.           email: b,
  9347.           forum: this.forum.id
  9348.         },
  9349.         method: 'POST'
  9350.       }) : e.call('aet/subscribe', {
  9351.         data: {
  9352.           forum: this.forum.id
  9353.         },
  9354.         method: 'POST'
  9355.       })).then(function (b) {
  9356.         return a.model.set({
  9357.           loading: !1,
  9358.           signupComplete: !0
  9359.         }),
  9360.         b
  9361.       }) ['catch'](function () {
  9362.         a.model.set('loading', !1)
  9363.       })
  9364.     },
  9365.     reportView: function () {
  9366.       f.trigger('uiAction:viewEmailSubscriptionPrompt', this.getTrackingCopy())
  9367.     },
  9368.     render: function () {
  9369.       if (!this.forum.get('aetEnabled') || this.model.get('dismissed')) return this.$el.empty(),
  9370.       this;
  9371.       var a = this.session.shouldFetchSession() ? this.session.get('aetBannerStatus') : j;
  9372.       switch (a) {
  9373.         case j:
  9374.         case k:
  9375.           if (this.model.get('signupComplete') || a === k ? c.render(b.createElement(g, {
  9376.             forum: this.forum.toJSON(),
  9377.             isVerified: Boolean(this.session.user && this.session.user.get('isVerified')),
  9378.             onDismiss: this.handleCompleteDismiss
  9379.           }), this.el) : c.render(b.createElement(h, {
  9380.             forum: this.forum.toJSON(),
  9381.             isLoading: this.model.get('loading'),
  9382.             isLoggedIn: this.isLoggedIn(),
  9383.             onDismiss: this.handleDismiss,
  9384.             onSubscribe: this.handleSubscribe
  9385.           }), this.el), this._isFirstRender) {
  9386.             this._isFirstRender = !1,
  9387.             f.trigger('uiAction:loadEmailSubscriptionPrompt', this.getTrackingCopy());
  9388.             var e = d(this);
  9389.             e.isVisible() ? this.reportView() : this.listenToOnce(e, 'enter', this.reportView)
  9390.           }
  9391.           break;
  9392.         default:
  9393.           this.$el.empty()
  9394.       }
  9395.       return this
  9396.     }
  9397.   });
  9398.   return m
  9399. }),
  9400. define('react-dom/server', [
  9401.   'underscore'
  9402. ], function (a) {
  9403.   'use strict';
  9404.   var b = function c(b) {
  9405.     if (null === b) return '';
  9406.     if (a.isArray(b)) return b.map(c).join('');
  9407.     if (a.isElement(b)) return b.outerHTML;
  9408.     if (b && b.nodeType === window.Node.DOCUMENT_FRAGMENT_NODE) {
  9409.       var d = window.document.createElement('div');
  9410.       return d.appendChild(b),
  9411.       d.innerHTML
  9412.     }
  9413.     return a.escape(String(b))
  9414.   };
  9415.   return {
  9416.     renderToString: b,
  9417.     renderToStaticMarkup: b
  9418.   }
  9419. }),
  9420. define('core/utils/media/upload', [
  9421.   'underscore',
  9422.   'exports',
  9423.   'core/api',
  9424.   'core/models/Media',
  9425.   'core/UniqueModel'
  9426. ], function (a, b, c, d, e) {
  9427.   'use strict';
  9428.   b.uploadSupported = Boolean(window.FormData),
  9429.   b._extractFirstImageFile = function (b) {
  9430.     return a.find(b, function (a) {
  9431.       return a.type.match(/^image\//)
  9432.     })
  9433.   },
  9434.   b._uploadViaApi = function (a, b, d) {
  9435.     return Promise.resolve(c.call(a, {
  9436.       data: b,
  9437.       contentType: !1,
  9438.       processData: !1,
  9439.       method: 'POST',
  9440.       xhr: function () {
  9441.         var a = new window.XMLHttpRequest,
  9442.         b = d && d.onProgress;
  9443.         return b && a.upload.addEventListener('progress', function (a) {
  9444.           a.total && b(100 * a.loaded / a.total)
  9445.         }),
  9446.         a
  9447.       }
  9448.     }))
  9449.   },
  9450.   b.UPLOAD_URL = 'https://uploads.services.disqus.com/api/3.0/media/create.json',
  9451.   b.uploadMediaUrl = function (c, f) {
  9452.     var g,
  9453.     h = new window.FormData,
  9454.     i = b._extractFirstImageFile(c);
  9455.     return i ? (h.append('upload', i), h.append('permanent', 1), b._uploadViaApi(b.UPLOAD_URL, h, f).then(function (b) {
  9456.       var c = b.response,
  9457.       f = a.first(a.values(c));
  9458.       if (!f || !f.ok) throw g = new Error('Upload failed'),
  9459.       g.code = f && f['error-code'],
  9460.       g;
  9461.       return new e(d, {
  9462.         mediaType: d.MEDIA_TYPES.IMAGE_UPLOAD,
  9463.         url: f.url,
  9464.         thumbnailUrl: f.url
  9465.       })
  9466.     }, function (a) {
  9467.       if (a.responseJSON && 4 === a.responseJSON.code) throw g = new Error('Upload failed'),
  9468.       g.code = 'not-authenticated',
  9469.       g;
  9470.       throw a
  9471.     })) : (g = new Error('No image file to upload'), g.code = 'invalid-content-type', Promise.reject(g))
  9472.   }
  9473. }),
  9474. define('core/views/media/DragDropUploadView', [
  9475.   'underscore',
  9476.   'backbone',
  9477.   'core/utils'
  9478. ], function (a, b, c) {
  9479.   'use strict';
  9480.   var d = c.stopEventHandler,
  9481.   e = b.View.extend({
  9482.     events: {
  9483.       dragover: '_dragOn',
  9484.       dragenter: '_dragOn',
  9485.       dragleave: '_dragOff',
  9486.       dragexit: '_dragOff',
  9487.       drop: '_drop'
  9488.     },
  9489.     _dragOn: d(function () {
  9490.       this.trigger('uploader:dragEnter'),
  9491.       this._toggleDragPlaceholder(!0)
  9492.     }),
  9493.     _dragOff: d(function () {
  9494.       this._toggleDragPlaceholder(!1)
  9495.     }),
  9496.     _drop: d(function (a) {
  9497.       this._toggleDragPlaceholder(!1);
  9498.       var b = a.originalEvent.dataTransfer.files;
  9499.       return b.length ? void this.trigger('uploader:attachMedia', b) : void this.trigger('uploader:dropError', 'No files')
  9500.     }),
  9501.     _toggleDragPlaceholder: a.throttle(function (a) {
  9502.       a ? this.trigger('uploader:showPlaceholder') : this.trigger('uploader:hidePlaceholder')
  9503.     }, 50)
  9504.   });
  9505.   return e
  9506. }),
  9507. define('core/templates/postMediaUploadButton', [
  9508.   'handlebars',
  9509.   'core/templates/handlebars.partials',
  9510.   'core/extensions/handlebars.helpers'
  9511. ], function (a) {
  9512.   return a.template({
  9513.     compiler: [
  9514.       8,
  9515.       '>= 4.3.0'
  9516.     ],
  9517.     main: function (a, b, c, d, e) {
  9518.       return '<a href="#" data-action="attach" class="attach" title="' + a.escapeExpression(c.gettext.call(null != b ? b : a.nullContext || {
  9519.       }, 'Upload Images', {
  9520.         name: 'gettext',
  9521.         hash: {
  9522.         },
  9523.         data: e,
  9524.         loc: {
  9525.           start: {
  9526.             line: 1,
  9527.             column: 55
  9528.           },
  9529.           end: {
  9530.             line: 1,
  9531.             column: 82
  9532.           }
  9533.         }
  9534.       })) + '" tabIndex="0" aria-label="Open file attachment menu">\n<div class="wysiwyg__attach wysiwyg__attach-dims"\nrole="img"\n/>\n</a>\n<input type="file" data-role="media-upload" tabIndex="-1" accept="image/*">\n'
  9535.     },
  9536.     useData: !0
  9537.   })
  9538. }),
  9539. define('core/views/media/UploadButtonView', [
  9540.   'jquery',
  9541.   'underscore',
  9542.   'backbone',
  9543.   'core/templates/postMediaUploadButton',
  9544.   'core/utils'
  9545. ], function (a, b, c, d, e) {
  9546.   'use strict';
  9547.   var f = e.stopEventHandler,
  9548.   g = 'input[type=file][data-role=media-upload]',
  9549.   h = c.View.extend({
  9550.     events: function () {
  9551.       var a = {
  9552.         'click [data-action=attach]': '_attachMedia',
  9553.         'keydown [data-action=attach]': 'keydownHandler'
  9554.       };
  9555.       return a['change ' + g] = '_selectorChange',
  9556.       a
  9557.     }(),
  9558.     initialize: function (a) {
  9559.       this.template = a && a.template || this.generateImageUploadButton
  9560.     },
  9561.     keydownHandler: function (a) {
  9562.       var b = 13,
  9563.       c = 32;
  9564.       a.keyCode !== b && a.keyCode !== c || (a.preventDefault(), this._attachMedia())
  9565.     },
  9566.     generateImageUploadButton: function () {
  9567.       return d({
  9568.         imageUrl: 'https://c.disquscdn.com/next/embed/assets/img/attach.03c320b14aa9c071da30c904d0a0827f.svg'
  9569.       })
  9570.     },
  9571.     render: function () {
  9572.       return this.$el.html(this.template()),
  9573.       this
  9574.     },
  9575.     _attachMedia: f(b.throttle(function () {
  9576.       this.$(g).click()
  9577.     }, 1000, {
  9578.       trailing: !1
  9579.     })),
  9580.     _selectorChange: function (b) {
  9581.       var c = b.target,
  9582.       d = c.files;
  9583.       d.length && (this.trigger('uploader:attachMedia', d), a(c).replaceWith(c.cloneNode()))
  9584.     }
  9585.   });
  9586.   return h
  9587. }),
  9588. define('core/templates/postMediaUploadProgress', [
  9589.   'handlebars',
  9590.   'core/templates/handlebars.partials',
  9591.   'core/extensions/handlebars.helpers'
  9592. ], function (a) {
  9593.   return a.template({
  9594.     1: function (a, b, c, d, e) {
  9595.       return '<li>\n<div class="media-progress-box">\n<div class="media-progress">\n<div class="bar" style="right: ' + a.escapeExpression(a.lambda(null != b ? b.remainingPerc : b, b)) + '%"></div>\n</div>\n</div>\n</li>\n'
  9596.     },
  9597.     compiler: [
  9598.       8,
  9599.       '>= 4.3.0'
  9600.     ],
  9601.     main: function (a, b, c, d, e) {
  9602.       var f;
  9603.       return null != (f = c.each.call(null != b ? b : a.nullContext || {
  9604.       }, null != b ? b.collection : b, {
  9605.         name: 'each',
  9606.         hash: {
  9607.         },
  9608.         fn: a.program(1, e, 0),
  9609.         inverse: a.noop,
  9610.         data: e,
  9611.         loc: {
  9612.           start: {
  9613.             line: 1,
  9614.             column: 0
  9615.           },
  9616.           end: {
  9617.             line: 9,
  9618.             column: 9
  9619.           }
  9620.         }
  9621.       })) ? f : ''
  9622.     },
  9623.     useData: !0
  9624.   })
  9625. }),
  9626. define('core/views/media/UploadsProgressSubView', [
  9627.   'backbone',
  9628.   'core/templates/postMediaUploadProgress'
  9629. ], function (a, b) {
  9630.   'use strict';
  9631.   var c = a.View.extend({
  9632.     initialize: function () {
  9633.       this.collection = new a.Collection,
  9634.       this.listenTo(this.collection, 'add remove change', this.render)
  9635.     },
  9636.     hasVisible: function () {
  9637.       return Boolean(this.collection.length)
  9638.     },
  9639.     render: function () {
  9640.       return this.$el.html(b({
  9641.         collection: this.collection.toJSON()
  9642.       })),
  9643.       this
  9644.     }
  9645.   });
  9646.   return c
  9647. }),
  9648. define('core/templates/postMediaUploadRich', [
  9649.   'handlebars',
  9650.   'core/templates/handlebars.partials',
  9651.   'core/extensions/handlebars.helpers'
  9652. ], function (a) {
  9653.   return a.template({
  9654.     1: function (a, b, c, d, e) {
  9655.       return '<video src="' + a.escapeExpression(a.lambda(null != b ? b.thumbnailUrl : b, b)) + '" autoplay muted loop></video>\n'
  9656.     },
  9657.     3: function (a, b, c, d, e) {
  9658.       var f;
  9659.       return '<img src="' + a.escapeExpression(a.lambda(null != b ? b.thumbnailUrl : b, b)) + '" alt="' + (null != (f = c['if'].call(null != b ? b : a.nullContext || {
  9660.       }, null != (f = null != b ? b.media : b) ? f.title : f, {
  9661.         name: 'if',
  9662.         hash: {
  9663.         },
  9664.         fn: a.program(4, e, 0),
  9665.         inverse: a.program(6, e, 0),
  9666.         data: e,
  9667.         loc: {
  9668.           start: {
  9669.             line: 9,
  9670.             column: 33
  9671.           },
  9672.           end: {
  9673.             line: 9,
  9674.             column: 112
  9675.           }
  9676.         }
  9677.       })) ? f : '') + '">\n'
  9678.     },
  9679.     4: function (a, b, c, d, e) {
  9680.       var f;
  9681.       return a.escapeExpression(a.lambda(null != (f = null != b ? b.media : b) ? f.title : f, b))
  9682.     },
  9683.     6: function (a, b, c, d, e) {
  9684.       return a.escapeExpression(c.gettext.call(null != b ? b : a.nullContext || {
  9685.       }, 'Media attachment', {
  9686.         name: 'gettext',
  9687.         hash: {
  9688.         },
  9689.         data: e,
  9690.         loc: {
  9691.           start: {
  9692.             line: 9,
  9693.             column: 75
  9694.           },
  9695.           end: {
  9696.             line: 9,
  9697.             column: 105
  9698.           }
  9699.         }
  9700.       }))
  9701.     },
  9702.     compiler: [
  9703.       8,
  9704.       '>= 4.3.0'
  9705.     ],
  9706.     main: function (a, b, c, d, e) {
  9707.       var f;
  9708.       return '<li class="publisher-border-color">\n<div class="media-box">\n<div class="media-ct">\n<div class="media-surface">\n<a href="' + a.escapeExpression(a.lambda(null != (f = null != b ? b.media : b) ? f.url : f, b)) + '" target="_blank">\n' + (null != (f = c['if'].call(null != b ? b : a.nullContext || {
  9709.       }, null != b ? b.isVideo : b, {
  9710.         name: 'if',
  9711.         hash: {
  9712.         },
  9713.         fn: a.program(1, e, 0),
  9714.         inverse: a.program(3, e, 0),
  9715.         data: e,
  9716.         loc: {
  9717.           start: {
  9718.             line: 6,
  9719.             column: 0
  9720.           },
  9721.           end: {
  9722.             line: 10,
  9723.             column: 7
  9724.           }
  9725.         }
  9726.       })) ? f : '') + '</a>\n</div>\n</div>\n</div>\n</li>\n'
  9727.     },
  9728.     useData: !0
  9729.   })
  9730. }),
  9731. define('core/views/media/UploadsRichSubView', [
  9732.   'underscore',
  9733.   'backbone',
  9734.   'core/models/Media',
  9735.   'core/UniqueModel',
  9736.   'core/utils',
  9737.   'core/templates/postMediaUploadRich'
  9738. ], function (a, b, c, d, e, f) {
  9739.   'use strict';
  9740.   var g = b.View.extend({
  9741.     initialize: function () {
  9742.       this._hasVisible = !1,
  9743.       this.collection = new b.Collection([], {
  9744.         model: c,
  9745.         comparator: 'index'
  9746.       }),
  9747.       this.listenTo(this.collection, 'add remove reset sort change:thumbnailUrl change:mediaType change:editsFinished', this.render),
  9748.       this.listenTo(this.collection, 'change:index', a.bind(this.collection.sort, this.collection))
  9749.     },
  9750.     render: function () {
  9751.       return this.$el.empty(),
  9752.       this._hasVisible = !1,
  9753.       this.collection.each(function (b) {
  9754.         b.get('thumbnailUrl') && (a.contains(c.WEBPAGE_TYPES, b.get('mediaType')) || b.get('editsFinished') && (this.$el.append(f({
  9755.           media: b.toJSON(),
  9756.           isVideo: this.isVideo(b),
  9757.           thumbnailUrl: b.get('thumbnailUrl')
  9758.         })), this._hasVisible = !0))
  9759.       }, this),
  9760.       this
  9761.     },
  9762.     isVideo: function (a) {
  9763.       return a.get('mediaType') === c.MEDIA_TYPES.MP4_VIDEO
  9764.     },
  9765.     hasVisible: function () {
  9766.       return this._hasVisible
  9767.     },
  9768.     addMedia: function (a, b) {
  9769.       var e = d.get(c, a.url);
  9770.       if (e) e.set(a);
  9771.        else {
  9772.         if (!a.editsFinished) return;
  9773.         e = new d(c, a),
  9774.         e.fetch(b)
  9775.       }
  9776.       return this.collection.add(e),
  9777.       e
  9778.     },
  9779.     updateFromText: function (b, c, d) {
  9780.       if (!b) return void this.collection.reset();
  9781.       var f = e.bleachFindUrls(b);
  9782.       f = a.uniq(f, !1, function (a) {
  9783.         return a.url
  9784.       });
  9785.       var g = {
  9786.       };
  9787.       a.each(f, function (e) {
  9788.         g[e.url] = !0;
  9789.         var f = a.pick(e, 'index', 'url'),
  9790.         h = e.index < c && c <= e.endIndex || '.' === b[e.endIndex];
  9791.         h && !d.isPasteEvent || (f.editsFinished = !0),
  9792.         this.addMedia(f, d)
  9793.       }, this);
  9794.       var h = this.collection.pluck('url');
  9795.       g = a.keys(g);
  9796.       var i = a.difference(h, g);
  9797.       this.collection.remove(this.collection.filter(function (b) {
  9798.         return a.contains(i, b.get('url'))
  9799.       }))
  9800.     }
  9801.   });
  9802.   return g
  9803. }),
  9804. define('core/templates/postMediaUploads', [
  9805.   'handlebars',
  9806.   'core/templates/handlebars.partials',
  9807.   'core/extensions/handlebars.helpers'
  9808. ], function (a) {
  9809.   return a.template({
  9810.     compiler: [
  9811.       8,
  9812.       '>= 4.3.0'
  9813.     ],
  9814.     main: function (a, b, c, d, e) {
  9815.       return '<ul data-role="media-progress-list"></ul>\n<ul data-role="media-rich-list"></ul>\n<div class="media-expanded empty" data-role="media-preview-expanded">\n<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="\ndata-role="media-preview-expanded-image" alt="' + a.escapeExpression(c.gettext.call(null != b ? b : a.nullContext || {
  9816.       }, 'Media preview placeholder', {
  9817.         name: 'gettext',
  9818.         hash: {
  9819.         },
  9820.         data: e,
  9821.         loc: {
  9822.           start: {
  9823.             line: 6,
  9824.             column: 46
  9825.           },
  9826.           end: {
  9827.             line: 6,
  9828.             column: 85
  9829.           }
  9830.         }
  9831.       })) + '">\n</div>\n'
  9832.     },
  9833.     useData: !0
  9834.   })
  9835. }),
  9836. define('core/views/media/UploadsView', [
  9837.   'backbone',
  9838.   'core/views/media/UploadsProgressSubView',
  9839.   'core/views/media/UploadsRichSubView',
  9840.   'core/templates/postMediaUploads'
  9841. ], function (a, b, c, d) {
  9842.   'use strict';
  9843.   var e = a.View.extend({
  9844.     initialize: function () {
  9845.       this.richView = new c,
  9846.       this.rich = this.richView.collection,
  9847.       this.uploadProgressView = new b,
  9848.       this.uploadProgress = this.uploadProgressView.collection,
  9849.       this.listenTo(this.rich, 'all', this._updateEmpty),
  9850.       this.listenTo(this.uploadProgress, 'all', this._updateEmpty)
  9851.     },
  9852.     render: function () {
  9853.       return this.richView.$el.detach(),
  9854.       this.uploadProgressView.$el.detach(),
  9855.       this.$el.html(d()),
  9856.       this._updateEmpty(),
  9857.       this.richView.setElement(this.$('[data-role=media-rich-list]') [0]),
  9858.       this.uploadProgressView.setElement(this.$('[data-role=media-progress-list]') [0]),
  9859.       this
  9860.     },
  9861.     clear: function () {
  9862.       this.rich.reset(),
  9863.       this.uploadProgress.reset()
  9864.     },
  9865.     _updateEmpty: function () {
  9866.       this.richView.hasVisible() || this.uploadProgressView.hasVisible() ? this.$el.removeClass('empty') : this.$el.addClass('empty')
  9867.     }
  9868.   });
  9869.   return e
  9870. }),
  9871. define('core/mixins/withUploadForm', [
  9872.   'underscore',
  9873.   'backbone',
  9874.   'core/strings',
  9875.   'core/utils',
  9876.   'core/utils/media/upload',
  9877.   'core/utils/storage',
  9878.   'core/views/media/DragDropUploadView',
  9879.   'core/views/media/UploadButtonView',
  9880.   'core/views/media/UploadsView'
  9881. ], function (a, b, c, d, e, f, g, h, i) {
  9882.   'use strict';
  9883.   var j = c.get,
  9884.   k = function () {
  9885.     a.defaults(this, k.bothProto, k.uploadsProto, k.previewsProto)
  9886.   },
  9887.   l = {
  9888.     'invalid-image-file': j('Unfortunately your image upload failed. Please verify that the file is valid and in a supported format (JPEG, PNG, or GIF).'),
  9889.     'invalid-content-type': j('Unfortunately your image upload failed. Please verify that the file is in a supported format (JPEG, PNG, or GIF).'),
  9890.     'file-too-large': j('Unfortunately your image upload failed. Please verify that your image is under 5MB.'),
  9891.     'not-authenticated': j('You must be logged in to upload an image.')
  9892.   },
  9893.   m = j('Unfortunately your image upload failed. Please verify that your image is in a supported format (JPEG, PNG, or GIF) and under 5MB. If you continue seeing this error, please try again later.');
  9894.   return k.previewsProto = {
  9895.     initMediaPreviews: function (b, c) {
  9896.       this.mediaUploadsView = new i({
  9897.         el: b[0]
  9898.       }),
  9899.       this.mediaUploadsView.render(),
  9900.       this.updateLiveMediaDebounced = a.partial(a.debounce(this.updateLiveMedia, 500), c, !1),
  9901.       this.stopListening(c, 'keychange'),
  9902.       this.stopListening(c, 'paste'),
  9903.       this.listenTo(c, {
  9904.         keychange: this.updateLiveMediaDebounced,
  9905.         paste: function (b, d) {
  9906.           d && d.fake || a.defer(a.bind(this.updateLiveMedia, this, c, !0))
  9907.         }
  9908.       }),
  9909.       this.updateLiveMedia(c, !0)
  9910.     },
  9911.     clearMediaPreviews: function () {
  9912.       this.mediaUploadsView && this.mediaUploadsView.clear()
  9913.     },
  9914.     updateLiveMedia: function (a, b) {
  9915.       if (this.mediaUploadsView) {
  9916.         var c = a.get(),
  9917.         d = a.offset();
  9918.         this.mediaUploadsView.richView.updateFromText(c, d, {
  9919.           isPasteEvent: b,
  9920.           forum: this.thread.forum.id
  9921.         })
  9922.       }
  9923.     }
  9924.   },
  9925.   k.uploadsProto = {
  9926.     initMediaUploads: function (a, b, c) {
  9927.       this.mediaDragDropView && this.stopListening(this.mediaDragDropView),
  9928.       this.mediaDragDropView = new g({
  9929.         el: b[0]
  9930.       }),
  9931.       this.listenTo(this.mediaDragDropView, {
  9932.         'uploader:attachMedia': function () {
  9933.           f.set('usedDragDrop', 1),
  9934.           this.handleAttachMedia.apply(this, arguments)
  9935.         },
  9936.         'uploader:dragEnter': function () {
  9937.           this.$el.addClass('expanded')
  9938.         },
  9939.         'uploader:showPlaceholder': function () {
  9940.           a.show()
  9941.         },
  9942.         'uploader:hidePlaceholder': function () {
  9943.           a.hide()
  9944.         },
  9945.         'uploader:dropError': function () {
  9946.           var a = j('Sorry we didn\'t catch that. Try again?');
  9947.           this.alert(a, {
  9948.             type: 'error',
  9949.             isUploadError: !0
  9950.           })
  9951.         }
  9952.       }),
  9953.       this.mediaUploadButtonView && this.stopListening(this.mediaUploadButtonView),
  9954.       this.mediaUploadButtonView = new h({
  9955.         el: c[0]
  9956.       }),
  9957.       this.listenTo(this.mediaUploadButtonView, {
  9958.         'uploader:attachMedia': this.handleUploadViaButton
  9959.       }),
  9960.       this.mediaUploadButtonView.render()
  9961.     },
  9962.     handleUploadViaButton: function (a) {
  9963.       if (a && f.isPersistent && !f.get('usedDragDrop') && !d.isMobileUserAgent()) {
  9964.         var b = this.alert(j('Did you know you can drag and drop images too? Try it now!'));
  9965.         this.listenToOnce(b, 'dismiss', function () {
  9966.           f.set('usedDragDrop', 1)
  9967.         })
  9968.       }
  9969.       this.handleAttachMedia.apply(this, arguments)
  9970.     },
  9971.     handleAttachMedia: function (c, d) {
  9972.       var f = this,
  9973.       g = new b.Model({
  9974.         remainingPerc: 100
  9975.       });
  9976.       f.mediaUploadsView.uploadProgress.add(g),
  9977.       d = a.extend(d || {
  9978.       }, {
  9979.         onProgress: function (a) {
  9980.           g.set('remainingPerc', 100 - a)
  9981.         }
  9982.       });
  9983.       var h = function () {
  9984.         f.mediaUploadsView.uploadProgress.remove(g)
  9985.       };
  9986.       e.uploadMediaUrl(c, d).then(function (a) {
  9987.         a.fetch({
  9988.           forum: f.thread.forum.id
  9989.         }),
  9990.         f.textarea.insertAtCursor(a.get('url')),
  9991.         f.updateLiveMedia(f.textarea, !0),
  9992.         f.dismissUploadError()
  9993.       }) ['catch'](function (a) {
  9994.         var b;
  9995.         a && a.code && (b = l[a.code]),
  9996.         b || (b = m),
  9997.         f.alert(b, {
  9998.           type: 'error',
  9999.           isUploadError: !0
  10000.         })
  10001.       }).then(h, h)
  10002.     },
  10003.     dismissUploadError: function () {
  10004.       this.dismissAlert(function (a) {
  10005.         return a.options && a.options.isUploadError
  10006.       })
  10007.     },
  10008.     uploadSupported: e.uploadSupported,
  10009.     isUploadInProgress: function () {
  10010.       return this.mediaUploadsView && this.mediaUploadsView.uploadProgress.length
  10011.     }
  10012.   },
  10013.   k.bothProto = {
  10014.     initMediaViews: function (a) {
  10015.       (a.mediaembedEnabled || a.gifPickerEnabled) && this.initMediaPreviews(this.$('[data-role=media-preview]'), a.textarea),
  10016.       a.allowUploads && this.initMediaUploads(this.$('[data-role=drag-drop-placeholder]'), this.$('[data-role=textarea]'), this.$('[data-role=media-uploader]'))
  10017.     }
  10018.   },
  10019.   k
  10020. }),
  10021. define('core/editable', [
  10022. ], function () {
  10023.   'use strict';
  10024.   function a(a) {
  10025.     return a.replace(e, ' ')
  10026.   }
  10027.   function b(c, d, e) {
  10028.     var f,
  10029.     h,
  10030.     i,
  10031.     j,
  10032.     k = '',
  10033.     l = [
  10034.     ];
  10035.     for ('string' != typeof e && (e = '\n\n'), j = 0; j < c.length; ++j) h = c[j],
  10036.     f = h.nodeName.toLowerCase(),
  10037.     1 === h.nodeType ? (i = d && d(h), i ? k += i : g.hasOwnProperty(f) ? (k && l.push(k), k = b(h.childNodes, d, e)) : k += 'br' === f ? '\n' : b(h.childNodes, d, e)) : 3 === h.nodeType && (k += a(h.nodeValue));
  10038.     return l.push(k),
  10039.     l.join(e)
  10040.   }
  10041.   var c = window.document,
  10042.   d = 'character',
  10043.   e = new RegExp(String.fromCharCode(160), 'gi'),
  10044.   f = 'h1 h2 h3 h4 h5 h6 p pre blockquote address ul ol dir menu li dl div form'.split(' '),
  10045.   g = {
  10046.   },
  10047.   h = 0;
  10048.   for (h = 0; h < f.length; h++) g[f[h]] = !0;
  10049.   var i = function (a, b, c) {
  10050.     var d = this;
  10051.     if (!a || !a.contentEditable) throw new Error('First argument must be contentEditable');
  10052.     this.elem = a,
  10053.     this.emulateTextarea = a.getAttribute('plaintext-only') || b,
  10054.     this.emulateTextarea && (this.pasteHandler = function (a) {
  10055.       var b = a && a.clipboardData || window.clipboardData;
  10056.       b && !b.getData('text') && (a.preventDefault(), a.stopPropagation());
  10057.       var c = d.plainTextReformat,
  10058.       e = function () {
  10059.         c.timeout = null,
  10060.         c.call(d)
  10061.       };
  10062.       c.timeout && clearTimeout(c.timeout),
  10063.       c.timeout = setTimeout(e, 0)
  10064.     }, a.addEventListener('paste', this.pasteHandler));
  10065.     for (var e in c) c.hasOwnProperty(e) && (this[e] = c[e])
  10066.   };
  10067.   return i.prototype = {
  10068.     insertHTML: function (a) {
  10069.       if (c.all) {
  10070.         var b = c.selection.createRange();
  10071.         return b.pasteHTML(a),
  10072.         b.collapse(!1),
  10073.         b.select()
  10074.       }
  10075.       return c.execCommand('insertHTML', !1, a)
  10076.     },
  10077.     insertNode: function (a) {
  10078.       var b,
  10079.       d,
  10080.       e;
  10081.       window.getSelection ? (b = window.getSelection(), b.getRangeAt && b.rangeCount && (d = b.getRangeAt(0), d.deleteContents(), d.insertNode(a), d.collapse(!1), b.removeAllRanges(), b.addRange(d))) : c.selection && c.selection.createRange && (d = c.selection.createRange(), e = 3 === a.nodeType ? a.data : a.outerHTML, d.pasteHTML(e), d.collapse(!1))
  10082.     },
  10083.     getTextNodes: function (a) {
  10084.       var b = this.elem;
  10085.       a && a.nodeType ? a = [
  10086.         a
  10087.       ] : a || (a = b.childNodes);
  10088.       for (var c, d = [
  10089.       ], e = 0; e < a.length; ++e) if (c = a[e]) switch (c.nodeType) {
  10090.         case 1:
  10091.           d = d.concat(this.getTextNodes(c.childNodes));
  10092.           break;
  10093.         case 3:
  10094.           /^\n\s+/.test(c.nodeValue) || d.push(c)
  10095.       }
  10096.       return d
  10097.     },
  10098.     text: function (a) {
  10099.       var c,
  10100.       d,
  10101.       e,
  10102.       f = this.elem;
  10103.       try {
  10104.         d = Array.prototype.slice.call(f.childNodes)
  10105.       } catch (g) {
  10106.         for (d = [
  10107.         ], e = 0; e < f.childNodes.length; ++e) d.push(f.childNodes[e])
  10108.       }
  10109.       return c = b(d, a, this.emulateTextarea && '\n'),
  10110.       c.replace(/^\s+|\s+$/g, '')
  10111.     },
  10112.     setText: function (a) {
  10113.       a = a || '';
  10114.       var b,
  10115.       d,
  10116.       e,
  10117.       f = c.createDocumentFragment(),
  10118.       g = [
  10119.         a
  10120.       ],
  10121.       h = g && g.length;
  10122.       for (b = 0; b < h; b++) d = g[b],
  10123.       e = this.createParagraph(d),
  10124.       f.appendChild(e);
  10125.       if (f.lastChild.appendChild(c.createElement('br')), this.elem.innerHTML = '', this.elem.appendChild(f), 'WebkitAppearance' in c.documentElement.style && window.navigator.userAgent.indexOf('Firefox') === - 1 && window.navigator.userAgent.indexOf('MSIE') === - 1) {
  10126.         var i = window.getSelection && window.getSelection();
  10127.         i && i.anchorNode === this.elem && i.modify && i.modify('move', 'forward', 'line')
  10128.       }
  10129.     },
  10130.     createParagraph: function (a) {
  10131.       var b,
  10132.       d,
  10133.       e,
  10134.       f,
  10135.       g,
  10136.       h,
  10137.       i,
  10138.       j = c.createElement('p');
  10139.       for (e = a.split(/\r\n|\r|\n/), d = 0, g = e.length; d < g; d++) {
  10140.         for (f = e[d], i = this.getHtmlElements(f), b = 0, h = i.length; b < h; b++) j.appendChild(i[b]);
  10141.         j.appendChild(c.createElement('br'))
  10142.       }
  10143.       return j.lastChild && j.removeChild(j.lastChild),
  10144.       j
  10145.     },
  10146.     getHtmlElements: function (a) {
  10147.       return [c.createTextNode(a)]
  10148.     },
  10149.     plainTextReformat: function () {
  10150.       if (!(this.elem.getElementsByTagName('p').length <= 1)) {
  10151.         this.emulateTextarea = !1;
  10152.         var a = this.text();
  10153.         this.emulateTextarea = !0,
  10154.         this.setText(a)
  10155.       }
  10156.     },
  10157.     removeNode: function (a) {
  10158.       var b,
  10159.       d,
  10160.       e;
  10161.       window.getSelection ? (b = a.previousSibling, a.parentNode.removeChild(a), d = window.getSelection(), e = c.createRange(), b && (e.setStart(b, b.length), e.setEnd(b, b.length)), d.addRange(e)) : a.parentNode.removeChild(a)
  10162.     },
  10163.     selectedTextNode: function () {
  10164.       var b,
  10165.       e,
  10166.       f,
  10167.       g,
  10168.       h,
  10169.       i,
  10170.       j,
  10171.       k,
  10172.       l,
  10173.       m = this.elem;
  10174.       if (window.getSelection) return b = window.getSelection(),
  10175.       b.anchorNode;
  10176.       if (c.selection.createRange) {
  10177.         for (e = c.selection.createRange().duplicate(); e.moveStart(d, - 1000) === - 1000; );
  10178.         var n = e.text;
  10179.         for (k = 0; k < m.childNodes.length; ++k) for (f = m.childNodes[k], h = this.getTextNodes(f), l = 0; l < h.length; ++l) if (g = h[l], j = a(g.nodeValue), n.indexOf(j) > - 1) i = g,
  10180.         n = n.replace(j, '');
  10181.          else if (j.indexOf(n) > - 1) return g;
  10182.         return i
  10183.       }
  10184.     },
  10185.     selectedTextNodeOffset: function (b) {
  10186.       var e,
  10187.       f,
  10188.       g;
  10189.       if (window.getSelection) {
  10190.         var h = window.getSelection();
  10191.         h && h.anchorOffset && (g = h.anchorOffset)
  10192.       } else if (b && c.selection.createRange) {
  10193.         var i = a(b.nodeValue);
  10194.         e = c.selection.createRange();
  10195.         var j = e.duplicate(),
  10196.         k = j.parentElement();
  10197.         for (f = 0; 0 !== e.moveStart(d, - 1) && (0 !== i.indexOf(a(e.text)) && k === e.parentElement()); f++) j = e.duplicate(),
  10198.         k = j.parentElement();
  10199.         g = f
  10200.       }
  10201.       return isNaN(g) ? 0 : g
  10202.     },
  10203.     offset: function () {
  10204.       function b(d, e) {
  10205.         function f(a) {
  10206.           i += a[0];
  10207.           for (var b = 1; b < a.length; ++b) h.push(i),
  10208.           i = a[b]
  10209.         }
  10210.         'string' != typeof e && (e = '\n\n');
  10211.         for (var h = [
  10212.         ], i = '', j = 0; j < d.length; ++j) {
  10213.           var k = d[j],
  10214.           l = k.nodeName.toLowerCase();
  10215.           1 === k.nodeType ? g.hasOwnProperty(l) ? (i && (i += e), f(b(k.childNodes, e))) : 'br' === l ? i += '\n' : f(b(k.childNodes, e)) : 3 === k.nodeType && (k === c.anchorNode ? (i += a(k.nodeValue.slice(0, c.anchorOffset)), h.push(i), i = a(k.nodeValue.slice(c.anchorOffset))) : i += a(k.nodeValue))
  10216.         }
  10217.         return h.push(i),
  10218.         h
  10219.       }
  10220.       var c = window.getSelection();
  10221.       if (!c || !c.anchorNode || 3 !== c.anchorNode.nodeType) return 0;
  10222.       var d,
  10223.       e = this.elem;
  10224.       try {
  10225.         d = Array.prototype.slice.call(e.childNodes)
  10226.       } catch (f) {
  10227.         d = [
  10228.         ];
  10229.         for (var h = 0; h < e.childNodes.length; ++h) d.push(e.childNodes[h])
  10230.       }
  10231.       var i = b(d, this.emulateTextarea && '\n');
  10232.       if (1 === i.length) return 0;
  10233.       var j = i[0].length,
  10234.       k = i.join(''),
  10235.       l = k.match(/\s+$/);
  10236.       if (l) {
  10237.         var m = l[0].length;
  10238.         j = Math.min(j, k.length - m)
  10239.       }
  10240.       var n = k.match(/^\s+/);
  10241.       if (n) {
  10242.         var o = n[0].length;
  10243.         j -= o
  10244.       }
  10245.       return j
  10246.     },
  10247.     selectNodeText: function (b, e, f) {
  10248.       var g,
  10249.       h,
  10250.       i = this.elem;
  10251.       if (window.getSelection) return g = window.getSelection(),
  10252.       g.removeAllRanges(),
  10253.       h = c.createRange(),
  10254.       h.setStart(b, e),
  10255.       h.setEnd(b, f),
  10256.       g.addRange(h),
  10257.       g;
  10258.       if (c.selection.createRange) {
  10259.         h = c.selection.createRange();
  10260.         var j = a(b.nodeValue);
  10261.         if ('body' === h.parentElement().nodeName.toLowerCase()) {
  10262.           for (i.focus(), h = c.selection.createRange(); h.moveStart(d, - 1000) === - 1000; );
  10263.           for (; 1000 === h.moveEnd(d, 1000); );
  10264.           var k = a(h.text),
  10265.           l = k.indexOf(j);
  10266.           l > 0 && h.moveStart(d, l + 2),
  10267.           h.collapse()
  10268.         }
  10269.         for (; h.moveStart(d, - 1) === - 1 && 0 !== j.indexOf(a(h.text)); );
  10270.         for (; 1 === h.moveEnd(d, 1) && j !== a(h.text); );
  10271.         return h.moveStart(d, e),
  10272.         h.moveEnd(d, - 1 * (f - e - h.text.length)),
  10273.         h.select(),
  10274.         h
  10275.       }
  10276.     }
  10277.   },
  10278.   i.normalizeSpace = a,
  10279.   i
  10280. }),
  10281. define('core/utils/html/nodeTypes', [
  10282. ], function () {
  10283.   'use strict';
  10284.   var a = function (a) {
  10285.     return 'p' === a.nodeName.toLowerCase()
  10286.   },
  10287.   b = function (a) {
  10288.     return 'div' === a.nodeName.toLowerCase()
  10289.   },
  10290.   c = function (a) {
  10291.     return '#text' === a.nodeName.toLowerCase()
  10292.   },
  10293.   d = function (a) {
  10294.     return 'br' === a.nodeName.toLowerCase()
  10295.   },
  10296.   e = function (a) {
  10297.     return 'button' === a.nodeName.toLowerCase()
  10298.   },
  10299.   f = function (a) {
  10300.     return 'br' === a.nodeName.toLowerCase() || '#text' === a.nodeName.toLowerCase() && '\n' === a.nodeValue
  10301.   },
  10302.   g = function (a) {
  10303.     return 'p' === a.nodeName.toLowerCase() || 'div' === a.nodeName.toLowerCase()
  10304.   },
  10305.   h = function (a) {
  10306.     return 'span' === a.nodeName.toLowerCase()
  10307.   };
  10308.   return {
  10309.     isP: a,
  10310.     isDiv: b,
  10311.     isText: c,
  10312.     isBr: d,
  10313.     isButton: e,
  10314.     isNewline: f,
  10315.     isPorDiv: g,
  10316.     isSpan: h
  10317.   }
  10318. }),
  10319. define('core/CappedStorage', [
  10320.   'core/utils/storage'
  10321. ], function (a) {
  10322.   'use strict';
  10323.   var b = function (a, b) {
  10324.     this.max = a || 10,
  10325.     this.queueKey = b || '__queue',
  10326.     this.getQueue() || this.setQueue([])
  10327.   };
  10328.   return b.prototype.set = function (b, c) {
  10329.     var d = this.getQueue() || this.setQueue([]);
  10330.     d.length === this.max && a.remove(d.shift()),
  10331.     a.set(b, c),
  10332.     d.push(b),
  10333.     this.setQueue(d)
  10334.   },
  10335.   b.prototype.get = function (b) {
  10336.     return a.get(b)
  10337.   },
  10338.   b.prototype.remove = function (b) {
  10339.     a.remove(b);
  10340.     for (var c = this.getQueue() || [
  10341.     ], d = 0; d < c.length; d++) if (c[d] === b) {
  10342.       c.splice(d, 1);
  10343.       break
  10344.     }
  10345.     this.setQueue(c)
  10346.   },
  10347.   b.prototype.clear = function () {
  10348.     a.clear(),
  10349.     this.setQueue([])
  10350.   },
  10351.   b.prototype.getQueue = function () {
  10352.     return a.get(this.queueKey)
  10353.   },
  10354.   b.prototype.setQueue = function (b) {
  10355.     return a.set(this.queueKey, b),
  10356.     b
  10357.   },
  10358.   b
  10359. }),
  10360. define('core/extensions/jquery.autoresize', [
  10361.   'jquery',
  10362.   'underscore'
  10363. ], function (a, b) {
  10364.   'use strict';
  10365.   return a.fn.autoresize = function (c) {
  10366.     var d = b.extend({
  10367.       extraSpace: 0,
  10368.       maxHeight: 1000
  10369.     }, c);
  10370.     return this.each(function () {
  10371.       var c = a(this).css({
  10372.         resize: 'none',
  10373.         overflow: 'hidden'
  10374.       }),
  10375.       e = 'true' === String(c[0].contentEditable) ? 'html' : 'val',
  10376.       f = 'html' === e ? '<br>' : '\n',
  10377.       g = c.height(),
  10378.       h = function () {
  10379.         var d = {
  10380.         };
  10381.         b.each(d, function (a, b) {
  10382.           d[b] = c.css(b)
  10383.         });
  10384.         var e = a(c[0].cloneNode(!0));
  10385.         return e.removeAttr('id').removeAttr('name').css({
  10386.           visibility: 'hidden',
  10387.           position: 'absolute',
  10388.           top: '-9999px',
  10389.           left: '-9999px',
  10390.           contentEditable: !1
  10391.         }).css(d).attr('tabIndex', '-1'),
  10392.         e.insertAfter(c[0]),
  10393.         e
  10394.       }(),
  10395.       i = null,
  10396.       j = function () {
  10397.         h[0].style.height = 0,
  10398.         h[e](c[e]() + f),
  10399.         h.scrollTop(h[0].scrollHeight);
  10400.         var a = Math.max(h[0].scrollHeight, g) + parseInt(d.extraSpace, 10);
  10401.         d.maxHeight && (a >= d.maxHeight ? (c.css('overflow', ''), a = d.maxHeight) : c.css('overflow', 'hidden')),
  10402.         i !== a && (i = a, c.height(a), c.trigger && c.trigger('resize'))
  10403.       },
  10404.       k = b.throttle(j, 500),
  10405.       l = function (a) {
  10406.         13 === a.keyCode ? j() : k()
  10407.       };
  10408.       c.bind('keyup', l).bind('paste', j).css('overflow', 'hidden'),
  10409.       j()
  10410.     })
  10411.   },
  10412.   a
  10413. }),
  10414. define('core/views/TextareaView', [
  10415.   'underscore',
  10416.   'jquery',
  10417.   'backbone',
  10418.   'core/utils',
  10419.   'core/utils/html/nodeTypes',
  10420.   'core/CappedStorage',
  10421.   'core/extensions/jquery.autoresize'
  10422. ], function (a, b, c, d, e, f) {
  10423.   'use strict';
  10424.   var g = c.View.extend({
  10425.     events: {
  10426.       'keydown  [data-role=editable]': 'handleKeyDown',
  10427.       'keyup    [data-role=editable]': 'handleKeyUp',
  10428.       'paste    [data-role=editable]': 'handlePaste',
  10429.       'focusin  [data-role=editable]': 'handleFocusIn',
  10430.       'blur     [data-role=editable]': 'handleBlur'
  10431.     },
  10432.     initialize: function (b) {
  10433.       b = b || {
  10434.       },
  10435.       this.storageKey = b.storageKey,
  10436.       this.value = b.value || this.getDraft() [0],
  10437.       this.history = [
  10438.         this.value
  10439.       ],
  10440.       this.historyPosition = 0,
  10441.       this.placeholder = b.placeholder,
  10442.       this.selectionIndices = {
  10443.         start: 0,
  10444.         end: 0,
  10445.         endElemInd: 0,
  10446.         endElemSelectionInd: 0,
  10447.         startElemInd: 0,
  10448.         startElemSelectionInd: 0
  10449.       },
  10450.       this.inputFixed = !1,
  10451.       this.listenTo(this, 'keychange', a.debounce(this.saveDraft, this.constructor.SAVE_DRAFT_INTERVAL))
  10452.     },
  10453.     render: function () {
  10454.       return this.$input = this.createInput(),
  10455.       this.set(this.value),
  10456.       this.$el.append(this.$input),
  10457.       this.$input.autoresize({
  10458.         maxHeight: this.constructor.MAX_TEXTAREA_HEIGHT
  10459.       }),
  10460.       this
  10461.     },
  10462.     createInput: function () {
  10463.       return b('<textarea>').attr({
  10464.         'class': 'textarea',
  10465.         placeholder: this.placeholder,
  10466.         'data-role': 'editable'
  10467.       })
  10468.     },
  10469.     resize: function () {
  10470.       this.$input.trigger('paste', {
  10471.         fake: !0
  10472.       })
  10473.     },
  10474.     get: function () {
  10475.       return this.$input.val().replace(/^\s+|\s+$/g, '')
  10476.     },
  10477.     getSelected: function () {
  10478.       var a = this.$input[0];
  10479.       return 'number' == typeof a.selectionStart ? this.$input.val().substring(a.selectionStart, a.selectionEnd) : ''
  10480.     },
  10481.     offset: function () {
  10482.       var a = this.$input[0],
  10483.       b = this.$input.val(),
  10484.       c = 'number' == typeof a.selectionStart ? a.selectionStart : 0,
  10485.       d = b.match(/\s+$/);
  10486.       if (d) {
  10487.         var e = d[0].length;
  10488.         c = Math.min(c, b.length - e)
  10489.       }
  10490.       var f = b.match(/^\s+/);
  10491.       if (f) {
  10492.         var g = f[0].length;
  10493.         c = Math.max(c - g, 0)
  10494.       }
  10495.       return c
  10496.     },
  10497.     insertAtCursor: function (a) {
  10498.       this.focus();
  10499.       var b = this.get(),
  10500.       c = this.offset(),
  10501.       e = d.insertWithWhitespace(b, c, a),
  10502.       f = this.$input[0];
  10503.       if (this.set(e), f.setSelectionRange) {
  10504.         var g = e.indexOf(a, c) + a.length + 1;
  10505.         f.setSelectionRange(g, g)
  10506.       }
  10507.     },
  10508.     insertAroundSelection: function (a, b) {
  10509.       this.focus();
  10510.       var c,
  10511.       d,
  10512.       e = this.$input[0];
  10513.       'number' == typeof e.selectionStart ? (c = e.selectionStart, d = e.selectionEnd) : c = d = 0;
  10514.       var f = this.get(),
  10515.       g = f.substring(0, c) + a + f.substring(c, d) + b + f.substring(d);
  10516.       this.set(g),
  10517.       e.setSelectionRange && e.setSelectionRange(c + a.length, d + a.length)
  10518.     },
  10519.     set: function (a) {
  10520.       this.$input.val(a)
  10521.     },
  10522.     clear: function () {
  10523.       this.set('')
  10524.     },
  10525.     focus: function () {
  10526.       this.$input.focus()
  10527.     },
  10528.     handleKeyDown: function (a) {
  10529.       this.trigger('keydown', a)
  10530.     },
  10531.     handleKeyUp: function (a) {
  10532.       this.trigger('keychange', a)
  10533.     },
  10534.     handlePaste: function (a, b) {
  10535.       b = b || {
  10536.       },
  10537.       this.trigger(b.fake ? 'paste' : 'paste keychange'),
  10538.       this.$input.trigger('resize')
  10539.     },
  10540.     handleFocusIn: function () {
  10541.       this.fixInputStructure(),
  10542.       this.trigger('focus')
  10543.     },
  10544.     handleBlur: function () {
  10545.       this.trigger('blur')
  10546.     },
  10547.     saveDraft: function () {
  10548.       if (this.storageKey) return b.trim(this.get()) ? void this.constructor.storage.set(this.storageKey, this.toJSON()) : void this.removeDraft()
  10549.     },
  10550.     toJSON: function () {
  10551.       return [this.get(),
  10552.       b.now()]
  10553.     },
  10554.     getDraft: function () {
  10555.       var a = [
  10556.         ''
  10557.       ];
  10558.       if (!this.storageKey) return a;
  10559.       var c = this.constructor.storage.get(this.storageKey);
  10560.       if (!c) return a;
  10561.       if (a = c, !a.length) return [''];
  10562.       var d = b.now() - a[1] >= this.constructor.DRAFT_MAX_AGE;
  10563.       return d ? (this.removeDraft(), [
  10564.         ''
  10565.       ]) : a
  10566.     },
  10567.     removeDraft: function () {
  10568.       this.storageKey && this.constructor.storage.remove(this.storageKey)
  10569.     },
  10570.     fixInputStructure: function () {
  10571.       var a,
  10572.       b,
  10573.       c,
  10574.       f,
  10575.       g,
  10576.       h,
  10577.       i,
  10578.       j = !1,
  10579.       k = !1,
  10580.       l = window.document,
  10581.       m = this.$input[0];
  10582.       if (m.type && 'textarea' === m.type);
  10583.        else if (d.browser.isChrome()) 0 === m.childNodes.length ? (b = m.appendChild(l.createElement('p')), b.appendChild(l.createTextNode('\n')), j = !0) : (a = m.childNodes[0], a.childNodes.forEach(function (b) {
  10584.         e.isBr(b) && a.replaceChild(l.createTextNode('\n'), b)
  10585.       }));
  10586.        else if (d.browser.isIE()) {
  10587.         if (0 === m.childNodes.length) c = l.createElement('p'),
  10588.         c.appendChild(l.createTextNode('')),
  10589.         m.appendChild(c),
  10590.         j = !0;
  10591.          else for (g = m.childNodes.length, i = 0; i < g; i++) if (e.isP(m.childNodes[i])) if (f = m.childNodes[i].childNodes.length, 0 === f) m.childNodes[i].appendChild(l.createTextNode('')),
  10592.         1 === g && (j = !0);
  10593.          else if (1 === f) e.isBr(m.childNodes[i].childNodes[0]) && (m.childNodes[i].replaceChild(l.createTextNode(''), m.childNodes[i].childNodes[0]), 1 === g && (j = !0));
  10594.          else for (; f > 0; ) h = m.childNodes[i].childNodes[0],
  10595.         1 === f && e.isBr(h) ? (m.childNodes[i].replaceChild(l.createTextNode(''), h), f -= 1) : 2 === f && e.isBr(h) && e.isText(m.childNodes[i].childNodes[1]) && this.inputFixed ? (c = l.createElement('p'), c.appendChild(l.createTextNode('')), m.insertBefore(c, m.childNodes[i]), i += 1, g += 1, m.childNodes[i].removeChild(h), f -= 2, this.selectionIndices = {
  10596.           startElemInd: i,
  10597.           endElemInd: i,
  10598.           startElemSelectionInd: 0,
  10599.           endElemSelectionInd: 0
  10600.         }, k = !0) : 2 === f && e.isText(h) && e.isBr(m.childNodes[i].childNodes[1]) ? (this.inputFixed && (c = l.createElement('p'), c.appendChild(l.createTextNode('')), i === g - 1 ? m.appendChild(c) : m.insertBefore(c, m.childNodes[i + 1]), g += 1, this.selectionIndices = {
  10601.           startElemInd: i + 1,
  10602.           endElemInd: i + 1,
  10603.           startElemSelectionInd: 0,
  10604.           endElemSelectionInd: 0
  10605.         }, k = !0), m.childNodes[i].removeChild(m.childNodes[i].childNodes[1]), f -= 2) : f > 2 && e.isText(h) && e.isBr(m.childNodes[i].childNodes[1]) ? (c = l.createElement('p'), c.appendChild(l.createTextNode(h.nodeValue)), m.insertBefore(c, m.childNodes[i]), i += 1, g += 1, m.childNodes[i].removeChild(m.childNodes[i].childNodes[1]), m.childNodes[i].removeChild(h), f -= 2) : f -= 1
  10606.       } else if (d.browser.isFirefox()) {
  10607.         if (1 === m.childNodes.length && e.isP(m.childNodes[0]) && m.childNodes[0].childNodes.length > 2) {
  10608.           for (f = m.childNodes[0].childNodes.length, i = 0; i < f; i++) h = m.childNodes[0].childNodes[i],
  10609.           e.isText(h) ? (c = l.createElement('p'), c.appendChild(l.createTextNode(h.nodeValue)), i < f - 1 && e.isBr(m.childNodes[0].childNodes[i + 1]) && (i += 1)) : e.isBr(h) && (c = l.createElement('p'), c.appendChild(l.createElement('br'))),
  10610.           m.appendChild(c);
  10611.           m.removeChild(m.childNodes[0])
  10612.         } else 1 === m.childNodes.length && e.isBr(m.childNodes[0]) ? (m.removeChild(m.childNodes[0]), c = l.createElement('p'), c.appendChild(l.createElement('br')), m.appendChild(c)) : 0 === m.childNodes.length && (c = l.createElement('p'), c.appendChild(l.createElement('br')), m.appendChild(c), j = !0);
  10613.         for (i = 0; i < m.childNodes.length; i++) {
  10614.           var n = m.childNodes[i];
  10615.           e.isP(n) && 1 === n.childNodes.length && e.isBr(n.childNodes[0]) ? n.insertBefore(l.createTextNode(''), n.childNodes[0]) : e.isDiv(n) && (c = l.createElement('p'), 1 === n.childNodes.length && e.isBr(n.childNodes[0]) ? (c.appendChild(l.createTextNode('')), c.appendChild(l.createElement('br'))) : 2 === n.childNodes.length && e.isText(n.childNodes[0]) && n.childNodes[0].nodeValue.length > 0 && e.isBr(n.childNodes[1]) && c.appendChild(l.createTextNode(n.childNodes[0].nodeValue)), m.replaceChild(c, n))
  10616.         }
  10617.       } else if (d.browser.isSafari() || d.browser.isEdge()) if (0 !== m.childNodes.length && e.isP(m.childNodes[0])) {
  10618.         for (a = m.childNodes[0], f = a.childNodes.length, i = 0; i < f; i += 1) e.isBr(a.childNodes[i]) && (0 === i || e.isBr(a.childNodes[i - 1])) && (a.insertBefore(l.createTextNode(''), a.childNodes[i]), i === f - 1 && (j = !0));
  10619.         for (i = 0; i < f - 1; i += 1) e.isText(a.childNodes[i]) && '' === a.childNodes[i].nodeValue && e.isText(a.childNodes[i + 1]) && (a.removeChild(a.childNodes[i]), i -= 1, f -= 1)
  10620.       } else {
  10621.         for (c = l.createElement('p'), c.appendChild(l.createTextNode('')), c.appendChild(l.createElement('br')); m.firstChild; ) m.removeChild(m.firstChild);
  10622.         m.appendChild(c),
  10623.         j = !0
  10624.       } else if (d.browser.isOpera()) if (0 === m.childNodes.length) c = l.createElement('p'),
  10625.       c.appendChild(l.createTextNode('\n')),
  10626.       m.appendChild(c),
  10627.       j = !0;
  10628.        else for (a = m.childNodes[0], i = 0; i < a.childNodes.length; i++) e.isBr(a.childNodes[i]) && a.replaceChild(l.createTextNode('\n'), a.childNodes[i]);
  10629.       this.inputFixed = !0,
  10630.       k ? this.selectText() : j && this.focusEndOfText()
  10631.     },
  10632.     focusEndOfText: function () {
  10633.       var a,
  10634.       b = this.$input[0],
  10635.       c = 0,
  10636.       f = 0,
  10637.       g = 0,
  10638.       h = 0;
  10639.       d.browser.isChrome() || d.browser.isOpera() ? (a = b.childNodes[0], c = f = a.childNodes.length - 1, g = h = a.childNodes[c].nodeValue.length) : d.browser.isSafari() || d.browser.isEdge() ? (a = b.childNodes[0], c = f = e.isText(a.childNodes[a.childNodes.length - 1]) ? a.childNodes.length - 1 : a.childNodes.length - 2, g = h = a.childNodes[c].nodeValue.length) : (d.browser.isFirefox() || d.browser.isIE()) && (c = f = b.childNodes.length - 1, g = b.childNodes[c].childNodes[0].nodeValue.length, h = g),
  10640.       this.selectionIndices = {
  10641.         startElemInd: c,
  10642.         startElemSelectionInd: g,
  10643.         endElemInd: f,
  10644.         endElemSelectionInd: h
  10645.       },
  10646.       this.selectText()
  10647.     },
  10648.     getWhichChildIndex: function (a, b) {
  10649.       for (var c = 0; c < a.childNodes.length; c++) if (a.childNodes[c] === b) return c;
  10650.       return - 1
  10651.     },
  10652.     getNodeLength: function (a) {
  10653.       return e.isBr(a) ? 1 : a.nodeValue.length
  10654.     },
  10655.     placeholderSetSelection: function () {
  10656.       var a,
  10657.       b,
  10658.       c = window.getSelection();
  10659.       this.$input[0].type && 'textarea' === this.$input[0].type ? (a = this.$input[0].selectionStart, b = this.$input[0].selectionEnd) : 'DIV' === c.anchorNode.tagName ? (a = 0, b = this.get().length) : 'P' === c.anchorNode.tagName ? a = b = this.get().length : (a = Math.min(c.focusOffset, c.anchorOffset), b = Math.max(c.focusOffset, c.anchorOffset)),
  10660.       this.selectionIndices = {
  10661.         start: a,
  10662.         end: b,
  10663.         endElemInd: 0,
  10664.         endElemSelectionInd: 0,
  10665.         startElemInd: 0,
  10666.         startElemSelectionInd: 0
  10667.       }
  10668.     },
  10669.     setSelection: function () {
  10670.       var a,
  10671.       b,
  10672.       c,
  10673.       f,
  10674.       g,
  10675.       h,
  10676.       i;
  10677.       this.fixInputStructure();
  10678.       var j = this.$input[0],
  10679.       k = !1,
  10680.       l = window.getSelection();
  10681.       if (j.type && 'textarea' === j.type) b = j.selectionStart,
  10682.       c = j.selectionEnd;
  10683.        else if (l.rangeCount) {
  10684.         var m = l.getRangeAt(0);
  10685.         if (d.browser.isChrome()) {
  10686.           for (a = j.childNodes[0], b = f = 0; a.childNodes[f] && a.childNodes[f] !== m.startContainer; ) e.isSpan(a.childNodes[f]) || (b += this.getNodeLength(a.childNodes[f])),
  10687.           f += 1;
  10688.           if (h = m.startOffset, b += m.startOffset, m.collapsed) g = f,
  10689.           c = b,
  10690.           i = h;
  10691.            else if (m.startContainer === m.endContainer) g = f,
  10692.           i = m.endOffset,
  10693.           c = b + (m.endOffset - m.startOffset);
  10694.            else {
  10695.             for (g = f, c = b - m.startOffset; a.childNodes[g] && a.childNodes[g] !== m.endContainer; ) e.isSpan(a.childNodes[g]) || (c += this.getNodeLength(a.childNodes[g])),
  10696.             g += 1;
  10697.             e.isNewline(a.childNodes[g]) ? (i = this.getNodeLength(a.childNodes[g - 1]), g -= 1) : (c += m.endOffset, i = m.endOffset)
  10698.           }
  10699.         } else if (d.browser.isIE()) e.isDiv(m.startContainer) && e.isDiv(m.endContainer) && m.collapsed ? (f = j.childNodes.length - 1, g = j.childNodes.length - 1, h = j.childNodes[f].childNodes[0].nodeValue.length, i = j.childNodes[g].childNodes[0].nodeValue.length, k = !0) : e.isDiv(m.startContainer) && e.isDiv(m.endContainer) && !m.collapsed ? (f = m.startOffset, g = m.endOffset - 1, h = 0, i = j.childNodes[g].childNodes[0].nodeValue.length) : e.isText(m.startContainer) && e.isText(m.endContainer) ? (f = this.getWhichChildIndex(j, m.startContainer.parentNode), g = this.getWhichChildIndex(j, m.endContainer.parentNode), h = m.startOffset, i = m.endOffset) : e.isText(m.startContainer) && e.isDiv(m.endContainer) ? (f = this.getWhichChildIndex(j, m.startContainer.parentNode), g = m.endOffset - 1, h = m.startOffset, i = j.childNodes[g].childNodes[0].nodeValue.length) : (f = 0, g = 0, h = 0, i = 0);
  10700.          else if (d.browser.isFirefox()) e.isDiv(m.startContainer) && e.isDiv(m.endContainer) && m.startContainer === j && m.endContainer === j && m.collapsed ? (f = j.childNodes.length - 1, g = j.childNodes.length - 1, h = j.childNodes[f].childNodes[0].nodeValue.length, i = j.childNodes[g].childNodes[0].nodeValue.length, k = !0) : e.isDiv(m.startContainer) && e.isDiv(m.endContainer) && m.startContainer === j && m.endContainer === j && !m.collapsed ? (f = m.startOffset, g = m.endOffset - 1, h = 0, i = j.childNodes[g].childNodes[0].nodeValue.length) : e.isDiv(m.startContainer) && e.isText(m.endContainer) && m.startContainer === j ? (f = 0, g = this.getWhichChildIndex(j, m.endContainer.parentNode), h = 0, i = m.endOffset) : e.isDiv(m.startContainer) && e.isP(m.endContainer) && m.startContainer === j ? (f = 0, g = this.getWhichChildIndex(j, m.endContainer), h = 0, i = j.childNodes[g].childNodes[0].nodeValue.length) : e.isText(m.startContainer) && e.isText(m.endContainer) ? (f = this.getWhichChildIndex(j, m.startContainer.parentNode), g = this.getWhichChildIndex(j, m.endContainer.parentNode), h = m.startOffset, i = m.endOffset) : e.isText(m.startContainer) && e.isP(m.endContainer) ? (f = this.getWhichChildIndex(j, m.startContainer.parentNode), g = this.getWhichChildIndex(j, m.endContainer), h = m.startOffset, i = f === g ? j.childNodes[g].childNodes[0].nodeValue.length : 0) : e.isP(m.startContainer) && e.isText(m.endContainer) ? (f = this.getWhichChildIndex(j, m.startContainer), g = this.getWhichChildIndex(j, m.endContainer.parentNode), h = 0, i = m.endOffset) : e.isP(m.startContainer) && e.isP(m.endContainer) ? (f = this.getWhichChildIndex(j, m.startContainer), g = this.getWhichChildIndex(j, m.endContainer), h = 0, i = j.childNodes[g].childNodes[0].nodeValue.length) : (f = 0, g = 0, h = 0, i = 0);
  10701.          else if (d.browser.isSafari() || d.browser.isEdge()) a = j.childNodes[0],
  10702.         e.isText(m.startContainer) ? (f = this.getWhichChildIndex(a, m.startContainer), h = m.startOffset) : e.isP(m.startContainer) ? (f = m.startOffset < a.childNodes.length && e.isText(a.childNodes[m.startOffset]) ? m.collapsed ? m.startOffset : m.startOffset - 2 : m.startOffset - 1, h = a.childNodes[f].nodeValue.length) : e.isDiv(m.startContainer) && (m.collapsed ? (f = e.isText(a.childNodes[a.childNodes.length - 1]) ? a.childNodes.length - 1 : a.childNodes.length - 2, h = a.childNodes[f].nodeValue.length) : (f = 0, h = 0)),
  10703.         e.isText(m.endContainer) ? (g = this.getWhichChildIndex(a, m.endContainer), i = m.endOffset) : e.isP(m.endContainer) ? (g = m.endOffset < a.childNodes.length && e.isText(a.childNodes[m.endOffset]) ? m.collapsed ? m.endOffset : m.endOffset - 2 : m.endOffset - 1 < a.childNodes.length && e.isText(a.childNodes[m.endOffset - 1]) ? m.endOffset - 1 : m.endOffset - 1 < a.childNodes.length && e.isBr(a.childNodes[m.endOffset - 1]) ? m.endOffset - 2 : a.childNodes.length - 2, i = a.childNodes[g].nodeValue.length) : e.isDiv(m.endContainer) && (g = e.isText(a.childNodes[a.childNodes.length - 1]) ? a.childNodes.length - 1 : a.childNodes.length - 2, i = a.childNodes[f].nodeValue.length);
  10704.          else {
  10705.           if (!d.browser.isOpera()) return this.placeholderSetSelection();
  10706.           a = j.childNodes[0],
  10707.           f = this.getWhichChildIndex(a, m.startContainer),
  10708.           g = this.getWhichChildIndex(a, m.endContainer),
  10709.           h = m.startOffset,
  10710.           i = m.endOffset
  10711.         }
  10712.       } else this.focusEndOfText();
  10713.       this.selectionIndices = {
  10714.         start: b,
  10715.         end: c,
  10716.         startElemInd: f,
  10717.         startElemSelectionInd: h,
  10718.         endElemInd: g,
  10719.         endElemSelectionInd: i
  10720.       },
  10721.       k && this.selectText()
  10722.     },
  10723.     addTagTextarea: function (a) {
  10724.       var b,
  10725.       c,
  10726.       d,
  10727.       e = this.selectionIndices.start,
  10728.       f = this.selectionIndices.end,
  10729.       g = this.selectionIndices.startElemInd,
  10730.       h = this.selectionIndices.endElemInd,
  10731.       i = this.selectionIndices.startElemSelectionInd,
  10732.       j = this.selectionIndices.endElemSelectionInd;
  10733.       switch (a) {
  10734.         case 'a':
  10735.           b = '<a href="#">',
  10736.           c = '</a>';
  10737.           break;
  10738.         default:
  10739.           b = '<' + a + '>',
  10740.           c = '</' + a + '>'
  10741.       }
  10742.       var k = this.get(),
  10743.       l = k.slice(0, e),
  10744.       m = k.slice(e, f),
  10745.       n = k.slice(f),
  10746.       o = new RegExp('<' + a + '[^<>]*>'),
  10747.       p = new RegExp(c + '$'),
  10748.       q = m.match(o),
  10749.       r = m.match(p);
  10750.       q && r && 0 === q.index && r.index === f - e - c.length ? (d = m.replace(o, '').replace(p, ''), f -= q[0].length + r[0].length, j -= q[0].length + r[0].length) : (d = b + m + c, f += b.length + c.length, j += b.length + c.length),
  10751.       this.selectionIndices = {
  10752.         start: e,
  10753.         end: f,
  10754.         startElemInd: g,
  10755.         endElemInd: h,
  10756.         startElemSelectionInd: i,
  10757.         endElemSelectionInd: j
  10758.       },
  10759.       this.set(l + d + n),
  10760.       this.debouncedSaveHistory(),
  10761.       this.selectText()
  10762.     },
  10763.     addTag: function (a) {
  10764.       var b,
  10765.       c,
  10766.       e,
  10767.       f,
  10768.       g,
  10769.       h,
  10770.       i,
  10771.       j,
  10772.       k,
  10773.       l,
  10774.       m,
  10775.       n,
  10776.       o,
  10777.       p = window.document,
  10778.       q = this.$input[0],
  10779.       r = this.selectionIndices.start,
  10780.       s = this.selectionIndices.end,
  10781.       t = this.selectionIndices.startElemInd,
  10782.       u = this.selectionIndices.endElemInd,
  10783.       v = this.selectionIndices.startElemSelectionInd,
  10784.       w = this.selectionIndices.endElemSelectionInd;
  10785.       switch (a) {
  10786.         case 'a':
  10787.           b = '<a href="#">',
  10788.           c = '</a>';
  10789.           break;
  10790.         default:
  10791.           b = '<' + a + '>',
  10792.           c = '</' + a + '>'
  10793.       }
  10794.       var x = new RegExp('<' + a + '[^<>]*>'),
  10795.       y = new RegExp(c + '$');
  10796.       if (q.type && 'textarea' === q.type) return this.addTagTextarea(a);
  10797.       if (d.browser.isChrome() || d.browser.isSafari() || d.browser.isOpera() || d.browser.isEdge()) k = q.childNodes[0],
  10798.       l = k.childNodes[t],
  10799.       m = k.childNodes[u],
  10800.       n = l.nodeValue,
  10801.       o = m.nodeValue,
  10802.       f = n.slice(v).match(x),
  10803.       g = o.slice(0, w).match(y),
  10804.       f && g && 0 === f.index && g.index === w - c.length ? (t === u ? (h = n.slice(0, v) + n.slice(v, w).replace(x, '').replace(y, '') + n.slice(w), k.replaceChild(p.createTextNode(h), l), w -= f[0].length + g[0].length) : (i = n.slice(0, v) + n.slice(v).replace(x, ''), j = o.slice(0, w).replace(y, '') + o.slice(w), k.replaceChild(p.createTextNode(i), l), k.replaceChild(p.createTextNode(j), m), w -= g[0].length), s -= f[0].length + g[0].length) : (t === u ? (h = n.slice(0, v) + b + n.slice(v, w) + c + n.slice(w), k.replaceChild(p.createTextNode(h), l), w += b.length + c.length) : (i = n.slice(0, v) + b + n.slice(v), j = o.slice(0, w) + c + o.slice(w), k.replaceChild(p.createTextNode(i), l), k.replaceChild(p.createTextNode(j), m), w += c.length), s += b.length + c.length);
  10805.        else if (d.browser.isFirefox() || d.browser.isIE()) {
  10806.         var z = q.childNodes[this.selectionIndices.startElemInd],
  10807.         A = q.childNodes[this.selectionIndices.endElemInd];
  10808.         l = z.childNodes[0],
  10809.         m = A.childNodes[0],
  10810.         n = l.nodeValue,
  10811.         o = m.nodeValue,
  10812.         f = n.slice(v).match(x),
  10813.         g = o.slice(0, w).match(y),
  10814.         f && g && 0 === f.index && g.index === w - c.length ? (t === u ? (h = n.slice(0, v) + n.slice(v, w).replace(x, '').replace(y, '') + n.slice(w), z.replaceChild(p.createTextNode(h), l), w -= f[0].length + g[0].length) : (i = n.slice(0, v) + n.slice(v).replace(x, ''), j = o.slice(0, w).replace(y, '') + o.slice(w), z.replaceChild(p.createTextNode(i), l), A.replaceChild(p.createTextNode(j), m), w -= g[0].length), s -= f[0].length + g[0].length) : (t === u ? (h = n.slice(0, v) + b + n.slice(v, w) + c + n.slice(w), z.replaceChild(p.createTextNode(h), l), w += b.length + c.length) : (i = n.slice(0, v) + b + n.slice(v), j = o.slice(0, w) + c + o.slice(w), z.replaceChild(p.createTextNode(i), l), A.replaceChild(p.createTextNode(j), m), w += c.length), s += b.length + c.length)
  10815.       } else {
  10816.         var B = this.get(),
  10817.         C = B.slice(0, r),
  10818.         D = B.slice(r, s),
  10819.         E = B.slice(s);
  10820.         f = D.match(x),
  10821.         g = D.match(y),
  10822.         f && g && 0 === f.index && g.index === s - r - c.length ? (e = D.replace(x, '').replace(y, ''), s = s - f[0].length - g[0].length) : (e = b + D + c, s = s + b.length + c.length),
  10823.         this.set(C + e + E)
  10824.       }
  10825.       this.debouncedSaveHistory(),
  10826.       this.selectionIndices = {
  10827.         start: r,
  10828.         end: s,
  10829.         startElemInd: t,
  10830.         startElemSelectionInd: v,
  10831.         endElemInd: u,
  10832.         endElemSelectionInd: w
  10833.       },
  10834.       this.selectText()
  10835.     },
  10836.     selectText: function () {
  10837.       var a,
  10838.       b,
  10839.       c,
  10840.       e,
  10841.       f = this.$input[0],
  10842.       g = window.document.createRange(),
  10843.       h = this.selectionIndices.start,
  10844.       i = this.selectionIndices.end,
  10845.       j = f.childNodes[0],
  10846.       k = window.getSelection();
  10847.       if (f.type && 'textarea' === f.type) f.setSelectionRange(h, i);
  10848.        else if (d.browser.isChrome() || d.browser.isSafari() || d.browser.isOpera() || d.browser.isEdge()) a = j.childNodes[this.selectionIndices.startElemInd],
  10849.       b = this.selectionIndices.startElemSelectionInd,
  10850.       c = j.childNodes[this.selectionIndices.endElemInd],
  10851.       e = this.selectionIndices.endElemSelectionInd,
  10852.       g.setStart(a, b),
  10853.       g.setEnd(c, e),
  10854.       k.removeAllRanges(),
  10855.       k.addRange(g);
  10856.        else if (d.browser.isFirefox() || d.browser.isIE()) a = f.childNodes[this.selectionIndices.startElemInd].childNodes[0],
  10857.       b = this.selectionIndices.startElemSelectionInd,
  10858.       c = f.childNodes[this.selectionIndices.endElemInd].childNodes[0],
  10859.       e = this.selectionIndices.endElemSelectionInd,
  10860.       g.setStart(a, b),
  10861.       g.setEnd(c, e),
  10862.       (!d.browser.isIE() || k.rangeCount > 0 && k.getRangeAt(0).getClientRects().length > 0) && k.removeAllRanges(),
  10863.       k.addRange(g);
  10864.        else {
  10865.         var l = j.childNodes[0];
  10866.         g.setStart(l, h),
  10867.         g.setEnd(l, i),
  10868.         k.removeAllRanges(),
  10869.         k.addRange(g)
  10870.       }(d.browser.isEdge() || f.type && 'textarea' === f.type) && this.focus()
  10871.     },
  10872.     debouncedSaveHistory: a.debounce(function () {
  10873.       var a = this.toJSON() [0];
  10874.       a !== this.history[this.historyPosition] && (this.historyPosition !== this.history.length - 1 && (this.history = this.history.slice(0, this.historyPosition + 1)), this.history.push(a), this.historyPosition += 1)
  10875.     }, 200),
  10876.     undoTextarea: function () {
  10877.       this.historyPosition > 0 && (this.historyPosition -= 1, this.set(this.history[this.historyPosition]), this.fixInputStructure(), this.focusEndOfText())
  10878.     },
  10879.     redoTextarea: function () {
  10880.       this.historyPosition < this.history.length - 1 && (this.historyPosition += 1, this.set(this.history[this.historyPosition]), this.fixInputStructure(), this.focusEndOfText())
  10881.     }
  10882.   }, {
  10883.     MAX_TEXTAREA_HEIGHT: 350,
  10884.     SAVE_DRAFT_INTERVAL: 500,
  10885.     DRAFT_MAX_AGE: 86400000,
  10886.     storage: new f(5, 'drafts.queue')
  10887.   });
  10888.   return g
  10889. }),
  10890. define('core/views/ContentEditableView', [
  10891.   'jquery',
  10892.   'underscore',
  10893.   'core/editable',
  10894.   'core/views/TextareaView'
  10895. ], function (a, b, c, d) {
  10896.   'use strict';
  10897.   var e = window.document,
  10898.   f = d,
  10899.   g = f.prototype,
  10900.   h = f.extend({
  10901.     events: b.defaults({
  10902.       'focusout [data-role=editable]': 'handleFocusOut',
  10903.       'click .placeholder': 'handlePlaceholderClick'
  10904.     }, g.events),
  10905.     initialize: function () {
  10906.       g.initialize.apply(this, arguments),
  10907.       this.hasFocus = !1,
  10908.       this._selectionRange = null
  10909.     },
  10910.     saveSelection: function () {
  10911.       var a = window.getSelection();
  10912.       this._selectionRange = a && a.rangeCount && a.getRangeAt(0)
  10913.     },
  10914.     restoreSelection: function () {
  10915.       if (this._selectionRange) {
  10916.         var a = window.getSelection();
  10917.         a.removeAllRanges(),
  10918.         a.addRange(this._selectionRange),
  10919.         this._selectionRange = null
  10920.       }
  10921.     },
  10922.     render: function () {
  10923.       return this.$input = this.createInput(),
  10924.       this.$el.append(this.$input),
  10925.       this.set(this.value),
  10926.       this.renderPlaceholder(),
  10927.       this
  10928.     },
  10929.     createInput: function () {
  10930.       var b = a('<div>').attr({
  10931.         'class': 'textarea',
  10932.         tabIndex: 0,
  10933.         role: 'textbox',
  10934.         'aria-multiline': 'true',
  10935.         contenteditable: 'PLAINTEXT-ONLY',
  10936.         'data-role': 'editable'
  10937.       }).css({
  10938.         overflow: 'auto',
  10939.         'word-wrap': 'break-word',
  10940.         'max-height': this.constructor.MAX_TEXTAREA_HEIGHT + 'px'
  10941.       }),
  10942.       d = b[0];
  10943.       return 'plaintext-only' !== d.contentEditable && (d.contentEditable = 'true'),
  10944.       this.content = new c(d, (!0)),
  10945.       b
  10946.     },
  10947.     renderPlaceholder: function () {
  10948.       var b = this.placeholder;
  10949.       b && (this.$input.attr('aria-label', b), this.$placeholder = a('<span class="placeholder">' + b + '</span>'), this.updatePlaceholderDisplay())
  10950.     },
  10951.     updatePlaceholderDisplay: function () {
  10952.       this.$placeholder && (this.hasFocus || this.content.text() ? this.$placeholder.remove() : this.$el.prepend(this.$placeholder))
  10953.     },
  10954.     handlePlaceholderClick: function () {
  10955.       this.$input.focus()
  10956.     },
  10957.     handleFocusIn: function () {
  10958.       g.handleFocusIn.call(this),
  10959.       this.restoreSelection(),
  10960.       this.hasFocus = !0,
  10961.       this.updatePlaceholderDisplay()
  10962.     },
  10963.     handleFocusOut: function () {
  10964.       this.saveSelection(),
  10965.       this.hasFocus = !1,
  10966.       this.updatePlaceholderDisplay()
  10967.     },
  10968.     get: function () {
  10969.       return this.content.text()
  10970.     },
  10971.     getSelected: function () {
  10972.       return this.hasFocus && window.getSelection ? window.getSelection().toString() : this._selectionRange ? this._selectionRange.toString() : ''
  10973.     },
  10974.     offset: function () {
  10975.       return this.content.offset()
  10976.     },
  10977.     set: function (a) {
  10978.       this.content.setText(a),
  10979.       this.resize(),
  10980.       this.updatePlaceholderDisplay()
  10981.     },
  10982.     insertAtCursor: function (a) {
  10983.       this.focus();
  10984.       var b = ' ' + a + ' ';
  10985.       e.queryCommandSupported && e.queryCommandSupported('insertText') && e.execCommand('insertText', !1, b) || this.content.insertNode(e.createTextNode(b))
  10986.     },
  10987.     clear: function () {
  10988.       g.clear.call(this),
  10989.       b.defer(function (a) {
  10990.         a.$input.blur()
  10991.       }, this)
  10992.     },
  10993.     insertAroundSelection: function (a, b) {
  10994.       this.focus();
  10995.       var c = window.getSelection();
  10996.       if (c.rangeCount) {
  10997.         var d = c.getRangeAt(0),
  10998.         f = d.cloneRange();
  10999.         f.collapse(!1);
  11000.         var g = e.createTextNode(b);
  11001.         f.insertNode(g);
  11002.         var h = d.cloneRange();
  11003.         h.collapse(!0);
  11004.         var i = e.createTextNode(a);
  11005.         h.insertNode(i),
  11006.         d.setStart(i, a.length),
  11007.         d.setEnd(g, 0),
  11008.         c.removeAllRanges(),
  11009.         c.addRange(d)
  11010.       }
  11011.     }
  11012.   });
  11013.   return h
  11014. }),
  11015. define('core/views/PostReplyView', [
  11016.   'jquery',
  11017.   'underscore',
  11018.   'backbone',
  11019.   'modernizr',
  11020.   'moment',
  11021.   'core/UniqueModel',
  11022.   'core/mixins/withAlert',
  11023.   'core/mixins/withUploadForm',
  11024.   'core/models/Post',
  11025.   'core/models/User',
  11026.   'core/strings',
  11027.   'core/time',
  11028.   'core/utils',
  11029.   'core/switches',
  11030.   'core/views/ContentEditableView',
  11031.   'core/views/TextareaView',
  11032.   'core/utils/threadRatingsHelpers'
  11033. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) {
  11034.   'use strict';
  11035.   var r = k.get,
  11036.   s = m.preventDefaultHandler,
  11037.   t = c.View.extend({
  11038.     tagName: 'form',
  11039.     className: 'reply',
  11040.     events: {
  11041.       submit: 'submitForm'
  11042.     },
  11043.     postboxAlertSelector: '[role=postbox-alert]',
  11044.     initialize: function (a) {
  11045.       this.session = a.session,
  11046.       this.parent = a.parent,
  11047.       this.thread = a.thread,
  11048.       this.isRefreshEnabled = n.isFeatureActive('embed_refresh', {
  11049.         forum: this.thread && this.thread.forum && this.thread.forum.id
  11050.       }),
  11051.       this.isRefreshV2Enabled = this.isRefreshEnabled && n.isFeatureActive('embed_refresh_v2', {
  11052.         forum: this.thread && this.thread.forum && this.thread.forum.id
  11053.       }),
  11054.       this.$el.addClass(this.isRefreshEnabled ? 'form-refresh' : ''),
  11055.       this.$el.addClass(this.isRefreshV2Enabled ? 'form-refresh-v2' : ''),
  11056.       this.gifPickerEnabled = Boolean(this.thread) && Boolean(this.thread.forum) && Boolean(this.thread.forum.get('settings').gifPickerEnabled),
  11057.       this.post = this.makePostInstance(),
  11058.       this.setAlertSelector('[role=alert]'),
  11059.       this.shouldShowEmailAlertInForm = a.shouldShowEmailAlertInForm,
  11060.       this.parentView = a.parentView,
  11061.       this._isHidden = !1,
  11062.       this.parent && (t.open[this.parent.cid] = this),
  11063.       this.mediaembedEnabled = this.thread.forum.get('settings').mediaembedEnabled,
  11064.       this.allowUploads = this.mediaembedEnabled && this.uploadSupported,
  11065.       this.listenTo(this.session, 'change:id', this.redraw)
  11066.     },
  11067.     redraw: function () {
  11068.       var b = this.$el.hasClass('expanded'),
  11069.       c = this.el,
  11070.       d = this.$el.find('textarea').val();
  11071.       this.render(),
  11072.       this.$el.find('textarea').val(d),
  11073.       b && this.$el.addClass('expanded'),
  11074.       0 !== a(c).parent().length && c.parentNode.replaceChild(this.el, c)
  11075.     },
  11076.     getPlaceholderText: function () {
  11077.       return this.thread.get('posts') ? this.thread.forum.get('commentsPlaceholderTextPopulated') || r('Join the discussion…') : this.thread.forum.get('commentsPlaceholderTextEmpty') || r('Start the discussion…')
  11078.     },
  11079.     getTemplateData: function () {
  11080.       return {
  11081.         user: this.session.toJSON(),
  11082.         displayMediaPreviews: this.mediaembedEnabled || this.gifPickerEnabled,
  11083.         displayMediaUploadButton: this.allowUploads,
  11084.         gifPickerEnabled: this.gifPickerEnabled
  11085.       }
  11086.     },
  11087.     render: function () {
  11088.       return this.$el.html(this.template(this.getTemplateData())),
  11089.       this.initTextEditor(null, !0),
  11090.       this.parent ? this.$el.addClass('expanded') : this.$el.removeClass('expanded'),
  11091.       this.initTextarea(),
  11092.       this.initMediaViews({
  11093.         mediaembedEnabled: this.mediaembedEnabled,
  11094.         gifPickerEnabled: this.gifPickerEnabled,
  11095.         allowUploads: this.allowUploads,
  11096.         textarea: this.textarea
  11097.       }),
  11098.       this.constructor.mustVerifyEmailToPost(this.session.user, this.thread.forum) && this._alertMustVerify(this.shouldShowEmailAlertInForm),
  11099.       this._isHidden && this.$el.addClass('hidden'),
  11100.       this.initStarRatings(),
  11101.       this
  11102.     },
  11103.     createTextarea: function () {
  11104.       var a = {
  11105.         placeholder: this.getPlaceholderText(),
  11106.         storageKey: this.post.storageKey()
  11107.       };
  11108.       return this.constructor.canUseContentEditable ? new this.constructor.ContentEditableView(a) : new this.constructor.TextareaView(a)
  11109.     },
  11110.     initTextarea: function () {
  11111.       var a = this.textarea = this.createTextarea();
  11112.       this.$('[data-role=textarea]').prepend(a.render().el),
  11113.       this.listenTo(a, {
  11114.         keydown: function (a) {
  11115.           !a || !a.ctrlKey && !a.metaKey || 13 !== a.keyCode && 10 !== a.keyCode || this.submitForm(),
  11116.           this.session.get('banned') && this.alertBannedError()
  11117.         },
  11118.         focus: function () {
  11119.           this.$el.hasClass('expanded') || this.$el.addClass('expanded')
  11120.         }
  11121.       })
  11122.     },
  11123.     resize: function () {
  11124.       this.textarea.resize()
  11125.     },
  11126.     focus: function () {
  11127.       this.textarea.focus()
  11128.     },
  11129.     clear: function () {
  11130.       var a = this;
  11131.       a.textarea.clear(),
  11132.       a.clearMediaPreviews(),
  11133.       a.$el.removeClass('expanded'),
  11134.       b.delay(function () {
  11135.         a.resize()
  11136.       }, 200),
  11137.       a.parent && a.hide()
  11138.     },
  11139.     restore: function (a) {
  11140.       var c = this;
  11141.       c.textarea.set(a.get('raw_message')),
  11142.       c.textarea.handleFocusIn(),
  11143.       b.delay(function () {
  11144.         c.resize()
  11145.       }, 200),
  11146.       c.parent && c.show()
  11147.     },
  11148.     _alertMustVerify: function (a) {
  11149.       var b = this.emailVerifyAlertTemplate({
  11150.         user: this.session.user.toJSON(),
  11151.         forumName: this.thread.forum.get('name'),
  11152.         forumId: this.thread.forum.id
  11153.       });
  11154.       this.alert(b, {
  11155.         safe: !0,
  11156.         type: a ? 'error' : 'warn',
  11157.         target: a ? this.postboxAlertSelector : null
  11158.       })
  11159.     },
  11160.     submitForm: s(function () {
  11161.       return this.dismissAlert(),
  11162.       this.initiatePost()
  11163.     }),
  11164.     makePostInstance: function () {
  11165.       return new f(this.constructor.Post, {
  11166.         thread: this.thread.id,
  11167.         depth: this.parent ? this.parent.get('depth') + 1 : 0,
  11168.         parent: this.parent ? this.parent.id : null
  11169.       })
  11170.     },
  11171.     getPostParams: function () {
  11172.       var a = {
  11173.         raw_message: this.textarea.get(),
  11174.         rating: this.rating
  11175.       };
  11176.       b.extend(a, this.getAuthorParams());
  11177.       var c = this.mediaUploadsView;
  11178.       return c && (a.media = c.rich.invoke('toJSON')),
  11179.       a
  11180.     },
  11181.     getAuthorParams: function () {
  11182.       return {
  11183.         author_id: this.session.user.id
  11184.       }
  11185.     },
  11186.     initiatePost: function () {
  11187.       this.createPost(this.getPostParams())
  11188.     },
  11189.     createPost: function (c) {
  11190.       var d = this,
  11191.       e = this.post;
  11192.       this.dismissAlert();
  11193.       var f = a.now();
  11194.       if (!this.shouldAbortCreatePost(e, c)) return this.listenTo(e, {
  11195.         error: this._onCreateError,
  11196.         sync: b.partial(this._onCreateSync, f)
  11197.       }),
  11198.       e.save(c, {
  11199.         success: function () {
  11200.           b.isNumber(d.rating) && q.isThreadModelRatingsEnabled(d.thread) && (d.thread.set('userRating', d.rating), b.delay(b.bind(d.thread.fetchRatings, d.thread), 500))
  11201.         }
  11202.       }),
  11203.       this.attachAuthorToPost(e, c),
  11204.       e.created = !0,
  11205.       this.addPostToThread(e),
  11206.       this.clear(),
  11207.       e
  11208.     },
  11209.     shouldAbortCreatePost: function (a, b) {
  11210.       return this.isUploadInProgress() ? (this.alert(r('Please wait until your images finish uploading.'), {
  11211.         type: 'error',
  11212.         target: this.postboxAlertSelector
  11213.       }), !0) : !a.set(b, {
  11214.         validate: !0
  11215.       }) && (this.alert(a.validationError, {
  11216.         type: 'error',
  11217.         target: this.postboxAlertSelector
  11218.       }), !0)
  11219.     },
  11220.     alertBannedError: function () {
  11221.       var a = {
  11222.         blocker: this.session.user.get('isOnGlobalBlacklist') ? 'Disqus' : this.thread.forum.get('name')
  11223.       };
  11224.       if (this.session.get('banExpires')) {
  11225.         var b = e(l.assureTzOffset(this.session.get('banExpires')), l.ISO_8601);
  11226.         if (b.isBefore(e())) return;
  11227.         a.expirationRelative = b.fromNow()
  11228.       }
  11229.       this.alert(this.blacklistErrorMessageTemplate(a), {
  11230.         type: 'error',
  11231.         target: this.postboxAlertSelector,
  11232.         safe: !0
  11233.       })
  11234.     },
  11235.     _onCreateError: function (a, c) {
  11236.       12 === c.code && /not have permission to post on this thread/.test(c.response) ? this.alertBannedError() : 12 === c.code && /not have permission via SSO to post on this thread/.test(c.response) ? this.thread.forum.get('name') ? this.alert(k.interpolate(r('Please sign into %(forumName)s to comment.'), {
  11237.         forumName: this.thread.forum.get('name')
  11238.       }), {
  11239.         type: 'error',
  11240.         target: this.postboxAlertSelector
  11241.       }) : this.alert(r('Please sign into this site to comment'), {
  11242.         type: 'error',
  11243.         target: this.postboxAlertSelector
  11244.       }) : 12 === c.code && /verify/.test(c.response) ? this._alertMustVerify(!0) : b.isString(c.response) ? this.alert(c.response, {
  11245.         type: 'error',
  11246.         target: this.postboxAlertSelector
  11247.       }) : this.alert(r('Oops! We\'re having trouble posting your comment. Check your internet connection and try again.'), {
  11248.         type: 'error',
  11249.         target: this.postboxAlertSelector
  11250.       }),
  11251.       this.thread.posts.remove(a),
  11252.       this.restore(a)
  11253.     },
  11254.     _onCreateSync: function (b, c) {
  11255.       this.textarea.removeDraft(),
  11256.       this.thread.trigger('create', c),
  11257.       this.trigger('uiCallback:postCreated', c, {
  11258.         duration: a.now() - b
  11259.       }),
  11260.       this.parentView && this.parentView.toggleReplyLink(!1),
  11261.       this.stopListening(c, 'error', this._onCreateError),
  11262.       this.stopListening(c, 'sync', this._onCreateSync),
  11263.       this.post = this.makePostInstance(),
  11264.       this.trigger('domReflow')
  11265.     },
  11266.     attachAuthorToPost: function (a, b) {
  11267.       this.session.isLoggedIn() ? a.author = this.session.user : a.author = new f(this.constructor.User, {
  11268.         name: b.author_name,
  11269.         email: b.author_email
  11270.       })
  11271.     },
  11272.     addPostToThread: function (a) {
  11273.       this.thread.posts.add(a)
  11274.     },
  11275.     remove: function () {
  11276.       this.parent && delete t.open[this.parent.cid],
  11277.       c.View.prototype.remove.call(this)
  11278.     },
  11279.     toggle: function () {
  11280.       this.isOpen() ? this.hide() : this.show()
  11281.     },
  11282.     show: function () {
  11283.       var a = this;
  11284.       a._isHidden = !1,
  11285.       a.$el.removeClass('hidden'),
  11286.       a.trigger('show')
  11287.     },
  11288.     hide: function () {
  11289.       var a = this;
  11290.       a._isHidden = !0,
  11291.       a.dismissAlert(),
  11292.       a.$el.addClass('hidden'),
  11293.       a.trigger('hide')
  11294.     },
  11295.     isOpen: function () {
  11296.       return !this._isHidden
  11297.     }
  11298.   }, {
  11299.     mustVerifyEmailToPost: function (a, b) {
  11300.       if (a.isAnonymous()) return !1;
  11301.       var c = b.get('settings').mustVerifyEmail,
  11302.       d = a.get('isVerified');
  11303.       return c && !d
  11304.     },
  11305.     canUseContentEditable: d.contenteditable && !m.isMobileUserAgent() && !(window.opera && window.opera.version),
  11306.     TextareaView: p,
  11307.     ContentEditableView: o,
  11308.     User: j,
  11309.     Post: i,
  11310.     open: {
  11311.     }
  11312.   });
  11313.   return g.call(t.prototype),
  11314.   h.call(t.prototype),
  11315.   t
  11316. }),
  11317. define('constants/gifPickerConstants', [
  11318. ], function () {
  11319.   'use strict';
  11320.   return {
  11321.     GIF_PICKER_CATEGORIES: {
  11322.       LEFT: [
  11323.         {
  11324.           title: 'Trending',
  11325.           gifUrl: 'https://media.giphy.com/media/WsV5AoDeKePw4/200w_d.gif',
  11326.           width: 200,
  11327.           height: 113
  11328.         },
  11329.         {
  11330.           title: 'OMG',
  11331.           gifUrl: 'https://media.giphy.com/media/5VKbvrjxpVJCM/200w_d.gif',
  11332.           width: 200,
  11333.           height: 160
  11334.         },
  11335.         {
  11336.           title: 'No',
  11337.           gifUrl: 'https://media.giphy.com/media/z5WtAAaFpnIgU/200w_d.gif',
  11338.           width: 200,
  11339.           height: 150
  11340.         },
  11341.         {
  11342.           title: 'Slow clap',
  11343.           gifUrl: 'https://media.giphy.com/media/58FMN3DmsmYta2m0aB/200w_d.gif',
  11344.           width: 200,
  11345.           height: 150
  11346.         },
  11347.         {
  11348.           title: 'Love',
  11349.           gifUrl: 'https://media.giphy.com/media/Xf7g5BjIIMun8fR14k/200w_d.gif',
  11350.           width: 200,
  11351.           height: 199
  11352.         },
  11353.         {
  11354.           title: 'Eye roll',
  11355.           gifUrl: 'https://media.giphy.com/media/sbwjM9VRh0mLm/200w_d.gif',
  11356.           width: 200,
  11357.           height: 142
  11358.         }
  11359.       ],
  11360.       RIGHT: [
  11361.         {
  11362.           title: 'Applause',
  11363.           gifUrl: 'https://media.giphy.com/media/fnK0jeA8vIh2QLq3IZ/200w_d.gif',
  11364.           width: 200,
  11365.           height: 201
  11366.         },
  11367.         {
  11368.           title: 'Agree',
  11369.           gifUrl: 'https://media.giphy.com/media/3og0ILzGlzG26yNINq/200w_d.gif',
  11370.           width: 200,
  11371.           height: 166
  11372.         },
  11373.         {
  11374.           title: 'Ok',
  11375.           gifUrl: 'https://media.giphy.com/media/mgqefqwSbToPe/200w_d.gif',
  11376.           width: 200,
  11377.           height: 150
  11378.         },
  11379.         {
  11380.           title: 'Thumbs up',
  11381.           gifUrl: 'https://media.giphy.com/media/j5QcmXoFWl4Q0/200w_d.gif',
  11382.           width: 200,
  11383.           height: 125
  11384.         },
  11385.         {
  11386.           title: 'Thumbs down',
  11387.           gifUrl: 'https://media.giphy.com/media/KUrgyFtn9bQNW/200w_d.gif',
  11388.           width: 200,
  11389.           height: 128
  11390.         },
  11391.         {
  11392.           title: 'Thank you',
  11393.           gifUrl: 'https://media.giphy.com/media/QAsBwSjx9zVKoGp9nr/200w_d.gif',
  11394.           width: 200,
  11395.           height: 144
  11396.         }
  11397.       ]
  11398.     }
  11399.   }
  11400. }),
  11401. define('templates/lounge/gifsView', [
  11402.   'react'
  11403. ], function (a) {
  11404.   'use strict';
  11405.   var b = function (b) {
  11406.     return a.createElement('div', {
  11407.       className: 'gif-picker__gifs-view'
  11408.     }, a.createElement('div', {
  11409.       className: 'gif-picker__gifs-view-left'
  11410.     }, b.gifsLeft ? b.gifsLeft.map(function (b) {
  11411.       return a.createElement('div', {
  11412.         key: b.id,
  11413.         className: 'gif-picker__image',
  11414.         'data-action': 'gif-picker-image',
  11415.         'data-tag': b['default'].url,
  11416.         tabIndex: '0',
  11417.         'aria-label': b.title
  11418.       }, a.createElement('img', {
  11419.         src: b.fixedWidth200.url,
  11420.         title: b.title,
  11421.         style: {
  11422.           height: parseInt(b.fixedWidth200.height, 10) + 'px',
  11423.           width: parseInt(b.fixedWidth200.width, 10) + 'px'
  11424.         }
  11425.       }))
  11426.     }) : null), a.createElement('div', {
  11427.       className: 'gif-picker__gifs-view-right'
  11428.     }, b.gifsRight ? b.gifsRight.map(function (b) {
  11429.       return a.createElement('div', {
  11430.         key: b.fixedWidth200.url,
  11431.         className: 'gif-picker__image',
  11432.         'data-action': 'gif-picker-image',
  11433.         'data-tag': b['default'].url
  11434.       }, a.createElement('img', {
  11435.         src: b.fixedWidth200.url,
  11436.         title: b.title,
  11437.         style: {
  11438.           height: parseInt(b.fixedWidth200.height, 10) + 'px',
  11439.           width: parseInt(b.fixedWidth200.width, 10) + 'px'
  11440.         }
  11441.       }))
  11442.     }) : null))
  11443.   };
  11444.   return b
  11445. }),
  11446. define('templates/lounge/gifsCategory', [
  11447.   'react',
  11448.   'core/strings'
  11449. ], function (a, b) {
  11450.   'use strict';
  11451.   var c = b.get,
  11452.   d = function (d) {
  11453.     return a.createElement('div', {
  11454.       className: 'gif-picker__gifs-view gif-picker__categories'
  11455.     }, a.createElement('div', {
  11456.       className: 'gif-picker__gifs-view-left'
  11457.     }, d.categoriesLeft ? d.categoriesLeft.map(function (d) {
  11458.       return a.createElement('div', {
  11459.         key: d.title,
  11460.         className: 'gif-picker__image',
  11461.         'data-action': 'gif-picker-category',
  11462.         'data-tag': d.title,
  11463.         tabIndex: '0',
  11464.         'aria-label': 'Collection of animated images in the category of ' + d.title
  11465.       }, a.createElement('img', {
  11466.         src: d.gifUrl,
  11467.         className: 'gif-picker__category-gif',
  11468.         style: {
  11469.           height: d.height + 'px',
  11470.           width: d.width + 'px'
  11471.         }
  11472.       }), a.createElement('div', {
  11473.         className: 'gif-picker__category-overlay'
  11474.       }), a.createElement('div', {
  11475.         className: 'gif-picker__category-title align align--middle align--center'
  11476.       }, a.createElement('b', null, b.interpolate(c('%(title)s'), {
  11477.         title: d.title
  11478.       }))))
  11479.     }) : null), a.createElement('div', {
  11480.       className: 'gif-picker__gifs-view-right'
  11481.     }, d.categoriesRight ? d.categoriesRight.map(function (d) {
  11482.       return a.createElement('div', {
  11483.         key: d.title,
  11484.         className: 'gif-picker__image',
  11485.         'data-action': 'gif-picker-category',
  11486.         'data-tag': d.title,
  11487.         tabIndex: '0',
  11488.         'aria-label': 'Collection of animated images in the category of ' + d.title
  11489.       }, a.createElement('img', {
  11490.         src: d.gifUrl,
  11491.         className: 'gif-picker__category-gif',
  11492.         style: {
  11493.           height: d.height + 'px',
  11494.           width: d.width + 'px'
  11495.         }
  11496.       }), a.createElement('div', {
  11497.         className: 'gif-picker__category-overlay'
  11498.       }), a.createElement('div', {
  11499.         className: 'gif-picker__category-title align align--middle align--center'
  11500.       }, a.createElement('b', null, b.interpolate(c('%(title)s'), {
  11501.         title: d.title
  11502.       }))))
  11503.     }) : null))
  11504.   };
  11505.   return d
  11506. }),
  11507. define('templates/lounge/gifsPopout', [
  11508.   'react',
  11509.   'core/strings'
  11510. ], function (a, b) {
  11511.   'use strict';
  11512.   var c = b.get,
  11513.   d = function () {
  11514.     return a.createElement('div', {
  11515.       className: 'gif-picker__popout'
  11516.     }, a.createElement('textarea', {
  11517.       className: 'gif-picker__search-bar',
  11518.       placeholder: c('Search for gifs'),
  11519.       'data-role': 'gif-picker-input',
  11520.       wrap: 'soft',
  11521.       rows: '1'
  11522.     }), a.createElement('div', {
  11523.       className: 'gif-picker__gifs-view-container',
  11524.       'data-role': 'gifs-view-container'
  11525.     }), a.createElement('img', {
  11526.       className: 'gif-picker__powered-by',
  11527.       src: 'https://c.disquscdn.com/next/embed/assets/img/powered-by-giphy.b72f56fe31b44adb55a65c343c691d63.png'
  11528.     }))
  11529.   };
  11530.   return d
  11531. }),
  11532. define('lounge/mixins/asGifPicker', [
  11533.   'jquery',
  11534.   'underscore',
  11535.   'core/bus',
  11536.   'core/strings',
  11537.   'constants/gifPickerConstants',
  11538.   'templates/lounge/gifsView',
  11539.   'templates/lounge/gifsCategory',
  11540.   'templates/lounge/gifsPopout',
  11541.   'common/collections'
  11542. ], function (a, b, c, d, e, f, g, h, i) {
  11543.   'use strict';
  11544.   var j = d.get,
  11545.   k = {
  11546.     events: {
  11547.       'mousedown  [data-role=gif-picker-toggle]': 'toggleGifPicker',
  11548.       'keydown  [data-role=gif-picker-toggle]': 'toggleGifPicker',
  11549.       'mousedown  [data-action=gif-picker-image]': 'pickGif',
  11550.       'keydown  [data-action=gif-picker-image]': 'pickGif',
  11551.       'mousedown  [data-action=gif-picker-category]': 'pickGifCategory',
  11552.       'keydown  [data-action=gif-picker-category]': 'pickGifCategory',
  11553.       'keydown    [data-role=gif-picker-input]': 'onKeydown',
  11554.       'keyup      [data-role=gif-picker-input]': 'onKeyup'
  11555.     },
  11556.     initialize: function (a, b) {
  11557.       b = b || {
  11558.       },
  11559.       a.call(this, b)
  11560.     },
  11561.     initGifPicker: function () {
  11562.       this.gifPicker = this.$('.gif-picker'),
  11563.       this.toggle = this.$('[data-role=gif-picker-toggle]'),
  11564.       this.gifsCollection = new i.GifObjectsCollection,
  11565.       this.popoutContainer = this.$('[data-role=gif-picker-popout-container]'),
  11566.       this.categories = e.GIF_PICKER_CATEGORIES,
  11567.       this.gifPickerQuery = null,
  11568.       this.rescrollToTop = 0,
  11569.       this.popoutTemplate = h({
  11570.       }),
  11571.       this.popoutContainer.html(this.popoutTemplate),
  11572.       this.renderCategoriesView(),
  11573.       this.revealGifPicker(),
  11574.       this.listenTo(this.gifsCollection, 'sync', this.syncGifsCollection)
  11575.     },
  11576.     fetchGifObjectsCollection: function (a) {
  11577.       this.gifsCollection.fetch({
  11578.         forum: this.thread.forum.id,
  11579.         query: a
  11580.       })
  11581.     },
  11582.     syncGifsCollection: function () {
  11583.       this.renderGifsView(),
  11584.       this.positionGifPickerPopout(),
  11585.       this.gifsView[0].scrollTo({
  11586.         top: this.rescrollToTop
  11587.       })
  11588.     },
  11589.     dismissGifPicker: function (b) {
  11590.       this.gifPicker.length && !this.gifPicker[0].contains(b.target) && (this.hideGifPicker(), a(window).off('mousedown', this.dismissGifPicker))
  11591.     },
  11592.     toggleGifPicker: function (a) {
  11593.       if ('keydown' === a.type) {
  11594.         var b = 13,
  11595.         c = 32;
  11596.         if (a.keyCode !== b && a.keyCode !== c) return;
  11597.         a.preventDefault()
  11598.       }
  11599.       this.popoutTemplate ? this.popoutContainer.hasClass('hidden') ? this.revealGifPicker() : this.hideGifPicker() : this.initGifPicker()
  11600.     },
  11601.     pickGif: function (a) {
  11602.       if ('keydown' === a.type) {
  11603.         if (32 !== a.keyCode && 13 !== a.keyCode) return;
  11604.         a.preventDefault()
  11605.       }
  11606.       this.textarea.set(this.textarea.get() + ' ' + a.currentTarget.getAttribute('data-tag')),
  11607.       b.delay(b.bind(function () {
  11608.         this.hideGifPicker()
  11609.       }, this), 500)
  11610.     },
  11611.     pickGifCategory: function (a) {
  11612.       if ('keydown' === a.type) {
  11613.         if (32 !== a.keyCode && 13 !== a.keyCode) return;
  11614.         a.preventDefault()
  11615.       }
  11616.       var b = a.currentTarget.getAttribute('data-tag');
  11617.       b = 'Trending' === b ? '' : d.interpolate(j('%(category)s'), {
  11618.         category: b
  11619.       }),
  11620.       this.gifPickerQuery = b,
  11621.       this.rescrollToTop = 0,
  11622.       this.fetchGifObjectsCollection(b),
  11623.       this.gifsInput.val(b)
  11624.     },
  11625.     revealGifPicker: function () {
  11626.       this.popoutContainer.removeClass('hidden'),
  11627.       a(window).on('mousedown', b.bind(this.dismissGifPicker, this)),
  11628.       this.positionGifPickerPopout(),
  11629.       this.triggerClick()
  11630.     },
  11631.     hideGifPicker: function () {
  11632.       this.popoutContainer.addClass('hidden')
  11633.     },
  11634.     onKeydown: function (a) {
  11635.       13 === a.keyCode && a.preventDefault()
  11636.     },
  11637.     onKeyup: function (a) {
  11638.       a.target.value !== this.gifPickerQuery && (this.gifPickerQuery = '' === a.target.value ? null : a.target.value, this.rescrollToTop = 0, this.debouncedSearch())
  11639.     },
  11640.     debouncedSearch: b.debounce(function () {
  11641.       this.gifPickerQuery || '' === this.gifPickerQuery ? this.fetchGifObjectsCollection(this.gifPickerQuery) : this.renderCategoriesView()
  11642.     }, 250),
  11643.     renderCategoriesView: function () {
  11644.       this.gifsCollection.reset(),
  11645.       this.gifsContainer = this.$('[data-role=gifs-view-container]'),
  11646.       this.gifsInput = this.$('[data-role=gif-picker-input]'),
  11647.       this.gifCategories ? (this.gifsContainer.html(this.gifCategories), this.gifsView = this.gifCategories) : (this.gifsContainer.html(g({
  11648.         categoriesLeft: this.categories.LEFT,
  11649.         categoriesRight: this.categories.RIGHT
  11650.       })), this.gifCategories = this.gifsView = this.gifsContainer.children())
  11651.     },
  11652.     renderGifsView: function () {
  11653.       var a = this.gifsCollection && this.gifsCollection.toJSON(),
  11654.       c = [
  11655.       ],
  11656.       d = [
  11657.       ],
  11658.       e = 0,
  11659.       g = 0;
  11660.       b.forEach(a, function (a) {
  11661.         var b = parseInt(a.fixedWidth200.height, 10) + 10;
  11662.         g >= e ? (c.push(a), e += b) : (d.push(a), g += b)
  11663.       }),
  11664.       this.gifsContainer.html(f({
  11665.         gifsLeft: c,
  11666.         gifsRight: d
  11667.       })),
  11668.       this.gifsView = this.gifsContainer.children()
  11669.     },
  11670.     positionGifPickerPopout: function () {
  11671.       var b = this,
  11672.       c = 450,
  11673.       d = 800,
  11674.       e = 0,
  11675.       f = 0,
  11676.       g = d,
  11677.       h = !1,
  11678.       i = 873,
  11679.       j = 236,
  11680.       k = 73,
  11681.       l = 20,
  11682.       m = this.toggle.outerWidth() + 2,
  11683.       n = this.popoutContainer.height() + l,
  11684.       o = this.toggle.outerHeight(),
  11685.       p = this.toggle.offset().left,
  11686.       q = this.toggle.offset().top + o - 2,
  11687.       r = a(window.document).height(),
  11688.       s = a(window.document).width();
  11689.       if (n > r || n < i && n < r && r < i ? (g = Math.min(r, i) - k, e = - q + o, f = m, h = !0) : r > i && r - q < i ? (e = r - q - Math.max(n, i) + o, f = m, h = !0) : r - q > i && (h = !0, e = o, f = Math.min(0, s - (this.toggle.offset().left + j))), s < c) {
  11690.         this.popoutContainer.find('.gif-picker__popout').css({
  11691.           padding: '4px 4px 4px'
  11692.         });
  11693.         var t = this.popoutContainer.outerWidth() - this.gifsView.outerWidth(),
  11694.         u = s - (p + t + f + 10),
  11695.         v = u / 2;
  11696.         this.popoutContainer.find('.gif-picker__image > img').each(function () {
  11697.           a(this).css({
  11698.             width: v,
  11699.             height: v * a(this).height() / a(this).width()
  11700.           })
  11701.         }),
  11702.         h = !0
  11703.       }
  11704.       h && (this.gifsView.css('maxHeight', g), this.popoutContainer.css({
  11705.         top: e,
  11706.         left: f
  11707.       })),
  11708.       this.lastScrollTop = 0,
  11709.       this.gifsView[0].onscroll = function (a) {
  11710.         var c = a.target.scrollHeight - a.target.scrollTop - g,
  11711.         d = a.target.scrollTop > b.lastScrollTop;
  11712.         b.lastScrollTop = a.target.scrollTop,
  11713.         b.rescrollToTop = a.target.scrollTop,
  11714.         d && null !== b.gifPickerQuery && c < Math.min(1000, 0.5 * g) && b.throttledOnScrollToBottom(a.target.scrollTop)
  11715.       }
  11716.     },
  11717.     throttledOnScrollToBottom: b.throttle(function () {
  11718.       this.debouncedSearch()
  11719.     }, 500, {
  11720.       trailing: !1
  11721.     }),
  11722.     triggerClick: function () {
  11723.       c.trigger('uiAction:gifsClickButton')
  11724.     },
  11725.     triggerScroll: function () {
  11726.       c.trigger('uiAction:gifsScrollToBottom')
  11727.     }
  11728.   };
  11729.   return function () {
  11730.     this.events = b.defaults({
  11731.     }, this.events, k.events),
  11732.     this.initialize = b.wrap(this.initialize, k.initialize),
  11733.     b.extend(this, b.pick(k, [
  11734.       'initGifPicker',
  11735.       'fetchGifObjectsCollection',
  11736.       'syncGifsCollection',
  11737.       'toggleGifPicker',
  11738.       'dismissGifPicker',
  11739.       'pickGif',
  11740.       'pickGifCategory',
  11741.       'revealGifPicker',
  11742.       'hideGifPicker',
  11743.       'onKeydown',
  11744.       'onKeyup',
  11745.       'debouncedSearch',
  11746.       'renderCategoriesView',
  11747.       'renderGifsView',
  11748.       'positionGifPickerPopout',
  11749.       'throttledOnScrollToBottom',
  11750.       'triggerClick',
  11751.       'triggerScroll'
  11752.     ]))
  11753.   }
  11754. }),
  11755. define('core/constants/textEditorConstants', [
  11756.   'exports'
  11757. ], function (a) {
  11758.   'use strict';
  11759.   a.EDITOR_BUTTONS_ORDER = [
  11760.     'b',
  11761.     'spoiler',
  11762.     'i',
  11763.     's',
  11764.     'u',
  11765.     'a',
  11766.     'code',
  11767.     'blockquote'
  11768.   ],
  11769.   a.GIF_PICKER_BUTTON = 'gif-picker',
  11770.   a.MEDIA_UPLOADER_BUTTON = 'media-uploader'
  11771. }),
  11772. define('lounge/mixins/asTextEditor', [
  11773.   'jquery',
  11774.   'underscore',
  11775.   'core/constants/textEditorConstants'
  11776. ], function (a, b, c) {
  11777.   'use strict';
  11778.   var d = {
  11779.     events: {
  11780.       'mousedown [data-action=text-editor-tag]': 'textEditorTag',
  11781.       'keydown [data-action=text-editor-tag]': 'textEditorTag',
  11782.       'mouseup   [data-action=text-editor-buttons]': 'textEditorForceSelectText',
  11783.       'mousedown [data-role=editable]': 'textEditorMouseDown',
  11784.       'keyup     [data-role=editable]': 'textEditorKeyUp',
  11785.       'keydown   [data-role=editable]': 'textEditorKeyDown'
  11786.     },
  11787.     initialize: function (c, d) {
  11788.       d = d || {
  11789.       },
  11790.       c.call(this, d),
  11791.       this.textEditorMouseUp = b.bind(this.textEditorMouseUp, this),
  11792.       this.editBox = this.el && this.el.className && this.el.className.indexOf('edit') > - 1,
  11793.       a(window).on('resize', b.bind(this.initTextEditor, this)),
  11794.       this.mostRecentPostBoxWidth = null
  11795.     },
  11796.     textEditorTag: function (a) {
  11797.       if ('keydown' === a.type) {
  11798.         var b = 13,
  11799.         c = 32;
  11800.         return void (a.keyCode !== b && a.keyCode !== c || (a.preventDefault(), this.textarea.addTag(a.currentTarget.getAttribute('data-tag'))))
  11801.       }
  11802.       this.textarea.addTag(a.currentTarget.getAttribute('data-tag'))
  11803.     },
  11804.     textEditorForceSelectText: function () {
  11805.       this.textarea.selectText()
  11806.     },
  11807.     textEditorMouseDown: function () {
  11808.       a(window).on('mouseup', this.textEditorMouseUp)
  11809.     },
  11810.     textEditorMouseUp: function () {
  11811.       a(window).off('mouseup', this.textEditorMouseUp),
  11812.       setTimeout(b.bind(this.textarea.setSelection, this.textarea), 200)
  11813.     },
  11814.     textEditorKeyUp: function () {
  11815.       this.textarea.setSelection()
  11816.     },
  11817.     textEditorKeyDown: function (a) {
  11818.       !a.ctrlKey && !a.metaKey || 'z' !== a.key && 'y' !== a.key && 'Z' !== a.key && 'Y' !== a.key ? this.textarea.debouncedSaveHistory() : (a.preventDefault(), this.textarea.debouncedSaveHistory(), 'y' === a.key || 'Y' === a.key || a.shiftKey && ('z' === a.key || 'Z' === a.key) ? this.textarea.redoTextarea() : 'z' !== a.key && 'Z' !== a.key || this.textarea.undoTextarea())
  11819.     },
  11820.     getTextEditorTemplateData: function () {
  11821.       var a = [
  11822.       ],
  11823.       b = !this.editBox && this.gifPickerEnabled,
  11824.       d = !this.editBox && this.allowUploads,
  11825.       e = this.$('.post-actions').outerWidth() || 0;
  11826.       this.mostRecentPostBoxWidth = e;
  11827.       var f = this.$('.wysiwyg__item').outerWidth(!0) || 0,
  11828.       g = (this.$('.edit-button').outerWidth() || 0) + (this.$('.post-action__cancel').outerWidth(!0) || 0),
  11829.       h = this.$('.full-size-button').outerWidth() || 0,
  11830.       i = this.$('.small-size-button').outerWidth() || 0,
  11831.       j = b || d ? this.$('.vertical-separator').outerWidth() || 30 : 0,
  11832.       k = c.EDITOR_BUTTONS_ORDER.length + (!this.editBox && this.gifPickerEnabled ? 1 : 0) + (!this.editBox && this.allowUploads ? 1 : 0),
  11833.       l = h + j + (k + 1) * f >= e,
  11834.       m = l ? i : h,
  11835.       n = this.editBox ? g : m,
  11836.       o = Math.floor((e - n - j) / f) || 0;
  11837.       return b && o > a.length && (a = a.concat([c.GIF_PICKER_BUTTON])),
  11838.       o > a.length && (a = a.concat(c.EDITOR_BUTTONS_ORDER.slice(0, 1))),
  11839.       d && o > a.length && (a = a.concat([c.MEDIA_UPLOADER_BUTTON])),
  11840.       o > a.length && (a = a.concat(c.EDITOR_BUTTONS_ORDER.slice(1, o - a.length))),
  11841.       {
  11842.         user: this.session.toJSON(),
  11843.         displayMediaPreviews: this.mediaembedEnabled || this.gifPickerEnabled,
  11844.         displayMediaUploadButton: this.allowUploads,
  11845.         gifPickerEnabled: this.gifPickerEnabled,
  11846.         useSmallPostButton: l,
  11847.         buttonsToShow: a,
  11848.         edit: this.editBox,
  11849.         forum: this.thread.forum.id
  11850.       }
  11851.     },
  11852.     initTextEditor: function (a, b) {
  11853.       var c = this.$('.post-actions').outerWidth();
  11854.       if (!(a && 'resize' === a.type && this.mostRecentPostBoxWidth && c && c === this.mostRecentPostBoxWidth)) return this.$('.text-editor-container').html(this.textEditorTemplate(this.getTextEditorTemplateData())),
  11855.       b && null === c ? void this.initTextEditor(null, !1) : void (!this.editBox && this.textarea && this.initMediaViews({
  11856.         mediaembedEnabled: this.mediaembedEnabled,
  11857.         gifPickerEnabled: this.gifPickerEnabled,
  11858.         allowUploads: this.allowUploads,
  11859.         textarea: this.textarea
  11860.       }))
  11861.     }
  11862.   };
  11863.   return function () {
  11864.     this.events = b.defaults({
  11865.     }, this.events, d.events),
  11866.     this.initialize = b.wrap(this.initialize, d.initialize),
  11867.     b.extend(this, b.pick(d, [
  11868.       'textEditorTag',
  11869.       'textEditorForceSelectText',
  11870.       'textEditorMouseDown',
  11871.       'textEditorMouseUp',
  11872.       'textEditorKeyUp',
  11873.       'textEditorKeyDown',
  11874.       'getTextEditorTemplateData',
  11875.       'initTextEditor'
  11876.     ]))
  11877.   }
  11878. }),
  11879. define('lounge/mixins/asTextEditorV2', [
  11880.   'underscore',
  11881.   'core/strings',
  11882.   'core/switches'
  11883. ], function (a, b, c) {
  11884.   'use strict';
  11885.   var d = b.translations,
  11886.   e = [
  11887.   ];
  11888.   Object.defineProperties(window, {
  11889.     _loadTextEditor: {
  11890.       writable: !0
  11891.     },
  11892.     loadTextEditor: {
  11893.       get: function () {
  11894.         return this._loadTextEditor
  11895.       },
  11896.       set: function (a) {
  11897.         for (this._loadTextEditor = a; e.length; ) {
  11898.           var b = e.shift();
  11899.           b()
  11900.         }
  11901.       }
  11902.     }
  11903.   });
  11904.   var f = {
  11905.     initialize: function (a, b) {
  11906.       a.call(this, b),
  11907.       this.isEmbedV2Enabled = c.isFeatureActive('embed_v2', {
  11908.         forum: this.thread.forum.id
  11909.       })
  11910.     },
  11911.     loadEditorV2: function (b) {
  11912.       var c = this.$el.find('[data-role=textarea]') [0],
  11913.       f = a.extend({
  11914.         forum: this.thread.forum.id,
  11915.         thread: this.thread.id,
  11916.         lang: this.thread.forum.get('language'),
  11917.         translations: d,
  11918.         setAlert: a.partial(this.alert, a, a, !0).bind(this),
  11919.         clearAlert: this.alert.bind(this, '', null, !0),
  11920.         key: this.post && this.post.cid
  11921.       }, b),
  11922.       g = function () {
  11923.         var a = this.editorV2Root && this.editorV2Root._internalRoot && this.editorV2Root._internalRoot.containerInfo === c;
  11924.         this.editorV2Root && !a ? (this.editorV2Root.unmount(), this.editorV2Root = window.loadTextEditor(c, f)) : this.editorV2Root = window.loadTextEditor(c, f, this.editorV2Root)
  11925.       };
  11926.       window.loadTextEditor ? g.call(this) : e.push(g.bind(this))
  11927.     },
  11928.     resize: function (a) {
  11929.       this.isEmbedV2Enabled || a.call(this)
  11930.     },
  11931.     focus: function (a) {
  11932.       this.isEmbedV2Enabled || a.call(this)
  11933.     },
  11934.     initTextEditor: function (a) {
  11935.       this.isEmbedV2Enabled || a.call(this)
  11936.     },
  11937.     remove: function (a) {
  11938.       this.editorV2Root && (this.editorV2Root.unmount(), this.editorV2Root = null),
  11939.       a.call(this)
  11940.     },
  11941.     alert: function (a, b, c, d) {
  11942.       c = c || {
  11943.       };
  11944.       var e = '[role=postbox-alert]' === this._alertSelector || '[role=postbox-alert]' === c.target;
  11945.       if (!this.isEmbedV2Enabled || !d && !e) return a.call(this, b, c);
  11946.       var f = this.getEditorProps ? this.getEditorProps() : {
  11947.       };
  11948.       f.alert = {
  11949.         message: b,
  11950.         type: c.type,
  11951.         safe: c.safe
  11952.       },
  11953.       this.loadEditorV2(f)
  11954.     }
  11955.   };
  11956.   return function () {
  11957.     this.initialize = a.wrap(this.initialize, f.initialize),
  11958.     this.resize = a.wrap(this.resize, f.resize),
  11959.     this.focus = a.wrap(this.focus, f.focus),
  11960.     this.remove = a.wrap(this.remove, f.remove),
  11961.     this.alert = a.wrap(this.alert, f.alert),
  11962.     this.initTextEditor = a.wrap(this.initTextEditor, f.initTextEditor),
  11963.     a.extend(this, a.pick(f, [
  11964.       'loadEditorV2'
  11965.     ]))
  11966.   }
  11967. }),
  11968. define('templates/lounge/rate', [
  11969.   'react',
  11970.   'core/strings'
  11971. ], function (a, b) {
  11972.   'use strict';
  11973.   var c = b.gettext,
  11974.   d = function (b) {
  11975.     return a.createElement('div', {
  11976.       className: 'ratings-rate'
  11977.     }, a.createElement('div', {
  11978.       className: 'ratings-text'
  11979.     }, c(b.submitted ? 'You rated this' : 'Rate and comment')), a.createElement('div', {
  11980.       className: 'ratings-stars'
  11981.     }, a.createElement('div', {
  11982.       className: 'stars animation-star-container'
  11983.     }, a.createElement('div', {
  11984.       className: 'animation-star'
  11985.     }, a.createElement('div', {
  11986.       className: 'rating-star'
  11987.     }, '★'), a.createElement('div', {
  11988.       className: 'rating-star'
  11989.     }, '★'), a.createElement('div', {
  11990.       className: 'rating-star'
  11991.     }, '★'), a.createElement('div', {
  11992.       className: 'rating-star'
  11993.     }, '★'), a.createElement('div', {
  11994.       className: 'rating-star'
  11995.     }, '★'))), b.selected ? a.createElement('div', {
  11996.       className: 'stars selection-stars',
  11997.       style: {
  11998.         width: 20 * b.selectedValue + '%'
  11999.       }
  12000.     }, a.createElement('div', {
  12001.       className: 'rating-star'
  12002.     }, '★'), a.createElement('div', {
  12003.       className: 'rating-star'
  12004.     }, '★'), a.createElement('div', {
  12005.       className: 'rating-star'
  12006.     }, '★'), a.createElement('div', {
  12007.       className: 'rating-star'
  12008.     }, '★'), a.createElement('div', {
  12009.       className: 'rating-star'
  12010.     }, '★')) : null, a.createElement('div', {
  12011.       className: 'stars voting-stars'
  12012.     }, a.createElement('div', {
  12013.       className: 'rating-star',
  12014.       'data-action': 'rateThread',
  12015.       'data-tag': '1',
  12016.       tabIndex: '0'
  12017.     }, '★'), a.createElement('div', {
  12018.       className: 'rating-star',
  12019.       'data-action': 'rateThread',
  12020.       'data-tag': '2',
  12021.       tabIndex: '0'
  12022.     }, '★'), a.createElement('div', {
  12023.       className: 'rating-star',
  12024.       'data-action': 'rateThread',
  12025.       'data-tag': '3',
  12026.       tabIndex: '0'
  12027.     }, '★'), a.createElement('div', {
  12028.       className: 'rating-star',
  12029.       'data-action': 'rateThread',
  12030.       'data-tag': '4',
  12031.       tabIndex: '0'
  12032.     }, '★'), a.createElement('div', {
  12033.       className: 'rating-star',
  12034.       'data-action': 'rateThread',
  12035.       'data-tag': '5',
  12036.       tabIndex: '0'
  12037.     }, '★')), a.createElement('div', {
  12038.       className: 'stars base-stars'
  12039.     }, a.createElement('div', {
  12040.       className: 'rating-star'
  12041.     }, '★'), a.createElement('div', {
  12042.       className: 'rating-star'
  12043.     }, '★'), a.createElement('div', {
  12044.       className: 'rating-star'
  12045.     }, '★'), a.createElement('div', {
  12046.       className: 'rating-star'
  12047.     }, '★'), a.createElement('div', {
  12048.       className: 'rating-star'
  12049.     }, '★'))))
  12050.   };
  12051.   return d
  12052. }),
  12053. define('lounge/mixins/withStarRatings', [
  12054.   'underscore',
  12055.   'core/strings',
  12056.   'core/utils/threadRatingsHelpers',
  12057.   'templates/lounge/rate'
  12058. ], function (a, b, c, d) {
  12059.   'use strict';
  12060.   var e = b.gettext,
  12061.   f = 13,
  12062.   g = {
  12063.     events: {
  12064.       'click     [data-action=rateThread]': 'rateThread',
  12065.       'keydown   [data-action=rateThread]': function (a) {
  12066.         a.keyCode && a.keyCode === f && (a.preventDefault(), this.rateThread(a))
  12067.       },
  12068.       'mouseover [data-action=rateThread]': 'highlightRating',
  12069.       'mouseout  [data-action=rateThread]': 'unhighlightRating',
  12070.       'focusin   [data-action=rateThread]': 'highlightRating',
  12071.       'focusout  [data-action=rateThread]': 'unhighlightRating'
  12072.     },
  12073.     initialize: function (a, b) {
  12074.       b = b || {
  12075.       },
  12076.       a.call(this, b),
  12077.       this.rateTemplate = d,
  12078.       this.rating = null,
  12079.       this.ratingsEnabled = !this.post.get('parent') && c.isThreadModelRatingsEnabled(this.thread),
  12080.       this.listenTo(this.thread, 'change', function () {
  12081.         var a = this.thread.changedAttributes();
  12082.         return void 0 !== a.ratingsEnabled ? (this.ratingsEnabled = !this.post.get('parent') && c.isThreadModelRatingsEnabled(this.thread), this.initStarRatings(this.thread.get('userRating'))) : a.userRating && a.userRating !== this.rating ? this.initStarRatings(a.userRating) : void 0
  12083.       }),
  12084.       this.listenToOnce(this.thread.forum, 'change:features', function () {
  12085.         return this.ratingsEnabled = !this.post.get('parent') && c.isThreadModelRatingsEnabled(this.thread),
  12086.         this.initStarRatings(this.thread.get('userRating'))
  12087.       })
  12088.     },
  12089.     initStarRatings: function (b) {
  12090.       if (!this.ratingsEnabled) {
  12091.         var c = this.$('[data-role=ratings-container]');
  12092.         return void (c.length && this.$('[data-role=ratings-container]').empty())
  12093.       }
  12094.       return this.rating = a.isNumber(b) ? b : this.thread.get('userRating'),
  12095.       this.$('[data-role=ratings-container]').html(this.rateTemplate({
  12096.         selected: a.isNumber(this.rating),
  12097.         submitted: Boolean(this.thread.get('userRating')),
  12098.         selectedValue: this.rating
  12099.       }))
  12100.     },
  12101.     rateThread: function (a) {
  12102.       var b = this,
  12103.       c = parseInt(a.currentTarget.getAttribute('data-tag'), 10);
  12104.       Promise.resolve(this.initStarRatings(c)).then(function () {
  12105.         var a = b.$('.animation-star-container'),
  12106.         d = b.$('.animation-star-container > .animation-star');
  12107.         d.children().slice(c).remove(),
  12108.         a.addClass('animate-star'),
  12109.         d.css({
  12110.           position: 'absolute',
  12111.           left: '0',
  12112.           width: 20 * c + '%'
  12113.         }),
  12114.         setTimeout(function () {
  12115.           a.removeClass('animate-star')
  12116.         }, 500)
  12117.       }).then(function () {
  12118.         return b.textarea.focus()
  12119.       }).then(function () {
  12120.         return !b.postEditMode && b.alert(e('Please post a comment to submit your rating.'), {
  12121.           type: 'info',
  12122.           target: b.postboxAlertSelector
  12123.         })
  12124.       })
  12125.     },
  12126.     highlightRating: function (a) {
  12127.       this.$(a.currentTarget).addClass('selected-star'),
  12128.       this.$(a.currentTarget).prevAll().addClass('selected-star')
  12129.     },
  12130.     unhighlightRating: function (a) {
  12131.       this.$(a.currentTarget).removeClass('selected-star'),
  12132.       this.$(a.currentTarget).prevAll().removeClass('selected-star')
  12133.     }
  12134.   };
  12135.   return function () {
  12136.     this.events = a.defaults({
  12137.     }, this.events, g.events),
  12138.     this.initialize = a.wrap(this.initialize, g.initialize),
  12139.     a.extend(this, a.pick(g, [
  12140.       'initStarRatings',
  12141.       'rateThread',
  12142.       'highlightRating',
  12143.       'unhighlightRating'
  12144.     ]))
  12145.   }
  12146. }),
  12147. define('lounge/mixins/post-reply', [
  12148.   'underscore',
  12149.   'common/models',
  12150.   'lounge/common'
  12151. ], function (a, b, c) {
  12152.   'use strict';
  12153.   var d = {
  12154.     initialize: function () {
  12155.       this.canBindTypingHandlers() && this.bindTypingHandlers()
  12156.     },
  12157.     canBindTypingHandlers: function () {
  12158.       return this.parent && c.getLounge().isRealtimeEnabled() && this.session && this.thread && this.thread.forum
  12159.     },
  12160.     bindTypingHandlers: function () {
  12161.       return a.map([[this,
  12162.       'show',
  12163.       this.typingStart],
  12164.       [
  12165.         this,
  12166.         'hide',
  12167.         this.typingStop
  12168.       ]], function (a) {
  12169.         return this.listenTo.apply(this, a),
  12170.         a
  12171.       }, this)
  12172.     },
  12173.     syncTyping: function (a) {
  12174.       this.typingUser && (void 0 !== a && this.typingUser.set('typing', a), this.typingUser.sync())
  12175.     },
  12176.     typingStart: function () {
  12177.       var a = this.parent;
  12178.       this.typingUser || (this.typingUser = b.TypingUser.make({
  12179.         user: this.session.user.id,
  12180.         post: a.id,
  12181.         thread: this.thread.id,
  12182.         forum: this.thread.forum.id
  12183.       }), a.usersTyping.add(this.typingUser)),
  12184.       this.syncTyping(!0)
  12185.     },
  12186.     typingStop: function () {
  12187.       this.syncTyping(!1)
  12188.     }
  12189.   },
  12190.   e = function (b) {
  12191.     var c = b.initialize,
  12192.     e = b.remove;
  12193.     a.extend(b, d),
  12194.     b.initialize = function () {
  12195.       c.apply(this, arguments),
  12196.       d.initialize.call(this)
  12197.     },
  12198.     b.remove = function () {
  12199.       return this.parent && this.typingStop(),
  12200.       e.call(this)
  12201.     }
  12202.   };
  12203.   return {
  12204.     asRealtimeTyping: e
  12205.   }
  12206. }),
  12207. define('templates/lounge/suggestions', [
  12208.   'react',
  12209.   'core/strings'
  12210. ], function (a, b) {
  12211.   'use strict';
  12212.   var c = b.gettext,
  12213.   d = function () {
  12214.     return a.createElement('ul', {
  12215.       className: 'user-mention__list',
  12216.       id: 'user-mention-list'
  12217.     }, a.createElement('li', {
  12218.       className: 'header user-mention__header'
  12219.     }, a.createElement('h5', null, c('in this conversation'))))
  12220.   };
  12221.   return d
  12222. }),
  12223. define('templates/lounge/suggestedUser', [
  12224.   'react',
  12225.   'core/strings',
  12226.   'core/utils/object/get'
  12227. ], function (a, b, c) {
  12228.   'use strict';
  12229.   var d = b.gettext,
  12230.   e = function (b) {
  12231.     return a.createElement('li', {
  12232.       className: 'user-mention__item',
  12233.       'data-cid': b.cid || ''
  12234.     }, a.createElement('img', {
  12235.       src: c(b.avatar, [
  12236.         'cache'
  12237.       ], ''),
  12238.       className: 'avatar',
  12239.       alt: d('Avatar')
  12240.     }), a.createElement('span', null, b.name || b.username || null))
  12241.   };
  12242.   return e
  12243. }),
  12244. define('lounge/views/posts/SuggestionView', [
  12245.   'jquery',
  12246.   'underscore',
  12247.   'backbone',
  12248.   'templates/lounge/suggestions',
  12249.   'templates/lounge/suggestedUser'
  12250. ], function (a, b, c, d, e) {
  12251.   'use strict';
  12252.   var f = c.View.extend({
  12253.     events: {
  12254.       'click li': 'handleClick'
  12255.     },
  12256.     initialize: function (a) {
  12257.       this.active = !1,
  12258.       this.userSuggestions = a.userSuggestions,
  12259.       this.scrollListener = null,
  12260.       this.userHtmlCache = {
  12261.       },
  12262.       this.userSuggestions && this.userSuggestions.userCollection && this.listenTo(this.userSuggestions.userCollection, 'sync', this.syncUserCollection)
  12263.     },
  12264.     syncUserCollection: function () {
  12265.       this.active && (this.userSuggestions.userCollection.models.length ? this.renderUsers(this.userSuggestions.userCollection.models) : this.clear())
  12266.     },
  12267.     suggest: function (a, b) {
  12268.       return a ? (this.userSuggestions.find(a, b), this.currTerms = a, this.active = !0, void this.$el.show()) : void this.clear()
  12269.     },
  12270.     throttledSuggestMore: b.throttle(function () {
  12271.       this.suggest(this.currTerms, !0)
  12272.     }, 200, {
  12273.       trailing: !1
  12274.     }),
  12275.     render: function () {
  12276.       var a = this;
  12277.       return this.$el.html(d()),
  12278.       this.active || this.$el.hide(),
  12279.       this.scrollListener || (this.scrollListener = this.$el.find('#user-mention-list') [0].onscroll = function (b) {
  12280.         b.target.scrollHeight - b.target.scrollTop === b.target.clientHeight && a.throttledSuggestMore()
  12281.       }),
  12282.       this
  12283.     },
  12284.     renderUsers: function (c) {
  12285.       var d = b.reduce(c, function (b, c) {
  12286.         var d = this.userHtmlCache[c.cid];
  12287.         return void 0 === d && (this.userHtmlCache[c.cid] = d = a(this.renderSingleUser(c))),
  12288.         b.appendChild(d[0]),
  12289.         b
  12290.       }, window.document.createDocumentFragment(), this);
  12291.       this.$('.header').siblings().remove().end().after(d).siblings().removeClass('active').first().addClass('active')
  12292.     },
  12293.     renderSingleUser: function (a) {
  12294.       var b = a.toJSON();
  12295.       return b.cid = a.cid,
  12296.       e(b)
  12297.     },
  12298.     clear: function () {
  12299.       this.active = !1,
  12300.       this.$el.hide()
  12301.     },
  12302.     handleClick: function (b) {
  12303.       var c = a(b.currentTarget);
  12304.       this.select(c.attr('data-cid'))
  12305.     },
  12306.     select: function (a) {
  12307.       this.active && (a || (a = this.$el.find('.active').attr('data-cid')), this.trigger('select', a), this.clear())
  12308.     },
  12309.     move: function (a) {
  12310.       if (this.active) {
  12311.         var b = this.$el.find('.active'),
  12312.         c = 'up' === a ? 'prev' : 'next',
  12313.         d = b[c]();
  12314.         d.length && d.attr('data-cid') && (b.removeClass('active'), d.addClass('active'))
  12315.       }
  12316.     }
  12317.   }, {
  12318.     MAX_SUGGESTIONS: 5
  12319.   });
  12320.   return f
  12321. }),
  12322. define('lounge/views/posts/ContentEditableView', [
  12323.   'jquery',
  12324.   'underscore',
  12325.   'core/editable',
  12326.   'core/views/ContentEditableView',
  12327.   'common/collections',
  12328.   'lounge/common',
  12329.   'lounge/views/posts/SuggestionView'
  12330. ], function (a, b, c, d, e, f, g) {
  12331.   'use strict';
  12332.   var h = window.document,
  12333.   i = d,
  12334.   j = i.prototype,
  12335.   k = i.extend({
  12336.     initialize: function (a) {
  12337.       j.initialize.call(this, a),
  12338.       a = a || {
  12339.       },
  12340.       this.userSuggestions = a.userSuggestions,
  12341.       this.mentionsCache = new e.UserCollection,
  12342.       this.restoreMentionedUsers(),
  12343.       this.suggestions = new g({
  12344.         userSuggestions: this.userSuggestions,
  12345.         mentions: this.mentionsCache
  12346.       }),
  12347.       this.listenTo(this.suggestions, 'select', this.insertMention),
  12348.       this.reset(),
  12349.       this.$input = null
  12350.     },
  12351.     restoreMentionedUsers: function () {
  12352.       var a = this.getDraft() [2];
  12353.       a && !b.isEmpty(a) && this.userSuggestions.addRemote(new e.UserCollection(a))
  12354.     },
  12355.     reset: function () {
  12356.       this.anchorNode = null,
  12357.       this.anchorOffset = null,
  12358.       this.anchorLength = 0,
  12359.       this.suggestions.clear()
  12360.     },
  12361.     render: function () {
  12362.       return d.prototype.render.call(this),
  12363.       this.$el.append(this.suggestions.render().el),
  12364.       this
  12365.     },
  12366.     createInput: function () {
  12367.       var a = d.prototype.createInput.call(this);
  12368.       return this.content.getHtmlElements = b.bind(this.getHtmlElements, this),
  12369.       a
  12370.     },
  12371.     getHtmlElements: function (a) {
  12372.       if (!a) return a;
  12373.       var c = [
  12374.         a
  12375.       ],
  12376.       d = this.getMentionNodes(a);
  12377.       return b.each(d, function (a, d) {
  12378.         for (var e = 0; e < c.length; e++) {
  12379.           var f,
  12380.           g = c[e],
  12381.           h = e;
  12382.           if (b.isString(g)) {
  12383.             for (; (f = g.indexOf(d)) > - 1; ) f > 0 && (c.splice(e, 0, g.substring(0, f)), e += 1),
  12384.             c.splice(e, 0, a.cloneNode(!0)),
  12385.             e += 1,
  12386.             g = g.substring(f + d.length);
  12387.             g && g !== c[h] && (c.splice(e, 0, g), e += 1),
  12388.             h !== e && c.splice(e, 1)
  12389.           }
  12390.         }
  12391.       }),
  12392.       c = b.map(c, function (a) {
  12393.         return b.isString(a) ? h.createTextNode(a) : a
  12394.       })
  12395.     },
  12396.     getMentionNodes: function (a) {
  12397.       var b = k.MENTIONS_RE_GROUPED,
  12398.       c = {
  12399.       };
  12400.       b.lastIndex = 0;
  12401.       for (var d = b.exec(a); d; ) {
  12402.         var e = d[1],
  12403.         f = this.userSuggestions.all().findWhere({
  12404.           username: e
  12405.         });
  12406.         if (f) {
  12407.           var g = k.getMentionDom(f),
  12408.           h = d[0];
  12409.           c[h] = g,
  12410.           this.updateCache(f, f.cid)
  12411.         }
  12412.         d = b.exec(a)
  12413.       }
  12414.       return c
  12415.     },
  12416.     handleKeyDown: function (a) {
  12417.       switch (d.prototype.handleKeyDown.call(this, a), a.keyCode) {
  12418.         case 9:
  12419.           this.suggestions.active && (this.suggestions.select(), a.preventDefault(), a.stopPropagation());
  12420.           break;
  12421.         case 10:
  12422.         case 13:
  12423.         case 38:
  12424.         case 40:
  12425.           this.suggestions.active && (a.preventDefault(), a.stopPropagation())
  12426.       }
  12427.     },
  12428.     handleKeyUp: function (a) {
  12429.       switch (d.prototype.handleKeyUp.call(this, a), a.preventDefault(), a.stopPropagation(), this.setSelection(), this.checkExistingMentions(), a.keyCode) {
  12430.         case 10:
  12431.         case 13:
  12432.           this.suggestions.select();
  12433.           break;
  12434.         case 27:
  12435.           this.reset(a);
  12436.           break;
  12437.         case 38:
  12438.           this.suggestions.move('up');
  12439.           break;
  12440.         case 40:
  12441.           this.suggestions.move('down');
  12442.           break;
  12443.         default:
  12444.           this.throttledSuggest(a)
  12445.       }
  12446.     },
  12447.     handleFocusIn: function () {
  12448.       var a = f.getLounge();
  12449.       a && this.$input && this.$input.on('transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd resize', function () {
  12450.         a.resize()
  12451.       }),
  12452.       j.handleFocusIn.call(this)
  12453.     },
  12454.     suggest: function () {
  12455.       var a = this.parseSearchTerms();
  12456.       this.suggestions.suggest(a)
  12457.     },
  12458.     throttledSuggest: b.throttle(function () {
  12459.       this.suggest()
  12460.     }, 250),
  12461.     insertMention: function (a) {
  12462.       var c = this.userSuggestions.get(a);
  12463.       if (c) {
  12464.         this.selectSearchString(c),
  12465.         this.updateCache(c, a);
  12466.         var d = k.getMentionDom(c);
  12467.         this.content.insertNode(d);
  12468.         var e = this.$el.find('span[data-cid]');
  12469.         b.each(e, function (a) {
  12470.           a.contentEditable !== !1 && (a.contentEditable = !1)
  12471.         })
  12472.       }
  12473.     },
  12474.     updateCache: function (a, b) {
  12475.       this.mentionsCache.get(b) || this.mentionsCache.add(a)
  12476.     },
  12477.     selectSearchString: function () {
  12478.       this.content.selectNodeText(this.anchorNode, this.anchorOffset - 1, this.anchorOffset + this.anchorLength)
  12479.     },
  12480.     get: function () {
  12481.       function a(a) {
  12482.         return c(a, !0) ? b.mentionToText(a) : null
  12483.       }
  12484.       var b = this,
  12485.       c = k.isMention;
  12486.       return this.content.text(a)
  12487.     },
  12488.     parseSearchTerms: function () {
  12489.       var a = this.content.selectedTextNode(),
  12490.       b = a ? a.nodeValue : '',
  12491.       d = c.normalizeSpace;
  12492.       if (b) {
  12493.         var e = this.content.selectedTextNodeOffset(a),
  12494.         f = c.normalizeSpace(b.slice(0, e).split('').reverse().join('')),
  12495.         g = f.indexOf('@');
  12496.         if (g === - 1) return null;
  12497.         this.anchorNode = a,
  12498.         this.anchorOffset = e - g,
  12499.         this.anchorLength = g;
  12500.         var h = d(b.slice(this.anchorOffset - 1, e)).match(k.MENTIONS_RE);
  12501.         return h ? h[0].slice(1).split(' ') : 0 === g ? [
  12502.           ''
  12503.         ] : void 0
  12504.       }
  12505.     },
  12506.     checkExistingMentions: function () {
  12507.       var d = c.normalizeSpace,
  12508.       e = this.$el.find('span'),
  12509.       f = b.filter(e, k.isMention),
  12510.       g = this.mentionsCache,
  12511.       h = {
  12512.       };
  12513.       b.each(f, function (c) {
  12514.         var e = a(c).attr('data-cid'),
  12515.         f = b.reduce(this.content.getTextNodes(c), function (a, b) {
  12516.           return a + d(b.nodeValue)
  12517.         }, ''),
  12518.         i = g.get(e);
  12519.         i && i.get('name') !== f ? (this.mentionsCache.remove(i), this.content.removeNode(c), this.content.insertHTML(' '), this.reset()) : h[e] = c
  12520.       }, this),
  12521.       g.each(function (a) {
  12522.         h[a.cid] || g.remove(a)
  12523.       })
  12524.     },
  12525.     mentionToText: function (b) {
  12526.       var c = a(b).attr('data-cid'),
  12527.       d = this.mentionsCache.get(c),
  12528.       e = b.innerText || b.textContent;
  12529.       return d && d.get('username') && (e = d.get('username')),
  12530.       [
  12531.         '@',
  12532.         e,
  12533.         ':',
  12534.         'disqus'
  12535.       ].join('')
  12536.     },
  12537.     toJSON: function () {
  12538.       var a = d.prototype.toJSON.call(this);
  12539.       return a.push(this.mentionsCache.models),
  12540.       a
  12541.     }
  12542.   }, {
  12543.     MENTIONS_RE: new RegExp('@\\w+\\s?(?:\\w+\\s?){0,5}(?:\\w+)?$'),
  12544.     MENTIONS_RE_GROUPED: /@([\d\w]+)\s?(:\s?(\w+))?/gi,
  12545.     isMention: function (b, c) {
  12546.       var d;
  12547.       do {
  12548.         if (d = a(b), d.hasClass('mention') && d.attr('data-cid')) return !0;
  12549.         b = b.parentElement
  12550.       } while (c && b);
  12551.       return !1
  12552.     },
  12553.     getMentionDom: function (a) {
  12554.       var b = h.createDocumentFragment(),
  12555.       c = h.createElement('span'),
  12556.       d = h.createElement('span'),
  12557.       e = h.createTextNode(a.get('name') || a.get('username'));
  12558.       return c.setAttribute('contenteditable', !0),
  12559.       d.setAttribute('contenteditable', !1),
  12560.       d.setAttribute('data-cid', a.cid),
  12561.       d.className = 'mention',
  12562.       d.appendChild(e),
  12563.       c.appendChild(d),
  12564.       b.appendChild(c),
  12565.       b.appendChild(h.createTextNode(' ')),
  12566.       b
  12567.     }
  12568.   });
  12569.   return k
  12570. }),
  12571. define('lounge/views/posts/DummyTextareaView', [
  12572.   'backbone',
  12573.   'core/CappedStorage',
  12574.   'core/extensions/jquery.autoresize'
  12575. ], function (a, b) {
  12576.   'use strict';
  12577.   var c = a.View.extend({
  12578.     initialize: function (a) {
  12579.       a = a || {
  12580.       },
  12581.       this.storageKey = a.storageKey,
  12582.       this.value = a.value,
  12583.       this.history = [
  12584.         this.value
  12585.       ],
  12586.       this.historyPosition = 0,
  12587.       this.placeholder = a.placeholder,
  12588.       this.selectionIndices = {
  12589.         start: 0,
  12590.         end: 0,
  12591.         endElemInd: 0,
  12592.         endElemSelectionInd: 0,
  12593.         startElemInd: 0,
  12594.         startElemSelectionInd: 0
  12595.       },
  12596.       this.inputFixed = !1
  12597.     },
  12598.     render: function () {
  12599.       return this
  12600.     },
  12601.     createInput: function () {
  12602.     },
  12603.     resize: function () {
  12604.     },
  12605.     get: function () {
  12606.     },
  12607.     getSelected: function () {
  12608.     },
  12609.     offset: function () {
  12610.     },
  12611.     insertAtCursor: function () {
  12612.     },
  12613.     insertAroundSelection: function () {
  12614.     },
  12615.     set: function () {
  12616.     },
  12617.     clear: function () {
  12618.     },
  12619.     focus: function () {
  12620.     },
  12621.     handleKeyDown: function () {
  12622.     },
  12623.     handleKeyUp: function () {
  12624.     },
  12625.     handlePaste: function () {
  12626.     },
  12627.     handleFocusIn: function () {
  12628.     },
  12629.     handleBlur: function () {
  12630.     },
  12631.     saveDraft: function () {
  12632.     },
  12633.     toJSON: function () {
  12634.     },
  12635.     getDraft: function () {
  12636.     },
  12637.     removeDraft: function () {
  12638.     },
  12639.     fixInputStructure: function () {
  12640.     },
  12641.     focusEndOfText: function () {
  12642.     },
  12643.     getWhichChildIndex: function () {
  12644.     },
  12645.     getNodeLength: function () {
  12646.     },
  12647.     placeholderSetSelection: function () {
  12648.     },
  12649.     setSelection: function () {
  12650.     },
  12651.     addTagTextarea: function () {
  12652.     },
  12653.     addTag: function () {
  12654.     },
  12655.     selectText: function () {
  12656.     },
  12657.     debouncedSaveHistory: function () {
  12658.     },
  12659.     undoTextarea: function () {
  12660.     },
  12661.     redoTextarea: function () {
  12662.     }
  12663.   }, {
  12664.     MAX_TEXTAREA_HEIGHT: 350,
  12665.     SAVE_DRAFT_INTERVAL: 500,
  12666.     DRAFT_MAX_AGE: 86400000,
  12667.     storage: new b(5, 'drafts.queue')
  12668.   });
  12669.   return c
  12670. }),
  12671. define('core/views/common/LoginFormView', [
  12672.   'underscore',
  12673.   'backbone',
  12674.   'core/strings'
  12675. ], function (a, b, c) {
  12676.   'use strict';
  12677.   var d = c.get,
  12678.   e = b.View.extend({
  12679.     initialize: function () {
  12680.       this.model = new this.User
  12681.     },
  12682.     parseRegistrationErrorResponse: function (a) {
  12683.       if (a.responseJSON) {
  12684.         var b = a.responseJSON.response;
  12685.         return window.grecaptcha && window.grecaptcha.reset(),
  12686.         /Unable to create user/i.test(b) ? {
  12687.           email: [
  12688.             d('That email address is already registered with a Disqus account. Log in or enter another email.')
  12689.           ]
  12690.         }
  12691.          : /The e-mail address you specified is already in use./i.test(b) ? {
  12692.           email: [
  12693.             d('The e-mail address you specified is already in use.') + '<br><a class="link" href="#" data-action="auth:disqus">' + d('Try logging in.') + '</a>'
  12694.           ]
  12695.         }
  12696.          : (/You must re-submit this request with a response to the captcha challenge/i.test(b) && this.showCaptcha && this.showCaptcha(null, !0), {
  12697.           all: [
  12698.             b
  12699.           ]
  12700.         })
  12701.       }
  12702.     },
  12703.     getPassword: function () {
  12704.       var a = this.$el.find('input[name=password]');
  12705.       return a.length ? a.val() : null
  12706.     },
  12707.     getDisplayName: function () {
  12708.       return this.$el.find('input[name=display_name]').val()
  12709.     },
  12710.     getEmail: function () {
  12711.       return this.$el.find('input[name=email]').val()
  12712.     },
  12713.     disableForm: function () {
  12714.       this.$('[data-role=submit-btn-container]').addClass('is-submitting')
  12715.     },
  12716.     enableForm: function () {
  12717.       this.$('[data-role=submit-btn-container]').removeClass('is-submitting')
  12718.     },
  12719.     handleRegistrationErrorResponse: function (a) {
  12720.       this.handleRegistrationError(this.parseRegistrationErrorResponse(a))
  12721.     },
  12722.     registerUser: function () {
  12723.       return this.model.set({
  12724.         display_name: this.$el.find('input[name=display_name]').val(),
  12725.         email: this.$el.find('input[name=email]').val(),
  12726.         password: this.getPassword()
  12727.       }),
  12728.       this.model.isValid() ? (this.disableForm(), void this.model.register({
  12729.         gRecaptchaResponse: this.captchaShown && window.grecaptcha && window.grecaptcha.getResponse(),
  12730.         error: a.bind(this.handleRegistrationErrorResponse, this),
  12731.         success: a.bind(this.handleRegistrationSuccess, this)
  12732.       }).always(a.bind(this.enableForm, this))) : void this.handleRegistrationError(this.model.validationError)
  12733.     }
  12734.   });
  12735.   return e
  12736. }),
  12737. define('templates/lounge/partials/audienceSync', [
  12738.   'react',
  12739.   'core/config/urls',
  12740.   'core/strings'
  12741. ], function (a, b, c) {
  12742.   'use strict';
  12743.   var d = c.gettext,
  12744.   e = function (c) {
  12745.     return a.createElement('div', {
  12746.       className: 'audiencesync'
  12747.     }, a.createElement('h6', null, d('Connect with %(forumName)s', {
  12748.       forumName: c.forumName
  12749.     })), a.createElement('div', {
  12750.       className: 'services'
  12751.     }, a.createElement('div', {
  12752.       className: 'audiencesync__icons'
  12753.     }, a.createElement('img', {
  12754.       className: 'icon',
  12755.       alt: 'Disqus',
  12756.       src: 'https://c.disquscdn.com/next/embed/assets/img/audiencesync/sync-icon.74333606cf6b545eb92a69a61b112481.png'
  12757.     }), a.createElement('i', {
  12758.       className: 'icon icon-proceed'
  12759.     }), a.createElement('img', {
  12760.       className: 'icon',
  12761.       alt: c.forumName,
  12762.       src: (b.root || '') + '/api/applications/icons/' + (c.apiKey || '') + '.png'
  12763.     })), a.createElement('p', null, d('%(forumName)s needs permission to access your account.', {
  12764.       forumName: c.forumName
  12765.     }))), a.createElement('button', {
  12766.       type: 'button',
  12767.       'data-action': 'audiencesync',
  12768.       className: 'proceed btn submit'
  12769.     }, d('Next')))
  12770.   };
  12771.   return e
  12772. }),
  12773. define('templates/lounge/partials/guestForm', [
  12774.   'react',
  12775.   'core/strings',
  12776.   'core/utils/object/get'
  12777. ], function (a, b, c) {
  12778.   'use strict';
  12779.   var d = b.gettext,
  12780.   e = function () {
  12781.     return a.createElement('div', {
  12782.       className: 'acceptance-wrapper'
  12783.     }, a.createElement('label', null, a.createElement('input', {
  12784.       type: 'checkbox',
  12785.       name: 'tos'
  12786.     }), a.createElement('span', {
  12787.       className: 'spacing-left-small'
  12788.     }, d('I agree to Disqus\' %(terms)s', {
  12789.       terms: a.createElement('a', {
  12790.         href: 'https://help.disqus.com/customer/portal/articles/466260-terms-of-service',
  12791.         target: '_blank',
  12792.         rel: 'noopener noreferrer'
  12793.       }, d('Terms of Service'))
  12794.     }))), a.createElement('label', null, a.createElement('input', {
  12795.       type: 'checkbox',
  12796.       name: 'privacy-policy'
  12797.     }), a.createElement('span', {
  12798.       className: 'spacing-left-small'
  12799.     }, d('I consent to Disqus’ processing of my personal data, in accordance with its %(policy)s and %(terms)s, (including the use of strictly necessary cookies) to the extent needed to authenticate me and enable me to post comments or use other Disqus services. I acknowledge that my personal data will be processed in the United States', {
  12800.       policy: a.createElement('a', {
  12801.         href: 'https://disqus.com/privacy-policy',
  12802.         target: '_blank',
  12803.         rel: 'noopener noreferrer'
  12804.       }, d('Privacy Policy')),
  12805.       terms: a.createElement('a', {
  12806.         href: 'https://help.disqus.com/customer/portal/articles/466260-terms-of-service',
  12807.         target: '_blank',
  12808.         rel: 'noopener noreferrer'
  12809.       }, d('Terms of Service'))
  12810.     }))), a.createElement('label', null, a.createElement('input', {
  12811.       type: 'checkbox',
  12812.       name: 'data-sharing'
  12813.     }), a.createElement('span', {
  12814.       className: 'spacing-left-small'
  12815.     }, d('I consent to Disqus collecting, using, and disclosing my personal data for marketing purposes, including the use of tracking cookies for cross context behavioral advertising. My personal data may be transferred to the companies listed %(dataRecipients)s. I may withdraw my consent at any time by clicking %(policy)s', {
  12816.       policy: a.createElement('a', {
  12817.         href: 'https://disqus.com/data-sharing-settings/',
  12818.         target: '_blank',
  12819.         rel: 'noopener noreferrer'
  12820.       }, d('here')),
  12821.       dataRecipients: a.createElement('a', {
  12822.         href: 'https://help.disqus.com/en/articles/1944034-cookies-and-data-recipients',
  12823.         target: '_blank',
  12824.         rel: 'noopener noreferrer'
  12825.       }, d('here'))
  12826.     }))))
  12827.   },
  12828.   f = function (b) {
  12829.     var f = b.isRefreshEnabled,
  12830.     g = f ? 'sign-up-wrapper-refresh' : '',
  12831.     h = f ? 'guest guest--refresh' : 'guest',
  12832.     i = f ? 'guest-form-title guest-form-title--refresh' : 'guest-form-title';
  12833.     return a.createElement('div', {
  12834.       className: h
  12835.     }, a.createElement('div', {
  12836.       className: g
  12837.     }, a.createElement('h6', {
  12838.       className: i
  12839.     }, a.createElement('span', {
  12840.       className: 'register-text'
  12841.     }, ' ', d('or sign up with Disqus'), ' '), a.createElement('span', {
  12842.       className: 'guest-text'
  12843.     }, ' ', d('or pick a name'), ' ')), ' ', a.createElement('button', {
  12844.       type: 'button',
  12845.       className: 'help-tooltip__wrapper help-icon',
  12846.       name: 'guest_tooltip',
  12847.       tabIndex: 0
  12848.     }, a.createElement('div', {
  12849.       id: 'rules',
  12850.       className: 'help-tooltip__container',
  12851.       'data-role': 'guest-form-tooltip'
  12852.     }, a.createElement('div', {
  12853.       className: 'tooltip show help-tooltip'
  12854.     }, a.createElement('h3', {
  12855.       className: 'help-tooltip__heading'
  12856.     }, d('Disqus is a discussion network')), a.createElement('ul', {
  12857.       className: 'help-tooltip__list'
  12858.     }, a.createElement('li', null, a.createElement('span', null, d('Don\'t be a jerk or do anything illegal. Everything is easier that way.')))), a.createElement('p', {
  12859.       className: 'clearfix'
  12860.     }, a.createElement('a', {
  12861.       href: 'https://docs.disqus.com/kb/terms-and-policies/',
  12862.       className: 'btn btn-small help-tooltip__button',
  12863.       rel: 'noopener noreferrer',
  12864.       target: '_blank'
  12865.     }, d('Read full terms and conditions'))))))), a.createElement('p', {
  12866.       className: 'input-wrapper'
  12867.     }, a.createElement('input', {
  12868.       dir: 'auto',
  12869.       type: 'text',
  12870.       placeholder: d('Name'),
  12871.       name: 'display_name',
  12872.       id: (b.cid || '') + '_display_name',
  12873.       maxLength: '30',
  12874.       className: 'input--text',
  12875.       'aria-label': 'name'
  12876.     })), a.createElement('div', {
  12877.       className: 'guest-details ' + (c(b.sso, [
  12878.         'url'
  12879.       ]) ? 'expanded' : ''),
  12880.       'data-role': 'guest-details'
  12881.     }, a.createElement('p', {
  12882.       className: 'input-wrapper'
  12883.     }, a.createElement('input', {
  12884.       dir: 'auto',
  12885.       type: 'email',
  12886.       placeholder: d('Email'),
  12887.       name: 'email',
  12888.       id: (b.cid || '') + '_email',
  12889.       className: 'input--text',
  12890.       'aria-label': 'email'
  12891.     })), a.createElement('p', {
  12892.       className: 'input-wrapper'
  12893.     }, a.createElement('input', {
  12894.       dir: 'auto',
  12895.       disabled: !c(b.sso, [
  12896.         'url'
  12897.       ]),
  12898.       type: c(b.sso, [
  12899.         'url'
  12900.       ]) ? 'password' : 'text',
  12901.       className: 'register-text input--text',
  12902.       placeholder: d('Password'),
  12903.       name: 'password',
  12904.       'aria-label': 'password',
  12905.       id: (b.cid || '') + '_password'
  12906.     })), b.isPrivate ? a.createElement(e, null) : a.createElement('p', {
  12907.       className: 'privacy-info'
  12908.     }, a.createElement('div', null, d('By clicking submit, I authorize Disqus, Inc. and its affiliated companies to'), ':'), a.createElement('div', null, a.createElement('ul', {
  12909.       className: 'privacy-info-list'
  12910.     }, a.createElement('li', null, d('Use, sell, and share my information to enable me to use its comment services and for marketing purposes, including cross-context behavioral advertising, as described in our %(terms)s and %(policy)s', {
  12911.       policy: a.createElement('a', {
  12912.         href: 'https://disqus.com/privacy-policy',
  12913.         target: '_blank',
  12914.         rel: 'noopener noreferrer'
  12915.       }, d('Privacy Policy')),
  12916.       terms: a.createElement('a', {
  12917.         href: 'https://help.disqus.com/customer/portal/articles/466260-terms-of-service',
  12918.         target: '_blank',
  12919.         rel: 'noopener noreferrer'
  12920.       }, d('Terms of Service'))
  12921.     })), a.createElement('li', null, d('Supplement the information that I provide with additional information lawfully obtained from other sources, like demographic data from public sources, interests inferred from web page views, or other data relevant to what might interest me, like past purchase or location data')), a.createElement('li', null, d('Contact me or enable others to contact me by email with offers for goods and services (from any category) at the email address provided')), a.createElement('li', null, d('Process any sensitive personal information that I submit in a comment for the purpose of displaying the comment')), a.createElement('li', null, d('Retain my information while I am engaging with marketing messages that I receive and for a reasonable amount of time thereafter. I understand I can opt out at any time through an email that I receive.  Companies that we share data with are listed %(dataRecipients)s.', {
  12922.       dataRecipients: a.createElement('a', {
  12923.         href: 'https://help.disqus.com/en/articles/1944034-cookies-and-data-recipients',
  12924.         target: '_blank',
  12925.         rel: 'noopener noreferrer'
  12926.       }, d('here'))
  12927.     }))))), b.allowAnonPost ? a.createElement('div', {
  12928.       className: 'guest-checkbox'
  12929.     }, a.createElement('label', null, a.createElement('input', {
  12930.       type: 'checkbox',
  12931.       name: 'author-guest'
  12932.     }), ' ', d('I\'d rather post as a guest'))) : a.createElement('input', {
  12933.       type: 'checkbox',
  12934.       name: 'author-guest',
  12935.       style: {
  12936.         display: 'none'
  12937.       }
  12938.     }), a.createElement('div', {
  12939.       className: 'g-recaptcha',
  12940.       'data-role': 'grecaptcha-container'
  12941.     }), a.createElement('div', {
  12942.       className: 'proceed',
  12943.       'data-role': 'submit-btn-container'
  12944.     }, b.allowAnonPost ? a.createElement('div', null, a.createElement('button', {
  12945.       type: 'submit',
  12946.       className: 'proceed__button btn submit',
  12947.       'aria-label': d('Post')
  12948.     }, a.createElement('span', {
  12949.       className: 'icon-proceed'
  12950.     }), a.createElement('div', {
  12951.       className: 'spinner'
  12952.     })), a.createElement('button', {
  12953.       type: 'submit',
  12954.       className: 'proceed__button btn next',
  12955.       'aria-label': d('Next')
  12956.     }, a.createElement('span', {
  12957.       className: 'icon-proceed'
  12958.     }), a.createElement('div', {
  12959.       className: 'spinner'
  12960.     }))) : a.createElement('button', {
  12961.       type: 'submit',
  12962.       className: 'proceed__button btn submit',
  12963.       'aria-label': d('Next')
  12964.     }, a.createElement('span', {
  12965.       className: 'icon-proceed'
  12966.     }), a.createElement('div', {
  12967.       className: 'spinner'
  12968.     })))))
  12969.   };
  12970.   return f
  12971. }),
  12972. define('templates/lounge/partials/loginButtons', [
  12973.   'react',
  12974.   'core/utils/object/get'
  12975. ], function (a, b) {
  12976.   'use strict';
  12977.   var c = function (c) {
  12978.     return a.createElement('ul', {
  12979.       'data-role': 'login-menu',
  12980.       className: 'services login-buttons'
  12981.     }, b(c.sso, [
  12982.       'url'
  12983.     ]) ? a.createElement('li', {
  12984.       className: 'sso'
  12985.     }, a.createElement('button', {
  12986.       type: 'button',
  12987.       'data-action': 'auth:sso',
  12988.       title: b(c.sso, [
  12989.         'name'
  12990.       ], ''),
  12991.       className: 'sso__button ' + (b(c.sso, [
  12992.         'button'
  12993.       ]) ? 'image' : 'no-image')
  12994.     }, b(c.sso, [
  12995.       'button'
  12996.     ]) ? a.createElement('img', {
  12997.       alt: b(c.sso, [
  12998.         'name'
  12999.       ], ''),
  13000.       src: b(c.sso, [
  13001.         'button'
  13002.       ], '')
  13003.     }) : b(c.sso, [
  13004.       'name'
  13005.     ], null))) : null, a.createElement('li', {
  13006.       className: 'auth-disqus'
  13007.     }, a.createElement('button', {
  13008.       type: 'button',
  13009.       'data-action': 'auth:disqus',
  13010.       title: 'Disqus',
  13011.       className: 'connect__button',
  13012.       'aria-label': 'Login with Disqus'
  13013.     }, a.createElement('i', {
  13014.       className: 'icon-disqus'
  13015.     }))), a.createElement('li', {
  13016.       className: 'auth-facebook'
  13017.     }, a.createElement('button', {
  13018.       type: 'button',
  13019.       'data-action': 'auth:facebook',
  13020.       title: 'Facebook',
  13021.       className: 'connect__button',
  13022.       'aria-label': 'Login with Facebook'
  13023.     }, a.createElement('i', {
  13024.       className: 'icon-facebook-circle'
  13025.     }))), a.createElement('li', {
  13026.       className: 'auth-twitter'
  13027.     }, a.createElement('button', {
  13028.       type: 'button',
  13029.       'data-action': 'auth:twitter',
  13030.       title: 'X (Twitter)',
  13031.       className: 'connect__button',
  13032.       'aria-label': 'Login with X (Twitter)'
  13033.     }, a.createElement('i', {
  13034.       className: 'icon-twitter-x'
  13035.     }))), a.createElement('li', {
  13036.       className: 'auth-google'
  13037.     }, a.createElement('button', {
  13038.       type: 'button',
  13039.       'data-action': 'auth:google',
  13040.       title: 'Google',
  13041.       className: 'connect__button',
  13042.       'aria-label': 'Login with Google'
  13043.     }, a.createElement('i', {
  13044.       className: 'icon-google-plus-circle'
  13045.     }))), a.createElement('li', {
  13046.       className: 'auth-microsoft'
  13047.     }, a.createElement('button', {
  13048.       type: 'button',
  13049.       'data-action': 'auth:microsoft',
  13050.       title: 'Microsoft',
  13051.       className: 'connect__button',
  13052.       'aria-label': 'Login with Microsoft'
  13053.     })), a.createElement('li', {
  13054.       className: 'auth-apple'
  13055.     }, a.createElement('button', {
  13056.       type: 'button',
  13057.       'data-action': 'auth:apple',
  13058.       title: 'Apple',
  13059.       className: 'connect__button',
  13060.       'aria-label': 'Login with Apple'
  13061.     })))
  13062.   };
  13063.   return c
  13064. }),
  13065. define('templates/lounge/loginForm', [
  13066.   'react',
  13067.   'core/strings',
  13068.   'core/switches',
  13069.   'core/utils/object/get',
  13070.   'templates/lounge/partials/audienceSync',
  13071.   'templates/lounge/partials/guestForm',
  13072.   'templates/lounge/partials/loginButtons'
  13073. ], function (a, b, c, d, e, f, g) {
  13074.   'use strict';
  13075.   var h = b.gettext,
  13076.   i = function (b) {
  13077.     var i = b.forumName,
  13078.     j = c.isFeatureActive('embed_refresh', {
  13079.       forum: i
  13080.     }),
  13081.     k = j ? 'connect__heading' : '';
  13082.     return a.createElement('div', null, d(b.user, [
  13083.       'isAnonymous'
  13084.     ]) ? a.createElement('section', {
  13085.       className: 'auth-section logged-out__display'
  13086.     }, a.createElement('div', {
  13087.       className: 'connect'
  13088.     }, a.createElement('h6', {
  13089.       className: k
  13090.     }, h('Log in with')), a.createElement(g, {
  13091.       sso: b.sso
  13092.     })), a.createElement(f, {
  13093.       cid: b.cid,
  13094.       sso: b.sso,
  13095.       allowAnonPost: b.allowAnonPost,
  13096.       isPrivate: b.isPrivate,
  13097.       captcha_site_key: b.captcha_site_key,
  13098.       isRefreshEnabled: j
  13099.     })) : null, b.audienceSyncRequired ? a.createElement('section', {
  13100.       className: 'auth-section'
  13101.     }, a.createElement(e, {
  13102.       apiKey: b.apiKey,
  13103.       forumName: b.forumName
  13104.     })) : null)
  13105.   };
  13106.   return i
  13107. }),
  13108. define('lounge/views/posts/LoginFormView', [
  13109.   'underscore',
  13110.   'jquery',
  13111.   'remote/config',
  13112.   'core/bus',
  13113.   'core/api',
  13114.   'core/views/common/LoginFormView',
  13115.   'common/models',
  13116.   'lounge/common',
  13117.   'templates/lounge/loginForm'
  13118. ], function (a, b, c, d, e, f, g, h, i) {
  13119.   'use strict';
  13120.   var j = f.extend({
  13121.     events: {
  13122.       'click input[name=author-guest]': 'updateLoginForm',
  13123.       'focusin input[name=display_name]': 'expandGuestForm',
  13124.       'change input[name=tos], input[name=privacy-policy]': 'updateEnabled',
  13125.       'keyup input[name=display_name]': 'showCaptcha',
  13126.       'click button[name=guest_tooltip]': 'toggleGuestFormTooltip'
  13127.     },
  13128.     User: g.User,
  13129.     initialize: function (b) {
  13130.       f.prototype.initialize.call(this, b),
  13131.       this.thread = b.thread,
  13132.       this.session = b.session,
  13133.       this.alert = b.alert,
  13134.       this.config = a.property('config') (h.getLounge()) || {
  13135.       }
  13136.     },
  13137.     expandGuestForm: function () {
  13138.       this.$('[data-role=guest-details]').hasClass('expanded') || (this.$('[data-role=guest-details]').addClass('expanded'), this.$('input[name=password]').attr('type', 'password').removeAttr('disabled'), this.$('[name=display_name]').focus())
  13139.     },
  13140.     retractGuestForm: function () {
  13141.       this.$('[data-role=guest-details]').hasClass('expanded') && this.$('[data-role=guest-details]').removeClass('expanded')
  13142.     },
  13143.     toggleGuestFormTooltip: function () {
  13144.       this.$('[data-role=guest-form-tooltip]').hasClass('expanded') ? this.$('[data-role=guest-form-tooltip]').removeClass('expanded') : this.$('[data-role=guest-form-tooltip]').addClass('expanded')
  13145.     },
  13146.     showCaptcha: function (d, e) {
  13147.       !this.captchaShown && this.$('input[name=display_name]').val().trim().length && (c.register.ENABLE_CAPTCHA || e) && (window.onCaptchaChange = a.bind(this.updateEnabled, this), window.onCaptchaLoad = a.bind(function () {
  13148.         window.grecaptcha && (this.captchaId = window.grecaptcha.render(this.$('[data-role=grecaptcha-container]') [0], {
  13149.           sitekey: this.session.getRecaptchaKey(),
  13150.           callback: 'onCaptchaChange',
  13151.           'expired-callback': 'onCaptchaChange'
  13152.         }), this.updateEnabled(), a.delay(function () {
  13153.           b('iframe[title^="recaptcha challenge"]').parent().parent().addClass('recaptcha-challenge-container')
  13154.         }, 1000))
  13155.       }, this), b('<script>').attr('src', 'https://www.google.com/recaptcha/api.js?onload=onCaptchaLoad&render=explicit').appendTo(b('head')), this.captchaShown = !0)
  13156.     },
  13157.     shouldRegisterUser: function () {
  13158.       return this.session.isLoggedOut() && !this.$('input[name=author-guest]').is(':checked')
  13159.     },
  13160.     render: function () {
  13161.       return this.$el.html(i({
  13162.         user: this.session.toJSON(),
  13163.         forumName: this.thread.forum.get('name'),
  13164.         audienceSyncRequired: this.session.needsAudienceSyncAuth(this.thread.forum),
  13165.         allowAnonPost: this.thread.forum.get('settings').allowAnonPost,
  13166.         apiKey: this.config.apiKey || '',
  13167.         sso: this.session.get('sso'),
  13168.         cid: this.cid,
  13169.         isPrivate: Boolean(this.config.isPrivate)
  13170.       })),
  13171.       this.updateEnabled(),
  13172.       this
  13173.     },
  13174.     updateEnabled: function () {
  13175.       this.$el.closest('form').find('button[type=submit]').attr('disabled', Boolean(this.config.isPrivate) && (!this.$('input[name=tos]').prop('checked') || !this.$('input[name=privacy-policy]').prop('checked')) || Boolean(this.captchaShown && window.grecaptcha && !window.grecaptcha.getResponse(this.captchaId)))
  13176.     },
  13177.     handleRegistrationSuccess: function () {
  13178.       var a = this.$('input[name=data-sharing]');
  13179.       a.length && e.call('internal/users/setDNT', {
  13180.         method: 'POST',
  13181.         data: {
  13182.           value: a.prop('checked') ? 0 : 1
  13183.         }
  13184.       }),
  13185.       this.session.setUser(this.model),
  13186.       d.frame.trigger('onboardAlert.show'),
  13187.       this.retractGuestForm()
  13188.     },
  13189.     handleRegistrationError: function (b) {
  13190.       var c = this;
  13191.       c.clearRegistrationErrors(),
  13192.       a.isString(b) && (b = {
  13193.         all: [
  13194.           b
  13195.         ]
  13196.       }),
  13197.       a.has(b, 'all') && (c.alert && c.alert(b.all[0], {
  13198.         type: 'error'
  13199.       }), b = a.omit(b, 'all')),
  13200.       a.each(b, function (a, b) {
  13201.         var d = c.$('input[name=' + b + ']');
  13202.         d.attr('aria-invalid', 'true').attr('aria-labelledby', 'label-for-' + d.attr('id')).after('<label for="' + d.attr('id') + '" id="label-for-' + d.attr('id') + '" class="input-label">' + a[0] + '</label>').parent('.input-wrapper').addClass('has-error')
  13203.       }),
  13204.       c.$('[aria-invalid]').first().focus()
  13205.     },
  13206.     updateLoginForm: function () {
  13207.       var a = this.$el,
  13208.       b = a.find('input[name=author-guest]').is(':checked'),
  13209.       c = a.find('.guest'),
  13210.       d = a.find('input[name=password]');
  13211.       d.val(''),
  13212.       c.toggleClass('is-guest', b),
  13213.       this.clearRegistrationErrors()
  13214.     },
  13215.     clearRegistrationErrors: function () {
  13216.       this.$('.input-wrapper.has-error').removeClass('has-error').find('.input-label').remove(),
  13217.       this.$('[aria-invalid]').removeAttr('aria-invalid')
  13218.     }
  13219.   });
  13220.   return j
  13221. });
  13222. var _extends = Object.assign || function (a) {
  13223.   for (var b = 1; b < arguments.length; b++) {
  13224.     var c = arguments[b];
  13225.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  13226.   }
  13227.   return a
  13228. };
  13229. define('templates/lounge/partials/profileLink', [
  13230.   'react',
  13231.   'core/switches',
  13232.   'core/utils/object/get'
  13233. ], function (a, b, c) {
  13234.   'use strict';
  13235.   var d = function (d) {
  13236.     var e = d.children,
  13237.     f = d.user,
  13238.     g = d.forumId,
  13239.     h = d.profileTab,
  13240.     i = _objectWithoutProperties(d, [
  13241.       'children',
  13242.       'user',
  13243.       'forumId',
  13244.       'profileTab'
  13245.     ]),
  13246.     j = c(f, [
  13247.       'isSSOProfileUrl'
  13248.     ]);
  13249.     if (!j && b.isFeatureActive('sso_less_branding', {
  13250.       forum: g
  13251.     })) return a.createElement('span', i, e);
  13252.     var k = c(f, [
  13253.       'profileUrl'
  13254.     ], ''),
  13255.     l = 'profile';
  13256.     return j ? l = null : k && h && (k = '' + k + h),
  13257.     a.createElement('a', _extends({
  13258.       href: k,
  13259.       'data-action': l,
  13260.       'data-tab': h || '',
  13261.       'data-username': c(f, [
  13262.         'username'
  13263.       ], ''),
  13264.       target: '_blank',
  13265.       rel: 'noopener noreferrer'
  13266.     }, i), e)
  13267.   };
  13268.   return d
  13269. }),
  13270. define('templates/lounge/partials/userAvatar', [
  13271.   'react',
  13272.   'core/strings',
  13273.   'core/switches',
  13274.   'core/utils',
  13275.   'core/utils/object/get',
  13276.   'templates/lounge/partials/profileLink'
  13277. ], function (a, b, c, d, e, f) {
  13278.   'use strict';
  13279.   var g = b.gettext,
  13280.   h = d.getInitials,
  13281.   i = function (b) {
  13282.     var d = b.defaultAvatarUrl,
  13283.     i = b.forum,
  13284.     j = b.user,
  13285.     k = b.hasForumAvatar,
  13286.     l = c.isFeatureActive('embed_refresh', {
  13287.       forum: i.id
  13288.     }),
  13289.     m = l && c.isFeatureActive('embed_refresh_v2', {
  13290.       forum: i.id
  13291.     }),
  13292.     n = l ? 'user user--refresh' : 'user',
  13293.     o = void 0,
  13294.     p = e(i, [
  13295.       'avatar',
  13296.       'large',
  13297.       'cache'
  13298.     ], '');
  13299.     return void 0 === j.avatar.isCustom || j.avatar.isCustom === !0 ? o = e(j, [
  13300.       'avatar',
  13301.       'cache'
  13302.     ], '') : l ? l && k && (o = p) : o = p ? p : d,
  13303.     a.createElement(f, {
  13304.       user: j,
  13305.       forumId: i.id,
  13306.       className: n
  13307.     }, o ? a.createElement('img', {
  13308.       'data-role': 'user-avatar',
  13309.       'data-user': e(j, [
  13310.         'id'
  13311.       ], ''),
  13312.       src: d || o,
  13313.       'data-src': d ? o : null,
  13314.       alt: g('Avatar'),
  13315.       className: l ? 'image-refresh' : null
  13316.     }) : a.createElement('div', null, m ? h(j.name) [0] : h(j.name)))
  13317.   };
  13318.   return i
  13319. }),
  13320. define('templates/lounge/form', [
  13321.   'react',
  13322.   'core/strings',
  13323.   'core/switches',
  13324.   'core/utils',
  13325.   'core/utils/object/get',
  13326.   'templates/lounge/partials/userAvatar'
  13327. ], function (a, b, c, d, e, f) {
  13328.   'use strict';
  13329.   var g = b.gettext,
  13330.   h = function (b) {
  13331.     var h = b.forum.id,
  13332.     i = c.isFeatureActive('embed_refresh', {
  13333.       forum: h
  13334.     }),
  13335.     j = c.isFeatureActive('embed_v2', {
  13336.       forum: h
  13337.     }),
  13338.     k = i ? 'textarea-outer-wrapper textarea-outer-wrapper--refresh' : 'textarea-outer-wrapper',
  13339.     l = i ? 'user user--refresh' : 'user',
  13340.     m = i ? 'image-refresh' : '',
  13341.     n = !d.isDefaultAvatar(e(b.forum, [
  13342.       'avatar',
  13343.       'large',
  13344.       'cache'
  13345.     ], ''));
  13346.     return a.createElement('div', {
  13347.       className: 'postbox'
  13348.     }, a.createElement('div', {
  13349.       role: 'alert'
  13350.     }), a.createElement('div', {
  13351.       className: 'ratings-wrapper',
  13352.       'data-role': 'ratings-container'
  13353.     }), a.createElement('div', {
  13354.       className: 'compose-wrapper'
  13355.     }, a.createElement('div', {
  13356.       className: 'avatar'
  13357.     }, e(b.user, [
  13358.       'isRegistered'
  13359.     ]) ? a.createElement(f, {
  13360.       forum: b.forum,
  13361.       user: b.user,
  13362.       hasForumAvatar: n
  13363.     }) : a.createElement('span', {
  13364.       className: l
  13365.     }, i && !n ? a.createElement('div', null, 'G') : a.createElement('img', {
  13366.       'data-role': 'user-avatar',
  13367.       src: e(b.forum, [
  13368.         'avatar',
  13369.         'large',
  13370.         'cache'
  13371.       ], ''),
  13372.       alt: g('Avatar'),
  13373.       className: m
  13374.     }))), a.createElement('div', {
  13375.       className: k
  13376.     }, j ? a.createElement('div', {
  13377.       className: 'textarea-wrapper textarea-wrapper--embedv2',
  13378.       'data-role': 'textarea',
  13379.       dir: 'auto'
  13380.     }, a.createElement('div', {
  13381.       className: 'textarea-skeleton'
  13382.     })) : a.createElement('div', {
  13383.       className: 'textarea-wrapper',
  13384.       'data-role': 'textarea',
  13385.       dir: 'auto'
  13386.     }, a.createElement('div', {
  13387.       'data-role': 'drag-drop-placeholder',
  13388.       className: 'media-drag-hover',
  13389.       style: {
  13390.         display: 'none'
  13391.       }
  13392.     }, a.createElement('div', {
  13393.       className: 'drag-text'
  13394.     }, '⬇ ', g('Drag and drop your images here to upload them.'))), b.displayMediaPreviews ? a.createElement('div', {
  13395.       className: 'media-preview empty',
  13396.       'data-role': 'media-preview'
  13397.     }) : null, a.createElement('div', {
  13398.       className: 'edit-alert',
  13399.       role: 'postbox-alert'
  13400.     }), a.createElement('div', {
  13401.       className: 'text-editor-container'
  13402.     })))), a.createElement('div', {
  13403.       'data-role': 'login-form'
  13404.     }))
  13405.   };
  13406.   return h
  13407. }),
  13408. define('templates/lounge/textEditor', [
  13409.   'react',
  13410.   'core/constants/textEditorConstants',
  13411.   'core/strings',
  13412.   'core/switches',
  13413.   'core/utils/object/get'
  13414. ], function (a, b, c, d, e) {
  13415.   'use strict';
  13416.   var f = c.gettext,
  13417.   g = function (b) {
  13418.     var c = b.forum,
  13419.     g = d.isFeatureActive('embed_refresh', {
  13420.       forum: c
  13421.     }),
  13422.     h = function () {
  13423.       return g ? b.useSmallPostButton ? 'hidden' : '' : e(b.user, [
  13424.         'isRegistered'
  13425.       ]) && !b.useSmallPostButton ? '' : 'hidden'
  13426.     };
  13427.     return a.createElement('div', {
  13428.       className: 'temp-post'
  13429.     }, a.createElement('button', {
  13430.       type: 'submit',
  13431.       className: 'btn post-action__button full-size-button ' + h()
  13432.     }, g ? f('Comment') : f('Post as %(name)s', {
  13433.       name: a.createElement('span', {
  13434.         'data-username': e(b.user, [
  13435.           'username'
  13436.         ], ''),
  13437.         'data-role': 'username'
  13438.       }, e(b.user, [
  13439.         'name'
  13440.       ], null))
  13441.     })), a.createElement('button', {
  13442.       type: 'submit',
  13443.       className: 'btn post-action__button small-size-button' + (e(b.user, [
  13444.         'isRegistered'
  13445.       ]) && b.useSmallPostButton ? '' : ' hidden')
  13446.     }, f(g ? 'Comment' : 'Post')))
  13447.   },
  13448.   h = function (b) {
  13449.     return a.createElement('div', {
  13450.       className: 'logged-in'
  13451.     }, a.createElement('section', null, b.edit ? a.createElement('div', {
  13452.       className: 'temp-post'
  13453.     }, a.createElement('button', {
  13454.       className: 'btn post-action__button edit-button',
  13455.       type: 'submit'
  13456.     }, f('Save Edit')), a.createElement('a', {
  13457.       className: 'cancel post-action__cancel',
  13458.       href: '#',
  13459.       'data-action': 'edit'
  13460.     }, f('Cancel'))) : a.createElement(g, b)))
  13461.   },
  13462.   i = function (c) {
  13463.     return a.createElement('div', {
  13464.       className: 'wysiwyg'
  13465.     }, c.buttonsToShow.indexOf(b.GIF_PICKER_BUTTON) > - 1 ? a.createElement('div', {
  13466.       className: 'gif-picker'
  13467.     }, a.createElement('div', {
  13468.       className: 'wysiwyg__item',
  13469.       'data-role': 'gif-picker-toggle',
  13470.       title: f('GIF'),
  13471.       'aria-label': 'Open GIF menu',
  13472.       tabIndex: '0'
  13473.     }, a.createElement('div', {
  13474.       className: 'wysiwyg__gif',
  13475.       title: f('GIF'),
  13476.       role: 'img'
  13477.     })), a.createElement('div', {
  13478.       className: 'hidden gif-picker__popout-container',
  13479.       'data-role': 'gif-picker-popout-container'
  13480.     }), a.createElement('div', {
  13481.       className: 'new-feature-badge-star',
  13482.       title: f('New')
  13483.     }, a.createElement('div', {
  13484.       className: 'wysiwyg__star-badge wysiwyg__star-badge-dims'
  13485.     }))) : null, c.buttonsToShow.indexOf(b.MEDIA_UPLOADER_BUTTON) > - 1 ? a.createElement('div', {
  13486.       className: 'media-uploader'
  13487.     }, a.createElement('li', {
  13488.       className: 'wysiwyg__item',
  13489.       'data-role': 'media-uploader',
  13490.       tabIndex: '-1'
  13491.     })) : null, (c.buttonsToShow.indexOf(b.GIF_PICKER_BUTTON) > - 1 || c.buttonsToShow.indexOf(b.MEDIA_UPLOADER_BUTTON) > - 1) && c.buttonsToShow.length > 1 ? a.createElement('div', {
  13492.       className: 'vertical-separator'
  13493.     }) : null, a.createElement('div', {
  13494.       'data-action': 'text-editor-buttons'
  13495.     }, a.createElement('div', {
  13496.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('b') > - 1 ? '' : ' hidden'),
  13497.       'data-action': 'text-editor-tag',
  13498.       'data-tag': 'b',
  13499.       tabIndex: '0',
  13500.       'aria-label': 'Add bold tags to text editor'
  13501.     }, a.createElement('div', {
  13502.       className: 'wysiwyg__bold',
  13503.       title: f('Bold'),
  13504.       role: 'img'
  13505.     })), a.createElement('div', {
  13506.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('i') > - 1 ? '' : ' hidden'),
  13507.       'data-action': 'text-editor-tag',
  13508.       'data-tag': 'i',
  13509.       tabIndex: '0',
  13510.       'aria-label': 'Add italics tags to text editor'
  13511.     }, a.createElement('div', {
  13512.       className: 'wysiwyg__italic',
  13513.       title: f('Italic'),
  13514.       role: 'img'
  13515.     })), a.createElement('div', {
  13516.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('u') > - 1 ? '' : ' hidden'),
  13517.       'data-action': 'text-editor-tag',
  13518.       'data-tag': 'u',
  13519.       tabIndex: '0',
  13520.       'aria-label': 'Add underline tags to text editor'
  13521.     }, a.createElement('div', {
  13522.       className: 'wysiwyg__underline',
  13523.       title: f('Underline'),
  13524.       role: 'img'
  13525.     })), a.createElement('div', {
  13526.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('s') > - 1 ? '' : ' hidden'),
  13527.       'data-action': 'text-editor-tag',
  13528.       'data-tag': 's',
  13529.       tabIndex: '0',
  13530.       'aria-label': 'Add strikethrough tags to text editor'
  13531.     }, a.createElement('div', {
  13532.       className: 'wysiwyg__strikethrough',
  13533.       title: f('Strikethrough'),
  13534.       role: 'img'
  13535.     })), a.createElement('div', {
  13536.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('a') > - 1 ? '' : ' hidden'),
  13537.       'data-action': 'text-editor-tag',
  13538.       'data-tag': 'a',
  13539.       tabIndex: '0',
  13540.       'aria-label': 'Add link tags to text editor'
  13541.     }, a.createElement('div', {
  13542.       className: 'wysiwyg__link',
  13543.       title: f('Link'),
  13544.       role: 'img'
  13545.     })), a.createElement('div', {
  13546.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('spoiler') > - 1 ? '' : ' hidden'),
  13547.       'data-action': 'text-editor-tag',
  13548.       'data-tag': 'spoiler',
  13549.       tabIndex: '0',
  13550.       'aria-label': 'Add spoiler tags to text editor'
  13551.     }, a.createElement('div', {
  13552.       className: 'wysiwyg__spoiler',
  13553.       title: f('Spoiler'),
  13554.       role: 'img'
  13555.     })), a.createElement('div', {
  13556.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('code') > - 1 ? '' : ' hidden'),
  13557.       'data-action': 'text-editor-tag',
  13558.       'data-tag': 'code',
  13559.       tabIndex: '0',
  13560.       'aria-label': 'Add code tags to text editor'
  13561.     }, a.createElement('div', {
  13562.       className: 'wysiwyg__code',
  13563.       title: f('Code'),
  13564.       role: 'img'
  13565.     })), a.createElement('div', {
  13566.       className: 'wysiwyg__item' + (c.buttonsToShow.indexOf('blockquote') > - 1 ? '' : ' hidden'),
  13567.       'data-action': 'text-editor-tag',
  13568.       'data-tag': 'blockquote',
  13569.       tabIndex: '0',
  13570.       'aria-label': 'Add block quote tags to text editor'
  13571.     }, a.createElement('div', {
  13572.       className: 'wysiwyg__blockquote',
  13573.       title: f('Quote'),
  13574.       role: 'img'
  13575.     }))))
  13576.   },
  13577.   j = function (b) {
  13578.     return a.createElement('div', {
  13579.       className: 'post-actions'
  13580.     }, a.createElement(i, b), a.createElement(h, b))
  13581.   };
  13582.   return j
  13583. }),
  13584. define('templates/lounge/blacklistErrorMessage', [
  13585.   'react',
  13586.   'core/strings'
  13587. ], function (a, b) {
  13588.   'use strict';
  13589.   var c = b.gettext,
  13590.   d = function (b) {
  13591.     return [b.expirationRelative ? c('We are unable to post your comment because %(blocker)s has placed your account in a timeout. You will be able to comment again when your timeout expires %(expirationRelative)s.', {
  13592.       blocker: b.blocker,
  13593.       expirationRelative: b.expirationRelative
  13594.     }) : c('We are unable to post your comment because you have been banned by %(blocker)s.', {
  13595.       blocker: b.blocker
  13596.     }),
  13597.     ' ',
  13598.     a.createElement('a', {
  13599.       key: 'error-link',
  13600.       target: '_blank',
  13601.       href: 'https://help.disqus.com/customer/portal/articles/466223-who-deleted-or-removed-my-comment-'
  13602.     }, c('Find out more.'))]
  13603.   };
  13604.   return d
  13605. }),
  13606. define('templates/lounge/emailVerifyAlert', [
  13607.   'react',
  13608.   'core/strings',
  13609.   'core/utils/object/get'
  13610. ], function (a, b, c) {
  13611.   'use strict';
  13612.   var d = b.gettext,
  13613.   e = function (b) {
  13614.     return [d('%(forumName)s requires you to verify your email address before posting.', {
  13615.       forumName: b.forumName
  13616.     }),
  13617.     ' ',
  13618.     a.createElement('a', {
  13619.       key: 'alert-link',
  13620.       'data-action': 'verify-email',
  13621.       'data-forum': b.forumId,
  13622.       title: d('Verify Email'),
  13623.       href: '/verify'
  13624.     }, d('Send verification email to %(email)s', {
  13625.       email: c(b.user, [
  13626.         'email'
  13627.       ], '')
  13628.     }))]
  13629.   };
  13630.   return e
  13631. }),
  13632. define('lounge/views/posts/PostReplyView', [
  13633.   'jquery',
  13634.   'underscore',
  13635.   'react',
  13636.   'react-dom/server',
  13637.   'core/utils',
  13638.   'core/bus',
  13639.   'core/switches',
  13640.   'core/views/PostReplyView',
  13641.   'common/models',
  13642.   'lounge/mixins/asGifPicker',
  13643.   'lounge/mixins/asTextEditor',
  13644.   'lounge/mixins/asTextEditorV2',
  13645.   'lounge/mixins/withStarRatings',
  13646.   'lounge/mixins/post-reply',
  13647.   'lounge/common',
  13648.   'lounge/views/posts/ContentEditableView',
  13649.   'lounge/views/posts/DummyTextareaView',
  13650.   'lounge/views/posts/LoginFormView',
  13651.   'templates/lounge/form',
  13652.   'templates/lounge/textEditor',
  13653.   'templates/lounge/blacklistErrorMessage',
  13654.   'templates/lounge/emailVerifyAlert'
  13655. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) {
  13656.   'use strict';
  13657.   var w = e.preventDefaultHandler,
  13658.   x = h,
  13659.   y = x.prototype,
  13660.   z = x.extend({
  13661.     initialize: function (a) {
  13662.       y.initialize.call(this, a),
  13663.       this.listenTo(this.session, 'change:audienceSyncVerified', this.redraw),
  13664.       this.userSuggestions = a.userSuggestions,
  13665.       this.loginFormView = new r({
  13666.         thread: this.thread,
  13667.         session: this.session,
  13668.         alert: b.bind(this.alert, this)
  13669.       });
  13670.       var e = o.getLounge();
  13671.       b.each(['uiCallback:postCreated',
  13672.       'domReflow'], function (a) {
  13673.         this.listenTo(this, a, b.bind(e.trigger, e, a))
  13674.       }, this),
  13675.       this.template = s,
  13676.       this.textEditorTemplate = t,
  13677.       this.blacklistErrorMessageTemplate = function (a) {
  13678.         return d.renderToStaticMarkup(c.createElement(u, a))
  13679.       },
  13680.       this.emailVerifyAlertTemplate = function (a) {
  13681.         return d.renderToStaticMarkup(c.createElement(v, a))
  13682.       },
  13683.       this.postEditMode = !1
  13684.     },
  13685.     getTemplateData: function () {
  13686.       var a = y.getTemplateData.call(this);
  13687.       return a.audienceSyncRequired = this.session.needsAudienceSyncAuth(this.thread.forum),
  13688.       a.forum = this.thread.forum.toJSON(),
  13689.       a
  13690.     },
  13691.     getEditorProps: function () {
  13692.       return {
  13693.         placeholder: this.getPlaceholderText(),
  13694.         allowUploads: this.allowUploads,
  13695.         gifPickerEnabled: this.gifPickerEnabled,
  13696.         focusOnLoad: Boolean(this.parent),
  13697.         onSubmit: this.submitForm.bind(this, null),
  13698.         draftKey: 'v2:' + this.post.storageKey()
  13699.       }
  13700.     },
  13701.     render: function () {
  13702.       return this.loginFormView.$el.detach(),
  13703.       this.isEmbedV2Enabled ? (this.$el.html(this.template(this.getTemplateData())), this.loadEditorV2(this.getEditorProps()), this.textarea = new q, this.constructor.mustVerifyEmailToPost(this.session.user, this.thread.forum) && this._alertMustVerify(this.shouldShowEmailAlertInForm), this._isHidden && this.$el.addClass('hidden'), this.initStarRatings()) : y.render.call(this),
  13704.       this.loginFormView.render(),
  13705.       this.loginFormView.$el.appendTo(this.$('[data-role=login-form]')),
  13706.       this.session.user.id ? this.$el.addClass('authenticated') : this.$el.removeClass('authenticated'),
  13707.       this
  13708.     },
  13709.     createTextarea: function () {
  13710.       var a = {
  13711.         placeholder: this.getPlaceholderText(),
  13712.         storageKey: this.post.storageKey()
  13713.       };
  13714.       return this.constructor.canUseContentEditable ? (a.userSuggestions = this.userSuggestions, new this.constructor.ContentEditableView(a)) : new this.constructor.TextareaView(a)
  13715.     },
  13716.     getPostParams: function (c) {
  13717.       var d = a.Deferred(),
  13718.       e = y.getPostParams.call(this);
  13719.       return b.isString(c) && (e.raw_message = c),
  13720.       g.isFeatureActive('before_comment_callback', {
  13721.         forum: this.thread.forum.id
  13722.       }) ? (f.frame.sendHostMessage('posts.beforeCreate', {
  13723.         raw_message: e.raw_message
  13724.       }), this.listenToOnce(f.frame, 'posts.beforeCreate.response', function (a) {
  13725.         a && (e.raw_message = a),
  13726.         d.resolve(e)
  13727.       })) : d.resolve(e),
  13728.       d.promise()
  13729.     },
  13730.     getAuthorParams: function () {
  13731.       return this.session.isLoggedIn() ? {
  13732.         author_id: this.session.user.id
  13733.       }
  13734.        : {
  13735.         author_name: this.loginFormView.getDisplayName(),
  13736.         author_email: this.loginFormView.getEmail()
  13737.       }
  13738.     },
  13739.     initiatePost: function (a) {
  13740.       var c = b.bind(this.createPost, this);
  13741.       this.getPostParams(a).done(c)
  13742.     },
  13743.     shouldAbortCreatePost: function (a, c) {
  13744.       return this.constructor.mustVerifyEmailToPost(this.session.user, this.thread.forum) ? (this.session.fetch().always(b.bind(function () {
  13745.         this.constructor.mustVerifyEmailToPost(this.session.user, this.thread.forum) ? this._alertMustVerify(!0) : this.createPost(c)
  13746.       }, this)), !0) : y.shouldAbortCreatePost.call(this, a, c)
  13747.     },
  13748.     _onCreateError: function (a, b) {
  13749.       y._onCreateError.call(this, a, b),
  13750.       this.thread.incrementPostCount( - 1)
  13751.     },
  13752.     _onCreateSync: function (a, c) {
  13753.       y._onCreateSync.call(this, a, c),
  13754.       this.thread.posts.saveToCache(c),
  13755.       this.isEmbedV2Enabled && this.loadEditorV2(b.extend({
  13756.         clearDraft: !0
  13757.       }, this.getEditorProps()))
  13758.     },
  13759.     addPostToThread: function (a) {
  13760.       this.thread.incrementPostCount(1),
  13761.       this.thread.posts.add(a)
  13762.     },
  13763.     remove: function () {
  13764.       return this.loginFormView && (this.loginFormView.remove(), this.loginFormView = null),
  13765.       y.remove.call(this)
  13766.     },
  13767.     _submitForm: function (a, b) {
  13768.       return this.dismissAlert(),
  13769.       this.loginFormView.shouldRegisterUser() ? void this.loginFormView.registerUser() : this.initiatePost(b)
  13770.     },
  13771.     submitForm: w(function (a, c) {
  13772.       if (this.isEmbedV2Enabled && !b.isString(c)) {
  13773.         var d = this.$el.find('[data-role=textarea] button[type=button]');
  13774.         return void d.trigger('click')
  13775.       }
  13776.       return this._submitForm(a, c)
  13777.     })
  13778.   }, {
  13779.     ContentEditableView: p,
  13780.     User: i.User,
  13781.     Post: i.Post
  13782.   });
  13783.   return n.asRealtimeTyping(z.prototype),
  13784.   m.call(z.prototype),
  13785.   k.call(z.prototype),
  13786.   l.call(z.prototype),
  13787.   j.call(z.prototype),
  13788.   z
  13789. }),
  13790. define('core/constants/badgesConstants', [
  13791.   'exports'
  13792. ], function (a) {
  13793.   'use strict';
  13794.   a.ACTION_TYPES = {
  13795.     AWARD: 'award',
  13796.     REMOVE: 'remove'
  13797.   },
  13798.   a.BADGES_CRITERIA = {
  13799.     MANUAL: 'MANUAL',
  13800.     COMMENTS: 'COMMENTS',
  13801.     FEATURED_COMMENTS: 'FEATURED_COMMENTS',
  13802.     COMMENT_UPVOTES: 'COMMENT_UPVOTES'
  13803.   },
  13804.   a.MAX_BADGE_COUNT = 8
  13805. }),
  13806. define('core/models/RichMediaViewModel', [
  13807.   'backbone'
  13808. ], function (a) {
  13809.   'use strict';
  13810.   return a.Model.extend({
  13811.     defaults: {
  13812.       deferred: !0,
  13813.       showButtons: !0,
  13814.       activated: !1,
  13815.       kind: 'image',
  13816.       deferredHeight: 0,
  13817.       providerExpandMessage: '',
  13818.       providerCollapseMessage: '',
  13819.       providerIcon: 'icon-proceed',
  13820.       respectSettings: !0
  13821.     }
  13822.   })
  13823. }),
  13824. define('core/templates/postMediaInlineLink', [
  13825.   'handlebars',
  13826.   'core/templates/handlebars.partials',
  13827.   'core/extensions/handlebars.helpers'
  13828. ], function (a) {
  13829.   return a.template({
  13830.     1: function (a, b, c, d, e) {
  13831.       var f;
  13832.       return null != (f = c['if'].call(null != b ? b : a.nullContext || {
  13833.       }, null != b ? b.hasUserText : b, {
  13834.         name: 'if',
  13835.         hash: {
  13836.         },
  13837.         fn: a.program(2, e, 0),
  13838.         inverse: a.noop,
  13839.         data: e,
  13840.         loc: {
  13841.           start: {
  13842.             line: 2,
  13843.             column: 0
  13844.           },
  13845.           end: {
  13846.             line: 5,
  13847.             column: 7
  13848.           }
  13849.         }
  13850.       })) ? f : ''
  13851.     },
  13852.     2: function (a, b, c, d, e) {
  13853.       var f = a.lambda,
  13854.       g = a.escapeExpression;
  13855.       return '<a href="' + g(f(null != b ? b.href : b, b)) + '" rel="nofollow">' + g(f(null != b ? b.text : b, b)) + '</a>\n'
  13856.     },
  13857.     4: function (a, b, c, d, e) {
  13858.       var f,
  13859.       g = a.lambda,
  13860.       h = a.escapeExpression,
  13861.       i = null != b ? b : a.nullContext || {
  13862.       };
  13863.       return '<a href="' + h(g(null != b ? b.href : b, b)) + '" class="post-media-link" data-action="expand-collapse-media" rel="nofollow">' + (null != (f = c['if'].call(i, null != (f = null != b ? b.model : b) ? f.providerIcon : f, {
  13864.         name: 'if',
  13865.         hash: {
  13866.         },
  13867.         fn: a.program(5, e, 0),
  13868.         inverse: a.noop,
  13869.         data: e,
  13870.         loc: {
  13871.           start: {
  13872.             line: 10,
  13873.             column: 3
  13874.           },
  13875.           end: {
  13876.             line: 10,
  13877.             column: 74
  13878.           }
  13879.         }
  13880.       })) ? f : '') + h(g(null != b ? b.mediaLinkText : b, b)) + (null != (f = c['if'].call(i, null != b ? b.domain : b, {
  13881.         name: 'if',
  13882.         hash: {
  13883.         },
  13884.         fn: a.program(7, e, 0),
  13885.         inverse: a.noop,
  13886.         data: e,
  13887.         loc: {
  13888.           start: {
  13889.             line: 14,
  13890.             column: 3
  13891.           },
  13892.           end: {
  13893.             line: 14,
  13894.             column: 87
  13895.           }
  13896.         }
  13897.       })) ? f : '') + '</a>\n'
  13898.     },
  13899.     5: function (a, b, c, d, e) {
  13900.       var f;
  13901.       return '<i class="' + a.escapeExpression(a.lambda(null != (f = null != b ? b.model : b) ? f.providerIcon : f, b)) + '"></i>'
  13902.     },
  13903.     7: function (a, b, c, d, e) {
  13904.       return '<span class="post-media-link-domain"> &mdash; ' + a.escapeExpression(a.lambda(null != b ? b.domain : b, b)) + '</span>'
  13905.     },
  13906.     compiler: [
  13907.       8,
  13908.       '>= 4.3.0'
  13909.     ],
  13910.     main: function (a, b, c, d, e) {
  13911.       var f;
  13912.       return null != (f = c['if'].call(null != b ? b : a.nullContext || {
  13913.       }, null != (f = null != b ? b.model : b) ? f.deferred : f, {
  13914.         name: 'if',
  13915.         hash: {
  13916.         },
  13917.         fn: a.program(1, e, 0),
  13918.         inverse: a.program(4, e, 0),
  13919.         data: e,
  13920.         loc: {
  13921.           start: {
  13922.             line: 1,
  13923.             column: 0
  13924.           },
  13925.           end: {
  13926.             line: 16,
  13927.             column: 7
  13928.           }
  13929.         }
  13930.       })) ? f : ''
  13931.     },
  13932.     useData: !0
  13933.   })
  13934. }),
  13935. define('core/views/RichMediaLinkView', [
  13936.   'backbone',
  13937.   'core/utils',
  13938.   'core/templates/postMediaInlineLink'
  13939. ], function (a, b, c) {
  13940.   'use strict';
  13941.   return a.View.extend({
  13942.     tagName: 'span',
  13943.     events: {
  13944.       'click [data-action=expand-collapse-media]': 'handleToggle'
  13945.     },
  13946.     initialize: function (a) {
  13947.       this.media = a.media;
  13948.       var c = a.$link;
  13949.       this.linkText = c.text(),
  13950.       this.linkHref = c.attr('href'),
  13951.       this.linkDomain = b.getDomain(this.linkHref),
  13952.       this.linkHasUserText = this.isUserText(c),
  13953.       this.hasGenericMessage = !1,
  13954.       this.linkHasUserText ? this.mediaLinkText = this.linkText : this.media.get('title') ? this.mediaLinkText = b.niceTruncate(this.media.get('title'), 60) : (this.hasGenericMessage = !0, this.mediaLinkText = this.model.get('providerExpandMessage')),
  13955.       this.listenTo(this.model, 'change:deferred', this.render),
  13956.       this.listenTo(this.model, 'change:activated', this.onChangeActivated)
  13957.     },
  13958.     isUserText: function (a) {
  13959.       if ('A' !== a[0].nodeName) return !1;
  13960.       var b = (a.text() || '').toLowerCase();
  13961.       if (!b) return !1;
  13962.       if (0 === b.indexOf('http') || 0 === b.indexOf('www')) return !1;
  13963.       b = b.replace(/\.\.\.$/, '');
  13964.       var c = (a.attr('href') || '').toLowerCase();
  13965.       return c.indexOf(b) === - 1
  13966.     },
  13967.     render: function () {
  13968.       var a = this.mediaLinkText;
  13969.       return this.hasGenericMessage && this.model.get('activated') && (a = this.model.get('providerCollapseMessage')),
  13970.       this.$el.html(c({
  13971.         model: this.model.toJSON(),
  13972.         text: this.linkText,
  13973.         href: this.linkHref,
  13974.         mediaLinkText: a,
  13975.         domain: this.linkDomain,
  13976.         hasUserText: this.linkHasUserText
  13977.       })),
  13978.       this
  13979.     },
  13980.     onChangeActivated: function () {
  13981.       this.hasGenericMessage && this.render()
  13982.     },
  13983.     handleToggle: function (a) {
  13984.       this.model.get('deferred') || (this.model.set('activated', !this.model.get('activated')), a && a.preventDefault && a.preventDefault())
  13985.     }
  13986.   })
  13987. }),
  13988. define('core/templates/postMedia', [
  13989.   'handlebars',
  13990.   'core/templates/handlebars.partials',
  13991.   'core/extensions/handlebars.helpers'
  13992. ], function (a) {
  13993.   return a.template({
  13994.     1: function (a, b, c, d, e) {
  13995.       var f;
  13996.       return (null != (f = c['if'].call(null != b ? b : a.nullContext || {
  13997.       }, null != (f = null != b ? b.media : b) ? f.providerName : f, {
  13998.         name: 'if',
  13999.         hash: {
  14000.         },
  14001.         fn: a.program(2, e, 0),
  14002.         inverse: a.noop,
  14003.         data: e,
  14004.         loc: {
  14005.           start: {
  14006.             line: 5,
  14007.             column: 26
  14008.           },
  14009.           end: {
  14010.             line: 5,
  14011.             column: 90
  14012.           }
  14013.         }
  14014.       })) ? f : '') + a.escapeExpression(a.lambda(null != (f = null != b ? b.media : b) ? f.title : f, b))
  14015.     },
  14016.     2: function (a, b, c, d, e) {
  14017.       var f;
  14018.       return a.escapeExpression(a.lambda(null != (f = null != b ? b.media : b) ? f.providerName : f, b)) + ' &ndash; '
  14019.     },
  14020.     4: function (a, b, c, d, e) {
  14021.       var f;
  14022.       return '<i class="' + a.escapeExpression(a.lambda(null != (f = null != b ? b.model : b) ? f.providerIcon : f, b)) + ' publisher-background-color"></i>'
  14023.     },
  14024.     6: function (a, b, c, d, e) {
  14025.       return 'media-video'
  14026.     },
  14027.     compiler: [
  14028.       8,
  14029.       '>= 4.3.0'
  14030.     ],
  14031.     main: function (a, b, c, d, e) {
  14032.       var f,
  14033.       g = a.lambda,
  14034.       h = a.escapeExpression,
  14035.       i = null != b ? b : a.nullContext || {
  14036.       };
  14037.       return '\n<a class="media-button media-button-expand publisher-color publisher-border-color" href="' + h(g(null != (f = null != b ? b.media : b) ? f.url : f, b)) + '" rel="nofollow" target="_blank" data-action="expand"\ntitle="' + (null != (f = c['if'].call(i, null != (f = null != b ? b.media : b) ? f.title : f, {
  14038.         name: 'if',
  14039.         hash: {
  14040.         },
  14041.         fn: a.program(1, e, 0),
  14042.         inverse: a.noop,
  14043.         data: e,
  14044.         loc: {
  14045.           start: {
  14046.             line: 5,
  14047.             column: 7
  14048.           },
  14049.           end: {
  14050.             line: 5,
  14051.             column: 112
  14052.           }
  14053.         }
  14054.       })) ? f : '') + '">\n' + (null != (f = c['if'].call(i, null != (f = null != b ? b.model : b) ? f.providerIcon : f, {
  14055.         name: 'if',
  14056.         hash: {
  14057.         },
  14058.         fn: a.program(4, e, 0),
  14059.         inverse: a.noop,
  14060.         data: e,
  14061.         loc: {
  14062.           start: {
  14063.             line: 6,
  14064.             column: 0
  14065.           },
  14066.           end: {
  14067.             line: 6,
  14068.             column: 98
  14069.           }
  14070.         }
  14071.       })) ? f : '') + '\n' + h(g(null != (f = null != b ? b.model : b) ? f.providerExpandMessage : f, b)) + '\n</a>\n<a class="media-button media-button-contract publisher-color publisher-border-color" href="#" target="_blank" data-action="contract">\n<i class="icon-cancel publisher-background-color"></i> ' + h(g(null != (f = null != b ? b.model : b) ? f.providerCollapseMessage : f, b)) + '\n</a>\n<div class="media-content-loader" data-role="content-loader"></div>\n<div data-role="content-placeholder" class="media-content-placeholder media-' + h(g(null != (f = null != b ? b.media : b) ? f.providerName : f, b)) + ' ' + (null != (f = c['if'].call(i, null != b ? b.isVideo : b, {
  14072.         name: 'if',
  14073.         hash: {
  14074.         },
  14075.         fn: a.program(6, e, 0),
  14076.         inverse: a.noop,
  14077.         data: e,
  14078.         loc: {
  14079.           start: {
  14080.             line: 15,
  14081.             column: 99
  14082.           },
  14083.           end: {
  14084.             line: 15,
  14085.             column: 132
  14086.           }
  14087.         }
  14088.       })) ? f : '') + '"></div>\n'
  14089.     },
  14090.     useData: !0
  14091.   })
  14092. }),
  14093. define('core/templates/postMediaPlaceholder', [
  14094.   'handlebars',
  14095.   'core/templates/handlebars.partials',
  14096.   'core/extensions/handlebars.helpers'
  14097. ], function (a) {
  14098.   return a.template({
  14099.     compiler: [
  14100.       8,
  14101.       '>= 4.3.0'
  14102.     ],
  14103.     main: function (a, b, c, d, e) {
  14104.       var f;
  14105.       return '<a href="#" class="media-force-load" data-action="force-load"><i class="' + a.escapeExpression(a.lambda(null != (f = null != b ? b.model : b) ? f.providerIcon : f, b)) + '"></i></a>\n'
  14106.     },
  14107.     useData: !0
  14108.   })
  14109. }),
  14110. define('core/constants/mediaTypeConstants', [
  14111.   'exports'
  14112. ], function (a) {
  14113.   'use strict';
  14114.   a.VIDEO_CODES = [
  14115.     '3',
  14116.     '9',
  14117.     '12',
  14118.     '14'
  14119.   ]
  14120. }),
  14121. define('core/views/RichMediaView', [
  14122.   'jquery',
  14123.   'underscore',
  14124.   'backbone',
  14125.   'core/utils',
  14126.   'core/mediaConfig',
  14127.   'core/views/RichMediaLinkView',
  14128.   'core/templates/postMedia',
  14129.   'core/templates/postMediaPlaceholder',
  14130.   'core/constants/mediaTypeConstants'
  14131. ], function (a, b, c, d, e, f, g, h, i) {
  14132.   'use strict';
  14133.   var j = d.preventDefaultHandler,
  14134.   k = function (a, b, c, d) {
  14135.     a[b.get(c) ? 'addClass' : 'removeClass'](d)
  14136.   };
  14137.   return c.View.extend({
  14138.     className: 'media-container',
  14139.     events: {
  14140.       'click [data-action=expand]': 'handleExpand',
  14141.       'click [data-action=contract]': 'handleContract',
  14142.       'click [data-action=force-load]': 'handleForceLoad'
  14143.     },
  14144.     template: g,
  14145.     initialize: function (a) {
  14146.       this.options = a,
  14147.       this.media = a.media,
  14148.       this.template = a.template || this.template,
  14149.       this.$linkEl = null,
  14150.       this.setupMode(),
  14151.       this.listenTo(this.model, 'change:activated', this.applyState),
  14152.       this.listenTo(this.model, 'change:deferredHeight', this.onChangeDeferredHeight),
  14153.       this.listenTo(this.model, 'change:showButtons', this.updateElementClass),
  14154.       this.listenTo(this.model, 'change:deferred', this.render),
  14155.       this.listenTo(e, 'change:collapsed', this.setupMode)
  14156.     },
  14157.     getMediaDimensions: function () {
  14158.       return {
  14159.         width: null,
  14160.         height: null
  14161.       }
  14162.     },
  14163.     getAvailableWidth: function () {
  14164.       return this.$el.parent().width() || e.get('loadedThumbnailWidth')
  14165.     },
  14166.     updateDeferredHeight: function () {
  14167.       this.model.set('deferredHeight', this.calculateDeferredHeight())
  14168.     },
  14169.     calculateDeferredHeight: function () {
  14170.       var a = this.getMediaDimensions(),
  14171.       b = a.width,
  14172.       c = a.height;
  14173.       if (!b || !c) return c;
  14174.       var d = this.getAvailableWidth(),
  14175.       e = d * c / b;
  14176.       return e
  14177.     },
  14178.     convertToButton: function (a) {
  14179.       this.model.set('showButtons', !1),
  14180.       this.linkSubview && this.linkSubview.remove(),
  14181.       this.linkSubview = new f({
  14182.         model: this.model,
  14183.         media: this.media,
  14184.         $link: a
  14185.       }),
  14186.       a.replaceWith(this.linkSubview.$el),
  14187.       this.linkSubview.render()
  14188.     },
  14189.     applyContentNodeHeight: function (a) {
  14190.       this.contentNode.height(a || 'auto')
  14191.     },
  14192.     shouldAutoplay: function () {
  14193.       return !this.model.get('deferred')
  14194.     },
  14195.     generateContentHtml: function () {
  14196.       return this.media.get('html')
  14197.     },
  14198.     createContentNode: function (b) {
  14199.       return a(b)
  14200.     },
  14201.     insertContentNode: function (a) {
  14202.       this.contentNode.html(a)
  14203.     },
  14204.     prepareElementEvents: function () {
  14205.     },
  14206.     displayContent: function () {
  14207.       this.updateDeferredHeight();
  14208.       var a = this.generateContentHtml(),
  14209.       b = this.createContentNode(a);
  14210.       this.prepareElementEvents(b),
  14211.       this.insertContentNode(b),
  14212.       this.applyContentNodeHeight(null)
  14213.     },
  14214.     configureDeferred: function () {
  14215.       this.enterViewport()
  14216.     },
  14217.     configureContentFromActivated: function () {
  14218.       this.model.get('activated') ? this.displayContent() : this.displayPlaceholder()
  14219.     },
  14220.     displayPlaceholder: function () {
  14221.       this.contentNode.html(h({
  14222.         model: this.model.toJSON()
  14223.       }))
  14224.     },
  14225.     updateElementClass: function () {
  14226.       var a = this.$el,
  14227.       b = this.model;
  14228.       k(a, b, 'deferred', 'media-mode-deferred'),
  14229.       k(a, b, 'activated', 'media-activated'),
  14230.       k(a, b, 'showButtons', 'media-show-buttons')
  14231.     },
  14232.     applyState: function () {
  14233.       this.configureDeferred(),
  14234.       this.configureContentFromActivated(),
  14235.       this.updateElementClass()
  14236.     },
  14237.     render: function () {
  14238.       return this.$el.html(this.template({
  14239.         model: this.model.toJSON(),
  14240.         media: this.media.toJSON(),
  14241.         isVideo: b.contains(i.VIDEO_CODES, this.media.get('mediaType'))
  14242.       })),
  14243.       this.contentNode = this.$el.find('[data-role=content-placeholder]'),
  14244.       this.applyState(),
  14245.       this
  14246.     },
  14247.     remove: function () {
  14248.       this.linkSubview && this.linkSubview.remove(),
  14249.       c.View.prototype.remove.apply(this, arguments)
  14250.     },
  14251.     enterViewport: function () {
  14252.       this.model.get('deferred') && this.activate()
  14253.     },
  14254.     activate: function () {
  14255.       this.model.set('activated', !0)
  14256.     },
  14257.     setupMode: function () {
  14258.       if (this.model.get('respectSettings')) {
  14259.         this.model.set('activated', !1);
  14260.         var a = e.get('collapsed');
  14261.         a ? this.model.set('deferred', !1) : this.model.set('deferred', !0)
  14262.       }
  14263.     },
  14264.     onChangeDeferredHeight: function () {
  14265.       this.model.get('deferred') && !this.model.get('activated') && this.applyContentNodeHeight(this.model.get('deferredHeight'))
  14266.     },
  14267.     handleExpand: j(function () {
  14268.       this.model.set('activated', !0)
  14269.     }),
  14270.     handleContract: j(function () {
  14271.       this.model.set('activated', !1)
  14272.     }),
  14273.     handleForceLoad: j(function () {
  14274.       this.model.get('deferred') && this.model.set('activated', !0)
  14275.     })
  14276.   })
  14277. }),
  14278. define('core/templates/postMediaImage', [
  14279.   'handlebars',
  14280.   'core/templates/handlebars.partials',
  14281.   'core/extensions/handlebars.helpers'
  14282. ], function (a) {
  14283.   return a.template({
  14284.     1: function (a, b, c, d, e) {
  14285.       return '<video src="' + a.escapeExpression(a.lambda(null != b ? b.thumbnailUrl : b, b)) + '" autoplay muted loop></video>\n'
  14286.     },
  14287.     3: function (a, b, c, d, e) {
  14288.       var f,
  14289.       g = a.escapeExpression,
  14290.       h = null != b ? b : a.nullContext || {
  14291.       };
  14292.       return '<img src="' + g(a.lambda(null != b ? b.thumbnailUrl : b, b)) + '" alt="' + g(c.gettext.call(h, 'Thumbnail', {
  14293.         name: 'gettext',
  14294.         hash: {
  14295.         },
  14296.         data: e,
  14297.         loc: {
  14298.           start: {
  14299.             line: 6,
  14300.             column: 33
  14301.           },
  14302.           end: {
  14303.             line: 6,
  14304.             column: 56
  14305.           }
  14306.         }
  14307.       })) + '" ' + (null != (f = c['if'].call(h, null != (f = null != b ? b.model : b) ? f.deferredHeight : f, {
  14308.         name: 'if',
  14309.         hash: {
  14310.         },
  14311.         fn: a.program(4, e, 0),
  14312.         inverse: a.noop,
  14313.         data: e,
  14314.         loc: {
  14315.           start: {
  14316.             line: 6,
  14317.             column: 58
  14318.           },
  14319.           end: {
  14320.             line: 6,
  14321.             column: 128
  14322.           }
  14323.         }
  14324.       })) ? f : '') + '>\n'
  14325.     },
  14326.     4: function (a, b, c, d, e) {
  14327.       var f;
  14328.       return ' height="' + a.escapeExpression(a.lambda(null != (f = null != b ? b.model : b) ? f.deferredHeight : f, b)) + '" '
  14329.     },
  14330.     compiler: [
  14331.       8,
  14332.       '>= 4.3.0'
  14333.     ],
  14334.     main: function (a, b, c, d, e) {
  14335.       var f;
  14336.       return '<a href="' + a.escapeExpression(a.lambda(null != b ? b.imageUrl : b, b)) + '" target="_blank" rel="nofollow">\n' + (null != (f = c['if'].call(null != b ? b : a.nullContext || {
  14337.       }, null != b ? b.isVideo : b, {
  14338.         name: 'if',
  14339.         hash: {
  14340.         },
  14341.         fn: a.program(1, e, 0),
  14342.         inverse: a.program(3, e, 0),
  14343.         data: e,
  14344.         loc: {
  14345.           start: {
  14346.             line: 3,
  14347.             column: 0
  14348.           },
  14349.           end: {
  14350.             line: 7,
  14351.             column: 8
  14352.           }
  14353.         }
  14354.       })) ? f : '') + '</a>\n'
  14355.     },
  14356.     useData: !0
  14357.   })
  14358. }),
  14359. define('core/views/ImageRichMediaView', [
  14360.   'core/views/RichMediaView',
  14361.   'core/models/Media',
  14362.   'core/utils',
  14363.   'core/config',
  14364.   'core/mediaConfig',
  14365.   'core/templates/postMediaImage'
  14366. ], function (a, b, c, d, e, f) {
  14367.   'use strict';
  14368.   var g = new RegExp('(^|\\.)' + c.getDomain(d.urls.media).split('.').slice( - 2).join('\\.') + '$');
  14369.   return a.extend({
  14370.     getMediaDimensions: function () {
  14371.       return {
  14372.         width: this.media.get('thumbnailWidth'),
  14373.         height: this.media.get('thumbnailHeight')
  14374.       }
  14375.     },
  14376.     getImageUrl: function () {
  14377.       return this.media.get('resolvedUrlRedirect') || this.media.get('urlRedirect') || this.media.get('thumbnailUrl')
  14378.     },
  14379.     getImageThumbnailUrl: function () {
  14380.       var a = this.media.get('thumbnailUrl');
  14381.       return this.constructor.isOnDisqusCDN(a) && !this.isVideo() && (a = c.serialize(a, {
  14382.         w: e.get('loadedThumbnailWidth'),
  14383.         h: this.model.get('deferredHeight')
  14384.       })),
  14385.       a
  14386.     },
  14387.     isVideo: function () {
  14388.       return this.media.get('mediaType') === b.MEDIA_TYPES.MP4_VIDEO
  14389.     },
  14390.     generateContentHtml: function () {
  14391.       return f({
  14392.         model: this.model.toJSON(),
  14393.         media: this.media.toJSON(),
  14394.         thumbnailUrl: this.getImageThumbnailUrl(),
  14395.         imageUrl: this.getImageUrl(),
  14396.         isVideo: this.isVideo()
  14397.       })
  14398.     },
  14399.     prepareElementEvents: function (a) {
  14400.       var b = this,
  14401.       c = a.find('img');
  14402.       c.on('load.richMediaView error.richMediaView', function (a) {
  14403.         b.trigger(a.type),
  14404.         c.off('.richMediaView')
  14405.       })
  14406.     },
  14407.     calculateDeferredHeight: function () {
  14408.       var b = Math.floor(a.prototype.calculateDeferredHeight.apply(this, arguments)),
  14409.       c = this.getMediaDimensions().height;
  14410.       return Math.min(c, b) || null
  14411.     }
  14412.   }, {
  14413.     isOnDisqusCDN: function (a) {
  14414.       var b = c.getDomain(a);
  14415.       return g.test(b)
  14416.     }
  14417.   })
  14418. }),
  14419. define('core/views/IframeRichMediaView', [
  14420.   'underscore',
  14421.   'core/mediaConfig',
  14422.   'core/views/RichMediaView'
  14423. ], function (a, b, c) {
  14424.   'use strict';
  14425.   return c.extend({
  14426.     getMediaDimensions: function () {
  14427.       return {
  14428.         width: this.media.get('htmlWidth'),
  14429.         height: this.media.get('htmlHeight')
  14430.       }
  14431.     },
  14432.     _findIframe: function (a) {
  14433.       return a.is('iframe') ? a : a.find('iframe')
  14434.     },
  14435.     configureContentFromActivated: function () {
  14436.       c.prototype.configureContentFromActivated.apply(this, arguments),
  14437.       this.model.get('activated') || this.$el.removeClass('media-loading')
  14438.     },
  14439.     createContentNode: function () {
  14440.       var a = c.prototype.createContentNode.apply(this, arguments);
  14441.       return a.attr({
  14442.         width: '100%',
  14443.         height: this.model.get('deferredHeight')
  14444.       }),
  14445.       a
  14446.     },
  14447.     insertContentNode: function (a) {
  14448.       this.loaderNode = this.$el.find('[data-role=content-loader]'),
  14449.       this.loaderHeight = this.model.get('deferredHeight') || b.get('defaultIframeHeight'),
  14450.       this.loaderNode.height(this.loaderHeight),
  14451.       this.$el.addClass('media-loading'),
  14452.       c.prototype.insertContentNode.call(this, a)
  14453.     },
  14454.     prepareElementEvents: function (b) {
  14455.       var c = this._findIframe(b);
  14456.       c.one('load', a.bind(this.finishLoad, this, c))
  14457.     },
  14458.     finishLoad: function (a) {
  14459.       this.$el.removeClass('media-loading'),
  14460.       a.height(this.loaderHeight),
  14461.       this.trigger('load')
  14462.     }
  14463.   })
  14464. }),
  14465. define('core/views/FacebookPhotoRichMediaView', [
  14466.   'core/views/ImageRichMediaView'
  14467. ], function (a) {
  14468.   'use strict';
  14469.   return a.extend({
  14470.     getImageThumbnailUrl: function () {
  14471.       return this.media.get('metadata').imageUrl || a.prototype.getImageThumbnailUrl.call(this)
  14472.     }
  14473.   })
  14474. }),
  14475. define('core/views/AutoplayRichMediaView', [
  14476.   'underscore',
  14477.   'jquery',
  14478.   'core/utils',
  14479.   'core/views/IframeRichMediaView'
  14480. ], function (a, b, c, d) {
  14481.   'use strict';
  14482.   return d.extend({
  14483.     createContentNode: function () {
  14484.       var a = d.prototype.createContentNode.apply(this, arguments),
  14485.       b = a.attr('src');
  14486.       return this.shouldAutoplay() && b && !this.model.get('playerjs') && (b = c.serialize(b, {
  14487.         auto_play: !0,
  14488.         autoplay: 1
  14489.       }), a.attr('src', b)),
  14490.       a
  14491.     },
  14492.     insertContentNode: function (c) {
  14493.       if (this.model.get('playerjs')) {
  14494.         var e = this._findIframe(c),
  14495.         f = e.attr('src');
  14496.         '//' === f.substr(0, 2) && (f = window.location.protocol + f);
  14497.         var g = f.split('/');
  14498.         g = g[0] + '//' + g[2],
  14499.         this.playerjs = {
  14500.           ready: !1,
  14501.           queue: [
  14502.           ],
  14503.           origin: g,
  14504.           $iframe: e
  14505.         },
  14506.         this.model.get('mute') && this.send('mute'),
  14507.         this.shouldAutoplay() && this.send('play');
  14508.         var h = a.once(a.bind(function () {
  14509.           this.playerjs.ready = !0;
  14510.           var b = this.playerjs.queue;
  14511.           this.playerjs.queue = [
  14512.           ],
  14513.           a.each(b, this.send, this)
  14514.         }, this));
  14515.         b(window).on('message', function (a) {
  14516.           if (a = a.originalEvent, a.origin === g) {
  14517.             var b;
  14518.             try {
  14519.               b = JSON.parse(a.data)
  14520.             } catch (c) {
  14521.               return
  14522.             }
  14523.             'ready' === b.event && b.value && b.value.src === f && h()
  14524.           }
  14525.         })
  14526.       }
  14527.       return d.prototype.insertContentNode.apply(this, arguments)
  14528.     },
  14529.     send: function (a) {
  14530.       if (this.playerjs) {
  14531.         if (!this.playerjs.ready) return void this.playerjs.queue.push(a);
  14532.         var b = {
  14533.           context: 'player.js',
  14534.           version: '0.0.10',
  14535.           method: a
  14536.         };
  14537.         this.playerjs.$iframe[0].contentWindow.postMessage(JSON.stringify(b), this.playerjs.origin)
  14538.       }
  14539.     }
  14540.   })
  14541. }),
  14542. define('core/views/DynamicHeightRichMediaView', [
  14543.   'underscore',
  14544.   'core/views/RichMediaView'
  14545. ], function (a, b) {
  14546.   'use strict';
  14547.   return b.extend({
  14548.     insertContentNode: function () {
  14549.       b.prototype.insertContentNode.apply(this, arguments),
  14550.       this.finishLoad()
  14551.     },
  14552.     finishLoad: function () {
  14553.       var b = this,
  14554.       c = 0,
  14555.       d = 150,
  14556.       e = 20,
  14557.       f = function () {
  14558.         c += 1,
  14559.         c < e ? a.delay(f, d) : b.trigger('load')
  14560.       };
  14561.       f()
  14562.     }
  14563.   })
  14564. }),
  14565. define('core/templates/postMediaTwitterContent', [
  14566.   'handlebars',
  14567.   'core/templates/handlebars.partials',
  14568.   'core/extensions/handlebars.helpers'
  14569. ], function (a) {
  14570.   return a.template({
  14571.     compiler: [
  14572.       8,
  14573.       '>= 4.3.0'
  14574.     ],
  14575.     main: function (a, b, c, d, e) {
  14576.       var f = a.lambda,
  14577.       g = a.escapeExpression;
  14578.       return '<meta name="twitter:widgets:csp" content="on">\n<blockquote class="twitter-tweet" data-theme="' + g(f(null != b ? b.theme : b, b)) + '" data-link-color="' + g(f(null != b ? b.linkColor : b, b)) + '" lang="' + g(f(null != b ? b.language : b, b)) + '">\n<a href="' + g(f(null != b ? b.url : b, b)) + '"></a>\n</blockquote>\n<script src="//platform.twitter.com/widgets.js"></script>\n'
  14579.     },
  14580.     useData: !0
  14581.   })
  14582. }),
  14583. define('core/views/TwitterRichMediaView', [
  14584.   'underscore',
  14585.   'core/views/DynamicHeightRichMediaView',
  14586.   'core/templates/postMediaTwitterContent'
  14587. ], function (a, b, c) {
  14588.   'use strict';
  14589.   var d = b.extend({
  14590.     generateContentHtml: function () {
  14591.       var b = window.document.documentElement.lang;
  14592.       b = b && b.substring(0, 2);
  14593.       var e = this.media.get('url');
  14594.       return this.media.get('resolvedUrl').indexOf('/status') !== - 1 && (e = this.media.get('resolvedUrl')),
  14595.       c({
  14596.         url: e,
  14597.         theme: a.result(d, 'theme'),
  14598.         linkColor: a.result(d, 'linkColor'),
  14599.         language: b
  14600.       })
  14601.     }
  14602.   }, {
  14603.     theme: 'light',
  14604.     linkColor: '#2e9fff'
  14605.   });
  14606.   return d
  14607. }),
  14608. define('core/views/SoundCloudRichMediaView', [
  14609.   'core/views/AutoplayRichMediaView'
  14610. ], function (a) {
  14611.   'use strict';
  14612.   return a.extend({
  14613.     getMediaDimensions: function () {
  14614.       return {
  14615.         width: null,
  14616.         height: this.media.get('htmlHeight')
  14617.       }
  14618.     }
  14619.   })
  14620. }),
  14621. define('core/views/VineRichMediaView', [
  14622.   'core/views/AutoplayRichMediaView',
  14623.   'core/utils'
  14624. ], function (a, b) {
  14625.   'use strict';
  14626.   return a.extend({
  14627.     createContentNode: function () {
  14628.       var c = a.prototype.createContentNode.apply(this, arguments),
  14629.       d = c.attr('src');
  14630.       return this.shouldAutoplay() && d && (d = b.serialize(d, {
  14631.         audio: 1
  14632.       }), c.attr('src', d)),
  14633.       c
  14634.     }
  14635.   })
  14636. }),
  14637. define('core/views/IframeGifRichMediaView', [
  14638.   'core/views/IframeRichMediaView'
  14639. ], function (a) {
  14640.   'use strict';
  14641.   return a.extend({
  14642.     insertContentNode: function (b) {
  14643.       a.prototype.insertContentNode.call(this, b),
  14644.       this.loaderNode.width(this.getMediaDimensions().width)
  14645.     },
  14646.     createContentNode: function () {
  14647.       var b = a.prototype.createContentNode.apply(this, arguments);
  14648.       return b.attr(this.getMediaDimensions()),
  14649.       b
  14650.     },
  14651.     calculateDeferredHeight: function () {
  14652.       return this.getMediaDimensions().height
  14653.     },
  14654.     displayPlaceholder: function () {
  14655.       a.prototype.displayPlaceholder.call(this);
  14656.       var b = this.getMediaDimensions();
  14657.       this.contentNode.height(b.height).width(b.width)
  14658.     }
  14659.   })
  14660. }),
  14661. define('core/media', [
  14662.   'underscore',
  14663.   'core/strings',
  14664.   'core/models/Media',
  14665.   'core/models/RichMediaViewModel',
  14666.   'core/views/ImageRichMediaView',
  14667.   'core/views/IframeRichMediaView',
  14668.   'core/views/FacebookPhotoRichMediaView',
  14669.   'core/views/AutoplayRichMediaView',
  14670.   'core/views/TwitterRichMediaView',
  14671.   'core/views/SoundCloudRichMediaView',
  14672.   'core/views/VineRichMediaView',
  14673.   'core/views/IframeGifRichMediaView'
  14674. ], function (a, b, c, d, e, f, g, h, i, j, k, l) {
  14675.   'use strict';
  14676.   var m = b.get,
  14677.   n = {
  14678.     PLAY_HIDE: {
  14679.       kind: 'html',
  14680.       providerExpandMessage: m('Play'),
  14681.       providerCollapseMessage: m('Hide')
  14682.     },
  14683.     VIEW_HIDE: {
  14684.       kind: 'html',
  14685.       providerExpandMessage: m('View'),
  14686.       providerCollapseMessage: m('Hide')
  14687.     },
  14688.     VIEW_IMAGE: {
  14689.       kind: 'image',
  14690.       providerIcon: 'icon-images',
  14691.       providerExpandMessage: m('View'),
  14692.       providerCollapseMessage: m('Hide')
  14693.     }
  14694.   },
  14695.   o = function (b) {
  14696.     var m = function (b, c) {
  14697.       return a.defaults({
  14698.         providerIcon: c
  14699.       }, n[b])
  14700.     },
  14701.     o = null,
  14702.     p = null,
  14703.     q = c.MEDIA_TYPES;
  14704.     switch (b.get('mediaType')) {
  14705.       case q.IMAGE:
  14706.       case q.IMAGE_UPLOAD:
  14707.       case q.MP4_VIDEO:
  14708.         o = n.VIEW_IMAGE;
  14709.         break;
  14710.       case q.FACEBOOK_PHOTO:
  14711.         p = g,
  14712.         o = n.VIEW_IMAGE;
  14713.         break;
  14714.       case q.GIF_VIDEO:
  14715.         p = l,
  14716.         o = n.VIEW_HIDE;
  14717.         break;
  14718.       case q.VIMEO_VIDEO:
  14719.       case q.YOUTUBE_VIDEO:
  14720.         p = h,
  14721.         o = m('PLAY_HIDE', 'icon-video');
  14722.         break;
  14723.       case q.TWITTER_STATUS:
  14724.         p = i,
  14725.         o = m('VIEW_HIDE', 'icon-twitter-x');
  14726.         break;
  14727.       case q.VINE_VIDEO:
  14728.         p = k,
  14729.         o = m('PLAY_HIDE', 'icon-video');
  14730.         break;
  14731.       case q.FACEBOOK_VIDEO:
  14732.         o = m('VIEW_HIDE', 'icon-video');
  14733.         break;
  14734.       case q.SOUNDCLOUD_SOUND:
  14735.         p = j,
  14736.         o = m('PLAY_HIDE', 'icon-music');
  14737.         break;
  14738.       case q.GOOGLE_MAP:
  14739.         o = m('VIEW_HIDE', 'icon-map');
  14740.         break;
  14741.       default:
  14742.         return null
  14743.     }
  14744.     if (null === p) switch (o.kind) {
  14745.       case 'webpage':
  14746.         return null;
  14747.       case 'html':
  14748.         p = f;
  14749.         break;
  14750.       case 'image':
  14751.         p = e
  14752.     }
  14753.     var r = new d(o);
  14754.     return {
  14755.       Cls: p,
  14756.       mediaViewModel: r
  14757.     }
  14758.   },
  14759.   p = function (a) {
  14760.     var b = o(a);
  14761.     return b ? new b.Cls({
  14762.       model: b.mediaViewModel,
  14763.       media: a
  14764.     }) : null
  14765.   },
  14766.   q = function (a) {
  14767.     return new e({
  14768.       model: new d(n.VIEW_IMAGE),
  14769.       media: a
  14770.     })
  14771.   };
  14772.   return {
  14773.     instantiateRichMediaView: p,
  14774.     instantiateRichMediaThumbnail: q,
  14775.     getRichMediaViewConfig: o
  14776.   }
  14777. }),
  14778. define('core/mixins/withRichMedia', [
  14779.   'underscore',
  14780.   'jquery',
  14781.   'core/collections/MediaCollection',
  14782.   'core/media'
  14783. ], function (a, b, c, d) {
  14784.   'use strict';
  14785.   function e(a) {
  14786.     var c = {
  14787.     };
  14788.     return a.length ? (a.find('a').each(function (a, d) {
  14789.       var e = d.href;
  14790.       c[e] || (c[e] = b(d))
  14791.     }), c) : c
  14792.   }
  14793.   function f() {
  14794.     a.extend(this, g)
  14795.   }
  14796.   var g = {
  14797.     renderRichMedia: function (a, f, g) {
  14798.       return g = g || {
  14799.       },
  14800.       a = a instanceof c ? a : new c(a),
  14801.       a.chain().map(function (a) {
  14802.         return d.instantiateRichMediaView(a)
  14803.       }).without(null).map(function (a) {
  14804.         var c = a.media.get('urlRedirect');
  14805.         g.normalize && (c = g.normalize.call(this, c));
  14806.         var d = e(this.$('[data-role=message]')),
  14807.         h = d[c];
  14808.         return g.beforeRender && g.beforeRender.call(this, a),
  14809.         a.render(),
  14810.         h ? g.convertLinkToButton ? (h.after(a.$el), a.convertToButton(h)) : h.replaceWith(a.$el) : (f = f || this.$('[data-role=post-media-list]'), f.append(b('<li>').append(a.$el))),
  14811.         a
  14812.       }, this).value()
  14813.     }
  14814.   };
  14815.   return f
  14816. }),
  14817. define('core/views/common/HoverCard', [
  14818.   'jquery',
  14819.   'underscore',
  14820.   'backbone',
  14821.   'core/bus'
  14822. ], function (a, b, c, d) {
  14823.   'use strict';
  14824.   var e = c.View.extend({
  14825.     events: {
  14826.       mouseenter: 'enter',
  14827.       mouseleave: 'leave'
  14828.     },
  14829.     initialize: function () {
  14830.       this._id = b.uniqueId(),
  14831.       this._rendered = !1,
  14832.       this._hoverState = 'out',
  14833.       this._visible = !1,
  14834.       this._enterTimeout = null,
  14835.       this._leaveTimeout = null,
  14836.       e.open = {
  14837.       },
  14838.       this.events = this.events || {
  14839.       },
  14840.       this.events['click [data-action=profile]'] = 'handleShowProfile',
  14841.       this.listenTo(this, 'authenticating', this.keepOpen)
  14842.     },
  14843.     render: function () {
  14844.       return this.hide(),
  14845.       a('body').append(this.el),
  14846.       this
  14847.     },
  14848.     target: function (a) {
  14849.       a.on('mouseenter', b.bind(this.enter, this, a)),
  14850.       a.on('mouseleave', b.bind(this.leave, this))
  14851.     },
  14852.     enter: function (a) {
  14853.       var c = this;
  14854.       a.originalEvent && (a = null),
  14855.       a && (c.$target = a),
  14856.       c._leaveTimeout && clearTimeout(c._leaveTimeout),
  14857.       'in' !== c._hoverState && (c._hoverState = 'in', c._enterTimeout = b.delay(function () {
  14858.         'in' === c._hoverState && c.show(),
  14859.         c._enterTimeout = null
  14860.       }, e.DELAY_ENTER), e.open[this.uid] = this)
  14861.     },
  14862.     leave: function () {
  14863.       var a = this;
  14864.       a._enterTimeout && clearTimeout(a._enterTimeout),
  14865.       'out' !== a._hoverState && (a._hoverState = 'out', a._leaveTimeout = b.delay(function () {
  14866.         'out' === a._hoverState && a.hide(),
  14867.         a._leaveTimeout = null;
  14868.       }, e.DELAY_LEAVE), e.open[this.uid] && delete e.open[this.uid])
  14869.     },
  14870.     show: function () {
  14871.       var a = this;
  14872.       a._rendered || (a._rendered = !0, a.render()),
  14873.       a.moveTo(a.$target),
  14874.       a.$el.show(),
  14875.       a._visible = !0,
  14876.       a.trigger('show')
  14877.     },
  14878.     moveTo: function (a) {
  14879.       if (a) {
  14880.         var b = e.POSITION_OFFSET,
  14881.         c = a.offset(),
  14882.         d = this.$el,
  14883.         f = d.height(),
  14884.         g = this.getContainerPosition();
  14885.         c.top -= b;
  14886.         var h = c.top + f + g.containerOffset.top,
  14887.         i = g.pageOffset + g.containerHeight;
  14888.         h <= i ? d.css('top', c.top) : d.css('top', c.top - f + 2 * b),
  14889.         d.css('left', c.left + b)
  14890.       }
  14891.     },
  14892.     getContainerPosition: function () {
  14893.       return {
  14894.         pageOffset: a(window).scrollTop(),
  14895.         containerOffset: {
  14896.           top: 0,
  14897.           height: a(window).height()
  14898.         },
  14899.         containerHeight: a(window).height()
  14900.       }
  14901.     },
  14902.     hide: function () {
  14903.       this._keepOpen || (this._enterTimeout && clearTimeout(this._enterTimeout), this.$el.hide(), this._visible = !1)
  14904.     },
  14905.     keepOpen: function () {
  14906.       this._keepOpen = !0,
  14907.       this.setupKeepOpenCanceler()
  14908.     },
  14909.     setupKeepOpenCanceler: function () {
  14910.       var c = this,
  14911.       e = function () {
  14912.         'out' === c._hoverState && (c.stopListening(d, 'window.click', e), a('body').off('click', e), c._keepOpen = !1, c.hide())
  14913.       };
  14914.       b.delay(function () {
  14915.         c.listenTo(d, 'window.click', e),
  14916.         a('body').on('click', e)
  14917.       }, 100)
  14918.     },
  14919.     isVisible: function () {
  14920.       return this._visible
  14921.     },
  14922.     handleShowProfile: function () {
  14923.       this.hide()
  14924.     }
  14925.   }, {
  14926.     open: {
  14927.     },
  14928.     instances: {
  14929.     },
  14930.     DELAY_ENTER: 350,
  14931.     DELAY_LEAVE: 175,
  14932.     POSITION_OFFSET: 20,
  14933.     exitAll: function () {
  14934.       b.invoke(e.open, 'leave')
  14935.     },
  14936.     create: function (a, b, c, d) {
  14937.       var f = e.instances[c];
  14938.       f || (e.instances[c] = f = {
  14939.       });
  14940.       var g = f[a];
  14941.       return g || (g = new d(b), f[a] = g),
  14942.       b.targetElement && g.target(b.targetElement),
  14943.       g
  14944.     }
  14945.   });
  14946.   return function () {
  14947.     a(window.document).on('mouseout', b.debounce(function (a) {
  14948.       var b = a.relatedTarget || a.toElement;
  14949.       b && 'HTML' !== b.nodeName || e.exitAll()
  14950.     }, 10))
  14951.   }(),
  14952.   e
  14953. }),
  14954. define('core/utils/views', [
  14955.   'underscore'
  14956. ], function (a) {
  14957.   'use strict';
  14958.   var b = function (b, c, d) {
  14959.     var e = b.prototype,
  14960.     f = a.extend({
  14961.     }, c, d);
  14962.     if (a.defaults(e, f), a.defaults(e.events, f.events), void 0 !== e.initialize && void 0 !== f.initialize) {
  14963.       var g = e.initialize;
  14964.       e.initialize = function () {
  14965.         var a = g.apply(this, arguments);
  14966.         return f.initialize.apply(this, arguments),
  14967.         a
  14968.       }
  14969.     }
  14970.   };
  14971.   return {
  14972.     mixin: b
  14973.   }
  14974. }),
  14975. define('core/views/common/mixins/LocalScroll', [
  14976. ], function () {
  14977.   'use strict';
  14978.   var a = {
  14979.     events: {
  14980.       mousewheel: 'handleScrollEvent',
  14981.       wheel: 'handleScrollEvent'
  14982.     },
  14983.     scrollMeasureSelector: '',
  14984.     getScrollMeasure: function () {
  14985.       return this.scrollMeasure || (this.scrollMeasure = this.$el, this.scrollMeasureSelector && (this.scrollMeasure = this.$el.find(this.scrollMeasureSelector))),
  14986.       this.scrollMeasure
  14987.     },
  14988.     handleScrollEvent: function (a) {
  14989.       var b = a.originalEvent,
  14990.       c = b.wheelDeltaY || - b.deltaY,
  14991.       d = this.$el,
  14992.       e = d.height(),
  14993.       f = this.getScrollMeasure(),
  14994.       g = f.height(),
  14995.       h = f.parent() [0].scrollTop,
  14996.       i = h >= g - e,
  14997.       j = 0 === h;
  14998.       (i && c < 0 || j && c > 0) && a.preventDefault()
  14999.     }
  15000.   };
  15001.   return a
  15002. }),
  15003. define('core/templates/usersCard', [
  15004.   'handlebars',
  15005.   'core/templates/handlebars.partials',
  15006.   'core/extensions/handlebars.helpers'
  15007. ], function (a) {
  15008.   return a.template({
  15009.     1: function (a, b, c, d, e) {
  15010.       return 'guests-only'
  15011.     },
  15012.     3: function (a, b, c, d, e) {
  15013.       return 'tooltip--post-refresh'
  15014.     },
  15015.     5: function (a, b, c, d, e, f, g) {
  15016.       var h;
  15017.       return null != (h = c.each.call(null != b ? b : a.nullContext || {
  15018.       }, null != b ? b.users : b, {
  15019.         name: 'each',
  15020.         hash: {
  15021.         },
  15022.         fn: a.program(6, e, 0, f, g),
  15023.         inverse: a.noop,
  15024.         data: e,
  15025.         loc: {
  15026.           start: {
  15027.             line: 5,
  15028.             column: 0
  15029.           },
  15030.           end: {
  15031.             line: 7,
  15032.             column: 9
  15033.           }
  15034.         }
  15035.       })) ? h : ''
  15036.     },
  15037.     6: function (a, b, c, d, e, f, g) {
  15038.       var h;
  15039.       return null != (h = a.invokePartial(d.cardUser, b, {
  15040.         name: 'cardUser',
  15041.         hash: {
  15042.           isRefreshEnabled: null != g[1] ? g[1].isRefreshEnabled : g[1],
  15043.           forumId: null != g[1] ? g[1].forumId : g[1],
  15044.           highlight: null != g[1] ? g[1].highlight : g[1]
  15045.         },
  15046.         data: e,
  15047.         helpers: c,
  15048.         partials: d,
  15049.         decorators: a.decorators
  15050.       })) ? h : ''
  15051.     },
  15052.     8: function (a, b, c, d, e) {
  15053.       return 'tooltip-point--refresh'
  15054.     },
  15055.     compiler: [
  15056.       8,
  15057.       '>= 4.3.0'
  15058.     ],
  15059.     main: function (a, b, c, d, e, f, g) {
  15060.       var h,
  15061.       i = null != b ? b : a.nullContext || {
  15062.       };
  15063.       return '<div class="tooltip-wrapper">\n<div class="tooltip voters ' + (null != (h = c.unless.call(i, null != (h = null != b ? b.users : b) ? h.length : h, {
  15064.         name: 'unless',
  15065.         hash: {
  15066.         },
  15067.         fn: a.program(1, e, 0, f, g),
  15068.         inverse: a.noop,
  15069.         data: e,
  15070.         loc: {
  15071.           start: {
  15072.             line: 2,
  15073.             column: 27
  15074.           },
  15075.           end: {
  15076.             line: 2,
  15077.             column: 73
  15078.           }
  15079.         }
  15080.       })) ? h : '') + ' ' + (null != (h = c['if'].call(i, null != b ? b.isRefreshEnabled : b, {
  15081.         name: 'if',
  15082.         hash: {
  15083.         },
  15084.         fn: a.program(3, e, 0, f, g),
  15085.         inverse: a.noop,
  15086.         data: e,
  15087.         loc: {
  15088.           start: {
  15089.             line: 2,
  15090.             column: 74
  15091.           },
  15092.           end: {
  15093.             line: 2,
  15094.             column: 126
  15095.           }
  15096.         }
  15097.       })) ? h : '') + '">\n<ul class="scroll-measure" data-role="content">\n' + (null != (h = c['if'].call(i, null != (h = null != b ? b.users : b) ? h.length : h, {
  15098.         name: 'if',
  15099.         hash: {
  15100.         },
  15101.         fn: a.program(5, e, 0, f, g),
  15102.         inverse: a.noop,
  15103.         data: e,
  15104.         loc: {
  15105.           start: {
  15106.             line: 4,
  15107.             column: 0
  15108.           },
  15109.           end: {
  15110.             line: 8,
  15111.             column: 7
  15112.           }
  15113.         }
  15114.       })) ? h : '') + '</ul>\n</div>\n</div>\n<div class="tooltip-point hidden ' + (null != (h = c['if'].call(i, null != b ? b.isRefreshEnabled : b, {
  15115.         name: 'if',
  15116.         hash: {
  15117.         },
  15118.         fn: a.program(8, e, 0, f, g),
  15119.         inverse: a.noop,
  15120.         data: e,
  15121.         loc: {
  15122.           start: {
  15123.             line: 12,
  15124.             column: 33
  15125.           },
  15126.           end: {
  15127.             line: 12,
  15128.             column: 86
  15129.           }
  15130.         }
  15131.       })) ? h : '') + '"></div>\n'
  15132.     },
  15133.     usePartial: !0,
  15134.     useData: !0,
  15135.     useDepths: !0
  15136.   })
  15137. }),
  15138. define('core/views/UsersCard', [
  15139.   'jquery',
  15140.   'underscore',
  15141.   'handlebars',
  15142.   'core/config',
  15143.   'core/bus',
  15144.   'core/utils/views',
  15145.   'core/switches',
  15146.   'core/utils',
  15147.   'core/views/common/HoverCard',
  15148.   'core/views/common/mixins/LocalScroll',
  15149.   'core/templates/usersCard'
  15150. ], function (a, b, c, d, e, f, g, h, i, j, k) {
  15151.   'use strict';
  15152.   var l = function (a) {
  15153.     return a.get('isAnonymous') || a.get('isBlocked') || a.get('isBlocking')
  15154.   },
  15155.   m = i.extend({
  15156.     guestTextPartialName: 'cardOtherUserText',
  15157.     initialize: function (a) {
  15158.       this.isRefreshEnabled = a.isRefreshEnabled,
  15159.       this.$el.attr('class', this.isRefreshEnabled ? 'tooltip-outer voters-outer voters-outer--refresh' : 'tooltip-outer voters-outer'),
  15160.       i.prototype.initialize.call(this, a),
  15161.       this.collection = this.collection || a.collection,
  15162.       this.session = a.session,
  15163.       this.numUsers = a.numUsers,
  15164.       this.voteType = a.voteType,
  15165.       this.listenTo(this.collection, 'add', this.addUser),
  15166.       this.listenTo(this.collection, 'change:isBlocked', this.render),
  15167.       this.listenTo(this.collection, 'remove', this.removeUser),
  15168.       this.listenTo(this.collection, 'reset', this.render)
  15169.     },
  15170.     addUser: function (a) {
  15171.       l(a) ? this.updateGuests() : this.$listEl && this.$listEl.length && (this.$listEl.prepend(c.partials.cardUser(this.getUserTemplateData(a))), this.stopHighlightUsername())
  15172.     },
  15173.     removeUser: function (a) {
  15174.       if (l(a)) this.updateGuests();
  15175.        else {
  15176.         var b = this.$el.find('[data-username=' + a.get('username') + ']');
  15177.         b.length && b.remove()
  15178.       }
  15179.     },
  15180.     stopHighlightUsername: b.debounce(function () {
  15181.       var a = this.$el.find('.highlight');
  15182.       a.removeClass('highlight')
  15183.     }, 1100),
  15184.     getGuestCount: function () {
  15185.       return Math.max(this.numUsers - this.collection.reject(l).length, 0)
  15186.     },
  15187.     updateGuests: function () {
  15188.       var a = this.$el.find('[data-role=guest]'),
  15189.       b = this.getGuestCount(),
  15190.       e = c.partials[this.guestTextPartialName]({
  15191.         guestCount: b
  15192.       }),
  15193.       f = {
  15194.         guestCount: b,
  15195.         guestAvatarUrl: d.urls.avatar.generic,
  15196.         highlight: a.length,
  15197.         guestText: e,
  15198.         isRefreshEnabled: this.isRefreshEnabled
  15199.       },
  15200.       g = c.partials.cardGuestUser(f);
  15201.       a.length ? (a.replaceWith(g), this.stopHighlightUsername()) : this.$listEl && this.$listEl.length && this.$listEl.append(g)
  15202.     },
  15203.     getTemplateData: function () {
  15204.       var a = b.invoke(this.collection.reject(l), 'toJSON').map(function (a) {
  15205.         return a.initials = h.getInitials(a.name || ''),
  15206.         a
  15207.       });
  15208.       return {
  15209.         users: a,
  15210.         highlight: !1,
  15211.         isRefreshEnabled: this.isRefreshEnabled
  15212.       }
  15213.     },
  15214.     getUserTemplateData: function (a) {
  15215.       var c = a.toJSON();
  15216.       return c.initials = h.getInitials(c.name || ''),
  15217.       b.extend({
  15218.         highlight: !0,
  15219.         isRefreshEnabled: this.isRefreshEnabled
  15220.       }, c)
  15221.     },
  15222.     render: function () {
  15223.       delete this.pointEl,
  15224.       this.$el.html(k(this.getTemplateData())),
  15225.       i.prototype.render.call(this),
  15226.       this.$listEl = this.$el.find('.voters ul'),
  15227.       this.updateGuests()
  15228.     },
  15229.     show: function () {
  15230.       this.numUsers && !this.isVisible() && (i.prototype.show.call(this), e.trigger('uiAction:userCardShow'))
  15231.     },
  15232.     showPoint: function (a) {
  15233.       var c = [
  15234.         'tl',
  15235.         'bl'
  15236.       ],
  15237.       d = this.$el.find('.tooltip--post-refresh'),
  15238.       e = this.$el.find('.tooltip-wrapper');
  15239.       this.pointEl || (this.pointEl = this.$el.find('.tooltip-point'), this.pointEl.removeClass('hidden')),
  15240.       b.each(c, function (a) {
  15241.         this.pointEl.removeClass('point-position-' + a),
  15242.         d.removeClass('tooltip--' + a),
  15243.         e.removeClass('tooltip-wrapper--' + a)
  15244.       }, this),
  15245.       this.pointEl.addClass('point-position-' + a),
  15246.       d.addClass('tooltip--' + a),
  15247.       e.addClass('tooltip-wrapper--' + a)
  15248.     },
  15249.     moveTo: function (a, b) {
  15250.       if (a) {
  15251.         var c = i.POSITION_OFFSET,
  15252.         d = a.offset(),
  15253.         e = this.$el,
  15254.         f = e.height(),
  15255.         g = a.outerWidth(),
  15256.         h = this.getContainerPosition();
  15257.         b && (f += e.find('li.user').height() + 10),
  15258.         d.top - f - c >= 0 && d.top - f + h.containerOffset.top >= h.pageOffset ? (e.css({
  15259.           bottom: h.containerOffset.height - d.top + c,
  15260.           top: 'inherit'
  15261.         }), this.showPoint('bl')) : (e.css({
  15262.           bottom: 'inherit',
  15263.           top: d.top + 2 * c
  15264.         }), this.showPoint('tl')),
  15265.         'rtl' === window.document.documentElement.dir ? e.css('right', d.left ? h.containerOffset.width - d.left - g - c : 0) : e.css('left', d.left - c)
  15266.       }
  15267.     },
  15268.     handleShowProfile: function (b) {
  15269.       i.prototype.handleShowProfile.call(this, b);
  15270.       var c = a(b.currentTarget),
  15271.       d = c.attr('data-username');
  15272.       e.trigger('uiCallback:showProfile', d, b)
  15273.     }
  15274.   }, {
  15275.     create: function (a, b) {
  15276.       return i.create(a, b, 'UsersCard', m)
  15277.     }
  15278.   });
  15279.   return f.mixin(m, j, {
  15280.     scrollMeasureSelector: '[data-role=content]'
  15281.   }),
  15282.   m
  15283. }),
  15284. define('core/views/VotersCard', [
  15285.   'underscore',
  15286.   'core/views/common/HoverCard',
  15287.   'core/views/UsersCard',
  15288.   'core/switches',
  15289.   'core/utils'
  15290. ], function (a, b, c, d, e) {
  15291.   'use strict';
  15292.   var f = e.preventDefaultHandler,
  15293.   g = c.extend({
  15294.     guestTextPartialName: 'cardGuestVoterText',
  15295.     initialize: function (b) {
  15296.       this.voteType = b.voteType;
  15297.       var d = b.model,
  15298.       e = 1 === this.voteType ? d.getUpvotersUserCollection() : d.getDownvotersUserCollection();
  15299.       a.extend(b, {
  15300.         collection: e,
  15301.         numUsers: 1 === this.voteType ? d.get('likes') : d.get('dislikes')
  15302.       }),
  15303.       c.prototype.initialize.call(this, b),
  15304.       this.model = d,
  15305.       this.session = b.session,
  15306.       this.likes = d.get('likes'),
  15307.       this.dislikes = d.get('dislikes'),
  15308.       this.hadLikes = Boolean(this.likes),
  15309.       this.hadDislikes = Boolean(this.dislikes),
  15310.       this.isRefreshEnabled = b.isRefreshEnabled,
  15311.       this._fetched = !1,
  15312.       this._rendered = !1,
  15313.       this.listenTo(this.model, 'change:userScore', this.updateUserSet),
  15314.       1 === this.voteType ? this.listenTo(this.model, 'change:likes', this.updateGuests) : this.listenTo(this.model, 'change:dislikes', this.updateGuests)
  15315.     },
  15316.     updateGuests: function () {
  15317.       this.numUsers = (1 === this.voteType ? this.model.get('likes') : this.model.get('dislikes')) || 0,
  15318.       c.prototype.updateGuests.call(this)
  15319.     },
  15320.     updateUserSet: function () {
  15321.       var a = this.session.user,
  15322.       b = this.likes,
  15323.       c = this.dislikes,
  15324.       d = !1;
  15325.       this.likes = this.model.get('likes'),
  15326.       this.dislikes = this.model.get('dislikes'),
  15327.       this.model.get('userScore') === this.voteType ? (this.session.isLoggedIn() && this.collection.add(a), 1 === this.voteType && this.likes && !b || this.voteType === - 1 && this.dislikes && !c ? (this._rendered = !1, this.show()) : d = !!this.session.isLoggedOut() || Boolean((1 === this.voteType ? this.likes : this.dislikes) - 1 - this.collection.length)) : (this.collection.remove(a), (1 === this.voteType && !this.likes || this.voteType === - 1 && !this.dislikes) && this.hide()),
  15328.       this.updateGuests(),
  15329.       this.moveTo(this.$target, d)
  15330.     },
  15331.     show: function () {
  15332.       if (this.isRefreshEnabled && (b.prototype.constructor.POSITION_OFFSET = 12), !(1 === this.voteType && !this.likes || this.voteType === - 1 && !this.dislikes || this.isVisible())) {
  15333.         if ((1 === this.voteType && !this.hadLikes || this.voteType === - 1 && !this.hadDislikes) && (this._fetched = !0), !this._fetched) return void this.collection.fetch({
  15334.           vote: this.voteType
  15335.         }).done(a.bind(function () {
  15336.           this._fetched = !0,
  15337.           this.show()
  15338.         }, this));
  15339.         var d = this.session.user;
  15340.         this.model.get('userScore') === this.voteType && this.session.isLoggedIn() && !this.collection.contains(d) && this.collection.add(d),
  15341.         c.prototype.show.call(this)
  15342.       }
  15343.     },
  15344.     handleShowProfile: f(function (a) {
  15345.       c.prototype.handleShowProfile.call(this, a)
  15346.     }),
  15347.     getTemplateData: function () {
  15348.       var b = c.prototype.getTemplateData.apply(this, arguments);
  15349.       return a.extend({
  15350.       }, b, {
  15351.         forumId: this.model.get('forum')
  15352.       })
  15353.     },
  15354.     getUserTemplateData: function () {
  15355.       var b = c.prototype.getUserTemplateData.apply(this, arguments);
  15356.       return a.extend({
  15357.       }, b, {
  15358.         forumId: this.model.get('forum')
  15359.       })
  15360.     }
  15361.   }, {
  15362.     create: function (a) {
  15363.       var c = a.model;
  15364.       if (c.has('id')) return b.create([c.get('id'),
  15365.       '-',
  15366.       a.voteType].join(''), a, 'VotersCard', g)
  15367.     }
  15368.   });
  15369.   return g
  15370. }),
  15371. define('templates/lounge/contextCard', [
  15372.   'react',
  15373.   'core/strings',
  15374.   'core/utils/object/get',
  15375.   'core/utils',
  15376.   'core/switches',
  15377.   'templates/lounge/partials/profileLink'
  15378. ], function (a, b, c, d, e, f) {
  15379.   'use strict';
  15380.   var g = b.gettext,
  15381.   h = d.getInitials,
  15382.   i = function (b) {
  15383.     var d = e.isFeatureActive('embed_refresh', {
  15384.       forum: b.post.forum
  15385.     }),
  15386.     f = !c(b.post, [
  15387.       'author',
  15388.       'avatar',
  15389.       'isCustom'
  15390.     ]);
  15391.     return f && d ? a.createElement('div', {
  15392.       className: 'initials user--refresh'
  15393.     }, h(b.post.author.name)) : a.createElement('img', {
  15394.       src: c(b.post, [
  15395.         'author',
  15396.         'avatar',
  15397.         'cache'
  15398.       ], ''),
  15399.       className: 'user',
  15400.       alt: g('Avatar')
  15401.     })
  15402.   },
  15403.   j = function (b) {
  15404.     var d = e.isFeatureActive('embed_refresh', {
  15405.       forum: b.post.forum
  15406.     }),
  15407.     g = d ? 'avatar avatar--refresh' : 'avatar',
  15408.     h = d ? 'tooltip tooltip--post-refresh' : 'tooltip';
  15409.     return a.createElement('div', {
  15410.       className: h
  15411.     }, a.createElement('div', {
  15412.       className: 'notch'
  15413.     }), c(b.post, [
  15414.       'author',
  15415.       'isAnonymous'
  15416.     ]) ? a.createElement('div', {
  15417.       className: g
  15418.     }, a.createElement(i, {
  15419.       post: b.post
  15420.     })) : a.createElement(f, {
  15421.       className: g,
  15422.       user: c(b.post, [
  15423.         'author'
  15424.       ]),
  15425.       forumId: b.post.forum
  15426.     }, a.createElement(i, {
  15427.       post: b.post
  15428.     })), a.createElement('div', {
  15429.       className: 'tooltip__content'
  15430.     }, a.createElement('h3', null, c(b.post, [
  15431.       'author',
  15432.       'isAnonymous'
  15433.     ]) ? a.createElement('h3', null, c(b.post, [
  15434.       'author',
  15435.       'name'
  15436.     ], null)) : a.createElement(f, {
  15437.       user: c(b.post, [
  15438.         'author'
  15439.       ]),
  15440.       forumId: b.post.forum
  15441.     }, a.createElement('h3', null, c(b.post, [
  15442.       'author',
  15443.       'name'
  15444.     ], null)))), a.createElement('p', null, c(b.post, [
  15445.       'excerpt'
  15446.     ], null))))
  15447.   };
  15448.   return j
  15449. }),
  15450. define('templates/lounge/partials/followButtonSmall', [
  15451.   'react',
  15452.   'core/config/urls',
  15453.   'core/strings',
  15454.   'core/utils/object/get',
  15455.   'core/switches'
  15456. ], function (a, b, c, d, e) {
  15457.   'use strict';
  15458.   var f = c.gettext,
  15459.   g = function (c) {
  15460.     var g = e.isFeatureActive('embed_refresh', {
  15461.       forum: c.forumId
  15462.     }),
  15463.     h = g && e.isFeatureActive('embed_refresh_v2', {
  15464.       forum: c.forumId
  15465.     });
  15466.     return d(c.user, [
  15467.       'isSession'
  15468.     ]) ? d(c.user, [
  15469.       'isEditable'
  15470.     ]) ? g ? a.createElement('a', {
  15471.       href: b.editProfile || '',
  15472.       target: '_blank',
  15473.       className: c.buttonAsLink ? 'publisher-anchor-color follow-link hover-card' : 'follow-btn btn-small hover-card edit'
  15474.     }, f('Edit')) : a.createElement('a', {
  15475.       href: b.editProfile || '',
  15476.       target: '_blank',
  15477.       className: c.buttonAsLink ? 'publisher-anchor-color follow-link' : 'btn btn-small'
  15478.     }, f('Edit profile')) : null : d(c.user, [
  15479.       'isPrivate'
  15480.     ]) ? g ? h ? a.createElement('span', {
  15481.       className: 'btn btn-small follow-btn private'
  15482.     }, a.createElement('a', {
  15483.       href: d(c.user, [
  15484.         'profileUrl'
  15485.       ], ''),
  15486.       'data-action': 'profile',
  15487.       'data-username': d(c.user, [
  15488.         'username'
  15489.       ], ''),
  15490.       target: '_blank',
  15491.       rel: 'noopener noreferrer'
  15492.     }, a.createElement('i', {
  15493.       'aria-hidden': 'true',
  15494.       className: 'icon-lock'
  15495.     }), a.createElement('span', {
  15496.       className: 'btn-text'
  15497.     }, f('Private Profile')))) : null : a.createElement('span', {
  15498.       className: 'btn btn-small follow-btn private'
  15499.     }, a.createElement('i', {
  15500.       'aria-hidden': 'true',
  15501.       className: 'icon-lock'
  15502.     }), ' ', a.createElement('span', {
  15503.       className: 'btn-text'
  15504.     }, f('Private'))) : g ? h ? a.createElement('a', {
  15505.       href: d(c.user, [
  15506.         'profileUrl'
  15507.       ], ''),
  15508.       className: '' + (c.buttonAsLink ? 'publisher-anchor-color follow-link' : 'btn btn-small follow-btn hover-card') + (d(c.user, [
  15509.         'isFollowing'
  15510.       ]) ? ' following' : ''),
  15511.       'data-action': 'toggleFollow',
  15512.       'data-user': d(c.user, [
  15513.         'id'
  15514.       ], ''),
  15515.       target: '_blank',
  15516.       rel: 'noopener noreferrer'
  15517.     }, a.createElement('span', {
  15518.       className: 'btn-text following-text hover-card'
  15519.     }, a.createElement('span', {
  15520.       className: 'follow-user is-following'
  15521.     }), f('Following')), a.createElement('span', {
  15522.       className: 'btn-text follow-text'
  15523.     }, a.createElement('span', {
  15524.       className: 'follow-user publisher-background-color-refresh hover-card'
  15525.     }), f('Follow'))) : a.createElement('a', {
  15526.       href: d(c.user, [
  15527.         'profileUrl'
  15528.       ], ''),
  15529.       className: '' + (c.buttonAsLink ? 'publisher-anchor-color follow-link' : 'btn btn-small follow-btn hover-card') + (d(c.user, [
  15530.         'isFollowing'
  15531.       ]) ? ' following' : ''),
  15532.       'data-action': 'toggleFollow',
  15533.       'data-user': d(c.user, [
  15534.         'id'
  15535.       ], ''),
  15536.       target: '_blank',
  15537.       rel: 'noopener noreferrer'
  15538.     }, a.createElement('span', {
  15539.       className: 'btn-text following-text hover-card'
  15540.     }, a.createElement('span', {
  15541.       className: 'follow-user is-following publisher-background-color-refresh'
  15542.     })), a.createElement('span', {
  15543.       className: 'btn-text follow-text'
  15544.     }, a.createElement('span', {
  15545.       className: 'follow-user publisher-background-color-refresh hover-card'
  15546.     }))) : a.createElement('a', {
  15547.       href: d(c.user, [
  15548.         'profileUrl'
  15549.       ], ''),
  15550.       className: '' + (c.buttonAsLink ? 'publisher-anchor-color follow-link' : 'btn btn-small follow-btn') + (d(c.user, [
  15551.         'isFollowing'
  15552.       ]) ? ' following' : ''),
  15553.       'data-action': 'toggleFollow',
  15554.       'data-user': d(c.user, [
  15555.         'id'
  15556.       ], ''),
  15557.       target: '_blank',
  15558.       rel: 'noopener noreferrer'
  15559.     }, a.createElement('span', {
  15560.       className: 'btn-text following-text'
  15561.     }, f('Following')), a.createElement('span', {
  15562.       className: 'btn-text follow-text'
  15563.     }, f('Follow')), a.createElement('i', {
  15564.       'aria-hidden': 'true',
  15565.       className: 'icon-checkmark'
  15566.     }))
  15567.   };
  15568.   return g
  15569. }),
  15570. define('templates/lounge/partials/hovercardActions', [
  15571.   'react',
  15572.   'core/strings',
  15573.   'core/switches',
  15574.   'templates/lounge/partials/followButtonSmall',
  15575.   'templates/lounge/partials/profileLink'
  15576. ], function (a, b, c, d, e) {
  15577.   'use strict';
  15578.   var f = b.gettext,
  15579.   g = function (b) {
  15580.     var g = c.isFeatureActive('embed_refresh', {
  15581.       forum: b.forumId
  15582.     }),
  15583.     h = g && c.isFeatureActive('embed_refresh_v2', {
  15584.       forum: b.forumId
  15585.     });
  15586.     return g ? h ? a.createElement('div', {
  15587.       className: 'hovercard-actions-container'
  15588.     }, b.showFollowButton ? a.createElement(d, {
  15589.       user: b.user,
  15590.       buttonAsLink: b.buttonAsLink,
  15591.       forumId: b.forumId
  15592.     }) : null, b.user.isPrivate && !b.user.isEditable ? null : a.createElement(e, {
  15593.       user: b.user,
  15594.       forumId: null,
  15595.       className: 'view-profile'
  15596.     }, a.createElement('span', {
  15597.       className: 'eye'
  15598.     }), f('View Profile'))) : a.createElement('div', null, b.showFollowButton ? a.createElement(d, {
  15599.       user: b.user,
  15600.       buttonAsLink: b.buttonAsLink,
  15601.       forumId: b.forumId
  15602.     }) : null) : a.createElement('div', null, a.createElement(e, {
  15603.       user: b.user,
  15604.       forumId: null,
  15605.       className: 'full-profile'
  15606.     }, f('Full profile')), b.showFollowButton ? a.createElement(d, {
  15607.       user: b.user,
  15608.       buttonAsLink: b.buttonAsLink
  15609.     }) : null, ' ')
  15610.   };
  15611.   return g
  15612. }),
  15613. define('templates/lounge/partials/hovercardCounters', [
  15614.   'react',
  15615.   'core/strings',
  15616.   'core/utils/object/get',
  15617.   'core/switches'
  15618. ], function (a, b, c, d) {
  15619.   'use strict';
  15620.   var e = b.gettext,
  15621.   f = function (b) {
  15622.     var f = d.isFeatureActive('embed_refresh', {
  15623.       forum: b.forumId
  15624.     }),
  15625.     g = f && d.isFeatureActive('embed_refresh_v2', {
  15626.       forum: b.forumId
  15627.     });
  15628.     return f ? g ? a.createElement('div', {
  15629.       className: 'hovercard-counters-container hovercard-counters-container-v2'
  15630.     }, a.createElement('div', {
  15631.       className: 'counters'
  15632.     }, a.createElement('span', {
  15633.       className: 'count count-v2 comment'
  15634.     }), 1 === c(b.user, [
  15635.       'numPosts'
  15636.     ]) ? '1' : b.user.numPosts), a.createElement('div', {
  15637.       className: 'counters'
  15638.     }, a.createElement('span', {
  15639.       className: 'count count-v2 like'
  15640.     }), 1 === c(b.user, [
  15641.       'numLikesReceived'
  15642.     ]) ? '1' : b.user.numLikesReceived)) : a.createElement('div', {
  15643.       className: 'hovercard-counters-container'
  15644.     }, a.createElement('div', {
  15645.       className: 'counters'
  15646.     }, a.createElement('span', {
  15647.       className: 'count comment'
  15648.     }), 1 === c(b.user, [
  15649.       'numPosts'
  15650.     ]) ? '1' : b.user.numPosts), a.createElement('div', {
  15651.       className: 'counters'
  15652.     }, a.createElement('span', {
  15653.       className: 'count like'
  15654.     }), 1 === c(b.user, [
  15655.       'numLikesReceived'
  15656.     ]) ? '1' : b.user.numLikesReceived)) : a.createElement('div', null, 1 === c(b.user, [
  15657.       'numPosts'
  15658.     ]) ? e('1 comment') : e('%(numPosts)s comments', {
  15659.       numPosts: c(b.user, [
  15660.         'numPosts'
  15661.       ], '')
  15662.     }), ' ', a.createElement('span', {
  15663.       className: 'bullet'
  15664.     }, '•'), ' ', 1 === c(b.user, [
  15665.       'numLikesReceived'
  15666.     ]) ? e('1 vote') : e('%(numLikesReceived)s votes', {
  15667.       numLikesReceived: c(b.user, [
  15668.         'numLikesReceived'
  15669.       ], '')
  15670.     }))
  15671.   };
  15672.   return f
  15673. }),
  15674. define('templates/lounge/hovercard', [
  15675.   'react',
  15676.   'core/strings',
  15677.   'core/switches',
  15678.   'core/utils/object/get',
  15679.   'core/utils',
  15680.   'templates/lounge/partials/hovercardActions',
  15681.   'templates/lounge/partials/hovercardCounters',
  15682.   'templates/lounge/partials/profileLink'
  15683. ], function (a, b, c, d, e, f, g, h) {
  15684.   'use strict';
  15685.   var i = b.gettext,
  15686.   j = e.getInitials,
  15687.   k = function (b, c) {
  15688.     return b.length <= c ? b : a.createElement('span', null, b.slice(0, c), '…')
  15689.   },
  15690.   l = function (b) {
  15691.     var e = c.isFeatureActive('embed_refresh', {
  15692.       forum: b.forumId
  15693.     }),
  15694.     l = e && c.isFeatureActive('embed_refresh_v2', {
  15695.       forum: b.forumId
  15696.     }),
  15697.     m = d(b.user, [
  15698.       'isPrivate'
  15699.     ]),
  15700.     n = d(b.user, [
  15701.       'avatar',
  15702.       'isCustom'
  15703.     ]) ? d(b.user, [
  15704.       'avatar',
  15705.       'cache'
  15706.     ], '') : b.forumAvatar;
  15707.     return e ? l ? a.createElement('div', {
  15708.       className: 'tooltip tooltip-v2 tooltip--refresh--v2'
  15709.     }, a.createElement('div', {
  15710.       className: 'tooltip__header'
  15711.     }, a.createElement(h, {
  15712.       user: b.user,
  15713.       forumId: b.forumId,
  15714.       className: 'avatar avatar--refresh-v2'
  15715.     }, n ? a.createElement('img', {
  15716.       'data-user': d(b.user, [
  15717.         'id'
  15718.       ], ''),
  15719.       'data-role': 'user-avatar',
  15720.       src: n,
  15721.       className: 'user',
  15722.       alt: i('Avatar')
  15723.     }) : a.createElement('div', {
  15724.       className: 'initials'
  15725.     }, j(b.user.name) [0])), a.createElement('div', {
  15726.       className: 'tooltip__content tooltip__content--refresh-v2'
  15727.     }, a.createElement('h3', {
  15728.       className: 'profile-link-container'
  15729.     }, a.createElement('div', {
  15730.       className: 'profile-link-username profile-link-username-refresh-v2'
  15731.     }, a.createElement(h, {
  15732.       user: b.user,
  15733.       forumId: null,
  15734.       'data-role': 'username'
  15735.     }, d(b.user, [
  15736.       'name'
  15737.     ], null)))), a.createElement('p', {
  15738.       className: 'stats stats--refresh-v2',
  15739.       'data-role': 'counters'
  15740.     }, null !== d(b.user, [
  15741.       'numPosts'
  15742.     ], null) && null !== d(b.user, [
  15743.       'numLikesReceived'
  15744.     ], null) ? a.createElement(g, {
  15745.       user: b.user
  15746.     }) : null))), a.createElement('div', {
  15747.       className: 'tooltip__bio'
  15748.     }, d(b.user, [
  15749.       'about'
  15750.     ]) ? a.createElement('p', {
  15751.       className: 'bio'
  15752.     }, d(b.user, [
  15753.       'about'
  15754.     ], '')) : null), a.createElement('footer', {
  15755.       className: 'tooltip__footer-v2',
  15756.       'data-role': 'actions'
  15757.     }, a.createElement(f, {
  15758.       user: b.user,
  15759.       buttonAsLink: b.buttonAsLink,
  15760.       showFollowButton: b.showFollowButton,
  15761.       forumId: b.forumId
  15762.     }))) : a.createElement('div', {
  15763.       className: 'tooltip tooltip--refresh'
  15764.     }, a.createElement(h, {
  15765.       user: b.user,
  15766.       forumId: b.forumId,
  15767.       className: 'avatar avatar--refresh'
  15768.     }, n ? a.createElement('img', {
  15769.       'data-user': d(b.user, [
  15770.         'id'
  15771.       ], ''),
  15772.       'data-role': 'user-avatar',
  15773.       src: n,
  15774.       className: 'user user--refresh',
  15775.       alt: i('Avatar')
  15776.     }) : a.createElement('div', {
  15777.       className: 'initials user--refresh'
  15778.     }, j(b.user.name)), m ? a.createElement('div', {
  15779.       className: 'view-profile-message-container'
  15780.     }, a.createElement('i', {
  15781.       'aria-hidden': 'true',
  15782.       className: 'icon-lock'
  15783.     }), a.createElement('div', null, 'Private')) : a.createElement('div', {
  15784.       className: 'view-profile-message-container'
  15785.     }, a.createElement('div', null, 'View'), a.createElement('div', null, 'Profile'))), a.createElement('div', {
  15786.       className: 'tooltip__content tooltip__content--refresh'
  15787.     }, a.createElement('h3', {
  15788.       className: 'profile-link-container'
  15789.     }, a.createElement('div', {
  15790.       className: 'profile-link-username'
  15791.     }, a.createElement(h, {
  15792.       user: b.user,
  15793.       forumId: null,
  15794.       'data-role': 'username'
  15795.     }, d(b.user, [
  15796.       'name'
  15797.     ], null))), a.createElement('div', {
  15798.       className: 'tooltip__actions',
  15799.       'data-role': 'actions'
  15800.     }, a.createElement(f, {
  15801.       user: b.user,
  15802.       buttonAsLink: b.buttonAsLink,
  15803.       showFollowButton: b.showFollowButton,
  15804.       forumId: b.forumId
  15805.     }))), a.createElement('p', {
  15806.       className: 'stats stats--refresh',
  15807.       'data-role': 'counters'
  15808.     }, null !== d(b.user, [
  15809.       'numPosts'
  15810.     ], null) && null !== d(b.user, [
  15811.       'numLikesReceived'
  15812.     ], null) ? a.createElement(g, {
  15813.       user: b.user
  15814.     }) : null))) : a.createElement('div', {
  15815.       className: 'tooltip'
  15816.     }, a.createElement('div', {
  15817.       className: 'notch'
  15818.     }), a.createElement(h, {
  15819.       user: b.user,
  15820.       forumId: null,
  15821.       className: 'avatar'
  15822.     }, a.createElement('img', {
  15823.       'data-user': d(b.user, [
  15824.         'id'
  15825.       ], ''),
  15826.       'data-role': 'user-avatar',
  15827.       src: d(b.user, [
  15828.         'avatar',
  15829.         'cache'
  15830.       ], ''),
  15831.       className: 'user',
  15832.       alt: i('Avatar')
  15833.     })), a.createElement('div', {
  15834.       className: 'tooltip__content'
  15835.     }, a.createElement('h3', null, a.createElement(h, {
  15836.       user: b.user,
  15837.       forumId: null,
  15838.       'data-role': 'username'
  15839.     }, d(b.user, [
  15840.       'name'
  15841.     ], null)), ' ', d(b.user, [
  15842.       'thread',
  15843.       'canModerate'
  15844.     ]) ? a.createElement('span', {
  15845.       className: 'badge moderator'
  15846.     }, i('MOD')) : null), d(b.user, [
  15847.       'about'
  15848.     ]) ? a.createElement('p', {
  15849.       className: 'bio'
  15850.     }, k(d(b.user, [
  15851.       'about'
  15852.     ], ''), 80)) : null, a.createElement('p', {
  15853.       className: 'stats',
  15854.       'data-role': 'counters'
  15855.     }, null !== d(b.user, [
  15856.       'numPosts'
  15857.     ], null) && null !== d(b.user, [
  15858.       'numLikesReceived'
  15859.     ], null) ? a.createElement(g, {
  15860.       user: b.user
  15861.     }) : null), a.createElement('div', {
  15862.       className: 'hovercard-badges',
  15863.       'data-role': 'hovercard-badges'
  15864.     })), a.createElement('footer', {
  15865.       className: 'tooltip__footer',
  15866.       'data-role': 'actions'
  15867.     }, a.createElement(f, {
  15868.       user: b.user,
  15869.       buttonAsLink: b.buttonAsLink,
  15870.       showFollowButton: b.showFollowButton
  15871.     })))
  15872.   };
  15873.   return l
  15874. }),
  15875. define('templates/lounge/upgradeCard', [
  15876.   'react',
  15877.   'core/strings',
  15878.   'core/utils/object/get'
  15879. ], function (a, b, c) {
  15880.   'use strict';
  15881.   var d = b.gettext,
  15882.   e = function (b) {
  15883.     return a.createElement('div', {
  15884.       className: 'tooltip'
  15885.     }, a.createElement('div', {
  15886.       className: 'notch'
  15887.     }), a.createElement('div', null, a.createElement('p', {
  15888.       className: 'text-normal'
  15889.     }, d('Disqus Pro gives you access to exclusive features like auto-moderation, shadow banning, and customization options.')), a.createElement('a', {
  15890.       href: [
  15891.         'https://disqus.com/admin/',
  15892.         b.organization ? 'orgs/' + c(b.organization, [
  15893.           'id'
  15894.         ]) + '/' + c(b.organization, [
  15895.           'slug'
  15896.         ], 'sites') + '/' : '',
  15897.         'settings/subscription/'
  15898.       ].join(''),
  15899.       target: '_blank',
  15900.       rel: 'noopener noreferrer',
  15901.       className: 'btn btn-small',
  15902.       'data-role': 'upgrade-link'
  15903.     }, d('Subscriptions and Billing'))))
  15904.   };
  15905.   return e
  15906. }),
  15907. define('templates/lounge/partials/userBadges', [
  15908.   'react',
  15909.   'core/bus',
  15910.   'templates/lounge/partials/profileLink'
  15911. ], function (a, b, c) {
  15912.   'use strict';
  15913.   var d = function (b) {
  15914.     var d = b.badge,
  15915.     e = b.user,
  15916.     f = b.forumId,
  15917.     g = b.context,
  15918.     h = b.trackClick,
  15919.     i = b.postId;
  15920.     return d.image ? a.createElement(c, {
  15921.       user: e,
  15922.       forumId: f,
  15923.       profileTab: 'badges',
  15924.       id: g + '-badge_' + e.id + '-' + d.id + '-' + i,
  15925.       className: 'user-badge badge-tooltip__wrapper',
  15926.       'data-role': 'user-badge',
  15927.       'data-badge': d.id,
  15928.       onClick: function (a) {
  15929.         return h(a, d.id)
  15930.       },
  15931.       tabIndex: 0
  15932.     }, a.createElement('img', {
  15933.       className: 'user-badge-image',
  15934.       src: d.image,
  15935.       alt: d.name
  15936.     }), a.createElement('div', {
  15937.       className: 'badge-tooltip__container'
  15938.     }, a.createElement('div', {
  15939.       className: 'tooltip show badge-tooltip'
  15940.     }, a.createElement('span', {
  15941.       className: 'badge-tooltip__content'
  15942.     }, d.name)))) : null
  15943.   },
  15944.   e = function (a, b) {
  15945.     return b.badges ? b.badges.filter(function (b) {
  15946.       return a.badges[b.id]
  15947.     }) : [
  15948.     ]
  15949.   },
  15950.   f = function (f) {
  15951.     var g = f.forum,
  15952.     h = f.user,
  15953.     i = f.context,
  15954.     j = f.limit,
  15955.     k = f.postId;
  15956.     if (!(g.settings.badgesEnabled && g.badges && Object.keys(g.badges).length && h)) return null;
  15957.     var l = e(g, h),
  15958.     m = function (a, c) {
  15959.       b.trigger('uiAction:clickBadge', a, c)
  15960.     },
  15961.     n = l.length > j,
  15962.     o = n ? j - 1 : j;
  15963.     return l.length ? a.createElement('span', {
  15964.       'data-role': 'badges',
  15965.       className: 'user-badges-collection',
  15966.       'data-tracking-area': i
  15967.     }, l.map(function (b, c) {
  15968.       return c < o ? a.createElement(d, {
  15969.         key: c,
  15970.         badge: b,
  15971.         user: h,
  15972.         forumId: g.id,
  15973.         context: i,
  15974.         trackClick: m,
  15975.         postId: k
  15976.       }) : null
  15977.     }), n ? a.createElement(c, {
  15978.       user: h,
  15979.       forumId: g.id,
  15980.       profileTab: 'badges',
  15981.       className: 'user-badge truncate-badge publisher-background-color',
  15982.       'data-role': 'user-badge',
  15983.       onClick: function (a) {
  15984.         return m(a, 'more')
  15985.       },
  15986.       tabIndex: 0
  15987.     }, a.createElement('span', {
  15988.       className: 'user-badge-more'
  15989.     }, '+', l.length - o)) : null) : a.createElement('span', {
  15990.       'data-role': 'badges',
  15991.       className: 'user-badges-collection'
  15992.     })
  15993.   };
  15994.   return f
  15995. }),
  15996. define('lounge/views/cards', [
  15997.   'jquery',
  15998.   'underscore',
  15999.   'lounge/common',
  16000.   'core/utils',
  16001.   'core/switches',
  16002.   'common/models',
  16003.   'common/views/mixins',
  16004.   'core/constants/badgesConstants',
  16005.   'core/views/common/HoverCard',
  16006.   'core/views/VotersCard',
  16007.   'templates/lounge/contextCard',
  16008.   'templates/lounge/hovercard',
  16009.   'templates/lounge/upgradeCard',
  16010.   'templates/lounge/partials/hovercardActions',
  16011.   'templates/lounge/partials/hovercardCounters',
  16012.   'templates/lounge/partials/userBadges'
  16013. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
  16014.   'use strict';
  16015.   i.prototype.getContainerPosition = function () {
  16016.     var a = c.getLounge().getPosition();
  16017.     return {
  16018.       pageOffset: a.pageOffset,
  16019.       containerOffset: a.frameOffset,
  16020.       containerHeight: a.height
  16021.     }
  16022.   },
  16023.   function () {
  16024.     var c = 10;
  16025.     a(window.document).on('mouseout', b.debounce(function (a) {
  16026.       var b = a.relatedTarget || a.toElement;
  16027.       b && 'HTML' !== b.nodeName || i.exitAll()
  16028.     }, c))
  16029.   }();
  16030.   var q = i.extend({
  16031.     className: 'tooltip-outer profile-card',
  16032.     events: b.defaults({
  16033.       'click [data-action=toggleFollow]': 'toggleFollow'
  16034.     }, i.prototype.events),
  16035.     initialize: function (a) {
  16036.       var b = this;
  16037.       i.prototype.initialize.call(b, a),
  16038.       b.session = a.session,
  16039.       b.user = a.user,
  16040.       b._fetched = !1,
  16041.       b.listenTo(b.session, 'change:id', function () {
  16042.         this._rendered && this.render()
  16043.       }),
  16044.       b.session.attributes.thread && e.isFeatureActive('embed_refresh', {
  16045.         forum: b.session.attributes.thread.forum.id
  16046.       }) && b.el.classList.add('profile-card--refresh')
  16047.     },
  16048.     onFetch: function (a) {
  16049.       this.user = new f.SyncedUser(a.attributes),
  16050.       this.updateCounters(),
  16051.       this.updateActions(),
  16052.       this.updateBadges(),
  16053.       this.listenTo(this.user, {
  16054.         'change:numPosts change:numLikesReceived': b.debounce(function () {
  16055.           this.updateCounters()
  16056.         }),
  16057.         'change:isFollowing': this.updateActions
  16058.       });
  16059.       var c = function (a) {
  16060.         this.set('isFollowing', a.get('isFollowing'))
  16061.       };
  16062.       a.listenTo(this.user, 'change:isFollowing', c),
  16063.       this.user.listenTo(a, 'change:isFollowing', c)
  16064.     },
  16065.     serialize: function () {
  16066.       var a = this.user.toJSON({
  16067.         session: this.session
  16068.       });
  16069.       a.numLikesReceived = a.numLikesReceived || this.user.get('numVotes') || 0;
  16070.       var b = this.session.get('thread').forum.get('avatar');
  16071.       return b = b && b.large && b.large.cache,
  16072.       b = d.isDefaultAvatar(b) ? null : b,
  16073.       {
  16074.         forumId: this.session.attributes.thread.forum.id,
  16075.         forumAvatar: b,
  16076.         user: a,
  16077.         showFollowButton: this.user.has('isFollowing') || this.session.isLoggedOut()
  16078.       }
  16079.     },
  16080.     render: function () {
  16081.       this.$el.html(l(this.serialize())),
  16082.       i.prototype.render.call(this)
  16083.     },
  16084.     setBadges: function (a) {
  16085.       this._fetched && (this.user.set('badges', a), this.updateBadges())
  16086.     },
  16087.     updateBadges: function () {
  16088.       if (!e.isFeatureActive('embed_refresh', {
  16089.         forum: this.session.attributes.thread.forum.id
  16090.       })) {
  16091.         var a = this.session.get('thread') && this.session.get('thread').forum,
  16092.         b = Boolean(a && a.get('settings') && a.get('settings').badgesEnabled && a.get('badges')),
  16093.         c = Boolean(b && this.user.get('badges') && this.user.get('badges').length);
  16094.         c && !this.el.classList.contains('has-badges') ? this.el.classList.add('has-badges') : !c && this.el.classList.contains('has-badges') && this.el.classList.remove('has-badges'),
  16095.         b && this.$el.find('[data-role=hovercard-badges]').html(p({
  16096.           forum: a.attributes,
  16097.           user: this.user.attributes,
  16098.           context: 'hovercard',
  16099.           limit: h.MAX_BADGE_COUNT
  16100.         }))
  16101.       }
  16102.     },
  16103.     updateCounters: function () {
  16104.       this.$el.find('[data-role=counters]').html(o(this.serialize()))
  16105.     },
  16106.     updateActions: function () {
  16107.       this.$el.find('[data-role=actions]').html(n(this.serialize()))
  16108.     },
  16109.     show: function () {
  16110.       this._fetched || (this._fetched = !0, this.user.fetch({
  16111.         success: b.bind(this.onFetch, this)
  16112.       })),
  16113.       e.isFeatureActive('embed_refresh', {
  16114.         forum: this.session.attributes.thread.forum.id
  16115.       }) && (i.prototype.constructor.POSITION_OFFSET = 0, i.prototype.constructor.DELAY_ENTER = 0, i.prototype.constructor.DELAY_LEAVE = 0),
  16116.       i.prototype.show.call(this)
  16117.     }
  16118.   }, {
  16119.     create: function (a) {
  16120.       var b = a.user;
  16121.       return i.create(b.id, a, 'ProfileCard', q)
  16122.     }
  16123.   });
  16124.   b.extend(q.prototype, g.FollowButtonMixin);
  16125.   var r = i.extend({
  16126.     className: 'context-card tooltip-outer',
  16127.     initialize: function (a) {
  16128.       var b = this;
  16129.       i.prototype.initialize.call(b, a),
  16130.       b.post = a.post
  16131.     },
  16132.     render: function () {
  16133.       var a = this.post,
  16134.       b = a.toJSON();
  16135.       b.excerpt = d.niceTruncate(b.plaintext, 40),
  16136.       this.$el.html(k({
  16137.         post: b
  16138.       })),
  16139.       i.prototype.render.call(this)
  16140.     }
  16141.   }, {
  16142.     create: function (a) {
  16143.       var b = a.post;
  16144.       return i.create(b.id, a, 'ContextCard', r)
  16145.     }
  16146.   }),
  16147.   s = i.extend({
  16148.     className: 'tooltip-outer upgrade-card',
  16149.     events: b.defaults({
  16150.       'click [data-role=upgrade-link]': 'onClickUpgrade'
  16151.     }, i.prototype.events),
  16152.     initialize: function (a) {
  16153.       i.prototype.initialize.call(this, a),
  16154.       this.organization = a.organization
  16155.     },
  16156.     render: function () {
  16157.       this.$el.html(m({
  16158.         organization: this.organization
  16159.       })),
  16160.       i.prototype.render.call(this)
  16161.     },
  16162.     onClickUpgrade: function (a) {
  16163.       this.trigger('click:upgrade', a)
  16164.     }
  16165.   }, {
  16166.     create: function (a) {
  16167.       var b = a.organization;
  16168.       return i.create(b ? b.id : 'upgrade', a, 'UpgradeCard', s)
  16169.     }
  16170.   });
  16171.   return {
  16172.     HoverCard: i,
  16173.     ProfileCard: q,
  16174.     ContextCard: r,
  16175.     VotersCard: j,
  16176.     UpgradeCard: s
  16177.   }
  16178. }),
  16179. define('core/views/SourcelessIframeRichMediaView', [
  16180.   'jquery',
  16181.   'core/mediaConfig',
  16182.   'core/views/RichMediaView'
  16183. ], function (a, b, c) {
  16184.   'use strict';
  16185.   return c.extend({
  16186.     createContentNode: function (b) {
  16187.       return a('<iframe>').attr({
  16188.         frameBorder: 0,
  16189.         scrolling: 'no',
  16190.         width: '100%',
  16191.         height: this.model.get('deferredHeight'),
  16192.         'data-src': b,
  16193.         src: 'javascript:window.frameElement.getAttribute("data-src");'
  16194.       })
  16195.     },
  16196.     insertContentNode: function (a) {
  16197.       c.prototype.insertContentNode.apply(this, arguments);
  16198.       var d = this.model.get('deferredHeight') || b.get('defaultIframeHeight');
  16199.       a.height(d)
  16200.     }
  16201.   })
  16202. }),
  16203. define('lounge/views/media', [
  16204.   'underscore',
  16205.   'stance',
  16206.   'core/utils',
  16207.   'core/utils/storage',
  16208.   'core/utils/html/toHexColorString',
  16209.   'core/media',
  16210.   'core/mediaConfig',
  16211.   'core/models/RichMediaViewModel',
  16212.   'core/views/RichMediaLinkView',
  16213.   'core/views/RichMediaView',
  16214.   'core/views/IframeRichMediaView',
  16215.   'core/views/SoundCloudRichMediaView',
  16216.   'core/views/AutoplayRichMediaView',
  16217.   'core/views/SourcelessIframeRichMediaView',
  16218.   'core/views/DynamicHeightRichMediaView',
  16219.   'core/views/TwitterRichMediaView',
  16220.   'core/views/ImageRichMediaView',
  16221.   'core/views/FacebookPhotoRichMediaView',
  16222.   'core/views/VineRichMediaView',
  16223.   'lounge/common'
  16224. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) {
  16225.   'use strict';
  16226.   function u() {
  16227.     var b = d.get('disqus.collapse-media');
  16228.     return a.isBoolean(b) || (b = c.isMobileUserAgent()),
  16229.     b
  16230.   }
  16231.   return a.extend(j.prototype, {
  16232.     topEdgeOffset: function () {
  16233.       return - t.getLounge().getPosition().height
  16234.     },
  16235.     configureDeferred: function () {
  16236.       this.model.get('deferred') && !this.model.get('activated') && this.listenToOnce(b(this), 'enter', function () {
  16237.         this.relatedPost && this.listenToOnce(this, 'load error', function () {
  16238.           t.getLounge().postsView.onDeferredViewReady(this.relatedPost)
  16239.         }),
  16240.         this.enterViewport()
  16241.       }),
  16242.       this.listenToOnce(t.getLounge().postsView, 'render:end', this.updateDeferredHeight)
  16243.     }
  16244.   }),
  16245.   p.theme = function () {
  16246.     return t.getLounge().config.colorScheme
  16247.   },
  16248.   p.linkColor = function () {
  16249.     return e(t.getLounge().config.anchorColor)
  16250.   },
  16251.   g.set({
  16252.     collapsed: u()
  16253.   }),
  16254.   g.on('change:collapsed', function (b, c) {
  16255.     if (a.isObject(c)) {
  16256.       if (!c.persist) return;
  16257.       c = c.value
  16258.     }
  16259.     d.set('disqus.collapse-media', c)
  16260.   }),
  16261.   {
  16262.     settings: g,
  16263.     getCollapseDefault: u,
  16264.     getDomain: c.getDomain,
  16265.     RichMediaLinkView: i,
  16266.     RichMediaViewModel: h,
  16267.     RichMediaView: j,
  16268.     IframeRichMediaView: k,
  16269.     SoundCloudRichMediaView: l,
  16270.     AutoplayRichMediaView: m,
  16271.     SourcelessIframeRichMediaView: n,
  16272.     DynamicHeightRichMediaView: o,
  16273.     TwitterRichMediaView: p,
  16274.     ImageRichMediaView: q,
  16275.     FacebookPhotoRichMediaView: r,
  16276.     VineRichMediaView: s,
  16277.     instantiateRichMediaView: f.instantiateRichMediaView,
  16278.     getRichMediaViewConfig: f.getRichMediaViewConfig
  16279.   }
  16280. }),
  16281. define('core/templates/react/BadgesManageTemplate', [
  16282.   'react',
  16283.   'underscore',
  16284.   'core/strings',
  16285.   'core/constants/badgesConstants'
  16286. ], function (a, b, c, d) {
  16287.   'use strict';
  16288.   var e = c.gettext,
  16289.   f = d.ACTION_TYPES,
  16290.   g = function (b) {
  16291.     var c = b.text,
  16292.     d = b.value,
  16293.     e = b.selected,
  16294.     f = b.handleChange,
  16295.     g = function (a) {
  16296.       var b = 13;
  16297.       a.keyCode === b && f(a)
  16298.     };
  16299.     return a.createElement('label', {
  16300.       className: 'padding-default align align__item--grow align__item--equal align--center align--column modal__option' + (e ? ' -selected' : ''),
  16301.       tabIndex: '0',
  16302.       onKeyPress: g,
  16303.       onChange: f
  16304.     }, a.createElement('input', {
  16305.       type: 'radio',
  16306.       name: 'badge_action',
  16307.       value: d,
  16308.       checked: e
  16309.     }), a.createElement('p', {
  16310.       className: 'text-semibold text-center modal__option-text'
  16311.     }, c))
  16312.   },
  16313.   h = function (b) {
  16314.     var c = b.badge,
  16315.     d = b.selectedBadge,
  16316.     e = b.handleChange;
  16317.     return a.createElement('span', {
  16318.       key: c.id,
  16319.       className: 'badge-option spacing-right ' + (d && d === c.id ? ' selected' : '') + (c.disabled ? ' disabled' : '')
  16320.     }, a.createElement('input', {
  16321.       id: 'badge-' + c.id + '-input',
  16322.       name: 'badge',
  16323.       type: 'radio',
  16324.       className: 'badge-option_input',
  16325.       value: c.id,
  16326.       onChange: e,
  16327.       disabled: c.disabled,
  16328.       tabIndex: '0'
  16329.     }), a.createElement('label', {
  16330.       htmlFor: 'badge-' + c.id + '-input',
  16331.       className: 'badge-option_label'
  16332.     }, a.createElement('span', {
  16333.       className: 'badge-option_image-wrapper'
  16334.     }, a.createElement('img', {
  16335.       className: 'badge-option_image',
  16336.       src: c.image,
  16337.       alt: c.name
  16338.     })), a.createElement('span', {
  16339.       className: 'badge-option_title'
  16340.     }, c.name)))
  16341.   },
  16342.   i = function (b) {
  16343.     var c = b.badgeAction,
  16344.     d = b.formValues,
  16345.     i = b.badgeOptions,
  16346.     j = b.updateBadgeAction,
  16347.     k = b.updateBadgeSelection,
  16348.     l = b.handleSubmit,
  16349.     m = b.handleClose,
  16350.     n = 'https://' + d.forum + '.disqus.com/admin/settings/badges';
  16351.     return a.createElement('form', {
  16352.       className: 'badges-manage-form'
  16353.     }, a.createElement('div', {
  16354.       className: 'admin-modal__content padding-bottom'
  16355.     }, a.createElement('div', null, a.createElement('div', {
  16356.       className: 'align align--stretch align--wrap'
  16357.     }, a.createElement(g, {
  16358.       text: e('Award a Badge'),
  16359.       value: f.AWARD,
  16360.       selected: c === f.AWARD,
  16361.       handleChange: j
  16362.     }), a.createElement(g, {
  16363.       text: e('Remove a Badge'),
  16364.       value: f.REMOVE,
  16365.       selected: c === f.REMOVE,
  16366.       handleChange: j
  16367.     })), a.createElement('div', {
  16368.       className: 'modal__description border-bottom-dark'
  16369.     }, a.createElement('p', {
  16370.       className: 'modal__option-subtext'
  16371.     }, e(c === f.AWARD ? 'Select a badge below to award it to this commenter.' : 'Select one of the manually awarded badges below to remove it from this commenter. Automatically awarded badges can only be removed by removing the badge from your site entirely.'), a.createElement('br', null), e('You can manage your site\'s badges using the '), a.createElement('a', {
  16372.       href: n,
  16373.       target: '_blank',
  16374.       rel: 'noopener noreferrer'
  16375.     }, e('Badges settings')), e(' in the Disqus Admin.'))), a.createElement('div', {
  16376.       className: 'modal__config'
  16377.     }, a.createElement('div', {
  16378.       className: 'badge-options_list'
  16379.     }, i.map(function (b) {
  16380.       return a.createElement(h, {
  16381.         key: b.id,
  16382.         badge: b,
  16383.         selectedBadge: d.badge,
  16384.         handleChange: k
  16385.       })
  16386.     }), c === f.AWARD ? a.createElement('span', {
  16387.       className: 'badge-option spacing-right create-badge'
  16388.     }, a.createElement('a', {
  16389.       className: 'badge-option_link',
  16390.       href: n,
  16391.       target: '_blank',
  16392.       rel: 'noopener noreferrer'
  16393.     }, a.createElement('span', {
  16394.       className: 'badge-option_image-wrapper'
  16395.     }, a.createElement('span', {
  16396.       className: 'icon icon-plus badge-option_add-icon'
  16397.     })), a.createElement('span', {
  16398.       className: 'badge-option_title'
  16399.     }, e('Create a new badge')))) : null), c !== f.REMOVE || i.length ? null : a.createElement('div', {
  16400.       className: 'badge-options_empty'
  16401.     }, e('This user doesn\'t have any badges.')), d.errorMessage ? a.createElement('div', {
  16402.       className: 'spacing-top-narrow'
  16403.     }, a.createElement('p', {
  16404.       className: 'text-small modal__option-subtext modal__error'
  16405.     }, d.errorMessage)) : null))), a.createElement('div', {
  16406.       className: 'admin-modal__footer clearfix'
  16407.     }, a.createElement('button', {
  16408.       className: 'button button-fill--brand button-small text-capitalized',
  16409.       onClick: l
  16410.     }, e(c === f.AWARD ? 'Award badge' : 'Remove badge')), a.createElement('button', {
  16411.       className: 'button button-fill button-small text-capitalized',
  16412.       onClick: m
  16413.     }, e('Cancel'))))
  16414.   };
  16415.   return i
  16416. });
  16417. var _extends = Object.assign || function (a) {
  16418.   for (var b = 1; b < arguments.length; b++) {
  16419.     var c = arguments[b];
  16420.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  16421.   }
  16422.   return a
  16423. };
  16424. define('lounge/views/posts/BadgesManageView', [
  16425.   'underscore',
  16426.   'backbone',
  16427.   'core/api',
  16428.   'core/bus',
  16429.   'core/strings',
  16430.   'core/utils',
  16431.   'core/templates/react/BadgesManageTemplate',
  16432.   'core/constants/badgesConstants'
  16433. ], function (a, b, c, d, e, f, g, h) {
  16434.   'use strict';
  16435.   var i = h.ACTION_TYPES,
  16436.   j = h.BADGES_CRITERIA,
  16437.   k = f.preventDefaultHandler,
  16438.   l = e.get,
  16439.   m = b.View.extend({
  16440.     className: 'badges-action',
  16441.     initialize: function (a) {
  16442.       this.forum = a.forum
  16443.     },
  16444.     render: function () {
  16445.       var a = this.$el;
  16446.       return this.badgeAction = this.badgeAction || i.AWARD,
  16447.       this.formValues = _extends({
  16448.         user: this.model.author.id,
  16449.         forum: this.forum.id
  16450.       }, this.formValues),
  16451.       a.html(g({
  16452.         badgeAction: this.badgeAction,
  16453.         formValues: this.formValues,
  16454.         badgeOptions: this.getBadgeOptions(),
  16455.         updateBadgeAction: this.updateBadgeAction.bind(this),
  16456.         updateBadgeSelection: this.updateBadgeSelection.bind(this),
  16457.         handleSubmit: this.submit.bind(this),
  16458.         handleClose: this.cancel.bind(this)
  16459.       })),
  16460.       this.trigger('render'),
  16461.       this
  16462.     },
  16463.     updateBadgeAction: function (a) {
  16464.       this.formValues.badge = null,
  16465.       this.formValues.errorMessage = null,
  16466.       this.badgeAction = a.target.value || a.target.children[0].value,
  16467.       this.render()
  16468.     },
  16469.     updateBadgeSelection: function (a) {
  16470.       this.formValues.errorMessage = null,
  16471.       a.target.disabled || (this.formValues.badge = a.target.value)
  16472.     },
  16473.     getBadgeOptions: function () {
  16474.       var a = [
  16475.       ],
  16476.       b = [
  16477.       ],
  16478.       c = this.forum.get('badges') ? f.deepClone(this.forum.get('badges')) : [
  16479.       ],
  16480.       d = this.model.author.get('badges') || [
  16481.       ];
  16482.       if (this.badgeAction === i.AWARD) {
  16483.         var e = d.map(function (a) {
  16484.           return a.id
  16485.         });
  16486.         Object.keys(c).forEach(function (d) {
  16487.           var f = c[d];
  16488.           f.criteria === j.MANUAL && (e.indexOf(f.id) > - 1 ? (f.disabled = !0, b.push(f)) : a.push(f))
  16489.         })
  16490.       } else this.badgeAction === i.REMOVE && d.forEach(function (c) {
  16491.         c.criteria === j.MANUAL ? a.push(c) : (c.disabled = !0, b.push(c))
  16492.       });
  16493.       return [].concat(a, b)
  16494.     },
  16495.     submit: k(function () {
  16496.       var b = this;
  16497.       if (this.formValues.badge) {
  16498.         this.formValues.errorMessage = null;
  16499.         var e = this.badgeAction === i.AWARD ? 'uiAction:awardBadge' : 'uiAction:removeBadge';
  16500.         c.call('badges/' + this.badgeAction, {
  16501.           method: 'POST',
  16502.           data: a.omit(this.formValues, a.isNull),
  16503.           success: function (a) {
  16504.             b.trigger('success', {
  16505.               action: b.badgeAction,
  16506.               badge: a.response
  16507.             }),
  16508.             d.trigger(e, a.response.id)
  16509.           },
  16510.           error: function (a) {
  16511.             b.formValues.errorMessage = a.responseJSON.response,
  16512.             b.render()
  16513.           }
  16514.         })
  16515.       } else this.badgeAction === i.AWARD ? this.formValues.errorMessage = l('You must select a badge to award') : this.formValues.errorMessage = l('You must select a badge to remove'),
  16516.       this.render()
  16517.     }),
  16518.     cancel: k(function () {
  16519.       this.trigger('cancel')
  16520.     })
  16521.   }, {
  16522.     defaultFormValues: {
  16523.       badge: null,
  16524.       errorMessage: null
  16525.     }
  16526.   });
  16527.   return m
  16528. }),
  16529. define('core/constants/moderationUserLists', [
  16530.   'exports',
  16531.   'moment'
  16532. ], function (a, b) {
  16533.   'use strict';
  16534.   a.LIST_TYPES = {
  16535.     WHITELIST: 'whitelist',
  16536.     BLACKLIST: 'blacklist'
  16537.   },
  16538.   a.BAN_TYPES = {
  16539.     SHADOW: 'shadowban',
  16540.     PERMANENT: 'permanent',
  16541.     TEMP: 'temp'
  16542.   },
  16543.   a.RETROACTIVE_ACTION_TYPES = {
  16544.     DO_NOTHING: '',
  16545.     DELETE: '1',
  16546.     MARK_AS_SPAM: '2'
  16547.   },
  16548.   a.DEFAULT_FORM_VALUES = {
  16549.     durationHours: '24',
  16550.     customDurationAmount: '1',
  16551.     customDurationScale: '1'
  16552.   },
  16553.   a.STORAGE_KEY_BAN_TYPE = 'defaultBan',
  16554.   a.getDateExpires = function (a) {
  16555.     return 'custom' === a.durationHours && (a.durationHours = parseInt(a.customDurationAmount, 10) * parseInt(a.customDurationScale, 10)),
  16556.     b().add(a.durationHours, 'hours').toISOString()
  16557.   },
  16558.   a.isBanTypeSupported = function (b, c) {
  16559.     return !!c && (b === a.BAN_TYPES.SHADOW ? c.shadowBanning : b === a.BAN_TYPES.TEMP ? c.temporaryBanning : Boolean(b))
  16560.   }
  16561. }),
  16562. define('core/templates/react/ModerationUserListsTemplate', [
  16563.   'react',
  16564.   'underscore',
  16565.   'core/strings',
  16566.   'core/constants/moderationUserLists'
  16567. ], function (a, b, c, d) {
  16568.   'use strict';
  16569.   var e = this,
  16570.   f = c.gettext,
  16571.   g = d.LIST_TYPES,
  16572.   h = d.BAN_TYPES,
  16573.   i = d.RETROACTIVE_ACTION_TYPES,
  16574.   j = 168,
  16575.   k = [
  16576.     {
  16577.       label: f('1 day'),
  16578.       durationHours: '24'
  16579.     },
  16580.     {
  16581.       label: f('1 week'),
  16582.       durationHours: j.toString()
  16583.     },
  16584.     {
  16585.       label: f('2 weeks'),
  16586.       durationHours: (2 * j).toString()
  16587.     }
  16588.   ],
  16589.   l = function (c) {
  16590.     var d = c.user,
  16591.     j = c.listName,
  16592.     l = c.ipAddress,
  16593.     m = c.formValues,
  16594.     n = c.supportsShadowBanning,
  16595.     o = c.supportsTempBanning,
  16596.     p = c.selectRetroactiveAction,
  16597.     q = c.toggleBanTypeCallback,
  16598.     r = c.toggleUserValueChecked,
  16599.     s = c.toggleIpAddressChecked,
  16600.     t = c.updateDuration,
  16601.     u = c.updateCustomDurationAmount,
  16602.     v = c.updateCustomDurationScale,
  16603.     w = c.updateReason,
  16604.     x = c.handleSubmit,
  16605.     y = c.handleClose,
  16606.     z = c.handleChangeValue,
  16607.     A = c.closeText,
  16608.     B = c.getPlaceholderForValue,
  16609.     C = c.itemTypes,
  16610.     D = c.itemType,
  16611.     E = c.UpgradeIcon,
  16612.     F = c.itemValue;
  16613.     return j ? a.createElement('form', {
  16614.       className: j + '-form'
  16615.     }, a.createElement('div', {
  16616.       className: 'admin-modal__content padding-bottom'
  16617.     }, a.createElement('div', null, j === g.WHITELIST ? a.createElement('p', {
  16618.       className: 'spacing-default'
  16619.     }, f('Adding this person to the whitelist will automatically approve his or her new comments from now on.')) : a.createElement('div', {
  16620.       className: 'align align--stretch align--wrap'
  16621.     }, a.createElement('label', {
  16622.       className: [
  16623.         'padding-default',
  16624.         'align',
  16625.         'align__item--grow',
  16626.         'align__item--equal',
  16627.         'align--center',
  16628.         'align--column',
  16629.         'modal__option',
  16630.         'ban__option',
  16631.         o ? null : '-disabled',
  16632.         m.type === h.TEMP ? '-selected' : null
  16633.       ].join(' ')
  16634.     }, a.createElement('input', {
  16635.       type: 'radio',
  16636.       name: 'ban_type',
  16637.       value: h.TEMP,
  16638.       checked: m.type === h.TEMP,
  16639.       onChange: q,
  16640.       disabled: !o
  16641.     }), a.createElement('p', {
  16642.       className: 'text-semibold text-center modal__option-text ban__option-text'
  16643.     }, f('Timeout'), o ? null : a.createElement(E, {
  16644.       tooltipClass: 'tooltip-timeout'
  16645.     }))), j === g.BLACKLIST && m.type === h.TEMP ? a.createElement('div', {
  16646.       className: 'padding-default modal__description ban__description border-bottom-dark'
  16647.     }, a.createElement('div', {
  16648.       className: 'text-small modal__option-subtext ban__option-subtext'
  16649.     }, f('Restrict a user\'s ability to comment for a period of time. This notifies the user of their timeout. If discussions get heated, enforce timeouts so that users cool off and improve their behavior.'), k.map(function (b) {
  16650.       return a.createElement('label', {
  16651.         className: 'fieldset__block--checkbox text-medium spacing-bottom-small text-semibold text-gray-dark',
  16652.         key: b.durationHours
  16653.       }, a.createElement('input', {
  16654.         type: 'radio',
  16655.         name: 'duration',
  16656.         checked: m.durationHours === b.durationHours,
  16657.         onChange: t,
  16658.         value: b.durationHours,
  16659.         className: 'spacing-right-small'
  16660.       }), b.label)
  16661.     }), a.createElement('div', null, a.createElement('label', {
  16662.       className: 'text-medium spacing-bottom-small inline__item spacing-right text-semibold text-gray-dark'
  16663.     }, a.createElement('input', {
  16664.       type: 'radio',
  16665.       name: 'duration',
  16666.       checked: 'custom' === m.durationHours,
  16667.       onChange: t,
  16668.       value: 'custom',
  16669.       className: 'spacing-right-small'
  16670.     }), f('Custom')), a.createElement('input', {
  16671.       name: 'customDurationAmount',
  16672.       type: 'number',
  16673.       value: m.customDurationAmount,
  16674.       onChange: u,
  16675.       onFocus: u,
  16676.       onKeyPress: u,
  16677.       className: 'spacing-right-small -text-small',
  16678.       maxLength: '2',
  16679.       style: {
  16680.         width: '50px'
  16681.       },
  16682.       min: '0'
  16683.     }), a.createElement('select', {
  16684.       value: m.customDurationScale,
  16685.       onChange: v
  16686.     }, a.createElement('option', {
  16687.       value: '1'
  16688.     }, 'Hour(s)'), a.createElement('option', {
  16689.       value: '24'
  16690.     }, 'Day(s)'), a.createElement('option', {
  16691.       value: 168 .toString()
  16692.     }, 'Week(s)'))))) : null, a.createElement('label', {
  16693.       className: [
  16694.         'padding-default',
  16695.         'align',
  16696.         'align__item--grow',
  16697.         'align__item--equal',
  16698.         'align--center',
  16699.         'align--column',
  16700.         'modal__option',
  16701.         'ban__option',
  16702.         n ? null : '-disabled',
  16703.         m.type === h.SHADOW ? '-selected' : null
  16704.       ].join(' ')
  16705.     }, a.createElement('input', {
  16706.       type: 'radio',
  16707.       name: 'ban_type',
  16708.       value: h.SHADOW,
  16709.       checked: m.type === h.SHADOW,
  16710.       onChange: q,
  16711.       disabled: !n
  16712.     }), a.createElement('p', {
  16713.       className: 'text-semibold text-center modal__option-text ban__option-text'
  16714.     }, f('Shadow Ban'), n ? null : a.createElement(E, null))), j === g.BLACKLIST && m.type === h.SHADOW ? a.createElement('div', {
  16715.       className: 'modal__description ban__description border-bottom-dark'
  16716.     }, a.createElement('p', {
  16717.       className: 'text-small modal__option-subtext ban__option-subtext'
  16718.     }, f('Ban a user without them knowing. The user can still comment, however, their posts will only be visible to themselves. Use it against trolls and spammers who attempt to circumvent a ban with new accounts.'))) : null, a.createElement('label', {
  16719.       className: [
  16720.         'padding-default',
  16721.         'align',
  16722.         'align__item--grow',
  16723.         'align__item--equal',
  16724.         'align--center',
  16725.         'align--column',
  16726.         'modal__option',
  16727.         'ban__option',
  16728.         m.type === h.PERMANENT ? '-selected' : null
  16729.       ].join(' ')
  16730.     }, a.createElement('input', {
  16731.       type: 'radio',
  16732.       name: 'ban_type',
  16733.       value: h.PERMANENT,
  16734.       checked: m.type === h.PERMANENT,
  16735.       onChange: q
  16736.     }), a.createElement('p', {
  16737.       className: 'text-semibold text-center modal__option-text ban__option-text'
  16738.     }, 'Permanent Ban')), j === g.BLACKLIST && m.type === h.PERMANENT ? a.createElement('div', {
  16739.       className: 'modal__description ban__description border-bottom-dark'
  16740.     }, a.createElement('p', {
  16741.       className: 'text-small modal__option-subtext ban__option-subtext'
  16742.     }, f('Permanently ban the user so they can no longer post, vote, or flag comments on your site. If the user repeatedly violates your comment policy, revoke their ability to participate.'), a.createElement('label', {
  16743.       className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
  16744.     }, a.createElement('span', {
  16745.       className: 'text-semibold text-gray-dark'
  16746.     }, f('Last 30 days of comments:'), ' '), a.createElement('select', {
  16747.       value: m.retroactiveAction,
  16748.       onChange: p,
  16749.       className: 'custom-select'
  16750.     }, a.createElement('option', {
  16751.       value: i.DO_NOTHING
  16752.     }, f('Do nothing')), a.createElement('option', {
  16753.       value: i.DELETE
  16754.     }, f('Delete')), a.createElement('option', {
  16755.       value: i.MARK_AS_SPAM
  16756.     }, f('Mark as spam')))))) : null)), a.createElement('div', {
  16757.       className: 'padding-default modal__config ban__config'
  16758.     }, !d || d.isAnonymous ? null : a.createElement('div', {
  16759.       className: 'align align--stretch access__block spacing-bottom embed-hidden'
  16760.     }, a.createElement('a', {
  16761.       href: d.profileUrl,
  16762.       className: 'spacing-right'
  16763.     }, a.createElement('img', {
  16764.       src: d.avatar.cache,
  16765.       alt: d.name,
  16766.       className: 'comment-__avatar border-radius-sm'
  16767.     })), a.createElement('div', {
  16768.       className: 'access__value'
  16769.     }, a.createElement('h4', null, d.name), a.createElement('p', {
  16770.       className: 'text-gray text-small'
  16771.     }, ' ', d.username, ' '))), d ? a.createElement('label', {
  16772.       className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
  16773.     }, a.createElement('input', {
  16774.       type: 'checkbox',
  16775.       checked: Boolean(m.username),
  16776.       onChange: b.partial(r, b, 'username'),
  16777.       className: 'spacing-right-small'
  16778.     }), f('User:'), ' ', ' ', a.createElement('strong', null, ' ', d.username, ' ')) : a.createElement(a.Fragment, null, a.createElement('div', {
  16779.       className: 'spacing-top spacing-bottom form-attribute-input'
  16780.     }, a.createElement('div', null, a.createElement('h3', {
  16781.       className: 'text-gray-darker'
  16782.     }, 'Type')), a.createElement('select', {
  16783.       name: 'itemType',
  16784.       className: 'input--select',
  16785.       value: e.itemType,
  16786.       onChange: z,
  16787.       disabled: C.length <= 1
  16788.     }, C.map(function (b) {
  16789.       return a.createElement('option', {
  16790.         key: b.value,
  16791.         value: b.value
  16792.       }, ' ', b.displayName, ' ')
  16793.     }))), a.createElement('div', {
  16794.       className: 'spacing-top spacing-bottom form-attribute-input'
  16795.     }, a.createElement('h3', {
  16796.       className: 'text-gray-darker'
  16797.     }, 'Value'), a.createElement('div', null, a.createElement('input', {
  16798.       className: 'input--textbox',
  16799.       name: 'itemValue',
  16800.       type: 'text',
  16801.       placeholder: B(D),
  16802.       value: F,
  16803.       onChange: z
  16804.     })))), d && j === g.BLACKLIST ? a.createElement('label', {
  16805.       className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
  16806.     }, a.createElement('input', {
  16807.       type: 'checkbox',
  16808.       checked: Boolean(m.email),
  16809.       onChange: b.partial(r, b, 'email'),
  16810.       className: 'spacing-right-small'
  16811.     }), f('Email:'), ' ', a.createElement('strong', null, ' ', d.email, ' ')) : null, j === g.BLACKLIST && l ? a.createElement('label', {
  16812.       className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
  16813.     }, a.createElement('input', {
  16814.       type: 'checkbox',
  16815.       checked: Boolean(m.ipAddress),
  16816.       onChange: s,
  16817.       className: 'spacing-right-small'
  16818.     }), f('IP Address:'), ' ', a.createElement('strong', null, ' ', l, ' '), a.createElement('div', {
  16819.       className: [
  16820.         'spacing-default-narrow',
  16821.         'text-small',
  16822.         'text-gray',
  16823.         'spacing-left-large',
  16824.         'embed-hidden'
  16825.       ].join(' ')
  16826.     }, a.createElement('strong', null, f('Note:'), ' '), f('Adding an IP address to the banned list may also unintentionally block others who may share this IP address.'))) : null, j === g.BLACKLIST ? a.createElement('div', null, a.createElement('div', {
  16827.       className: 'spacing-bottom-small spacing-top-narrow'
  16828.     }, a.createElement('label', {
  16829.       className: 'modal__reason ban__reason'
  16830.     }, f('Reason for banning:'), a.createElement('input', {
  16831.       name: 'reason',
  16832.       type: 'text',
  16833.       value: m.reason || '',
  16834.       onChange: w,
  16835.       className: 'input--textbox -text-small border-gray-light',
  16836.       maxLength: '50'
  16837.     }))), a.createElement('p', {
  16838.       className: 'text-small modal__option-subtext ban__option-subtext'
  16839.     }, f('You can remove the user from the banned list at any time.'))) : null)), a.createElement('div', {
  16840.       className: 'admin-modal__footer clearfix'
  16841.     }, a.createElement('div', null, a.createElement('button', {
  16842.       className: [
  16843.         'button',
  16844.         'button-fill--brand',
  16845.         'button-small',
  16846.         'text-capitalized'
  16847.       ].join(' '),
  16848.       disabled: !(m.email || m.username || m.ipAddress || F),
  16849.       onClick: x
  16850.     }, f(j === g.WHITELIST ? 'Add to Trusted List' : 'Add to Banned List')), j === g.BLACKLIST ? a.createElement('button', {
  16851.       className: [
  16852.         'button',
  16853.         'button-fill',
  16854.         'button-small',
  16855.         'text-capitalized'
  16856.       ].join(' '),
  16857.       onClick: y
  16858.     }, f(A)) : null))) : null
  16859.   };
  16860.   return l
  16861. }),
  16862. define('lounge/utils', [
  16863.   'jquery',
  16864.   'core/api'
  16865. ], function (a, b) {
  16866.   'use strict';
  16867.   var c = {
  16868.   },
  16869.   d = function (d) {
  16870.     if (c[d]) return c[d];
  16871.     var e = a.Deferred();
  16872.     return d ? (c[d] = e.promise(), b.call('forums/details', {
  16873.       method: 'GET',
  16874.       data: {
  16875.         forum: d,
  16876.         attach: 'forumFeatures'
  16877.       }
  16878.     }).done(function (a) {
  16879.       e.resolve(a.response.features)
  16880.     }).fail(function () {
  16881.       e.reject({
  16882.       })
  16883.     }), e.promise()) : e.reject({
  16884.     })
  16885.   };
  16886.   return d._clearCache = function () {
  16887.     c = {
  16888.     }
  16889.   },
  16890.   {
  16891.     getSaasFeatures: d
  16892.   }
  16893. });
  16894. var _extends = Object.assign || function (a) {
  16895.   for (var b = 1; b < arguments.length; b++) {
  16896.     var c = arguments[b];
  16897.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  16898.   }
  16899.   return a
  16900. };
  16901. define('lounge/views/posts/BlacklistView', [
  16902.   'jquery',
  16903.   'underscore',
  16904.   'backbone',
  16905.   'react',
  16906.   'moment',
  16907.   'core/bus',
  16908.   'core/api',
  16909.   'core/utils',
  16910.   'core/utils/storage',
  16911.   'core/templates/react/ModerationUserListsTemplate',
  16912.   'core/constants/moderationUserLists',
  16913.   'lounge/utils',
  16914.   'lounge/views/cards'
  16915. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m) {
  16916.   'use strict';
  16917.   var n = k.BAN_TYPES,
  16918.   o = k.LIST_TYPES,
  16919.   p = k.STORAGE_KEY_BAN_TYPE,
  16920.   q = k.RETROACTIVE_ACTION_TYPES,
  16921.   r = k.DEFAULT_FORM_VALUES,
  16922.   s = k.getDateExpires,
  16923.   t = k.isBanTypeSupported,
  16924.   u = h.preventDefaultHandler,
  16925.   v = c.View.extend({
  16926.     className: 'moderate',
  16927.     initialize: function (b) {
  16928.       this.forum = b.forum;
  16929.       var c = [
  16930.         l.getSaasFeatures(this.model.get('forum'))
  16931.       ];
  16932.       this.model.get('ipAddress') && this.model.author.get('email') || c.push(this.model.fetch()),
  16933.       this.loading = a.when.apply(a, c)
  16934.     },
  16935.     render: function () {
  16936.       var a = this,
  16937.       b = this.$el;
  16938.       return b.addClass('loading'),
  16939.       f.trigger('uiAction:viewBanUser'),
  16940.       this.loading.always(function (c) {
  16941.         var e = a.model.author,
  16942.         f = i.get(p);
  16943.         a.saasFeatures = c,
  16944.         a.formValues = _extends({
  16945.         }, r, {
  16946.           type: t(f, c) ? f : n.PERMANENT,
  16947.           username: e.get('username'),
  16948.           email: e.get('email'),
  16949.           user: e.get('id'),
  16950.           postId: a.model.id
  16951.         }, a.formValues),
  16952.         b.removeClass('loading'),
  16953.         b.html(j({
  16954.           user: e.toJSON(),
  16955.           listName: o.BLACKLIST,
  16956.           ipAddress: a.model.get('ipAddress'),
  16957.           formValues: a.formValues,
  16958.           supportsShadowBanning: t(n.SHADOW, a.saasFeatures),
  16959.           supportsTempBanning: t(n.TEMP, a.saasFeatures),
  16960.           selectRetroactiveAction: a.selectRetroactiveAction.bind(a),
  16961.           toggleBanTypeCallback: a.toggleBanTypeCallback.bind(a),
  16962.           toggleUserValueChecked: a.toggleUserValueChecked.bind(a),
  16963.           toggleIpAddressChecked: a.toggleIpAddressChecked.bind(a),
  16964.           updateReason: a.updateReason.bind(a),
  16965.           updateDuration: a.updateDuration.bind(a),
  16966.           updateCustomDurationAmount: a.updateCustomDurationAmount.bind(a),
  16967.           updateCustomDurationScale: a.updateCustomDurationScale.bind(a),
  16968.           handleSubmit: a.submit.bind(a),
  16969.           handleClose: a.cancel.bind(a),
  16970.           closeText: 'Cancel',
  16971.           UpgradeIcon: function () {
  16972.             return d.createElement('span', {
  16973.               className: 'text-largest text-yellow icon-upgrade-arrow-pro media-middle spacing-left upgrade-card',
  16974.               'data-role': 'upgrade-card-target'
  16975.             })
  16976.           }
  16977.         })),
  16978.         a.initUpgradeCard()
  16979.       }),
  16980.       this.trigger('render'),
  16981.       this
  16982.     },
  16983.     initUpgradeCard: function () {
  16984.       var b = m.UpgradeCard.create({
  16985.         organization: this.forum ? {
  16986.           id: this.forum.get('organizationId')
  16987.         }
  16988.          : null
  16989.       });
  16990.       this.$('[data-role=upgrade-card-target]').each(function () {
  16991.         b.target(a(this))
  16992.       }),
  16993.       this.listenToOnce(b, 'show', function () {
  16994.         f.trigger('uiAction:viewUpgradeCard')
  16995.       }),
  16996.       this.listenTo(b, 'click:upgrade', function (a) {
  16997.         a.stopPropagation(),
  16998.         f.trigger('uiAction:clickUpgrade')
  16999.       })
  17000.     },
  17001.     toggleBanType: function (a, b) {
  17002.       t(b, this.saasFeatures) && (this.formValues.type = b, i.set(p, b), this.render())
  17003.     },
  17004.     toggleBanTypeCallback: function (a) {
  17005.       this.toggleBanType(a, a.target.value)
  17006.     },
  17007.     selectRetroactiveAction: function (a) {
  17008.       this.formValues.retroactiveAction = a.target.value || q.DO_NOTHING
  17009.     },
  17010.     toggleUserValueChecked: function (a, b) {
  17011.       this.formValues[b] = a.target.checked ? 1 : 0
  17012.     },
  17013.     toggleIpAddressChecked: function (a) {
  17014.       this.formValues.ipAddress = a.target.checked ? 1 : 0
  17015.     },
  17016.     updateReason: function (a) {
  17017.       this.formValues.reason = a.target.value
  17018.     },
  17019.     updateDuration: function (a) {
  17020.       this.formValues.durationHours = a.target.value
  17021.     },
  17022.     updateCustomDurationAmount: function (a) {
  17023.       var b = this;
  17024.       if ('keypress' === a.type && /[^\d]/.test(a.key)) return void a.preventDefault();
  17025.       var c = a.target.value,
  17026.       d = 'custom';
  17027.       this.formValues.customDurationAmount === c && this.formValues.durationHours === d || (this.formValues.customDurationAmount = c, this.formValues.durationHours = d, a.target === window.document.activeElement && this.once('render', function () {
  17028.         b.$('input[name=customDurationAmount]').focus()
  17029.       }), this.render())
  17030.     },
  17031.     updateCustomDurationScale: function (a) {
  17032.       this.formValues.customDurationScale = a.target.value,
  17033.       this.formValues.durationHours = 'custom',
  17034.       this.render()
  17035.     },
  17036.     cancel: u(function () {
  17037.       this.trigger('cancel')
  17038.     }),
  17039.     submit: u(function () {
  17040.       var a = this,
  17041.       c = this.formValues.type === n.TEMP ? s(this.formValues) : null;
  17042.       f.trigger('uiAction:clickBanUser', JSON.stringify({
  17043.         date_expires: c,
  17044.         date_added: e().toISOString()
  17045.       }));
  17046.       var d = {
  17047.         post: this.formValues.postId,
  17048.         notes: this.formValues.reason,
  17049.         shadowBan: this.formValues.type === n.SHADOW ? 1 : 0,
  17050.         dateExpires: c
  17051.       };
  17052.       this.formValues.email && (d.banEmail = 1),
  17053.       this.formValues.username && (d.banUser = 1),
  17054.       this.formValues.ipAddress && (d.banIp = 1),
  17055.       this.formValues.type === n.PERMANENT && (d.retroactiveAction = this.formValues.retroactiveAction),
  17056.       d.post && g.call('forums/block/banPostAuthor.json', {
  17057.         method: 'POST',
  17058.         data: b.omit(d, b.isNull),
  17059.         success: function () {
  17060.           a.trigger('success')
  17061.         }
  17062.       })
  17063.     })
  17064.   }, {
  17065.     defaultFormValues: {
  17066.       postId: null,
  17067.       username: null,
  17068.       email: null,
  17069.       ipAddress: null,
  17070.       reason: '',
  17071.       retroactiveAction: null
  17072.     }
  17073.   });
  17074.   return v
  17075. }),
  17076. define('templates/lounge/edit', [
  17077.   'react',
  17078.   'core/switches'
  17079. ], function (a, b) {
  17080.   'use strict';
  17081.   var c = function (c) {
  17082.     var d = c.forum.id,
  17083.     e = b.isFeatureActive('embed_refresh', {
  17084.       forum: d
  17085.     }),
  17086.     f = b.isFeatureActive('embed_v2', {
  17087.       forum: d
  17088.     }),
  17089.     g = e ? 'textarea-outer-wrapper textarea-outer-wrapper--refresh' : 'textarea-outer-wrapper',
  17090.     h = f ? 'textarea-wrapper textarea-wrapper--embedv2' : 'textarea-wrapper';
  17091.     return a.createElement('div', {
  17092.       className: g
  17093.     }, a.createElement('div', {
  17094.       className: 'ratings-wrapper',
  17095.       'data-role': 'ratings-container'
  17096.     }), a.createElement('div', {
  17097.       className: h,
  17098.       'data-role': 'textarea'
  17099.     }, a.createElement('div', {
  17100.       className: 'edit-alert',
  17101.       role: 'postbox-alert'
  17102.     }), a.createElement('div', {
  17103.       className: 'text-editor-container'
  17104.     })))
  17105.   };
  17106.   return c
  17107. }),
  17108. define('lounge/views/posts/PostEditView', [
  17109.   'backbone',
  17110.   'moment',
  17111.   'underscore',
  17112.   'core/bus',
  17113.   'core/mixins/withAlert',
  17114.   'core/strings',
  17115.   'core/switches',
  17116.   'core/time',
  17117.   'core/views/TextareaView',
  17118.   'core/utils/threadRatingsHelpers',
  17119.   'lounge/common',
  17120.   'lounge/mixins/asTextEditor',
  17121.   'lounge/mixins/asTextEditorV2',
  17122.   'lounge/mixins/withStarRatings',
  17123.   'lounge/views/posts/DummyTextareaView',
  17124.   'templates/lounge/edit',
  17125.   'templates/lounge/textEditor'
  17126. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) {
  17127.   'use strict';
  17128.   var r = f.get,
  17129.   s = a.View.extend({
  17130.     tagName: 'form',
  17131.     className: 'edit',
  17132.     events: {
  17133.       submit: 'submitForm',
  17134.       'click [data-action=cancel]': 'cancel'
  17135.     },
  17136.     initialize: function (a) {
  17137.       this.post = a.post,
  17138.       this.session = a.session,
  17139.       this.thread = a.thread,
  17140.       this.isRefreshEnabled = g.isFeatureActive('embed_refresh', {
  17141.         forum: this.thread.forum.id
  17142.       }),
  17143.       this.isRefreshV2Enabled = this.isRefreshEnabled && g.isFeatureActive('embed_refresh_v2', {
  17144.         forum: this.thread.forum.id
  17145.       }),
  17146.       this.$el.addClass(this.isRefreshEnabled ? 'form-refresh' : ''),
  17147.       this.$el.addClass(this.isRefreshV2Enabled ? 'form-refresh-v2' : ''),
  17148.       this._alertSelector = '[role=postbox-alert]',
  17149.       this.textEditorTemplate = q,
  17150.       this.postEditMode = !0
  17151.     },
  17152.     cancel: function () {
  17153.       this.trigger('cancel')
  17154.     },
  17155.     getEditTimeLeft: function () {
  17156.       var a,
  17157.       c = b().format(h.ISO_8601);
  17158.       return a = c < this.post.get('editableUntil') ? f.interpolate(r('You have until %(editableUntil)s to edit this comment.'), {
  17159.         editableUntil: this.post.getRelativeCreatedAt('editableUntil')
  17160.       }) : r('The edit period for this comment has expired.'),
  17161.       '<div class="edit-time-left">' + a + ' <a class="edit-time-message"href="https://help.disqus.com/commenting/remove-and-edit-your-comments"target="_blank"rel="noopener noreferrer"align="center">' + r('Learn more') + '</a></div>'
  17162.     },
  17163.     getEditorProps: function () {
  17164.       return {
  17165.         focusOnLoad: !0,
  17166.         onSubmit: this.submitForm.bind(this, null),
  17167.         isEdit: !0,
  17168.         onCancel: this.cancel.bind(this),
  17169.         initialState: this.post.toJSON().message
  17170.       }
  17171.     },
  17172.     render: function () {
  17173.       var a = this.post.toJSON();
  17174.       this.$el.html(p({
  17175.         post: a,
  17176.         user: this.session.toJSON(),
  17177.         forum: this.thread.forum
  17178.       }));
  17179.       var b = this.getEditTimeLeft();
  17180.       if (this.isEmbedV2Enabled) this.loadEditorV2(this.getEditorProps()),
  17181.       this.textarea = new o,
  17182.       this.$('[data-role=textarea]').after(b);
  17183.        else {
  17184.         this.initTextEditor();
  17185.         var c = this.textarea = new i({
  17186.           value: a.raw_message
  17187.         });
  17188.         this.$('[data-role=textarea]').prepend(c.render().el).after(b)
  17189.       }
  17190.       return this.initStarRatings(),
  17191.       this
  17192.     },
  17193.     resize: function () {
  17194.       var a = k.getLounge();
  17195.       a && this.textarea && this.textarea.$input && this.textarea.$input.on('transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd', function () {
  17196.         a.resize()
  17197.       }),
  17198.       this.textarea.resize()
  17199.     },
  17200.     submitForm: function (a, b) {
  17201.       this.dismissAlert(),
  17202.       a && a.preventDefault() && a.preventDefault();
  17203.       var e = this,
  17204.       f = {
  17205.         raw_message: b || this.textarea.get(),
  17206.         rating: this.rating
  17207.       },
  17208.       g = e.post.validateMessage(f);
  17209.       return void 0 !== g ? this.alert(g, {
  17210.         type: 'error'
  17211.       }) : void e.post.save(f, {
  17212.         success: function () {
  17213.           e.trigger('submitted'),
  17214.           d.trigger('uiCallback:postUpdated', e.post, {
  17215.             area: 'main'
  17216.           }),
  17217.           c.isNumber(e.rating) && j.isThreadModelRatingsEnabled(e.thread) && (e.thread.set('userRating', e.rating), c.delay(c.bind(e.thread.fetchRatings, e.thread), 500))
  17218.         },
  17219.         error: function (a, b) {
  17220.           var c;
  17221.           return c = b.response.indexOf('Comment edit period expired') > - 1 ? r('You can no longer edit this comment. Comments can only be edited within 7 days after posting.') + ' <a href="https://help.disqus.com/commenting/remove-and-edit-your-comments" target="_blank" rel="noopener noreferrer"style="color:white ! important" >' + r('Learn more') + '</a>' : b.response,
  17222.           e.alert(c, {
  17223.             type: 'error',
  17224.             safe: !0
  17225.           })
  17226.         }
  17227.       })
  17228.     },
  17229.     remove: function () {
  17230.       this.$el.remove()
  17231.     }
  17232.   });
  17233.   return e.call(s.prototype),
  17234.   n.call(s.prototype),
  17235.   l.call(s.prototype),
  17236.   m.call(s.prototype),
  17237.   s
  17238. }),
  17239. define('lounge/views/posts/TypingUserView', [
  17240.   'backbone',
  17241.   'core/strings',
  17242.   'core/switches',
  17243.   'core/utils/object/get'
  17244. ], function (a, b, c, d) {
  17245.   'use strict';
  17246.   var e = b.get,
  17247.   f = a.View.extend({
  17248.     initialize: function (a) {
  17249.       this.options = a
  17250.     },
  17251.     render: function () {
  17252.       var a,
  17253.       d = this.options.parentView.reply,
  17254.       f = d && d.typingUser,
  17255.       g = this.model.usersTyping.count(f && f.id),
  17256.       h = c.isFeatureActive('embed_refresh', {
  17257.         forum: this.model.get('forum')
  17258.       });
  17259.       return g <= 0 ? void this.$el.hide() : (1 === g ? a = e(h ? '1 person writing a comment…' : 'One other person is typing…') : (a = e(h ? '%(num)s people writing comments…' : '%(num)s other people are typing…'), a = b.interpolate(a, {
  17260.         num: g
  17261.       })), this.$el.text(a), this.$el.show(), this)
  17262.     }
  17263.   });
  17264.   return f
  17265. });
  17266. var _extends = Object.assign || function (a) {
  17267.   for (var b = 1; b < arguments.length; b++) {
  17268.     var c = arguments[b];
  17269.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  17270.   }
  17271.   return a
  17272. };
  17273. define('templates/lounge/flaggingReasons', [
  17274.   'react',
  17275.   'core/strings'
  17276. ], function (a, b) {
  17277.   'use strict';
  17278.   var c = b.gettext,
  17279.   d = [
  17280.     {
  17281.       id: 6,
  17282.       title: c('I disagree with this user')
  17283.     },
  17284.     {
  17285.       id: 0,
  17286.       title: c('Targeted harassment'),
  17287.       description: c('posted or encouraged others to post harassing comments or hate speech targeting me, other individuals, or groups')
  17288.     },
  17289.     {
  17290.       id: 1,
  17291.       title: c('Spam'),
  17292.       description: c('posted spam comments or discussions')
  17293.     },
  17294.     {
  17295.       id: 2,
  17296.       title: c('Inappropriate profile'),
  17297.       description: c('profile contains inappropriate images or text')
  17298.     },
  17299.     {
  17300.       id: 3,
  17301.       title: c('Threatening content'),
  17302.       description: c('posted directly threatening content')
  17303.     },
  17304.     {
  17305.       id: 4,
  17306.       title: c('Impersonation'),
  17307.       description: c('misrepresents themselves as someone else')
  17308.     },
  17309.     {
  17310.       id: 5,
  17311.       title: c('Private information'),
  17312.       description: c('posted someone else\'s personally identifiable information')
  17313.     }
  17314.   ],
  17315.   e = function (b) {
  17316.     var c = b.id,
  17317.     d = b.title,
  17318.     e = b.description,
  17319.     f = b.updateReason;
  17320.     return a.createElement('label', {
  17321.       className: [
  17322.         'padding-default',
  17323.         'flagging__reason'
  17324.       ].join(' ')
  17325.     }, a.createElement('input', {
  17326.       type: 'radio',
  17327.       name: 'reason',
  17328.       value: c,
  17329.       onChange: f
  17330.     }), a.createElement('p', {
  17331.       className: 'text-bold flagging__reason-text'
  17332.     }, d, e ? a.createElement('span', {
  17333.       className: 'text-small text-normal'
  17334.     }, ' — ', e) : null))
  17335.   },
  17336.   f = function (b) {
  17337.     var f = b.updateReason,
  17338.     g = b.handleSubmit,
  17339.     h = b.handleCancel;
  17340.     return a.createElement('form', {
  17341.       className: 'flagging-form'
  17342.     }, a.createElement('div', {
  17343.       className: 'flagging__title text-semibold'
  17344.     }, c('Flag Comment')), a.createElement('div', {
  17345.       className: 'flagging__content'
  17346.     }, a.createElement('p', {
  17347.       className: 'flagging__subtitle text-semibold'
  17348.     }, c('Why are you flagging this comment?')), d.map(function (b) {
  17349.       return a.createElement(e, _extends({
  17350.         key: b.id,
  17351.         updateReason: f
  17352.       }, b))
  17353.     }), a.createElement('p', {
  17354.       className: 'flagging__reason-subtext'
  17355.     }, c('Before flagging, please keep in mind that %(disqus)s does not moderate communities. Your username will be shown to the moderator, so you should only flag this comment for one of the reasons listed above.', {
  17356.       disqus: 'Disqus'
  17357.     }))), a.createElement('div', {
  17358.       className: 'admin-modal__footer -mobile clearfix'
  17359.     }, a.createElement('button', {
  17360.       className: 'button button-fill--brand',
  17361.       onClick: g
  17362.     }, c('Flag Comment')), ' ', a.createElement('button', {
  17363.       className: 'button button-fill',
  17364.       onClick: h
  17365.     }, c('Cancel'))))
  17366.   };
  17367.   return f
  17368. }),
  17369. define('templates/lounge/flaggingUserBlocking', [
  17370.   'react',
  17371.   'core/strings',
  17372.   'core/switches',
  17373.   'templates/lounge/partials/profileLink'
  17374. ], function (a, b, c, d) {
  17375.   'use strict';
  17376.   var e = b.gettext,
  17377.   f = function (b) {
  17378.     var f = b.user,
  17379.     g = b.forumId,
  17380.     h = b.handleBlock,
  17381.     i = b.handleComplete;
  17382.     return a.createElement('div', {
  17383.       className: 'flagging__blocking-form'
  17384.     }, a.createElement('div', {
  17385.       className: 'flagging__title text-semibold'
  17386.     }, e('Thanks for your feedback!')), c.isFeatureActive('sso_less_branding', {
  17387.       forum: g
  17388.     }) ? a.createElement('div', {
  17389.       className: 'admin-modal__footer -mobile clearfix'
  17390.     }, a.createElement('button', {
  17391.       className: 'button button-fill--brand',
  17392.       onClick: i
  17393.     }, e('Done'))) : [
  17394.       a.createElement('div', {
  17395.         key: 'blocking-0',
  17396.         className: 'flagging__blocking-content'
  17397.       }, a.createElement('p', {
  17398.         className: 'flagging__subtitle text-semibold'
  17399.       }, e('Other tools for you:')), a.createElement('p', {
  17400.         className: 'spacing-bottom'
  17401.       }, e('Blocking this user will hide all of their activity and comments from your %(disqus)s content, feeds, and notifications.', {
  17402.         disqus: 'Disqus'
  17403.       })), a.createElement('p', {
  17404.         className: 'spacing-top spacing-bottom-none'
  17405.       }, e('Would you like to block %(user)s?', {
  17406.         user: a.createElement(d, {
  17407.           user: f,
  17408.           forumId: g,
  17409.           className: 'text-semibold'
  17410.         }, f.name)
  17411.       }))),
  17412.       a.createElement('div', {
  17413.         key: 'blocking-1',
  17414.         className: 'admin-modal__footer -mobile clearfix'
  17415.       }, a.createElement('div', null, a.createElement('button', {
  17416.         className: 'button button-fill--red',
  17417.         onClick: h
  17418.       }, e('Block User')), ' ', a.createElement('button', {
  17419.         className: 'button button-fill',
  17420.         onClick: i
  17421.       }, e('No Thanks'))))
  17422.     ])
  17423.   };
  17424.   return f
  17425. }),
  17426. define('templates/lounge/flaggingUserBlocked', [
  17427.   'react',
  17428.   'core/strings'
  17429. ], function (a, b) {
  17430.   'use strict';
  17431.   var c = b.gettext,
  17432.   d = function (b) {
  17433.     var d = b.displayName,
  17434.     e = b.handleComplete,
  17435.     f = b.error;
  17436.     return a.createElement('div', {
  17437.       className: 'flagging__blocking-complete'
  17438.     }, a.createElement('div', {
  17439.       className: 'flagging__title'
  17440.     }, c('Blocked User')), a.createElement('div', {
  17441.       className: 'flagging__blocking-complete-content'
  17442.     }, a.createElement('img', {
  17443.       className: 'flagging-pam',
  17444.       alt: 'Pam',
  17445.       src: 'https://c.disquscdn.com/next/embed/assets/img/PamX.fe88e2955f3d594a6cc13c66569ed7d0.svg'
  17446.     }), f ? a.createElement('p', {
  17447.       className: 'spacing-top-bottom'
  17448.     }, f) : a.createElement('div', null, a.createElement('p', {
  17449.       className: 'spacing-top-bottom text-semibold'
  17450.     }, c('You\'ve blocked %(user)s.', {
  17451.       user: d
  17452.     })), a.createElement('p', {
  17453.       className: 'spacing-top-bottom'
  17454.     }, c('You won\'t see comments from this user on %(disqus)s in discussions, notifications, and more.', {
  17455.       disqus: 'Disqus'
  17456.     })))), a.createElement('div', {
  17457.       className: 'admin-modal__footer -mobile clearfix'
  17458.     }, a.createElement('div', null, a.createElement('button', {
  17459.       className: 'button button-fill--brand',
  17460.       onClick: e
  17461.     }, c('Done')), ' ', a.createElement('a', {
  17462.       className: 'button button-fill',
  17463.       href: 'https://disqus.com/home/settings/blocking/',
  17464.       target: '_blank',
  17465.       rel: 'noopener noreferrer',
  17466.       onClick: e
  17467.     }, c('Manage Blocked Users')))))
  17468.   };
  17469.   return d
  17470. }),
  17471. define('lounge/views/posts/FlaggingView', [
  17472.   'backbone',
  17473.   'core/api',
  17474.   'core/utils',
  17475.   'core/bus',
  17476.   'core/strings',
  17477.   'templates/lounge/flaggingReasons',
  17478.   'templates/lounge/flaggingUserBlocking',
  17479.   'templates/lounge/flaggingUserBlocked'
  17480. ], function (a, b, c, d, e, f, g, h) {
  17481.   'use strict';
  17482.   var i = c.preventDefaultHandler,
  17483.   j = e.gettext,
  17484.   k = a.View.extend({
  17485.     className: 'moderate',
  17486.     render: function () {
  17487.       if (this.model.get('isFlaggedByUser')) if (this.blockComplete) {
  17488.         var a = this.model.author;
  17489.         this.$el.html(h({
  17490.           displayName: a.get('name'),
  17491.           error: this.blockError,
  17492.           handleComplete: this.handleComplete.bind(this)
  17493.         }))
  17494.       } else {
  17495.         var b = this.model.author;
  17496.         this.$el.html(g({
  17497.           user: b.toJSON(),
  17498.           forumId: this.model.get('forum'),
  17499.           handleBlock: this.handleBlockUser.bind(this),
  17500.           handleComplete: this.handleComplete.bind(this)
  17501.         })),
  17502.         d.trigger('uiAction:viewBlockUser')
  17503.       } else this.$el.html(f({
  17504.         updateReason: this.updateFlaggingReason.bind(this),
  17505.         handleSubmit: this.submitReason.bind(this),
  17506.         handleCancel: this.cancel.bind(this)
  17507.       })),
  17508.       d.trigger('uiAction:viewFlagPost');
  17509.       return this
  17510.     },
  17511.     updateFlaggingReason: function (a) {
  17512.       this.reason = a.target.value
  17513.     },
  17514.     cancel: i(function () {
  17515.       this.trigger('cancel')
  17516.     }),
  17517.     handleComplete: function () {
  17518.       this.trigger('success')
  17519.     },
  17520.     submitReason: i(function () {
  17521.       this.reason && (d.trigger('uiAction:clickFlagPost'), this.model.report(this.reason), this.model.set('isFlaggedByUser', !0), this.render())
  17522.     }),
  17523.     handleBlockUser: i(function () {
  17524.       var a = this,
  17525.       c = this.model.author;
  17526.       return d.trigger('uiAction:clickBlockUser'),
  17527.       c.block().fail(function (c) {
  17528.         var d = j('Something went wrong while trying to block this user. Please try again later.'),
  17529.         e = c && c.responseJSON && c.responseJSON.code;
  17530.         e === b.ERROR_CODES.MAX_ITEMS_REACHED && (d = j('Unfortunately this user could not be blocked; you have reached the limit for number of users blocked.')),
  17531.         a.blockError = d
  17532.       }).always(function () {
  17533.         a.blockComplete = !0,
  17534.         a.render()
  17535.       })
  17536.     })
  17537.   });
  17538.   return k
  17539. }),
  17540. define('core/views/Tooltip', [
  17541.   'jquery',
  17542.   'core/views/common/HoverCard'
  17543. ], function (a, b) {
  17544.   'use strict';
  17545.   var c = b.extend({
  17546.     className: 'tooltip-outer message-card',
  17547.     initialize: function (a) {
  17548.       b.prototype.initialize.call(this, a),
  17549.       this.template = a.template,
  17550.       this.message = a.message
  17551.     },
  17552.     render: function () {
  17553.       if (this.template) this.$el.html(this.template());
  17554.        else {
  17555.         if (!this.message) return;
  17556.         this.$el.html(a('<div>').addClass('tooltip').text(this.message))
  17557.       }
  17558.       b.prototype.render.call(this)
  17559.     },
  17560.     moveTo: function (a) {
  17561.       if (a) {
  17562.         var b = this.constructor.POSITION_OFFSET,
  17563.         c = a.offset(),
  17564.         d = this.getContainerPosition(),
  17565.         e = this.$el.width();
  17566.         this.$el.css({
  17567.           bottom: d.containerOffset.height - c.top + b,
  17568.           top: 'inherit',
  17569.           left: c.left - e / 2
  17570.         })
  17571.       }
  17572.     }
  17573.   }, {
  17574.     create: function (a) {
  17575.       return b.create(a.id, a, 'Tooltip', c)
  17576.     },
  17577.     POSITION_OFFSET: 10
  17578.   });
  17579.   return c
  17580. }),
  17581. define('core/views/ClickTooltip', [
  17582.   'underscore',
  17583.   'core/views/common/HoverCard',
  17584.   'core/views/Tooltip'
  17585. ], function (a, b, c) {
  17586.   'use strict';
  17587.   var d = c.extend({
  17588.     target: function (b) {
  17589.       b.on('click', a.bind(this.targetClicked, this, b)),
  17590.       b.on('mouseleave', a.bind(this.leave, this))
  17591.     },
  17592.     targetClicked: function (a) {
  17593.       a && (this.$target = a),
  17594.       'in' !== this._hoverState && (this._hoverState = 'in', this.show(), c.open[this.uid] = this)
  17595.     }
  17596.   }, {
  17597.     create: function (a) {
  17598.       return b.create(a.id, a, 'ClickTooltip', d)
  17599.     }
  17600.   });
  17601.   return d
  17602. }),
  17603. define('templates/lounge/partials/postVotes', [
  17604.   'react',
  17605.   'core/constants/voteConstants',
  17606.   'core/strings',
  17607.   'core/switches',
  17608.   'core/utils/object/get'
  17609. ], function (a, b, c, d, e) {
  17610.   'use strict';
  17611.   var f = c.gettext,
  17612.   g = function (c) {
  17613.     var g = d.isFeatureActive('embed_refresh', {
  17614.       forum: c.forumId
  17615.     }),
  17616.     h = a.createElement('span', {
  17617.       className: 'control'
  17618.     }, g ? null : a.createElement('i', {
  17619.       'aria-hidden': 'true',
  17620.       className: 'icon icon-arrow-2'
  17621.     })),
  17622.     i = a.createElement('span', {
  17623.       className: 'updatable count',
  17624.       'data-role': 'likes'
  17625.     }, e(c.post, [
  17626.       'likes'
  17627.     ], null)),
  17628.     j = g ? [
  17629.       h,
  17630.       ' ',
  17631.       i
  17632.     ] : [
  17633.       i,
  17634.       ' ',
  17635.       h
  17636.     ];
  17637.     return c.votingType === b.VOTING_TYPES.DISABLED ? null : a.createElement('div', {
  17638.       className: 'post-votes'
  17639.     }, a.createElement('a', {
  17640.       href: '#',
  17641.       className: 'vote-up ' + (e(c.post, [
  17642.         'userScore'
  17643.       ], 0) > 0 ? 'upvoted' : '') + ' count-' + e(c.post, [
  17644.         'likes'
  17645.       ], ''),
  17646.       'data-action': 'upvote',
  17647.       title: e(c.post, [
  17648.         'likes'
  17649.       ]) ? '' : f('Vote up'),
  17650.       name: f('Vote up')
  17651.     }, j), c.votingType === b.VOTING_TYPES.DOWNVOTE_DISABLED || g ? null : a.createElement('div', {
  17652.       className: 'post-votes__separator'
  17653.     }, ''), c.votingType === b.VOTING_TYPES.DOWNVOTE_DISABLED ? null : a.createElement('a', {
  17654.       href: '#',
  17655.       className: 'vote-down ' + (e(c.post, [
  17656.         'userScore'
  17657.       ], 0) < 0 ? 'downvoted' : '') + ' count-' + (c.votingType === b.VOTING_TYPES.DOWNVOTE_LIMITED ? 0 : e(c.post, [
  17658.         'dislikes'
  17659.       ], '')),
  17660.       'data-action': 'downvote',
  17661.       title: e(c.post, [
  17662.         'dislikes'
  17663.       ]) ? '' : f('Vote down'),
  17664.       name: f('Vote down')
  17665.     }, a.createElement('span', {
  17666.       className: 'control'
  17667.     }, g ? null : a.createElement('i', {
  17668.       'aria-hidden': 'true',
  17669.       className: 'icon icon-arrow'
  17670.     })), ' ', a.createElement('span', {
  17671.       className: 'updatable count',
  17672.       'data-role': 'dislikes'
  17673.     }, c.votingType === b.VOTING_TYPES.DOWNVOTE_LIMITED ? null : e(c.post, [
  17674.       'dislikes'
  17675.     ], null))))
  17676.   };
  17677.   return g
  17678. }),
  17679. define('templates/lounge/partials/postFooter', [
  17680.   'react',
  17681.   'core/constants/voteConstants',
  17682.   'core/strings',
  17683.   'core/switches',
  17684.   'core/utils/object/get',
  17685.   'templates/lounge/partials/postVotes'
  17686. ], function (a, b, c, d, e, f) {
  17687.   'use strict';
  17688.   var g = c.gettext,
  17689.   h = function (c) {
  17690.     var h = (e(c.session, [
  17691.       'isRegistered'
  17692.     ]) || !d.isFeatureActive('sso_less_branding', {
  17693.       forum: c.post.forum
  17694.     })) && c.votingType !== b.VOTING_TYPES.DISABLED,
  17695.     i = d.isFeatureActive('embed_refresh', {
  17696.       forum: c.post.forum
  17697.     }),
  17698.     j = i && d.isFeatureActive('embed_refresh_v2', {
  17699.       forum: c.post.forum
  17700.     }),
  17701.     k = i ? 'realtime-replies realtime-replies--refresh icon icon-pencil' : 'realtime-replies',
  17702.     l = i ? 'realtime-button realtime-button--refresh' : 'realtime-button';
  17703.     return a.createElement('menu', {
  17704.       className: 'comment-footer__menu'
  17705.     }, h ? [
  17706.       a.createElement('li', {
  17707.         key: 'vote-0',
  17708.         className: 'voting',
  17709.         'data-role': 'voting'
  17710.       }, a.createElement(f, {
  17711.         post: c.post,
  17712.         votingType: c.votingType,
  17713.         forumId: c.forumId
  17714.       })),
  17715.       i && j ? null : a.createElement('li', {
  17716.         key: 'vote-1',
  17717.         className: 'bullet',
  17718.         'aria-hidden': 'true'
  17719.       }, '•')
  17720.     ] : null, e(c.post, [
  17721.       'canBeEdited'
  17722.     ]) ? a.createElement('li', {
  17723.       key: 'edit-0',
  17724.       className: 'edit',
  17725.       'data-role': 'edit-link'
  17726.     }, a.createElement('a', {
  17727.       className: 'comment-footer__action',
  17728.       href: '#',
  17729.       'data-action': 'edit'
  17730.     }, a.createElement('i', {
  17731.       className: 'icon icon-pencil-large'
  17732.     }), a.createElement('span', {
  17733.       className: 'text'
  17734.     }, g('Edit')))) : null, e(c.post, [
  17735.       'canBeRepliedTo'
  17736.     ]) ? a.createElement('li', {
  17737.       key: 'reply-0',
  17738.       className: 'reply',
  17739.       'data-role': 'reply-link'
  17740.     }, a.createElement('a', {
  17741.       className: 'comment-footer__action',
  17742.       href: '#',
  17743.       'data-action': 'reply'
  17744.     }, a.createElement('span', {
  17745.       className: 'text'
  17746.     }, g('Reply')))) : null, e(c.post, [
  17747.       'isSponsored'
  17748.     ]) && !e(c.post, [
  17749.       'hideViewAllComments'
  17750.     ]) ? [
  17751.       a.createElement('li', {
  17752.         key: 'sponsored-0',
  17753.         className: 'thread-link',
  17754.         'data-role': 'thread-link'
  17755.       }, a.createElement('a', {
  17756.         href: e(c.post, [
  17757.           'permalink'
  17758.         ], ''),
  17759.         target: '_blank',
  17760.         rel: 'noopener noreferrer',
  17761.         'data-action': 'thread'
  17762.       }, a.createElement('i', {
  17763.         className: 'icon icon-mobile'
  17764.       }), a.createElement('span', {
  17765.         className: 'text'
  17766.       }, g('View all comments')), a.createElement('span', {
  17767.         className: 'mobile-text'
  17768.       }, g('All Comments')))),
  17769.       a.createElement('li', {
  17770.         key: 'sponsored-1',
  17771.         className: 'bullet',
  17772.         'aria-hidden': 'true'
  17773.       }, '•')
  17774.     ] : null, e(c.post, [
  17775.       'canBeShared'
  17776.     ]) ? a.createElement('li', {
  17777.       id: 'comment__share-' + e(c.post, [
  17778.         'id'
  17779.       ], ''),
  17780.       className: 'comment__share'
  17781.     }, a.createElement('a', {
  17782.       className: 'toggle',
  17783.       href: '#',
  17784.       'data-action': 'expand-share'
  17785.     }, a.createElement('i', {
  17786.       className: 'icon icon-share'
  17787.     }), a.createElement('span', {
  17788.       className: 'text'
  17789.     }, g('Share'), ' ›')), a.createElement('ul', {
  17790.       className: 'comment-share__buttons'
  17791.     }, c.disableSocialShare ? null : a.createElement('div', {
  17792.       className: 'comment-share__social-share-buttons'
  17793.     }, a.createElement('li', {
  17794.       className: 'twitter share__button-container'
  17795.     }, a.createElement('button', {
  17796.       className: 'share__button icon icon-twitter-x',
  17797.       'data-action': 'share:twitter',
  17798.       'aria-label': 'Share comment on X (Twitter)'
  17799.     })), a.createElement('li', {
  17800.       className: 'facebook share__button-container'
  17801.     }, a.createElement('button', {
  17802.       className: 'share__button icon icon-facebook',
  17803.       'data-action': 'share:facebook',
  17804.       'aria-label': 'Share comment on Facebook'
  17805.     }))), a.createElement('li', {
  17806.       className: 'link share__button-container'
  17807.     }, a.createElement('button', {
  17808.       className: 'share__button icon icon-link',
  17809.       value: e(c.post, [
  17810.         'shortLink'
  17811.       ], ''),
  17812.       name: g('Link'),
  17813.       title: g('Click to copy post link'),
  17814.       'data-action': 'copy-link',
  17815.       'aria-label': 'Copy link to comment'
  17816.     }), a.createElement('input', {
  17817.       className: 'share__button link_url',
  17818.       value: e(c.post, [
  17819.         'shortLink'
  17820.       ], ''),
  17821.       name: g('Link'),
  17822.       title: g('Click to copy post link'),
  17823.       'data-action': 'copy-link',
  17824.       readOnly: !0
  17825.     })))) : null, e(c.post, [
  17826.       'isDeleted'
  17827.     ]) ? null : a.createElement('li', {
  17828.       className: 'realtime',
  17829.       'data-role': 'realtime-notification:' + e(c.post, [
  17830.         'id'
  17831.       ], '')
  17832.     }, a.createElement('span', {
  17833.       style: {
  17834.         display: 'none'
  17835.       },
  17836.       className: k
  17837.     }), a.createElement('a', {
  17838.       style: {
  17839.         display: 'none'
  17840.       },
  17841.       href: '#',
  17842.       className: l
  17843.     })), e(c.post, [
  17844.       'isSponsored'
  17845.     ]) ? a.createElement('li', {
  17846.       className: 'feedback'
  17847.     }, a.createElement('button', {
  17848.       'data-action': 'feedback'
  17849.     }, g('Leave Feedback'))) : null)
  17850.   };
  17851.   return h
  17852. });
  17853. var _extends = Object.assign || function (a) {
  17854.   for (var b = 1; b < arguments.length; b++) {
  17855.     var c = arguments[b];
  17856.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  17857.   }
  17858.   return a
  17859. };
  17860. define('templates/lounge/partials/postMenu', [
  17861.   'react',
  17862.   'core/config/urls',
  17863.   'core/strings',
  17864.   'core/switches',
  17865.   'core/utils/object/get'
  17866. ], function (a, b, c, d, e) {
  17867.   'use strict';
  17868.   var f = c.gettext,
  17869.   g = function (a, c, d, g) {
  17870.     var h = [
  17871.     ],
  17872.     i = e(c, [
  17873.       'thread',
  17874.       'canModerate'
  17875.     ]),
  17876.     j = e(c, [
  17877.       'isRegistered'
  17878.     ]),
  17879.     k = j && e(a, [
  17880.       'author'
  17881.     ]) && e(a, [
  17882.       'author',
  17883.       'id'
  17884.     ]) === e(c, [
  17885.       'id'
  17886.     ]);
  17887.     if (i) {
  17888.       if (h = [
  17889.         {
  17890.           link: '#',
  17891.           action: 'spam',
  17892.           text: f('Mark as Spam')
  17893.         },
  17894.         {
  17895.           link: '#',
  17896.           action: 'delete',
  17897.           text: f('Delete')
  17898.         },
  17899.         {
  17900.           link: '#',
  17901.           action: 'blacklist',
  17902.           text: f('Ban User')
  17903.         },
  17904.         {
  17905.           link: b.moderate + 'approved/search/id:' + e(a, [
  17906.             'id'
  17907.           ], ''),
  17908.           action: 'moderate',
  17909.           target: '_blank',
  17910.           rel: 'noopener noreferrer',
  17911.           text: f('Moderate')
  17912.         },
  17913.         {
  17914.           link: '#',
  17915.           action: e(a, [
  17916.             'isHighlighted'
  17917.           ]) ? 'unhighlight' : 'highlight',
  17918.           text: f(e(a, [
  17919.             'isHighlighted'
  17920.           ]) ? 'Stop featuring' : 'Feature this comment'),
  17921.           className: 'highlight-toggle'
  17922.         }
  17923.       ], d && !a.author.isAnonymous) {
  17924.         var l = 4;
  17925.         h.splice(l, 0, {
  17926.           link: '#',
  17927.           action: 'manage-badges',
  17928.           text: f('Manage Badges')
  17929.         })
  17930.       }
  17931.       k || g || h.unshift({
  17932.         link: '#',
  17933.         action: 'block-user',
  17934.         text: f('Block User')
  17935.       })
  17936.     } else k ? h = [
  17937.       {
  17938.         link: '#',
  17939.         action: 'delete',
  17940.         text: f('Delete')
  17941.       },
  17942.       {
  17943.         link: '#',
  17944.         action: 'flag',
  17945.         text: f(e(a, [
  17946.           'isFlaggedByUser'
  17947.         ]) ? 'Flagged' : 'Flag as inappropriate')
  17948.       }
  17949.     ] : j && (h = [
  17950.       {
  17951.         link: '#',
  17952.         action: 'block-user',
  17953.         text: f('Block User')
  17954.       },
  17955.       {
  17956.         link: '#',
  17957.         action: 'flag',
  17958.         text: f(e(a, [
  17959.           'isFlaggedByUser'
  17960.         ]) ? 'Flagged' : 'Flag as inappropriate')
  17961.       }
  17962.     ]);
  17963.     return h
  17964.   },
  17965.   h = function (b) {
  17966.     var c = null,
  17967.     h = e(b.session, [
  17968.       'thread',
  17969.       'canModerate'
  17970.     ]),
  17971.     i = d.isFeatureActive('sso_less_branding', {
  17972.       forum: b.post.forum
  17973.     }),
  17974.     j = b.forum && b.forum.settings && b.forum.settings.badgesEnabled,
  17975.     k = d.isFeatureActive('embed_refresh', {
  17976.       forum: b.post.forum
  17977.     }),
  17978.     l = g(b.post, b.session, j, i);
  17979.     return e(b.post, [
  17980.       'id'
  17981.     ]) && e(b.post, [
  17982.       'isMinimized'
  17983.     ]) !== !0 && e(b.post, [
  17984.       'isDeleted'
  17985.     ]) !== !0 && e(b.post, [
  17986.       'author',
  17987.       'isBlocked'
  17988.     ]) !== !0 && e(b.post, [
  17989.       'sb'
  17990.     ]) !== !0 && (l.length ? c = a.createElement('div', null, a.createElement('a', {
  17991.       className: 'dropdown-toggle',
  17992.       'data-toggle': 'dropdown',
  17993.       href: '#'
  17994.     }, k ? a.createElement('span', {
  17995.       className: 'dropdown-toggle-icon' + (h ? ' moderator-menu-options' : '')
  17996.     }) : a.createElement('b', {
  17997.       className: 'caret' + (h ? ' moderator-menu-options' : '')
  17998.     })), a.createElement('ul', {
  17999.       className: 'dropdown-menu' + (k ? ' dropdown-menu--refresh' : '')
  18000.     }, l.map(function (b) {
  18001.       var c = {
  18002.       };
  18003.       return b.rel && (c.rel = b.rel),
  18004.       b.target && (c.target = b.target),
  18005.       a.createElement('li', {
  18006.         key: b.action,
  18007.         className: 'dropdown-item ' + (b.className || '')
  18008.       }, a.createElement('a', _extends({
  18009.         className: 'dropdown-link',
  18010.         href: b.link,
  18011.         'data-action': b.action,
  18012.         role: 'menuitem'
  18013.       }, c), b.text))
  18014.     }))) : i || (c = a.createElement('a', {
  18015.       className: 'dropdown-toggle',
  18016.       href: '#',
  18017.       'data-action': 'flag',
  18018.       'data-role': 'flag',
  18019.       title: f('Flag as inappropriate')
  18020.     }, a.createElement('i', {
  18021.       'aria-hidden': 'true',
  18022.       className: 'icon icon-flag'
  18023.     })))),
  18024.     a.createElement('ul', {
  18025.       className: 'post-menu dropdown' + (k ? ' post-menu--refresh' : ''),
  18026.       'data-role': 'menu',
  18027.       'data-view-id': 'post-menu',
  18028.       'data-post-id': e(b.post, [
  18029.         'id'
  18030.       ])
  18031.     }, a.createElement('li', {
  18032.       className: 'post-menu-item collapse'
  18033.     }, a.createElement('a', {
  18034.       href: '#',
  18035.       'data-action': 'collapse',
  18036.       title: f('Collapse'),
  18037.       name: f('Collapse')
  18038.     }, a.createElement('span', null, '−'))), a.createElement('li', {
  18039.       className: 'post-menu-item expand'
  18040.     }, a.createElement('a', {
  18041.       href: '#',
  18042.       'data-action': 'collapse',
  18043.       title: f('Expand'),
  18044.       name: f('Collapse')
  18045.     }, a.createElement('span', null, '+'))), null === c ? null : a.createElement('li', {
  18046.       className: (h ? 'moderator-menu-options' : '') + ' post-menu-item',
  18047.       role: 'menuitem'
  18048.     }, c))
  18049.   };
  18050.   return h
  18051. }),
  18052. define('templates/lounge/partials/postUserAvatar', [
  18053.   'react',
  18054.   'core/strings',
  18055.   'core/switches',
  18056.   'core/utils',
  18057.   'core/utils/object/get',
  18058.   'templates/lounge/partials/userAvatar'
  18059. ], function (a, b, c, d, e, f) {
  18060.   'use strict';
  18061.   var g = b.gettext,
  18062.   h = d.getInitials,
  18063.   i = function (b) {
  18064.     var d = c.isFeatureActive('embed_refresh', {
  18065.       forum: b.forum && b.forum.id
  18066.     }),
  18067.     i = d ? 'user user--refresh' : 'user',
  18068.     j = d ? 'user image-refresh' : 'user',
  18069.     k = void 0;
  18070.     return k = e(b.post, [
  18071.       'author',
  18072.       'isRegistered'
  18073.     ]) && e(b.post, [
  18074.       'isMinimized'
  18075.     ]) !== !0 ? a.createElement('div', {
  18076.       className: 'avatar hovercard'
  18077.     }, a.createElement(f, {
  18078.       defaultAvatarUrl: b.defaultAvatarUrl,
  18079.       forum: b.forum,
  18080.       user: b.post.author,
  18081.       hasForumAvatar: b.hasForumAvatar
  18082.     })) : e(b.post, [
  18083.       'author',
  18084.       'hasSponsoredAvatar'
  18085.     ]) ? a.createElement('div', {
  18086.       className: 'avatar'
  18087.     }, a.createElement('div', {
  18088.       className: 'user'
  18089.     }, a.createElement('img', {
  18090.       src: b.defaultAvatarUrl,
  18091.       'data-src': e(b.post, [
  18092.         'author',
  18093.         'avatar',
  18094.         'cache'
  18095.       ], ''),
  18096.       className: 'user',
  18097.       alt: g('Avatar')
  18098.     }))) : a.createElement('div', {
  18099.       className: 'avatar'
  18100.     }, a.createElement('div', {
  18101.       className: i
  18102.     }, d && !b.hasForumAvatar ? a.createElement('div', null, h(b.post.author.name) || 'G') : a.createElement('img', {
  18103.       src: b.defaultAvatarUrl,
  18104.       className: j,
  18105.       alt: g('Avatar')
  18106.     })))
  18107.   };
  18108.   return i
  18109. }),
  18110. define('templates/lounge/partials/postWrapper', [
  18111.   'react',
  18112.   'core/strings',
  18113.   'core/switches',
  18114.   'core/utils/object/get',
  18115.   'templates/lounge/partials/postMenu'
  18116. ], function (a, b, c, d, e) {
  18117.   'use strict';
  18118.   var f = b.gettext,
  18119.   g = function (b) {
  18120.     var g = [
  18121.       'post-content',
  18122.       d(b.post, [
  18123.         'isRealtime'
  18124.       ]) && 'new',
  18125.       d(b.session, [
  18126.         'isRegistered'
  18127.       ]) && d(b.post, [
  18128.         'author',
  18129.         'id'
  18130.       ]) === d(b.session, [
  18131.         'id'
  18132.       ]) && 'authored-by-session-user'
  18133.     ].filter(Boolean).join(' ');
  18134.     return [a.createElement('div', {
  18135.       key: 'post-wrapper-content',
  18136.       'data-role': 'post-content',
  18137.       className: g,
  18138.       tabIndex: 0
  18139.     }, a.createElement('div', {
  18140.       className: 'indicator'
  18141.     }), c.isFeatureActive('embed_refresh', {
  18142.       forum: b.forum && b.forum.id
  18143.     }) ? a.createElement('span', {
  18144.       className: 'pinned-icon'
  18145.     }) : null, a.createElement(e, {
  18146.       post: b.post,
  18147.       session: b.session,
  18148.       forum: b.forum
  18149.     }), b.children, a.createElement('div', {
  18150.       className: 'moderate-form blacklist-form',
  18151.       'data-role': 'blacklist-form'
  18152.     }), a.createElement('div', {
  18153.       className: 'moderate-form flag-form',
  18154.       'data-role': 'flagging-form'
  18155.     }), a.createElement('div', {
  18156.       className: 'badges-form',
  18157.       'data-role': 'badges-form'
  18158.     }), a.createElement('div', {
  18159.       className: 'reply-form-container',
  18160.       'data-role': 'reply-form'
  18161.     })),
  18162.     a.createElement('div', {
  18163.       className: 'children',
  18164.       key: 'post-wrapper-children'
  18165.     }, a.createElement('ul', {
  18166.       'data-role': 'children'
  18167.     }), a.createElement('div', {
  18168.       className: 'show-children-wrapper ' + (b.post.hasMore ? '' : 'hidden')
  18169.     }, a.createElement('a', {
  18170.       className: 'show-children',
  18171.       id: 'post-' + b.post.id + '-show-children',
  18172.       'data-action': 'show-children',
  18173.       href: '#'
  18174.     }, f('Show more replies'))))]
  18175.   };
  18176.   return g
  18177. }),
  18178. define('templates/lounge/post', [
  18179.   'react',
  18180.   'core/constants/voteConstants',
  18181.   'core/strings',
  18182.   'core/switches',
  18183.   'core/utils/object/get',
  18184.   'core/utils/threadRatingsHelpers',
  18185.   'templates/lounge/partials/postFooter',
  18186.   'templates/lounge/partials/postUserAvatar',
  18187.   'templates/lounge/partials/postWrapper',
  18188.   'templates/lounge/partials/profileLink',
  18189.   'templates/lounge/partials/userBadges'
  18190. ], function (a, b, c, d, e, f, g, h, i, j, k) {
  18191.   'use strict';
  18192.   var l = c.gettext,
  18193.   m = function (a) {
  18194.     var b = e(a.parentPost, [
  18195.       'author',
  18196.       'id'
  18197.     ]),
  18198.     c = e(a.session, [
  18199.       'blockedUserIdSet'
  18200.     ]);
  18201.     return a.post.hideParent || !(!b || !c) && c.has(b)
  18202.   },
  18203.   n = function (b) {
  18204.     return e(b.post, [
  18205.       'author',
  18206.       'badge'
  18207.     ]) ? a.createElement('span', {
  18208.       className: 'badge',
  18209.       'data-type': 'tracked-badge'
  18210.     }, b.hasEmbedRefreshV2 ? a.createElement('span', {
  18211.       className: 'badge-content'
  18212.     }, e(b.post, [
  18213.       'author',
  18214.       'badge'
  18215.     ], null)) : e(b.post, [
  18216.       'author',
  18217.       'badge'
  18218.     ], null)) : e(b.post, [
  18219.       'author',
  18220.       'thread',
  18221.       'canModerate'
  18222.     ]) ? a.createElement('span', {
  18223.       className: 'badge moderator'
  18224.     }, b.hasEmbedRefreshV2 ? a.createElement('span', {
  18225.       className: 'badge-content'
  18226.     }, l('Mod')) : l('Mod')) : b.opBadgeEnabled && e(b.post, [
  18227.       'author',
  18228.       'thread',
  18229.       'isOP'
  18230.     ]) ? a.createElement('span', {
  18231.       className: 'badge'
  18232.     }, b.hasEmbedRefreshV2 ? a.createElement('span', {
  18233.       className: 'badge-content'
  18234.     }, l('OP')) : l('OP')) : null
  18235.   },
  18236.   o = function (b) {
  18237.     var c = e(b.author, [
  18238.       'isFollowing'
  18239.     ]),
  18240.     f = e(b.author, [
  18241.       'id'
  18242.     ]),
  18243.     g = e(b.session, [
  18244.       'id'
  18245.     ]);
  18246.     return !d.isFeatureActive('embed_refresh', {
  18247.       forum: b.forumId
  18248.     }) || f === g || e(b.author, [
  18249.       'isPrivate'
  18250.     ]) ? null : a.createElement('a', {
  18251.       'data-action': 'follow',
  18252.       'data-user': f,
  18253.       className: 'follow-user-container',
  18254.       tabIndex: '0'
  18255.     }, a.createElement('span', {
  18256.       className: 'follow-user' + (c ? ' is-following' : ''),
  18257.       'aria-label': l(c ? 'Unfollow' : 'Follow'),
  18258.       title: l(c ? 'Unfollow' : 'Follow')
  18259.     }))
  18260.   },
  18261.   p = function (b) {
  18262.     return !b.parentPost && f.isThreadRatingsEnabled(b.thread, b.forum) && b.post.author.threadRating ? a.createElement('span', {
  18263.       className: 'post-ratings'
  18264.     }, b.hasEmbedRefresh ? null : a.createElement('span', {
  18265.       className: 'bullet time-ago-bullet',
  18266.       'aria-hidden': 'true'
  18267.     }, '•'), a.createElement('span', {
  18268.       className: 'post-ratings-stars'
  18269.     }, a.createElement('div', {
  18270.       className: 'post-stars active',
  18271.       style: {
  18272.         width: Math.round(20 * b.post.author.threadRating) + '%'
  18273.       }
  18274.     }, a.createElement('div', {
  18275.       className: 'rating-star'
  18276.     }, '★'), a.createElement('div', {
  18277.       className: 'rating-star'
  18278.     }, '★'), a.createElement('div', {
  18279.       className: 'rating-star'
  18280.     }, '★'), a.createElement('div', {
  18281.       className: 'rating-star'
  18282.     }, '★'), a.createElement('div', {
  18283.       className: 'rating-star'
  18284.     }, '★')), a.createElement('div', {
  18285.       className: 'post-stars inactive'
  18286.     }, a.createElement('div', {
  18287.       className: 'rating-star'
  18288.     }, '★'), a.createElement('div', {
  18289.       className: 'rating-star'
  18290.     }, '★'), a.createElement('div', {
  18291.       className: 'rating-star'
  18292.     }, '★'), a.createElement('div', {
  18293.       className: 'rating-star'
  18294.     }, '★'), a.createElement('div', {
  18295.       className: 'rating-star'
  18296.     }, '★')))) : null
  18297.   },
  18298.   q = function (b) {
  18299.     return a.createElement('span', {
  18300.       className: 'post-meta'
  18301.     }, b.hasEmbedRefresh ? null : a.createElement('span', {
  18302.       className: 'bullet time-ago-bullet',
  18303.       'aria-hidden': 'true'
  18304.     }, '•'), ' ', e(b.post, [
  18305.       'id'
  18306.     ]) ? a.createElement('a', {
  18307.       href: e(b.post, [
  18308.         'permalink'
  18309.       ], ''),
  18310.       'data-role': 'relative-time',
  18311.       className: 'time-ago' + (b.hasEmbedRefresh && !b.hasEmbedRefreshV2 ? ' icon icon-clock' : ''),
  18312.       title: e(b.post, [
  18313.         'formattedCreatedAt'
  18314.       ], '')
  18315.     }, e(b.post, [
  18316.       'relativeCreatedAt'
  18317.     ], null)) : a.createElement('span', {
  18318.       className: 'time-ago' + (b.hasEmbedRefresh && !b.hasEmbedRefreshV2 ? ' icon icon-clock' : ''),
  18319.       'data-role': 'relative-time',
  18320.       title: e(b.post, [
  18321.         'formattedCreatedAt'
  18322.       ], '')
  18323.     }, e(b.post, [
  18324.       'relativeCreatedAt'
  18325.     ], null)), ' ', e(b.post, [
  18326.       'isEdited'
  18327.     ]) ? a.createElement('span', null, b.hasEmbedRefresh ? null : a.createElement('span', {
  18328.       className: 'bullet time-ago-bullet',
  18329.       'aria-hidden': 'true'
  18330.     }, '•'), ' ', a.createElement('span', {
  18331.       className: 'has-edit',
  18332.       'data-role': 'has-edit'
  18333.     }, l('edited'))) : null)
  18334.   },
  18335.   r = function (c) {
  18336.     return [a.createElement('div', {
  18337.       key: 'post-alert',
  18338.       role: 'alert'
  18339.     }),
  18340.     a.createElement(i, {
  18341.       key: 'post-wrapper',
  18342.       post: c.post,
  18343.       session: c.session,
  18344.       forum: c.forum
  18345.     }, a.createElement(h, {
  18346.       post: c.post,
  18347.       forum: c.forum,
  18348.       defaultAvatarUrl: c.defaultAvatarUrl,
  18349.       hasForumAvatar: c.hasForumAvatar
  18350.     }), a.createElement('div', {
  18351.       className: 'post-body'
  18352.     }, a.createElement('header', {
  18353.       className: 'comment__header'
  18354.     }, a.createElement('span', {
  18355.       className: 'post-byline'
  18356.     }, e(c.post, [
  18357.       'author',
  18358.       'isRegistered'
  18359.     ]) ? a.createElement('span', null, c.isInHome && e(c.post, [
  18360.       'author',
  18361.       'isPowerContributor'
  18362.     ]) ? a.createElement('a', {
  18363.       href: '#',
  18364.       className: 'icon__position -inline -allstar',
  18365.       'data-toggle': 'tooltip',
  18366.       'data-role': 'allstar',
  18367.       title: l('All-Star')
  18368.     }, a.createElement('span', {
  18369.       className: 'icon-allstar allstar__icon'
  18370.     })) : null, ' ', a.createElement('span', {
  18371.       className: 'author publisher-anchor-color'
  18372.     }, a.createElement(j, {
  18373.       user: e(c.post, [
  18374.         'author'
  18375.       ]),
  18376.       forumId: c.post.forum
  18377.     }, e(c.post, [
  18378.       'author',
  18379.       'name'
  18380.     ], null))), ' ', a.createElement(n, {
  18381.       post: c.post,
  18382.       forumId: c.forum.id,
  18383.       hasEmbedRefreshV2: d.isFeatureActive('embed_refresh', {
  18384.         forum: c.forum && c.forum.id
  18385.       }) && d.isFeatureActive('embed_refresh_v2', {
  18386.         forum: c.forum && c.forum.id
  18387.       }),
  18388.       opBadgeEnabled: c.isOnChannel
  18389.     }), d.isFeatureActive('sso_less_branding', {
  18390.       forum: c.forum.id
  18391.     }) ? null : a.createElement(o, {
  18392.       author: e(c.post, [
  18393.         'author'
  18394.       ]),
  18395.       session: c.session,
  18396.       forumId: c.forum.id
  18397.     }), a.createElement(k, {
  18398.       forum: c.forum,
  18399.       user: e(c.post, [
  18400.         'author'
  18401.       ]),
  18402.       context: 'post',
  18403.       limit: 4,
  18404.       postId: e(c.post, [
  18405.         'id'
  18406.       ])
  18407.     })) : a.createElement('span', {
  18408.       className: 'author'
  18409.     }, e(c.post, [
  18410.       'author',
  18411.       'name'
  18412.     ], null)), c.parentPost && !m(c) ? a.createElement('span', {
  18413.       className: 'parent-link-container'
  18414.     }, ' ', a.createElement('a', {
  18415.       href: e(c.parentPost, [
  18416.         'permalink'
  18417.       ], ''),
  18418.       className: 'parent-link',
  18419.       'data-role': 'parent-link'
  18420.     }, a.createElement('i', {
  18421.       'aria-label': 'in reply to',
  18422.       className: 'icon-forward',
  18423.       title: 'in reply to'
  18424.     }), ' ', e(c.parentPost, [
  18425.       'author',
  18426.       'name'
  18427.     ], null))) : null), ' ', d.isFeatureActive('embed_refresh', {
  18428.       forum: c.forum && c.forum.id
  18429.     }) ? [
  18430.       a.createElement(p, {
  18431.         parentPost: e(c, [
  18432.           'parentPost'
  18433.         ]),
  18434.         thread: c.thread,
  18435.         forum: c.forum,
  18436.         post: c.post,
  18437.         key: 'ratings',
  18438.         hasEmbedRefresh: !0
  18439.       }),
  18440.       ' ',
  18441.       a.createElement(q, {
  18442.         post: c.post,
  18443.         key: 'meta',
  18444.         hasEmbedRefresh: !0,
  18445.         hasEmbedRefreshV2: d.isFeatureActive('embed_refresh_v2', {
  18446.           forum: c.forum && c.forum.id
  18447.         })
  18448.       })
  18449.     ] : [
  18450.       a.createElement(q, {
  18451.         post: c.post,
  18452.         key: 'meta'
  18453.       }),
  18454.       ' ',
  18455.       a.createElement(p, {
  18456.         parentPost: e(c, [
  18457.           'parentPost'
  18458.         ]),
  18459.         thread: c.thread,
  18460.         forum: c.forum,
  18461.         post: c.post,
  18462.         key: 'ratings'
  18463.       })
  18464.     ], ' ', c.stateByline ? a.createElement('span', {
  18465.       className: 'state-byline state-byline-' + e(c.stateByline, [
  18466.         'style'
  18467.       ], '')
  18468.     }, a.createElement('span', {
  18469.       className: 'icon-mobile icon-' + e(c.stateByline, [
  18470.         'icon'
  18471.       ], ''),
  18472.       'aria-hidden': 'true'
  18473.     }), ' ', a.createElement('span', {
  18474.       className: 'text'
  18475.     }, e(c.stateByline, [
  18476.       'text'
  18477.     ], null))) : null), a.createElement('div', {
  18478.       className: 'post-body-inner'
  18479.     }, a.createElement('div', {
  18480.       className: 'post-message-container',
  18481.       'data-role': 'message-container'
  18482.     }, a.createElement('div', {
  18483.       className: 'publisher-anchor-color',
  18484.       'data-role': 'message-content'
  18485.     }, a.createElement('div', {
  18486.       className: 'post-message ' + (e(c.post, [
  18487.         'message'
  18488.       ]) ? '' : 'loading'),
  18489.       'data-role': 'message',
  18490.       dir: 'auto'
  18491.     }, '' === e(c.post, [
  18492.       'message'
  18493.     ]) ? a.createElement('p', null, a.createElement('i', null, l('This comment has no content.'))) : a.createElement('div', {
  18494.       dangerouslySetInnerHTML: {
  18495.         __html: e(c.post, [
  18496.           'message'
  18497.         ], '')
  18498.       }
  18499.     })), a.createElement('span', {
  18500.       className: 'post-media'
  18501.     }, a.createElement('ul', {
  18502.       'data-role': 'post-media-list'
  18503.     })))), a.createElement('a', {
  18504.       className: 'see-more hidden',
  18505.       title: l('see more'),
  18506.       'data-action': 'see-more'
  18507.     }, l('see more'))), a.createElement('footer', {
  18508.       className: 'comment__footer'
  18509.     }, a.createElement(g, {
  18510.       post: c.post,
  18511.       session: c.session,
  18512.       disableSocialShare: e(c.forum, [
  18513.         'settings',
  18514.         'disableSocialShare'
  18515.       ], !1),
  18516.       votingType: e(c.forum, [
  18517.         'votingType'
  18518.       ], b.VOTING_TYPES.DEFAULT_VOTING_TYPE),
  18519.       forumId: c.forum && c.forum.id
  18520.     }))))]
  18521.   };
  18522.   return r
  18523. }),
  18524. define('templates/lounge/postDeleted', [
  18525.   'react',
  18526.   'core/config/urls',
  18527.   'core/strings',
  18528.   'core/utils/object/get',
  18529.   'templates/lounge/partials/postMenu',
  18530.   'templates/lounge/partials/postWrapper'
  18531. ], function (a, b, c, d, e, f) {
  18532.   'use strict';
  18533.   var g = c.gettext,
  18534.   h = function (c) {
  18535.     return a.createElement(f, {
  18536.       post: c.post,
  18537.       session: c.session,
  18538.       forum: c.forum
  18539.     }, a.createElement('div', {
  18540.       className: 'avatar'
  18541.     }, a.createElement('img', {
  18542.       'data-src': d(b, [
  18543.         'avatar',
  18544.         'generic'
  18545.       ], ''),
  18546.       className: 'user',
  18547.       alt: g('Avatar')
  18548.     })), a.createElement('div', {
  18549.       className: 'post-body'
  18550.     }, a.createElement('div', {
  18551.       className: 'post-message'
  18552.     }, a.createElement('p', null, g('This comment was deleted.'))), a.createElement('header', null, a.createElement(e, {
  18553.       post: c.post,
  18554.       session: c.session,
  18555.       forum: c.forum
  18556.     }))))
  18557.   };
  18558.   return h
  18559. }),
  18560. define('templates/lounge/postBlocked', [
  18561.   'react',
  18562.   'core/config/urls',
  18563.   'core/strings',
  18564.   'core/utils/object/get',
  18565.   'core/switches',
  18566.   'templates/lounge/partials/postWrapper'
  18567. ], function (a, b, c, d, e, f) {
  18568.   'use strict';
  18569.   var g = c.gettext,
  18570.   h = function (c) {
  18571.     return a.createElement(f, {
  18572.       post: c.post,
  18573.       session: c.session,
  18574.       forum: c.forum
  18575.     }, a.createElement('div', {
  18576.       className: 'avatar'
  18577.     }, a.createElement('img', {
  18578.       'data-src': d(b, [
  18579.         'avatar',
  18580.         'generic'
  18581.       ], ''),
  18582.       className: 'user',
  18583.       alt: g('Avatar')
  18584.     })), a.createElement('div', {
  18585.       className: 'post-body'
  18586.     }, a.createElement('div', {
  18587.       className: 'post-message'
  18588.     }, a.createElement('p', null, g('Content unavailable')))))
  18589.   };
  18590.   return h
  18591. }),
  18592. define('templates/lounge/postMinimized', [
  18593.   'react',
  18594.   'core/strings',
  18595.   'core/utils/object/get',
  18596.   'templates/lounge/partials/postMenu',
  18597.   'templates/lounge/partials/postUserAvatar',
  18598.   'templates/lounge/partials/postWrapper'
  18599. ], function (a, b, c, d, e, f) {
  18600.   'use strict';
  18601.   var g = b.gettext,
  18602.   h = function (b) {
  18603.     var d = void 0;
  18604.     return d = c(b.post, [
  18605.       'isApproved'
  18606.     ]) ? a.createElement('p', null, g('Comment score below threshold.'), ' ', a.createElement('a', {
  18607.       href: '#',
  18608.       'data-action': 'reveal'
  18609.     }, g('Show comment.'))) : b.created ? a.createElement('p', null, g('Your comment is awaiting moderation.'), ' ', a.createElement('a', {
  18610.       href: '#',
  18611.       'data-action': 'reveal'
  18612.     }, g('See your comment.')), ' ', a.createElement('a', {
  18613.       href: 'https://help.disqus.com/customer/portal/articles/466223',
  18614.       className: 'help-icon',
  18615.       title: g('Why?'),
  18616.       target: '_blank',
  18617.       rel: 'noopener noreferrer'
  18618.     }), ' ') : a.createElement('p', null, g('This comment is awaiting moderation.'), ' ', a.createElement('a', {
  18619.       href: '#',
  18620.       'data-action': 'reveal'
  18621.     }, g('Show comment.')))
  18622.   },
  18623.   i = function (b) {
  18624.     return a.createElement(f, {
  18625.       post: b.post,
  18626.       session: b.session,
  18627.       forum: b.forum
  18628.     }, a.createElement(e, {
  18629.       post: b.post,
  18630.       forum: b.forum,
  18631.       defaultAvatarUrl: b.defaultAvatarUrl
  18632.     }), a.createElement('div', {
  18633.       className: 'post-body'
  18634.     }, a.createElement('div', {
  18635.       className: 'post-message publisher-anchor-color'
  18636.     }, a.createElement(h, {
  18637.       create: b.created,
  18638.       post: b.post
  18639.     })), a.createElement('header', null, a.createElement('div', {
  18640.       className: 'post-meta'
  18641.     }, g('This comment is awaiting moderation.')), a.createElement(d, {
  18642.       post: b.post,
  18643.       session: b.session,
  18644.       forum: b.forum
  18645.     }))))
  18646.   };
  18647.   return i
  18648. }),
  18649. define('templates/lounge/postSpam', [
  18650.   'react',
  18651.   'core/config/urls',
  18652.   'core/strings',
  18653.   'core/utils/object/get',
  18654.   'templates/lounge/partials/postMenu',
  18655.   'templates/lounge/partials/postWrapper'
  18656. ], function (a, b, c, d, e, f) {
  18657.   'use strict';
  18658.   var g = c.gettext,
  18659.   h = function (c) {
  18660.     return a.createElement(f, {
  18661.       post: c.post,
  18662.       session: c.session,
  18663.       forum: c.forum
  18664.     }, a.createElement('div', {
  18665.       className: 'avatar'
  18666.     }, a.createElement('img', {
  18667.       'data-src': d(b, [
  18668.         'avatar',
  18669.         'generic'
  18670.       ], ''),
  18671.       className: 'user',
  18672.       alt: g('Avatar')
  18673.     })), a.createElement('div', {
  18674.       className: 'post-body'
  18675.     }, a.createElement('div', {
  18676.       className: 'post-message'
  18677.     }, a.createElement('p', null, g('This comment was marked as spam.'))), a.createElement('header', null, a.createElement(e, {
  18678.       post: c.post,
  18679.       session: c.session,
  18680.       forum: c.forum
  18681.     }))))
  18682.   };
  18683.   return h
  18684. }),
  18685. define('templates/lounge/anonUpvoteCard', [
  18686.   'react',
  18687.   'core/strings'
  18688. ], function (a, b) {
  18689.   'use strict';
  18690.   var c = b.gettext,
  18691.   d = function () {
  18692.     return a.createElement('div', {
  18693.       className: 'vote-action tooltip'
  18694.     }, c('You must sign in to up-vote this post.'))
  18695.   };
  18696.   return d
  18697. }),
  18698. define('templates/lounge/anonDownvoteCard', [
  18699.   'react',
  18700.   'core/strings'
  18701. ], function (a, b) {
  18702.   'use strict';
  18703.   var c = b.gettext,
  18704.   d = function () {
  18705.     return a.createElement('div', {
  18706.       className: 'vote-action tooltip'
  18707.     }, c('You must sign in to down-vote this post.'))
  18708.   };
  18709.   return d
  18710. }),
  18711. define('lounge/views/post', [
  18712.   'jquery',
  18713.   'underscore',
  18714.   'backbone',
  18715.   'stance',
  18716.   'react',
  18717.   'react-dom',
  18718.   'core/api',
  18719.   'core/constants/badgesConstants',
  18720.   'core/constants/voteConstants',
  18721.   'core/strings',
  18722.   'core/switches',
  18723.   'core/utils',
  18724.   'core/utils/sso',
  18725.   'core/mixins/withAlert',
  18726.   'core/mixins/withRichMedia',
  18727.   'core/WindowBus',
  18728.   'core/bus',
  18729.   'common/urls',
  18730.   'common/views/mixins',
  18731.   'common/utils',
  18732.   'lounge/common',
  18733.   'lounge/mixins',
  18734.   'lounge/views/cards',
  18735.   'lounge/views/media',
  18736.   'lounge/views/posts/BadgesManageView',
  18737.   'lounge/views/posts/BlacklistView',
  18738.   'lounge/views/posts/PostEditView',
  18739.   'lounge/views/posts/PostReplyView',
  18740.   'lounge/views/posts/TypingUserView',
  18741.   'lounge/views/posts/FlaggingView',
  18742.   'core/views/ClickTooltip',
  18743.   'core/views/Tooltip',
  18744.   'templates/lounge/partials/postFooter',
  18745.   'templates/lounge/partials/postMenu',
  18746.   'templates/lounge/partials/userBadges',
  18747.   'templates/lounge/post',
  18748.   'templates/lounge/postDeleted',
  18749.   'templates/lounge/postBlocked',
  18750.   'templates/lounge/postMinimized',
  18751.   'templates/lounge/postSpam',
  18752.   'templates/lounge/anonUpvoteCard',
  18753.   'templates/lounge/anonDownvoteCard'
  18754. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) {
  18755.   'use strict';
  18756.   var Q = l.preventDefaultHandler,
  18757.   R = j.get,
  18758.   S = new p,
  18759.   T = h.ACTION_TYPES,
  18760.   U = 13,
  18761.   V = c.View.extend({
  18762.     tagName: 'li',
  18763.     className: 'post',
  18764.     events: {
  18765.       'click > [data-role=post-content] [data-action]': 'performAction',
  18766.       'keydown > [data-role=post-content] [data-action]': function (a) {
  18767.         a.keyCode && a.keyCode !== U || this.performAction(a)
  18768.       },
  18769.       'click [data-role=allstar]': function () {
  18770.         S.broadcast('click:allstar')
  18771.       }
  18772.     },
  18773.     actions: {
  18774.       upvote: Q(function (a) {
  18775.         this.handleVote(a, 1)
  18776.       }),
  18777.       downvote: Q(function (a) {
  18778.         this.handleVote(a, - 1)
  18779.       }),
  18780.       reply: 'handleReply',
  18781.       flag: 'handleFlag',
  18782.       'block-user': 'handleBlockUser',
  18783.       edit: 'handleEdit',
  18784.       'delete': 'handleDelete',
  18785.       spam: 'handleSpam',
  18786.       blacklist: 'handleBlacklist',
  18787.       'manage-badges': 'handleManageBadges',
  18788.       highlight: 'handleHighlight',
  18789.       unhighlight: 'handleUnhighlight',
  18790.       collapse: 'handleCollapse',
  18791.       reveal: 'handleReveal',
  18792.       'expand-share': 'handleExpandShare',
  18793.       'share:twitter': '_onShare',
  18794.       'share:facebook': '_onShare',
  18795.       'copy-link': 'handleCopyLink',
  18796.       follow: 'toggleFollow'
  18797.     },
  18798.     performAction: function (c) {
  18799.       var d = this,
  18800.       e = a(c.currentTarget).attr('data-action'),
  18801.       f = d.actions[e];
  18802.       if (f) return (b.isFunction(f) ? f : d[f]).call(d, c)
  18803.     },
  18804.     initialize: function (a) {
  18805.       var b = this;
  18806.       this.thread = a.thread,
  18807.       this.session = a.session,
  18808.       this.created = Boolean(a.created),
  18809.       this.options = a,
  18810.       this.userSuggestions = a.userSuggestions,
  18811.       this.gifPickerEnabled = Boolean(this.thread) && Boolean(this.thread.forum) && this.thread.forum.get('settings').gifPickerEnabled,
  18812.       this.config = a.config,
  18813.       this.setAlertSelector('> [role=alert]'),
  18814.       this.listenTo(this.model, {
  18815.         'change:isDeleted spam': this.removeAsDeleted,
  18816.         'change:message': this.stopLoading,
  18817.         'change:points': this.updateVotePoints,
  18818.         'change:userScore': this.updateActiveUserVote,
  18819.         'change:isFlaggedByUser': this.updateMenu,
  18820.         'change:hasMore': this.handleHasMoreChanged,
  18821.         'change:isHighlighted': function () {
  18822.           this.redraw()
  18823.         },
  18824.         'change:hideReplyPreview': this.updateHideReplyPreview,
  18825.         change: function () {
  18826.           var a = this.model.changedAttributes();
  18827.           (a.id || a.message) && (a.media && k.isFeatureActive('embed_v2', {
  18828.             forum: this.thread.forum.id
  18829.           }) && (this.shouldWaitToRenderMedia = !0, this.listenToOnce(this.model.media, 'reset', function () {
  18830.             this.shouldWaitToRenderMedia = !1,
  18831.             this.renderMedia()
  18832.           })), this.redraw())
  18833.         }
  18834.       }),
  18835.       this.model.author && (this.listenTo(this.model.author, 'change:isBlocked', function (a, c) {
  18836.         var d = a.previous('isBlocked') || !1;
  18837.         return b.flaggingView ? void b.listenToOnce(b.flaggingView, 'success cancel', b.redraw) : b.manageBadgeView ? void b.listenToOnce(b.manageBadgeView, 'success cancel', b.redraw) : void (c !== d && b.redraw())
  18838.       }), this.listenTo(this.model.author, 'change:badges', this.updateBadges), this.listenTo(this.model.author, 'change:isFollowing', this.updateFollowing)),
  18839.       this.thread.forum.get('features') || this.listenToOnce(this.thread.forum, 'change:features', this.redraw),
  18840.       this.listenTo(this.thread, 'change:ratingsEnabled', this.redraw),
  18841.       !this.model.getParent() && this.model.isAuthorSessionUser(this.session) && this.listenTo(this.thread, 'change:userRating', function () {
  18842.         this.model.author.set('threadRating', this.thread.get('userRating')),
  18843.         this.redraw()
  18844.       }),
  18845.       this.listenTo(this.model.usersTyping, 'add remove reset change', this.updateTypingCount),
  18846.       this.listenTo(this.session, 'change:id', function () {
  18847.         this.updateFooter(),
  18848.         this.updateMenu(),
  18849.         this.updateSessionClass(),
  18850.         k.isFeatureActive('embed_refresh', {
  18851.           forum: this.thread.forum.id
  18852.         }) && this.updateFollowingInitial()
  18853.       }),
  18854.       this.listenTo(u.getLounge(), 'opened:post-menu', this.positionMenu),
  18855.       this.listenTo(this.thread, 'change:ratingsEnabled', this.render),
  18856.       this.hasVisibleChildren = !1,
  18857.       this.reply = null,
  18858.       this.edit = null,
  18859.       this.parent = a.parent,
  18860.       this.trackPosition = !1,
  18861.       this.offset = {
  18862.         top: - 1,
  18863.         height: - 1
  18864.       },
  18865.       this.dim = {
  18866.         height: - 1,
  18867.         width: - 1
  18868.       },
  18869.       this.listenTo(u.getLounge(), 'domReflow', this.calcRect),
  18870.       this.isCollapseAllowed = !0,
  18871.       this.haveSubscribedToRichMediaEvents = !1
  18872.     },
  18873.     calcRect: function () {
  18874.       if (!this.trackPosition || !this.visible) return this.offset = {
  18875.         top: - 1,
  18876.         height: - 1
  18877.       },
  18878.       void (this.dim = {
  18879.         height: - 1,
  18880.         width: - 1
  18881.       });
  18882.       var a = this.contentNode;
  18883.       this.offset = a.offset(),
  18884.       this.dim = {
  18885.         height: a.height(),
  18886.         width: a.width()
  18887.       }
  18888.     },
  18889.     updatePostMetaPlacement: function () {
  18890.       var a = k.isFeatureActive('embed_refresh', {
  18891.         forum: this.thread.forum.id
  18892.       });
  18893.       if (a && !l.isMobileUserAgent()) {
  18894.         var b = a && k.isFeatureActive('embed_refresh_v2', {
  18895.           forum: this.thread.forum.id
  18896.         }),
  18897.         c = this.$el.find('.comment__header').first(),
  18898.         d = c.find('.post-meta'),
  18899.         e = 32;
  18900.         d.css({
  18901.           display: '',
  18902.           'margin-top': ''
  18903.         }),
  18904.         c.height() <= e ? d.css({
  18905.           display: 'block',
  18906.           'margin-top': b ? '' : '6px'
  18907.         }) : b && d.css({
  18908.           top: '-2px'
  18909.         })
  18910.       }
  18911.     },
  18912.     createTypingUserView: function () {
  18913.       var a = this.$el.find('[data-role=realtime-notification\\:' + this.model.id + '] .realtime-replies');
  18914.       this.typingUserView = new C({
  18915.         parentView: this,
  18916.         model: this.model,
  18917.         el: a
  18918.       })
  18919.     },
  18920.     updateTypingCount: function () {
  18921.       this.typingUserView || this.createTypingUserView(),
  18922.       this.typingUserView.render()
  18923.     },
  18924.     stopLoading: function () {
  18925.       this.contentNode.find('.loading').removeClass('loading')
  18926.     },
  18927.     updateRelativeTime: function () {
  18928.       this.contentNode.find('[data-role=relative-time]').text(this.model.getRelativeCreatedAt())
  18929.     },
  18930.     updateSessionClass: function () {
  18931.       var a = 'authored-by-session-user';
  18932.       this.model.isAuthorSessionUser(this.session) ? this.contentNode.addClass(a) : this.contentNode.removeClass(a)
  18933.     },
  18934.     updateActiveUserVote: function () {
  18935.       var a = this.model,
  18936.       b = this.contentNode.find('[data-action=upvote]'),
  18937.       c = this.contentNode.find('[data-action=downvote]');
  18938.       c.removeClass('downvoted'),
  18939.       b.removeClass('upvoted'),
  18940.       a.get('userScore') > 0 ? b.addClass('upvoted') : a.get('userScore') < 0 && c.addClass('downvoted')
  18941.     },
  18942.     updateHideReplyPreview: function () {
  18943.       var a = this.contentNode.find('a.parent-link');
  18944.       a.removeClass('parent-link'),
  18945.       a.addClass('hidden'),
  18946.       this.updatePostMetaPlacement()
  18947.     },
  18948.     updateVotePoints: function () {
  18949.       var c = this,
  18950.       d = c.model,
  18951.       e = c.contentNode.find('[data-role=likes], [data-role=dislikes]'),
  18952.       f = c.contentNode.find('[data-action=upvote], [data-action=downvote]'),
  18953.       g = function (a) {
  18954.         b.delay(function () {
  18955.           a.addClass('update'),
  18956.           b.delay(function () {
  18957.             a.removeClass('update')
  18958.           }, 1000)
  18959.         }, 500)
  18960.       };
  18961.       b.each(e, function (b, e) {
  18962.         b = a(b);
  18963.         var h = b.html(),
  18964.         j = d.get(b.attr('data-role')),
  18965.         k = a(f[e]);
  18966.         if (j = Math.max(j, 0).toString(), h !== j) {
  18967.           k.removeClass('count-' + h);
  18968.           var l = c.thread.forum.get('votingType'),
  18969.           m = l === i.VOTING_TYPES.DOWNVOTE_LIMITED || l === i.VOTING_TYPES.DOWNVOTE_DISABLED;
  18970.           l === i.VOTING_TYPES.DISABLED || 'dislikes' === b.attr('data-role') && m ? k.addClass('count-0') : (k.addClass('count-' + j), b.html(j)),
  18971.           g(b)
  18972.         }
  18973.       })
  18974.     },
  18975.     updateFooter: function () {
  18976.       var a = this.contentNode.find('footer'),
  18977.       b = G({
  18978.         post: this.getPostAttributes(),
  18979.         session: this.session.toJSON(),
  18980.         disableSocialShare: this.thread.forum.get('settings').disableSocialShare,
  18981.         votingType: this.thread.forum.get('votingType'),
  18982.         forumId: this.thread.forum.id
  18983.       });
  18984.       B.open[this.model.cid] && this.toggleReplyLink(!0),
  18985.       a.html(b),
  18986.       this.initVotersCard()
  18987.     },
  18988.     updateMenu: function () {
  18989.       var a = this.contentNode.find('[data-role=menu]'),
  18990.       b = H({
  18991.         session: this.session.toJSON(),
  18992.         post: this.getPostAttributes(),
  18993.         forum: this.thread.forum.toJSON()
  18994.       });
  18995.       a.replaceWith(b)
  18996.     },
  18997.     updateBadges: function () {
  18998.       var a = this.getPostAttributes().author,
  18999.       b = this.contentNode.find('[data-role=badges]'),
  19000.       c = I({
  19001.         forum: this.thread.forum.toJSON(),
  19002.         user: a,
  19003.         context: 'post',
  19004.         limit: 4
  19005.       });
  19006.       b.replaceWith(c),
  19007.       this.profileCard && this.profileCard.setBadges(a.badges),
  19008.       this.updatePostMetaPlacement()
  19009.     },
  19010.     updateFollowing: function () {
  19011.       var a = '[data-user=' + this.model.author.id + '][data-action=follow]';
  19012.       if (this.model.author.get('isPrivate') || this.model.author.id === this.session.user.id) return void this.$el.find(a).hide();
  19013.       var b = Boolean(this.model.author.get('isFollowing')),
  19014.       c = a + ' .follow-user',
  19015.       d = R(b ? 'Unfollow' : 'Follow');
  19016.       this.$el.find(c).toggleClass('is-following', b),
  19017.       this.$el.find(c).attr('aria-label', d),
  19018.       this.$el.find(c).attr('title', d)
  19019.     },
  19020.     updateFollowingInitial: function () {
  19021.       (this.session.user.get('followingUserIdSet') && this.session.user.get('followingUserIdSet').has(this.model.author.id) || this.session.user.id === this.model.author.id) && this.updateFollowing()
  19022.     },
  19023.     updatePostStateClasses: function () {
  19024.       var a = this.model,
  19025.       b = a.get('isHighlighted') || a.get('isSponsored');
  19026.       this.$el.toggleClass('highlighted', Boolean(b)),
  19027.       this.contentNode.toggleClass('disabled', !a.id)
  19028.     },
  19029.     getMessageContent: function () {
  19030.       return this.messageContent && this.messageContent.length || (this.messageContent = this.contentNode.find('[data-role=message-content]')),
  19031.       this.messageContent
  19032.     },
  19033.     manageMessageHeight: function (a) {
  19034.       var b = this,
  19035.       c = b.getMessageContent(),
  19036.       d = 1.5 * b.collapsedHeight,
  19037.       e = c && c.length && c.height() || 0;
  19038.       e += a || 0,
  19039.       e > d && !b.$el.hasClass('collapsed') ? b.collapse() : b.expand(!0)
  19040.     },
  19041.     preventCollapsing: function (a) {
  19042.       a.get('deferred') || (this.expand(), this.isCollapseAllowed = !1)
  19043.     },
  19044.     markSeen: function () {
  19045.       function a() {
  19046.         c.contentNode.addClass('seen'),
  19047.         b.delay(function () {
  19048.           c.contentNode.removeClass('seen'),
  19049.           c.contentNode.removeClass('new')
  19050.         }, 10000),
  19051.         c.trackPosition = !1
  19052.       }
  19053.       var c = this,
  19054.       e = d(c);
  19055.       e.isVisible() ? a() : this.listenToOnce(e, 'enter', a)
  19056.     },
  19057.     renderMedia: function () {
  19058.       var a = this.model.media;
  19059.       if (a && a.length) {
  19060.         var c = this.$el.find('[data-role=post-media-list]');
  19061.         this.richMediaViews = this.renderRichMedia(a, c, {
  19062.           convertLinkToButton: !0,
  19063.           beforeRender: function (a) {
  19064.             this.listenTo(a.model, 'change:activated', this.preventCollapsing),
  19065.             a.relatedPost = this.model.cid
  19066.           },
  19067.           normalize: function (a) {
  19068.             var b = l.bleachFindUrls(a);
  19069.             return b.length && (a = b[0].url),
  19070.             a
  19071.           }
  19072.         }),
  19073.         !this.haveSubscribedToRichMediaEvents && this.richMediaViews.length && (this.listenTo(x.settings, 'change:collapsed', function (a, c) {
  19074.           if (c) this.manageMessageHeight();
  19075.            else {
  19076.             var d = b.reduce(this.richMediaViews, function (a, b) {
  19077.               return a + (b.model.get('deferredHeight') || 0)
  19078.             }, 0);
  19079.             this.manageMessageHeight(d)
  19080.           }
  19081.         }), this.haveSubscribedToRichMediaEvents = !0)
  19082.       }
  19083.     },
  19084.     renderSpoilers: function () {
  19085.       this.$el.find('spoiler').each(function () {
  19086.         a(this).attr('tabindex', '0')
  19087.       })
  19088.     },
  19089.     getStateByline: function () {
  19090.       var a,
  19091.       b = this.model;
  19092.       return b.get('isHighlighted') ? a = {
  19093.         icon: 'trophy',
  19094.         text: R('Featured by %(forum)s'),
  19095.         style: 'default'
  19096.       }
  19097.        : b.get('isSponsored') ? a = {
  19098.         icon: 'trophy',
  19099.         text: R('Sponsored on Disqus'),
  19100.         style: 'sponsored'
  19101.       }
  19102.        : b.isAuthorSessionUser(this.session) && (b.get('isApproved') || (a = {
  19103.         icon: 'clock',
  19104.         text: R('Hold on, this is waiting to be approved by %(forum)s.'),
  19105.         style: 'default'
  19106.       })),
  19107.       a && (a.text = j.interpolate(a.text, {
  19108.         forum: this.thread.forum.get('name')
  19109.       })),
  19110.       a
  19111.     },
  19112.     getTemplate: function (a) {
  19113.       if (a.isDeleted) return K;
  19114.       var b = this.model.isAuthorSessionUser(this.session);
  19115.       return a.sb && !b ? K : a.isSpam ? N : this.model.author && (this.model.author.get('isBlocked') || this.model.author.get('isBlocking')) ? L : b && !a.isApproved ? J : a.isMinimized ? M : J
  19116.     },
  19117.     getPostAttributes: function () {
  19118.       var a = this.model.toJSON({
  19119.         session: this.session,
  19120.         thread: this.thread
  19121.       }),
  19122.       b = this.model.getParent();
  19123.       return b && b.get('isSponsored') && (a.canBeRepliedTo = !1, a.hideViewAllComments = b.get('hideViewAllComments')),
  19124.       a
  19125.     },
  19126.     render: function () {
  19127.       var a = this.$el,
  19128.       b = this.getPostAttributes(),
  19129.       c = u.getLounge(),
  19130.       d = this.thread.forum.get('avatar'),
  19131.       g = this.model.getParent(),
  19132.       h = this.getTemplate(b);
  19133.       return !b.message && b.raw_message && t.isPlainText(b.raw_message) && (b.message = this.model.constructor.formatMessage(b.raw_message)),
  19134.       f.render(e.createElement(h, {
  19135.         post: b,
  19136.         forumName: this.thread.forum.get('name'),
  19137.         session: this.session.toJSON(),
  19138.         thread: this.thread.toJSON(),
  19139.         forum: this.thread.forum.toJSON(),
  19140.         created: this.created,
  19141.         parentPost: g && g.toJSON({
  19142.           session: this.session,
  19143.           thread: this.thread
  19144.         }),
  19145.         defaultAvatarUrl: d ? d.large.cache : r.avatar.generic,
  19146.         hasForumAvatar: Boolean(d && !l.isDefaultAvatar(d.large.cache)),
  19147.         stateByline: this.getStateByline(),
  19148.         isInHome: c.isInHome(),
  19149.         isOnChannel: c.isOnChannel()
  19150.       }), this.el),
  19151.       h === J ? a.removeClass('minimized') : a.addClass('minimized'),
  19152.       b.sb && !this.model.isAuthorSessionUser(this.session) ? this.hasVisibleChildren || a.addClass('banned') : this.parent && this.parent.markHasVisibleChildren(),
  19153.       !this.options.excludeAnchor && this.model.id && a.attr('id', 'post-' + this.model.id),
  19154.       this.contentNode = a.find('[data-role=post-content]'),
  19155.       this.childrenNode = a.find('[data-role=children]'),
  19156.       this.messageNode = this.contentNode.find('[data-role=message]'),
  19157.       this.highlightSyntax(),
  19158.       this.processMentions(),
  19159.       this.initCards(),
  19160.       this.updatePostStateClasses(),
  19161.       this.shouldWaitToRenderMedia || this.renderMedia(),
  19162.       this.renderSpoilers(),
  19163.       this.model.get('isRealtime') && (this.trackPosition = !0, this.listenToOnce(c.postsView, 'render:end', this.markSeen)),
  19164.       this.listenToOnce(c.postsView, 'render:end', function () {
  19165.         this.markSeen(),
  19166.         this.manageMessageHeight(),
  19167.         this.updatePostMetaPlacement()
  19168.       }),
  19169.       this
  19170.     },
  19171.     positionMenu: function (b) {
  19172.       var c = b.data('postId').toString();
  19173.       if (c === this.model.id) {
  19174.         var d = this.$('.dropdown-menu', b);
  19175.         if (d.css('top', ''), d.height() + d.offset().top > a(window.document).height()) {
  19176.           var e = d.css('top') || 0;
  19177.           d.css('top', (d.height() + parseInt(e, 10)) * - 1)
  19178.         }
  19179.       }
  19180.     },
  19181.     markHasVisibleChildren: function () {
  19182.       this.hasVisibleChildren = !0,
  19183.       this.model.get('sb') && (this.$el.removeClass('banned'), this.parent && this.parent.markHasVisibleChildren())
  19184.     },
  19185.     highlightSyntax: function () {
  19186.       var a = this.contentNode.find('pre code');
  19187.       a.length && a.each(function () {
  19188.         t.syntaxHighlighter.highlight(this)
  19189.       })
  19190.     },
  19191.     redraw: function () {
  19192.       var a = window.document.createDocumentFragment();
  19193.       this.childrenNode.children().appendTo(a),
  19194.       this.render(),
  19195.       this.childrenNode.append(a),
  19196.       this.blacklist && this.contentNode.find('[data-role=blacklist-form]').first().append(this.blacklist.el),
  19197.       u.getLounge().postsView.trigger('render:end'),
  19198.       u.getLounge().trigger('domReflow')
  19199.     },
  19200.     handleHasMoreChanged: function () {
  19201.       var b = this.$el.find('.show-children-wrapper');
  19202.       a(b[b.length - 1]).toggleClass('hidden', !this.model.get('hasMore'))
  19203.     },
  19204.     processMentions: function () {
  19205.       var b = this.session,
  19206.       c = m.getProfileUrlTemplate(b && b.get('sso') && b.get('sso').profile_url),
  19207.       d = k.isFeatureActive('sso_less_branding', {
  19208.         forum: this.thread.forum.id
  19209.       }) && !c;
  19210.       this.contentNode.find('[data-dsq-mention]').each(function () {
  19211.         var b = a(this);
  19212.         if (d) {
  19213.           var e = a('<span />');
  19214.           e.text(b.text()),
  19215.           e.addClass('mention'),
  19216.           b.replaceWith(e)
  19217.         } else {
  19218.           if (c) {
  19219.             var f = m.getProfileUrl(c, b.text());
  19220.             b.attr('href', f),
  19221.             b.attr('title', f)
  19222.           } else {
  19223.             var g = b.attr('data-dsq-mention').split(':') [0];
  19224.             b.attr('data-action', 'profile'),
  19225.             b.attr('data-username', g)
  19226.           }
  19227.           b.addClass('mention')
  19228.         }
  19229.       })
  19230.     },
  19231.     attachChild: function (a) {
  19232.       var b = a.model;
  19233.       b.created || !b.id || b.get('isImmediateReply') ? this.childrenNode.prepend(a.el) : this.childrenNode.append(a.el)
  19234.     },
  19235.     toggleReply: function () {
  19236.       this.reply && this.reply.isOpen() ? this.hideReply() : this.showReply()
  19237.     },
  19238.     toggleReplyLink: function (a) {
  19239.       this.contentNode.find('[data-role=reply-link]').toggleClass('active', a),
  19240.       this.contentNode.find('[data-role=reply-link]').toggleClass('publisher-anchor-color', a)
  19241.     },
  19242.     showReply: function () {
  19243.       this.reply ? (this.$el.find('[data-role=reply-form]').first().prepend(this.reply.$el), this.reply.show(), this.reply.focus()) : this.getReplyView(),
  19244.       this.toggleReplyLink(!0)
  19245.     },
  19246.     hideReply: function () {
  19247.       this.reply && (this.reply.hide(), this.toggleReplyLink(!1))
  19248.     },
  19249.     toggleEdit: function () {
  19250.       return this.contentNode.find('[data-role=edit-link]').toggleClass('active', !this.edit),
  19251.       this.edit ? (this.edit.remove(), this.edit = null, void this.messageNode.show()) : void this.showEdit()
  19252.     },
  19253.     showEdit: function () {
  19254.       if (this.session.isLoggedOut()) return void this.listenToOnce(this.session, 'change:id', this.toggleEdit);
  19255.       if (this.model.canBeEdited(this.session, this.thread) && !this.edit) {
  19256.         this.edit = new A({
  19257.           post: this.model,
  19258.           session: this.session,
  19259.           thread: this.thread
  19260.         }),
  19261.         this.edit.render(),
  19262.         this.listenTo(this.edit, 'submitted cancel', this.toggleEdit),
  19263.         this.expand(!0);
  19264.         var a = this.messageNode;
  19265.         a.parent().prepend(this.edit.$el),
  19266.         a.hide(),
  19267.         this.edit.resize();
  19268.         var b = u.getLounge();
  19269.         b && b.scrollToPost(this.model.id),
  19270.         q.trigger('uiAction:postStartUpdate', this.model, {
  19271.           area: 'main'
  19272.         })
  19273.       }
  19274.     },
  19275.     removeAsDeleted: function () {
  19276.       this.redraw()
  19277.     },
  19278.     initCards: function () {
  19279.       var a = this;
  19280.       a.initProfileCard(),
  19281.       a.initContextCard(),
  19282.       a.initVotersCard(),
  19283.       a.initAnonVoteCards(),
  19284.       a.initTooltips()
  19285.     },
  19286.     initProfileCard: function () {
  19287.       if (!l.isMobileUserAgent() && !k.isFeatureActive('sso_less_branding', {
  19288.         forum: this.thread.forum.id
  19289.       })) {
  19290.         var a = this.$el.find('.hovercard');
  19291.         a.length && (this.profileCard = w.ProfileCard.create({
  19292.           session: this.session,
  19293.           user: this.model.author,
  19294.           targetElement: a
  19295.         }))
  19296.       }
  19297.     },
  19298.     initContextCard: function () {
  19299.       if (!l.isMobileUserAgent()) {
  19300.         var a = this.parent && this.parent.model;
  19301.         a && !a.get('isDeleted') && (this.contextCard = w.ContextCard.create({
  19302.           post: a,
  19303.           targetElement: this.$el.find('[data-role=parent-link]')
  19304.         }))
  19305.       }
  19306.     },
  19307.     initVotersCard: function () {
  19308.       if (!l.isMobileUserAgent()) {
  19309.         var a = this.$el.find('[data-action=upvote]'),
  19310.         b = this.$el.find('[data-action=downvote]'),
  19311.         c = this.thread.forum.get('votingType');
  19312.         a.length && c !== i.VOTING_TYPES.DISABLED && (this.upvotersCard = w.VotersCard.create({
  19313.           session: this.session,
  19314.           model: this.model,
  19315.           targetElement: a,
  19316.           voteType: 1,
  19317.           isRefreshEnabled: k.isFeatureActive('embed_refresh', {
  19318.             forum: this.thread.forum.id
  19319.           })
  19320.         })),
  19321.         !b.length || null !== c && void 0 !== c && c !== i.VOTING_TYPES.DETAILED || (this.downvotersCard = w.VotersCard.create({
  19322.           session: this.session,
  19323.           model: this.model,
  19324.           targetElement: b,
  19325.           voteType: - 1,
  19326.           isRefreshEnabled: k.isFeatureActive('embed_refresh', {
  19327.             forum: this.thread.forum.id
  19328.           })
  19329.         }))
  19330.       }
  19331.     },
  19332.     initAnonVoteCards: function () {
  19333.       this.session.isLoggedOut() && !this.thread.forum.get('settings').allowAnonVotes && (this.anonVoteCards = this.anonVoteCards || {
  19334.       }, b.each({
  19335.         upvote: O,
  19336.         downvote: P
  19337.       }, function (a, b) {
  19338.         this.anonVoteCards[b] && (this.anonVoteCards[b].remove(), this.anonVoteCards[b] = null);
  19339.         var c = this.$('[data-action=' + b + ']');
  19340.         c.length && (this.anonVoteCards[b] = E.create({
  19341.           targetElement: c,
  19342.           template: a,
  19343.           id: 'anon' + b + this.model.id
  19344.         }))
  19345.       }, this), this.anonVoteCards.upvote && this.listenTo(this.anonVoteCards.upvote, 'show', this.closeUpvotersCard), this.anonVoteCards.downvote && this.listenTo(this.anonVoteCards.upvote, 'show', this.closeDownvotersCard))
  19346.     },
  19347.     initTooltips: function () {
  19348.       if (!l.isMobileUserAgent()) {
  19349.         var b = this.$el.find('[data-toggle=tooltip]');
  19350.         b.length && b.each(function (b, c) {
  19351.           var d = a(c),
  19352.           e = d.attr('title');
  19353.           d.attr('data-original-title', e).attr('title', ''),
  19354.           F.create({
  19355.             targetElement: d,
  19356.             message: e,
  19357.             id: e
  19358.           })
  19359.         })
  19360.       }
  19361.     },
  19362.     closeUpvotersCard: function () {
  19363.       this.upvotersCard && this.upvotersCard.hide()
  19364.     },
  19365.     closeDownvotersCard: function () {
  19366.       this.downvotersCard && this.downvotersCard.hide()
  19367.     },
  19368.     _onShare: Q(function (a) {
  19369.       if (!this.thread.forum.get('settings').disableSocialShare) {
  19370.         var b = t.extractService(a.target, 'share');
  19371.         b && (u.getLounge().trigger('uiAction:postShare', this.model, b), this.share(b))
  19372.       }
  19373.     }),
  19374.     handleBlacklist: Q(function () {
  19375.       if (!this.blacklist) {
  19376.         var a = this.blacklist = new z({
  19377.           model: this.model,
  19378.           forum: this.thread.forum
  19379.         });
  19380.         a.render(),
  19381.         this.listenTo(a, 'success cancel', function () {
  19382.           this.blacklist.remove(),
  19383.           this.blacklist = null
  19384.         }),
  19385.         this.contentNode.find('[data-role=blacklist-form]').first().append(a.el)
  19386.       }
  19387.     }),
  19388.     handleManageBadges: Q(function () {
  19389.       if (!this.manageBadgeView) {
  19390.         var a = this.manageBadgeView = new y({
  19391.           model: this.model,
  19392.           forum: this.thread.forum
  19393.         });
  19394.         a.render(),
  19395.         q.trigger('uiAction:viewBadgeModal'),
  19396.         this.listenTo(a, 'success cancel', function () {
  19397.           this.manageBadgeView.remove(),
  19398.           this.manageBadgeView = null
  19399.         }),
  19400.         this.listenTo(a, 'success', function (a) {
  19401.           var b = this.model.author;
  19402.           b.get('badges') || b.set('badges', [
  19403.           ]);
  19404.           var c = b.get('badges');
  19405.           a.action === T.AWARD ? c.unshift(a.badge) : a.action === T.REMOVE && b.set('badges', c.filter(function (b) {
  19406.             return b.id !== a.badge.id
  19407.           })),
  19408.           this.thread.trigger('change:badgeAction', b)
  19409.         }),
  19410.         this.contentNode.find('[data-role=badges-form]').first().append(a.el)
  19411.       }
  19412.     }),
  19413.     toggleCollapse: function (a) {
  19414.       this.$el.toggleClass('collapsed', a)
  19415.     },
  19416.     handleCollapse: Q(function () {
  19417.       this.toggleCollapse()
  19418.     }),
  19419.     handleHighlight: Q(function () {
  19420.       this.model.highlight();
  19421.       var a = R('You\'ve featured a comment! This comment will now also appear at the top of the discussion.');
  19422.       this.alert(a, {
  19423.         safe: !0,
  19424.         type: 'success'
  19425.       }),
  19426.       this.thread.set('highlightedPost', this.model);
  19427.       var b = u.getLounge();
  19428.       b && b.scrollToPost(this.model.id)
  19429.     }),
  19430.     handleUnhighlight: Q(function () {
  19431.       this.model.unhighlight(),
  19432.       this.dismissAlert(),
  19433.       this.thread.unset('highlightedPost')
  19434.     }),
  19435.     handleVote: function (a, b) {
  19436.       if (this.thread.forum.get('votingType') !== i.VOTING_TYPES.DISABLED && (b !== - 1 || this.thread.forum.get('votingType') !== i.VOTING_TYPES.DOWNVOTE_DISABLED)) {
  19437.         if (!this.thread.forum.get('settings').allowAnonVotes && this.session.isLoggedOut()) return void this.queueAuthAction(function () {
  19438.           this.handleVote(a, b)
  19439.         }, this);
  19440.         var c = u.getLounge(),
  19441.         d = this.model.get('userScore') === b;
  19442.         d ? c.trigger('uiAction:postUnvote', this.model, a) : 1 === b ? c.trigger('uiAction:postUpvote', this.model, a) : b === - 1 && c.trigger('uiAction:postDownvote', this.model, a),
  19443.         this.model.vote(d ? 0 : b)
  19444.       }
  19445.     },
  19446.     queueAuthAction: function (a, b) {
  19447.       this.listenToOnce(this.session, 'change:id', function () {
  19448.         this.session.isLoggedIn() && a.call(b)
  19449.       }),
  19450.       this.session.get('sso') && this.session.get('sso').url ? this.session.authenticate('sso') : this.session.authenticate('disqusDotcom')
  19451.     },
  19452.     getReplyView: function () {
  19453.       return this.reply ? this.reply : (this.reply = new B({
  19454.         parentView: this,
  19455.         parent: this.model,
  19456.         thread: this.thread,
  19457.         session: this.options.session,
  19458.         userSuggestions: this.userSuggestions,
  19459.         gifPickerEnabled: this.gifPickerEnabled,
  19460.         shouldShowEmailAlertInForm: !0
  19461.       }), this.reply.render(), this.showReply(), this.reply)
  19462.     },
  19463.     handleReply: Q(function () {
  19464.       this.toggleReply()
  19465.     }),
  19466.     handleFlag: Q(function () {
  19467.       if (!this.model.get('isFlaggedByUser') && !this.flaggingView) {
  19468.         if (this.session.isLoggedOut()) {
  19469.           var a = this;
  19470.           return a._pendingFlagComplete = !1,
  19471.           void a.queueAuthAction(function () {
  19472.             a._pendingFlagComplete || (a._pendingFlagComplete = !0, setTimeout(function () {
  19473.               a.handleFlag()
  19474.             }, 400))
  19475.           })
  19476.         }
  19477.         var b = this.flaggingView = new D({
  19478.           model: this.model
  19479.         });
  19480.         b.render(),
  19481.         this.listenTo(b, 'cancel success', function () {
  19482.           b.remove(),
  19483.           this.flaggingView = null,
  19484.           this.updateMenu()
  19485.         }),
  19486.         this.contentNode.find('[data-role=flagging-form]').first().append(b.el),
  19487.         q.frame.sendHostMessage('scrollTo', {
  19488.           top: b.$el.offset().top - 80
  19489.         })
  19490.       }
  19491.     }),
  19492.     handleBlockUser: Q(function () {
  19493.       this.dismissAlert(function (a) {
  19494.         return a.options && a.options.isBlockError
  19495.       });
  19496.       var a = this;
  19497.       this.model.author.block().fail(function (b) {
  19498.         var c = R('Something went wrong while trying to block this user. Please try again later.'),
  19499.         d = b && b.responseJSON && b.responseJSON.code;
  19500.         d === g.ERROR_CODES.MAX_ITEMS_REACHED && (c = R('Unfortunately this user could not be blocked; you have reached the limit for number of users blocked.')),
  19501.         a.alert(c, {
  19502.           type: 'error',
  19503.           isBlockError: !0
  19504.         })
  19505.       })
  19506.     }),
  19507.     handleEdit: Q(function () {
  19508.       this.toggleEdit()
  19509.     }),
  19510.     handleDelete: Q(function () {
  19511.       this.model.get('isHighlighted') && (this.model.set('isHighlighted', !1), this.thread.unset('highlightedPost')),
  19512.       this.model._delete()
  19513.     }),
  19514.     handleSpam: Q(function () {
  19515.       this.model.spam()
  19516.     }),
  19517.     handleReveal: Q(function () {
  19518.       this.model.set('isMinimized', !1),
  19519.       this.redraw()
  19520.     }),
  19521.     handleExpandMessage: Q(function () {
  19522.       return this.expand()
  19523.     }),
  19524.     handleExpandShare: Q(function () {
  19525.       var a = this.$('#comment__share-' + this.model.id + ' .comment-share__buttons');
  19526.       a.toggleClass('comment-share__buttons-visible')
  19527.     }),
  19528.     handleCopyLink: function () {
  19529.       l.copyToClipboard(this.model.shortLink())
  19530.     }
  19531.   });
  19532.   return b.extend(V.prototype, v.ShareMixin),
  19533.   b.extend(V.prototype, s.FollowButtonMixin),
  19534.   n.call(V.prototype),
  19535.   v.asCollapsible.call(V.prototype, {
  19536.     collapsedHeight: 374,
  19537.     collapseTargetSelector: '[data-role=message-container]',
  19538.     collapseScope: 'contentNode'
  19539.   }),
  19540.   o.call(V.prototype),
  19541.   V
  19542. }),
  19543. define('lounge/views/posts/collection', [
  19544.   'jquery',
  19545.   'underscore',
  19546.   'backbone',
  19547.   'moment',
  19548.   'core/bus',
  19549.   'core/strings',
  19550.   'core/switches',
  19551.   'common/models',
  19552.   'common/utils',
  19553.   'lounge/views/posts/PostReplyView',
  19554.   'lounge/views/post'
  19555. ], function (a, b, c, d, e, f, g, h, i, j, k) {
  19556.   'use strict';
  19557.   var l = f.get,
  19558.   m = c.View.extend({
  19559.     events: {
  19560.       'click [data-action=more-posts]': 'handleLoadMore',
  19561.       'click [data-action=show-children]': 'handleLoadMoreChildPosts'
  19562.     },
  19563.     STREAMING_MAX_VISIBLE: 250,
  19564.     initialize: function (a) {
  19565.       this.lounge = a.lounge,
  19566.       this.thread = a.thread,
  19567.       this.userSuggestions = a.userSuggestions,
  19568.       this.posts = a.posts,
  19569.       this.postsToAppend = [
  19570.       ],
  19571.       this.postsToPrepend = [
  19572.       ],
  19573.       this.session = a.session,
  19574.       this.subViews = {
  19575.       },
  19576.       this.state = {
  19577.         nextPassTimeoutId: null,
  19578.         renderedPosts: [
  19579.         ],
  19580.         clearDomAfterRender: !1,
  19581.         totalPostsProcessed: 0,
  19582.         totalElapsedTime: 0
  19583.       },
  19584.       this.addPostsIncremental = b.bind(this.addPostsIncremental, this),
  19585.       this.listenTo(this.posts, {
  19586.         reset: this.redrawPosts,
  19587.         add: this.addPosts,
  19588.         remove: this.removePost
  19589.       }),
  19590.       this.listenTo(this.thread, 'change:badgeAction', this.handleBadgeAction),
  19591.       this.listenTo(this.thread, 'change:highlightedPost', this.handleHasHighlightedState),
  19592.       this.listenToOnce(this.lounge, 'threadView:init', function () {
  19593.         this.listenTo(this.thread, 'change:isClosed', this.toggleNoPosts),
  19594.         this.listenTo(this.session, 'change:id', this.toggleNoPosts),
  19595.         this.listenTo(this.posts, 'reset add', this.toggleNoPosts)
  19596.       }),
  19597.       this.listenTo(this.posts, 'reset add', this.enableTimestampUpdates),
  19598.       this.listenTo(this, 'render:end', this.toggleLoadMorePosts),
  19599.       this.listenTo(this, 'render:end', this.handleHasHighlightedState),
  19600.       g.isFeatureActive('limit_rendered_posts', {
  19601.         forum: this.thread.forum.id
  19602.       }) && this.listenTo(this.lounge, 'scroll', b.throttle(this.hideOffscreenPosts, 200))
  19603.     },
  19604.     handleHasHighlightedState: function () {
  19605.       this.$el.toggleClass('has-highlighted-post', this.thread.has('highlightedPost'))
  19606.     },
  19607.     handleBadgeAction: function (a) {
  19608.       var b = this;
  19609.       Object.keys(this.subViews).forEach(function (c) {
  19610.         var d = b.subViews[c];
  19611.         d.model.author.id === a.id && d.updateBadges()
  19612.       })
  19613.     },
  19614.     getPostView: function (a) {
  19615.       return this.subViews[a]
  19616.     },
  19617.     bootstrap: function (a, c) {
  19618.       this.permalinkOptions = c,
  19619.       this.listenTo(this.posts, 'reset', b.bind(this.posts.restoreFromCache, this.posts)),
  19620.       this.listenTo(this.posts, 'change:isDeleted', b.bind(this.posts.removeFromCache, this.posts)),
  19621.       this.handleInitialCommentCount(a.posts)
  19622.     },
  19623.     handleInitialCommentCount: function (a) {
  19624.       var c = this.thread.forum.get('initialCommentCount');
  19625.       if (!c) {
  19626.         var d = g.getSwitchContext('customCommentCounts') || {
  19627.         };
  19628.         c = d[this.thread.forum.id]
  19629.       }
  19630.       this.posts.reset(a, {
  19631.         customThreadLength: c
  19632.       }),
  19633.       b.invoke(this.subViews, 'manageMessageHeight')
  19634.     },
  19635.     bindUIUpdateHandlers: function () {
  19636.       var c = this,
  19637.       d = a(window),
  19638.       e = a(window.document.body),
  19639.       f = e.width(),
  19640.       g = b.debounce(function () {
  19641.         var a = e.width();
  19642.         f !== a && c.subViews && (f = a, b.each(c.subViews, function (a) {
  19643.           a.manageMessageHeight()
  19644.         }))
  19645.       }, 50);
  19646.       d.on('resize', g)
  19647.     },
  19648.     updateTimestamps: function () {
  19649.       return !(!this.subViews || b.size(this.subViews) < 1) && (b.invoke(this.subViews, 'updateRelativeTime'), !0)
  19650.     },
  19651.     enableTimestampUpdates: function () {
  19652.       var a = this,
  19653.       c = 60000;
  19654.       if (!a.timestampUpdateTimer) {
  19655.         var d = function e() {
  19656.           return a.updateTimestamps() ? void (a.timestampUpdateTimer = b.delay(e, c)) : void (a.timestampUpdateTimer = null)
  19657.         };
  19658.         a.timestampUpdateTimer = b.delay(d, c)
  19659.       }
  19660.     },
  19661.     openReply: function (a) {
  19662.       var b = this.posts.get(a);
  19663.       if (b) {
  19664.         var c = this.subViews[b.cid];
  19665.         c.showReply()
  19666.       }
  19667.     },
  19668.     openEdit: function (a) {
  19669.       var b = this.posts.get(a);
  19670.       if (b) {
  19671.         var c = this.subViews[b.cid];
  19672.         c.showEdit()
  19673.       }
  19674.     },
  19675.     toggleLoadMorePosts: function () {
  19676.       var a = this.lounge.threadView.$el.find('#posts [data-role=more]'),
  19677.       b = this.posts.hasNext();
  19678.       b ? a.show() : a.hide()
  19679.     },
  19680.     handleLoadMore: function (a) {
  19681.       var b = this.posts.currentPage();
  19682.       this._loadMore(a),
  19683.       this.lounge.trigger('uiAction:seeMore', b + 1)
  19684.     },
  19685.     handleLoadMoreChildPosts: function (a) {
  19686.       var b = a.currentTarget.id.split('-') [1],
  19687.       c = this.posts.get(b);
  19688.       this._loadMore(a, c),
  19689.       this.lounge.trigger('uiAction:seeMoreChildren', a)
  19690.     },
  19691.     _loadMore: function (b, c) {
  19692.       b.preventDefault();
  19693.       var d = this,
  19694.       f = a(b.currentTarget);
  19695.       f.addClass('busy'),
  19696.       d.posts.more({
  19697.         post: c,
  19698.         success: function () {
  19699.           d.posts.restoreFromCache(),
  19700.           d.once('render:end', function () {
  19701.             f.removeClass('busy')
  19702.           })
  19703.         },
  19704.         error: function () {
  19705.           f.removeClass('busy')
  19706.         }
  19707.       }),
  19708.       e.frame.sendHostMessage('posts.paginate')
  19709.     },
  19710.     renderLayout: a.noop,
  19711.     toggleNoPosts: function () {
  19712.       var a,
  19713.       b = this.lounge.threadView.$el.find('#no-posts');
  19714.       this.posts.models.length ? b.hide() : (a = l(this.thread.get('isClosed') ? 'This discussion has been closed.' : this.session.get('canReply') ? 'Be the first to comment.' : 'Nothing in this discussion yet.'), b.text(a), b.show())
  19715.     },
  19716.     handleSort: function () {
  19717.       a('#posts [data-role=more]').hide(),
  19718.       a('#no-posts').hide(),
  19719.       a('#post-list').addClass('loading').empty()
  19720.     },
  19721.     redrawPosts: function () {
  19722.       var a = this;
  19723.       a.subViews = {
  19724.       },
  19725.       a.once('render:end', function () {
  19726.         b.each(j.open, function (b, c) {
  19727.           var d = a.subViews[c];
  19728.           if (d) {
  19729.             var e = d.getReplyView();
  19730.             e.textarea.set(b.textarea.get()),
  19731.             b.isOpen() ? e.show() : e.hide()
  19732.           }
  19733.         })
  19734.       }),
  19735.       a.posts.setPageFor && a.permalinkOptions && a.permalinkOptions.postId && a.posts.setPageFor(a.permalinkOptions.postId, {
  19736.         silent: !0
  19737.       }),
  19738.       a.addPosts(a.posts, {
  19739.         clearDom: !0
  19740.       })
  19741.     },
  19742.     hideOffscreenPosts: function (a) {
  19743.       var c = a.pageOffset,
  19744.       d = this.lounge.position.frameOffset.top,
  19745.       e = 2 * a.height,
  19746.       f = c - e,
  19747.       g = c + a.height + e;
  19748.       b.isNumber(c) && b.isNumber(e) && b.each(this.subViews, function (a) {
  19749.         var b = a.$el,
  19750.         c = b.offset().top + d,
  19751.         e = c + b.outerHeight();
  19752.         e < f || c > g ? b.addClass('invisible') : b.removeClass('invisible')
  19753.       })
  19754.     },
  19755.     postsShouldBePrepended: function (a) {
  19756.       var b = a.length && a[0];
  19757.       return Boolean(b && (b.created || !b.id || b.get('isRealtime') || b.get('isCached') || b.requestedByPermalink))
  19758.     },
  19759.     hasQueuedPosts: function () {
  19760.       return this.postsToAppend.length || this.postsToPrepend.length
  19761.     },
  19762.     addPosts: i.decorate(c.collectionAddNormalizer(c.Collection, h.Post), function (a, c, d) {
  19763.       var e = this;
  19764.       if (d.clearDom && (e.postsToAppend = [
  19765.       ], e.postsToPrepend = [
  19766.       ], e.postsShouldClearDom = !0), e.postsShouldBePrepended(a)) {
  19767.         var f = [
  19768.         ];
  19769.         b.each(a, function (a) {
  19770.           var b = a.get('parent');
  19771.           b && e.posts.get(b) ? e.postsToPrepend.push(a) : f.push(a)
  19772.         }),
  19773.         e.postsToPrepend = f.concat(e.postsToPrepend)
  19774.       } else e.postsToAppend = e.postsToAppend.concat(a);
  19775.       e.state.nextPassTimeoutId || (e.state.nextPassTimeoutId = b.defer(function () {
  19776.         e.trigger('render:start'),
  19777.         e.addPostsIncremental(!0)
  19778.       }))
  19779.     }),
  19780.     onDeferredViewReady: function (a) {
  19781.       var b = this.subViews;
  19782.       b.hasOwnProperty(a) && b[a].manageMessageHeight()
  19783.     },
  19784.     removePost: function (a) {
  19785.       if (this.hasQueuedPosts()) return void this.once('render:end', b.bind(this.removePost, this, a));
  19786.       var c = this.subViews[a.cid];
  19787.       c && (c.remove(), delete this.subViews[a.cid])
  19788.     },
  19789.     addPostsIncremental: function (a) {
  19790.       this.state.nextPassTimeoutId = null,
  19791.       this.discardRenderProgressIfClearDomRequested();
  19792.       var b = this.getPostModelsForThePass();
  19793.       b.length && this.renderPass(b, a ? m.FIRST_ATTEMPT_TIME_SCALE : void 0),
  19794.       this.finishPass(b),
  19795.       this.scheduleNextPass()
  19796.     },
  19797.     discardRenderProgressIfClearDomRequested: function () {
  19798.       this.postsShouldClearDom && (this.state.clearDomAfterRender = !0, this.postsShouldClearDom = !1, this.state.renderedPosts = [
  19799.       ])
  19800.     },
  19801.     getPostModelsForThePass: function () {
  19802.       return this.postsToAppend.length ? this.postsToAppend : this.postsToPrepend
  19803.     },
  19804.     renderPass: function (a, b) {
  19805.       var c = m.TARGET_PROCESS_TIME;
  19806.       b && (c *= b);
  19807.       for (var d = this.calculatePostsForNextRun(c) || m.MINIMUM_POSTS_PER_RUN; d > 0; ) {
  19808.         var e = a.splice(0, d),
  19809.         f = this.timedRenderPosts(e);
  19810.         if (null === f) break;
  19811.         c -= f,
  19812.         d = this.calculatePostsForNextRun(c)
  19813.       }
  19814.     },
  19815.     timedRenderPosts: function (a) {
  19816.       if (!a.length) return null;
  19817.       var c = Number(new Date);
  19818.       this.state.renderedPosts = this.state.renderedPosts.concat(b.map(a, this.createPostView, this));
  19819.       var d = Number(new Date) - c;
  19820.       return d < 0 && (d = 0),
  19821.       this.state.totalElapsedTime += d,
  19822.       this.state.totalPostsProcessed += a.length,
  19823.       d || null
  19824.     },
  19825.     createPostView: function (a) {
  19826.       var b,
  19827.       c = a.get('parent');
  19828.       c && (c = this.posts.get(c), b = c && this.getPostView(c.cid));
  19829.       var d = new k({
  19830.         parent: b,
  19831.         model: a,
  19832.         thread: this.thread,
  19833.         session: this.session,
  19834.         created: a.created,
  19835.         userSuggestions: this.userSuggestions,
  19836.         config: this.lounge.config
  19837.       });
  19838.       return this.subViews[a.cid] = d,
  19839.       d.render(),
  19840.       d
  19841.     },
  19842.     calculatePostsForNextRun: function (a) {
  19843.       return a <= 0 ? 0 : this.state.totalElapsedTime <= 0 ? this.state.totalPostsProcessed : Math.floor(a * this.state.totalPostsProcessed / this.state.totalElapsedTime)
  19844.     },
  19845.     finishPass: function (a) {
  19846.       if (!a.length) {
  19847.         if (this.$postList = this.lounge.threadView.$el.find('#post-list'), this.state.clearDomAfterRender && (this.$postList.empty(), this.state.clearDomAfterRender = !1), this.state.renderedPosts.length) {
  19848.           this.removeOldPostsIfRealtime(),
  19849.           this.enablePostTracking(this.state.renderedPosts);
  19850.           var b = a === this.postsToAppend;
  19851.           this.insertPostElements(this.state.renderedPosts, b),
  19852.           this.state.renderedPosts = [
  19853.           ]
  19854.         }
  19855.         this.$postList.removeClass('loading'),
  19856.         this.postsToPrepend.length || this.postsToAppend.length || this.trigger('render:end')
  19857.       }
  19858.     },
  19859.     removeOldPostsIfRealtime: function () {
  19860.       var a = b.any(this.state.renderedPosts, function (a) {
  19861.         return a.model.get('isRealtime')
  19862.       });
  19863.       a && this.removeOldPosts()
  19864.     },
  19865.     removeOldPosts: function () {
  19866.       var a = b.size(this.subViews) - this.STREAMING_MAX_VISIBLE;
  19867.       if (!(a <= 0)) for (var c, e = this.posts.sortBy(function (a) {
  19868.         return d(a.get('createdAt')).valueOf()
  19869.       }), f = 0, g = 0; g < e.length && f <= a; g++) c = this.getPostView(e[g].cid),
  19870.       c && 0 === c.childrenNode.children().length && (this.posts.remove(e[g]), f += 1)
  19871.     },
  19872.     enablePostTracking: function (a) {
  19873.       b.each(a, function (a) {
  19874.         a.visible = !0
  19875.       })
  19876.     },
  19877.     insertPostElements: function (a, c) {
  19878.       var d = b.groupBy(a, function (a) {
  19879.         return Boolean(a.parent)
  19880.       });
  19881.       b.each(d['true'], function (a) {
  19882.         a.parent.attachChild(a)
  19883.       });
  19884.       var e = b.pluck(d['false'], '$el');
  19885.       c ? this.$postList.append(e) : this.$postList.prepend(e)
  19886.     },
  19887.     scheduleNextPass: function () {
  19888.       (this.postsToPrepend.length || this.postsToAppend.length) && (this.state.nextPassTimeoutId = b.defer(this.addPostsIncremental))
  19889.     }
  19890.   });
  19891.   m.TARGET_PROCESS_TIME = 30,
  19892.   m.FIRST_ATTEMPT_TIME_SCALE = 0.8,
  19893.   m.MINIMUM_POSTS_PER_RUN = 2;
  19894.   var n = c.View.extend({
  19895.     initialize: function (a) {
  19896.       this.lounge = a.lounge,
  19897.       this.thread = a.thread,
  19898.       this.userSuggestions = a.userSuggestions,
  19899.       this.posts = a.posts,
  19900.       this.postsToAppend = [
  19901.       ],
  19902.       this.postsToPrepend = [
  19903.       ],
  19904.       this.session = a.session,
  19905.       this.subViews = {
  19906.       },
  19907.       this.state = {
  19908.         nextPassTimeoutId: null,
  19909.         renderedPosts: [
  19910.         ],
  19911.         clearDomAfterRender: !1,
  19912.         totalPostsProcessed: 0,
  19913.         totalElapsedTime: 0
  19914.       },
  19915.       this.listenTo(this.posts, {
  19916.         reset: this.addPosts,
  19917.         add: this.addPosts
  19918.       })
  19919.     },
  19920.     handleHasHighlightedState: function () {
  19921.     },
  19922.     handleBadgeAction: function () {
  19923.     },
  19924.     getPostView: function () {
  19925.     },
  19926.     bootstrap: function (a) {
  19927.       this.posts.reset(a.posts)
  19928.     },
  19929.     handleInitialCommentCount: function () {
  19930.     },
  19931.     bindUIUpdateHandlers: function () {
  19932.     },
  19933.     enableTimestampUpdates: function () {
  19934.     },
  19935.     openReply: function () {
  19936.     },
  19937.     openEdit: function () {
  19938.     },
  19939.     toggleLoadMorePosts: function () {
  19940.     },
  19941.     handleLoadMore: function () {
  19942.     },
  19943.     handleLoadMoreChildPosts: function () {
  19944.     },
  19945.     _loadMore: function () {
  19946.     },
  19947.     renderLayout: function () {
  19948.     },
  19949.     toggleNoPosts: function () {
  19950.     },
  19951.     handleSort: function () {
  19952.     },
  19953.     redrawPosts: function () {
  19954.     },
  19955.     hideOffscreenPosts: function () {
  19956.     },
  19957.     postsShouldBePrepended: function () {
  19958.     },
  19959.     hasQueuedPosts: function () {
  19960.     },
  19961.     addPosts: function () {
  19962.       this.trigger('render:end')
  19963.     },
  19964.     onDeferredViewReady: function () {
  19965.     },
  19966.     removePost: function () {
  19967.     },
  19968.     addPostsIncremental: function () {
  19969.     },
  19970.     discardRenderProgressIfClearDomRequested: function () {
  19971.     },
  19972.     getPostModelsForThePass: function () {
  19973.     },
  19974.     renderPass: function () {
  19975.     },
  19976.     timedRenderPosts: function () {
  19977.     },
  19978.     createPostView: function () {
  19979.     },
  19980.     calculatePostsForNextRun: function () {
  19981.     },
  19982.     finishPass: function () {
  19983.     },
  19984.     removeOldPostsIfRealtime: function () {
  19985.     },
  19986.     removeOldPosts: function () {
  19987.     },
  19988.     enablePostTracking: function () {
  19989.     },
  19990.     insertPostElements: function () {
  19991.     },
  19992.     scheduleNextPass: function () {
  19993.     }
  19994.   });
  19995.   return {
  19996.     PostCollectionView: m,
  19997.     DummyPostCollectionView: n
  19998.   }
  19999. }),
  20000. define('templates/lounge/onboard', [
  20001.   'react',
  20002.   'core/config/urls',
  20003.   'core/strings',
  20004.   'core/utils/object/get'
  20005. ], function (a, b, c, d) {
  20006.   'use strict';
  20007.   var e = c.gettext,
  20008.   f = function (c) {
  20009.     return [a.createElement('div', {
  20010.       key: 'onboard-notice',
  20011.       className: 'notice ' + (c.showHome ? 'notice--brand' : '')
  20012.     }, a.createElement('div', {
  20013.       className: 'notice-wrapper'
  20014.     }, a.createElement('span', {
  20015.       className: 'notice__icon icon icon-disqus'
  20016.     }), a.createElement('a', {
  20017.       'data-action': 'show-home',
  20018.       href: (b.home || '') + 'explore/?utm_source=embed&utm_medium=onboard_message&utm_content=see_home_msg&forum_id=' + d(c.forum, [
  20019.         'id'
  20020.       ], ''),
  20021.       target: '_blank',
  20022.       className: 'notice__message'
  20023.     }, e('Welcome to %(Disqus)s! Discover more great discussions just like this one. We\'re a lot more than comments.', {
  20024.       Disqus: 'Disqus'
  20025.     })), a.createElement('a', {
  20026.       'data-action': 'show-home',
  20027.       href: (b.home || '') + 'explore/?utm_source=embed&utm_medium=onboard_message&utm_content=see_home_btn&forum_id=' + d(c.forum, [
  20028.         'id'
  20029.       ], ''),
  20030.       target: '_blank',
  20031.       className: 'btn btn-primary notice__button'
  20032.     }, e('Get Started')))),
  20033.     a.createElement('a', {
  20034.       key: 'onboard-link',
  20035.       className: 'dismiss',
  20036.       'data-action': 'close',
  20037.       href: '#',
  20038.       title: e('Dismiss')
  20039.     }, 'Dismiss ', a.createElement('span', {
  20040.       'aria-label': 'Dismiss',
  20041.       className: 'cross'
  20042.     }, '×'))]
  20043.   };
  20044.   return f
  20045. }),
  20046. define('lounge/views/onboard-alert', [
  20047.   'backbone',
  20048.   'react',
  20049.   'react-dom',
  20050.   'common/utils',
  20051.   'templates/lounge/onboard'
  20052. ], function (a, b, c, d, e) {
  20053.   'use strict';
  20054.   var f = a.View.extend({
  20055.     events: {
  20056.       'click [data-action=close]': 'handleClose',
  20057.       'click [data-action=show-home]': 'handleShowHome'
  20058.     },
  20059.     initialize: function (a) {
  20060.       this.session = a.session,
  20061.       this.forum = a.forum
  20062.     },
  20063.     render: function () {
  20064.       return this.session.isLoggedIn() && this.shouldShow() && (c.render(b.createElement(e, {
  20065.         forum: this.forum.toJSON()
  20066.       }), this.el), this.trigger('uiAction:onboardAlertShow')),
  20067.       this
  20068.     },
  20069.     shouldShow: function () {
  20070.       return !1
  20071.     },
  20072.     getCookie: function () {
  20073.       return d.cookies.read(f.COOKIE_NAME)
  20074.     },
  20075.     setInitialCookie: function () {
  20076.       this.session.user.get('joinedRecently') && this.createCookie(f.COOKIE_NEW_USER)
  20077.     },
  20078.     createCookie: function (a) {
  20079.       d.cookies.create(f.COOKIE_NAME, a, {
  20080.         expiresIn: 2592000000
  20081.       })
  20082.     },
  20083.     eraseCookie: function () {
  20084.       d.cookies.erase(f.COOKIE_NAME)
  20085.     },
  20086.     handleShowHome: function () {
  20087.       this.remove()
  20088.     },
  20089.     handleClose: function (a) {
  20090.       a.preventDefault(),
  20091.       this.remove(),
  20092.       this.trigger('uiAction:onboardAlertDismiss')
  20093.     },
  20094.     remove: function () {
  20095.       this.eraseCookie(),
  20096.       this.session = null,
  20097.       a.View.prototype.remove.call(this)
  20098.     }
  20099.   }, {
  20100.     COOKIE_NAME: 'disqus.onboarding',
  20101.     COOKIE_NEW_USER: 'newUser'
  20102.   });
  20103.   return {
  20104.     OnboardAlert: f
  20105.   }
  20106. }),
  20107. define('templates/lounge/notificationMenu', [
  20108.   'react',
  20109.   'core/config/urls',
  20110.   'core/switches'
  20111. ], function (a, b, c) {
  20112.   'use strict';
  20113.   var d = function (d) {
  20114.     var e = c.isFeatureActive('embed_refresh', {
  20115.       forum: d.forumId
  20116.     }),
  20117.     f = e ? 'notification-icon notification-icon--refresh' : 'notification-icon',
  20118.     g = e ? 'notification-count notification-count--refresh' : 'notification-count';
  20119.     return a.createElement('a', {
  20120.       href: b.homeInbox || '',
  20121.       className: 'notification-container',
  20122.       'data-action': 'home',
  20123.       'data-home-path': 'home/notifications/'
  20124.     }, a.createElement('span', {
  20125.       className: f + ' icon-comment',
  20126.       'aria-hidden': !0
  20127.     }), a.createElement('span', {
  20128.       className: g,
  20129.       'data-role': 'notification-count'
  20130.     }))
  20131.   };
  20132.   return d
  20133. }),
  20134. define('lounge/views/notification-menu', [
  20135.   'jquery',
  20136.   'underscore',
  20137.   'backbone',
  20138.   'stance',
  20139.   'core/bus',
  20140.   'core/switches',
  20141.   'core/utils',
  20142.   'templates/lounge/notificationMenu'
  20143. ], function (a, b, c, d, e, f, g, h) {
  20144.   'use strict';
  20145.   var i = c.View.extend({
  20146.     events: {
  20147.       'click [data-action=home]': 'handleShowHome'
  20148.     },
  20149.     initialize: function (c) {
  20150.       var e = a.Deferred();
  20151.       this.listenToOnce(d(this), 'enter', function () {
  20152.         e.resolveWith(this)
  20153.       });
  20154.       var f = this.session = c.session;
  20155.       this.forum = c.forum,
  20156.       this.language = window.document.documentElement.lang,
  20157.       this.listenTo(f, 'change:id', this.render),
  20158.       this.listenTo(f, 'change:notificationCount', this.updateCount),
  20159.       this.listenTo(f, 'change:id', function () {
  20160.         e.done(b.bind(f.fetchNotificationCount, f)),
  20161.         e.done(this.preloadSidebar)
  20162.       }),
  20163.       this.listenTo(this, {
  20164.         'sidebar:open:start': this.startLoadingAnimation,
  20165.         'sidebar:open:done': this.stopLoadingAnimation
  20166.       })
  20167.     },
  20168.     startLoadingAnimation: function () {
  20169.       this.$el.addClass('notification-loading')
  20170.     },
  20171.     stopLoadingAnimation: function () {
  20172.       this.$el.removeClass('notification-loading')
  20173.     },
  20174.     preloadSidebar: function () {
  20175.       e.trigger('sidebar:preload')
  20176.     },
  20177.     render: function () {
  20178.       return this.forum.get('settings').ssoRequired && this.session.isLoggedOut() ? void this.$el.hide() : (this.$el.html(h({
  20179.         forumId: this.forum.id
  20180.       })), this.updateCount(), this.$el.show(), this)
  20181.     },
  20182.     handleShowHome: function (b) {
  20183.       if (this.session.set('notificationCount', 0), !g.willOpenNewWindow(b)) {
  20184.         b.preventDefault();
  20185.         var c = a(b.currentTarget).attr('data-home-path');
  20186.         e.trigger('sidebar:open', c, this)
  20187.       }
  20188.     },
  20189.     updateCount: function () {
  20190.       var a = this.session.get('notificationCount') || 0;
  20191.       a > 0 ? (this.$('[data-role=notification-count]').html(a > 9 ? '9<i class="icon icon-plus"></i>' : a), this.$el.addClass('unread')) : (this.$('[data-role=notification-count]').html(''), this.$el.removeClass('unread'))
  20192.     }
  20193.   });
  20194.   return {
  20195.     NotificationMenuView: i
  20196.   }
  20197. }),
  20198. define('templates/lounge/highlightedPost', [
  20199.   'react',
  20200.   'core/strings'
  20201. ], function (a, b) {
  20202.   'use strict';
  20203.   var c = b.gettext,
  20204.   d = function (b) {
  20205.     return a.createElement('div', null, b.isRefreshEnabled ? null : a.createElement('h2', {
  20206.       className: 'highlighted-comment-header'
  20207.     }, c('Featured Comment')), a.createElement('ul', {
  20208.       className: 'post-list'
  20209.     }))
  20210.   };
  20211.   return d
  20212. }),
  20213. define('lounge/views/highlighted-post', [
  20214.   'backbone',
  20215.   'underscore',
  20216.   'jquery',
  20217.   'core/switches',
  20218.   'core/UniqueModel',
  20219.   'common/models',
  20220.   'lounge/views/post',
  20221.   'templates/lounge/highlightedPost'
  20222. ], function (a, b, c, d, e, f, g, h) {
  20223.   'use strict';
  20224.   var i = g.extend({
  20225.     getPostAttributes: function () {
  20226.       var a = g.prototype.getPostAttributes.apply(this, arguments);
  20227.       return a.hasMore = !1,
  20228.       d.isFeatureActive('embed_refresh', {
  20229.         forum: this.thread.forum.id
  20230.       }) ? a.hideParent = !0 : a.canBeRepliedTo = !1,
  20231.       a
  20232.     },
  20233.     getStateByline: function () {
  20234.       return !1
  20235.     }
  20236.   }),
  20237.   j = a.View.extend({
  20238.     template: h,
  20239.     itemViewContainer: '.post-list',
  20240.     initialize: function (a) {
  20241.       b.extend(this, b.pick(a, [
  20242.         'thread',
  20243.         'session',
  20244.         'userSuggestions',
  20245.         'config'
  20246.       ])),
  20247.       this.listenTo(this.thread, 'change:highlightedPost', this.reset)
  20248.     },
  20249.     getPost: function () {
  20250.       return this.post ? c.Deferred().resolve(this.post) : this.getHighlightedPost()
  20251.     },
  20252.     _getHighlightedPost: function () {
  20253.       var a = this.thread.get('highlightedPost');
  20254.       return a ? (a instanceof f.Post || (a = new e(f.Post, a)), a.get('isDeleted') ? null : a.get('sb') && !a.isAuthorSessionUser(this.session) ? null : a.get('isHighlighted') ? a : null) : null
  20255.     },
  20256.     getHighlightedPost: function () {
  20257.       var a,
  20258.       e = this.post = this._getHighlightedPost(),
  20259.       g = c.Deferred();
  20260.       return e ? !(a = e.getParent()) || a.author || d.isFeatureActive('embed_refresh', {
  20261.         forum: this.thread.forum.id
  20262.       }) ? e.sync('read', e, {
  20263.         isHighlighted: !0
  20264.       }).always(b.bind(g.resolve, g)) : f.Post.fetchContext(e.id, this.thread).always(b.bind(g.resolve, g)) : g.reject(),
  20265.       g.promise()
  20266.     },
  20267.     reset: function () {
  20268.       delete this.post,
  20269.       this.getPost().always(b.bind(this.render, this))
  20270.     },
  20271.     createPostView: function () {
  20272.       return this.post ? new i({
  20273.         model: this.post,
  20274.         thread: this.thread,
  20275.         session: this.session,
  20276.         userSuggestions: this.userSuggestions,
  20277.         config: this.config,
  20278.         excludeAnchor: !0
  20279.       }).stopListening(this.post.usersTyping) : null
  20280.     },
  20281.     render: function () {
  20282.       var a = this.createPostView();
  20283.       return a ? (a.render(), this.$el.html(this.template({
  20284.         isRefreshEnabled: d.isFeatureActive('embed_refresh', {
  20285.           forum: this.thread.forum.id
  20286.         })
  20287.       })), this.$(this.itemViewContainer).append(a.el), this.$el.show(), this) : (this.$el.hide(), this)
  20288.     }
  20289.   });
  20290.   return {
  20291.     HighlightedPostView: j,
  20292.     FeaturedPostView: i
  20293.   }
  20294. }),
  20295. define('templates/lounge/realtimeCommentNotification', [
  20296.   'core/strings',
  20297.   'core/switches'
  20298. ], function (a, b) {
  20299.   'use strict';
  20300.   var c = a.gettext,
  20301.   d = function (a) {
  20302.     var d = b.isFeatureActive('embed_refresh', {
  20303.       forum: a.forumId
  20304.     });
  20305.     return 1 === a.comments ? c(d ? '+1 new comment' : 'Show One New Comment') : d ? c('+%(comments)s new comments', {
  20306.       comments: a.comments
  20307.     }) : c('Show %(comments)s New Comments', {
  20308.       comments: a.comments
  20309.     })
  20310.   };
  20311.   return d
  20312. }),
  20313. define('templates/lounge/realtimeReplyNotification', [
  20314.   'react',
  20315.   'core/strings',
  20316.   'core/switches'
  20317. ], function (a, b, c) {
  20318.   'use strict';
  20319.   var d = b.gettext,
  20320.   e = function (b) {
  20321.     var e = c.isFeatureActive('embed_refresh', {
  20322.       forum: b.forumId
  20323.     }),
  20324.     f = e ? 'indicator indicator--refresh' : 'indicator';
  20325.     return 1 === b.replies ? [
  20326.       a.createElement('span', {
  20327.         key: 'indicator',
  20328.         className: f
  20329.       }),
  20330.       d(e ? '+1 new reply' : 'Show 1 new reply')
  20331.     ] : [
  20332.       a.createElement('span', {
  20333.         key: 'indicator',
  20334.         className: f
  20335.       }),
  20336.       e ? d('+%(replies)s new replies', {
  20337.         replies: b.replies
  20338.       }) : d('Show %(replies)s new replies', {
  20339.         replies: b.replies
  20340.       })
  20341.     ]
  20342.   };
  20343.   return e
  20344. }),
  20345. define('lounge/views/realtime', [
  20346.   'underscore',
  20347.   'backbone',
  20348.   'react',
  20349.   'react-dom',
  20350.   'core/bus',
  20351.   'core/utils',
  20352.   'core/utils/object/get',
  20353.   'lounge/common',
  20354.   'templates/lounge/realtimeCommentNotification',
  20355.   'templates/lounge/realtimeReplyNotification'
  20356. ], function (a, b, c, d, e, f, g, h, i, j) {
  20357.   'use strict';
  20358.   var k = f.preventDefaultHandler,
  20359.   l = b.View.extend({
  20360.     events: {
  20361.       click: 'handleDrain'
  20362.     },
  20363.     initialize: function (a) {
  20364.       this.options = a
  20365.     },
  20366.     getDirection: function (a) {
  20367.       if (this.offset && this.dim) {
  20368.         var b = a.pageOffset,
  20369.         c = b + a.height,
  20370.         d = this.offset.top + a.frameOffset.top,
  20371.         e = d + this.dim.height;
  20372.         return e < b ? 1 : d > c ? - 1 : 0
  20373.       }
  20374.     },
  20375.     setCount: function (a) {
  20376.       this.options.count = a
  20377.     },
  20378.     render: function () {
  20379.       return 0 === this.options.count ? void this.$el.hide() : (d.render(c.createElement(i, {
  20380.         comments: this.options.count,
  20381.         forumId: this.model.get('forum')
  20382.       }), this.el), this.listenTo(h.getLounge(), 'domReflow', a.throttle(function () {
  20383.         0 !== this.options.count && (this.offset = this.$el.offset(), this.dim = {
  20384.           height: this.$el.height(),
  20385.           width: this.$el.width()
  20386.         })
  20387.       }, 400)), this.$el.show(), this)
  20388.     },
  20389.     handleDrain: k(function () {
  20390.       this.model.queue.drain(),
  20391.       this.setCount(this.model.queue.counters.comments),
  20392.       this.render(),
  20393.       e.trigger('uiAction:loadLiveComments')
  20394.     })
  20395.   }),
  20396.   m = l.extend({
  20397.     events: {
  20398.       click: 'handleDrain'
  20399.     },
  20400.     getDirection: function (a) {
  20401.       if (this.options.postView.visible) {
  20402.         this.offset = this.options.postView.offset,
  20403.         this.dim = this.options.postView.dim;
  20404.         var b = l.prototype.getDirection.call(this, a);
  20405.         return delete this.offset,
  20406.         delete this.dim,
  20407.         b
  20408.       }
  20409.     },
  20410.     render: function () {
  20411.       var b = this,
  20412.       e = b.options.postView;
  20413.       return 0 === b.options.count ? (b.$el.hide(), void (e.trackPosition = !1)) : (e.trackPosition = !0, e.calcRect(), d.render(c.createElement(j, {
  20414.         replies: b.options.count,
  20415.         forumId: this.model.get('forum')
  20416.       }), this.el), b.$el.show(), void a.delay(function () {
  20417.         b.$el.addClass('reveal')
  20418.       }, 13))
  20419.     },
  20420.     handleDrain: k(function () {
  20421.       var a = this.model.id,
  20422.       b = this.options.postView,
  20423.       c = this.options.thread.queue;
  20424.       c.drain(a),
  20425.       this.setCount(c.counters.replies[a]),
  20426.       b.trackPosition = !1,
  20427.       this.render(),
  20428.       e.trigger('uiAction:loadLiveReplies')
  20429.     })
  20430.   });
  20431.   return {
  20432.     QueuedPostView: l,
  20433.     QueuedReplyView: m
  20434.   }
  20435. }),
  20436. define('lounge/views/posts/UserSuggestionsManager', [
  20437.   'underscore',
  20438.   'common/collections'
  20439. ], function (a, b) {
  20440.   'use strict';
  20441.   function c(a) {
  20442.     this.remotes = [
  20443.     ],
  20444.     this.threadId = a.threadId,
  20445.     this.userCollection = new b.UserSuggestionsCollection([], {
  20446.       threadId: this.threadId
  20447.     })
  20448.   }
  20449.   return a.extend(c.prototype, {
  20450.     fetch: function (a, b) {
  20451.       this.userCollection.fetch({
  20452.         query: a || '',
  20453.         next: b
  20454.       })
  20455.     },
  20456.     addRemote: function (a) {
  20457.       this.remotes.push(a)
  20458.     },
  20459.     all: function () {
  20460.       var c = new b.UserCollection;
  20461.       return c.add(this.userCollection.models),
  20462.       c.add(a.chain(this.remotes).pluck('models').flatten().value()),
  20463.       c
  20464.     },
  20465.     find: function (a, b) {
  20466.       a && a.length && this.fetch(a.join(' ').replace(/[^\w\s]/, ''), b)
  20467.     },
  20468.     get: function (a) {
  20469.       return this.userCollection.get(a)
  20470.     }
  20471.   }),
  20472.   c
  20473. }),
  20474. define('lounge/views/sidebar', [
  20475.   'underscore',
  20476.   'backbone',
  20477.   'modernizr',
  20478.   'core/bus',
  20479.   'core/switches',
  20480.   'core/utils/url/serialize',
  20481.   'core/shared/urls',
  20482.   'core/utils'
  20483. ], function (a, b, c, d, e, f, g, h) {
  20484.   'use strict';
  20485.   var i = b.View.extend({
  20486.     initialize: function (a) {
  20487.       this.forum = a.forum,
  20488.       this.session = a.session,
  20489.       this.config = a.config,
  20490.       this.language = window.document.documentElement.lang,
  20491.       'en' === this.language && (this.language = void 0),
  20492.       this.listenTo(this.session, 'change:id', this.destroyHome),
  20493.       this.listenTo(d, {
  20494.         'sidebar:open': this.open,
  20495.         'sidebar:preload': this.preload
  20496.       }),
  20497.       this.iframeAlive = !0,
  20498.       this.iframeReady = !1,
  20499.       this.listenToOnce(d.frame, 'home.timeout', this.handleTimeout),
  20500.       this.listenToOnce(d.frame, 'home.ready', this.handleReady)
  20501.     },
  20502.     isIE9: function () {
  20503.       return 9 === window.document.documentMode
  20504.     },
  20505.     shouldUseIframe: function () {
  20506.       return !!(this.forum && this.forum.get('settings').sidebarEnabled && e.isFeatureActive('sso_less_branding', {
  20507.         forum: this.forum.id
  20508.       })) || !!this.iframeAlive && (this.session.isSSO() || this.forum && this.forum.get('settings').sidebarEnabled)
  20509.     },
  20510.     handleTimeout: function () {
  20511.       this.iframeAlive = !1
  20512.     },
  20513.     handleReady: function () {
  20514.       this.iframeReady = !0,
  20515.       d.frame.off('home.timeout')
  20516.     },
  20517.     open: function (b, c) {
  20518.       if (this.shouldUseIframe()) {
  20519.         if (this.storeHomeSession(), d.frame.sendHostMessage('home.show', {
  20520.           path: b,
  20521.           language: this.language,
  20522.           forum: this.forum && this.forum.id
  20523.         }), this.iframeReady || this.listenToOnce(d.frame, 'home.timeout', a.bind(this.open, this, b, c)), c) {
  20524.           c.trigger('sidebar:open:start');
  20525.           var e = a.bind(c.trigger, c, 'sidebar:open:done');
  20526.           this.listenToOnce(d.frame, {
  20527.             'home.opened': e,
  20528.             'home.timeout': e
  20529.           })
  20530.         }
  20531.       } else h.openWindow(f(g.apps.home + b, {
  20532.         l: this.language
  20533.       }));
  20534.       var i = 'unknown';
  20535.       0 === b.indexOf('home/forums/') ? i = 'community' : 0 === b.indexOf('by/') ? i = 'profile' : 'home/notifications/' !== b && 'home/inbox/' !== b || (i = 'notifications'),
  20536.       d.trigger('uiAction:openHome', i, this.shouldUseIframe())
  20537.     },
  20538.     destroyHome: function () {
  20539.       d.frame.sendHostMessage('home.destroy')
  20540.     },
  20541.     preload: function () {
  20542.       this.session.isLoggedOut() || this.shouldUseIframe() && (this.storeHomeSession(), d.frame.sendHostMessage('home.preload', {
  20543.         language: this.language,
  20544.         disableMOTD: e.isFeatureActive('sso_less_branding', {
  20545.           forum: this.forum.id
  20546.         }),
  20547.         forum: this.forum
  20548.       }))
  20549.     },
  20550.     storeHomeSession: function () {
  20551.       c.sessionstorage && window.sessionStorage.setItem('home.session', JSON.stringify(this.session.user.toJSON()))
  20552.     }
  20553.   });
  20554.   return i
  20555. }),
  20556. define('core/constants/ratingsConstants', [
  20557.   'exports'
  20558. ], function (a) {
  20559.   'use strict';
  20560.   a.DEFAULT_RATINGS = {
  20561.     average: 0,
  20562.     breakdown: {
  20563.       1: 0,
  20564.       2: 0,
  20565.       3: 0,
  20566.       4: 0,
  20567.       5: 0
  20568.     },
  20569.     count: 0
  20570.   }
  20571. });
  20572. var _slicedToArray = function () {
  20573.   function a(a, b) {
  20574.     var c = [
  20575.     ],
  20576.     d = !0,
  20577.     e = !1,
  20578.     f = void 0;
  20579.     try {
  20580.       for (var g, h = a[Symbol.iterator](); !(d = (g = h.next()).done) && (c.push(g.value), !b || c.length !== b); d = !0);
  20581.     } catch (i) {
  20582.       e = !0,
  20583.       f = i
  20584.     } finally {
  20585.       try {
  20586.         !d && h['return'] && h['return']()
  20587.       } finally {
  20588.         if (e) throw f
  20589.       }
  20590.     }
  20591.     return c
  20592.   }
  20593.   return function (b, c) {
  20594.     if (Array.isArray(b)) return b;
  20595.     if (Symbol.iterator in Object(b)) return a(b, c);
  20596.     throw new TypeError('Invalid attempt to destructure non-iterable instance')
  20597.   }
  20598. }();
  20599. define('core/templates/react/RatingsScoreTemplate', [
  20600.   'react',
  20601.   'underscore',
  20602.   'core/strings'
  20603. ], function (a, b, c) {
  20604.   'use strict';
  20605.   var d = function (b) {
  20606.     var c = b.breakdown,
  20607.     d = b.totalCount;
  20608.     return a.createElement('div', {
  20609.       className: 'ratings-breakdown-units align align--stretch'
  20610.     }, a.createElement('div', {
  20611.       className: 'align__item--flex-1 align align--column'
  20612.     }, c.map(function (b, c) {
  20613.       var e = b.rating,
  20614.       f = b.count,
  20615.       g = b.percentage;
  20616.       return a.createElement('div', {
  20617.         className: 'ratings-breakdown-unit-row align align--middle',
  20618.         key: c
  20619.       }, a.createElement('div', {
  20620.         className: 'ratings-breakdown-text'
  20621.       }, e, ' ', a.createElement('div', {
  20622.         className: 'rating-star'
  20623.       }, '★')), a.createElement('div', {
  20624.         className: 'align__item--flex-1 align align--center align--middle'
  20625.       }, a.createElement('div', {
  20626.         className: 'ratings-breakdown-outer-bar'
  20627.       }, a.createElement('div', {
  20628.         className: 'ratings-breakdown-inner-bar' + (d && f ? '' : ' no-rating'),
  20629.         style: {
  20630.           width: g / 2 + 'px'
  20631.         }
  20632.       }))))
  20633.     })), a.createElement('div', {
  20634.       className: 'align align--column'
  20635.     }, c.map(function (b, c) {
  20636.       var d = b.percentage;
  20637.       return a.createElement('div', {
  20638.         key: c,
  20639.         className: 'ratings-breakdown-unit-row ratings-breakdown-percentage align__item--flex-1 align align--center'
  20640.       }, a.createElement('div', {
  20641.         className: 'align__item--flex-1 text-right'
  20642.       }, d, '%'))
  20643.     })), a.createElement('div', {
  20644.       className: 'align align--column'
  20645.     }, c.map(function (b, c) {
  20646.       var d = b.count;
  20647.       return a.createElement('div', {
  20648.         key: c,
  20649.         className: 'ratings-breakdown-unit-row ratings-breakdown-percentage align__item--flex-1 align align--center'
  20650.       }, a.createElement('div', {
  20651.         className: 'align__item--flex-1 text-left'
  20652.       }, '(', d, ')'))
  20653.     })))
  20654.   },
  20655.   e = function (e) {
  20656.     var f = e.totalCount,
  20657.     g = e.average,
  20658.     h = e.breakdown,
  20659.     i = e.error,
  20660.     j = e.expandClass;
  20661.     return a.createElement('div', {
  20662.       className: 'ratings-score'
  20663.     }, a.createElement('div', {
  20664.       className: 'spacing-top-small align align--center'
  20665.     }, 1 === f ? c.gettext('1 Rating') : c.gettext('%(totalCount)s Ratings', {
  20666.       totalCount: f
  20667.     })), a.createElement('div', {
  20668.       className: 'ratings-items align align--center align--middle',
  20669.       tabIndex: '0'
  20670.     }, a.createElement('div', {
  20671.       className: 'ratings-stars'
  20672.     }, a.createElement('div', {
  20673.       className: 'stars score-stars',
  20674.       style: {
  20675.         width: 20 * g + '%'
  20676.       }
  20677.     }, a.createElement('div', {
  20678.       className: 'rating-star'
  20679.     }, '★'), a.createElement('div', {
  20680.       className: 'rating-star'
  20681.     }, '★'), a.createElement('div', {
  20682.       className: 'rating-star'
  20683.     }, '★'), a.createElement('div', {
  20684.       className: 'rating-star'
  20685.     }, '★'), a.createElement('div', {
  20686.       className: 'rating-star'
  20687.     }, '★')), a.createElement('div', {
  20688.       className: 'stars base-stars'
  20689.     }, a.createElement('div', {
  20690.       className: 'rating-star'
  20691.     }, '★'), a.createElement('div', {
  20692.       className: 'rating-star'
  20693.     }, '★'), a.createElement('div', {
  20694.       className: 'rating-star'
  20695.     }, '★'), a.createElement('div', {
  20696.       className: 'rating-star'
  20697.     }, '★'), a.createElement('div', {
  20698.       className: 'rating-star'
  20699.     }, '★'))), a.createElement('div', {
  20700.       className: 'ratings-average'
  20701.     }, (Math.round(10 * g) / 10).toFixed(1), a.createElement('div', {
  20702.       className: 'ratings-breakdown ' + j
  20703.     }, a.createElement('div', {
  20704.       className: 'ratings-breakdown-notch-border'
  20705.     }), a.createElement('div', {
  20706.       className: 'ratings-breakdown-notch'
  20707.     }), a.createElement(d, {
  20708.       breakdown: b.sortBy(b.mapObject(h, function (a, b) {
  20709.         return [Number(b),
  20710.         a]
  20711.       }), function (a) {
  20712.         return - a[0]
  20713.       }).map(function (a) {
  20714.         var b = _slicedToArray(a, 2),
  20715.         c = b[0],
  20716.         d = b[1];
  20717.         return {
  20718.           rating: c,
  20719.           count: d,
  20720.           percentage: f && d ? (100 * d / f).toFixed() : 0
  20721.         }
  20722.       }),
  20723.       totalCount: f
  20724.     })))), a.createElement('div', {
  20725.       className: 'err text-semibold'
  20726.     }, i || ''))
  20727.   };
  20728.   return e
  20729. });
  20730. var _extends = Object.assign || function (a) {
  20731.   for (var b = 1; b < arguments.length; b++) {
  20732.     var c = arguments[b];
  20733.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  20734.   }
  20735.   return a
  20736. };
  20737. define('lounge/views/ratings', [
  20738.   'underscore',
  20739.   'backbone',
  20740.   'react',
  20741.   'react-dom',
  20742.   'core/constants/ratingsConstants',
  20743.   'core/utils/threadRatingsHelpers',
  20744.   'core/templates/react/RatingsScoreTemplate'
  20745. ], function (a, b, c, d, e, f, g) {
  20746.   'use strict';
  20747.   var h = b.View.extend({
  20748.     initialize: function (a) {
  20749.       this.session = a.session,
  20750.       this.thread = a.thread,
  20751.       this.error = null,
  20752.       this.listenTo(this.thread, 'change:ratingsEnabled change:ratings', this.render),
  20753.       this.thread.forum.get('features') || this.listenToOnce(this.thread.forum, 'change:features', this.render)
  20754.     },
  20755.     setError: function () {
  20756.       var b = this;
  20757.       this.error = 'You must be logged in to rate this page',
  20758.       this.render(),
  20759.       setTimeout(a.bind(function () {
  20760.         b.error = null,
  20761.         b.render()
  20762.       }, this), 5000)
  20763.     },
  20764.     render: function () {
  20765.       if (f.isThreadModelRatingsEnabled(this.thread)) {
  20766.         var a = this.thread.get('ratings') || e.DEFAULT_RATINGS;
  20767.         d.render(c.createElement(g, _extends({
  20768.         }, a, {
  20769.           totalCount: a.count || 0,
  20770.           error: this.error,
  20771.           expandClass: 'expand-below'
  20772.         })), this.el)
  20773.       } else this.$el.empty();
  20774.       return this
  20775.     }
  20776.   });
  20777.   return h
  20778. }),
  20779. define('core/utils/reactions', [
  20780.   'jquery',
  20781.   'underscore',
  20782.   'core/switches'
  20783. ], function (a, b, c) {
  20784.   'use strict';
  20785.   var d = function (b) {
  20786.     for (var d, e = c.isFeatureActive('embed_refresh', {
  20787.       forum: b
  20788.     }), f = e && c.isFeatureActive('embed_refresh_v2', {
  20789.       forum: b
  20790.     }), g = 24, h = a('#reactions').width(), i = a('.reaction-item').map(function (b, c) {
  20791.       return e ? Math.ceil(a(c) [0].getBoundingClientRect().width) : a(c).width()
  20792.     }).get(), j = 0, k = [
  20793.     ]; !d && j < a('.reaction-item').length; ) {
  20794.       j += 1,
  20795.       d = !0;
  20796.       var l = Math.ceil(i.length / j);
  20797.       k = [
  20798.       ];
  20799.       for (var m = 0; m < j; m++) {
  20800.         var n = i.slice(l * m, l * (m + 1)),
  20801.         o = (n.length - 1) * g,
  20802.         p = n.reduce(function (a, b) {
  20803.           return a + b
  20804.         }, 0) + (e && !f ? o : 0);
  20805.         if (p >= h) {
  20806.           d = !1;
  20807.           break
  20808.         }
  20809.         k.push(p)
  20810.       }
  20811.     }
  20812.     if (e) {
  20813.       var q = 16;
  20814.       a('.reaction-tooltip').each(function (b, c) {
  20815.         a(c).height() > q && (c.style.top = '-68px')
  20816.       })
  20817.     }
  20818.     a('.reaction-items__container').width(Math.max.apply(null, k) + 1)
  20819.   },
  20820.   e = function (b) {
  20821.     var c = a('.reaction-items').width();
  20822.     c !== b._lastReactionsWidth && (b._lastReactionsWidth = c, d(b.forum))
  20823.   },
  20824.   f = function (c) {
  20825.     c._lastReactionsWidth = a('.reaction-items').width();
  20826.     var d = 200;
  20827.     c._reactionsResizeListener = b.debounce(b.partial(e, c), d),
  20828.     a(window).resize(c._reactionsResizeListener)
  20829.   },
  20830.   g = function (b) {
  20831.     b._reactionsResizeListener && a(window).off('resize', b._reactionsResizeListener)
  20832.   };
  20833.   return {
  20834.     attachReactionsListener: f,
  20835.     formatReactionsItems: d,
  20836.     detachReactionsListener: g
  20837.   }
  20838. }),
  20839. define('core/constants/reactionConstants', [
  20840.   'exports',
  20841.   'core/strings'
  20842. ], function (a, b) {
  20843.   'use strict';
  20844.   var c = b.get,
  20845.   d = '//c.disquscdn.com/next/current/publisher-admin/assets/img/emoji/';
  20846.   a.DEFAULT_REACTIONS = [
  20847.     {
  20848.       text: 'Upvote',
  20849.       imageUrl: d + 'upvote-512x512.png'
  20850.     },
  20851.     {
  20852.       text: 'Funny',
  20853.       imageUrl: d + 'funny-512x512.png'
  20854.     },
  20855.     {
  20856.       text: 'Love',
  20857.       imageUrl: d + 'love-512x512.png'
  20858.     },
  20859.     {
  20860.       text: 'Surprised',
  20861.       imageUrl: d + 'surprised-512x512.png'
  20862.     },
  20863.     {
  20864.       text: 'Angry',
  20865.       imageUrl: d + 'angry-512x512.png'
  20866.     },
  20867.     {
  20868.       text: 'Sad',
  20869.       imageUrl: d + 'sad-512x512.png'
  20870.     }
  20871.   ],
  20872.   a.DEFAULT_PROMPT = c('What do you think?'),
  20873.   a.DEFAULT_DESCRIPTIONS = [
  20874.     'Upvote',
  20875.     'Funny',
  20876.     'Love',
  20877.     'Surprised',
  20878.     'Angry',
  20879.     'Sad'
  20880.   ],
  20881.   a.UPLOAD_IMAGE_ERROR_MESSAGES = {
  20882.     'invalid-image-file': 'Unfortunately your image upload failed. Please verify that the file is valid and in a supported format (JPEG, PNG, or GIF).',
  20883.     'invalid-content-type': 'Unfortunately your image upload failed. Please verify that the file is in a supported format (JPEG, PNG, or GIF).',
  20884.     'file-too-large': 'Unfortunately your image upload failed. Please verify that your image is under 5MB.',
  20885.     'not-authenticated': 'You must be logged in to upload an image.',
  20886.     'default': 'Unfortunately your image upload failed. Please verify that your image is in a supported format (JPEG, PNG, or GIF) and under 5MB. If you continue seeing this error, please try again later.'
  20887.   }
  20888. });
  20889. var _extends = Object.assign || function (a) {
  20890.   for (var b = 1; b < arguments.length; b++) {
  20891.     var c = arguments[b];
  20892.     for (var d in c) Object.prototype.hasOwnProperty.call(c, d) && (a[d] = c[d])
  20893.   }
  20894.   return a
  20895. };
  20896. define('core/templates/react/ReactionItemsPartial', [
  20897.   'react',
  20898.   'core/constants/reactionConstants'
  20899. ], function (a, b) {
  20900.   'use strict';
  20901.   var c = function (c) {
  20902.     var d = c.reactionsList,
  20903.     e = c.onSubmitReaction,
  20904.     f = c.showVoteCount,
  20905.     g = c.readonly,
  20906.     h = c.isRefreshEnabled,
  20907.     i = c.isRefreshV2Enabled,
  20908.     j = h ? 'reaction-items__container--refresh' : '',
  20909.     k = h ? 'reaction-item reaction-item--refresh' : 'reaction-item align align--column align--middle spacing-bottom-narrow',
  20910.     l = h ? 'reaction-item__button reaction-item__button--refresh' : 'align align--middle align--column reaction-item__button',
  20911.     m = h ? 'reaction-item__votes reaction-item__votes--refresh' : 'reaction-item__votes',
  20912.     n = h ? 'reaction-item__votes-wrapper reaction-item__votes-wrapper--refresh' : 'reaction-item__votes-wrapper',
  20913.     o = h ? 'reaction-item__image-wrapper reaction-item__image-wrapper--refresh' : 'reaction-item__image-wrapper',
  20914.     p = h ? 'reaction-item__image reaction-item__image--refresh' : 'reaction-item__image',
  20915.     q = 'reaction-vote',
  20916.     r = function (a, b) {
  20917.       e && !g && e(a, b)
  20918.     },
  20919.     s = function (a, b, c) {
  20920.       var d = 13;
  20921.       a.keyCode === d && r(b, c)
  20922.     },
  20923.     t = d.map(function (a) {
  20924.       if (!a.imageUrl) return a;
  20925.       var c = a.imageUrl.split('/'),
  20926.       d = b.DEFAULT_REACTIONS.filter(function (a) {
  20927.         var b = a.imageUrl.split('/');
  20928.         return b[b.length - 1].split('-') [0].split('.') [0] === c[c.length - 1].split('-') [0].split('.') [0]
  20929.       }),
  20930.       e = (d.length ? d[0] : a).imageUrl;
  20931.       return _extends({
  20932.       }, a, {
  20933.         imageUrl: e
  20934.       })
  20935.     }),
  20936.     u = function (a) {
  20937.       if (a > 999) {
  20938.         var b = a.toString();
  20939.         return a < 9999 ? b[0] + '.' + b[1] + 'k' : a < 99999 ? b.slice(0, 2) + '.' + b[2] + 'k' : a < 999999 ? b.slice(0, 3) + '.' + b[3] + 'k' : b[0] + '.' + b[1] + 'm'
  20940.       }
  20941.       return a
  20942.     },
  20943.     v = function (a) {
  20944.       return (!h || i) && a.text && a.text.trim()
  20945.     };
  20946.     return a.createElement('div', {
  20947.       className: 'align align--center align--wrap reaction-items__container ' + j
  20948.     }, t.map(function (b, c) {
  20949.       return a.createElement('div', {
  20950.         key: c,
  20951.         className: [
  20952.           k,
  20953.           e ? 'reaction-item__enabled' : 'reaction-item__disabled',
  20954.           b.isSelected ? 'reaction-item__selected' : ''
  20955.         ].join(' ').trim()
  20956.       }, a.createElement('div', {
  20957.         className: l,
  20958.         tabIndex: g ? '-1' : '0',
  20959.         onKeyPress: function (a) {
  20960.           return s(a, c, b)
  20961.         },
  20962.         onClick: function () {
  20963.           return r(c, b)
  20964.         }
  20965.       }, a.createElement('div', {
  20966.         className: o
  20967.       }, b.imageUrl ? a.createElement('img', {
  20968.         className: p,
  20969.         src: b.imageUrl,
  20970.         title: b.text || 'reaction ' + c,
  20971.         alt: b.text || 'reaction ' + c
  20972.       }) : null, !i && f ? a.createElement('div', {
  20973.         className: n
  20974.       }, void 0 !== b.votes && f ? a.createElement('div', {
  20975.         className: m
  20976.       }, b.votes || 0) : a.createElement('div', {
  20977.         className: m
  20978.       }, ' ')) : null), i ? a.createElement('div', {
  20979.         className: q
  20980.       }, f ? a.createElement('div', {
  20981.         className: n
  20982.       }, void 0 !== b.votes && f ? a.createElement('div', {
  20983.         className: m
  20984.       }, u(b.votes) || 0) : a.createElement('div', {
  20985.         className: m
  20986.       }, ' ')) : null) : null, v(b) ? a.createElement('div', {
  20987.         className: 'reaction-item__text'
  20988.       }, b.text) : null), h && !i ? a.createElement('div', {
  20989.         className: 'reaction-tooltip'
  20990.       }, a.createElement('span', {
  20991.         className: 'reaction-tooltip__text'
  20992.       }, b.text), a.createElement('div', {
  20993.         className: 'reaction-tooltip__triangle'
  20994.       }, a.createElement('div', {
  20995.         className: 'reaction-tooltip__inner-triangle'
  20996.       }))) : null)
  20997.     }))
  20998.   };
  20999.   return c
  21000. }),
  21001. define('core/templates/react/ReactionsTemplate', [
  21002.   'react',
  21003.   'core/strings',
  21004.   'core/templates/react/ReactionItemsPartial',
  21005.   'core/constants/reactionConstants',
  21006.   'core/switches'
  21007. ], function (a, b, c, d, e) {
  21008.   'use strict';
  21009.   var f = function (f) {
  21010.     var g = f.reactionsList,
  21011.     h = f.prompt,
  21012.     i = f.onSubmitReaction,
  21013.     j = f.error,
  21014.     k = f.readonly,
  21015.     l = f.userCanModerate,
  21016.     m = f.forum,
  21017.     n = e.isFeatureActive('embed_refresh', {
  21018.       forum: m
  21019.     }),
  21020.     o = n && e.isFeatureActive('embed_refresh_v2', {
  21021.       forum: m
  21022.     }),
  21023.     p = n ? 'reactions-refresh' : '',
  21024.     q = g.reduce(function (a, b) {
  21025.       return a + ('number' == typeof b.votes ? b.votes : 0)
  21026.     }, 0),
  21027.     r = g.some(function (a) {
  21028.       return a.isSelected
  21029.     });
  21030.     return a.createElement('div', {
  21031.       id: 'reactions',
  21032.       className: p
  21033.     }, a.createElement('div', {
  21034.       className: 'text-bold align align--center spacing-bottom-small prompt'
  21035.     }, h && h.trim() || d.DEFAULT_PROMPT), a.createElement('div', {
  21036.       className: 'align align--center spacing-bottom'
  21037.     }, 1 === q ? b.gettext('1 Response') : b.gettext('%(voteCount)s Responses', {
  21038.       voteCount: q
  21039.     })), a.createElement('div', {
  21040.       className: [
  21041.         'reaction-items',
  21042.         k ? 'readonly' : '',
  21043.         r ? 'has-selection' : '',
  21044.         l || r || k ? 'counts-visible' : ''
  21045.       ].join(' ').trim()
  21046.     }, a.createElement(c, {
  21047.       reactionsList: g,
  21048.       onSubmitReaction: i,
  21049.       showVoteCount: l || r || k,
  21050.       readonly: k,
  21051.       isRefreshEnabled: n,
  21052.       isRefreshV2Enabled: o
  21053.     })), a.createElement('div', {
  21054.       className: 'err text-semibold'
  21055.     }, j || ''))
  21056.   };
  21057.   return f
  21058. }),
  21059. define('lounge/views/reactions', [
  21060.   'backbone',
  21061.   'react',
  21062.   'react-dom',
  21063.   'core/bus',
  21064.   'core/utils/reactions',
  21065.   'core/switches',
  21066.   'core/templates/react/ReactionsTemplate'
  21067. ], function (a, b, c, d, e, f, g) {
  21068.   'use strict';
  21069.   var h = a.View.extend({
  21070.     initialize: function (a) {
  21071.       this.reactions = a.reactions,
  21072.       this.readonly = a.readonly,
  21073.       this.session = a.session,
  21074.       this.forum = a.forum,
  21075.       this.userCanModerate = this.session.get('canModerate'),
  21076.       this.isRefreshEnabled = f.isFeatureActive('embed_refresh', {
  21077.         forum: this.forum
  21078.       }),
  21079.       this.listenTo(this.reactions, 'sync', this.render),
  21080.       this.listenTo(this.reactions, 'vote:start', this.handleSubmitStart),
  21081.       this.listenTo(this.reactions, 'vote:end', this.handleSubmitEnd),
  21082.       this.listenTo(this.session, 'change:canModerate', this.handleCanModerateChange),
  21083.       e.attachReactionsListener(this)
  21084.     },
  21085.     handleSubmitStart: function () {
  21086.       this.isSubmitting = !0,
  21087.       this.$('.reaction-items').addClass('is-submitting'),
  21088.       this.$('.err').html()
  21089.     },
  21090.     handleSubmitEnd: function () {
  21091.       this.isSubmitting = !1,
  21092.       this.$('.reaction-items').removeClass('is-submitting')
  21093.     },
  21094.     handleCanModerateChange: function () {
  21095.       this.userCanModerate = this.session.get('canModerate'),
  21096.       this.render()
  21097.     },
  21098.     vote: function (a) {
  21099.       if (!this.isSubmitting && !this.readonly) {
  21100.         var b = this;
  21101.         this.reactions.vote(a, {
  21102.           success: this.render.bind(this),
  21103.           error: function () {
  21104.             b.$('.err').html('An error has occurred while saving your reaction. Please try again later.')
  21105.           }
  21106.         }),
  21107.         d.trigger('uiAction:reactionsVote', this.reactions.at(a))
  21108.       }
  21109.     },
  21110.     render: function () {
  21111.       return this.reactions.length ? (c.render(b.createElement(g, {
  21112.         reactionsList: this.reactions.toJSON(),
  21113.         prompt: this.reactions.prompt,
  21114.         onSubmitReaction: this.vote.bind(this),
  21115.         readonly: this.readonly,
  21116.         userCanModerate: this.userCanModerate,
  21117.         forum: this.forum
  21118.       }), this.el), this.isRefreshEnabled && e.formatReactionsItems(this.forum)) : this.$el.html(''),
  21119.       this
  21120.     }
  21121.   });
  21122.   return h
  21123. }),
  21124. define('templates/lounge/reactionsPromotion', [
  21125.   'react',
  21126.   'core/strings',
  21127.   'core/templates/react/ReactionItemsPartial',
  21128.   'core/constants/reactionConstants'
  21129. ], function (a, b, c, d) {
  21130.   'use strict';
  21131.   var e = b.gettext,
  21132.   f = function (b) {
  21133.     var f = b.onConfirm,
  21134.     g = b.onDefer,
  21135.     h = b.forumShortname;
  21136.     return a.createElement('div', {
  21137.       id: 'reactions-promotion'
  21138.     }, a.createElement('div', {
  21139.       className: 'striped-bar'
  21140.     }), a.createElement('div', {
  21141.       className: 'align align--center private'
  21142.     }, a.createElement('span', {
  21143.       className: 'icon icon-lock'
  21144.     }), e('Only you can see this')), a.createElement('div', {
  21145.       className: 'promotion-title text-bold align align--center spacing-top-narrow spacing-bottom'
  21146.     }, e('Want to increase engagement? Add Reactions to your articles.')), a.createElement('div', {
  21147.       className: 'reaction-items'
  21148.     }, a.createElement(c, {
  21149.       reactionsList: d.DEFAULT_REACTIONS,
  21150.       readonly: !0
  21151.     })), a.createElement('div', {
  21152.       className: 'align align--center'
  21153.     }, a.createElement('button', {
  21154.       className: 'btn btn-info',
  21155.       onClick: g
  21156.     }, e('Maybe later')), a.createElement('a', {
  21157.       className: 'btn btn-primary spacing-left',
  21158.       onClick: f,
  21159.       target: '_blank',
  21160.       rel: 'noopener noreferrer',
  21161.       href: 'https://' + h + '.disqus.com/admin/settings/reactions/'
  21162.     }, 'Enable Reactions')))
  21163.   };
  21164.   return f
  21165. }),
  21166. define('lounge/views/reactions-promotion', [
  21167.   'backbone',
  21168.   'stance',
  21169.   'react',
  21170.   'react-dom',
  21171.   'core/api',
  21172.   'lounge/common',
  21173.   'templates/lounge/reactionsPromotion'
  21174. ], function (a, b, c, d, e, f, g) {
  21175.   'use strict';
  21176.   var h = a.View.extend({
  21177.     initialize: function (a) {
  21178.       this.forum = a.forum,
  21179.       this.listenToOnce(b(this), 'visible', this.trackView)
  21180.     },
  21181.     onConfirm: function () {
  21182.       f.getLounge().trigger('uiAction:reactionsEnable'),
  21183.       this.onDismiss()
  21184.     },
  21185.     onDefer: function () {
  21186.       f.getLounge().trigger('uiAction:reactionsDefer'),
  21187.       this.onDismiss()
  21188.     },
  21189.     onDismiss: function () {
  21190.       this.dismissed = !0,
  21191.       this.render(),
  21192.       e.call('announcements/messages/view', {
  21193.         method: 'POST',
  21194.         data: {
  21195.           message: 'reactionsEmbedPromotion'
  21196.         }
  21197.       })
  21198.     },
  21199.     trackView: function () {
  21200.       f.getLounge().trigger('uiAction:viewReactionsPromotion')
  21201.     },
  21202.     render: function () {
  21203.       return this.dismissed ? this.$el.html('') : d.render(c.createElement(g, {
  21204.         onDefer: this.onDefer.bind(this),
  21205.         onConfirm: this.onConfirm.bind(this),
  21206.         forumShortname: this.forum.id
  21207.       }), this.el),
  21208.       this
  21209.     }
  21210.   });
  21211.   return h
  21212. }),
  21213. define('templates/lounge/partials/postCount', [
  21214.   'react',
  21215.   'core/strings'
  21216. ], function (a, b) {
  21217.   'use strict';
  21218.   var c = b.gettext,
  21219.   d = function (b) {
  21220.     return a.createElement('a', {
  21221.       className: 'publisher-nav-color'
  21222.     }, a.createElement('span', {
  21223.       className: 'comment-count'
  21224.     }, 1 === b.count ? c('1 comment') : c('%(numPosts)s comments', {
  21225.       numPosts: b.count
  21226.     })))
  21227.   };
  21228.   return d
  21229. }),
  21230. define('templates/lounge/partials/topNavigation', [
  21231.   'react',
  21232.   'core/utils/object/get',
  21233.   'templates/lounge/partials/postCount',
  21234.   'core/switches'
  21235. ], function (a, b, c, d) {
  21236.   'use strict';
  21237.   var e = function (e) {
  21238.     var f = d.isFeatureActive('embed_refresh', {
  21239.       forum: e.thread.attributes.forum
  21240.     }),
  21241.     g = f ? 'nav-primary nav-primary--refresh' : 'nav-primary',
  21242.     h = f ? 'tab-conversation tab-conversation--refresh' : 'tab-conversation';
  21243.     return a.createElement('nav', {
  21244.       className: 'nav ' + g
  21245.     }, a.createElement('ul', null, a.createElement('li', {
  21246.       className: 'nav-tab nav-tab--primary ' + h + ' active',
  21247.       'data-role': 'post-count'
  21248.     }, e.inHome ? null : a.createElement(c, {
  21249.       count: b(e.thread, [
  21250.         'attributes',
  21251.         'posts'
  21252.       ], null)
  21253.     })), a.createElement('li', {
  21254.       className: 'nav-tab nav-tab--primary tab-user'
  21255.     }, a.createElement('ul', null, a.createElement('li', {
  21256.       className: 'nav-tab nav-tab--primary notification-menu',
  21257.       'data-role': 'notification-menu'
  21258.     }), a.createElement('li', {
  21259.       className: 'nav-tab nav-tab--primary dropdown user-menu',
  21260.       'data-role': 'logout'
  21261.     })))))
  21262.   };
  21263.   return e
  21264. }),
  21265. define('lounge/views/top-navigation', [
  21266.   'backbone',
  21267.   'templates/lounge/partials/topNavigation'
  21268. ], function (a, b) {
  21269.   'use strict';
  21270.   var c = a.View.extend({
  21271.     initialize: function (a) {
  21272.       this.inHome = a.inHome,
  21273.       this.thread = a.thread
  21274.     },
  21275.     render: function () {
  21276.       return this.$el.html(b({
  21277.         inHome: this.inHome,
  21278.         thread: this.thread
  21279.       })),
  21280.       this
  21281.     }
  21282.   });
  21283.   return c
  21284. }),
  21285. define('templates/lounge/partials/threadFooter', [
  21286.   'react',
  21287.   'core/strings',
  21288.   'core/switches',
  21289.   'core/utils/object/get'
  21290. ], function (a, b, c, d) {
  21291.   'use strict';
  21292.   var e = b.gettext,
  21293.   f = function (b) {
  21294.     var f = c.isFeatureActive('embed_refresh', {
  21295.       forum: b.forum.id
  21296.     }),
  21297.     g = f ? 'disqus-footer__link disqus-footer__link--refresh' : 'disqus-footer__link',
  21298.     h = f ? 'disqus-footer__item disqus-footer__item--refresh' : 'disqus-footer__item',
  21299.     i = f ? 'text-item' : 'clip',
  21300.     j = f ? 'disqus-footer disqus-footer--refresh' : 'disqus-footer';
  21301.     return a.createElement('div', {
  21302.       className: j
  21303.     }, a.createElement('ul', {
  21304.       className: 'disqus-footer__list'
  21305.     }, c.isFeatureActive('sso_less_branding', {
  21306.       forum: b.forum.id
  21307.     }) ? null : a.createElement('li', {
  21308.       id: 'thread-subscribe-button',
  21309.       className: 'email ' + h
  21310.     }, a.createElement('div', {
  21311.       className: 'default'
  21312.     }, a.createElement('a', {
  21313.       href: '#',
  21314.       rel: 'nofollow',
  21315.       'data-action': 'subscribe',
  21316.       title: e('Subscribe and get email updates from this discussion'),
  21317.       className: g
  21318.     }, f ? a.createElement('div', {
  21319.       className: 'icon-wrapper'
  21320.     }, a.createElement('i', {
  21321.       'aria-hidden': 'true',
  21322.       className: 'icon-subscribe-refresh'
  21323.     })) : a.createElement('i', {
  21324.       'aria-hidden': 'true',
  21325.       className: 'icon icon-mail'
  21326.     }), a.createElement('i', {
  21327.       'aria-hidden': 'true',
  21328.       className: 'icon icon-checkmark'
  21329.     }), a.createElement('span', {
  21330.       id: 'thread-subscribe-text-default',
  21331.       className: i
  21332.     }, e('Subscribe')), a.createElement('span', {
  21333.       id: 'thread-subscribe-text-subscribed',
  21334.       className: i
  21335.     }, e('Subscribed'))))), c.isFeatureActive('removePrivacyPolicy', {
  21336.       forum: b.forum.id
  21337.     }) ? null : a.createElement('li', {
  21338.       className: 'privacy ' + h
  21339.     }, a.createElement('a', {
  21340.       href: 'https://disqus.com/privacy-policy',
  21341.       rel: 'nofollow noopener noreferrer',
  21342.       target: '_blank',
  21343.       className: g,
  21344.       title: 'Privacy'
  21345.     }, f ? a.createElement('div', {
  21346.       className: 'icon-wrapper'
  21347.     }, a.createElement('i', {
  21348.       'aria-hidden': 'true',
  21349.       className: 'icon-privacy-refresh'
  21350.     })) : a.createElement('i', {
  21351.       'aria-hidden': 'true',
  21352.       className: 'icon icon-lock'
  21353.     }), a.createElement('span', {
  21354.       className: i
  21355.     }, e('Privacy')))), c.isFeatureActive('removePrivacyPolicy', {
  21356.       forum: b.forum.id
  21357.     }) ? '' : a.createElement('li', {
  21358.       className: 'do-not-sell ' + h
  21359.     }, a.createElement('a', {
  21360.       href: 'https://disqus.com/data-sharing-settings/',
  21361.       rel: 'nofollow noopener noreferrer',
  21362.       target: '_blank',
  21363.       className: g
  21364.     }, f ? a.createElement('div', {
  21365.       className: 'icon-wrapper'
  21366.     }, a.createElement('i', {
  21367.       'aria-hidden': 'true',
  21368.       className: 'icon-warning-refresh'
  21369.     })) : a.createElement('i', {
  21370.       'aria-hidden': 'true',
  21371.       className: 'icon icon-warning'
  21372.     }), a.createElement('span', {
  21373.       className: i
  21374.     }, e('Do Not Sell My Data'))))), d(b.forum, [
  21375.       'attributes',
  21376.       'disableDisqusBranding'
  21377.     ], null) ? null : a.createElement('span', {
  21378.       className: 'disqus-footer__logo'
  21379.     }, a.createElement('a', {
  21380.       href: 'https://disqus.com',
  21381.       rel: 'nofollow',
  21382.       title: e('Powered by Disqus'),
  21383.       className: g
  21384.     }, e('Powered by Disqus'))))
  21385.   };
  21386.   return f
  21387. }),
  21388. define('lounge/views/thread-footer', [
  21389.   'backbone',
  21390.   'templates/lounge/partials/threadFooter'
  21391. ], function (a, b) {
  21392.   'use strict';
  21393.   var c = a.View.extend({
  21394.     initialize: function (a) {
  21395.       this.forum = a.forum
  21396.     },
  21397.     render: function () {
  21398.       return this.$el.html(b({
  21399.         forum: this.forum
  21400.       })),
  21401.       this
  21402.     }
  21403.   });
  21404.   return c
  21405. }),
  21406. define('templates/lounge/partials/postSort', [
  21407.   'react',
  21408.   'core/strings',
  21409.   'core/switches'
  21410. ], function (a, b, c) {
  21411.   'use strict';
  21412.   var d = b.gettext,
  21413.   e = function (b) {
  21414.     var e = b.votingDisabled && 'popular' === b.order ? 'desc' : b.order,
  21415.     f = c.isFeatureActive('embed_refresh', {
  21416.       forum: b.forum
  21417.     }),
  21418.     g = f ? '' : 'nav-tab nav-tab--secondary dropdown sorting pull-left spacing-right-large',
  21419.     h = f ? 'sort-menu-refresh' : 'dropdown-menu',
  21420.     i = f ? 'sort-menu-refresh__item' : '';
  21421.     return a.createElement('li', {
  21422.       'data-role': 'post-sort',
  21423.       className: g
  21424.     }, f ? null : a.createElement('a', {
  21425.       href: '#',
  21426.       className: 'dropdown-toggle',
  21427.       'data-toggle': 'dropdown'
  21428.     }, 'popular' === e ? d('Sort by Best') : null, 'desc' === e ? d('Sort by Newest') : null, 'asc' === e ? d('Sort by Oldest') : null, a.createElement('span', {
  21429.       className: 'caret'
  21430.     })), a.createElement('ul', {
  21431.       className: h
  21432.     }, a.createElement('li', {
  21433.       className: i + ' ' + ('popular' === e ? 'selected' : '')
  21434.     }, b.votingDisabled ? null : a.createElement('a', {
  21435.       href: '#',
  21436.       'data-action': 'sort',
  21437.       'data-sort': 'popular'
  21438.     }, d('Best'), f ? null : a.createElement('i', {
  21439.       'aria-hidden': 'true',
  21440.       className: 'icon-checkmark'
  21441.     }))), a.createElement('li', {
  21442.       className: i + ' ' + ('desc' === e ? 'selected' : '')
  21443.     }, a.createElement('a', {
  21444.       href: '#',
  21445.       'data-action': 'sort',
  21446.       'data-sort': 'desc'
  21447.     }, d('Newest'), f ? null : a.createElement('i', {
  21448.       'aria-hidden': 'true',
  21449.       className: 'icon-checkmark'
  21450.     }))), a.createElement('li', {
  21451.       className: i + ' ' + ('asc' === e ? 'selected' : '')
  21452.     }, a.createElement('a', {
  21453.       href: '#',
  21454.       'data-action': 'sort',
  21455.       'data-sort': 'asc'
  21456.     }, d('Oldest'), f ? null : a.createElement('i', {
  21457.       'aria-hidden': 'true',
  21458.       className: 'icon-checkmark'
  21459.     })))))
  21460.   };
  21461.   return e
  21462. }),
  21463. define('templates/lounge/partials/secondaryNavigation', [
  21464.   'react',
  21465.   'templates/lounge/partials/postSort',
  21466.   'core/switches'
  21467. ], function (a, b, c) {
  21468.   'use strict';
  21469.   var d = function (d) {
  21470.     var e = d.forum,
  21471.     f = c.isFeatureActive('embed_refresh', {
  21472.       forum: e
  21473.     }),
  21474.     g = f ? 'nav-secondary-refresh__list' : '',
  21475.     h = d.inHome ? null : a.createElement(b, {
  21476.       order: d.order,
  21477.       votingDisabled: d.votingDisabled,
  21478.       forum: e
  21479.     }),
  21480.     i = a.createElement('li', {
  21481.       id: 'thread-share-bar',
  21482.       className: 'nav-tab nav-tab--secondary share-bar pull-left'
  21483.     }),
  21484.     j = a.createElement('li', {
  21485.       id: 'favorite-button',
  21486.       className: 'nav-tab nav-tab--secondary favorite dropdown pull-left',
  21487.       'aria-label': 'Favorite this discussion'
  21488.     }),
  21489.     k = a.createElement('li', {
  21490.       className: 'nav-secondary-refresh__list-item'
  21491.     }, a.createElement('div', {
  21492.       id: 'favorite-button'
  21493.     }), a.createElement('div', {
  21494.       id: 'thread-share-bar',
  21495.       className: 'share-bar-refresh'
  21496.     })),
  21497.     l = f ? [
  21498.       k,
  21499.       h
  21500.     ] : [
  21501.       h,
  21502.       j,
  21503.       i
  21504.     ];
  21505.     return a.createElement('ul', {
  21506.       className: g
  21507.     }, l)
  21508.   };
  21509.   return d
  21510. }),
  21511. define('lounge/views/secondary-navigation', [
  21512.   'backbone',
  21513.   'core/utils/storage',
  21514.   'core/switches',
  21515.   'templates/lounge/partials/secondaryNavigation'
  21516. ], function (a, b, c, d) {
  21517.   'use strict';
  21518.   var e = a.View.extend({
  21519.     attributes: {
  21520.       'data-tracking-area': 'secondary-nav'
  21521.     },
  21522.     initialize: function (a) {
  21523.       this.inHome = a.inHome,
  21524.       this.order = a.order,
  21525.       this.votingDisabled = a.votingDisabled,
  21526.       this.forum = a.forum,
  21527.       this.isRefreshEnabled = c.isFeatureActive('embed_refresh', {
  21528.         forum: this.forum
  21529.       }),
  21530.       this.$el.addClass(this.isRefreshEnabled ? 'nav-secondary-refresh' : 'nav nav-secondary')
  21531.     },
  21532.     render: function () {
  21533.       return this.$el.html(d({
  21534.         inHome: this.inHome,
  21535.         order: this.order,
  21536.         votingDisabled: this.votingDisabled,
  21537.         forum: this.forum
  21538.       })),
  21539.       this
  21540.     }
  21541.   });
  21542.   return e
  21543. }),
  21544. define('templates/lounge/userMenu', [
  21545.   'react',
  21546.   'core/config/urls',
  21547.   'core/strings',
  21548.   'core/switches',
  21549.   'core/utils/object/get',
  21550.   'core/utils/threadRatingsHelpers',
  21551.   'core/utils/storage',
  21552.   'templates/lounge/partials/profileLink'
  21553. ], function (a, b, c, d, e, f, g, h) {
  21554.   'use strict';
  21555.   var i = c.gettext,
  21556.   j = function (c) {
  21557.     var j = d.isFeatureActive('embed_refresh', {
  21558.       forum: c.forum.id
  21559.     }),
  21560.     k = d.isFeatureActive('embed_refresh_v2', {
  21561.       forum: c.forum.id
  21562.     }),
  21563.     l = j ? 'username username--refresh' : 'username',
  21564.     m = j ? 'avatar avatar--refresh' : 'avatar',
  21565.     n = j ? 'dropdown-toggle dropdown-toggle--refresh' : 'dropdown-toggle',
  21566.     o = j ? 'dropdown-menu dropdown-menu--refresh' : 'dropdown-menu',
  21567.     p = j ? 'caret caret--refresh' : 'caret',
  21568.     q = i(null === g.get('switch:embed_refresh') || g.get('switch:embed_refresh') === !0 ? 'Classic Disqus' : 'New Disqus');
  21569.     return [!e(c.user, [
  21570.       'thread',
  21571.       'canReply'
  21572.     ]) || !e(c.user, [
  21573.       'thread',
  21574.       'canModerate'
  21575.     ]) && d.isFeatureActive('sso_less_branding', {
  21576.       forum: c.thread.forum
  21577.     }) ? null : a.createElement('a', {
  21578.       key: 'user-menu-dropdown',
  21579.       href: '#',
  21580.       className: n,
  21581.       'data-toggle': 'dropdown',
  21582.       role: 'menuitem',
  21583.       name: e(c.user, [
  21584.         'isRegistered'
  21585.       ]) ? 'User Menu' : i('Login')
  21586.     }, a.createElement('span', {
  21587.       className: 'dropdown-toggle-wrapper'
  21588.     }, e(c.user, [
  21589.       'isRegistered'
  21590.     ]) ? a.createElement('span', null, a.createElement('span', {
  21591.       className: m
  21592.     }, a.createElement('img', {
  21593.       'data-role': 'user-avatar',
  21594.       'data-user': e(c.user, [
  21595.         'id'
  21596.       ], ''),
  21597.       'data-src': e(c.user, [
  21598.         'avatar',
  21599.         'cache'
  21600.       ], ''),
  21601.       alt: i('Avatar')
  21602.     })), a.createElement('span', {
  21603.       className: l,
  21604.       'data-role': 'username',
  21605.       'data-username': e(c.user, [
  21606.         'username'
  21607.       ], '')
  21608.     }, e(c.user, [
  21609.       'name'
  21610.     ]) || e(c.user, [
  21611.       'username'
  21612.     ]) || null)) : a.createElement('span', {
  21613.       className: l
  21614.     }, i('Login')), ' '), ' ', a.createElement('span', {
  21615.       className: p
  21616.     })),
  21617.     a.createElement('ul', {
  21618.       key: 'user-menu-menu',
  21619.       className: o
  21620.     }, e(c.user, [
  21621.       'isRegistered'
  21622.     ]) ? [
  21623.       e(c.user, [
  21624.         'thread',
  21625.         'canModerate'
  21626.       ]) && d.isFeatureActive('sso_less_branding', {
  21627.         forum: c.thread.forum
  21628.       }) ? null : a.createElement('li', {
  21629.         key: 'menu-profile'
  21630.       }, a.createElement(h, {
  21631.         user: c.user,
  21632.         forum: c.forum
  21633.       }, i('Your Profile'))),
  21634.       d.isFeatureActive('sso_less_branding', {
  21635.         forum: c.thread.forum
  21636.       }) || e(c.forum, [
  21637.         'disableDisqusBranding'
  21638.       ], null) ? null : a.createElement('li', {
  21639.         key: 'menu-channels'
  21640.       }, a.createElement('a', {
  21641.         href: '/channels/',
  21642.         target: '_blank',
  21643.         rel: 'noopener noreferrer'
  21644.       }, i('Channels'))),
  21645.       j && k && !c.isInHome && !d.isFeatureActive('sso_less_branding', {
  21646.         forum: c.thread.forum
  21647.       }) ? a.createElement('li', {
  21648.         key: 'menu-community'
  21649.       }, a.createElement('a', {
  21650.         href: e(c.forum, [
  21651.           'homeUrl'
  21652.         ], ''),
  21653.         'data-action': 'community-sidebar',
  21654.         'data-forum': e(c.forum, [
  21655.           'id'
  21656.         ], ''),
  21657.         id: 'community-tab',
  21658.         name: e(c.forum, [
  21659.           'name'
  21660.         ], null)
  21661.       }, i('Community'))) : null,
  21662.       a.createElement('li', {
  21663.         key: 'menu-media'
  21664.       }, a.createElement('a', {
  21665.         href: '#',
  21666.         className: 'media-toggle-on',
  21667.         'data-action': 'toggle-media'
  21668.       }, i('Display Media')), a.createElement('a', {
  21669.         href: '#',
  21670.         className: 'media-toggle-off',
  21671.         'data-action': 'toggle-media'
  21672.       }, i('Hide Media'))),
  21673.       e(c.user, [
  21674.         'remote'
  21675.       ]) ? null : a.createElement('li', {
  21676.         key: 'menu-settings'
  21677.       }, a.createElement('a', {
  21678.         href: e(b, [
  21679.           'editProfile'
  21680.         ], '')
  21681.       }, i('Edit Settings')))
  21682.     ] : [
  21683.       e(c.sso, [
  21684.         'url'
  21685.       ]) ? a.createElement('li', {
  21686.         key: 'menu-auth-sso',
  21687.         className: 'sso'
  21688.       }, a.createElement('a', {
  21689.         href: '#',
  21690.         'data-action': 'auth:sso'
  21691.       }, e(c.sso, [
  21692.         'name'
  21693.       ], null))) : null,
  21694.       a.createElement('li', {
  21695.         key: 'menu-auth-disqus'
  21696.       }, a.createElement('a', {
  21697.         href: '#',
  21698.         'data-action': 'auth:disqus'
  21699.       }, 'Disqus')),
  21700.       a.createElement('li', {
  21701.         key: 'menu-auth-facebook'
  21702.       }, a.createElement('a', {
  21703.         href: '#',
  21704.         'data-action': 'auth:facebook'
  21705.       }, 'Facebook')),
  21706.       a.createElement('li', {
  21707.         key: 'menu-auth-twitter'
  21708.       }, a.createElement('a', {
  21709.         href: '#',
  21710.         'data-action': 'auth:twitter'
  21711.       }, 'X (Twitter)')),
  21712.       a.createElement('li', {
  21713.         key: 'menu-auth-google'
  21714.       }, a.createElement('a', {
  21715.         href: '#',
  21716.         'data-action': 'auth:google'
  21717.       }, 'Google')),
  21718.       a.createElement('li', {
  21719.         key: 'menu-auth-microsoft'
  21720.       }, a.createElement('a', {
  21721.         href: '#',
  21722.         'data-action': 'auth:microsoft'
  21723.       }, 'Microsoft')),
  21724.       a.createElement('li', {
  21725.         key: 'menu-auth-apple'
  21726.       }, a.createElement('a', {
  21727.         href: '#',
  21728.         'data-action': 'auth:apple'
  21729.       }, 'Apple'))
  21730.     ], e(c.user, [
  21731.       'thread',
  21732.       'canModerate'
  21733.     ]) ? [
  21734.       c.forum.settings.validateAllPosts ? null : a.createElement('li', {
  21735.         key: 'menu-toggle-thread-premoderate'
  21736.       }, a.createElement('a', {
  21737.         href: '#',
  21738.         'data-action': 'toggle-thread-premoderate'
  21739.       }, i(c.thread.validateAllPosts ? 'Don\'t Premoderate Thread' : 'Premoderate Thread'))),
  21740.       a.createElement('li', {
  21741.         key: 'menu-toggle-thread'
  21742.       }, a.createElement('a', {
  21743.         href: '#',
  21744.         'data-action': 'toggle-thread'
  21745.       }, i(e(c.thread, [
  21746.         'isClosed'
  21747.       ]) ? 'Open Thread' : 'Close Thread'))),
  21748.       e(c.forum, [
  21749.         'settings',
  21750.         'threadReactionsEnabled'
  21751.       ]) && e(c.user, [
  21752.         'thread',
  21753.         'canModerate'
  21754.       ]) && c.thread.reactions.eligible ? a.createElement('li', {
  21755.         key: 'menu-toggle-reactions'
  21756.       }, a.createElement('a', {
  21757.         href: '#',
  21758.         'data-action': 'toggle-reactions'
  21759.       }, i(c.thread.reactions && c.thread.reactions.enabled ? 'Remove Reactions' : 'Restore Reactions'))) : null,
  21760.       f.isForumRatingsEnabled(c.forum) ? a.createElement('li', {
  21761.         key: 'menu-toggle-thread-ratings'
  21762.       }, a.createElement('a', {
  21763.         href: '#',
  21764.         'data-action': 'toggle-thread-ratings'
  21765.       }, i(c.thread.ratingsEnabled ? 'Disable Ratings' : 'Enable Ratings'))) : null,
  21766.       e(c.user, [
  21767.         'isGlobalAdmin'
  21768.       ]) ? null : a.createElement('li', {
  21769.         key: 'menu-help'
  21770.       }, a.createElement('a', {
  21771.         href: 'https://help.disqus.com/customer/portal/articles/2538045-commenter-launch-pad'
  21772.       }, i('Help')))
  21773.     ] : null, e(c.user, [
  21774.       'isGlobalAdmin'
  21775.     ]) ? [
  21776.       a.createElement('li', {
  21777.         key: 'menu-debug'
  21778.       }, a.createElement('a', {
  21779.         href: '#',
  21780.         'data-action': 'debug'
  21781.       }, i('Debug'))),
  21782.       a.createElement('li', {
  21783.         key: 'menu-repair'
  21784.       }, a.createElement('a', {
  21785.         href: '#',
  21786.         'data-action': 'repair'
  21787.       }, i('Repair')))
  21788.     ] : null, e(c.user, [
  21789.       'isRegistered'
  21790.     ]) && e(c.user, [
  21791.       'thread',
  21792.       'canReply'
  21793.     ]) ? [
  21794.       a.createElement('li', {
  21795.         key: 'menu-toggle-embed-refresh'
  21796.       }, d.isFeatureActive('toggle_embed_refresh') && !d.isFeatureActive('sso_less_branding', {
  21797.         forum: c.thread.forum
  21798.       }) ? a.createElement('a', {
  21799.         href: '#',
  21800.         'data-action': 'toggle-embed-refresh'
  21801.       }, q) : null),
  21802.       a.createElement('li', {
  21803.         key: 'menu-logout'
  21804.       }, a.createElement('a', {
  21805.         href: '#',
  21806.         'data-action': 'logout'
  21807.       }, i('Logout')))
  21808.     ] : null)]
  21809.   };
  21810.   return j
  21811. }),
  21812. define('templates/lounge/threadShareBar', [
  21813.   'react',
  21814.   'core/strings',
  21815.   'core/switches'
  21816. ], function (a, b, c) {
  21817.   'use strict';
  21818.   var d = b.gettext,
  21819.   e = function (b) {
  21820.     var e = b.forum,
  21821.     f = c.isFeatureActive('embed_refresh', {
  21822.       forum: e
  21823.     }),
  21824.     g = f && c.isFeatureActive('embed_refresh_v2', {
  21825.       forum: e
  21826.     }),
  21827.     h = f ? 'thread-share-bar-buttons-refresh' : 'thread-share-bar-buttons dropdown',
  21828.     i = f ? 'share-dropdown-refresh' : 'dropdown-menu pull-right',
  21829.     j = f ? 'share-button-toggle' : 'dropdown-toggle icon icon-share',
  21830.     k = f ? 'share-dropdown-refresh__item' : 'thread-share__item';
  21831.     return a.createElement('div', {
  21832.       className: 'thread-share-wrapper'
  21833.     }, f ? a.createElement('div', {
  21834.       className: 'round-delimiter'
  21835.     }) : null, a.createElement('span', {
  21836.       'data-role': 'thread-share',
  21837.       className: h
  21838.     }, a.createElement('a', {
  21839.       href: '#',
  21840.       className: j + ' ' + (g ? j + '--v2' : ''),
  21841.       'data-toggle': 'dropdown',
  21842.       'aria-label': d('Share')
  21843.     }, f ? d('Share') : ''), a.createElement('ul', {
  21844.       className: i
  21845.     }, f ? null : a.createElement('div', {
  21846.       className: 'thread-share__text'
  21847.     }, 'Share this discussion'), a.createElement('li', {
  21848.       className: k
  21849.     }, f ? a.createElement('div', {
  21850.       className: 'share-icons-wrapper share-icons-wrapper--twitter',
  21851.       'data-action': 'share:twitter'
  21852.     }, a.createElement('span', {
  21853.       className: 'icon-twitter-x',
  21854.       'aria-hidden': 'true'
  21855.     }), a.createElement('span', {
  21856.       className: 'visually-hidden'
  21857.     }, d('Tweet this discussion'))) : a.createElement('span', {
  21858.       className: 'share-twitter',
  21859.       'data-action': 'share:twitter',
  21860.       tabIndex: '0'
  21861.     }, a.createElement('span', {
  21862.       className: 'icon-twitter-circle',
  21863.       'aria-hidden': 'true'
  21864.     }), a.createElement('span', {
  21865.       className: 'visually-hidden'
  21866.     }, d('Tweet this discussion')))), a.createElement('li', {
  21867.       className: k
  21868.     }, f ? a.createElement('div', {
  21869.       className: 'share-icons-wrapper share-icons-wrapper--facebook',
  21870.       'data-action': 'share:facebook'
  21871.     }, a.createElement('span', {
  21872.       className: 'icon-facebook',
  21873.       'aria-hidden': 'true'
  21874.     }), a.createElement('span', {
  21875.       className: 'visually-hidden'
  21876.     }, d('Share this discussion on Facebook'))) : a.createElement('span', {
  21877.       className: 'share-facebook',
  21878.       'data-action': 'share:facebook',
  21879.       tabIndex: '0'
  21880.     }, a.createElement('span', {
  21881.       className: 'icon-facebook-circle',
  21882.       'aria-hidden': 'true'
  21883.     }), a.createElement('span', {
  21884.       className: 'visually-hidden'
  21885.     }, d('Share this discussion on Facebook')))), a.createElement('li', {
  21886.       className: k
  21887.     }, f ? a.createElement('div', {
  21888.       className: 'share-icons-wrapper share-icons-wrapper--email',
  21889.       'data-action': 'share:email'
  21890.     }, a.createElement('span', {
  21891.       className: 'icon-mail',
  21892.       'aria-hidden': 'true'
  21893.     }), a.createElement('span', {
  21894.       className: 'visually-hidden'
  21895.     }, d('Share this discussion via email'))) : a.createElement('span', {
  21896.       className: 'share-email',
  21897.       'data-action': 'share:email',
  21898.       tabIndex: '0'
  21899.     }, a.createElement('span', {
  21900.       className: 'icon-mail',
  21901.       'aria-hidden': 'true'
  21902.     }), a.createElement('span', {
  21903.       className: 'visually-hidden'
  21904.     }, d('Share this discussion via email')))), a.createElement('li', {
  21905.       className: k
  21906.     }, f ? a.createElement('div', {
  21907.       className: 'share-icons-wrapper share-icons-wrapper--link',
  21908.       'data-action': 'copy-link',
  21909.       title: d('Click to copy discussion link')
  21910.     }, a.createElement('span', {
  21911.       className: 'icon-link',
  21912.       'aria-hidden': 'true'
  21913.     }), a.createElement('span', {
  21914.       className: 'visually-hidden'
  21915.     }, d('Copy link to discussion'))) : a.createElement('span', {
  21916.       className: 'share-link',
  21917.       'data-action': 'copy-link',
  21918.       title: d('Click to copy discussion link'),
  21919.       tabIndex: '0'
  21920.     }, a.createElement('span', {
  21921.       className: 'icon-link',
  21922.       'aria-hidden': 'true'
  21923.     }), a.createElement('span', {
  21924.       className: 'visually-hidden'
  21925.     }, d('Copy link to discussion')))))))
  21926.   };
  21927.   return e
  21928. }),
  21929. define('templates/lounge/layout', [
  21930.   'react'
  21931. ], function (a) {
  21932.   'use strict';
  21933.   var b = function (b) {
  21934.     var c = b.forum;
  21935.     return a.createElement('div', {
  21936.       id: 'layout',
  21937.       'data-tracking-area': 'layout'
  21938.     }, c.settings.behindClickEnabled ? a.createElement('div', {
  21939.       id: 'behindclick__container'
  21940.     }) : null, a.createElement('div', {
  21941.       id: 'thread__container'
  21942.     }), a.createElement('div', {
  21943.       id: 'embed_v2-root'
  21944.     }))
  21945.   };
  21946.   return b
  21947. }),
  21948. define('templates/lounge/inEmbedAd', [
  21949.   'react'
  21950. ], function (a) {
  21951.   'use strict';
  21952.   return function () {
  21953.     return a.createElement('div', {
  21954.       className: 'ad-content',
  21955.       role: 'ad-content'
  21956.     })
  21957.   }
  21958. }),
  21959. define('templates/lounge/inthreadAd', [
  21960.   'react'
  21961. ], function (a) {
  21962.   'use strict';
  21963.   var b = function () {
  21964.     return a.createElement('li', {
  21965.       className: 'post advertisement'
  21966.     }, a.createElement('div', {
  21967.       className: 'post-content',
  21968.       'data-role': 'post-content'
  21969.     }))
  21970.   };
  21971.   return b
  21972. }),
  21973. define('templates/lounge/termsOfService', [
  21974.   'react',
  21975.   'core/strings'
  21976. ], function (a, b) {
  21977.   'use strict';
  21978.   var c = b.gettext,
  21979.   d = function () {
  21980.     return a.createElement('div', null, a.createElement('div', {
  21981.       className: 'checkbox-wrapper'
  21982.     }, a.createElement('p', null, a.createElement('label', null, a.createElement('input', {
  21983.       type: 'checkbox',
  21984.       name: 'tos'
  21985.     }), a.createElement('span', {
  21986.       className: 'spacing-left-small'
  21987.     }, c('I agree to Disqus\' %(terms)s', {
  21988.       terms: a.createElement('a', {
  21989.         href: 'https://help.disqus.com/customer/portal/articles/466260-terms-of-service',
  21990.         target: '_blank',
  21991.         rel: 'noopener noreferrer'
  21992.       }, c('Terms of Service'))
  21993.     })))), a.createElement('p', null, a.createElement('label', null, a.createElement('input', {
  21994.       type: 'checkbox',
  21995.       name: 'privacy-policy'
  21996.     }), a.createElement('span', {
  21997.       className: 'spacing-left-small'
  21998.     }, c('I agree to Disqus\' processing of email and IP address, and the use of cookies, to facilitate my authentication and posting of comments, explained further in the %(policy)s', {
  21999.       policy: a.createElement('a', {
  22000.         href: 'https://disqus.com/privacy-policy',
  22001.         target: '_blank',
  22002.         rel: 'noopener noreferrer'
  22003.       }, c('Privacy Policy'))
  22004.     })))), a.createElement('p', null, a.createElement('label', null, a.createElement('input', {
  22005.       type: 'checkbox',
  22006.       name: 'data-sharing'
  22007.     }), a.createElement('span', {
  22008.       className: 'spacing-left-small'
  22009.     }, c('I agree to additional processing of my information, including first and third party cookies, for personalized content and advertising as outlined in our %(policy)s', {
  22010.       policy: a.createElement('a', {
  22011.         href: 'https://disqus.com/data-sharing-settings/'
  22012.       }, c('Data Sharing Policy'))
  22013.     }))))))
  22014.   },
  22015.   e = function (b) {
  22016.     var e = b.onAccept,
  22017.     f = b.isPrivate;
  22018.     return a.createElement('div', {
  22019.       id: 'tos__message',
  22020.       className: 'align align--column align--middle'
  22021.     }, a.createElement('h1', null, c('Important Update')), a.createElement('p', null, c('When you log in with Disqus, we process personal data to facilitate your authentication and posting of comments. We also store the comments you post and those comments are immediately viewable and searchable by anyone around the world.')), f ? a.createElement(d, null) : a.createElement('p', null, a.createElement('label', null, a.createElement('span', null, c('Please access our %(policy)s to learn what personal data Disqus collects and your choices about how it is used.  All users of our service are also subject to our %(terms)s.', {
  22022.       policy: a.createElement('a', {
  22023.         href: 'https://disqus.com/privacy-policy',
  22024.         target: '_blank',
  22025.         rel: 'noopener noreferrer'
  22026.       }, c('Privacy Policy')),
  22027.       terms: a.createElement('a', {
  22028.         href: 'https://help.disqus.com/customer/portal/articles/466260-terms-of-service',
  22029.         target: '_blank',
  22030.         rel: 'noopener noreferrer'
  22031.       }, c('Terms of Service'))
  22032.     })))), a.createElement('p', {
  22033.       className: 'align'
  22034.     }, a.createElement('button', {
  22035.       className: 'button button-large',
  22036.       onClick: e,
  22037.       id: 'accept_tos'
  22038.     }, c('Proceed'))))
  22039.   };
  22040.   return e
  22041. }),
  22042. define('common/collections/profile', [
  22043.   'core/api',
  22044.   'common/models',
  22045.   'common/collections'
  22046. ], function (a, b, c) {
  22047.   'use strict';
  22048.   var d = c.PaginatedCollection.extend({
  22049.     initialize: function (a, b) {
  22050.       this.user = b.user,
  22051.       c.PaginatedCollection.prototype.initialize.apply(this, arguments)
  22052.     },
  22053.     fetch: function (a) {
  22054.       return a = a || {
  22055.       },
  22056.       a.data = a.data || {
  22057.       },
  22058.       a.data.user = this.user.id,
  22059.       c.PaginatedCollection.prototype.fetch.call(this, a)
  22060.     }
  22061.   }),
  22062.   e = d.extend({
  22063.     model: b.SyncedUser,
  22064.     url: a.getURL('users/listFollowing'),
  22065.     PER_PAGE: 20
  22066.   });
  22067.   return {
  22068.     SessionPaginatedCollection: d,
  22069.     FollowingCollection: e
  22070.   }
  22071. });
  22072. var _typeof = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (a) {
  22073.   return typeof a
  22074. }
  22075.  : function (a) {
  22076.   return a && 'function' == typeof Symbol && a.constructor === Symbol && a !== Symbol.prototype ? 'symbol' : typeof a
  22077. };
  22078. define('lounge/views', [
  22079.   'jquery',
  22080.   'underscore',
  22081.   'backbone',
  22082.   'loglevel',
  22083.   'raven',
  22084.   'stance',
  22085.   'moment',
  22086.   'react',
  22087.   'react-dom',
  22088.   'core/ads/ads',
  22089.   'core/analytics/identity',
  22090.   'core/api',
  22091.   'core/mediaConfig',
  22092.   'core/UniqueModel',
  22093.   'core/mixins/appliesPublisherClasses',
  22094.   'core/mixins/withAlert',
  22095.   'core/models/ThreadVote',
  22096.   'core/models/Vote',
  22097.   'core/constants/voteConstants',
  22098.   'core/config',
  22099.   'remote/config',
  22100.   'common/models',
  22101.   'common/collections',
  22102.   'common/utils',
  22103.   'core/bus',
  22104.   'core/strings',
  22105.   'common/urls',
  22106.   'core/analytics/jester',
  22107.   'common/views/mixins',
  22108.   'common/Session',
  22109.   'common/keys',
  22110.   'core/utils',
  22111.   'core/utils/isIframed',
  22112.   'core/utils/html/toRGBColorString',
  22113.   'core/utils/threadRatingsHelpers',
  22114.   'core/utils/url/serialize',
  22115.   'core/utils/storage',
  22116.   'core/utils/isMediaTradecraftAdEnabled',
  22117.   'core/switches',
  22118.   'core/viglink',
  22119.   'core/WindowBus',
  22120.   'common/outboundlinkhandler',
  22121.   'core/mixins/withEmailVerifyLink',
  22122.   'core/templates/react/BehindClickTemplate',
  22123.   'core/templates/react/ThreadTemplate',
  22124.   'core/shared/urls',
  22125.   'lounge/common',
  22126.   'lounge/menu-handler',
  22127.   'lounge/mixins',
  22128.   'lounge/realtime',
  22129.   'lounge/views/badges-message',
  22130.   'lounge/views/email-signup',
  22131.   'lounge/views/posts/PostReplyView',
  22132.   'lounge/views/posts/collection',
  22133.   'lounge/views/media',
  22134.   'lounge/views/onboard-alert',
  22135.   'lounge/views/notification-menu',
  22136.   'lounge/views/highlighted-post',
  22137.   'lounge/views/realtime',
  22138.   'lounge/views/posts/UserSuggestionsManager',
  22139.   'lounge/views/sidebar',
  22140.   'lounge/views/ratings',
  22141.   'lounge/views/reactions',
  22142.   'lounge/views/reactions-promotion',
  22143.   'lounge/views/favorite-button',
  22144.   'lounge/views/top-navigation',
  22145.   'lounge/views/thread-footer',
  22146.   'lounge/views/secondary-navigation',
  22147.   'lounge/tracking',
  22148.   'templates/lounge/userMenu',
  22149.   'templates/lounge/threadShareBar',
  22150.   'templates/lounge/layout',
  22151.   'templates/lounge/inEmbedAd',
  22152.   'templates/lounge/inthreadAd',
  22153.   'templates/lounge/termsOfService',
  22154.   'templates/lounge/partials/postCount',
  22155.   'templates/lounge/partials/postSort',
  22156.   'common/main',
  22157.   'common/collections/profile'
  22158. ], function (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, $, _, aa, ba, ca, da, ea, fa, ga, ha, ia, ja, ka, la, ma, na, oa, pa, qa, ra, sa, ta, ua, va, wa, xa) {
  22159.   'use strict';
  22160.   var ya = window.document,
  22161.   za = z.get,
  22162.   Aa = F.preventDefaultHandler,
  22163.   Ba = new O,
  22164.   Ca = c.View.extend({
  22165.     events: {
  22166.       'click [data-action=subscribe]': 'subscribe'
  22167.     },
  22168.     initialize: function (a) {
  22169.       this.thread = a.thread,
  22170.       this.session = a.session,
  22171.       this.listenTo(this.thread, 'change:userSubscription', this.updateStatus),
  22172.       this.updateStatus()
  22173.     },
  22174.     updateStatus: function () {
  22175.       this.thread.get('userSubscription') ? (this.$el.addClass('subscribed'), this.$el.find('#thread-subscribe-text-default').addClass('hidden'), this.$el.find('#thread-subscribe-text-subscribed').removeClass('hidden')) : (this.$el.removeClass('subscribed'), this.$el.find('#thread-subscribe-text-default').removeClass('hidden'), this.$el.find('#thread-subscribe-text-subscribed').addClass('hidden'))
  22176.     },
  22177.     subscribe: Aa(function () {
  22178.       var a = this.thread.get('userSubscription');
  22179.       this.session.isLoggedOut() ? this.subscribeAfterAuthentication() : this.thread.subscribe(!a)
  22180.     }),
  22181.     subscribeAfterAuthentication: function () {
  22182.       this.listenToOnce(this.session, 'fetchThreadDetails:success', function () {
  22183.         this.session.isLoggedIn() && this.thread.subscribe()
  22184.       }),
  22185.       this.session.get('sso') && this.session.get('sso').url ? this.session.authenticate('sso') : this.session.authenticate('disqusDotcom')
  22186.     }
  22187.   }),
  22188.   Da = c.View.extend({
  22189.     topEdgeOffset: function () {
  22190.       return - U.getLounge().getPosition().height
  22191.     },
  22192.     initialize: function (a) {
  22193.       this.options = a,
  22194.       this.hasLoaded = null,
  22195.       this.listenToOnce(f(this), 'enter', this.loadImage)
  22196.     },
  22197.     loadImage: function () {
  22198.       var a = this;
  22199.       if (!a.hasLoaded) {
  22200.         var b = function (b) {
  22201.           return function () {
  22202.             a.trigger(b),
  22203.             a.$el.off('.deferredMediaView'),
  22204.             a.relatedPost && U.getLounge().postsView.onDeferredViewReady(a.relatedPost)
  22205.           }
  22206.         };
  22207.         a.$el.on('load.deferredMediaView', b('load')),
  22208.         a.$el.on('error.deferredMediaView', b('error')),
  22209.         a.$el.attr('src', a.options.url),
  22210.         a.hasLoaded = !0
  22211.       }
  22212.     }
  22213.   }),
  22214.   Ea = c.View.extend({
  22215.     tagName: 'ul',
  22216.     className: 'debug',
  22217.     initialize: function (a) {
  22218.       this.values = a
  22219.     },
  22220.     render: function () {
  22221.       return this.$el.html(b.reduce(this.values, function (a, b, c) {
  22222.         return a + '<li><strong>' + c + '</strong>: ' + b + '</li>'
  22223.       }, '')),
  22224.       this
  22225.     }
  22226.   }),
  22227.   Fa = c.View.extend({
  22228.     initialize: function (a) {
  22229.       this.forum = a.forum,
  22230.       this.session = a.session,
  22231.       this.thread = a.thread,
  22232.       this.isInHome = a.isInHome,
  22233.       this.listenTo(this.session, 'change:id', this.render),
  22234.       this.listenTo(this.thread, 'change', this.render),
  22235.       this.listenTo(aa.settings, 'change:collapsed', this.onMediaCollapseChange),
  22236.       this.listenToReactions()
  22237.     },
  22238.     listenToReactions: function () {
  22239.       this.thread.get('reactions') ? this.listenTo(this.thread.get('reactions'), 'sync change:enabled', this.render) : this.listenToOnce(this.thread, 'change:reactions', this.listenToReactions)
  22240.     },
  22241.     render: function () {
  22242.       return i.render(h.createElement(pa, {
  22243.         user: this.session.toJSON(),
  22244.         forum: this.forum.toJSON(),
  22245.         thread: this.thread.toJSON(),
  22246.         sso: this.session.get('sso'),
  22247.         isInHome: this.isInHome
  22248.       }), this.el),
  22249.       this.onMediaCollapseChange(),
  22250.       this
  22251.     },
  22252.     onMediaCollapseChange: function () {
  22253.       aa.settings.get('collapsed') ? this.$el.addClass('media-collapsed') : this.$el.removeClass('media-collapsed')
  22254.     }
  22255.   }),
  22256.   Ga = c.View.extend({
  22257.     events: {
  22258.       'click [data-action=share\\:twitter]': '_onShare',
  22259.       'keyup [data-action=share\\:twitter]': '_onShare',
  22260.       'click [data-action=share\\:facebook]': '_onShare',
  22261.       'keyup [data-action=share\\:facebook]': '_onShare',
  22262.       'click [data-action=share\\:email]': '_onShare',
  22263.       'keyup [data-action=share\\:email]': '_onShare',
  22264.       'click [data-action=copy-link]': '_onCopyLink',
  22265.       'keyup [data-action=copy-link]': '_onCopyLink'
  22266.     },
  22267.     _onCopyLink: Aa(function () {
  22268.       F.copyToClipboard(this.model.shortLink())
  22269.     }),
  22270.     _onShare: Aa(function (a) {
  22271.       var b = 13;
  22272.       if (!a.keyCode || a.keyCode === b) {
  22273.         var c = x.extractService(a.target, 'share');
  22274.         c && this.sharers[c] && (U.getLounge().trigger('uiAction:threadShare', c), this.share(c))
  22275.       }
  22276.     }),
  22277.     render: function () {
  22278.       return i.render(h.createElement(qa, {
  22279.         forum: this.model.forum.id
  22280.       }), this.el),
  22281.       this
  22282.     }
  22283.   });
  22284.   b.extend(Ga.prototype, W.ShareMixin);
  22285.   var Ha = c.View.extend({
  22286.     events: {
  22287.       'change input[name=tos], input[name=privacy-policy]': 'updateEnabled'
  22288.     },
  22289.     initialize: function (a) {
  22290.       this.isPrivate = a.isPrivate,
  22291.       this.session = a.session
  22292.     },
  22293.     updateEnabled: function () {
  22294.       this.$('#accept_tos').prop('disabled', !!this.isPrivate && !this.areTosAccepted())
  22295.     },
  22296.     areTosAccepted: function () {
  22297.       return this.$('input[name=tos]').prop('checked') && this.$('input[name=privacy-policy]').prop('checked')
  22298.     },
  22299.     onAccept: function () {
  22300.       if (!this.isPrivate || this.areTosAccepted()) {
  22301.         var a = this.$('input[name=data-sharing]');
  22302.         a.length && l.call('internal/users/setDNT', {
  22303.           method: 'POST',
  22304.           data: {
  22305.             value: a.prop('checked') ? 0 : 1
  22306.           }
  22307.         }),
  22308.         l.call('users/acceptTerms', {
  22309.           method: 'POST'
  22310.         }),
  22311.         this.close()
  22312.       }
  22313.     },
  22314.     close: function () {
  22315.       this.remove()
  22316.     },
  22317.     render: function () {
  22318.       return i.render(h.createElement(ua, {
  22319.         onAccept: this.onAccept.bind(this),
  22320.         isPrivate: this.isPrivate
  22321.       }), this.el),
  22322.       this.updateEnabled(),
  22323.       this
  22324.     }
  22325.   }),
  22326.   Ia = c.View.extend({
  22327.     initialize: function (a) {
  22328.       this.thread = a.thread,
  22329.       this.postCount = a.thread.get('posts') || 0,
  22330.       this.settings = a.settings
  22331.     },
  22332.     render: function () {
  22333.       return i.render(h.createElement(R, {
  22334.         postCount: this.postCount,
  22335.         titleEnabled: this.settings.title_enabled,
  22336.         titleText: this.settings.title_text,
  22337.         titleCSS: this.settings.title_css,
  22338.         buttonText: this.settings.button_text,
  22339.         buttonCSS: this.settings.button_css
  22340.       }), this.el),
  22341.       this
  22342.     }
  22343.   }),
  22344.   Ja = c.View.extend({
  22345.     initialize: function (a) {
  22346.       this.thread = a.thread,
  22347.       this.forum = a.forum,
  22348.       this.inHome = a.inHome,
  22349.       this.hideFooter = a.hideFooter,
  22350.       this.posts = a.posts
  22351.     },
  22352.     render: function () {
  22353.       return i.render(h.createElement(S, {
  22354.         thread: this.thread.toJSON(),
  22355.         forum: this.forum.toJSON(),
  22356.         inHome: this.inHome,
  22357.         hideFooter: this.hideFooter,
  22358.         isPolicyAccepted: Boolean(K.get('isPolicyAccepted:' + this.forum.id)),
  22359.         posts: this.posts
  22360.       }), this.el),
  22361.       this
  22362.     }
  22363.   }),
  22364.   Ka = c.View.extend({
  22365.     events: {
  22366.       'click [data-action^=auth\\:]': 'handleAuth',
  22367.       'click [data-action=logout]': 'handleLogout',
  22368.       'click [data-action=audiencesync]': 'audienceSync',
  22369.       'click [data-action=profile]': 'handleShowProfile',
  22370.       'click [data-action=community-sidebar]': 'handleShowCommunitySidebar',
  22371.       'click [data-action=sort]': 'handleSort',
  22372.       'click [data-action=toggle-thread-premoderate]': 'toggleThreadPremoderate',
  22373.       'click [data-action=toggle-thread]': 'toggleThread',
  22374.       'click [data-action=toggle-thread-ratings]': 'toggleThreadRatingsEnabled',
  22375.       'click [data-action=toggle-thread-visibility]': 'toggleBehindClick',
  22376.       'click [data-action=debug]': 'renderDebugInfo',
  22377.       'click [data-action=repair]': 'repairThread',
  22378.       'click [data-action=toggle-media]': 'toggleMedia',
  22379.       'click [data-action=toggle-reactions]': 'toggleReactions',
  22380.       'click a': 'handleLinkClick',
  22381.       'click [data-action=accept-comment-policy]': 'setPolicyAccepted',
  22382.       'click [data-action=toggle-embed-refresh]': 'toggleEmbedRefresh'
  22383.     },
  22384.     initialize: function (c) {
  22385.       U.setLounge(this),
  22386.       c = c || {
  22387.       };
  22388.       var d = c.jsonData || {
  22389.       };
  22390.       this.language = ya.documentElement.lang,
  22391.       this.initialData = d.response || {
  22392.       },
  22393.       this.cleanInitialData(this.initialData),
  22394.       this.onboardWindowName = x.globalUniqueId('disqus_'),
  22395.       this.initialData.forum && this.initialData.forum.id && (A.moderate = x.updateURL(A.moderate, {
  22396.         hostname: this.initialData.forum.id + '.'
  22397.       })),
  22398.       this.deferredViews = [
  22399.       ],
  22400.       this.unsortedDeferredViews = [
  22401.       ],
  22402.       this.inthreadAdApps = [
  22403.       ],
  22404.       this.adPromise = a.Deferred().resolve(),
  22405.       D.setDefaults(this.initialData.session),
  22406.       this.session = D.get(),
  22407.       this.forum = new v.Forum,
  22408.       this.forum.set(this.initialData.forum),
  22409.       this.thread = new v.Thread(this.initialData.thread, {
  22410.         forum: this.forum,
  22411.         postCursor: d.cursor,
  22412.         moderators: (this.initialData.thread || {
  22413.         }).moderators,
  22414.         order: d.order
  22415.       }),
  22416.       this.initUserSuggestionsManager();
  22417.       this.postsView = new _.PostCollectionView({
  22418.         posts: this.thread.posts,
  22419.         thread: this.thread,
  22420.         lounge: this,
  22421.         session: this.session,
  22422.         el: this.el,
  22423.         userSuggestions: this.userSuggestions
  22424.       }),
  22425.       this.states = {
  22426.         fullyVisible: !1,
  22427.         realtimeIndicatorsCreated: !1,
  22428.         streamingPaused: !1,
  22429.         inViewport: !1,
  22430.         behindClick: !1
  22431.       },
  22432.       this.meta = {
  22433.         topics: null
  22434.       },
  22435.       xa.timings.loungeStart = Number(new Date);
  22436.       var e = b.bind(this.bootstrap, this);
  22437.       G(window) ? (this.listenTo(y.frame, 'init', e), this.initThreadView()) : b.defer(e),
  22438.       this.setAlertSelector('#layout'),
  22439.       this.initResizeHandler(),
  22440.       this.initAlertListeners(),
  22441.       this.initTopics()
  22442.     },
  22443.     setPolicyAccepted: function () {
  22444.       K.set('isPolicyAccepted:' + this.forum.id, !0),
  22445.       this.$el.find('#comment-policy').addClass('hidden')
  22446.     },
  22447.     cleanInitialData: function (a) {
  22448.       var c = a.thread && a.thread.highlightedPost;
  22449.       c && (c.isHighlighted = !0),
  22450.       b.each(a.posts, function (a) {
  22451.         c ? a.isHighlighted = a.id === c.id : a.isHighlighted = !1
  22452.       })
  22453.     },
  22454.     initAlertListeners: function () {
  22455.       this.listenTo(this.session, 'alert', this.alert)
  22456.     },
  22457.     initOnboardAlert: function () {
  22458.       var a = this.onboardAlert = new ba.OnboardAlert({
  22459.         session: this.session,
  22460.         forum: this.forum
  22461.       });
  22462.       this.proxyViewEvents(this.onboardAlert),
  22463.       this.listenTo(this.session, 'change:id', function () {
  22464.         a.setInitialCookie(),
  22465.         a.render().$el.appendTo('#onboard')
  22466.       })
  22467.     },
  22468.     bootstrap: function (a) {
  22469.       var c,
  22470.       d = this,
  22471.       e = {
  22472.       };
  22473.       d.config = a = a || x.getConfigFromHash(window),
  22474.       a.forceSwitch && M.forceFeature(a.forceSwitch),
  22475.       a.loaderVersion = xa.version,
  22476.       d.states.fullyVisible = a.startedFullyVisible,
  22477.       k.init({
  22478.         isPrivate: a.isPrivate
  22479.       });
  22480.       var f = a.experiment;
  22481.       if (f) {
  22482.         if (f.experiment && f.variant) {
  22483.           var g = f,
  22484.           h = g.experiment,
  22485.           i = g.variant;
  22486.           h = h.replace(/_hidden$/, ''),
  22487.           M.forceFeature(['experiment',
  22488.           h,
  22489.           i].join(':'))
  22490.         }
  22491.       } else a.experiment = f = {
  22492.       };
  22493.       a.apiKey && (e['X-Disqus-Publisher-API-Key'] = a.apiKey),
  22494.       b.isObject(a.remoteAuthS3) && b.isEmpty(a.remoteAuthS3) ? a.remoteAuthS3 = null : e['X-Disqus-Remote-Auth'] = a.remoteAuthS3,
  22495.       b.isEmpty(e) || l.headers(e),
  22496.       a.anchorColor && (c = H(a.anchorColor), x.setPublisherColor(c), x.addStylesheetRules([['.publisher-anchor-color a',
  22497.       [
  22498.         'color',
  22499.         c,
  22500.         !0
  22501.       ]],
  22502.       [
  22503.         'a.publisher-anchor-color',
  22504.         [
  22505.           'color',
  22506.           c,
  22507.           !0
  22508.         ]
  22509.       ],
  22510.       [
  22511.         '.publisher-anchor-hover a:hover',
  22512.         [
  22513.           'color',
  22514.           c,
  22515.           !0
  22516.         ]
  22517.       ],
  22518.       [
  22519.         'a.publisher-anchor-hover:hover',
  22520.         [
  22521.           'color',
  22522.           c,
  22523.           !0
  22524.         ]
  22525.       ],
  22526.       [
  22527.         '.active .publisher-nav-color:after',
  22528.         [
  22529.           'background',
  22530.           c,
  22531.           !0
  22532.         ]
  22533.       ],
  22534.       [
  22535.         '.media-preview .active.publisher-border-color',
  22536.         [
  22537.           'border-color',
  22538.           c,
  22539.           !0
  22540.         ]
  22541.       ],
  22542.       [
  22543.         '.publisher-color',
  22544.         [
  22545.           'color',
  22546.           c,
  22547.           !1
  22548.         ]
  22549.       ],
  22550.       [
  22551.         '.publisher-color:hover',
  22552.         [
  22553.           'color',
  22554.           c,
  22555.           !1
  22556.         ]
  22557.       ],
  22558.       [
  22559.         '.publisher-background-color',
  22560.         [
  22561.           'background-color',
  22562.           c,
  22563.           !1
  22564.         ]
  22565.       ],
  22566.       [
  22567.         '.publisher-border-color',
  22568.         [
  22569.           'border-color',
  22570.           c,
  22571.           !1
  22572.         ]
  22573.       ],
  22574.       [
  22575.         '.publisher-color-refresh',
  22576.         [
  22577.           'color',
  22578.           c,
  22579.           !0
  22580.         ]
  22581.       ],
  22582.       [
  22583.         '.publisher-color-refresh:hover',
  22584.         [
  22585.           'color',
  22586.           c,
  22587.           !0
  22588.         ]
  22589.       ],
  22590.       [
  22591.         '.publisher-background-color-refresh',
  22592.         [
  22593.           'background-color',
  22594.           c,
  22595.           !0
  22596.         ]
  22597.       ],
  22598.       [
  22599.         '.publisher-background-color-hover-refresh:hover',
  22600.         [
  22601.           'background-color',
  22602.           c,
  22603.           !0
  22604.         ]
  22605.       ],
  22606.       [
  22607.         '.publisher-border-color-refresh',
  22608.         [
  22609.           'border-color',
  22610.           c,
  22611.           !0
  22612.         ]
  22613.       ]])),
  22614.       a.impressionId && k.impression.setImpressionId(a.impressionId),
  22615.       x.injectBaseElement(),
  22616.       a.referrer && (d.thread.currentUrl = a.referrer),
  22617.       this.config.inthreadLeadingCommentCount && (this.config.inthreadLeadingCommentCount = Number(this.config.inthreadLeadingCommentCount), this.config.inthreadRepeatCommentCount = Number(this.config.inthreadRepeatCommentCount), this.config.inthreadTrailingCommentCount = Number(this.config.inthreadTrailingCommentCount));
  22618.       var j = this.getPermalinkOptions(a.parentWindowHash);
  22619.       j && y.frame.once('embed.rendered', b.bind(d.scrollToPost, d, j.postId, j.options)),
  22620.       a.sso && d.session.set('sso', a.sso),
  22621.       M.isFeatureActive('embed_v2', {
  22622.         forum: this.forum.id
  22623.       }) && (window.embedv2 = window.embedv2 || {
  22624.       }, window.embedv2.embedConfig = a, window.embedv2.TLDS = t.TLDS),
  22625.       a.initialPosition ? d.position = a.initialPosition : d.position = x.calculatePositionFullscreen(),
  22626.       d.initPrivacySettings(),
  22627.       d.initLinkAffiliation(),
  22628.       d.initLiveRamp(),
  22629.       d.updateModeratorBadgeText(),
  22630.       d.bindBusListeners();
  22631.       var m = xa.timings;
  22632.       m.hostStart = a.timestamp || m.initStart,
  22633.       m.embedLoadTime = a.loadTime,
  22634.       this.once('threadView:prep', function () {
  22635.         d.listenToOnce(d.postsView, 'render:start', function () {
  22636.           m.renderStart = Number(new Date)
  22637.         }),
  22638.         d.listenToOnce(d.postsView, 'render:end', d.sendTelemetry),
  22639.         m.bootstrapStart = Number(new Date),
  22640.         d.postsView.bootstrap(d.initialData, j),
  22641.         d.initAfterPostCreateHandler(),
  22642.         d.initSession()
  22643.       }),
  22644.       d.initUI(),
  22645.       d.initLinkHandler(),
  22646.       d.initialized = !0,
  22647.       d.trigger('bootstrap:complete', d)
  22648.     },
  22649.     _isInHome: function (a, b) {
  22650.       var c = /^(?:https?:)?\/\/(?:www.)?/;
  22651.       return a = a.replace(c, ''),
  22652.       b = b.replace(c, ''),
  22653.       0 === a.indexOf(b)
  22654.     },
  22655.     isInHome: function () {
  22656.       return !(!this.config || !this.config.referrer) && this._isInHome(this.config.referrer, T.apps.home + 'home/')
  22657.     },
  22658.     isOnChannel: function () {
  22659.       return !(!this.forum || !this.forum.id) && 0 === this.forum.id.indexOf('channel-')
  22660.     },
  22661.     initSession: function () {
  22662.       var a = this.config,
  22663.       b = this.session,
  22664.       c = this.thread;
  22665.       b.start({
  22666.         remoteAuthS3: a.remoteAuthS3,
  22667.         sso: a.sso,
  22668.         apiKey: a.apiKey,
  22669.         thread: c
  22670.       })
  22671.     },
  22672.     initPrivacySettings: function () {
  22673.       this.listenToOnce(this.session, 'change:id', function (a) {
  22674.         oa.isPrivate(a) && m.set({
  22675.           collapsed: {
  22676.             value: !0,
  22677.             persist: !1
  22678.           }
  22679.         })
  22680.       })
  22681.     },
  22682.     initLiveRamp: function () {
  22683.       var a = this.forum.get('settings') || {
  22684.       };
  22685.       a.userIdentityDisabled || this.listenTo(this.session, 'change:id', function (a) {
  22686.         var b = a.get('email');
  22687.         b && y.frame.sendHostMessage('liveramp:init', {
  22688.           email: a.get('email'),
  22689.           launchpad: A.liveRampAtsV2
  22690.         })
  22691.       })
  22692.     },
  22693.     initLinkAffiliation: function () {
  22694.       var a = N.getVersion();
  22695.       if (M.isFeatureActive('viglink_experiment', {
  22696.         forum: this.forum.id,
  22697.         forumPercent: this.forum.id
  22698.       }) && (a = N.getExperimentVersion()), this.isLinkAffiliatorEnabled() && !this.initLinkAffiliatorCalled && 'none' !== a) {
  22699.         this.initLinkAffiliatorCalled = !0;
  22700.         var b = A.linkAffiliatorClientV4;
  22701.         oa.shouldTrack(this.forum, this.session.user) && 'v5' === a && (b = A.linkAffiliatorClientV5),
  22702.         y.frame.sendHostMessage('viglink:init', {
  22703.           clientUrl: b,
  22704.           apiUrl: A.linkAffiliatorAPI,
  22705.           key: E.viglinkAPI,
  22706.           id: this.forum.get('pk')
  22707.         })
  22708.       }
  22709.     },
  22710.     initAfterPostCreateHandler: function () {
  22711.       this.listenTo(this.thread, 'create', function (a) {
  22712.         var c = a.toJSON();
  22713.         y.frame.sendHostMessage('posts.create', c),
  22714.         Ba.broadcast('posts.create', b.pick(c, 'forum', 'parent', 'id'))
  22715.       })
  22716.     },
  22717.     sendTelemetry: function () {
  22718.       if (x.shouldSample(u.lounge.telemetry_sample_percent)) {
  22719.         var c = a.now(),
  22720.         d = xa.timings,
  22721.         e = {
  22722.           embed: d.embedLoadTime,
  22723.           frame: d.initStart - d.hostStart,
  22724.           asset: d.downloadEnd - d.initStart,
  22725.           render: c - d.renderStart,
  22726.           total: c - d.hostStart - (d.renderStart - d.bootstrapStart)
  22727.         },
  22728.         f = window.performance;
  22729.         if (f) {
  22730.           var g = f.timing;
  22731.           g.responseStart && (e.frame_rtt = g.responseStart - g.navigationStart);
  22732.           var h = b.find(f.getEntries && f.getEntries() || [
  22733.           ], function (a) {
  22734.             return a.name.indexOf('/next/config.js') > - 1
  22735.           });
  22736.           h && h.responseStart && (e.config_rtt = h.responseStart - h.startTime)
  22737.         }
  22738.         var i = 'lounge_' + ('static' === this.config.experiment.service ? 'static' : 'dynamic');
  22739.         return B.telemetry(i, e)
  22740.       }
  22741.     },
  22742.     initUI: function () {
  22743.       this.applyPublisherClasses(),
  22744.       this.renderLayout(),
  22745.       this.setAlertSelector('#global-alert'),
  22746.       this.bindUIUpdateHandlers(),
  22747.       this.initDeferredViews(),
  22748.       this.postsView.once('render:end', function () {
  22749.         var a = x.getPageHeight();
  22750.         y.frame.sendHostMessage('rendered', {
  22751.           height: a
  22752.         }),
  22753.         this._lastHeight = a,
  22754.         this.initRealtime()
  22755.       }, this),
  22756.       this.once('threadView:prep', this.initUIComponents),
  22757.       this.initThreadView()
  22758.     },
  22759.     initUIComponents: function () {
  22760.       this.initMainPostBox(),
  22761.       this.initTermsOfService(),
  22762.       this.initReactions(),
  22763.       this.initStarRatings(),
  22764.       this.initThreadFooter(),
  22765.       this.initSecondaryNavigation(),
  22766.       this.isInHome() || (this.initTopNavigation(), this.initUserMenu(), this.initOnboardAlert(), this.initNotificationMenu(), this.initFavoriteButton(), this.initThreadShareBar()),
  22767.       M.isFeatureActive('embed_refresh_v2', {
  22768.         forum: this.forum.id
  22769.       }) || this.initBadgesMessage(),
  22770.       this.initHighlightedPost(),
  22771.       this.initEmailSignup(),
  22772.       this.initThreadSubscribe(),
  22773.       this.bindProfileUIListeners(this.session),
  22774.       this.updatePostCount(),
  22775.       this.trigger('threadView:render')
  22776.     },
  22777.     initHighlightedPost: function () {
  22778.       var a = this.thread.get('highlightedPost');
  22779.       a && !M.isFeatureActive('embed_refresh', {
  22780.         forum: this.forum.id
  22781.       }) && this.thread.posts.add(a),
  22782.       this.highlightedPostView = new da.HighlightedPostView({
  22783.         el: this.threadView.$el.find('#highlighted-post'),
  22784.         thread: this.thread,
  22785.         session: this.session,
  22786.         userSuggestions: this.userSuggestions,
  22787.         config: this.config
  22788.       }),
  22789.       this.highlightedPostView.reset()
  22790.     },
  22791.     initReactions: function () {
  22792.       if (this.forum.get('settings')) {
  22793.         if (!this.forum.get('settings').threadReactionsEnabled && !this.forum.channel) return void this.initReactionsPromotion();
  22794.         var a = new w.ReactionsCollection([], {
  22795.           thread: this.thread,
  22796.           userIsAnonymous: this.session.user.isAnonymous()
  22797.         });
  22798.         this.listenTo(a, 'sync', function () {
  22799.           a.length ? this.showReactions(a) : this.removeReactions()
  22800.         }),
  22801.         this.listenTo(a, 'change:enabled', function () {
  22802.           a.enabled ? this.showReactions(a) : this.removeReactions()
  22803.         }),
  22804.         this.thread.set('reactions', a),
  22805.         a.fetch()
  22806.       }
  22807.     },
  22808.     showReactions: function (a) {
  22809.       if (!this.reactionsView) {
  22810.         var b = this.reactionsView = new ia({
  22811.           reactions: a,
  22812.           readonly: this.thread.get('isClosed'),
  22813.           session: this.session,
  22814.           forum: this.thread.forum.id
  22815.         });
  22816.         b.render(),
  22817.         this.threadView.$el.find('#reactions__container').prepend(b.$el)
  22818.       }
  22819.     },
  22820.     removeReactions: function () {
  22821.       this.reactionsView && (this.reactionsView.remove(), this.reactionsView = null)
  22822.     },
  22823.     initReactionsPromotion: function () {
  22824.       if (!this.thread.isModerator(this.session.user)) return void this.listenToOnce(this.session, 'change:id', this.initReactionsPromotion);
  22825.       var b = 'reactionsEmbedPromotion',
  22826.       c = this;
  22827.       l.call('announcements/messages/checkViewed', {
  22828.         data: {
  22829.           message: b
  22830.         }
  22831.       }).success(function (d) {
  22832.         var e = d.response;
  22833.         if (!e[b]) {
  22834.           var f = c.reactionsPromotionView = new ja({
  22835.             forum: c.forum
  22836.           });
  22837.           f.render(),
  22838.           a('#reactions__container').prepend(f.$el)
  22839.         }
  22840.       })
  22841.     },
  22842.     initStarRatings: function () {
  22843.       this.forum.get('features') ? I.isForumModelRatingsEnabled(this.forum) && (this.thread.get('ratingsEnabled') && this.thread.fetchRatings(), this.listenTo(this.thread, 'change', this.showRatings), this.showRatings()) : this.listenToOnce(this.thread.forum, 'change:features', this.initStarRatings)
  22844.     },
  22845.     showRatings: function () {
  22846.       var a = M.isFeatureActive('star_ratings_total_hidden', {
  22847.         forum: this.forum.id
  22848.       });
  22849.       if (!this.ratingsView && this.thread && this.session && !a) {
  22850.         var b = this.ratingsView = new ha({
  22851.           thread: this.thread,
  22852.           session: this.session
  22853.         });
  22854.         b.render(),
  22855.         this.threadView.$el.find('#ratings__container').html(b.$el)
  22856.       }
  22857.     },
  22858.     bindUIUpdateHandlers: function () {
  22859.       var a = this,
  22860.       b = a.thread,
  22861.       c = a.session;
  22862.       a.listenTo(b, {
  22863.         'change:posts': a.updatePostCount
  22864.       }),
  22865.       a.listenTo(b.queue, 'add reset', a.toggleRealtimeNotifications),
  22866.       a.postsView.bindUIUpdateHandlers(),
  22867.       a.listenTo(c, 'change:id', a.updateThreadSessionData),
  22868.       a.listenTo(a, 'scrollOffViewport', function () {
  22869.         this.states.realtimeIndicatorsCreated && y.frame.sendHostMessage('indicator:hide')
  22870.       }),
  22871.       a.listenTo(a, 'scroll', function (a) {
  22872.         this.position = a
  22873.       }),
  22874.       a.listenTo(a, 'scroll', a.handleRealtimeScroll),
  22875.       a.listenTo(a.postsView, 'render:end', function () {
  22876.         a.toggleRealtimeNotifications(),
  22877.         a.config.inthreadPlacementUrl && a.loadInthreadAd()
  22878.       }),
  22879.       a.listenToOnce(a, 'threadView:render', function () {
  22880.         a.loadInEmbedAd()
  22881.       })
  22882.     },
  22883.     whenFullyVisible: function () {
  22884.       var b = a.Deferred();
  22885.       return this.states.fullyVisible ? b.resolve() : this.listenTo(this, 'frame.visible', function () {
  22886.         b.resolve()
  22887.       }),
  22888.       b.promise()
  22889.     },
  22890.     canShowInthreadAd: function (a, b) {
  22891.       if (!this.config.inthreadMultipleAds && a > 0) return !1;
  22892.       var c = this.config.inthreadLeadingCommentCount + this.config.inthreadRepeatCommentCount * a,
  22893.       d = c + this.config.inthreadTrailingCommentCount;
  22894.       return b >= d
  22895.     },
  22896.     inthreadAdInit: function (b, c) {
  22897.       var d = a.Deferred();
  22898.       return this.inthreadAdApps[b].init(),
  22899.       this.listenToOnce(this.inthreadAdApps[b], 'frame:ready', function () {
  22900.         c.css({
  22901.           height: 'auto',
  22902.           'margin-bottom': '24px'
  22903.         }),
  22904.         d.resolve()
  22905.       }),
  22906.       this.listenToOnce(this.inthreadAdApps[b], 'ad-placement-empty', function () {
  22907.         c.css({
  22908.           height: '',
  22909.           'margin-bottom': ''
  22910.         })
  22911.       }),
  22912.       d.promise()
  22913.     },
  22914.     loadInEmbedAd: function () {
  22915.       var c = this.config.topInEmbedPlacementUrl;
  22916.       if (c) {
  22917.         var d = a(sa());
  22918.         d.prependTo(this.postsView.$el);
  22919.         var e = j.Ads(b.extend({
  22920.           adUrl: c,
  22921.           placement: 'top_in_embed',
  22922.           container: d[0],
  22923.           isInHome: !1,
  22924.           isOnHostPage: !1,
  22925.           forumId: this.forum.get('pk'),
  22926.           version: this.config.version
  22927.         }, this.config));
  22928.         e.init()
  22929.       }
  22930.       var f = this.config.bottomInEmbedPlacementUrl;
  22931.       if (f) {
  22932.         var g = a(sa());
  22933.         g.appendTo(this.postsView.$el);
  22934.         var h = j.Ads(b.extend({
  22935.           adUrl: f,
  22936.           placement: 'bottom_in_embed',
  22937.           container: g[0],
  22938.           isInHome: !1,
  22939.           isOnHostPage: !1,
  22940.           forumId: this.forum.get('pk'),
  22941.           version: this.config.version
  22942.         }, this.config));
  22943.         h.init()
  22944.       }
  22945.     },
  22946.     loadInthreadAd: function () {
  22947.       var c = this.postsView.$el.find('#post-list');
  22948.       if (!(this.config.adBlockEnabled && !this.config.defaultPlacementUrl || c.hasClass('loading'))) {
  22949.         var d = this.config.inthreadCountChildren ? c.find('.post:not(.advertisement)') : c.children(':not(.advertisement)'),
  22950.         e = {
  22951.         };
  22952.         0 === this.config.experiment.experiment.indexOf('googlewidemargins') && 'fallthrough' !== this.config.experiment.variant && (e.margin = '0 ' + this.config.experiment.variant, e['min-width'] = 'calc(100% - ' + 2 * parseInt(this.config.experiment.variant, 10) + 'px)');
  22953.         var f;
  22954.         f = this.config.adBlockEnabled && this.config.defaultPlacementUrl ? J(this.config.defaultPlacementUrl, {
  22955.           position: 'inthread'
  22956.         }) : this.config.inthreadPlacementUrl;
  22957.         for (var g = this.inthreadAdApps.length; this.canShowInthreadAd(g, d.length); g++) {
  22958.           var h = this.config.inthreadLeadingCommentCount + this.config.inthreadRepeatCommentCount * g,
  22959.           i = a(ta());
  22960.           d && d.length && d[h] ? i.insertBefore(d[h]) : i.appendTo(a('#post-list')),
  22961.           this.inthreadAdApps[g] = j.Ads(b.extend({
  22962.             adUrl: f,
  22963.             placement: 'inthread',
  22964.             container: i.find('[data-role=post-content]') [0],
  22965.             isInHome: this.isInHome(),
  22966.             isOnHostPage: !1,
  22967.             forumId: this.forum.get('pk'),
  22968.             version: this.config.version,
  22969.             styles: e
  22970.           }, this.config));
  22971.           var k = this.inthreadAdInit.bind(this, g, i);
  22972.           0 === g ? this.adPromise = this.whenFullyVisible().then(k) : this.adPromise = this.adPromise.then(k)
  22973.         }
  22974.       }
  22975.     },
  22976.     relayScrollToStance: function (a) {
  22977.       f.scroll({
  22978.         top: a.pageOffset - a.frameOffset.top,
  22979.         height: a.height
  22980.       })
  22981.     },
  22982.     initDeferredViews: function () {
  22983.       this.listenTo(this, 'scroll', this.createDeferredViewsForImages),
  22984.       this.listenTo(this, 'domReflow', function () {
  22985.         f.invalidate(),
  22986.         this.position && (this.createDeferredViewsForImages(), this.relayScrollToStance(this.position))
  22987.       })
  22988.     },
  22989.     bindBusListeners: function () {
  22990.       this.listenTo(y.frame, {
  22991.         'window.hashchange': function (a) {
  22992.           var b = this.getPermalinkOptions(a);
  22993.           b && this.scrollToPost(b.postId, b.options)
  22994.         },
  22995.         'window.scroll': function (a) {
  22996.           this.trigger('scroll', a),
  22997.           this.relayScrollToStance(a)
  22998.         },
  22999.         'window.inViewport': function () {
  23000.           this.states.behindClick || (this.states.inViewport = !0, this.trigger('inViewport'))
  23001.         },
  23002.         'window.scrollOffViewport': function () {
  23003.           this.states.inViewport = !1,
  23004.           this.trigger('scrollOffViewport')
  23005.         },
  23006.         'frame.visible': function () {
  23007.           this.states.fullyVisible = !0,
  23008.           this.trigger('frame.visible')
  23009.         },
  23010.         error: function (a) {
  23011.           a = JSON.parse(a),
  23012.           e.captureException(a.error, {
  23013.             extra: {
  23014.               details: a.details
  23015.             },
  23016.             culprit: a.culprit
  23017.           })
  23018.         },
  23019.         'window.resize': this.resize,
  23020.         'indicator:click': this.handleRealtimeClick
  23021.       }),
  23022.       this.listenToOnce(this.session, 'change:id', this.initSidebar)
  23023.     },
  23024.     isLinkAffiliatorEnabled: function () {
  23025.       return this.forum.get('settings').linkAffiliationEnabled && !this.isInHome()
  23026.     },
  23027.     initLinkHandler: function () {
  23028.       this.outboundLinkHandler = new P,
  23029.       this.outboundLinkHandler.registerBeforeNavigationHandler(this.logLinkClick, this)
  23030.     },
  23031.     handleLinkClick: function (a) {
  23032.       this.outboundLinkHandler.handleClick(a)
  23033.     },
  23034.     initRealtimeIndicators: function () {
  23035.       var a = this;
  23036.       if (!a.states.realtimeIndicatorsCreated) {
  23037.         var c = [
  23038.           'north',
  23039.           'south'
  23040.         ].reduce(function (c, d) {
  23041.           return c[d] = {
  23042.             contents: '\n<!DOCTYPE html>\n<html lang="' + b.escape(a.language) + '">\n    <head>\n        <meta charset="utf-8">\n        <title>Disqus Realtime Notification</title>\n    </head>\n    <body>\n        <link rel="stylesheet" href="' + b.escape('https://c.disquscdn.com/next/embed/styles/realtime.b23ff3c36dd0169627f8e54ca1621eca.css') + '">\n        <div class="' + b.escape(d) + '" id="message">-</div>\n    </body>\n</html>\n'
  23043.           },
  23044.           c
  23045.         }, {
  23046.         });
  23047.         y.frame.sendHostMessage('indicator:init', c),
  23048.         a.states.realtimeIndicatorsCreated = !0
  23049.       }
  23050.     },
  23051.     insertStreamingComments: b.throttle(function () {
  23052.       var a = this.thread.queue;
  23053.       a.drain(),
  23054.       b.each(a.counters.replies, function (b, c) {
  23055.         a.drain(c)
  23056.       })
  23057.     }, 1000),
  23058.     updateModeratorBadgeText: function () {
  23059.       var a = this.forum.get('moderatorBadgeText');
  23060.       a && (z.translations.Mod = a)
  23061.     },
  23062.     logLinkClick: function (b) {
  23063.       var c = a(b.currentTarget);
  23064.       if (F.clickShouldBeLogged(b, c)) return B.client.emit({
  23065.         verb: 'click',
  23066.         object_type: 'link',
  23067.         object_id: c[0].href,
  23068.         area: oa.getEventTrackingArea(b)
  23069.       })
  23070.     },
  23071.     handleRealtimeScroll: function (a) {
  23072.       if (this.states.inViewport && this.states.realtimeIndicatorsCreated) {
  23073.         var c = b.union([this.queueView], b.values(this.postsView.subViews)),
  23074.         d = 0,
  23075.         e = 0;
  23076.         b.each(c, function (b) {
  23077.           if (b && !b.getDirection && (b = b.queueView), b && !(b.options.count <= 0)) {
  23078.             var c = b.getDirection(a);
  23079.             1 === c ? d += b.options.count : c === - 1 && (e += b.options.count)
  23080.           }
  23081.         });
  23082.         var f,
  23083.         g,
  23084.         h = function (a) {
  23085.           var c = a.orientation,
  23086.           d = a.num,
  23087.           e = void 0;
  23088.           return e = 'north' === c ? 1 === d ? za('One new comment above.') : z.interpolate(za('%(num)s new comments above.'), {
  23089.             num: d
  23090.           }) : 1 === d ? za('One new comment below.') : z.interpolate(za('%(num)s new comments below.'), {
  23091.             num: d
  23092.           }),
  23093.           '<p>' + b.escape(e) + '</p>'
  23094.         };
  23095.         g = {
  23096.           type: 'north'
  23097.         },
  23098.         d > 0 ? (f = 'indicator:show', g.content = h({
  23099.           num: d,
  23100.           orientation: 'north'
  23101.         })) : f = 'indicator:hide',
  23102.         y.frame.sendHostMessage(f, g),
  23103.         g = {
  23104.           type: 'south'
  23105.         },
  23106.         e > 0 ? (g.content = h({
  23107.           num: e,
  23108.           orientation: 'south'
  23109.         }), f = 'indicator:show') : f = 'indicator:hide',
  23110.         y.frame.sendHostMessage(f, g)
  23111.       }
  23112.     },
  23113.     handleRealtimeClick: function (a) {
  23114.       var c = this;
  23115.       y.frame.sendHostMessage('indicator:hide', {
  23116.         type: a
  23117.       });
  23118.       var d,
  23119.       e,
  23120.       f,
  23121.       g = b.union([c], b.toArray(c.postsView.subViews));
  23122.       g = b.filter(g, function (b) {
  23123.         if (b = b.queueView, !b || b.options.count <= 0) return !1;
  23124.         var d = 'north' === a ? 1 : - 1;
  23125.         return b.getDirection(c.position) === d
  23126.       }),
  23127.       g = b.sortBy(g, function (a) {
  23128.         return a === c ? 0 : a.offset.top
  23129.       }),
  23130.       d = 'north' === a ? b.last(g) : b.first(g),
  23131.       e = d.queueView,
  23132.       d === c ? (f = 0, e.handleDrain()) : (f = d.offset.top - 100, e.handleDrain()),
  23133.       U.getLounge().once('domReflow', b.bind(y.frame.sendHostMessage, y.frame, 'scrollTo', {
  23134.         top: f
  23135.       }))
  23136.     },
  23137.     toggleRealtimeNotifications: function () {
  23138.       var a = this,
  23139.       c = a.thread.queue;
  23140.       if (b.defer(function () {
  23141.         y.frame.sendHostMessage('fakeScroll')
  23142.       }), !c.length) return void a.$el.find('[data-role=realtime-notification]').hide();
  23143.       if (a.thread.get('hasStreaming')) return void a.insertStreamingComments();
  23144.       if (c.counters.comments) {
  23145.         var d = a.queueView || new ea.QueuedPostView({
  23146.           model: a.thread,
  23147.           el: a.$el.find('button[data-role=realtime-notification]')
  23148.         });
  23149.         a.queueView = d,
  23150.         d.setCount(c.counters.comments),
  23151.         d.render()
  23152.       }
  23153.       b.each(c.counters.replies, function (b, c) {
  23154.         var d = a.thread.posts.get(c);
  23155.         if (d) {
  23156.           var e = a.postsView.getPostView(d.cid);
  23157.           if (e) {
  23158.             var f = e.queueView;
  23159.             f || (f = new ea.QueuedReplyView({
  23160.               thread: a.thread,
  23161.               postView: e,
  23162.               model: d,
  23163.               el: e.$el.find('[data-role=realtime-notification\\:' + c + '] a')
  23164.             }), e.queueView = f),
  23165.             f.setCount(b),
  23166.             f.render()
  23167.           }
  23168.         }
  23169.       })
  23170.     },
  23171.     initBehindClick: function () {
  23172.       var c = this;
  23173.       if (!c.behindClickView && c.thread && a('#behindclick__container').length) {
  23174.         var d = {
  23175.           title_enabled: !1,
  23176.           title_text: null,
  23177.           title_css: null,
  23178.           button_text: null,
  23179.           button_css: null
  23180.         };
  23181.         l.call('forums/behindClick/details', {
  23182.           data: {
  23183.             forum: this.forum.id
  23184.           }
  23185.         }).success(function (a) {
  23186.           var e = a.response;
  23187.           c.showBehindClick(b.defaults({
  23188.           }, e, d))
  23189.         })
  23190.       }
  23191.     },
  23192.     showBehindClick: function (b) {
  23193.       var c = a('#behindclick__container'),
  23194.       d = new Ia({
  23195.         thread: this.thread,
  23196.         settings: b
  23197.       });
  23198.       d.render(),
  23199.       c.html(d.$el),
  23200.       y.frame.sendHostMessage('rendered', {
  23201.         height: x.getPageHeight()
  23202.       })
  23203.     },
  23204.     toggleBehindClick: function () {
  23205.       this.$('#behindclick__container').hide(),
  23206.       this.states.behindClick = !1,
  23207.       y.frame.trigger('window.inViewport'),
  23208.       y.trigger('uiAction:behindClickButton'),
  23209.       this.trigger('threadView:prep')
  23210.     },
  23211.     initThreadView: function () {
  23212.       this.createThreadView(),
  23213.       this.forum.get('settings').behindClickEnabled ? (this.initBehindClick(), this.states.behindClick = !0) : this.trigger('threadView:prep')
  23214.     },
  23215.     createThreadView: function () {
  23216.       if (!this.threadView && this.thread && this.session) {
  23217.         var a,
  23218.         b = this.isInHome();
  23219.         this.thread.posts.buffer && (a = this.thread.posts.getOrder());
  23220.         var c = this.threadView = new Ja({
  23221.           thread: this.thread,
  23222.           forum: this.forum,
  23223.           order: a,
  23224.           inHome: b,
  23225.           hideFooter: b,
  23226.           posts: this.initialData.posts
  23227.         });
  23228.         c.render(),
  23229.         this.trigger('threadView:init'),
  23230.         this.once('threadView:render', function () {
  23231.           this.$('#thread__container').html(this.threadView.$el)
  23232.         })
  23233.       }
  23234.     },
  23235.     renderDebugInfo: Aa(function () {
  23236.       if (this.session.user.get('isGlobalAdmin')) {
  23237.         var a = this.thread.forum.get('settings', {
  23238.         }),
  23239.         b = new Ea({
  23240.           Shortname: this.thread.get('forum'),
  23241.           'Thread ID': this.thread.get('id'),
  23242.           'Org ID': this.forum.get('organizationId'),
  23243.           'Thread slug': this.thread.get('slug'),
  23244.           'Anchor color': H(this.config.anchorColor),
  23245.           Language: this.thread.forum.get('language'),
  23246.           Recommendations: a.organicDiscoveryEnabled,
  23247.           'Ads enabled': a.adsEnabled,
  23248.           'Ads top enabled': a.adsPositionTopEnabled,
  23249.           'Ads bottom enabled': a.adsPositionBottomEnabled,
  23250.           'Ads in-thread enabled': a.adsPositionInthreadEnabled,
  23251.           'Ads recommendations enabled': a.adsPositionRecommendationsEnabled,
  23252.           'Ads Product Display enabled': a.adsProductDisplayEnabled,
  23253.           'Ads Product Links enabled': a.adsProductLinksEnabled,
  23254.           'Ads Product Video enabled': a.adsProductVideoEnabled,
  23255.           'In iframe': this.config.isHostIframed,
  23256.           'Behind click': this.config.isBehindClick,
  23257.           'Height restricted': this.config.isHeightRestricted
  23258.         });
  23259.         b.render();
  23260.         var c = ya.body;
  23261.         c.insertBefore(b.el, c.firstChild)
  23262.       }
  23263.     }),
  23264.     repairThread: Aa(function () {
  23265.       this.session.user.get('isGlobalAdmin') && l.call('internal/threads/repair.json', {
  23266.         method: 'GET',
  23267.         data: {
  23268.           thread: this.thread.get('id')
  23269.         },
  23270.         success: b.bind(this.alert, this, 'Thread repair has been queued. Refresh in a few seconds.'),
  23271.         error: b.bind(this.alert, this, 'An error occurred while repairing thread. Please try again.', {
  23272.           type: 'error'
  23273.         })
  23274.       })
  23275.     }),
  23276.     getPermalinkOptions: function (a) {
  23277.       var b = a && a.match(/(comment|reply|edit)-([0-9]+)/);
  23278.       if (b) return {
  23279.         postId: b[2],
  23280.         options: {
  23281.           highlight: !0,
  23282.           openReply: 'reply' === b[1],
  23283.           openEdit: 'edit' === b[1]
  23284.         }
  23285.       }
  23286.     },
  23287.     scrollToPost: function (a, c) {
  23288.       c = c || {
  23289.       },
  23290.       c.padding = c.padding || 90;
  23291.       var d = this,
  23292.       e = d.$el.find('#post-' + a);
  23293.       if (M.isFeatureActive('embed_refresh', {
  23294.         forum: this.forum.id
  23295.       }) && !e.length && d.highlightedPostView && d.highlightedPostView.post && d.highlightedPostView.post.id === a) e = d.highlightedPostView.$el.find('.post');
  23296.        else if (!e.length) return void v.Post.fetchContext(a, d.thread, {
  23297.         requestedByPermalink: !0
  23298.       }).done(function () {
  23299.         d.postsView.once('render:end', b.bind(d.scrollToPost, d, a, c)),
  23300.         y.frame.once('embed.resized', b.bind(d.scrollToPost, d, a, c))
  23301.       });
  23302.       c.highlight && (d.$el.find('.post-content.target').removeClass('target'), e.find('.post-content').first().addClass('target')),
  23303.       c.openReply && d.postsView.openReply(a),
  23304.       c.openEdit && d.postsView.openEdit(a),
  23305.       y.frame.sendHostMessage('scrollTo', {
  23306.         top: e.offset().top - c.padding,
  23307.         force: c.force || null
  23308.       })
  23309.     },
  23310.     updateThreadSessionData: function (a) {
  23311.       if (a) {
  23312.         a.get('thread') && this.thread.set(a.get('thread'));
  23313.         var c = a.get('votes');
  23314.         c && 'object' === ('undefined' == typeof c ? 'undefined' : _typeof(c)) && b.each(c, function (a, b) {
  23315.           var c = this.postsView.posts.get(b);
  23316.           c && c.set('userScore', a)
  23317.         }, this);
  23318.         var d = a.get('blockedUserIdSet');
  23319.         if (d && 0 !== d.size) {
  23320.           var e = this.postsView.posts.models;
  23321.           if (e && 'object' === ('undefined' == typeof e ? 'undefined' : _typeof(e))) {
  23322.             var f = {
  23323.             };
  23324.             b.each(e, function (a) {
  23325.               var b = a.attributes.id,
  23326.               c = a.author.id;
  23327.               if (f[b] = c, a.attributes.parent) {
  23328.                 var e = a.attributes.parent,
  23329.                 g = f[e];
  23330.                 d.has(g) && a.set('hideReplyPreview', !0)
  23331.               }
  23332.             }, this)
  23333.           }
  23334.         }
  23335.       }
  23336.     },
  23337.     initSidebar: function () {
  23338.       this.sidebar = new ga({
  23339.         session: this.session,
  23340.         forum: this.forum,
  23341.         config: this.config
  23342.       })
  23343.     },
  23344.     initNotificationMenu: function () {
  23345.       var a = this.notificationMenu = new ca.NotificationMenuView({
  23346.         el: this.threadView.$el.find('[data-role=notification-menu]') [0],
  23347.         session: this.session,
  23348.         forum: this.forum
  23349.       });
  23350.       a.render()
  23351.     },
  23352.     initUserMenu: function () {
  23353.       var a = this.userMenu = new Fa({
  23354.         el: this.threadView.$el.find('[data-role=logout]') [0],
  23355.         forum: this.forum,
  23356.         session: this.session,
  23357.         thread: this.thread,
  23358.         isInHome: this.isInHome()
  23359.       });
  23360.       a.render()
  23361.     },
  23362.     initThreadShareBar: function () {
  23363.       if (!this.thread.forum.get('settings').disableSocialShare) {
  23364.         var a = this.threadShareBar = new Ga({
  23365.           el: this.threadView.$el.find('#thread-share-bar') [0],
  23366.           model: this.thread
  23367.         });
  23368.         a.render()
  23369.       }
  23370.     },
  23371.     isRealtimeEnabled: function () {
  23372.       var a = u.lounge.REALTIME || {
  23373.       },
  23374.       b = a.THREAD_STALE_DAYS || 7,
  23375.       c = g.unix(this.initialData.lastModified);
  23376.       return !this.thread.get('isClosed') && g().diff(c, 'days') <= b
  23377.     },
  23378.     realtimeHandlers: {
  23379.       Post: function (a) {
  23380.         var b = a.data,
  23381.         c = this.thread;
  23382.         if (!this.thread.get('hasStreaming') || !this.states.streamingPaused) {
  23383.           if (!b.id) return void d.warn('RT: no post ID');
  23384.           if (!b.author || !b.author.id) return void d.warn('RT: no author or author ID');
  23385.           if (!b.author.name) return void d.warn('RT: no author name or email hash');
  23386.           if (!b.author.username) return void d.warn('RT: no author username');
  23387.           if (!b.post || !b.post.message) return void d.warn('RT: no post message');
  23388.           if (c.posts.get(b.id) || c.queue.get(b.id)) return void d.info('RT: duplicate: ', b.id);
  23389.           if ('approved' !== b.type) return void d.info('RT: unapproved: ', b.id);
  23390.           if (b.sb) return void d.info('RT: shadowbanned: ', b.id);
  23391.           if (b.type === b.type_prev) return void d.info('RT: Post change message, ignoring for now ', b.id);
  23392.           this.thread.incrementPostCount(1);
  23393.           var e = b.post.parent_post.id;
  23394.           if ('0' === e && (e = null), e && !c.posts.get(e) && !c.queue.get(e)) return void d.info('RT: parent is not on this page: ', b.id);
  23395.           var f = b.author.name,
  23396.           g = b.author.username,
  23397.           h = b.author.avatar,
  23398.           i = b.author.id,
  23399.           j = b.author.is_private;
  23400.           '0' === i && (i = void 0);
  23401.           var k = new n(v.User, {
  23402.             id: i,
  23403.             name: f,
  23404.             username: g,
  23405.             profileUrl: A.root + '/by/' + g + '/',
  23406.             isAnonymous: !i,
  23407.             isPrivate: j,
  23408.             avatar: {
  23409.               cache: h,
  23410.               permalink: h
  23411.             }
  23412.           });
  23413.           if (k.get('isBlocked')) return void d.info('RT: blocked: ', b.id);
  23414.           c.users.add(k, {
  23415.             merge: !0
  23416.           }),
  23417.           c.queue.add({
  23418.             id: b.id,
  23419.             user: k,
  23420.             parentId: e,
  23421.             message: b.post.message,
  23422.             createdAt: b.date,
  23423.             media: b.post.media
  23424.           })
  23425.         }
  23426.       },
  23427.       Vote: function (a) {
  23428.         var b = a.data;
  23429.         if (b.id && b.vote) {
  23430.           var c = this.thread,
  23431.           e = c.posts.get(b.vote.recipient_post_id);
  23432.           if (e) {
  23433.             d.debug('RT: Vote for post ', e.id);
  23434.             var f = e.votes.get(b.id);
  23435.             f || (d.debug('RT: Creating new vote with id ', b.id), f = new r({
  23436.               id: b.id
  23437.             }), e.votes.add(f));
  23438.             var g = e._vote(b.vote.vote, f.get('score'), b.voter);
  23439.             0 !== g && f.set('score', g)
  23440.           }
  23441.         }
  23442.       },
  23443.       ThreadVote: function (a) {
  23444.         var b = a.data,
  23445.         c = this.thread;
  23446.         if (b.id && b.vote && (!this.session.user.id || b.vote.voter_id !== this.session.user.id)) {
  23447.           var d = c.votes.get(b.id);
  23448.           if (d || (d = new q({
  23449.             id: b.id
  23450.           }), c.votes.add(d)), !d.get('currentUser')) {
  23451.             var e = c._vote(b.vote.vote, d.get('score'));
  23452.             0 !== e && d.set('score', e)
  23453.           }
  23454.         }
  23455.       },
  23456.       typing: function (a) {
  23457.         var c = a.data,
  23458.         d = this.thread,
  23459.         e = c.typing,
  23460.         f = c.post;
  23461.         if (c.thread === d.id && f) {
  23462.           var g = d.posts.get(f);
  23463.           g && (g.usersTyping.count() <= 0 && !e || g.usersTyping.add(v.TypingUser.make(b.extend({
  23464.             client_context: a.lastEventId
  23465.           }, c))))
  23466.         }
  23467.       }
  23468.     },
  23469.     initRealtime: function () {
  23470.       var a = X.Manager;
  23471.       if (!a.pipe && this.isRealtimeEnabled()) {
  23472.         this.initRealtimeIndicators(),
  23473.         a.initialize('thread/' + this.thread.id, this.realtimeHandlers, this);
  23474.         var b = function (a) {
  23475.           return 'POST' === a.method
  23476.         },
  23477.         c = 0;
  23478.         this.listenTo(l, 'call', function (d) {
  23479.           b(d) && (c += 1, a.pause())
  23480.         }),
  23481.         this.listenTo(l, 'complete', function (d) {
  23482.           !b(d) || c <= 0 || (c -= 1, c || a.resume())
  23483.         })
  23484.       }
  23485.     },
  23486.     initTopNavigation: function () {
  23487.       var a = this.topNavigation = new la({
  23488.         inHome: this.isInHome(),
  23489.         thread: this.thread
  23490.       });
  23491.       a.render(),
  23492.       this.threadView.$el.find('#main-nav').append(a.el)
  23493.     },
  23494.     initThreadFooter: function () {
  23495.       var a = this.threadFooter = new ma({
  23496.         forum: this.forum
  23497.       });
  23498.       a.render(),
  23499.       this.threadView.$el.find('#footer').append(a.el)
  23500.     },
  23501.     initSecondaryNavigation: function () {
  23502.       var a,
  23503.       b = this.forum.get('votingType') || s.VOTING_TYPES.DEFAULT_VOTING_TYPE,
  23504.       c = b === s.VOTING_TYPES.DISABLED;
  23505.       this.thread.posts.buffer && (a = this.thread.posts.getOrder());
  23506.       var d = this.secondaryNavigation = new na({
  23507.         inHome: this.isInHome(),
  23508.         order: a,
  23509.         votingDisabled: c,
  23510.         forum: this.thread.forum.id
  23511.       });
  23512.       d.render(),
  23513.       this.threadView.$el.find('#secondary-navigation').append(d.el)
  23514.     },
  23515.     initFavoriteButton: function () {
  23516.       if (this.favoriteButton && this.favoriteButton.remove(), !M.isFeatureActive('sso_less_branding', {
  23517.         forum: this.forum.id
  23518.       })) {
  23519.         var a = this.favoriteButton = new ka({
  23520.           thread: this.thread,
  23521.           session: this.session
  23522.         });
  23523.         this.listenTo(a, {
  23524.           'vote:like': b.bind(this.trigger, this, 'uiAction:threadLike'),
  23525.           'vote:unlike': b.bind(this.trigger, this, 'uiAction:threadUnlike')
  23526.         }),
  23527.         a.render(),
  23528.         this.threadView.$el.find('#favorite-button').append(a.el)
  23529.       }
  23530.     },
  23531.     initThreadSubscribe: function () {
  23532.       this.threadSubscribeButton = new Ca({
  23533.         session: this.session,
  23534.         thread: this.thread,
  23535.         el: this.threadView.$el.find('#thread-subscribe-button') [0]
  23536.       })
  23537.     },
  23538.     initBadgesMessage: function () {
  23539.       this.badgesMessageView = new Y({
  23540.         forum: this.forum,
  23541.         session: this.session,
  23542.         el: this.threadView.$el.find('#badges-message__container') [0]
  23543.       }).render()
  23544.     },
  23545.     initEmailSignup: function () {
  23546.       this.emailSignupForm = new Z({
  23547.         forum: this.forum,
  23548.         session: this.session,
  23549.         el: this.threadView.$el.find('#email-signup') [0]
  23550.       }).render()
  23551.     },
  23552.     updatePostCount: function () {
  23553.       var a = this.thread.get('posts');
  23554.       this.isInHome() || (this.$postCountContainer = this.$postCountContainer || this.threadView.$el.find('li[data-role=post-count]'), this.$postCountContainer.html(va({
  23555.         count: a
  23556.       }))),
  23557.       y.frame.sendHostMessage('posts.count', a)
  23558.     },
  23559.     renderLayout: function () {
  23560.       this.addFeatureDetectionClasses(),
  23561.       V.init(this);
  23562.       var b = a(ra({
  23563.         forum: this.forum.toJSON(),
  23564.         thread: this.thread.toJSON()
  23565.       }));
  23566.       b.appendTo(this.$el),
  23567.       this.postsView.renderLayout(),
  23568.       u.readonly ? this.alert(za('The Disqus comment system is temporarily in maintenance mode. You can still read comments during this time, however posting comments and other actions are temporarily delayed.'), {
  23569.         type: 'info'
  23570.       }) : this.listenToOnce(this.session, 'change:id', this.showPremoderationAlert)
  23571.     },
  23572.     showPremoderationAlert: function () {
  23573.       this.thread.isModerator(this.session.user) && !this.getAlert() && (this.forum.get('settings').validateAllPosts ? this.alert(b.escape(za('Comments on this entire site are premoderated (only moderators can see this message).')) + (' <a href="' + b.escape('https://' + this.forum.id + '.disqus.com/admin/settings/community/') + '" target="_blank" rel="noopener noreferrer">' + b.escape(za('Change site settings.')) + '</a>'), {
  23574.         safe: !0,
  23575.         isPremoderateStatus: !0
  23576.       }) : this.thread.get('validateAllPosts') && this.alert(za('Comments on this thread are premoderated (only moderators can see this message).'), {
  23577.         isPremoderateStatus: !0
  23578.       }))
  23579.     },
  23580.     dismissPremoderationAlert: function () {
  23581.       this.dismissAlert(function (a) {
  23582.         return a.options && a.options.isPremoderateStatus
  23583.       })
  23584.     },
  23585.     addFeatureDetectionClasses: function () {
  23586.       var b = a(ya.documentElement);
  23587.       (this.config.forceMobile || F.isMobileUserAgent()) && b.addClass('mobile'),
  23588.       F.isMobileUserAgent() || b.addClass('use-opacity-transitions'),
  23589.       M.isFeatureActive('embed_refresh', {
  23590.         forum: this.forum.id
  23591.       }) && (b.addClass('embed-refresh'), M.isFeatureActive('embed_refresh_v2', {
  23592.         forum: this.forum.id
  23593.       }) && b.addClass('embed-refresh-v2'))
  23594.     },
  23595.     initMainPostBox: function () {
  23596.       if (this.form && (this.form.remove(), this.form = null), this.thread.get('isClosed')) return this.threadView.$el.find('#secondary-navigation').addClass('no-postbox'),
  23597.       void this.showClosedAlert();
  23598.       if (!this.session.get('canReply')) return this.threadView.$el.find('#secondary-navigation').addClass('no-postbox'),
  23599.       void this.session.once('change:id', this.initMainPostBox, this);
  23600.       this.threadView.$el.find('#secondary-navigation').removeClass('no-postbox');
  23601.       var a = this.form = new $({
  23602.         thread: this.thread,
  23603.         userSuggestions: this.userSuggestions,
  23604.         session: this.session
  23605.       });
  23606.       a.render(),
  23607.       this.threadView.$el.find('#form').prepend(a.$el),
  23608.       a.resize()
  23609.     },
  23610.     showClosedAlert: function () {
  23611.       if (this.thread.get('isClosed')) {
  23612.         var a = this.thread.get('reactions');
  23613.         a ? (this.listenToOnce(a, 'sync change:enabled', this.showClosedAlert), this.alert(za(a.enabled ? 'Comments and reactions for this thread are now closed.' : 'Comments for this thread are now closed'))) : (this.listenToOnce(this.thread, 'change:reactions', this.showClosedAlert), this.alert(za('Comments for this thread are now closed')))
  23614.       }
  23615.     },
  23616.     initTermsOfService: function () {
  23617.       if (this.tos && (this.tos.remove(), this.tos = null), this.listenToOnce(this.session, 'change:id', this.initTermsOfService), !(this.session.user.isAnonymous() || this.session.user.get('hasAcceptedGdprTerms') || !this.config.isPrivate && this.session.isSSO() || u.tos_exempt_forums_shortnames.includes(this.forum.id))) {
  23618.         var a = this.tos = new Ha({
  23619.           isPrivate: this.config.isPrivate,
  23620.           session: this.session
  23621.         });
  23622.         a.render(),
  23623.         this.threadView.$el.find('#tos__container').prepend(a.$el)
  23624.       }
  23625.     },
  23626.     initUserSuggestionsManager: function () {
  23627.       this.userSuggestions = new fa({
  23628.         threadId: this.thread.id
  23629.       }),
  23630.       this.userSuggestions.addRemote(this.thread.users),
  23631.       this.listenTo(this.session, 'change:id', function () {
  23632.         this.session.isLoggedIn() && (this.session.user.getFollowing(), this.session.user.following.PER_PAGE = 100, this.userSuggestions.addRemote(this.session.user.following))
  23633.       })
  23634.     },
  23635.     handleShowProfile: function (b) {
  23636.       if (!(b.ctrlKey || b.metaKey || b.shiftKey || b.altKey || !this.isInHome() && !this.sidebar)) {
  23637.         b.preventDefault();
  23638.         var c = a(b.currentTarget).attr('data-username'),
  23639.         d = a(b.currentTarget).attr('data-tab') || '';
  23640.         this.isInHome() ? y.frame.sendHostMessage('home.open', T.apps.home + 'by/' + c + '/' + d) : this.showProfileSidebar(c, d)
  23641.       }
  23642.     },
  23643.     handleShowCommunitySidebar: function (b) {
  23644.       if (!F.willOpenNewWindow(b)) {
  23645.         b.preventDefault();
  23646.         var c = a(b.currentTarget).attr('data-forum');
  23647.         y.trigger('sidebar:open', 'home/forums/' + c + '/')
  23648.       }
  23649.     },
  23650.     handleSort: Aa(function (b) {
  23651.       var c = a(b.currentTarget).attr('data-sort'),
  23652.       d = this.forum.get('votingType') === s.VOTING_TYPES.DISABLED;
  23653.       'popular' === c && d && (c = 'desc'),
  23654.       this.$el.find('[data-role="post-sort"]').replaceWith(wa({
  23655.         order: c,
  23656.         votingDisabled: d,
  23657.         forum: this.thread.forum.id
  23658.       })),
  23659.       this.thread.posts.setOrder(c),
  23660.       this.thread.posts.fetch({
  23661.         reset: !0
  23662.       }),
  23663.       y.frame.sendHostMessage('change:sort', c),
  23664.       this.inthreadAdApps = [
  23665.       ],
  23666.       this.postsView.handleSort()
  23667.     }),
  23668.     toggleThread: Aa(function () {
  23669.       var a = this.thread.get('isClosed'),
  23670.       c = za(a ? 'An error occurred while opening the thread. Please try again.' : 'An error occurred while closing the thread. Please try again.'),
  23671.       d = {
  23672.         success: function () {
  23673.           window.location.reload(!0)
  23674.         },
  23675.         error: b.bind(this.alert, this, c, {
  23676.           type: 'error'
  23677.         })
  23678.       };
  23679.       a ? this.thread.open(d) : this.thread.close(d)
  23680.     }),
  23681.     toggleThreadPremoderate: Aa(function () {
  23682.       var a = this;
  23683.       this.dismissAlert(function (a) {
  23684.         return a.options && a.options.isPremoderateError
  23685.       });
  23686.       var b = this.thread.get('validateAllPosts');
  23687.       this.thread.premoderate(!b).then(function () {
  23688.         b ? a.dismissPremoderationAlert() : a.showPremoderationAlert()
  23689.       }, function () {
  23690.         a.alert(za('An error occurred while updating the thread. Please try again.'), {
  23691.           type: 'error',
  23692.           isPremoderateError: !0
  23693.         }),
  23694.         a.thread.set('validateAllPosts', b)
  23695.       }),
  23696.       y.trigger('uiAction:clickThreadPremoderate')
  23697.     }),
  23698.     toggleThreadRatingsEnabled: Aa(function () {
  23699.       var a = this;
  23700.       I.isForumModelRatingsEnabled(this.forum) && this.thread.toggleRatingsEnabled().then(function () {
  23701.         I.isThreadModelRatingsEnabled(a.thread) && (a.session.fetchThreadDetails({
  23702.           thread: a.thread
  23703.         }), a.thread.fetchRatings())
  23704.       })
  23705.     }),
  23706.     createDeferredViewsForImages: function () {
  23707.       a('img[data-src]').each(function (b, c) {
  23708.         var d = a(c),
  23709.         e = new Da({
  23710.           el: c,
  23711.           url: d.attr('data-src')
  23712.         });
  23713.         e.relatedPost = d.attr('data-post'),
  23714.         d.removeAttr('data-src')
  23715.       })
  23716.     },
  23717.     getPosition: function () {
  23718.       return this.position
  23719.     },
  23720.     showProfileSidebar: function (a, b) {
  23721.       y.trigger('sidebar:open', 'by/' + a + '/' + b)
  23722.     },
  23723.     initResizeHandler: function () {
  23724.       var a,
  23725.       b = this;
  23726.       if (window.MutationObserver) new window.MutationObserver(function () {
  23727.         a || (a = window.requestAnimationFrame(function () {
  23728.           a = null,
  23729.           b.resize()
  23730.         }))
  23731.       }).observe(ya.body, {
  23732.         attributes: !0,
  23733.         characterData: !0,
  23734.         childList: !0,
  23735.         subtree: !0,
  23736.         attributeFilter: [
  23737.           'class',
  23738.           'style'
  23739.         ]
  23740.       });
  23741.        else {
  23742.         var c = function d() {
  23743.           b.resize(),
  23744.           window.requestAnimationFrame(d)
  23745.         };
  23746.         window.requestAnimationFrame(c)
  23747.       }
  23748.     },
  23749.     resize: function () {
  23750.       var a = x.getPageHeight();
  23751.       this._lastHeight !== a && (this._lastHeight = a, this.trigger('domReflow'), y.frame.sendHostMessage('resize', {
  23752.         height: a
  23753.       }))
  23754.     },
  23755.     handleAuth: Aa(function (a) {
  23756.       this.session.authenticate(x.extractService(a.target, 'auth'))
  23757.     }),
  23758.     handleLogout: Aa(function () {
  23759.       this.session.logout()
  23760.     }),
  23761.     audienceSync: Aa(function () {
  23762.       this.session.audienceSync()
  23763.     }),
  23764.     toggleMedia: Aa(function () {
  23765.       var a = aa.settings,
  23766.       b = !a.get('collapsed');
  23767.       a.set('collapsed', b)
  23768.     }),
  23769.     toggleReactions: Aa(function () {
  23770.       this.thread.get('reactions').toggleEnabled()
  23771.     }),
  23772.     toggleEmbedRefresh: Aa(function () {
  23773.       null === K.get('switch:embed_refresh') || K.get('switch:embed_refresh') === !0 ? (K.set('switch:embed_refresh', !1), y.trigger('uiAction:toggleClassicDisqus', !0)) : (K.remove('switch:embed_refresh'), y.trigger('uiAction:toggleClassicDisqus', !1)),
  23774.       y.frame.sendHostMessage('reset', {
  23775.         reload: !0
  23776.       })
  23777.     }),
  23778.     initTopics: function () {
  23779.       var a = this;
  23780.       if ('browsingTopics' in ya && ya.featurePolicy && ya.featurePolicy.allowsFeature && ya.featurePolicy.allowsFeature('browsing-topics')) try {
  23781.         ya.browsingTopics().then(function (b) {
  23782.           a.meta.topics = b
  23783.         })
  23784.       } catch (b) {
  23785.       }
  23786.     }
  23787.   });
  23788.   return b.extend(Ka.prototype, W.ShareMixin),
  23789.   p.call(Ka.prototype),
  23790.   x.mixin(Ka, C.UiActionEventProxy),
  23791.   o.call(Ka.prototype),
  23792.   x.mixin(Ka, C.ProfileHtmlHelpers),
  23793.   Q.call(Ka.prototype),
  23794.   {
  23795.     Lounge: Ka,
  23796.     UserMenuView: Fa,
  23797.     ThreadSubscribeButton: Ca,
  23798.     RatingsView: ha,
  23799.     ReactionsView: ia,
  23800.     BehindClickView: Ia,
  23801.     ThreadView: Ja,
  23802.     DeferredMediaView: Da,
  23803.     DebugInfoView: Ea
  23804.   }
  23805. }),
  23806. define('lounge/main', [
  23807.   'jquery',
  23808.   'core/utils/getEmbeddedData',
  23809.   'lounge/tracking',
  23810.   'lounge/views'
  23811. ], function (a, b, c, d) {
  23812.   'use strict';
  23813.   return {
  23814.     init: function () {
  23815.       var e = b('threadData');
  23816.       if (!e) return {
  23817.         code: 'no_thread_data'
  23818.       };
  23819.       if (e.code) return 2 === e.code ? 'Endpoint resource not valid.' === e.response && (e.code = 'invalid_endpoint_resource') : 15 === e.code && 'Thread creations from embed disabled.' === e.response && (e.code = 'thread_creations_disabled'),
  23820.       e;
  23821.       a.extend(e.response, b('forumData')),
  23822.       a('#postCompatContainer').remove();
  23823.       var f = new d.Lounge({
  23824.         jsonData: e,
  23825.         el: window.document.body
  23826.       });
  23827.       c.init(f)
  23828.     }
  23829.   }
  23830. }),
  23831. define('lounge.bundle', function () {
  23832. });
  23833.