Skip to content

Instantly share code, notes, and snippets.

@mjuopperi
Created December 7, 2015 17:55
Show Gist options
  • Save mjuopperi/60974d8a6b4e58acf6d5 to your computer and use it in GitHub Desktop.
Save mjuopperi/60974d8a6b4e58acf6d5 to your computer and use it in GitHub Desktop.
try{(function(e,t){function a(e,t){var n=decodeURI(e),i=s[t||!1?"strict":"loose"].exec(n),a={attr:{},param:{},seg:{}},f=14;while(f--)a.attr[r[f]]=i[f]||"";return a.param.query={},a.param.fragment={},a.attr.query.replace(o,function(e,t,n){t&&(a.param.query[t]=n)}),a.attr.fragment.replace(u,function(e,t,n){t&&(a.param.fragment[t]=n)}),a.seg.path=a.attr.path.replace(/^\/+|\/+$/g,"").split("/"),a.seg.fragment=a.attr.fragment.replace(/^\/+|\/+$/g,"").split("/"),a.attr.base=a.attr.host?a.attr.protocol+"://"+a.attr.host+(a.attr.port?":"+a.attr.port:""):"",a}function f(e){var r=e.tagName;return r!==t?n[r.toLowerCase()]:r}var n={a:"href",img:"src",form:"action",base:"href",script:"src",iframe:"src",link:"href"},r=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"],i={anchor:"fragment"},s={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},o=/(?:^|&|;)([^&=;]*)=?([^&;]*)/g,u=/(?:^|&|;)([^&=;]*)=?([^&;]*)/g;e.fn.url=function(t){var n="";return this.length&&(n=e(this).attr(f(this[0]))||""),e.url(n,t)},e.url=function(e,n){return arguments.length===1&&e===!0&&(n=!0,e=t),n=n||!1,e=e||window.location.toString(),{data:a(e,n),attr:function(e){return e=i[e]||e,e!==t?this.data.attr[e]:this.data.attr},param:function(e){return e!==t?this.data.param.query[e]:this.data.param.query},fparam:function(e){return e!==t?this.data.param.fragment[e]:this.data.param.fragment},segment:function(e){return e===t?this.data.seg.path:(e=e<0?this.data.seg.path.length+e:e-1,this.data.seg.path[e])},fsegment:function(e){return e===t?this.data.seg.fragment:(e=e<0?this.data.seg.fragment.length+e:e-1,this.data.seg.fragment[e])}}}})(jQuery),function(){var e=this,t=e.Backbone,n=[],r=n.push,i=n.slice,s=n.splice,o;typeof exports!="undefined"?o=exports:o=e.Backbone={},o.VERSION="1.0.0";var u=e._;!u&&typeof require!="undefined"&&(u=require("underscore")),o.$=e.jQuery||e.Zepto||e.ender||e.$,o.noConflict=function(){return e.Backbone=t,this},o.emulateHTTP=!1,o.emulateJSON=!1;var a=o.Events={on:function(e,t,n){if(!l(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!l(this,"once",e,[t,n])||!t)return this;var r=this,i=u.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n)},off:function(e,t,n){var r,i,s,o,a,f,c,h;if(!this._events||!l(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;o=e?[e]:u.keys(this._events);for(a=0,f=o.length;a<f;a++){e=o[a];if(s=this._events[e]){this._events[e]=r=[];if(t||n)for(c=0,h=s.length;c<h;c++)i=s[c],(t&&t!==i.callback&&t!==i.callback._callback||n&&n!==i.context)&&r.push(i);r.length||delete this._events[e]}}return this},trigger:function(e){if(!this._events)return this;var t=i.call(arguments,1);if(!l(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&c(n,t),r&&c(r,arguments),this},stopListening:function(e,t,n){var r=this._listeners;if(!r)return this;var i=!t&&!n;typeof t=="object"&&(n=this),e&&((r={})[e._listenerId]=e);for(var s in r)r[s].off(t,n,this),i&&delete this._listeners[s];return this}},f=/\s+/,l=function(e,t,n,r){if(!n)return!0;if(typeof n=="object"){for(var i in n)e[t].apply(e,[i,n[i]].concat(r));return!1}if(f.test(n)){var s=n.split(f);for(var o=0,u=s.length;o<u;o++)e[t].apply(e,[s[o]].concat(r));return!1}return!0},c=function(e,t){var n,r=-1,i=e.length,s=t[0],o=t[1],u=t[2];switch(t.length){case 0:while(++r<i)(n=e[r]).callback.call(n.ctx);return;case 1:while(++r<i)(n=e[r]).callback.call(n.ctx,s);return;case 2:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o,u);return;default:while(++r<i)(n=e[r]).callback.apply(n.ctx,t)}},h={listenTo:"on",listenToOnce:"once"};u.each(h,function(e,t){a[t]=function(t,n,r){var i=this._listeners||(this._listeners={}),s=t._listenerId||(t._listenerId=u.uniqueId("l"));return i[s]=t,typeof n=="object"&&(r=this),t[e](n,r,this),this}}),a.bind=a.on,a.unbind=a.off,u.extend(o,a);var p=o.Model=function(e,t){var n,r=e||{};t||(t={}),this.cid=u.uniqueId("c"),this.attributes={},u.extend(this,u.pick(t,d)),t.parse&&(r=this.parse(r,t)||{});if(n=u.result(this,"defaults"))r=u.defaults({},r,n);this.set(r,t),this.changed={},this.initialize.apply(this,arguments)},d=["url","urlRoot","collection"];u.extend(p.prototype,a,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return u.clone(this.attributes)},sync:function(){return o.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return u.escape(this.get(e))},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,i,s,o,a,f,l,c;if(e==null)return this;typeof e=="object"?(i=e,n=t):(i={})[e]=t,n||(n={});if(!this._validate(i,n))return!1;s=n.unset,a=n.silent,o=[],f=this._changing,this._changing=!0,f||(this._previousAttributes=u.clone(this.attributes),this.changed={}),c=this.attributes,l=this._previousAttributes,this.idAttribute in i&&(this.id=i[this.idAttribute]);for(r in i)t=i[r],u.isEqual(c[r],t)||o.push(r),u.isEqual(l[r],t)?delete this.changed[r]:this.changed[r]=t,s?delete c[r]:c[r]=t;if(!a){o.length&&(this._pending=!0);for(var h=0,p=o.length;h<p;h++)this.trigger("change:"+o[h],this,c[o[h]],n)}if(f)return this;if(!a)while(this._pending)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,u.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,u.extend({},e,{unset:!0}))},hasChanged:function(e){return e==null?!u.isEmpty(this.changed):u.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?u.clone(this.changed):!1;var t,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(var i in e){if(u.isEqual(r[i],t=e[i]))continue;(n||(n={}))[i]=t}return n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return u.clone(this._previousAttributes)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r){if(!t.set(t.parse(r,e),e))return!1;n&&n(t,r,e),t.trigger("sync",t,r,e)},j(this,e),this.sync("read",this,e)},save:function(e,t,n){var r,i,s,o=this.attributes;e==null||typeof e=="object"?(r=e,n=t):(r={})[e]=t;if(r&&(!n||!n.wait)&&!this.set(r,n))return!1;n=u.extend({validate:!0},n);if(!this._validate(r,n))return!1;r&&n.wait&&(this.attributes=u.extend({},o,r)),n.parse===void 0&&(n.parse=!0);var a=this,f=n.success;return n.success=function(e){a.attributes=o;var t=a.parse(e,n);n.wait&&(t=u.extend(r||{},t));if(u.isObject(t)&&!a.set(t,n))return!1;f&&f(a,e,n),a.trigger("sync",a,e,n)},j(this,n),i=this.isNew()?"create":n.patch?"patch":"update",i==="patch"&&(n.attrs=r),s=this.sync(i,this,n),r&&n.wait&&(this.attributes=o),s},destroy:function(e){e=e?u.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(i){(e.wait||t.isNew())&&r(),n&&n(t,i,e),t.isNew()||t.trigger("sync",t,i,e)};if(this.isNew())return e.success(),!1;j(this,e);var i=this.sync("delete",this,e);return e.wait||r(),i},url:function(){var e=u.result(this,"urlRoot")||u.result(this.collection,"url")||B();return this.isNew()?e:e+(e.charAt(e.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(e){return this._validate({},u.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=u.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,u.extend(t||{},{validationError:n})),!1):!0}});var v=["keys","values","pairs","invert","pick","omit"];u.each(v,function(e){p.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.attributes),u[e].apply(u,t)}});var m=o.Collection=function(e,t){t||(t={}),t.url&&(this.url=t.url),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,u.extend({silent:!0},t))},g={add:!0,remove:!0,merge:!0},y={add:!0,merge:!1,remove:!1};u.extend(m.prototype,a,{model:p,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return o.sync.apply(this,arguments)},add:function(e,t){return this.set(e,u.defaults(t||{},y))},remove:function(e,t){e=u.isArray(e)?e.slice():[e],t||(t={});var n,r,i,s;for(n=0,r=e.length;n<r;n++){s=this.get(e[n]);if(!s)continue;delete this._byId[s.id],delete this._byId[s.cid],i=this.indexOf(s),this.models.splice(i,1),this.length--,t.silent||(t.index=i,s.trigger("remove",s,this,t)),this._removeReference(s)}return this},set:function(e,t){t=u.defaults(t||{},g),t.parse&&(e=this.parse(e,t)),u.isArray(e)||(e=e?[e]:[]);var n,i,o,a,f,l,c=t.at,h=this.comparator&&c==null&&t.sort!==!1,p=u.isString(this.comparator)?this.comparator:null,d=[],v=[],m={};for(n=0,i=e.length;n<i;n++){if(!(o=this._prepareModel(e[n],t)))continue;(f=this.get(o))?(t.remove&&(m[f.cid]=!0),t.merge&&(f.set(o.attributes,t),h&&!l&&f.hasChanged(p)&&(l=!0))):t.add&&(d.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,o.id!=null&&(this._byId[o.id]=o))}if(t.remove){for(n=0,i=this.length;n<i;++n)m[(o=this.models[n]).cid]||v.push(o);v.length&&this.remove(v,t)}d.length&&(h&&(l=!0),this.length+=d.length,c!=null?s.apply(this.models,[c,0].concat(d)):r.apply(this.models,d)),l&&this.sort({silent:!0});if(t.silent)return this;for(n=0,i=d.length;n<i;n++)(o=d[n]).trigger("add",o,this,t);return l&&this.trigger("sort",this,t),this},reset:function(e,t){t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),this.add(e,u.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,u.extend({at:this.length},t)),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,u.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return e==null?void 0:this._byId[e.id!=null?e.id:e.cid||e]},at:function(e){return this.models[e]},where:function(e,t){return u.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),u.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(u.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},sortedIndex:function(e,t,n){t||(t=this.comparator);var r=u.isFunction(t)?t:function(e){return e.get(t)};return u.sortedIndex(this.models,e,r,n)},pluck:function(e){return u.invoke(this.models,"get",e)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=e.success,n=this;return e.success=function(r){var i=e.reset?"reset":"set";n[i](r,e),t&&t(n,r,e),n.trigger("sync",n,r,e)},j(this,e),this.sync("read",this,e)},create:function(e,t){t=t?u.clone(t):{};if(!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,r=t.success;return t.success=function(i){t.wait&&n.add(e,t),r&&r(e,i,t)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof p)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(e,t)?n:(this.trigger("invalid",this,e,t),!1)},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var b=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];u.each(b,function(e){m.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.models),u[e].apply(u,t)}});var w=["groupBy","countBy","sortBy"];u.each(w,function(e){m.prototype[e]=function(t,n){var r=u.isFunction(t)?t:function(e){return e.get(t)};return u[e](this.models,r,n)}});var E=o.View=function(e){this.cid=u.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},S=/^(\S+)\s*(.*)$/,x=["model","collection","el","id","attributes","className","tagName","events"];u.extend(E.prototype,a,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof o.$?e:o.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=u.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];u.isFunction(n)||(n=this[e[t]]);if(!n)continue;var r=t.match(S),i=r[1],s=r[2];n=u.bind(n,this),i+=".delegateEvents"+this.cid,s===""?this.$el.on(i,n):this.$el.on(i,s,n)}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(e){this.options&&(e=u.extend({},u.result(this,"options"),e)),u.extend(this,u.pick(e,x)),this.options=e},_ensureElement:function(){if(!this.el){var e=u.extend({},u.result(this,"attributes"));this.id&&(e.id=u.result(this,"id")),this.className&&(e["class"]=u.result(this,"className"));var t=o.$("<"+u.result(this,"tagName")+">").attr(e);this.setElement(t,!1)}else this.setElement(u.result(this,"el"),!1)}}),o.sync=function(e,t,n){var r=T[e];u.defaults(n||(n={}),{emulateHTTP:o.emulateHTTP,emulateJSON:o.emulateJSON});var i={type:r,dataType:"json"};n.url||(i.url=u.result(t,"url")||B()),n.data==null&&t&&(e==="create"||e==="update"||e==="patch")&&(i.contentType="application/json",i.data=JSON.stringify(n.attrs||t.toJSON(n))),n.emulateJSON&&(i.contentType="application/x-www-form-urlencoded",i.data=i.data?{model:i.data}:{});if(n.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){i.type="POST",n.emulateJSON&&(i.data._method=r);var s=n.beforeSend;n.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",r);if(s)return s.apply(this,arguments)}}i.type!=="GET"&&!n.emulateJSON&&(i.processData=!1),i.type==="PATCH"&&window.ActiveXObject&&(!window.external||!window.external.msActiveXFilteringEnabled)&&(i.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var a=n.xhr=o.ajax(u.extend(i,n));return t.trigger("request",t,a,n),a};var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};o.ajax=function(){return o.$.ajax.apply(o.$,arguments)};var N=o.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},C=/\((.*?)\)/g,k=/(\(\?)?:\w+/g,L=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;u.extend(N.prototype,a,{initialize:function(){},route:function(e,t,n){u.isRegExp(e)||(e=this._routeToRegExp(e)),u.isFunction(t)&&(n=t,t=""),n||(n=this[t]);var r=this;return o.history.route(e,function(i){var s=r._extractParameters(e,i);n&&n.apply(r,s),r.trigger.apply(r,["route:"+t].concat(s)),r.trigger("route",t,s),o.history.trigger("route",r,t,s)}),this},navigate:function(e,t){return o.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;this.routes=u.result(this,"routes");var e,t=u.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(C,"(?:$1)?").replace(k,function(e,t){return t?e:"([^/]+)"}).replace(L,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return u.map(n,function(e){return e?decodeURIComponent(e):null})}});var O=o.History=function(){this.handlers=[],u.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},M=/^[#\/]|\s+$/g,_=/^\/+|\/+$/g,D=/msie [\w.]+/,P=/\/$/;O.started=!1,u.extend(O.prototype,a,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(P,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return e.replace(M,"")},start:function(e){if(O.started)throw new Error("Backbone.history has already been started");O.started=!0,this.options=u.extend({},{root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,r=D.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(_,"/"),r&&this._wantsHashChange&&(this.iframe=o.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?o.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?o.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var i=this.location,s=i.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!s)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&s&&i.hash&&(this.fragment=this.getHash().replace(M,""),this.history.replaceState({},document.title,this.root+this.fragment+i.search));if(!this.options.silent)return this.loadUrl()},stop:function(){o.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),O.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=u.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return n},navigate:function(e,t){if(!O.started)return!1;if(!t||t===!0)t={trigger:t};e=this.getFragment(e||"");if(this.fragment===e)return;this.fragment=e;var n=this.root+e;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),o.history=new O;var H=function(e,t){var n=this,r;e&&u.has(e,"constructor")?r=e.constructor:r=function(){return n.apply(this,arguments)},u.extend(r,n,t);var i=function(){this.constructor=r};return i.prototype=n.prototype,r.prototype=new i,e&&u.extend(r.prototype,e),r.__super__=n.prototype,r};p.extend=m.extend=N.extend=E.extend=O.extend=H;var B=function(){throw new Error('A "url" property or function must be specified')},j=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}}}.call(this),function(e,t){function n(e,n){n=n||{bubbles:!1,cancelable:!1,detail:t};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),r}if(e.CustomEvent)return;n.prototype=e.Event.prototype,e.CustomEvent=n}(this),function(e,t,n){"use strict";function h(n){if(n.origin!==location.origin&&!u.test(n.origin)&&n.origin!=="null")return;try{var r=JSON.parse(n.data),i=r.type;if(!f.test(i))return;var s=i.split(".",2)[1];if(l[s]){var o=l[s];e.frames.postMessage(o.target,i,r.data,r.options)}var a=new CustomEvent(i,{detail:r.data});a.source=n.source,t.dispatchEvent(a)}catch(c){}}function p(e,n,r){"addEventListener"in t?t.addEventListener(e,n,r):"attachEvent"in t&&t.attachEvent("on"+e,n)}function d(e,n,r){"removeEventListener"in t?t.removeEventListener(e,n):"detachEvent"in t&&t.attachEvent("on"+e,n)}function v(e){return new RegExp("^http(s)?:\\/\\/"+e.join("|")+"$","i")}function m(e){return new RegExp("\\.(?:"+e.join("|")+")$")}function g(e){return/\*/.test(e)}var r=".*",i=".postMessage",s={targetOrigin:"*"},o=[r],u=v(o),a=[i],f=m(a),l={},c=!1,y=e.frames={postMessage:function(e,t,n,r){/\..+$/.test(t)||(t+=i),r=r||{};for(var o in s)r.hasOwnProperty(o)||(r[o]=s[o]);e.postMessage(JSON.stringify({type:t,data:n,options:r}),r.targetOrigin)},receiveMessage:function(e,t,n,r){typeof e=="string"&&(r=n,n=t,t=e,e=null),r=r||this;var i=function(t){if(e&&e!==t.source&&e.contentWindow!==t.source)return;n.apply(r,arguments)};return p(t,i),{off:function(){d(t,i)}}},proxy:function(e,t){this.listen(e),l[e]={target:t}},receiveMessageOnce:function(e,t,n,r){var i=y.receiveMessage(e,t,function(){n&&n.apply(this,arguments),i.off()},r);return i},addPostMessageOrigin:function(e){g(e)?o=[r]:o.indexOf(e)===-1&&(y.removePostMessageOrigin(r),o.push(e),u=v(o))},removePostMessageOrigin:function(e){var t=o.indexOf(e);t!==-1&&(o.splice(t,1),u=v(o))},listen:function(e){a.indexOf(e)===-1&&(a.push(e),f=m(a)),c||(p("message",h),c=!0)},stopListening:function(e){var t=a.indexOf(e);t!==-1&&(a.splice(t,1),a.length?f=m(a):(d("message",h),c=!1))}}}(this.r=this.r||{},this),function(e,t,n){var r=Object.prototype.hasOwnProperty;e.utils=e.utils||{},e.utils.uuid=function(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t=="x"?n:n&3|8).toString(16)});return t},e.utils.serialize=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t.join("&")}}(window.rembeddit=window.rembeddit||{},this),!function(e,t,n){var r=e.PixelTracker=function(e){this._pixelTrackingUrl=e.url,this._anonymousPixelTrackingUrl=e.anonymousUrl};r.prototype.send=function(t,n,r){typeof n=="function"&&(r=n,n={}),n=n||{},r=r||function(){};var i=n.anonymous?this._anonymousPixelTrackingUrl:this._pixelTrackingUrl;if(!t||!i){r();return}t.uuid=t.uuid||e.utils.uuid();var s=new Image,o=Math.round(Math.random()*2147483647);s.onload=r,s.src=i+"?r="+o+"&data="+encodeURIComponent(JSON.stringify(t))}}(window.rembeddit=window.rembeddit||{},this),function(e,t,n){function u(e,t,n){for(var r=0;r<e.length;r++)t.call(n,r,e[r])}function a(e){return i.test(e.href)&&s.test(e.pathname)}function f(e){return a(e)&&e.pathname.replace(/^\//,"")}function l(e,t){var n;for(var r=0,i=e.length;r<i;r++)if(n=f(e[r]))break;return"//"+t+"/"+n}function c(e,t){var n=0,r=t.getAttribute("data-embed-live");t.getAttribute("data-embed-parent")==="true"&&n++;var i="embed=true&context="+n+"&depth="+ ++n+"&showedits="+(r==="true")+"&created="+t.getAttribute("data-embed-created")+"&showmore=false";return o+e.replace(/\/$/,"")+"?"+i}var i=/^https?:\/\//i,s=/\/?r\/[\w_]+\/comments\/(?:\S+\/){2,}[\w_]+\/?/i,o=location.protocol==="file:"?"https:":"";e.init=function(e,t){e=e||{},t=t||function(){};var n=document.querySelectorAll(".reddit-embed");u(n,function(n,i){if(i.getAttribute("data-initialized"))return;i.setAttribute("data-initialized",!0);var s=document.createElement("iframe"),o=i.getElementsByTagName("a"),u=l(o,i.getAttribute("data-embed-media"));if(!u)return;r.frames.addPostMessageOrigin(i.getAttribute("data-embed-media")),r.frames.listen("embed"),s.height=s.style.height=0,s.width=s.style.width="100%",s.scrolling="no",s.frameBorder=0,s.allowTransparency=!0,s.style.display="none",s.style.maxWidth="800px",s.style.minWidth="220px",s.style.margin="10px 0",s.style.borderRadius="5px",s.style.boxShadow="0 0 5px 0.5px rgba(0, 0, 0, 0.05)",s.style.borderColor="rgba(199,199,199, 0.55)",s.style.borderWidth="1px",s.style.borderStyle="solid",s.style.boxSizing="border-box",s.src=c(u,i),r.frames.receiveMessageOnce(s,"ping.embed",function(n){i.parentNode.removeChild(i),s.style.display="block",t(n),r.frames.postMessage(s.contentWindow,"pong.embed",{type:i.getAttribute("data-embed-parent")==="true"?"comment_and_parent":"comment",location:location,options:e})});var a=r.frames.receiveMessage(s,"resize.embed",function(e){if(!s.parentNode){a.off();return}s.height=s.style.height=e.detail+"px"});i.parentNode.insertBefore(s,i)})};if(e.preview)return;e.init()}(window.rembeddit=window.rembeddit||{},window.r,this),function(e,t,n){var r=document.getElementById("gtm-jail");e.gtm={trigger:function(t,n){n&&this.set(n),e.frames.postMessage(r.contentWindow,"event.gtm",{event:t})},set:function(t){e.frames.postMessage(r.contentWindow,"data.gtm",t)}}}(this.r=this.r||{},this),!function(e,t,n){"use strict";var r=t.Model.extend({duration:function(){return this.get("end")-this.get("start")},isValid:function(){return this.get("end")!==0}}),i=t.Collection.extend({model:r,comparator:"start",initialize:function(){this.on("reset",this.calculate,this)},calculate:function(){this.startTime=this.min(function(e){return e.get("start")}).get("start"),this.endTime=this.max(function(e){return e.get("end")}).get("end"),this.duration=this.endTime-this.startTime}}),s=i.extend({fetch:function(){function r(n,r,i){if(!e[r]||!e[i])return;t.push({key:n,start:e[r]/1e3,end:e[i]/1e3})}if(!window.performance||!window.performance.timing)return;var e=window.performance.timing,t=[];r("redirect","redirectStart","redirectEnd"),r("start","fetchStart","domainLookupStart"),r("dns","domainLookupStart","domainLookupEnd"),r("tcp","connectStart","connectEnd"),r("https","secureConnectionStart","connectEnd"),r("request","requestStart","responseStart"),r("response","responseStart","responseEnd"),r("domLoading","domLoading","domInteractive"),r("domInteractive","domInteractive","domContentLoadedEventStart"),r("domContentLoaded","domContentLoadedEventStart","domContentLoadedEventEnd"),this.reset(n.values(t))}});e.NavigationTimings=s,e.Timing=r,e.Timings=i}(r,Backbone,_),r.templating={},r.templating.TemplateSet=function(){this.index={}},r.templating.TemplateSet.prototype={_templateSettings:{variable:"thing"},_key:function(e,t){return e+"."+t},_create:function(e){return _.template(e,null,this._templateSettings)},set:function(e){_.each(e,function(e){r.config.uncompressedJS&&(e=r.utils.unescapeJson(e));var t=this._key(e.name,e.style);this.index[t]=e.template},this)},_defaultStyle:function(e){return _.isArray(e)||(e=[e,r.config.renderstyle]),e},get:function(e){e=this._defaultStyle(e);var t=this._key(e[0],e[1]);if(!this.index[t])throw'"'+e[0]+"."+e[1]+'"'+" template not found.";return template=this.index[t],_.isFunction(template)||(template=this.index[t]=this._create(template)),template},make:function(e,t,n){return html=this.get(e)(t),n&&$(n).append(html),html}},r.templates=new r.templating.TemplateSet,!function(e,t){e.ScrollUpdater=Backbone.View.extend({selector:null,startUpdate:function(){},update:function(e){},endUpdate:function(e){},start:function(){return this._resetScrollState(),this._listen(),this},restart:function(){return this._resetScrollState(),this},_resetScrollState:function(){this._elements=this.$el.find(this.selector),_.sortBy(this._elements,function(e){return t(e).offset().top}),this._curIndex=0,this._lastScroll=null,this._toUpdate=[],this._totalTime=0,_.defer(t.proxy(this,"_updateThings"))},_listen:function(){var e=_.throttle(t.proxy(this,"_updateThings"),20);t(window).on("scroll",e)},_updateThings:function(e){if(!this._elements.length)return;var n=new Date,r=t(window),i=r.height(),s=r.scrollTop(),o=s,u=s+i;s<this._lastScroll?o=Math.max(o-Math.floor(i/2),0):u+=Math.ceil(i/2);var a=this._curIndex,f=t(this._elements[a]);if(f.offset().top<o)while(a<this._elements.length-1&&f.offset().top<o)f=t(this._elements[a]),a++;else while(a>0&&f.offset().top>o)f=t(this._elements[a]),a--;var l=0;do f=t(this._elements[a]),this._toUpdate.push(f),a++,l++;while(a<=this._elements.length-1&&f.offset().top<=u);this._curIndex=a-1,this._lastScroll=s;var c=new Date;this._totalTime+=c-n,this._doUpdates()},cutoff:1e3/60,_doUpdates:function(){this.startUpdate();var e=new Date,n=e,r=0,i=[];while(n-e<this.cutoff){if(!this._toUpdate.length)break;var s=this._toUpdate.shift();i.push(s),this.update(s),r++,n=new Date}this._totalTime+=n-e,this._toUpdate.length&&_.defer(t.proxy(this,"_doUpdates")),this.endUpdate(t(i))}})}(r,jQuery),!function(e,t){function s(e){this.opts=_.defaults(e||{},i),this.elCache=t([]),this.refresh=_.throttle(this._refresh,1e3),setInterval(t.proxy(this.refresh,this),2e4),this.refresh()}Date.now||(Date.now=function(){return(new Date).getTime()});var n=Date.now(),r=[[31536e3,e.NP_("a year ago","%(num)s years ago")],[2592e3,e.NP_("a month ago","%(num)s months ago")],[86400,e.NP_("a day ago","%(num)s days ago")],[3600,e.NP_("an hour ago","%(num)s hours ago")],[60,e.NP_("a minute ago","%(num)s minutes ago")]],i={maxage:86400};s.prototype._refresh=function(){var e=s.now();this.elCache.each(t.proxy(function(t,n){this.refreshOne(n,e)},this))},s.prototype.updateCache=function(e){this.elCache=e,this.refresh()},s.prototype.refreshOne=function(n,r){r||(r=s.now());var i=t(n),o=e.utils.parseTimestamp(i),u,a;a=(r-o)/1e3;if(this.opts.maxage!==!1&&a>this.opts.maxage){i.removeClass("live-timestamp");return}u=this.formatTime(i,a,o,r),i.text(u)},s.prototype.formatTime=function(n,i,s,o){var u=e._("just now");return t.each(r,function(t,n){var r=Math.floor(i/n[0]),s;if(r>0)return s=n[1],u=e.P_(s[0],s[1],r).format({num:r}),!1}),u},s.clientOffset=0,s.now=function(){return Date.now()-s.clientOffset},s.init=function(){var t=e.config.server_time*1e3,r=n-t,i=36e5,s=Math.round(r/i);this.clientOffset=s*i},e.TimeText=s}(r,jQuery),r.ui.init=function(){$.cookie("reddit_first")?($.cookie("reddit_first",null,{domain:r.config.cur_domain}),store.safeSet("ui.shown.welcome",!0)):store.safeGet("ui.shown.welcome")!=1&&($(".infobar.welcome").show(),store.safeSet("ui.shown.welcome",!0)),r.ui.initMWebBanner(),$(".help-bubble").each(function(e,t){$(t).data("HelpBubble",new r.ui.Bubble({el:t}))}),$(".submit_text").each(function(e,t){$(t).data("SubredditSubmitText",new r.ui.SubredditSubmitText({el:t}))}),r.config.new_window&&(r.config.logged||!r.ui.isSmallScreen())&&$(document.body).on("click","a.may-blank, .may-blank-within a",function(e){if(!this.target){var t=_.contains(["http:","https:"],this.protocol);if(this.href&&t&&r.utils.onTrident()){var n=window.open(this.href,"_blank");if(n!==null)return n.opener=null,e.preventDefault(),!1}this.target="_blank",this.rel="noreferrer"}return!0}),r.ui.PermissionEditor.init(),r.ui.initLiveTimestamps(),r.ui.initNewCommentHighlighting(),r.ui.initReadNext(),r.ui.initTimings()},r.ui.inMobileWebBlacklist=function(){return _.any(r.config.mweb_blacklist_expressions,function(e){return(new RegExp(e)).test(window.location.pathname)})},r.ui.isSmallScreen=function(){return window.matchMedia?matchMedia("(max-device-width: 736px)").matches:$(window).width()<736},r.ui.TimeTextScrollListener=r.ScrollUpdater.extend({initialize:function(e){this.timeText=e.timeText,this.timeText.updateCache($(this.selector))},selector:".live-timestamp:visible",endUpdate:function(e){this.timeText.updateCache(e)}}),r.ui.initMWebBanner=function(){if(!r.ui.isSmallScreen()||r.config.renderstyle=="compact")return;if($.url().attr("path")!="/")return;if(r.ui.inMobileWebBlacklist
())return;var e=new Date(store.safeGet("mweb-beta-banner.closed")||0),t=(new Date).getTime();if(t<e)return;var n="__cf_mob_redir",i=document.createElement("a");i.href=window.location,i.host="m."+r.config.cur_domain,i.search+=(i.search?"&":"?")+"ref=mobile_beta_banner&ref_source=desktop";var s=i.href,o=$(_.template('<div class="mobile-web-redirect-bar"><a href="<%- url %>" class="mobile-web-redirect"><%- callout %></a><a href="#" class="mobile-web-redirect-optout">&times;</a></div>',{callout:r._("switch to mobile version"),url:s,close:r._("no thanks")}));o.find(".mobile-web-redirect-optout").on("click",function(e){e.preventDefault();var t=(new Date).getTime()+12096e5;store.safeSet("mweb-beta-banner.closed",t),o.fadeOut()}),o.find(".mobile-web-redirect").on("click",function(){return $.cookie(n,"1",{domain:r.config.cur_domain,path:"/",expires:90}),!0}),$("#header").before(o)},r.ui.initLiveTimestamps=function(){if($(".sitetable").length){var e=new r.ui.TimeTextScrollListener({el:".sitetable",timeText:new r.TimeText});e.start(),$(document).on("new_things_inserted",function(){e.restart()})}},r.ui.initNewCommentHighlighting=function(){if(!$("body").hasClass("comments-page"))return;$visitSelector=$("#comment-visits");if($visitSelector.length===0)return;$(document).on("new_things_inserted",r.ui.highlightNewComments),$visitSelector.on("change",r.ui.highlightNewComments),r.ui.highlightNewComments()},r.ui.highlightNewComments=function(){var e=$(".comment"),t=$("#comment-visits").val(),n;t&&(n=Date.parse(t)),e.each(function(){var e=$(this),t=e.find("> .entry .tagline time:first-of-type"),i=r.utils.parseTimestamp(t),s=!!n&&i>n;e.toggleClass("new-comment",s)})},r.ui.initReadNext=function(){var e=12096e5,t=$(".read-next-container"),n=!!store.safeGet("readnext.dismissed"),i=parseInt(store.safeGet("readnext.expiration"),10),s=Date.now();n&&(i?i<s&&(store.safeSet("readnext.dismissed",!1),n=!1):(i=s+e,store.safeSet("readnext.expiration",i)));var o=r.config.cur_link;if(n||!t.length)return;this.readNext=new r.ui.ReadNext({el:t,fixToBottom:!r.ui.isSmallScreen(),currentLinkFullname:o,ttl:e})},r.ui.ReadNext=Backbone.View.extend({events:{"click .read-next-button.next":"next","click .read-next-button.prev":"prev","click .read-next-dismiss":"dismiss"},initialize:function(){this.$readNext=this.$el.find(".read-next"),this.$links=this.$readNext.find(".read-next-link"),this.numLinks=this.$links.length,this.state=new Backbone.Model({fixed:!1,index:-1}),this.state.on("change",this.render.bind(this)),this.options.fixToBottom&&(this.updateScroll=this.updateScroll.bind(this),window.addEventListener("scroll",this.updateScroll),this.updateScroll());var e="#read-next-link-"+this.options.currentLinkFullname,t=this.$links.index($(e))+1;this.state.set({index:t}),this.resetRefIndicies(t),this.$readNext.addClass("active")},resetRefIndicies:function(e){var t=document.createElement("a");this.$links.toArray().forEach(function(n,r){var i=$.url(n.href),s=i.param();if(!s.ref)return;var o=this.moduloIndex(r-e);s.ref=s.ref.split("_")[0]+"_"+o,t.href=n.href,t.search=$.param(s),n.href=t.href},this)},moduloIndex:function(e){var t=this.numLinks;return(e+t)%t},next:function(){var e=this.state.get("index");this.state.set({index:this.moduloIndex(e+1)}),r.analytics.fireGAEvent("readnext","nav-next")},prev:function(){var e=this.state.get("index"),t=this.numLinks;this.state.set({index:this.moduloIndex(e-1)}),r.analytics.fireGAEvent("readnext","nav-prev")},dismiss:function(){this.$el.fadeOut(),window.removeEventListener("scroll",this.updateScroll),r.analytics.fireGAEvent("readnext","dismiss"),store.safeSet("readnext.dismissed",!0);var e=Date.now()+this.options.ttl;store.safeSet("readnext.expiration",e)},updateScroll:function(){var e=window.scrollY,t=this.$el.position().top,n=window.innerHeight,r=this.$readNext.height();e+=n,t+=r,this.state.set({fixed:e>=t})},render:function(){var e=this.state.get("index"),t=this.state.get("fixed");this.$links.removeClass("active"),this.$links.eq(e).addClass("active"),t?this.$readNext.addClass("fixed"):this.$readNext.removeClass("fixed")}}),r.ui.initTimings=function(){if(!r.config.pageInfo.actionName||!r.config.stats_domain)return;if(Math.random()>r.config.stats_sample_rate/100)return;var e=new r.NavigationTimings;$(function(){_.defer(function(){e.fetch();var t=e.filter(function(e){return e.get("key")!=="start"}).reduce(function(e,t){if(!t.isValid())return e;var n=t.duration();if(n>0){var r=t.get("key")+"Timing";e[r]=n}return e},{});t.actionName=r.config.pageInfo.actionName,t.verification=r.config.pageInfo.verification,$.ajax({type:"POST",url:r.config.stats_domain,data:JSON.stringify({rum:t}),contentType:"application/json; charset=utf-8",dataType:"json"})})})},r.ui.showWorkingDeferred=function(e,t){if(!t)return;var n=200,r="_workingCount",i=$(e);i.data(r,(i.data(r)||0)+1);var s=setTimeout(function(){i.addClass("working")},n);return t.always(function(){clearTimeout(s);var e=Math.max(0,i.data(r)-1);i.data(r,e),e==0&&i.removeClass("working")}),t},r.ui.refreshListing=function(){var e=$.url(),t=e.param();return t.bare="y",$.ajax({type:"GET",url:e.attr("base")+e.attr("path"),data:t}).done(function(e){$("body > .content").html(e).find(".promotedlink.promoted:visible").trigger("onshow")})},r.ui.Form=function(e){r.ui.Base.call(this,e),this.$el.submit($.proxy(function(e){e.preventDefault(),this.submit(e)},this)),this.$el.find("[data-validate-url]").validator({https:!!r.config.https_endpoint}).on("initialize.validator",function(e){var t=$(this);t.hasClass("c-has-error")&&t.stateify("showError")}).on("valid.validator",function(e){$(this).stateify("set","success")}).on("invalid.validator",function(e,t){if(t){var n=r.utils.parseError(t.errors[0]);$(this).stateify("set","error",n.message)}}).on("loading.validator",function(e){$(this).stateify("set","loading")}).on("cleared.validator",function(e){$(this).stateify("clear")})},r.ui.Form.prototype=$.extend(new r.ui.Base,{showStatus:function(e,t){this.$el.find(".status, .c-alert").show().toggleClass("error",!!t).text(e)},showErrors:function(e){var t=[];$.each(e,$.proxy(function(e,n){var i=r.utils.parseError(n),s=this.$el.find(".error."+i.name+(i.field?".field-"+i.field:"")),o=this.$el.filter(".form-v2").find('[name="'+i.field+'"]');s.length?s.show().text(i.message):o.length?o.stateify("set","error",i.message):t.push(i.message)},this)),t.length&&this.showStatus(t.join(", "),!0)},resetErrors:function(){this.$el.find(".error").hide()},checkCaptcha:function(e){if(this.$el.has('input[name="captcha"]').length){var t=$.grep(e,function(e){return e[0]=="badCaptcha"});t&&$.request("new_captcha",{id:this.$el.attr("id")})}},serialize:function(){return this.$el.serializeArray()},submit:function(){this.resetErrors(),r.ui.showWorkingDeferred(this.$el,this._submit()).done($.proxy(this,"handleResult")).fail($.proxy(this,"_handleNetError"))},_submit:function(){},handleResult:function(e){this.checkCaptcha(e.json.errors),this._handleResult(e)},_handleResult:function(e){this.showErrors(e.json.errors)},_handleNetError:function(e){var t=r._("an error occurred (status: %(status)s)").format({status:e.status});this.showStatus(t,!0)}}),r.ui.Bubble=Backbone.View.extend({showDelay:150,hideDelay:750,animateDuration:150,initialize:function(){this.$parent=this.options.parent||this.$el.parent(),this.options.trackHover!=0&&(this.$el.hover($.proxy(this,"queueShow"),$.proxy(this,"queueHide")),this.$parent.hover($.proxy(this,"queueShow"),$.proxy(this,"queueHide")),this.$parent.click($.proxy(this,"queueShow")))},position:function(){var e=this.$parent.offset(),t=$("body").offset(),n,i;this.$el.is(".anchor-top")||this.$el.is(".anchor-top-centered")?(n=this.$parent.outerWidth(!0)-this.$el.outerWidth(!0),i=this.$parent.outerHeight(!0)+5,this.$el.css({left:Math.max(e.left+n,0),top:e.top+i-t.top})):this.$el.is(".anchor-top-left")?(i=this.$parent.outerHeight(!0)+5,this.$el.css({left:e.left,top:e.top+i-t.top})):this.$el.is(".anchor-right-fixed")?(n=32,i=0,e.top-=$(document).scrollTop(),e.left-=$(document).scrollLeft(),this.$el.css({top:r.utils.clamp(e.top-i,0,$(window).height()-this.$el.outerHeight()),left:r.utils.clamp(e.left-n-this.$el.width(),0,$(window).width())})):this.$el.is(".anchor-left")?(n=this.$parent.outerWidth(!0)+16,i=0,this.$el.css({left:e.left+n,top:e.top+i-t.top})):(n=16,i=0,e.right=$(window).width()-e.left,this.$el.css({right:e.right+n,top:e.top+i-t.top}))},show:function(){this.cancelTimeout();if(this.$el.is(":visible"))return;this.trigger("show"),$("body").append(this.$el),this.$el.css("visibility","hidden").show(),this.render(),this.position(),this.$el.css({opacity:1,visibility:"visible"});var e=this.options.group&&this.options.group.current&&this.options.group.current!=this;e?this.options.group.current.hideNow():this._animate("show"),this.options.group&&(this.options.group.current=this)},hideNow:function(){this.cancelTimeout(),this.options.group&&this.options.group.current==this&&(this.options.group.current=null),this.$el.hide()},hide:function(e){if(!this.$el.is(":visible")){e&&e();return}this._animate("hide",$.proxy(function(){this.hideNow(),e&&e()},this))},_animate:function(e,t){if(!this.animateDuration){t&&t();return}var n,r;this.$el.is(".anchor-top")||this.$el.is(".anchor-top-centered")||this.$el.is(".anchor-top-left")?(n="top",r="-=5"):this.$el.is(".anchor-right-fixed")?(n="right",r="-=5"):this.$el.is(".anchor-left")?(n="left",r="+=5"):(n="right",r="-=5");var i=this.$el.css(n);hideProps={opacity:0},hideProps[n]=r,showProps={opacity:1},showProps[n]=i;var s,o;e=="show"?(s=hideProps,o=showProps):e=="hide"&&(s=showProps,o=hideProps),this.$el.css(s).animate(o,this.animateDuration,t)},cancelTimeout:function(){this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},queueShow:function(){this.cancelTimeout(),this.timeout=setTimeout($.proxy(this,"show"),this.showDelay)},queueHide:function(){this.cancelTimeout(),this.timeout=setTimeout($.proxy(this,"hide"),this.hideDelay)}}),r.ui.PermissionEditor=function(e){r.ui.Base.call(this,e);var t={};this.$el.find('input[type="hidden"]').each(function(e,n){t[n.name]=n.value});var n=t.type,i=t.name;this.form_id=n+"-permissions-"+i,this.permission_info=r.permissions[n],this.sorted_perm_keys=$.map(this.permission_info,function(e,t){return t}),this.sorted_perm_keys.sort(),this.original_perms=this._parsePerms(t.permissions),this.embedded=this.$el.find("form").length==0,this.$menu=null,this.embedded?(this.$permissions_field=this.$el.find('input[name="permissions"]'),this.$menu_controller=this.$el.siblings(".permissions-edit")):this.$menu_controller=this.$el.closest("tr").find(".permissions-edit"),this.$menu_controller.find("a").click($.proxy(this,"show")),this.updateSummary()},r.ui.PermissionEditor.init=function(){function e(e){$(e).find(".permissions").each(function(e,t){$(t).data("PermissionEditor",new r.ui.PermissionEditor(t))})}e("body");for(var t in r.permissions)$("."+t+"-table").on("insert-row","tr",function(t){e(this)})},r.ui.PermissionEditor.prototype=$.extend(new r.ui.Base,{_parsePerms:function(e){var t={};return e.split(",").forEach(function(e){t[e.substring(1)]=e[0]=="+"}),t.all?{all:!0}:t},_serializePerms:function(e){if(e.all)return"+all";var t=[];for(var n in e)t.push((e[n]?"+":"-")+n);return t.join(",")},_getNewPerms:function(){if(!this.$menu)return null;var e={};return this.$menu.find('input[type="checkbox"]').each(function(t,n){e[$(n).attr("name")]=$(n).prop("checked")}),e},_makeMenuLabel:function(e){var t=$.proxy(this,"updateSummary"),n=this.permission_info[e],i=$('<input type="checkbox">').attr("name",e).prop("checked",this.original_perms[e]),s=$("<label>").append(i).click(function(e){e.stopPropagation()});return e=="all"?(i.change(function(){var e=i.is(":checked");s.siblings().toggleClass("disabled",e).find('input[type="checkbox"]').prop("disabled",e),t()}),s.append(document.createTextNode(r._("full permissions")))):n&&(i.change(t),s.append(document.createTextNode(r._(n.title))),s.attr("title",r._(n.description))),s},show:function(e){if(r.access.isLinkRestricted(e.target))return;close_menus(e),this.$menu=$('<div class="permission-selector drop-choices">'),this.$menu.append(this._makeMenuLabel("all"));for(var t in this.sorted_perm_keys)this.$menu.append(this._makeMenuLabel(this.sorted_perm_keys[t]));this.$menu.on("close_menu",$.proxy(this,"hide")).find("input").first().change().end();if(!this.embedded){var n=this.$el.find("form").clone();n.attr("id",this.form_id),n.click(function(e){e.stopPropagation()}),this.$menu.append("<hr>",n),this.$permissions_field=this.$menu.find('input[name="permissions"]')}return this.$menu_controller.parent().append(this.$menu),open_menu(this.$menu_controller[0]),!1},hide:function(){this.$menu&&(this.embedded&&(this.original_perms=this._getNewPerms(),this.$permissions_field.val(this._serializePerms(this.original_perms))),this.$menu.remove(),this.$menu=null,this.updateSummary())},_renderBit:function(e){var t=this.permission_info[e],n;e=="all"?n=r._("full permissions"):t?n=r._(t.title):n=e;var i=$('<span class="permission-bit"/>').text(n);return t&&i.attr("title",r._(t.description)),i},updateSummary:function(){var e=this._getNewPerms(),t=[];if(e&&e.all)t.push(this._renderBit("all").toggleClass("added",this.original_perms.all!=1));else{if(this.original_perms.all&&!e)t.push(this._renderBit("all"));else if(!this.original_perms.all)for(var n in this.original_perms)this.original_perms[n]&&(this.embedded&&(!e||!!e[n])&&t.push(this._renderBit(n)),this.embedded||t.push(this._renderBit(n).toggleClass("removed",e!=null&&!e[n])));if(e)for(var n in e)this.permission_info[n]&&e[n]&&!this.original_perms[n]&&t.push(this._renderBit(n).toggleClass("added",!this.embedded))}t.length||t.push($('<span class="permission-bit">').text(r._("no permissions")).addClass("none"));var i=$('<div class="permission-summary">');for(var s=0;s<t.length;s++)s>0&&i.append(", "),i.append(t[s]);i.toggleClass("edited",this.$menu!=null),this.$el.find(".permission-summary").replaceWith(i),e&&this.$permissions_field&&this.$permissions_field.val(this._serializePerms(e))},onCommit:function(e){this.$el.find('input[name="permissions"]').val(e),this.original_perms=this._parsePerms(e),this.hide()}}),r.ui.scrollFixed=function(e){this.$el=$(e),this.$standin=null,this.onScroll(),$(window).bind("scroll resize",_.bind(_.throttle(this.onScroll,20),this))},r.ui.scrollFixed.prototype={onScroll:function(){if(!this.$el.is(".scroll-fixed")){var e=this.$el.outerHeight(!0)-this.$el.outerHeight(!1);this.origTop=this.$el.offset().top-e}var t=this.$el.height()<$(window).height();t&&$(window).scrollTop()>this.origTop?this.$standin||(this.$standin=$("<"+this.$el.prop("nodeName")+">").css({width:this.$el.width(),height:this.$el.height()}).attr("class",this.$el.attr("class")).addClass("scroll-fixed-standin"),this.$el.addClass("scroll-fixed").css({position:"fixed",top:0}),this.$el.before(this.$standin)):this.$standin&&(this.$el.removeClass("scroll-fixed").css({position:"",top:""}),this.$standin.remove(),this.$standin=null)}},r.ui.ConfirmButton=Backbone.View.extend({confirmTemplate:_.template('<span class="confirmation"><span class="prompt"><%- are_you_sure %></span><button class="yes"><%- yes %></button> / <button class="no"><%- no %></button></div>'),events:{click:"click"},initialize:function(){this.$target=this.$el,this.$target.wrap("<span>"),this.setElement(this.$target.parent()),this.$el.attr("class",this.$target.attr("class")).addClass("confirm-button"),this.$target.attr("class",null)},click:function(e){var t=$(e.target);this.$target.is(t)?(this.$target.hide(),this.$el.append(this.confirmTemplate({are_you_sure:r._("are you sure?"),yes:r._("yes"),no:r._("no")}))):t.is(".no")?(this.$(".confirmation").remove(),this.$target.show()):t.is(".yes")&&this.$target.trigger("confirm")}}),r.ui.SubredditSubmitText=Backbone.View.extend({initialize:function(){this.lookup=_.throttle(this._lookup,500),this.cache=new r.utils.LRUCache,this.$input=$("#sr-autocomplete"),this.$input.on("sr-changed change input",_.bind(this.lookup,this)),this.$sr=this.$el.find(".sr").first(),this.$content=this.$el.find(".content").first(),this.$content.text().trim()&&(this.$sr.text(r.config.post_site),this.show())},_lookup:function(){this.$content.empty();var e=this.$input.val();this.$sr.text(e),this.$el.addClass("working"),this.req&&this.req.abort&&this.req.abort(),this.req=this.cache.ajax(e,{url:"/r/"+e+"/api/submit_text/.json",dataType:"json"}).done(_.bind(this.settext,this,e)).fail(_.bind(this.error,this))},show:function(){this.$el.addClass("enabled")},hide:function(){this.$el.removeClass("enabled")},error:function(){delete this.req,this.hide()},settext:function(e,t){delete this.req,!t.submit_text||!t.submit_text.trim()?this.hide():(this.$sr.text(e),this.$content.html($.unsafe(t.submit_text_html)),this.$el.removeClass("working"),this.show())}}),r.ui.TextCounter=Backbone.View.extend({events:{"input input":"onInput","input textarea":"onInput"},initialize:function(e){this.error=!1,this.maxLength=e.maxLength,this.$counterDisplay=this.$el.find(".text-counter-display"),this.$counterParent=this.$counterDisplay.parent(),this.$input=this.$el.find(".text-counter-input"),this.update(e.initialText||"")},onInput:function(e){this.update(e.target.value)},update:function(e){var t=this.maxLength-e.length;this.$counterDisplay.text(t),t<0&&!this.error?(this.$counterParent.addClass("has-error"),this.error=!0,this.trigger("invalid")):t>=0&&this.error&&(this.$counterParent.removeClass("has-error"),this.error=!1,this.trigger("valid"))}}),function(e,t,n,i,s){var o={large:"modal-dialog-lg",medium:"",small:"modal-dialog-sm"},u={template:a,animate:!0,close:!0,modal:!0,shortcuts:!0,footer:!1,content:"",className:"",title:!1,size:"medium"},a=n.template('<div class="modal <% if (animate) { %> fade <% } %> <%- className %>"><div class="modal-dialog <% if (size) { %><%- SIZE_CLASS_LOOKUP[size] %><% } %>"><div class="modal-content"><% if (title || close) { %><div class="modal-header"><% if (close) { %><a href="javascript: void 0;" class="c-close c-hide-text" data-dismiss="modal">'+n.escape(r._("close this window"))+"</a>"+"<% } %>"+"<% if (title) { %>"+"<%= title %>"+"<% } %>"+"</div>"+"<% } %>"+'<div class="modal-body">'+"<%= content %>"+"</div>"+"<% if (footer) { %>"+'<div class="modal-footer">'+"<%= footer %>"+"</div>"+"<% } %>"+"</div>"+"</div>"+"</div>"),f=e.Popup=function(e){e=n.extend({},u,e,{SIZE_CLASS_LOOKUP:o});var r=a(e),i=this.listener=t({}),s=this.$=t(r);s.modal({show:!1,backdrop:!!e.modal,keyboard:e.shortcuts}),[["show.bs.modal","show.r.popup"],["shown.bs.modal","opened.r.popup"],["hide.bs.modal","hide.r.popup"],["hidden.bs.modal","closed.r.popup"]].forEach(function(e){s.on(e[0],function(){i.trigger(e[1])})}),s.attr("tabindex",s.attr("tabindex")||0)};["show","hide","toggle"].forEach(function(e){f.prototype[e]=function(){this.$.modal(e)}}),[["on","on"],["once","one"],["off","off"]].forEach(function(e){f.prototype[e[0]]=function(){this.listener[e[1]].apply(this.listener,arguments)}})}((this.r=this.r||{})&&(r.ui=r.ui||{}),this.jQuery,this._,this),r.login={post:function(e,t){var n=$('input[name="user"]',e.$el).val(),i=r.config.https_endpoint||"http://"+r.config.ajax_domain,s=i+"/api/"+t+"/"+n;if(r.config.currentOrigin==i||$.support.cors){var o=e.serialize();return o.push({name:"api_type",value:"json"}),$.ajax({url:s,type:"POST",dataType:"json",data:o,xhrFields:{withCredentials:!0}})}var u=$("<iframe>"),a=e.$el.clone(!0),f=("resp"+Math.random()).replace(".","");u.css("display","none").attr("name",f).appendTo("body"),u[0].contentWindow.name=f,a.unbind().css("display","none").attr("action",s).attr("target",f).appendTo("body"),$("<input>").attr({type:"hidden",name:"api_type",value:"json"}).appendTo(a),$("<input>").attr({type:"hidden",name:"hoist",value:r.login.hoist.type}).appendTo(a);var l=r.login.hoist.watch(t);return r.config.debug||l.done(function(){u.remove(),a.remove()}),a.submit(),l}},r.login.hoist={type:"cookie",watch:function(e){var t="hoist_"+e,n=new $.Deferred,i=setInterval(function(){data=$.cookie(t);if(data){try{data=JSON.parse(data)}catch(e){data=null}$.cookie(t,null,{domain:r.config.cur_domain,path:"/"}),clearInterval(i),n.resolve(data)}},100);return n}},r.login.ui={init:function(){r.config.logged||($(".content .login-form, .content #login-form, .side .login-form").each(function(e,t){new r.ui.LoginForm(t)}),$(".content .register-form, .content #register-form").each(function(e,t){new r.ui.RegisterForm(t)}),this.popup=new r.ui.LoginPopup,$(document).delegate(".login-required","click",$.proxy(this,"loginRequiredAction")))},_getActionDetails:function(e){var t=$(e);return t.hasClass("up")?{eventName:"upvote",description:r._("You need to be logged in to upvote things.")}:t.hasClass("down")?{eventName:"downvote",description:r._("You need to be logged in to downvote things.")}:t.hasClass("arrow")?{eventName:"arrow",description:r._("You need to be logged in to vote on things.")}:t.hasClass("give-gold")?{eventName:"give-gold",description:r._("You need to be logged in to give gold.")}:t.parents("#header").length&&t.attr("href").indexOf("login")!==-1?{eventName:"login-or-register"}:t.parents(".subscribe-button").length?{eventName:"subscribe-button",description:r._("You need to be logged in to subscribe to subreddits.")}:t.parents(".submit-link").length?{eventName:"submit-link",description:r._("You need to be logged in to submit things.")}:t.parents(".submit-text").length?{eventName:"submit-text",description:r._("You need to be logged in to submit things.")}:{eventName:t.attr("class"),description:r._("You need to be logged in to do that.")}},loginRequiredAction:function(e){if(r.config.logged)return!0;var t=$(e.target),n=t.attr("href"),i=this._getActionDetails(t),s;if(n&&n!="#"&&!/\/login\/?$/.test(n))s=n;else{var o=t.thing();o.length&&(s=o.find(".comments").attr("href"))}return this.popup.showLogin(i.description,s&&$.proxy(function(e){window.location=s},this)),r.analytics.fireGAEvent("login-required-popup","opened",i.eventName),!1}},r.ui.LoginForm=function(){r.ui.Form.apply(this,arguments)},r.ui.LoginForm.prototype=$.extend(new r.ui.Form,{showErrors:function(e){r.ui.Form.prototype.showErrors.call(this,e),e.length&&this.$el.find(".recover-password").addClass("attention")},showStatus:function(){this.$el.find(".error").css("opacity",1),r.ui.Form.prototype.showStatus.apply(this,arguments)},resetErrors:function(){if(this.$el.hasClass("login-form-side")){var e=this.$el.find(".error");e.is(":visible")&&e.fadeTo(100,.35)}else r.ui.Form.prototype.resetErrors.apply(this,arguments)},_submit:function(){return r.analytics.fireGAEvent("login-form","submit"),r.login.post(this,"login")},_handleResult:function(e){if(!e.json.errors.length)if(this.successCallback)this.successCallback(e);else{this.$el.addClass("working");var t=r.config.extension?"/."+r.config.extension:"/",n=/\/login\/?$/.test($.url().attr("path"))?t:window.location,i=this.$el.find('input[name="dest"]').val(),s=i||n;window.location===s?window.location.reload():window.location=s}else r.ui.Form.prototype._handleResult.call(this,e)},_handleNetError:function(e){r.ui.Form.prototype._handleNetError.apply(this,arguments),e.status==0&&r.config.currentOrigin!=r.config.https_endpoint&&$("<p>").append($("<a>").text(r._("try using our secure login form.")).attr("href",r.config.https_endpoint+"/login")).appendTo(this.$el.find(".status"))},focus:function(){this.$el.find('input[name="user"]').focus()}}),r.ui.RegisterForm=function(){r.ui.Form.apply(this,arguments),this.$user=this.$el.find('[name="user"]'),this.$user.is("[data-validate-url]")||(this.checkUsernameDebounced=_.debounce($.proxy(this,"checkUsername"),500),this.$user.on("keyup",$.proxy(this,"usernameChanged"))),this.$el.find('[name="passwd2"]').on("keyup",$.proxy(this,"checkPasswordMatch")),this.$el.find('[name="passwd"][data-validate-url]').strengthMeter({related:["#user_reg","#email_reg"],delay:0,trigger:"loaded.validator"}).on("score.strengthMeter",function(e,t){var n=$(this);if(n.stateify("getCurrentState")==="error")return;var i;t>90?i=r._("Password is strong"):t>70?i=r._("Password is good"):t>30?i=r._("Password is fair"):i=r._("Password is weak"),n.stateify("showMessage",i)}),this.$submit=this.$el.find(".submit button")},r.ui.RegisterForm.prototype=$.extend(new r.ui.Form,{maxName:0,usernameChanged:function(){var e=this.$user.val();if(e==this._priorName)return;this._priorName=e,this.$el.find(".error.field-user").hide(),this.$el.removeClass("name-checking name-available name-taken"),this.maxName=Math.max(this.maxName,e.length),e&&this.maxName>=3&&(this.$el.addClass("name-checking"),this.checkUsernameDebounced()),this.$submit.attr("disabled",!1)},checkPasswordMatch:_.debounce(function(){var e=this.$el.find('[name="passwd2"]'),t=this.$el.find('[name="passwd"]'),n=e.val(),i=t.val();if(!n||t.stateify("getCurrentState")!=="success"){e.stateify("clear");return}n===i?e.stateify("set","success"):e.stateify("set","error",r._("passwords do not match"))},$.fn.validator.Constructor.DEFAULTS.delay),checkUsername:function(){var e=this.$user.val();e?$.ajax({url:"/api/username_available.json",data:{user:e},success:$.proxy(this,"displayUsernameStatus"),complete:$.proxy(function(){this.$el.removeClass("name-checking")},this)}):this.$el.removeClass("name-available name-taken")},displayUsernameStatus:function(e){e.json&&e.json.errors?(this.showErrors(e.json.errors),this.$submit.attr("disabled",!0)):(this.$el.addClass(e?"name-available":"name-taken"),this.$submit.attr("disabled",e==0))},_submit:function(){return r.analytics.fireGAEvent("register-form","submit"),r.login.post(this,"register")},_handleResult:r.ui.LoginForm.prototype._handleResult,focus:r.ui.LoginForm.prototype.focus}),r.ui.LoginPopup=function(){var e=$("#login-popup").prop("innerHTML");r.ui.Popup.call(this,{size:"large",content:e,className:"login-modal"}),this.login=new r.ui.LoginForm(this.$.find("#login-form")),this.register=new r.ui.RegisterForm(this.$.find("#register-form"))},r.ui.LoginPopup.prototype=_.extend({},r.ui.Popup.prototype,{show:function(e,t){return this.login.successCallback=t,this.register.successCallback=t,this.$.find("#cover-msg").text(e).toggle(!!e),r.ui.Popup.prototype.show.call(this),!1},showLogin:function(){var e=this.login;this.show.apply(this,arguments),this.once("opened.r.popup",function(){e.focus()})},showRegister:function(){var e=this.register;this.show.apply(this,arguments),this.once("opened.r.popup",function(){e.focus()})}}),!function(e){e.locked={},_.extend(e.locked,{init:function(){$("body").on("click",".locked-error",this._handleClick)},getPopup:function(){if(this._popup)return this._popup;var t=$("#locked-popup").html(),n=new e.ui.Popup({size:"large",content:t,className:"locked-error-modal"});return n.$.on("click",".interstitial .c-btn",this._handleModalClick),this._popup=n,n},_handleClick:function(n){if(e.access.isLinkRestricted(n.target))return;return this.getPopup().show(),!1}.bind(e.locked),_handleModalClick:function(t){return this.getPopup().hide(),!1}.bind(e.locked)})}(r),!function(e){e.timeouts={},_.extend(e.timeouts,{init:function(){$("body").on("click",".access-required",this._handleClick),$(".access-required").removeAttr("onclick"),$("body.comments-page").on("focus",".usertext.cloneable textarea",function(t){$(this).blur(),e.timeouts._handleClick(t)}),$("body.comments-page").on("submit","form.usertext.cloneable",this._handleClick),$("body.comments-page form.usertext.cloneable").removeAttr("onsubmit");var t=e.access.isLinkRestricted;e.access.isLinkRestricted=function(n){return e.timeouts.isLinkRestricted(n)||t(n)}},getPopup:function(){if(this._popup)return this._popup;var t=$("#access-popup").html(),n=new e.ui.Popup({size:"large",content:t,className:"access-denied-modal"});return n.$.on("click",".interstitial .c-btn",this._handleModalClick),this._popup=n,n},_logEvent:function(t){var n=$(t.target),i=n.thing(),s=n.data("type")||i.data("type"),o=n.data("fullname")||i.data("fullname"),u=n.data("event-action"),a=n.data("event-detail");u||(u="modal",a=null),!o&&s=="subreddit"?o=e.config.cur_site:!o&&s=="link"&&(o=e.config.cur_link),e.analytics.event.timeoutForbiddenEvent(u,a,s,o)},_handleClick:function(t){return this.getPopup().show(),this._logEvent(t),!1}.bind(e.timeouts),_handleModalClick:function(t){return this.getPopup().hide(),!1}.bind(e.timeouts),isLinkRestricted:function(t){return $(t).hasClass("access-required")&&e.config.user_in_timeout}}),e.access.initHook(function(){if(!e.config.user_in_timeout)return;e.timeouts.init()})}(r),r.newsletter={post:function(e){var t=$('input[name="email"]',e.$el).val(),n=e.$el.attr("action"),i=e.serialize();return i.push({name:"api_type",value:"json"}),r.ajax({url:n,type:"POST",dataType:"json",data:i,xhrFields:{withCredentials:!0}})}},r.newsletter.ui={_setupNewsletterBar:function(){var e=!!store.safeGet("newsletterbar.seen");if(e||r.ui.isSmallScreen())return;$(".newsletterbar").show(),$(".newsletter-close").on("click",function(){$(".newsletterbar").hide()}),store.safeSet("newsletterbar.seen",!0)},_setupNewsletter:function(){if(!$("body").hasClass("newsletter"))return;$(".faq-toggle").click(function(e){e.preventDefault(),$(this).toggleClass("active"),$(".faq").slideToggle(),r.analytics.fireGAEvent("newsletter-form","faq-toggle")})},init:function(){$(".newsletter-signup").each(function(e,t){new r.newsletter.ui.NewsletterForm(t)}),this._setupNewsletterBar(),this._setupNewsletter()}},r.newsletter.ui.NewsletterForm=function(){r.ui.Form.apply(this,arguments)},r.newsletter.ui.NewsletterForm.prototype=$.extend(new r.ui.Form,{showStatus:function(){this.$el.find(".error").css("opacity",1),r.ui.Form.prototype.showStatus.apply(this,arguments)},_submit:function(){return r.analytics.fireGAEvent("newsletter-form","submit"),r.newsletter.post(this)},_showSuccess:function(){var e=this.$el.parents(".newsletter-container");e.find(".result-message").text(r._("check your inbox to confirm your subscription")),e.addClass("success"),e.find("header").fadeTo(250,1)},_handleResult:function(e){if(e.json.errors.length)return r.ui.Form.prototype._handleResult.call(this,e);var t=this.$el.parents(".newsletter-container");t.find("header, form").fadeTo(250,0,function(){this._showSuccess()}.bind(this))}}),$(function(){function e(e){$(e).parent().parent().addClass("edited"),$(e).parent().parent().find(".status").empty()}function t(){$(this).data("saved")!=$(this).val()&&e(this)}function n(e){return e.preventDefault(),post_form(this.parentNode,e.data.action)}function i(){e(this)}function s(e){return e.preventDefault(),$(this).removeClass("edited"),post_form(this,e.data.action)}function o(){return open_menu(this),$(this).addClass("active"),!1}function u(e){return e.data("name")?{name:e.data("name")}:{link:e.thing_id()}}function a(e){$(".flairselector li").removeClass("selected"),$(this).addClass("selected");var t=$(this).parent().parent().siblings("form")[0];$(t).children('input[name="flair_template_id"]').val(this.id);var n=$(t).children(".customizer"),r=n.children("input");$(this).hasClass("texteditable")?(n.addClass("texteditable"),r.removeAttr("disabled"),r.css("display","block"),r.val($.trim($(this).find(".flair, .linkflairlabel").text())).select(),r.keyup(function(){$(".flairselection .flair, .flairselection .linkflairlabel").text($(r).val()).attr("title",$(r).val())})):(n.removeClass("texteditable"),r.attr("disabled","disabled").hide());var i=$(".flairselector .flairremove").detach();return $(".flairselection").html($(this).first().children().clone()).append(i),$(".flairselector .flairremove").css("display","inline-block"),!1}function f(e){var t=$(this).parent().parent();$(t).children('input[name="flair_template_id"]').val(""),$(t).children(".customizer").hide();var n=$(".flairselector .flairremove").detach();$(n).hide(),$(".flairselector li").removeClass("selected"),$(".flairselection").empty().append(n)}function l(e){$(this).find(".status").html(r.config.status_msg.submitting).show();var t=$(this.parentNode.parentNode).find(".flairselectbtn");return simple_post_form(this,"selectflair",u(t)),!1}function c(e){function i(e){var t=1,n=3,r=150,i=10,s=$(e).children().length,o=Math.max(t,Math.min(n,Math.ceil(s/i))),u=Math.ceil(s/o),a=Math.max(r,$(e).width());$(e).width(a);if(o>1){$(e).css("float","left");var f=o*u-s;for(var l=1;l<o;l++){var c=u;l<=f&&c--;var h=s-c;s-=c;var p=$(e).children().slice(h).remove();$(p).width(a),$(e).after($("<ul>").css("float","left").append(p))}}return o*(a+5)+50}function s(e){$(n).html(e);var r=$(".flairselector ul"),s=Math.max(200,r.length?i(r):$(".error").width()+20),o=Math.max(100,$(t).position().left+$(t).width()-s);$(n).height("auto").width(s).css("left",o+"px").click(!1).find(".flairselection").click(!1).end().find("form").click(function(e){e.stopPropagation()}).submit(l).end().find(".customizer input"
).attr("disabled","disabled").end().find("li.selected").each(a).end().find("li:not(.error)").click(a).end().find(".flairremove").click(f).end()}if(r.access.isLinkRestricted(e.target))return!1;close_menus(e);var t=this,n=$(t).siblings(".flairselector")[0];$(n).html('<img class="flairthrobber" src="'+r.utils.staticURL("throbber.gif")+'" />').addClass("active").height(18).width(18).css("padding-left",4).css("padding-top",4).css("padding-bottom",4).css("padding-right",4).css("left",$(t).position().left+$(t).width()-18+"px").css("top",$(t).position().top+"px");var o=u($(this));return $.request("flairselector",o,s,!0,"html"),!1}$("#tabbedpane-grant").on("submit",".flair-entry",{action:"flair"},s),$("#tabbedpane-grant").on("click",".flairdeletebtn",{action:"deleteflair"},n),$("#tabbedpane-templates, #tabbedpane-link_templates").on("submit",".flair-entry",{action:"flairtemplate"},s),$("form.clearflairtemplates").on("submit",{action:"clearflairtemplates"},s),$(".flairlist").on("focus",".flaircell input",i).on("keyup",".flaircell input",t).on("change",".flaircell input",t).on("click",".flairtemplate .flairdeletebtn",{action:"deleteflairtemplate"},n),$(".flairtoggle").submit(function(){return post_form(this,"setflairenabled")}),$(".flairtoggle input").change(function(){$(this).parent().submit()}),$(document).on("click",".tagline .flairselectbtn, .thing .flairselectbtn",c),$(".flairselector .dropdown").click(o)}),$(function(){function e(){var e=$(this).closest(".reportform");return e.toggleClass("active"),!1}function t(){var e=$(this).closest(".reportform"),t=e.find('[type="submit"]'),n=e.find("[name=reason]:checked"),r=e.find('[name="other_reason"]'),i=n.val()==="other";return t.removeAttr("disabled"),i?r.removeAttr("disabled").focus():r.attr("disabled","disabled"),!1}function n(e){return{thing:e.thing_id()}}function i(e){function s(e){i.html(e);var t=i.children("form");t.css("display","block")}if(r.access.isLinkRestricted(e.target))return!1;var t=$(this).closest(".flat-list"),i=t.siblings(".reportform").eq(0);i.toggleClass("active");if(!i.hasClass("active"))return;i.html('<img class="flairthrobber" />');var o=i.children("img");o.attr("src",r.utils.staticURL("throbber.gif"));var u=n($(this));return $.request("report_form",u,s,!0,"html",!0),!1}$("div.content").on("click",".tagline .reportbtn, .thing .reportbtn",i),$("div.content").on("click",".btn.report-cancel",e),$("div.content").on("change","input[name='reason']",t)}),r.interestbar={init:function(){new r.ui.InterestBar($(".sr-interest-bar"))}},r.ui.InterestBar=function(){r.ui.Base.apply(this,arguments),this.$query=this.$el.find(".query"),this.queryChangedDebounced=_.debounce($.proxy(this,"queryChanged"),500),this.$query.on("keyup",$.proxy(this,"keyPressed")),this.$query.on("focus",$.proxy(function(){this.$el.addClass("focus")},this)).on("blur",$.proxy(function(){this.$el.removeClass("focus")},this))},r.ui.InterestBar.prototype={keyPressed:function(){var e=this.$query.val();e=$.trim(e);if(e==this._lastQuery)return;this._lastQuery=e,this.queryChangedDebounced(e),e&&e.length>1?this.$el.addClass("working"):(this.hideResults(),this.$el.removeClass("working error"))},queryChanged:function(e){e&&e.length>1&&$.ajax({url:"/api/subreddits_by_topic.json",data:{query:e},success:$.proxy(this,"displayResults"),error:$.proxy(this,"displayError")})},displayResults:function(e){this.$el.removeClass("working error");var t=this.$el.find(".results li:first"),n=this.$el.find(".results li:last"),r=_.template('<li><a href="/r/<%= name %>" target="_blank">/r/<%= name %></a></li>');this.$el.find(".results").empty().append(t).append(_.map(e,r).join("")).append(n).slideDown(150)},hideResults:function(){this.$el.find(".results").slideUp(150)},displayError:function(e){this.$el.removeClass("working").addClass("error").find(".error-caption").text(r._("an error occurred. please try again later! (status: %(status)s)").format({status:e.status})),this.hideResults()}},r.visited={key:"visited",init:function(){this.sendVisits=_.throttle(this._sendVisits,100),r.config.logged&&r.config.store_visits&&($(".content").on("click mousedown keydown",".link:not(.visited) a.title, .link:not(.visited) a.thumbnail",_.bind(this.onVisit,this)),$(".content").on("visit",".link:not(.visited)",_.bind(this.onVisit,this)),this.sendVisits())},onVisit:function(e){if(e.type==="keydown"&&e.which!==13)return;if(e.type==="mousedown")if(e.which===1||e.which===3)return;if(e.type==="click"&&e.which!==1)return;this.storeVisit($(e.target).closest(".thing").data("fullname")),this.sendVisits()},storeVisit:function(e){var t=store.safeGet(this.key)||[];t.push(e),store.safeSet(this.key,t)},_sendVisits:function(){var e=store.safeGet(this.key)||[];if(!e.length)return;e=_.last(_.uniq(e),100),r.ajax({type:"POST",url:"/api/store_visits",data:{links:e.join(",")}}),store.safeSet(this.key,[]),$.things.apply($,e).addClass("visited")}},r.wiki={request:function(e){r.config.logged&&(e.data.uh=r.config.modhash),e.data.page=r.config.wiki_page,$.ajax(e)},baseApiUrl:function(){return r.wiki.baseUrl(!0)},baseUrl:function(e){var t="";return e&&(t+="/api"),t+="/wiki",r.config.is_fake||(t="/r/"+r.config.post_site+t),t},init:function(){$("body.wiki-page").on("click",".revision_hide",this.toggleHide),$("body.wiki-page").on("click",".revision_delete",this.toggleDelete),$("body.wiki-page").on("click",".toggle-source",this.toggleSource)},toggleSource:function(e){e.preventDefault(),$(".wiki-page .source").toggle("slow")},toggleDelete:function(e){e.preventDefault();var t=$(this),n=r.wiki.baseApiUrl()+"/delete",i=t.parents(".revision"),s=i.hasClass("deleted");i.toggleClass("deleted"),r.wiki.request({url:n,type:"POST",dataType:"json",data:{revision:t.data("revision"),deleted:!s},error:function(){i.toggleClass("deleted")},success:function(e){e.status?i.addClass("deleted"):i.removeClass("deleted")}})},toggleHide:function(e){e.preventDefault();if(r.access.isLinkRestricted(this))return;var t=$(this),n=r.wiki.baseApiUrl()+"/hide",i=t.parents(".revision");i.toggleClass("hidden"),r.wiki.request({url:n,type:"POST",dataType:"json",data:{revision:t.data("revision")},error:function(){i.toggleClass("hidden")},success:function(e){e.status?i.addClass("hidden"):i.removeClass("hidden")}})},addUser:function(e){e.preventDefault(),$("#usereditallowerror").hide();var t=$(e.target),n=r.wiki.baseApiUrl()+"/alloweditor/add";r.wiki.request({url:n,type:"POST",data:{username:t.find('[name="username"]').val()},dataType:"json",error:function(){$("#usereditallowerror").show()},success:function(e){location.reload()}})},submitEdit:function(e){e.preventDefault();var t=$(e.target),n=r.wiki.baseApiUrl()+"/edit",s=$("#wiki_edit_conflict"),o=$("#wiki_special_error");s.hide(),o.hide(),params=r.utils.serializeForm(t),$("#wiki_save_button").attr("disabled",!0),t.addClass("working"),r.wiki.request({url:n,type:"POST",dataType:"json",data:params,error:function(){t.removeClass("working"),$("#wiki_save_button").removeAttr("disabled")},success:function(){window.location=r.wiki.baseUrl()+"/"+r.config.wiki_page},statusCode:{409:function(e){var n=JSON.parse(e.responseText),r=t.children("#wiki_page_content"),i=s.children("#yourdiff");s.children("#youredit").val(r.val()),i.html($.unsafe(n.diffcontent)),t.children("#previous").val(n.newrevision),r.val(n.newcontent),s.fadeIn("slow")},415:function(e){var t=JSON.parse(e.responseText).special_errors,n=o.children("#specials");n.empty();for(i in t)n.append($("<pre>").text($.unsafe(t[i])));o.fadeIn("slow")},429:function(e){var t=JSON.parse(e.responseText).message,n=o.children("#specials");n.empty(),n.text(t),o.fadeIn("slow")}}})},goCompare:function(){v1=$("input:radio[name=v1]:checked").val(),v2=$("input:radio[name=v2]:checked").val(),url=r.wiki.baseUrl()+"/"+r.config.wiki_page+"?v="+v1,v2!=v1&&(url+="&v2="+v2),window.location=url},helpon:function(e){$(e).parents("form").children(".markhelp:first").show()},helpoff:function(e){$(e).parents("form").children(".markhelp:first").hide()}},r.apps={init:function(){$(".authorized-app").delegate(".app-permissions li","mouseover mouseout",function(e){e.type=="mouseover"?$(this).find(".app-scope").show():$(this).find(".app-scope").hide()}),$("#developed-apps").delegate(".edit-app-button","click",function(){$(this).toggleClass("collapsed").closest(".developed-app").removeClass("collapsed").find(".app-developers").remove().end().find(".edit-app").slideToggle().removeClass("collapsed").end()}).delegate(".edit-app-icon-button","click",function(){$(this).toggleClass("collapsed").closest(".developed-app").find(".ajax-upload-form").show()}),$("#create-app-button").click(function(){$(this).hide(),$("#create-app").fadeIn()})},revoked:function(e,t){$(e).closest(".authorized-app").fadeOut()},deleted:function(e,t){$(e).closest(".developed-app").fadeOut()}},r.gold={_inlineGilding:!1,_googleCheckoutAnalyticsLoaded:!1,init:function(){$("div.content").on("click",'[name="message"]',this._toggleGiftMessage.bind(this)),$("div.content").on("click","a.give-gold, .gold-payment .close-button",this._toggleThingGoldForm.bind(this)),$("div.content").on("click",".gold-button",this._setGildingProperties.bind(this)),$(".stripe-gold").click(function(){$("#stripe-payment").slideToggle()}),$("#stripe-payment.charge .stripe-submit").on("click",function(){r.gold.tokenThenPost("stripecharge/gold")}),$("#stripe-payment.modify .stripe-submit").on("click",function(){r.gold.tokenThenPost("modify_subscription")}),$("h3.toggle").on("click",function(){$(this).toggleClass("toggled"),$(this).siblings(".details").slideToggle()}),$("dt.toggle").on("click",function(){$(this).toggleClass("toggled"),$(this).next("dd").slideToggle()}),$("body").hasClass("gold-signup")&&r.gold.signupForm.init(),$("form.creddits-gold .remaining").each(r.gold._renderCredditsAmount),$(document.body).on("submit","form.creddits-gold",function(e){return e.preventDefault(),e.stopPropagation(),r.gold._expendCreddits(),$(this).find(".gold-checkout:not(.creddits-gold)").hide(),post_form(this,"spendcreddits")})},_toggleGiftMessage:function(e){var t=e.target,n=t.checked,r=$(e.target).parents(".gold-form").find('[name="giftmessage"]').attr("id"),i=$("#"+r);i.toggleClass("hidden",!n)},_toggleThingGoldForm:function(e){if(r.access.isLinkRestricted(e.target))return;var t=$(e.target),n=t.thing(),i=t.thing_id(),s="gold_wrap_"+i,o=$("#"+s),u;if(o.length)return o.toggle(),!1;this._inlineGilding=!0,r.analytics.fireFunnelEvent("gold","open-inline-form",{tracker:"goldTracker"}),this._googleCheckoutAnalyticsLoaded||($.getScript("//checkout.google.com/files/digital/ga_post.js"),this._googleCheckoutAnalyticsLoaded=!0),n.hasClass("link")?u="cloneable-link":u="cloneable-comment";var a=$(".gold-wrap."+u+":first").clone(),f=a.find(".gold-form"),l=t.thing().find(".entry .author:first").text(),c=f.find(".passthrough"),h=f.find('[name="cbbaseurl"]').val(),p=!f.find('[name="signed"]').is(":checked");a.removeClass(u).addClass("inline-gold").prop("id",s),f.find("p:first-child em").text(l),f.find("button").attr("disabled",""),c.val(""),t.new_thing_child(a);var d=setTimeout(function(){f.addClass("working"),f.find("button").addClass("disabled")},200);return $.request("generate_payment_blob.json",{thing:i,signed:p},function(e){clearTimeout(d),f.removeClass("working"),c.val(e),f.find(".stripe-gold").on("click",function(){window.open("/gold/creditgild/"+e)}),f.find(".coinbase-gold").on("click",function(){window.open(h+"?c="+e)}),f.find("button").removeAttr("disabled").removeClass("disabled")}),!1},_setGildingProperties:function(e){var t=$(e.target),n=t.thing_id();if(!n){t.parents("form").submit();return}var i="gold_wrap_"+n,s=$("#"+i),o=s.find(".passthrough"),u=o.val(),a=!s.find('[name="signed"]').is(":checked"),f=s.find('[name="message"]').is(":checked"),l="";f&&(l=s.find('[name="giftmessage"]').val());if(this._inlineGilding){var c={label:t.closest("[data-vendor]").data("vendor"),tracker:"goldTracker"};r.analytics.fireFunnelEvent("gold","checkout",c)}$.request("modify_payment_blob.json",{code:u,signed:a,message:l},function(){t.parents("form").submit()})},_expendCreddits:function(){$(".cloneable-comment, .cloneable-link").find("form.creddits-gold .remaining").each(function(){var e=$(this),t=parseInt(e.data("current"),10),n=parseInt(e.data("total"),10),i=n-t;i<t?e.parents("form.creddits-gold").remove():($(this).data("total",i),r.gold._renderCredditsAmount.apply(this))})},_renderCredditsAmount:function(){var e=$(this),t=e.data("template");e.html(_.template(t,_.omit(e.data(),"template")))},gildThing:function(e,t,n){var r=$(".id-"+e);if(!r.length){console.log("couldn't gild thing "+e);return}var i=r.children(".entry").find("p.tagline"),s=i.find(".gilded-icon"),o;n!=null?o=n:(o=s.data("count")||0,o++),r.addClass("gilded user-gilded"),s.length||(s=$("<span>").addClass("gilded-icon"),i.append(s)),s.attr("title",t).data("count",o),o>1&&s.text("x"+o),r.children(".entry").find(".give-gold").parent().remove()},tokenThenPost:function(e){var t=function(t,n){var r=$("#stripe-payment"),i=r.find(".stripe-submit"),s=r.find(".status"),o=r.find('[name="stripeToken"]');n.error?(i.removeAttr("disabled"),s.html(n.error.message)):(o.val(n.id),post_form(r,e))};r.gold.makeStripeToken(t)},makeStripeToken:function(e){var t=$("#stripe-payment"),n=t.find('[name="stripePublicKey"]').val(),i=t.find(".stripe-submit"),s=t.find(".status"),o=t.find('[name="stripeToken"]'),u=t.find(".card-name").val(),a=t.find(".card-number").val(),f=t.find(".card-cvc").val(),l=t.find(".card-expiry-month").val(),c=t.find(".card-expiry-year").val(),h=t.find(".card-address_line1").val(),p=t.find(".card-address_line2").val(),d=t.find(".card-address_city").val(),v=t.find(".card-address_state").val(),m=t.find(".card-address_country").val(),g=t.find(".card-address_zip").val();Stripe.setPublishableKey(n);var y=function(e,n){t.find(".status").addClass("error").text(n),$(e).focus()};return u?Stripe.validateCardNumber(a)?Stripe.validateExpiry(l,c)?Stripe.validateCVC(f)?h?d?m?(s.removeClass("error").text(r.config.status_msg.submitting),i.attr("disabled","disabled"),Stripe.createToken({name:u,number:a,cvc:f,exp_month:l,exp_year:c,address_line1:h,address_line2:p,address_city:d,address_state:v,address_country:m,address_zip:g},e)):y(".card-address_country",r._("missing country")):y(".card-address_city",r._("missing city")):y(".card-address_line1",r._("missing address")):y(".card-cvc",r._("invalid cvc")):y(".card-expiry-month",r._("invalid expiration date")):y(".card-number",r._("invalid credit card number")):y(".card-name",r._("missing name")),!1}},r.gold.signupForm=function(){function e(){var e=$("#goldtype").val(),t=["goldtype"];switch(e){case"autorenew":t.push("period");break;case"onetime":t.push("months");break;case"code":t.push("months","email");break;case"gift":t.push("months","recipient","signed","giftmessage");break;case"creddits":t.push("num_creddits")}return t}function t(e){var t=$(e);if(t.is(":radio")&&!t.is(":checked"))throw"Unchecked radio button has no value";return t.is(":checkbox")?value=t.is(":checked")?t.val():null:t.is("select")?value=t.find("option:selected").val():value=t.val(),value}function n(){var n=$("<a />").get(0),r=e(),i={};if(!("replaceState"in window.history))return;$("form.gold-form").find(":input").each(function(){var e=$(this);if(!_.contains(r,this.name))return;try{i[this.name]=t(this)}catch(n){return}}),i.edit=!0,n.href=window.location.href,n.search=$.param(i),window.history.replaceState({},"",n.href)}function r(){var e=$('input[name="gifttype"]:checked'),t=$(".tab.active"),r=$("#gift").is(":checked"),i;t.prop("id")=="autorenew"?i="autorenew":t.prop("id")=="creddits"?i="creddits":r&&e.length>0?i=e.val():i="onetime",$("#goldtype").val(i),n()}function i(e){$("#form-options, #payment-options").show(),$(".active").removeClass("active"),$("#redeem-a-code, .question").hide(),$(e).addClass("active"),$(e.hash).addClass("active"),r()}function s(t){t.stopPropagation(),t.preventDefault(),$("#giftmessage, #recipient").each(function(){var e=$(this);e.val()===e.attr("placeholder")&&e.val("")});var n=$("form.gold-form").serializeArray(),r=_.object(_.pluck(n,"name"),_.pluck(n,"value")),i=_.pick(r,e());window.location="/gold/payment?"+$.param(i)}function o(){var e=$("form.gold-form");$("a.tab-toggle").on("click",function(e){e.stopPropagation(),e.preventDefault(),i(this)}),$('input[name="gift"]').change(function(){$("#gifting-details").slideToggle($(this).val()),r()}),$(".gold-dropdown").on("change",function(){$(this).find("[selected]").removeAttr("selected"),$(this).find(":selected").get(0).setAttribute("selected","selected")});var t="placeholder"in document.createElement("input");$('input[name="gifttype"]').change(function(){$("#gifttype-details-gift").toggleClass("hidden",this.value!=="gift"),t&&$("#gifttype-details-gift :input:eq(0)").focus(),r()}),$("#giftmessage").on("keyup",function(){$("#message").prop("checked",$(this).val()!=="")}),e.on("submit",s),e.find(":input").on("change",n),$('input[name="code"]').on("focus",function(){$(".redeem-submit").slideDown()})}return{init:o}}(),!function(e){e.gild_thing=function(t,n){r.gold.gildThing(t,n),e("#gold_wrap_"+t).fadeOut(400)}}(jQuery),r.multi={init:function(){this.multis=new r.multi.GlobalMultiCache,this.mine=new r.multi.MyMultiCollection,this.mine.fetch=_.throttle(this.mine.fetch,6e4);var e=$(".multi-details");if(e.length){var t=this.multis.touch(e.data("path"));t.fetch();var n=(new r.multi.MultiDetails({model:t,el:e})).render(),i=new r.multi.SubredditList({model:t,el:e});location.hash=="#created"&&n.focusAdd();var s=$("#multi-recs");s.length&&n.initRecommendations(s)}var o={};$(".subscribe-button").each(function(e,t){new r.multi.SubscribeButton({el:t,bubbleGroup:o})}),$(".listing-chooser").each(function(e,t){new r.multi.ListingChooser({el:t})})}},r.multi.MultiRedditList=Backbone.Collection.extend({model:Backbone.Model.extend({initialize:function(){this.id=this.get("name").toLowerCase()}}),comparator:function(e){return e.id},getByName:function(e){return this.get(e.toLowerCase())}}),r.multi.MultiReddit=Backbone.Model.extend({idAttribute:"path",url:function(){return r.utils.joinURLs("/api/multi",this.id)},defaults:{visibility:"private"},initialize:function(e,t){this.uncreated=t&&!!t.isNew,this.subreddits=new r.multi.MultiRedditList(this.get("subreddits"),{url:this.url()+"/r/",parse:!0}),this.on("change:subreddits",function(e,t){this.subreddits.set(t,{parse:!0})},this),this.subreddits.on("request",function(e,t,n){this.trigger("request",e,t,n)},this)},parse:function(e){return e.data},toJSON:function(){return data=Backbone.Model.prototype.toJSON.apply(this),data.subreddits=this.subreddits.toJSON(),data},isNew:function(){return this.uncreated},name:function(){return this.get("path").split("/").pop()},sync:function(e,t,n){var r=Backbone.sync.apply(this,arguments);return e=="create"&&r.done(_.bind(function(){this.uncreated=!1},this)),r},addSubreddit:function(e,t){e=r.utils.tup(e);if(e.length==1)this.subreddits.create({name:e[0]},t);else{var n=this.subreddits,i=n.clone();i.add(_.map(e,function(e){return{name:e}})),this.subreddits=i,this.save(null,t),this.subreddits=n}},removeSubreddit:function(e,t){this.subreddits.getByName(e).destroy(t)},_copyOp:function(e,t,n){var i=new $.Deferred;return Backbone.ajax({type:"POST",url:"/api/multi/"+e,data:{from:this.get("path"),to:t.pathByName(n)},success:_.bind(function(n){e=="rename"&&this.trigger("destroy",this,this.collection);var s=r.multi.multis.reify(n);t.add(s),i.resolve(s)},this),error:_.bind(i.reject,i)}),i},copyTo:function(e,t){return this._copyOp("copy",e,t)},renameTo:function(e,t){return this._copyOp("rename",e,t)},getSubredditNames:function(){return this.subreddits.pluck("name")}}),r.multi.MyMultiCollection=Backbone.Collection.extend({url:"/api/multi/mine",model:r.multi.MultiReddit,comparator:function(e){return e.get("path").toLowerCase()},parse:function(e){return _.map(e,function(e){return r.multi.multis.reify(e)})},pathByName:function(e){return"/user/"+r.config.logged+"/m/"+e}}),r.multi.GlobalMultiCache=Backbone.Collection.extend({model:r.multi.MultiReddit,touch:function(e){var t=this.get(e);return t||(t=new this.model({path:e}),this.add(t)),t},reify:function(e){var t=this.model.prototype.parse(e),n=this.touch(t.path);return n.set(t),n}}),r.multi.MultiSubredditItem=Backbone.View.extend({tagName:"li",template:_.template('<a href="/r/<%- sr_name %>">/r/<%- sr_name %></a><button class="remove-sr">x</button>'),events:{"click .remove-sr":"removeSubreddit"},render:function(){return this.$el.append(this.template({sr_name:this.model.get("name")})),r.config.logged&&(this.bubble=new r.multi.MultiSubscribeBubble({parent:this.$el,group:this.options.bubbleGroup,srName:this.model.get("name")})),this},remove:function(){this.bubble&&this.bubble.remove(),Backbone.View.prototype.remove.apply(this)},removeSubreddit:function(e){this.options.multi.removeSubreddit(this.model.get("name"))}}),r.multi.SubredditList=Backbone.View.extend({events:{"submit .add-sr":"addSubreddit"},initialize:function(){this.listenTo(this.model.subreddits,"add",this.addOne),this.listenTo(this.model.subreddits,"remove",this.removeOne),this.listenTo(this.model.subreddits,"sort",this.resort),new r.ui.ConfirmButton({el:this.$("button.delete")}),this.listenTo(this.model.subreddits,"add remove",function(){r.ui.showWorkingDeferred(this.$el,r.ui.refreshListing())}),this.model.on("request",function(e,t){r.ui.showWorkingDeferred(this.$el,t)},this),this.itemView=this.options.itemView||r.multi.MultiSubredditItem,this.itemViews={},this.bubbleGroup={},this.$(".subreddits").empty(),this.model.subreddits.each(this.addOne,this)},addOne:function(e){var t=new this.itemView({model:e,multi:this.model,bubbleGroup:this.bubbleGroup});this.itemViews[e.id]=t,this.$(".subreddits").append(t.render().$el)},resort:function(){this.model.subreddits.each(function(e){this.itemViews[e.id].$el.appendTo(this.$(".subreddits"))},this)},removeOne:function(e){this.itemViews[e.id].remove(),delete this.itemViews[e.id]},addSubreddit:function(e){e.preventDefault();var t=this.$(".add-sr .sr-name"),n=t.val();n=n.split(/[+,\-\s]+/),n=n.map(function(e){return e.replace(/^\/?r\//,"")}),n=_.compact(n);if(!n.length)return;t.val(""),this.$(".add-error").css("visibility","hidden"),this.model.addSubreddit(n,{wait:!0,success:_.bind(function(){this.$(".add-error").hide()},this),error:_.bind(function(e,t){var n=JSON.parse(t.responseText);this.$(".add-error").text(n.explanation).css("visibility","visible").show()},this)})}}),r.multi.MultiDetails=Backbone.View.extend({events:{'change [name="visibility"]':"setVisibility",'change [name="key_color"]':"setKeyColor",'change [name="icon_name"]':"setIconName","click .show-copy":"showCopyMulti","click .show-rename":"showRenameMulti","click .edit-description":"editDescription","click .edit-display-name":"editDisplayName","submit .description":"saveDescription","submit .display-name":"saveDisplayName","confirm .delete":"deleteMulti"},initialize:function(){this.listenTo(this.model,"change",this.render),this.listenTo(this.model.subreddits,"add remove reset",this.render),this.addBubble=new r.multi.MultiAddNoticeBubble({parent:this.$(".add-sr .sr-name"),trackHover:!1})},initRecommendations:function(e){var t=new r.recommend.RecommendationList;this.recsView=new r.recommend.RecommendationsView({collection:t,el:e}),this.model.subreddits.isEmpty()||t.fetchForSrs(this.model.getSubredditNames()),this.listenTo(this.model.subreddits,"add remove reset",function(){var e=this.model.getSubredditNames();t.fetchForSrs(e)}),this.recsView.bind("recs:select",function(e){this.model.addSubreddit(e.srName)},this)},render:function(){var e=this.model.get("can_edit");return e&&(this.model.subreddits.isEmpty()?this.addBubble.show():this.addBubble.hide()),this.$el.toggleClass("readonly",!e),this.$el.toggleClass("public",this.model.get("visibility")=="public"),this.model.has("description_html")&&this.$(".description .usertext-body").html(this.model.get("description_html")),this.$(".count").text(this.model.subreddits.length),this},setVisibility:function(){this.model.save({visibility:this.$('[name="visibility"]:checked').val()})},setKeyColor:function(){this.model.save({key_color:this.$('[name="key_color"]').val()})},setIconName:function(){this.model.save({icon_name:this.$('[name="icon_name"]').val()})},showCopyMulti:function(){this.$("form.rename-multi").hide();var e=this.$("form.copy-multi");e.show().find(".multi-name").val(this.model.name()).select().focus(),this.copyForm||(this.copyForm=new r.multi.MultiCopyForm({el:e,navOnCreate:!0,sourceMulti:this.model}))},showRenameMulti:function(){this.$("form.copy-multi").hide();var e=this.$("form.rename-multi");e.show().find(".multi-name").val(this.model.name()).select().focus(),this.renameForm||(this.renameForm=new r.multi.MultiRenameForm({el:e,navOnCreate:!0,sourceMulti:this.model}))},deleteMulti:function(){this.model.destroy({success:function(){window.location="/"}})},editDescription:function(){show_edit_usertext($(".description"))},saveDescription:function(e){e.preventDefault(),this.model.save({description_md:this.$(".description textarea").val()},{success:_.bind(function(){hide_edit_usertext($(".description"))},this)})},editDisplayName:function(){show_edit_usertext($(".display-name"))},saveDisplayName:function(e){e.preventDefault(),this.model.save({display_name:this.$(".display-name textarea").val()},{success:_.bind(function(){hide_edit_usertext($(".display-name"))},this)})},focusAdd:function(){this.$(".add-sr .sr-name").focus()}}),r.multi.MultiAddNoticeBubble=r.ui.Bubble.extend({className:"multi-add-notice hover-bubble anchor-right",template:_.template("<h3><%- awesomeness_goes_here %></h3><p><%- add_multi_sr %></p>"),render:function(){this.$el.html(this.template({awesomeness_goes_here:r._("awesomeness goes here"),add_multi_sr:r._("add a subreddit to your multi.")}))}}),r.multi.SubscribeButton=Backbone.View.extend({events:{mouseenter:"createBubble"},createBubble:function(){if(this.bubble)return;this.bubble=new r.multi.MultiSubscribeBubble({parent:this.$el,group:this.options.bubbleGroup,srName:String(this.$el.data("sr_name"))});var e=this.$el.data("bubble_class");e&&(this.bubble.$el.removeClass("anchor-right"),this.bubble.$el.addClass(e)),this.bubble.queueShow()}}),r.multi.MultiSubscribeBubble=r.ui.Bubble.extend({className:"multi-selector hover-bubble anchor-right",template:_.template('<div class="title"><strong><%- title %></strong><a class="sr" href="/r/<%- sr_name %>">/r/<%- sr_name %></a></div><div class="throbber"></div>'),itemTemplate:_.template('<label><input class="add-to-multi" type="checkbox" data-path="<%- path %>" <%- checked %>><%- name %><a href="<%- path %>" target="_blank" title="<%- open_multi %>">&rsaquo;</a></label>'),itemCreateTemplate:_.template('<label><form class="create-multi"><input type="text" class="multi-name" placeholder="<%- create_msg %>"><div class="error create-multi-error"></div></form></label>'),events:{"click .add-to-multi":"toggleSubscribed"},initialize:function(){this.listenTo(this,"show",this.load),this.listenTo(r.multi.mine,"reset add",_.debounce(this.render,100)),r.ui.Bubble.prototype.initialize.apply(this)},load:function(){r.ui.showWorkingDeferred(this.$el,r.multi.mine.fetch())},render:function(){this.$el.html(this.template({title:r._("categorize"),sr_name:this.options.srName}));var e=$('<div class="multi-list">');r.multi.mine.chain().sortBy(function(e){return e.subreddits.getByName(this.options.srName)},this).each(function(t){e.append(this.itemTemplate({name:t.get("name"),path:t.get("path"),checked:t.subreddits.getByName(this.options.srName)?"checked":"",open_multi:r._("open this multi")}))},this),e.append(this.itemCreateTemplate({create_msg:r._("create a new multi")})),this.$el.append(e),this.createForm=new r.multi.MultiCreateForm({el:this.$("form.create-multi")})},toggleSubscribed:function(e){var t=$(e.target),n=r.multi.mine.get(t.data("path"));t.is(":checked")?n.addSubreddit(this.options.srName):n.removeSubreddit(this.options.srName)}}),r.multi.MultiCreateForm=Backbone.View.extend({events:{submit:"createMulti"},createMulti:function(e){e.preventDefault();var t=this.$("input.multi-name").val();t=$.trim(t);if(!t)return;var n=this._createMulti(t);n.done(_.bind(function(e){this.trigger("create",e),this.options.navOnCreate&&(window.location=e.get("path")+"#created")},this)).fail(_.bind(function(e){var t=JSON.parse(e.responseText);this.showError(t.explanation)},this)),r.ui.showWorkingDeferred(this.$el,n)},_createMulti:function(e){var t=new r.multi.MultiReddit({path:r.multi.mine.pathByName(e)},{isNew:!0}),n=new $.Deferred;return r.multi.mine.create(t,{wait:!0,success:_.bind(n.resolve,n),error:function(e,t){n.reject(t)}}),n},showError:function(e){this.$(".error").text(_.unescape(e)).show()},focus:function(){this.$(".multi-name").focus()}}),r.multi.MultiCopyForm=r.multi.MultiCreateForm.extend({_createMulti:function(e){return this.options.sourceMulti.copyTo(r.multi.mine,e)}}),r.multi.MultiRenameForm=r.multi.MultiCopyForm.extend({_createMulti:function(e){return this.options.sourceMulti.renameTo(r.multi.mine,e)}}),r.multi.ListingChooser=Backbone.View.extend({events:{"click .create button":"createClick","click .grippy":"toggleCollapsed"},initialize:function(){this.$el.addClass("initialized"),store.safeGet("ui.collapse.listingchooser")==1&&this.toggleCollapsed(!0),store.safeSet("ui.collapse.listingchooser");var e=this.$(".contents").height(),t=$("body").height();e>t&&$("body").css("padding-bottom",e-t+100)},createClick:function(e){this.$(".create").is(".expanded")||(e.preventDefault(),this.$(".create").addClass("expanded"),this.createForm=new r.multi.MultiCreateForm({el:this.$(".create form"),navOnCreate:!0}),this.createForm.focus())},toggleCollapsed:function(e){$("body").toggleClass("listing-chooser-collapsed",e),Backbone.ajax({type:"POST",url:"/api/set_left_bar_collapsed.json",data:{collapsed:$("body").is(".listing-chooser-collapsed")}})}}),r.filter={},r.filter.init=function(){var e=$(".filtered-details");if(e.length){var t=new r.filter.Filter({path:e.data("path")});e.find(".subreddits a").each(function(e,n){t.subreddits.add({name:$(n).data("name")})}),t.fetch({error:_.bind(r.multi.mine.create,r.multi.mine,t,{wait:!0})});var n=(new r.multi.SubredditList({model:t,itemView:r.filter.FilteredSubredditItem,el:e})).render()}},r.filter.Filter=r.multi.MultiReddit.extend({url:function(){return r.utils.joinURLs("/api/filter",this.id)}}),r.filter.FilteredSubredditItem=r.multi.MultiSubredditItem.extend({render:function(){return this.$el.append(this.template({sr_name:this.model.get("name")})),this}}),r.recommend={init:function(){$(".explore-item").each(function(e,t){new r.recommend.ExploreItem({el:t})})}},r.recommend.Recommendation=Backbone.Model.extend(),r.recommend.RecommendationList=Backbone.Collection.extend({model:r.recommend.Recommendation,srNames:[],dismissed:[],fetchForSrs:function(e){if(!e.length){this.srNames=[],this.reset([]);return}this.srNames=e,this.fetchRecs()},fetchNewRecs:function(){var e=this.pluck("sr_name");this.dismissed=_.union(this.dismissed,e),this.fetchRecs()},fetchRecs:function(){var e="/api/recommend/sr/"+this.srNames.join(",");this.fetch({url:e,data:{omit:this.dismissed.join(",")},reset:!0,error:_.bind(function(){this.reset([])},this)})},clearHistory:function(){this.dismissed=[]}}),r.recommend.RecommendationsView=Backbone.View.extend({collection:r.recommend.RecommendationList,tagName:"div",itemTemplate:_.template('<li class="rec-item"><a href="/r/<%- sr_name %>" title="<%- sr_name %>" target="_blank">/r/<%- sr_name %></a><button class="add add-rec" data-srname="<%- sr_name %>"></button></li>'),initialize:function(){this.listenTo(this.collection,"add remove reset",this.render)},events:{"click .add-rec":"onAddClick","click .more":"showMore","click .reset":"resetRecommendations"},render:function(){this.$(".recommendations").empty();if(this.collection.models.length>0){this.$(".recs").show(),this.$(".endoflist").hide();var e=this.$el,t=this;this.collection.each(function(e){this.$(".recommendations").append(t.itemTemplate({sr_name:e.get("sr_name")}))},this),this.$el.css({opacity:1})}else this.collection.dismissed.length>0?(this.$(".recs").hide(),this.$(".endoflist").show()):this.$el.css({opacity:0});return this},resetRecommendations:function(){this.collection.clearHistory(),this.collection.fetchRecs()},onAddClick:function(e){var t=$(e.target).data("srname");this.trigger("recs:select",{srName:t})},showMore:function(e){this.collection.fetchNewRecs()}}),r.recommend.ExploreItem=Backbone.View.extend({events:{"click .explore-feedback-dismiss":"dismissSubreddit","click a":"recordClick"},dismissSubreddit:function(e){var t=$(e.target).closest(".explore-item"),n=t.data("sr_name"),i=t.data("src");r.ajax({type:"POST",url:"/api/recommend/feedback"
,data:{type:"dis",srnames:n,src:i,page:"explore"}}),this.$(".explore-feedback-dismiss").css({"font-weight":"bold"}),$(this.el).fadeOut("fast")},recordClick:function(e){var t=$(e.target).closest(".explore-item"),n=t.data("sr_name"),i=t.data("src");r.ajax({type:"POST",url:"/api/recommend/feedback",data:{type:"clk",srnames:n,src:i,page:"explore"}})}}),r.actionForm={init:function(){$("div.content").on("click",".action-thing, .cancel-action-thing",this.toggleActionForm.bind(this)),$("div.content").on("submit",".action-form",this.submitAction.bind(this))},toggleActionForm:function(e){var t=e.target,n=$(t);if(r.access.isLinkRestricted(t))return;var i=n.thing(),s=i.find("> .entry .action-form"),o=n.data("action-form");e.stopPropagation(),e.preventDefault();if(s.length>0)n.parents(".drop-choices").length?s.show():s.toggle();else{var u=$(o),a=u.clone(),f=i.find("> .entry .buttons"),l=i.thing_id();a.attr("id","action-thing-"+l),a.find('input[name="thing_id"]').val(l),a.insertAfter(f),a.show()}},submitAction:function(e){var t=$(e.target).thing().find(".action-form"),n=t.data("form-action");return post_pseudo_form(t,n)}},r.fraud={init:function(){$("div.content").on("click",".action-thing",this.showReason.bind(this)),$("div.content").on("change",".fraud-action-form input",this.validate.bind(this))},validate:function(e){var t=$(e.target),n=t.parents("form"),r=n.find('[type="submit"]'),i=n.find("input[name=refund]"),s=n.find("input[name=fraud]:checked").val(),o=s==="True";o?i.removeAttr("disabled").focus():i.prop("checked",!1).attr("disabled","disabled"),s?r.removeAttr("disabled"):r.attr("disabled","disabled")},showReason:function(e){var t=$(e.target),n=t.thing(),r=n.find("> .entry .action-form"),i=r.find(".fraud-reason"),s=t.attr("title");i.text(s)}},r.report={init:function(){$("div.content").on("change",".report-action-form input",this.validate.bind(this)),$("div.content").on("click",".reported-stamp.has-reasons",this.toggleReasons.bind(this))},toggleReasons:function(e){if(r.access.isLinkRestricted(e.target))return;$(e.target).parent().find(".report-reasons").toggle()},validate:function(e){var t=$(e.target).thing(),n=t.find("> .entry .report-action-form"),r=n.find('[type="submit"]'),i=n.find("[name=reason]:checked"),s=n.find('[name="other_reason"]'),o=i.val()==="other";r.removeAttr("disabled"),o?s.removeAttr("disabled").focus():s.attr("disabled","disabled")}},$(function(){r.actionForm.init(),r.fraud.init(),r.report.init()}),function(e,t){function u(e){return/^https?:\/\//.test(e)?e:"https://"+location.host+"/"+e.replace(/^\//,"")}function a(e){var t={live:!0,parent:!1,media:location.host,created:(new Date).toISOString()};return e=_.defaults({},e,t),e.comment=u(e.comment),e.link=u(e.link),_.extend({html:n(e)},e)}function f(e){return JSON.stringify(_.pick(e,"live","parent"))}function l(e,t){var n=e.$.find("#embed-preview"),r=typeof t!="string"?f(t):t;window.rembeddit.preview=!0,window.rembeddit.init({track:!1},function(){var e=0,t=setInterval(function(){var i=n.find("iframe:last-child"),s=i.height();e!==s?e=s:(clearInterval(t),n.find("iframe").hide().last().show().attr("data-options",r),n.css("height","auto"))},100)})}var n=_.template(_.unescape(r.config.embed_inject_template),!1,{escape:/%\(([^\n\)]+)\)s/g}),i=_.template('<h4 class="modal-title">'+_.escape(r._("Embed preview:"))+"</h4>"+'<div id="embed-preview">'+"<%= html %>"+"</div>"+"<% if (!root) { %>"+'<div class="c-checkbox">'+'<label class="remember">'+'<input type="checkbox" name="parent" <% if (parent) { %> checked <% } %>>'+_.escape(r._("Include parent comment."))+"</label>"+"</div>"+"<% } %>"+'<div class="c-checkbox">'+'<input type="checkbox" name="live" <% if (!live) { %> checked <% } %> data-rerender="false" id="live-edits">'+'<label for="live-edits">'+_.escape(r._("Do not show comment if edited."))+"&nbsp;"+'<a href="javascript: void 0;" class="c-toggle" data-toggle="#live-help">'+_.escape(r._("Learn more"))+"</a>"+"</label>"+'<div id="live-help" class="c-help-block c-toggle-content">'+"<p>"+_.escape(r._("When checked, if an embedded comment is later edited, the embedded comment text will be replaced by a link back to the current version of the comment on reddit."))+"</p>"+"<p>"+'<a href="https://www.reddit.com/r/reddit.com/wiki/embeds">'+_.escape(r._("This parameter can be changed after embedding."))+"</a>"+"</p>"+"</div>"+"</div>"),s=_.template('<h4 class="modal-title"><label for="embed-code">'+_.escape(r._("Copy this code and paste it into your website:"))+"</label>"+"</h4>"+'<textarea class="c-form-control" id="embed-code" rows="3" readonly>'+"<%- html %>"+"</textarea>"),o=_.template('<div class="reddit-embed" data-embed-media="<%- media %>" <% if (parent) { %> data-embed-parent="true" <% } %><% if (live) { %> data-embed-live="true" <% } %> data-embed-created="<%- new Date().toISOString() %>"><a href="<%- comment %>">Comment</a> from discussion <a href="<%- link %>"><%- title %></a>.</div>'),c=new window.rembeddit.PixelTracker({url:r.config.eventtracker_url});e("body").on("click",".embed-comment",function(n){var o=e(n.target),u=o.data(),h=a(u),p=new r.ui.Popup({className:"embed-modal",content:i(h),footer:s(h)}),d=p.$.find("textarea"),v=p.$.find("#embed-preview"),m=!1;p.$.find("[data-toggle]").togglable(),p.$.on("change",'[type="checkbox"]',function(n){var i=n.target.name,s=e(n.target),u=o.data(i);u===t&&(u=h[i]),o.data(n.target.name,!u);var c=o.data(),m=a(c),g=f(m),y=m.html,b=v.height();d.val(y);if(s.data("rerender")!==!1){var w='[data-options="'+r.utils.escapeSelector(g)+'"]',E=v.find(w);E.length?E.show().siblings().hide():(v.height(b).append(e(y).hide()),l(p,g))}}),d.on("focus",function(t){e(this).select().one("mouseup",function(e){e.preventDefault()});if(!m){var n=o.data(),i=a(n),s=new Date,u=s.getTime();c.send({event_topic:"embed",event_name:"embed_create",event_ts:u,event_ts_utc_offset:s.getTimezoneOffset()/-60,embed_type:i.parent?"comment_and_parent":"comment",user_agent:navigator.userAgent,user_id:r.config.user_id,logged_in_status:!!r.config.logged,sr_id:r.utils.fullnameToId(r.config.cur_site),sr_name:r.config.post_site,embed_id:r.utils.fullnameToId(o.thing_id()),embed_created_ts:u,embed_control:i.live,embed_host_url:location.href,embed_version:window.rembeddit.VERSION}),m=!0}}),p.on("closed.r.popup",function(){p.$.remove()}),p.on("show.r.popup",function(){v.find(".reddit-embed").hide()}),p.on("opened.r.popup",function(){l(p,h)}),p.show()})}(window.jQuery),!function(e){"use strict";var t=_.template('<div class="post-sharing-option post-sharing-option-<%- name %>" data-post-sharing-option="<%- name %>"><div class="c-tooltip" role="tooltip"><div class="tooltip-arrow bottom"></div><div class="tooltip-inner"><%- tooltip %></div></div></div>'),n=_.template('<div class="c-form-control-feedback-wrapper" ref="<%- ref %>"><span class="c-form-control-feedback c-form-control-feedback-throbber"></span><span class="c-form-control-feedback c-form-control-feedback-error"></span><span class="c-form-control-feedback c-form-control-feedback-success"></span></div>'),r=_.template('<a href="javascript: void 0;" class="c-close c-hide-text">'+_.escape(e._("close this window"))+"</a>"+'<div class="post-sharing-main post-sharing-form" ref="$mainForm">'+"<% if (options) { %>"+'<div class="c-form-group">'+'<div class="post-sharing-label">'+_.escape(e._("Share with:"))+"</div>"+'<div class="post-sharing-options">'+"<% options.forEach(function(option) { %>"+"<%= option %>"+"<% }) %>"+"</div>"+"</div>"+"<% } %>"+"<% if (link) { %>"+'<div class="c-form-group">'+'<div class="post-sharing-label">'+_.escape(e._("Link:"))+"</div>"+'<input class="post-sharing-link-input c-form-control" '+'ref="$postSharingLinkInput" '+'name="link" '+'type="text" '+"readonly "+'value="<%- link %>">'+"</div>"+"<% } %> "+"</div>"+'<div class="post-sharing-email-form post-sharing-form" ref="$emailForm">'+'<p class="post-sharing-label">'+_.escape(e._("Share via email as %(username)s").format({username:e.config.logged}))+"</p>"+'<div class="c-form-group">'+'<input class="post-sharing-recipient-input c-form-control" '+'ref="$shareTo" '+'name="recipient" type="text" '+'placeholder="name@example.com, name@example.com">'+n({ref:"$shareToFeedback"})+"</div>"+'<div class="c-form-group">'+'<textarea class="post-sharing-message-input c-form-control" '+'ref="$shareMessage" '+'name="message" '+'placeholder="'+_.escape(e._("add optional message"))+'"></textarea>'+n({ref:"$messageFeedback"})+"</div>"+'<div class="c-form-group">'+'<div class="post-sharing-buttons">'+'<button class="post-sharing-submit c-btn c-btn-primary c-pull-right">'+_.escape(e._("send"))+"</button>"+'<button class="post-sharing-cancel c-btn c-btn-secondary c-pull-right">'+_.escape(e._("cancel"))+"</button>"+"</div>"+n({ref:"$requestStateFeedback"})+'<div class="post-sharing-shareplane" ref="$shareplane">'+_.escape(e._("sent!"))+"</div>"+"</div>"+"</div>"),i=Backbone.Model.extend({defaults:function(){return{errors:[],options:null,requestState:"UNSENT",selectedOption:null,link:null}}});e.ui.PostSharing=Backbone.View.extend({animationSpeed:200,_template:r,_model:i,events:{"click .post-sharing-link-input":"selectLinkInputText","copy .post-sharing-link-input":"fireCopyEvent","click .post-sharing-option":"setPostSharingOption","click .post-sharing-cancel":"clearPostSharingOption","click .post-sharing-submit":"shareToEmail","click .c-close":"close"},initialize:function(){var e=this.options.$thing,t=e.data("fullname"),n=t.split("_")[1],r=e.find(".entry a.title").text(),i=e.find(".entry a.comments").attr("href");this.thingData={fullname:t,title:r,link:i};var s=this.options.props||{};s.link=this.getShareLink("link"),this.state=new this._model(s),this.listenTo(this.state,"change",this.render),this.initialRender()},initialRender:function(){var e=this.state.toJSON();e.options&&(e.options=e.options.map(t)),this.$el.html(this._template(e)),this.refs={};var n=this.$el.find("[ref]");n.toArray().forEach(function(e){var t=$(e),n=t.attr("ref");this.refs[n]=t},this),this.refs.$mainForm.css("display","block"),this.render()},show:function(){this.$el.slideDown(this.animationSpeed,"swing",function(){this.trigger("show",this),this.selectLinkInputText()}.bind(this))},hide:function(){this.$el.slideUp(this.animationSpeed,"swing",function(){this.trigger("hide")}.bind(this))},unmount:function(){this.remove(),this.trigger("unmount",this)},close:function(){this.once("hide",this.unmount.bind(this)),this.hide(),this.trigger("close")},setPostSharingOption:function(e){var t=$(e.target).closest(".post-sharing-option"),n=t.data("post-sharing-option");switch(n){case"email":return this.state.set({selectedOption:n});case"facebook":return this.shareToFacebook();case"twitter":return this.shareToTwitter();case"tumblr":return this.shareToTumblr();default:this.close()}},getShareLink:function(t){var n={ref:"share",ref_source:t};return e.utils.replaceUrlParams(this.thingData.link,n)},shareToFacebook:function(){var t=this.getShareLink("facebook"),n=e.config.currentOrigin+"/share/close",r={app_id:e.config.facebook_app_id,display:"popup",link:t,description:this.thingData.title,redirect_uri:n},i=e.utils.replaceUrlParams("https://www.facebook.com/dialog/feed",r);this.openWebIntent(i,"facebook")},shareToTwitter:function(){var t=this.getShareLink("twitter"),n="reddit",r=this.thingData.title,i=25,s=[r,"via","@"+n].join(" "),o=s.length+i,u=140,a=10,f=r.length-(o-u)-1;s.length>u&&(r=r.slice(0,Math.max(a,f)),r=r.trim()+"…");var l={url:t,text:r,via:n},c=e.utils.replaceUrlParams("https://twitter.com/intent/tweet",l);this.openWebIntent(c,"twitter")},shareToTumblr:function(){var t=this.getShareLink("tumblr"),n=this.thingData.title,r={canonicalUrl:t,posttype:"link",title:n},i=e.utils.replaceUrlParams("https://www.tumblr.com/widgets/share/tool",r);this.openWebIntent(i,"tumblr")},openWebIntent:function(e,t){var n=window.innerWidth,r=window.innerHeight,i=550,s=420,o={height:s,width:i,left:n/2-i/2,top:r/2-s/2},u=Object.keys(o).map(function(e){return e+"="+o[e]}).join(",");window.open(e,t,u),this.trigger("web-intent",t)},shareToEmail:function(){this.state.set({requestState:"LOADING"}),$.request("share",{share_from:"",replyto:"",share_to:this.refs.$shareTo.val(),message:this.refs.$shareMessage.val(),parent:this.thingData.fullname,api_type:"json"},function(e){if(this.state.get("requestState")!=="LOADING")return;var t=e.json;if(!t)throw"share api response error";t.errors.length?this.state.set({errors:t.errors,requestState:"DONE"}):(this.state.set({errors:[],requestState:"DONE"}),setTimeout(function(){this.close()}.bind(this),1500))}.bind(this))},clearPostSharingOption:function(e){this.state.set({requestState:"UNSENT",selectedOption:null})},selectLinkInputText:function(){this.refs.$postSharingLinkInput.focus().select()},fireCopyEvent:function(){this.trigger("link","copy")},getFeedbackRef:function(e){switch(e){case"BAD_EMAIL":case"BAD_EMAILS":case"NO_EMAILS":return this.refs.$shareToFeedback;case"TOO_LONG":return this.refs.$messageFeedback;default:return this.refs.$requestStateFeedback}},render:function(){var e=this.state.get("requestState"),t=this.state.get("errors"),n=this.state.changed,r=this.state.get("selectedOption");"selectedOption"in n&&(r==="email"?(this.refs.$mainForm.slideUp("fast"),this.refs.$emailForm.slideDown("fast")):(this.refs.$mainForm.slideDown("fast"),this.refs.$emailForm.slideUp("fast"))),r==="email"&&(this.refs.$shareToFeedback.stateify("clear"),this.refs.$messageFeedback.stateify("clear"),this.refs.$requestStateFeedback.stateify("clear"),t.length&&t.forEach(function(e){var t=e[0],n=e[1],r=this.getFeedbackRef(t);r.stateify("set","error",n)},this),e==="LOADING"?this.refs.$requestStateFeedback.stateify("set","loading"):e==="DONE"&&!t.length&&(this.refs.$requestStateFeedback.stateify("set","success"),this.refs.$emailForm.addClass("shared")))}}),$(function(){$("body").on("click",".post-sharing-button",function(t){t.preventDefault();var n=$(t.target),r=n.closest(".thing"),i=r.thing_id();if(e.ui.activeShareMenu&&e.ui.activeShareMenu.$el.is(":visible")){var s=e.ui.activeShareMenu.options.$thing[0]===r[0];e.ui.activeShareMenu.close();if(s)return}var o=[{name:"facebook",tooltip:e._("Share to %(name)s").format({name:"Facebook"})},{name:"twitter",tooltip:e._("Share to %(name)s").format({name:"Twitter"})}];e.config.feature_tumblr_sharing&&o.push({name:"tumblr",tooltip:e._("Share to %(name)s").format({name:"Tumblr"})}),e.config.logged&&o.push({name:"email",tooltip:e._("Email to a Friend")});var u=new e.ui.PostSharing({className:"post-sharing",$thing:r,props:{options:o}});r.find(".entry .buttons").after(u.el),e.ui.activeShareMenu=u,u.on("show",function(){e.analytics.fireGAEvent("post-sharing","open",i)}),u.on("unmount",function(){e.ui.activeShareMenu===u&&(e.ui.activeShareMenu=null)}),u.on("close",function(){var t=u.state.get("selectedOption")?"close":"cancel";e.analytics.fireGAEvent("post-sharing",t,i)}),u.on("web-intent",function(t){e.analytics.fireGAEvent("post-sharing","share-to-"+t,i)}),u.on("link",function(t){e.analytics.fireGAEvent("post-sharing","link-"+t,i)}),u.show()})})}(r),!function(e){function t(e){return e.tagName==="A"}var n=Backbone.View.extend({buttonSelector:".expando-button",expandoSelector:".expando",expanded:!1,events:{"click .expando-button":"toggleExpando"},constructor:function(){Backbone.View.prototype.constructor.apply(this,_.toArray(arguments)),this.afterInitialize()},initialize:function(){this.$button=this.$el.find(this.buttonSelector),this.$expando=this.$el.find(this.expandoSelector)},afterInitialize:function(){this.options.expanded&&this.expand()},toggleExpando:function(e){if(t(e.target))return;this.expanded?this.collapse():this.expand()},expand:function(){this.$button.addClass("expanded").removeClass("collapsed"),this.expanded=!0,this.show()},show:function(){this.$expando.show()},collapse:function(){this.$button.addClass("collapsed").removeClass("expanded"),this.expanded=!1,this.hide()},hide:function(){this.$expando.hide()}}),r=n.extend({events:_.extend({},n.prototype.events,{"click .open-expando":"expand"}),initialize:function(){n.prototype.initialize.call(this),this.cachedHTML=this.$expando.data("cachedhtml"),this.loaded=!!this.cachedHTML,this.id=this.$el.thing_id(),$(document).on("hide_thing_"+this.id,function(){this.collapse()}.bind(this))},show:function(){this.loaded?this.$expando.html(this.cachedHTML):$.request("expando",{link_id:this.id},function(e){var t=$.unsafe(e);this.cachedHTML=t,this.$expando.html(t),this.loaded=!0}.bind(this),!1,"html",!0),this.$expando.show()},hide:function(){this.$expando.hide().empty()}}),i=n.extend({buttonSelector:".search-expando-button",expandoSelector:".search-expando",events:{"click .search-expando-button":"toggleExpando"},afterInitialize:function(){var e=this.$expando.innerHeight(),t=this.$expando.find(".search-result-body").innerHeight();t<=e?(this.$button.remove(),this.$expando.removeClass("collapsed"),this.undelegateEvents()):this.options.expanded&&this.expand()},show:function(){this.$expando.removeClass("collapsed")},hide:function(){this.$expando.addClass("collapsed")}});$(function(){var e=[".linklisting",".organic-listing",".selfserve-subreddit-links"];$(e.join(",")).on("click",".expando-button",function(e){if(t(e.target))return;var n=$(this).closest(".thing");if(n.data("expando"))return;n.data("expando",!0);var i=new r({el:n[0],expanded:!0})});var n=$(".search-expando-button").closest(".search-result-link");n.each(function(){new i({el:this})})})}(r),r.saved={},r.saved.SaveCategories=Backbone.Collection.extend({model:Backbone.Model.extend({idAttribute:"category"}),url:"/api/saved_categories.json",fetchOnce:function(){return this._fetched||(this._fetched=this.fetch()),this._fetched},comparator:function(e){return e.get("category")},parse:function(e){return e.categories}}),r.saved.SaveDialog=r.ui.Bubble.extend({tagName:"form",className:"hover-bubble anchor-left save-selector",confirmTemplate:_.template('<label for="savedcategory"><%- label %></label><span class="throbber"></span><select><option value=""><%- placeholder %></option></select><input maxlength="20" class="savedcategory" name="savedcategory" placeholder="<%- textplaceholder %>"><input type="submit" value="<%- save %>"><div class="error"></div>'),events:{click:"clicked",submit:"save",mouseout:"mouseout",mouseover:"cancelTimeout","change select":"change"},mouseout:function(){this.$el.find("select, .savedcategory").is(":focus")||this.queueHide()},clicked:function(e){e.stopPropagation()},initialize:function(e){this.options=e,this.options.trackHover=!1,r.ui.Bubble.prototype.initialize.apply(this),r.saved.categories.fetchOnce().then(_.bind(this.show,this)),$("body").on("click.savedialog",_.bind(this.hideNow,this))},hideNow:function(){r.ui.Bubble.prototype.hideNow.apply(this),$("body").off("click.savedialog"),this.remove()},error:function(){this.$el.find("select, .savedcategory").attr("disabled",!1),this.$el.removeClass("working"),this.$el.find(".error").text(r._("Invalid category name"))},change:function(e){var t=this.$el.find(".savedcategory"),n=this.$el.find("option:selected").val();t.val(n).focus()},success:function(){var e=this.$parent.parents(".thing").find(".save-category");e.length&&this.category?(e.text("category: "+this.category),e.attr("href","/user/"+r.config.logged+"/saved/"+this.category),e.show()):e.hide(),r.saved.SaveButton.setSaved(this.$parent),this.category&&(r.saved.categories.add({category:this.category}),r.saved.categories.sort()),this.hide()},save:function(e){e.preventDefault(),this.category=this.$el.find(".savedcategory").val(),this.$el.find("select, .savedcategory").attr("disabled",!0);if(!this.category)return this.success();this.$el.addClass("working"),r.ajax({type:"POST",url:"/api/save",data:{id:this.$parent.thing_id(),category:this.category},success:this.success,error:this.error,context:this})},addCategory:function(e){var t=e.get("category");this.$el.find("select").append($("<option>").val(t).text(t))},show:function(){r.ui.Bubble.prototype.show.apply(this),this.$el.find(".savedcategory").focus()},render:function(){this.$el.html(this.confirmTemplate({label:r._("save category"),placeholder:r._("no category"),save:r._("save"),textplaceholder:r._("new category")})),r.saved.categories.each(this.addCategory,this),this.$el.find("select").first().prop("selected",!0)}}),r.saved.SaveButton={request:function(e,t,n){r.ajax({type:"POST",url:"/api/"+t,data:{id:e.thing_id()},success:_.bind(n,this,e)})},toggleSaved:function(e){this.isSaved(e)?this.unsave(e):this.save(e)},unsave:function(e){this.request(e,"unsave",this.setUnsaved)},save:function(e){this.request(e,"save",this.setSaved),r.config.gold&&new r.saved.SaveDialog({parent:e,group:r.saved.SaveButton})},isSaved:function(e){return e.thing().hasClass("saved")},setUnsaved:function(e){var t=e.parents(".thing").find(".save-category").hide();e.text(r._("save")),e.thing().removeClass("saved")},setSaved:function(e){e.text(r._("unsave")),e.thing().addClass("saved")}},r.saved.categories=new r.saved.SaveCategories,r.saved.init=function(){$("body").on("click",".save-button a, a.save-button",function(e){e.stopPropagation(),e.preventDefault(),r.saved.SaveButton.toggleSaved($(this))})},r.resAdvisory={},r.resAdvisory.minResVersion=[4,3,2,1],r.resAdvisory.checkRESClick=function(e){if(e.target.id=="viewImagesButton"||$(e.target).hasClass("expando-button"))r.resAdvisory.checkRESVersion()?document.body.removeEventListener("click",r.resAdvisory.checkRESClick,!0):(e.preventDefault(),e.stopPropagation(),alert("The version of Reddit Enhancement Suite you are using has a bug which makes expanding posts insecure to use. Please update Reddit Enhancement Suite to continue using post expandos. Please visit /r/Enhancement for more information."))},r.resAdvisory.checkRESVersion=_.memoize(function(){var e=$("#RESMainGearOverlay").length;if(!e)return!0;var t=$("#RESConsoleVersion").text();return t?(t=t.substring(1).split("."),t=_.map(t,function(e){return parseInt(e)}),t>=r.resAdvisory.minResVersion):!1}),r.resAdvisory.init=function(){document.body.addEventListener&&document.body.addEventListener("click",r.resAdvisory.checkRESClick,!0)},!function(e,t,n){"use strict";function i(){return s(2)}function s(e){var t="",n="abcdefghijklmnopqrstuvwxyz0123456789";for(var r=0;r<e;r++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}var r="pc";n.cachePoisoning={},n.cachePoisoning.updateCanaryCookie=function(){var e=t.cookie(r);e||(e=i()),t.cookie(r,null,{secure:n.config.https_forced,domain:n.config.cur_domain}),t.cookie(r,e,{secure:n.config.https_forced,domain:n.config.cur_domain,path:"/",expires:365})},n.cachePoisoning.checkPoisoned=function(){var e=t.cookie(r);return e&&n.config.poisoning_canary&&e!==n.config.poisoning_canary?!0:!1},n.cachePoisoning._parseHeaders=function(e){var t=/^(.*?):[ \t]*([^\r\n]*)$/mg,n={},r;while(r=t.exec(e)){var i=r[1].toLowerCase();n[i]===undefined&&(n[i]=[]),n[i].push(r[2])}return n},n.cachePoisoning.logPoisoning=function(){var e={report_mac:n.config.poisoning_report_mac,poisoner_name:n.config.logged,poisoner_id:n.config.user_id,cache_policy:n.config.cache_policy,poisoner_canary:n.config.poisoning_canary,victim_canary:t.cookie(r),render_time:n.config.server_time,route_name:n.config.pageInfo.actionName,source:"web",url:window.location.href||"",resp_headers:{}};t.ajax({url:window.location.href,xhr:function(){var e=jQuery.ajaxSettings.xhr(),t=e.setRequestHeader;return e.setRequestHeader=function(e,n){if(e==="X-Requested-With")return;t.call(this,e,n)},e},complete:function(t){if((t.responseText||"").indexOf(n.config.modhash)!==-1){var r=t.getAllResponseHeaders();e.resp_headers=n.cachePoisoning._parseHeaders(r)}e.resp_headers=JSON.stringify(e.resp_headers),n.ajax({type:"POST",url:"/web/poisoning.json",data:e,headers:{"X-Loggit":!0},success:function(){n.log("Sent cache poisoning report to server")},error:function(e,t,r){n.warn("Error sending cache poisoning report to server")}})}})},n.cachePoisoning.init=function(){n.config.logged&&n.cachePoisoning.checkPoisoned()&&n.cachePoisoning.logPoisoning(),n.cachePoisoning.updateCanaryCookie()}}(window,jQuery,r),r.messages={},r.messages.pollUnread=_.debounce(function(e){e=e+1||1;if(e>20){document.location="/message/unread";return}r.ajax({type:"GET",url:"/api/me.json",success:function(t){t.data.has_mail?r.messages.pollUnread(e):document.location="/message/unread"}})},2e3),r.messages.init=function(){$("a.mark-all-read").on("click",function(e){var t=$(this);e.preventDefault(),e.stopPropagation();if(t.hasClass("disabled"))return;t.addClass("disabled"),t.parent().addClass("working"),r.ajax({type:"POST",url:"/api/read_all_messages",data:{},success:r.messages.pollUnread})})},!function(e){var t=e.hooks.create("reddit");t.register(function(){try{e.setupBackbone(),e.login.ui.init(),e.TimeText.init(),e.ui.init(),e.interestbar.init(),e.visited.init(),e.apps.init(),e.wiki.init(),e.gold.init(),e.multi.init(),e.recommend.init(),e.saved.init(),e.messages.init(),e.resAdvisory.init(),e.filter.init(),e.newsletter.ui.init(),e.cachePoisoning.init(),e.locked.init()}catch(t){e.sendError("Error during reddit.js init",t.toString())}}),$(function(){t.call()})}(r),!function(e,t,n,r){function l(e){n.cookie(a,e,{domain:t.config.cur_domain,path:"/",expires:3650})}var i=_.escape(t._("Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies.")),s=t.config.requires_eu_cookie_policy,o=t.config.eu_cookie_max_attempts,u="eu_cookie",a="eu_cookie_v2",f=parseInt(n.cookie(a)||0,10);f||(f=parseInt(n.cookie(u)||0,10),f&&l(f)),s&&f<o&&(n(document.body).append(n('<form id="eu-cookie-policy"><div class="reddit-infobar md-container-small with-icon with-btn cookie-infobar"><div class="md"><p>'+i+"&nbsp;"+"&nbsp;"+'<a href="https://www.reddit.com/help/privacypolicy">'+_.escape(t._("Learn More"))+"</a>"+"</p>"+"</div>"+'<div class="infobar-btn-container">'+'<button class="c-btn c-btn-primary" type="submit">'+_.escape(t._("I AGREE"))+"</button>"+"</div>"+"</div>"+"</form>").on("submit",function(e){e.preventDefault(),l(o),n(this).hide()})),l(Math.min(f+1,o)))}(this,this.r=this.r||{},this.jQuery),r.permissions=_.extend(r.permissions||{},{moderator:{wiki:{description:r.N_("manage the wiki and access to the wiki"),title:r.N_("wiki")},access:{description:r.N_("manage the lists of contributors and banned/muted users"),title:r.N_("access")},mail:{description:r.N_("read and reply to moderator mail"),title:r.N_("mail")},config:{description:r.N_("edit settings, sidebar, css, images, and AutoModerator config"),title:r.N_("config")},posts:{description:r.N_("use the approve, remove, spam, distinguish, and nsfw buttons"),title:r.N_("posts")},flair:{description:r.N_("manage user flair, link flair, and flair templates"),title:r.N_("flair")}},moderator_invite:{wiki:{description:r.N_("manage the wiki and access to the wiki"),title:r.N_("wiki")},access:{description:r.N_("manage the lists of contributors and banned/muted users"),title:r.N_("access")},mail:{description:r.N_("read and reply to moderator mail"),title:r.N_("mail")},config:{description:r.N_("edit settings, sidebar, css, images, and AutoModerator config"),title:r.N_("config")},posts:{description:r.N_("use the approve, remove, spam, distinguish, and nsfw buttons"),title:r.N_("posts")},flair:{description:r.N_("manage user flair, link flair, and flair templates"),title:r.N_("flair")}}})}catch(err){r.sendError("Error running module","reddit.js",":",err.toString())};r.i18n.addMessages({"wiki": [null, "wiki"], "full permissions": [null, "full permissions"], "a month ago": [null, "a month ago", "%(num)s months ago"], "invalid cvc": [null, "invalid cvc"], "missing city": [null, "missing city"], "sent!": [null, "sent!"], "Email to a Friend": [null, "Email to a Friend"], "an hour ago": [null, "an hour ago", "%(num)s hours ago"], "just now": [null, "just now"], "cancel": [null, "cancel"], "Learn more": [null, "Learn more"], "save category": [null, "save category"], "Embed preview:": [null, "Embed preview:"], "This parameter can be changed after embedding.": [null, "This parameter can be changed after embedding."], "an error occurred (status: %(status)s)": [null, "an error occurred (status: %(status)s)"], "categorize": [null, "categorize"], "yes": [null, "yes"], "add a subreddit to your multi.": [null, "add a subreddit to your multi"], "new category": [null, "new category"], "no thanks": [null, "no thanks"], "passwords do not match": [null, "passwords do not match"], "open this multi": [null, "open this multi"], "a day ago": [null, "a day ago", "%(num)s days ago"], "no permissions": [null, "no permissions"], "use the approve, remove, spam, distinguish, and nsfw buttons": [null, "use the approve, remove, spam, distinguish, and nsfw buttons"], "send": [null, "send"], "add optional message": [null, "add optional message"], "config": [null, "config"], "create a new multi": [null, "create a new multi"], "invalid expiration date": [null, "invalid expiration date"], "access": [null, "access"], "Share via email as %(username)s": [null, "Share via email as %(username)s"], "read and reply to moderator mail": [null, "read and reply to moderator mail"], "a minute ago": [null, "a minute ago", "%(num)s minutes ago"], "Link:": [null, "Link:"], "Share to %(name)s": [null, "Share to %(name)s"], "are you sure?": [null, "are you sure?"], "close this window": [null, "close this window"], "flair": [null, "flair"], "switch to mobile version": [null, "switch to mobile version"], "missing country": [null, "missing country"], "awesomeness goes here": [null, "awesomeness goes here"], "Password is fair": [null, "Password is okay"], "Password is weak": [null, "Password is weak"], "missing name": [null, "missing name"], "invalid credit card number": [null, "invalid credit card number"], "Password is good": [null, "Password is good"], "a year ago": [null, "a year ago", "%(num)s years ago"], "no": [null, "no"], "mail": [null, "mail"], "Do not show comment if edited.": [null, "Do not show comment if edited."], "Copy this code and paste it into your website:": [null, "Copy this code and paste it into your website:"], "Include parent comment.": [null, "Include parent comment."], "save": [null, "save"], "Share with:": [null, "Share with:"], "edit settings, sidebar, css, images, and AutoModerator config": [null, "edit settings, sidebar, css, images, and AutoModerator config"], "try using our secure login form.": [null, "try using our secure login form."], "posts": [null, "posts"], "manage user flair, link flair, and flair templates": [null, "manage user flair, link flair, and flair templates"], "check your inbox to confirm your subscription": [null, "check your inbox to confirm your subscription"], "manage the wiki and access to the wiki": [null, "manage the wiki and access to the wiki"], "Password is strong": [null, "Password is strong"], "an error occurred. please try again later! (status: %(status)s)": [null, "an error occurred. please try again later! (status: %(status)s)"], "Invalid category name": [null, "Invalid category name"], "missing address": [null, "missing address"], "unsave": [null, "unsave"], "no category": [null, "no category"], "When checked, if an embedded comment is later edited, the embedded comment text will be replaced by a link back to the current version of the comment on reddit.": [null, "When checked, if an embedded comment is later edited, the embedded comment text will be replaced by a link back to the current version of the comment on reddit."]});
try{(function(e,t){typeof module=="object"&&typeof module.exports=="object"?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)})(typeof window!="undefined"?window:this,function(window,noGlobal){function isArraylike(e){var t=e.length,n=jQuery.type(e);return n==="function"||jQuery.isWindow(e)?!1:e.nodeType===1&&t?!0:n==="array"||t===0||typeof t=="number"&&t>0&&t-1 in e}function winnow(e,t,n){if(jQuery.isFunction(t))return jQuery.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return jQuery.grep(e,function(e){return e===t!==n});if(typeof t=="string"){if(risSimple.test(t))return jQuery.filter(t,e,n);t=jQuery.filter(t,e)}return jQuery.grep(e,function(e){return indexOf.call(t,e)>=0!==n})}function sibling(e,t){while((e=e[t])&&e.nodeType!==1);return e}function createOptions(e){var t=optionsCache[e]={};return jQuery.each(e.match(rnotwhite)||[],function(e,n){t[n]=!0}),t}function completed(){document.removeEventListener("DOMContentLoaded",completed,!1),window.removeEventListener("load",completed,!1),jQuery.ready()}function Data(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=jQuery.expando+Math.random()}function dataAttr(e,t,n){var r;if(n===undefined&&e.nodeType===1){r="data-"+t.replace(rmultiDash,"-$1").toLowerCase(),n=e.getAttribute(r);if(typeof n=="string"){try{n=n==="true"?!0:n==="false"?!1:n==="null"?null:+n+""===n?+n:rbrace.test(n)?jQuery.parseJSON(n):n}catch(i){}data_user.set(e,t,n)}else n=undefined}return n}function returnTrue(){return!0}function returnFalse(){return!1}function safeActiveElement(){try{return document.activeElement}catch(e){}}function manipulationTarget(e,t){return jQuery.nodeName(e,"table")&&jQuery.nodeName(t.nodeType!==11?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function disableScript(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function restoreScript(e){var t=rscriptTypeMasked.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function setGlobalEval(e,t){var n=0,r=e.length;for(;n<r;n++)data_priv.set(e[n],"globalEval",!t||data_priv.get(t[n],"globalEval"))}function cloneCopyEvent(e,t){var n,r,i,s,o,u,a,f;if(t.nodeType!==1)return;if(data_priv.hasData(e)){s=data_priv.access(e),o=data_priv.set(t,s),f=s.events;if(f){delete o.handle,o.events={};for(i in f)for(n=0,r=f[i].length;n<r;n++)jQuery.event.add(t,i,f[i][n])}}data_user.hasData(e)&&(u=data_user.access(e),a=jQuery.extend({},u),data_user.set(t,a))}function getAll(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&jQuery.nodeName(e,t)?jQuery.merge([e],n):n}function fixInput(e,t){var n=t.nodeName.toLowerCase();if(n==="input"&&rcheckableType.test(e.type))t.checked=e.checked;else if(n==="input"||n==="textarea")t.defaultValue=e.defaultValue}function actualDisplay(e,t){var n,r=jQuery(t.createElement(e)).appendTo(t.body),i=window.getDefaultComputedStyle&&(n=window.getDefaultComputedStyle(r[0]))?n.display:jQuery.css(r[0],"display");return r.detach(),i}function defaultDisplay(e){var t=document,n=elemdisplay[e];if(!n){n=actualDisplay(e,t);if(n==="none"||!n)iframe=(iframe||jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=iframe[0].contentDocument,t.write(),t.close(),n=actualDisplay(e,t),iframe.detach();elemdisplay[e]=n}return n}function curCSS(e,t,n){var r,i,s,o,u=e.style;return n=n||getStyles(e),n&&(o=n.getPropertyValue(t)||n[t]),n&&(o===""&&!jQuery.contains(e.ownerDocument,e)&&(o=jQuery.style(e,t)),rnumnonpx.test(o)&&rmargin.test(t)&&(r=u.width,i=u.minWidth,s=u.maxWidth,u.minWidth=u.maxWidth=u.width=o,o=n.width,u.width=r,u.minWidth=i,u.maxWidth=s)),o!==undefined?o+"":o}function addGetHookIf(e,t){return{get:function(){if(e()){delete this.get;return}return(this.get=t).apply(this,arguments)}}}function vendorPropName(e,t){if(t in e)return t;var n=t[0].toUpperCase()+t.slice(1),r=t,i=cssPrefixes.length;while(i--){t=cssPrefixes[i]+n;if(t in e)return t}return r}function setPositiveNumber(e,t,n){var r=rnumsplit.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function augmentWidthOrHeight(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2)n==="margin"&&(o+=jQuery.css(e,n+cssExpand[s],!0,i)),r?(n==="content"&&(o-=jQuery.css(e,"padding"+cssExpand[s],!0,i)),n!=="margin"&&(o-=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i))):(o+=jQuery.css(e,"padding"+cssExpand[s],!0,i),n!=="padding"&&(o+=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i)));return o}function getWidthOrHeight(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=getStyles(e),o=jQuery.css(e,"boxSizing",!1,s)==="border-box";if(i<=0||i==null){i=curCSS(e,t,s);if(i<0||i==null)i=e.style[t];if(rnumnonpx.test(i))return i;r=o&&(support.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+augmentWidthOrHeight(e,t,n||(o?"border":"content"),r,s)+"px"}function showHide(e,t){var n,r,i,s=[],o=0,u=e.length;for(;o<u;o++){r=e[o];if(!r.style)continue;s[o]=data_priv.get(r,"olddisplay"),n=r.style.display,t?(!s[o]&&n==="none"&&(r.style.display=""),r.style.display===""&&isHidden(r)&&(s[o]=data_priv.access(r,"olddisplay",defaultDisplay(r.nodeName)))):(i=isHidden(r),(n!=="none"||!i)&&data_priv.set(r,"olddisplay",i?n:jQuery.css(r,"display")))}for(o=0;o<u;o++){r=e[o];if(!r.style)continue;if(!t||r.style.display==="none"||r.style.display==="")r.style.display=t?s[o]||"":"none"}return e}function Tween(e,t,n,r,i){return new Tween.prototype.init(e,t,n,r,i)}function createFxNow(){return setTimeout(function(){fxNow=undefined}),fxNow=jQuery.now()}function genFx(e,t){var n,r=0,i={height:e};t=t?1:0;for(;r<4;r+=2-t)n=cssExpand[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function createTween(e,t,n){var r,i=(tweeners[t]||[]).concat(tweeners["*"]),s=0,o=i.length;for(;s<o;s++)if(r=i[s].call(n,t,e))return r}function defaultPrefilter(e,t,n){var r,i,s,o,u,a,f,l,c=this,h={},p=e.style,d=e.nodeType&&isHidden(e),v=data_priv.get(e,"fxshow");n.queue||(u=jQuery._queueHooks(e,"fx"),u.unqueued==null&&(u.unqueued=0,a=u.empty.fire,u.empty.fire=function(){u.unqueued||a()}),u.unqueued++,c.always(function(){c.always(function(){u.unqueued--,jQuery.queue(e,"fx").length||u.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],f=jQuery.css(e,"display"),l=f==="none"?data_priv.get(e,"olddisplay")||defaultDisplay(e.nodeName):f,l==="inline"&&jQuery.css(e,"float")==="none"&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",c.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){i=t[r];if(rfxtypes.exec(i)){delete t[r],s=s||i==="toggle";if(i===(d?"hide":"show")){if(i!=="show"||!v||v[r]===undefined)continue;d=!0}h[r]=v&&v[r]||jQuery.style(e,r)}else f=undefined}if(!jQuery.isEmptyObject(h)){v?"hidden"in v&&(d=v.hidden):v=data_priv.access(e,"fxshow",{}),s&&(v.hidden=!d),d?jQuery(e).show():c.done(function(){jQuery(e).hide()}),c.done(function(){var t;data_priv.remove(e,"fxshow");for(t in h)jQuery.style(e,t,h[t])});for(r in h)o=createTween(d?v[r]:0,r,c),r in v||(v[r]=o.start,d&&(o.end=o.start,o.start=r==="width"||r==="height"?1:0))}else(f==="none"?defaultDisplay(e.nodeName):f)==="inline"&&(p.display=f)}function propFilter(e,t){var n,r,i,s,o;for(n in e){r=jQuery.camelCase(n),i=t[r],s=e[n],jQuery.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=jQuery.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Animation(e,t,n){var r,i,s=0,o=animationPrefilters.length,u=jQuery.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=fxNow||createFxNow(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;o<a;o++)f.tweens[o].run(s);return u.notifyWith(e,[f,s,n]),s<1&&a?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:jQuery.extend({},t),opts:jQuery.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:fxNow||createFxNow(),duration:n.duration,tweens:[],createTween:function(t,n){var r=jQuery.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(r),r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;i=!0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;propFilter(l,f.opts.specialEasing);for(;s<o;s++){r=animationPrefilters[s].call(f,e,l,f.opts);if(r)return r}return jQuery.map(l,createTween,f),jQuery.isFunction(f.opts.start)&&f.opts.start.call(e,f),jQuery.fx.timer(jQuery.extend(a,{elem:e,anim:f,queue:f.opts.queue})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function addToPrefiltersOrTransports(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i=0,s=t.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(n))while(r=s[i++])r[0]==="+"?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function inspectPrefiltersOrTransports(e,t,n,r){function o(u){var a;return i[u]=!0,jQuery.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f=="string"&&!s&&!i[f])return t.dataTypes.unshift(f),o(f),!1;if(s)return!(a=f)}),a}var i={},s=e===transports;return o(t.dataTypes[0])||!i["*"]&&o("*")}function ajaxExtend(e,t){var n,r,i=jQuery.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&jQuery.extend(!0,e,r),e}function ajaxHandleResponses(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while(a[0]==="*")a.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in u)if(u[i]&&u[i].test(r)){a.unshift(i);break}if(a[0]in n)s=a[0];else{for(i in n){if(!a[0]||e.converters[i+" "+a[0]]){s=i;break}o||(o=i)}s=s||o}if(s)return s!==a[0]&&a.unshift(s),n[s]}function ajaxConvert(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s){e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift();if(s)if(s==="*")s=a;else if(a!=="*"&&a!==s){o=f[a+" "+s]||f["* "+s];if(!o)for(i in f){u=i.split(" ");if(u[1]===s){o=f[a+" "+u[0]]||f["* "+u[0]];if(o){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}}}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}}return{state:"success",data:t}}function buildParams(e,t,n,r){var i;if(jQuery.isArray(t))jQuery.each(t,function(t,i){n||rbracket.test(e)?r(e,i):buildParams(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&jQuery.type(t)==="object")for(i in t)buildParams(e+"["+i+"]",t[i],n,r);else r(e,t)}function getWindow(e){return jQuery.isWindow(e)?e:e.nodeType===9&&e.defaultView}var arr=[],slice=arr.slice,concat=arr.concat,push=arr.push,indexOf=arr.indexOf,class2type={},toString=class2type.toString,hasOwn=class2type.hasOwnProperty,support={},document=window.document,version="2.1.1",jQuery=function(e,t){return new jQuery.fn.init(e,t)},rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(e,t){return t.toUpperCase()};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,selector:"",length:0,toArray:function(){return slice.call(this)},get:function(e){return e!=null?e<0?this[e+this.length]:this[e]:slice.call(this)},pushStack:function(e){var t=jQuery.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return jQuery.each(this,e,t)},map:function(e){return this.pushStack(jQuery.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:push,sort:arr.sort,splice:arr.splice},jQuery.extend=jQuery.fn.extend=function(){var e,t,n,r,i,s,o=arguments[0]||{},u=1,a=arguments.length,f=!1;typeof o=="boolean"&&(f=o,o=arguments[u]||{},u++),typeof o!="object"&&!jQuery.isFunction(o)&&(o={}),u===a&&(o=this,u--);for(;u<a;u++)if((e=arguments[u])!=null)for(t in e){n=o[t],r=e[t];if(o===r)continue;f&&r&&(jQuery.isPlainObject(r)||(i=jQuery.isArray(r)))?(i?(i=!1,s=n&&jQuery.isArray(n)?n:[]):s=n&&jQuery.isPlainObject(n)?n:{},o[t]=jQuery.extend(f,s,r)):r!==undefined&&(o[t]=r)}return o},jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return jQuery.type(e)==="function"},isArray:Array.isArray,isWindow:function(e){return e!=null&&e===e.window},isNumeric:function(e){return!jQuery.isArray(e)&&e-parseFloat(e)>=0},isPlainObject:function(e){return jQuery.type(e)!=="object"||e.nodeType||jQuery.isWindow(e)?!1:e.constructor&&!hasOwn.call(e.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?class2type[toString.call(e)]||"object":typeof e},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code),code&&(code.indexOf("use strict")===1?(script=document.createElement("script"),script.text=code,document.head.appendChild(script).parentNode.removeChild(script)):indirect(code))},camelCase:function(e){return e.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,s=e.length,o=isArraylike(e);if(n)if(o)for(;i<s;i++){r=t.apply(e[i],n);if(r===!1)break}else for(i in e){r=t.apply(e[i],n);if(r===!1)break}else if(o)for(;i<s;i++){r=t.call(e[i],i,e[i]);if(r===!1)break}else for(i in e){r=t.call(e[i],i,e[i]);if(r===!1)break}return e},trim:function(e){return e==null?"":(e+"").replace(rtrim,"")},makeArray:function(e,t){var n=t||[];return e!=null&&(isArraylike(Object(e))?jQuery.merge(n,typeof e=="string"?[e]:e):push.call(n,e)),n},inArray:function(e,t,n){return t==null?-1:indexOf.call(t,e,n)},merge:function(e,t){var n=+t.length,r=0,i=e.length;for(;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length,u=!n;for(;s<o;s++)r=!t(e[s],s),r!==u&&i.push(e[s]);return i},map:function(e,t,n){var r,i=0,s=e.length,o=isArraylike(e),u=[];if(o)for(;i<s;i++)r=t(e[i],i,n),r!=null&&u.push(r);else for(i in e)r=t(e[i],i,n),r!=null&&u.push(r);return concat.apply([],u)},guid:1,proxy:function(e,t){var n,r,i;return typeof t=="string"&&(n=e[t],t=e,e=n),jQuery.isFunction(e)?(r=slice.call(arguments,2),i=function(){return e.apply(t||this,r.concat(slice.call(arguments)))},i.guid=e.guid=e.guid||jQuery.guid++,i):undefined},now:Date.now,support:support}),jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){class2type["[object "+t+"]"]=t.toLowerCase()});var Sizzle=function(e){function st(e,t,r,i){var s,u,f,l,c,d,g,y,S,x;(t?t.ownerDocument||t:E)!==p&&h(t),t=t||p,r=r||[];if(!e||typeof e!="string")return r;if((l=t.nodeType)!==1&&l!==9)return[];if(v&&!i){if(s=Z.exec(e))if(f=s[1]){if(l===9){u=t.getElementById(f);if(!u||!u.parentNode)return r;if(u.id===f)return r.push(u),r}else if(t.ownerDocument&&(u=t.ownerDocument.getElementById(f))&&b(t,u)&&u.id===f)return r.push(u),r}else{if(s[2])return P.apply(r,t.getElementsByTagName(e)),r;if((f=s[3])&&n.getElementsByClassName&&t.getElementsByClassName)return P.apply(r,t.getElementsByClassName(f)),r}if(n.qsa&&(!m||!m.test(e))){y=g=w,S=t,x=l===9&&e;if(l===1&&t.nodeName.toLowerCase()!=="object"){d=o(e),(g=t.getAttribute("id"))?y=g.replace(tt,"\\$&"):t.setAttribute("id",y),y="[id='"+y+"'] ",c=d.length;while(c--)d[c]=y+mt(d[c]);S=et.test(e)&&dt(t.parentNode)||t,x=d.join(",")}if(x)try{return P.apply(r,S.querySelectorAll(x)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return a(e.replace(z,"$1"),t,r,i)}function ot(){function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function ut(e){return e[w]=!0,e}function at(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ft(e,t){var n=e.split("|"),i=e.length;while(i--)r.attrHandle[n[i]]=t}function lt(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||A)-(~e.sourceIndex||A);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function pt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function dt(e){return e&&typeof e.getElementsByTagName!==L&&e}function vt(){}function mt(e){var t=0,n=e.length,r="";for(;t<n;t++)r+=e[t].value;return r}function gt(e,t,n){var r=t.dir,i=n&&r==="parentNode",s=x++;return t.first?function(t,n,s){while(t=t[r])if(t.nodeType===1||i)return e(t,n,s)}:function(t,n,o){var u,a,f=[S,s];if(o){while(t=t[r])if(t.nodeType===1||i)if(e(t,n,o))return!0}else while(t=t[r])if(t.nodeType===1||i){a=t[w]||(t[w]={});if((u=a[r])&&u[0]===S&&u[1]===s)return f[2]=u[2];a[r]=f;if(f[2]=e(t,n,o))return!0}}}function yt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function bt(e,t,n){var r=0,i=t.length;for(;r<i;r++)st(e,t[r],n);return n}function wt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function Et(e,t,n,r,i,s){return r&&!r[w]&&(r=Et(r)),i&&!i[w]&&(i=Et(i,s)),ut(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||bt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?wt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=wt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?B.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=wt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):P.apply(o,g)})}function St(e){var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=gt(function(e){return e===t},u,!0),c=gt(function(e){return B.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r))}];for(;a<s;a++)if(n=r.relative[e[a].type])h=[gt(yt(h),n)];else{n=r.filter[e[a].type].apply(null,e[a].matches);if(n[w]){i=++a;for(;i<s;i++)if(r.relative[e[i].type])break;return Et(a>1&&yt(h),a>1&&mt(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(z,"$1"),n,a<i&&St(e.slice(a,i)),i<s&&St(e=e.slice(i)),i<s&&mt(e))}h.push(n)}return yt(h)}function xt(e,t){var n=t.length>0,i=e.length>0,s=function(s,o,u,a,l){var c,h,d,v=0,m="0",g=s&&[],y=[],b=f,w=s||i&&r.find.TAG("*",l),E=S+=b==null?1:Math.random()||.1,x=w.length;l&&(f=o!==p&&o);for(;m!==x&&(c=w[m])!=null;m++){if(i&&c){h=0;while(d=e[h++])if(d(c,o,u)){a.push(c);break}l&&(S=E)}n&&((c=!d&&c)&&v--,s&&g.push(c))}v+=m;if(n&&m!==v){h=0;while(d=t[h++])d(g,y,o,u);if(s){if(v>0)while(m--)!g[m]&&!y[m]&&(y[m]=_.call(a));y=wt(y)}P.apply(a,y),l&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(a)}return l&&(S=E,f=b),g};return n?ut(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+ -(new Date),E=e.document,S=0,x=0,T=ot(),N=ot(),C=ot(),k=function(e,t){return e===t&&(c=!0),0},L=typeof undefined,A=1<<31,O={}.hasOwnProperty,M=[],_=M.pop,D=M.push,P=M.push,H=M.slice,B=M.indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},j="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",F="[\\x20\\t\\r\\n\\f]",I="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",q=I.replace("w","w#"),R="\\["+F+"*("+I+")(?:"+F+"*([*^$|!~]?=)"+F+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+q+"))|)"+F+"*\\]",U=":("+I+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+R+")*)|"+".*"+")\\)|)",z=new RegExp("^"+F+"+|((?:^|[^\\\\])(?:\\\\.)*)"+F+"+$","g"),W=new RegExp("^"+F+"*,"+F+"*"),X=new RegExp("^"+F+"*([>+~]|"+F+")"+F+"*"),V=new RegExp("="+F+"*([^\\]'\"]*?)"+F+"*\\]","g"),$=new RegExp(U),J=new RegExp("^"+q+"$"),K={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I.replace("w","w*")+")"),ATTR:new RegExp("^"+R),PSEUDO:new RegExp("^"+U),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+j+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},Q=/^(?:input|select|textarea|button)$/i,G=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/[+~]/,tt=/'|\\/g,nt=new RegExp("\\\\([\\da-f]{1,6}"+F+"?|("+F+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)};try{P.apply(M=H.call(E.childNodes),E.childNodes),M[E.childNodes.length].nodeType}catch(it){P={apply:M.length?function(e,t){D.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=st.support={},s=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},h=st.setDocument=function(e){var t,i=e?e.ownerDocument||e:E,o=i.defaultView;if(i===p||i.nodeType!==9||!i.documentElement)return p;p=i,d=i.documentElement,v=!s(i),o&&o!==o.top&&(o.addEventListener?o.addEventListener("unload",function(){h()},!1):o.attachEvent&&o.attachEvent("onunload",function(){h()})),n.attributes=at(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=at(function(e){return e.appendChild(i.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Y.test(i.getElementsByClassName)&&at(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",e.getElementsByClassName("i").length===2}),n.getById=at(function(e){return d.appendChild(e).id=w,!i.getElementsByName||!i.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!==L&&v){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!==L&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==L)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++])n.nodeType===1&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!==L&&v)return t.getElementsByClassName(e)},g=[],m=[];if(n.qsa=Y.test(i.querySelectorAll))at(function(e){e.innerHTML="<select msallowclip=''><option selected=''></option></select>",e.querySelectorAll("[msallowclip^='']").length&&m.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+F+"*(?:value|"+j+")"),e.querySelectorAll(":checked").length||m.push(":checked")}),at(function(e){var t=i.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+F+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")});return(n.matchesSelector=Y.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&at(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",U)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=Y.test(d.compareDocumentPosition),b=t||Y.test(d.contains)?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,r&1||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===i||e.ownerDocument===E&&b(E,e)?-1:t===i||t.ownerDocument===E&&b(E,t)?1:l?B.call(l,e)-B.call(l,t):0:r&4?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,s=e.parentNode,o=t.parentNode,u=[e],a=[t];if(!s||!o)return e===i?-1:t===i?1:s?-1:o?1:l?B.call(l,e)-B.call(l,t):0;if(s===o)return lt(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)a.unshift(n);while(u[r]===a[r])r++;return r?lt(u[r],a[r]):u[r]===E?-1:a[r]===E?1:0},i},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){(e.ownerDocument||e)!==p&&h(e),t=t.replace(V,"='$1']");if(n.matchesSelector&&v&&(!g||!g.test(t))&&(!m||!m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&e.document.nodeType!==11)return r}catch(i){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},st.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&O.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):undefined;return s!==undefined?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},st.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,r=[],i=0,s=0;c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k);if(c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=st.getText=function(e){var t,n="",r=0,s=e.nodeType;if(!s)while(t=e[r++])n+=i(t);else if(s===1||s===9||s===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(s===3||s===4)return e.nodeValue;return n},r=st.selectors={cacheLength:50,createPseudo:ut,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[3]||e[4]||e[5]||"").replace(nt,rt),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1].slice(0,3)==="nth"?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd")),e[5]=+(e[7]+e[8]||e[3]==="odd")):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&$.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return e==="*"?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&T(e,function(e){return t.test(typeof e.className=="string"&&e.className||typeof e.getAttribute!==L&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return i==null?t==="!=":t?(i+="",t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:c.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){l=m[w]||(m[w]={}),f=l[e]||[],p=f[0]===S&&f[1],h=f[0]===S&&f[2],c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(c.nodeType===1&&++h&&c===t){l[e]=[S,p,h];break}}else if(y&&(f=(t[w]||(t[w]={}))[e])&&f[0]===S)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:c.nodeType===1)&&++h){y&&((c[w]||(c[w]={}))[e]=[S,h]);if(c===t)break}return h-=i,h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=B.call(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:ut(function(e){var t=[],n=[],r=u(e.replace(z,"$1"));return r[w]?ut(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:ut(function(e){return function(t){return st(e,t).length>0}}),contains:ut(function(e){return function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:ut(function(e){return J.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||n.indexOf(e+"-")===0;while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return G.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()==="text")},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[n<0?n+t:n]}),even:pt(function(e,t){var n=0;for(;n<t;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;n<t;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=n<0?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=n<0?n+t:n;for(;++r<t;)e.push(r);return e})}},r.pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=ct(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=ht(t);return vt.prototype=r.filters=r.pseudos,r.setFilters=new vt,o=st.tokenize=function(e,t){var n,i,s,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=r.preFilter;while(u){if(!n||(i=W.exec(u)))i&&(u=u.slice(i[0].length)||u),a.push(s=[]);n=!1;if(i=X.exec(u))n=i.shift(),s.push({value:n,type:i[0].replace(z," ")}),u=u.slice(n.length);for(o in r.filter)(i=K[o].exec(u))&&(!f[o]||(i=f[o](i)))&&(n=i.shift(),s.push({value:n,type:o,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?st.error(e):N(e,a).slice(0)},u=st.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=o(e)),n=t.length;while(n--)s=St(t[n]),s[w]?r.push(s):i.push(s);s=C(e,xt(i,r)),s.selector=e}return s},a=st.select=function(e,t,i,s){var a,f,l,c,h,p=typeof e=="function"&&e,d=!s&&o(e=p.selector||e);i=i||[];if(d.length===1){f=d[0]=d[0].slice(0);if(f.length>2&&(l=f[0]).type==="ID"&&n.getById&&t.nodeType===9&&v&&r.relative[f[1].type]){t=(r.find.ID(l.matches[0].replace(nt,rt),t)||[])[0];if(!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=K.needsContext.test(e)?0:f.length;while(a--){l=f[a];if(r.relative[c=l.type])break;if(h=r.find[c])if(s=h(l.matches[0].replace(nt,rt),et.test(f[0].type)&&dt(t.parentNode)||t)){f.splice(a,1),e=s.length&&mt(f);if(!e)return P.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,et.test(e)&&dt(t.parentNode)||t),i},n.sortStable=
w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=at(function(e){return e.compareDocumentPosition(p.createElement("div"))&1}),at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild.getAttribute("href")==="#"})||ft("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,t.toLowerCase()==="type"?1:2)}),(!n.attributes||!at(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),e.firstChild.getAttribute("value")===""}))&&ft("value",function(e,t,n){if(!n&&e.nodeName.toLowerCase()==="input")return e.defaultValue}),at(function(e){return e.getAttribute("disabled")==null})||ft(j,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),st}(window);jQuery.find=Sizzle,jQuery.expr=Sizzle.selectors,jQuery.expr[":"]=jQuery.expr.pseudos,jQuery.unique=Sizzle.uniqueSort,jQuery.text=Sizzle.getText,jQuery.isXMLDoc=Sizzle.isXML,jQuery.contains=Sizzle.contains;var rneedsContext=jQuery.expr.match.needsContext,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,risSimple=/^.[^:#\[\.,]*$/;jQuery.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),t.length===1&&r.nodeType===1?jQuery.find.matchesSelector(r,e)?[r]:[]:jQuery.find.matches(e,jQuery.grep(t,function(e){return e.nodeType===1}))},jQuery.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if(typeof e!="string")return this.pushStack(jQuery(e).filter(function(){for(t=0;t<n;t++)if(jQuery.contains(i[t],this))return!0}));for(t=0;t<n;t++)jQuery.find(e,i[t],r);return r=this.pushStack(n>1?jQuery.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(winnow(this,e||[],!1))},not:function(e){return this.pushStack(winnow(this,e||[],!0))},is:function(e){return!!winnow(this,typeof e=="string"&&rneedsContext.test(e)?jQuery(e):e||[],!1).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(e,t){var n,r;if(!e)return this;if(typeof e=="string"){e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?n=[null,e,null]:n=rquickExpr.exec(e);if(n&&(n[1]||!t)){if(n[1]){t=t instanceof jQuery?t[0]:t,jQuery.merge(this,jQuery.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:document,!0));if(rsingleTag.test(n[1])&&jQuery.isPlainObject(t))for(n in t)jQuery.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return r=document.getElementById(n[2]),r&&r.parentNode&&(this.length=1,this[0]=r),this.context=document,this.selector=e,this}return!t||t.jquery?(t||rootjQuery).find(e):this.constructor(t).find(e)}return e.nodeType?(this.context=this[0]=e,this.length=1,this):jQuery.isFunction(e)?typeof rootjQuery.ready!="undefined"?rootjQuery.ready(e):e(jQuery):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),jQuery.makeArray(e,this))};init.prototype=jQuery.fn,rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:!0,contents:!0,next:!0,prev:!0};jQuery.extend({dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&e.nodeType!==9)if(e.nodeType===1){if(i&&jQuery(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}}),jQuery.fn.extend({has:function(e){var t=jQuery(e,this),n=t.length;return this.filter(function(){var e=0;for(;e<n;e++)if(jQuery.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,s=[],o=rneedsContext.test(e)||typeof e!="string"?jQuery(e,t||this.context):0;for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:n.nodeType===1&&jQuery.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?jQuery.unique(s):s)},index:function(e){return e?typeof e=="string"?indexOf.call(jQuery(e),this[0]):indexOf.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),jQuery(e,t))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),jQuery.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return jQuery.dir(e,"parentNode")},parentsUntil:function(e,t,n){return jQuery.dir(e,"parentNode",n)},next:function(e){return sibling(e,"nextSibling")},prev:function(e){return sibling(e,"previousSibling")},nextAll:function(e){return jQuery.dir(e,"nextSibling")},prevAll:function(e){return jQuery.dir(e,"previousSibling")},nextUntil:function(e,t,n){return jQuery.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return jQuery.dir(e,"previousSibling",n)},siblings:function(e){return jQuery.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return jQuery.sibling(e.firstChild)},contents:function(e){return e.contentDocument||jQuery.merge([],e.childNodes)}},function(e,t){jQuery.fn[e]=function(n,r){var i=jQuery.map(this,t,n);return e.slice(-5)!=="Until"&&(r=n),r&&typeof r=="string"&&(i=jQuery.filter(r,i)),this.length>1&&(guaranteedUnique[e]||jQuery.unique(i),rparentsprev.test(e)&&i.reverse()),this.pushStack(i)}});var rnotwhite=/\S+/g,optionsCache={};jQuery.Callbacks=function(e){e=typeof e=="string"?optionsCache[e]||createOptions(e):jQuery.extend({},e);var t,n,r,i,s,o,u=[],a=!e.once&&[],f=function(c){t=e.memory&&c,n=!0,o=i||0,i=0,s=u.length,r=!0;for(;u&&o<s;o++)if(u[o].apply(c[0],c[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,u&&(a?a.length&&f(a.shift()):t?u=[]:l.disable())},l={add:function(){if(u){var n=u.length;(function o(t){jQuery.each(t,function(t,n){var r=jQuery.type(n);r==="function"?(!e.unique||!l.has(n))&&u.push(n):n&&n.length&&r!=="string"&&o(n)})})(arguments),r?s=u.length:t&&(i=n,f(t))}return this},remove:function(){return u&&jQuery.each(arguments,function(e,t){var n;while((n=jQuery.inArray(t,u,n))>-1)u.splice(n,1),r&&(n<=s&&s--,n<=o&&o--)}),this},has:function(e){return e?jQuery.inArray(e,u)>-1:!!u&&!!u.length},empty:function(){return u=[],s=0,this},disable:function(){return u=a=t=undefined,this},disabled:function(){return!u},lock:function(){return a=undefined,t||l.disable(),this},locked:function(){return!a},fireWith:function(e,t){return u&&(!n||a)&&(t=t||[],t=[e,t.slice?t.slice():t],r?a.push(t):f(t)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!n}};return l},jQuery.extend({Deferred:function(e){var t=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return jQuery.Deferred(function(n){jQuery.each(t,function(t,s){var o=jQuery.isFunction(e[t])&&e[t];i[s[1]](function(){var e=o&&o.apply(this,arguments);e&&jQuery.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return e!=null?jQuery.extend(e,r):r}},i={};return r.pipe=r.then,jQuery.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=slice.call(arguments),r=n.length,i=r!==1||e&&jQuery.isFunction(e.promise)?r:0,s=i===1?e:jQuery.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?slice.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&jQuery.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}});var readyList;jQuery.fn.ready=function(e){return jQuery.ready.promise().done(e),this},jQuery.extend({isReady:!1,readyWait:1,holdReady:function(e){e?jQuery.readyWait++:jQuery.ready(!0)},ready:function(e){if(e===!0?--jQuery.readyWait:jQuery.isReady)return;jQuery.isReady=!0;if(e!==!0&&--jQuery.readyWait>0)return;readyList.resolveWith(document,[jQuery]),jQuery.fn.triggerHandler&&(jQuery(document).triggerHandler("ready"),jQuery(document).off("ready"))}}),jQuery.ready.promise=function(e){return readyList||(readyList=jQuery.Deferred(),document.readyState==="complete"?setTimeout(jQuery.ready):(document.addEventListener("DOMContentLoaded",completed,!1),window.addEventListener("load",completed,!1))),readyList.promise(e)},jQuery.ready.promise();var access=jQuery.access=function(e,t,n,r,i,s,o){var u=0,a=e.length,f=n==null;if(jQuery.type(n)==="object"){i=!0;for(u in n)jQuery.access(e,t,u,n[u],!0,s,o)}else if(r!==undefined){i=!0,jQuery.isFunction(r)||(o=!0),f&&(o?(t.call(e,r),t=null):(f=t,t=function(e,t,n){return f.call(jQuery(e),n)}));if(t)for(;u<a;u++)t(e[u],n,o?r:r.call(e[u],u,t(e[u],n)))}return i?e:f?t.call(e):a?t(e[0],n):s};jQuery.acceptData=function(e){return e.nodeType===1||e.nodeType===9||!+e.nodeType},Data.uid=1,Data.accepts=jQuery.acceptData,Data.prototype={key:function(e){if(!Data.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=Data.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,jQuery.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),s=this.cache[i];if(typeof t=="string")s[t]=n;else if(jQuery.isEmptyObject(s))jQuery.extend(this.cache[i],t);else for(r in t)s[r]=t[r];return s},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&typeof t=="string"&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,jQuery.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,s=this.key(e),o=this.cache[s];if(t===undefined)this.cache[s]={};else{jQuery.isArray(t)?r=t.concat(t.map(jQuery.camelCase)):(i=jQuery.camelCase(t),t in o?r=[t,i]:(r=i,r=r in o?[r]:r.match(rnotwhite)||[])),n=r.length;while(n--)delete o[r[n]]}},hasData:function(e){return!jQuery.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}};var data_priv=new Data,data_user=new Data,rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/([A-Z])/g;jQuery.extend({hasData:function(e){return data_user.hasData(e)||data_priv.hasData(e)},data:function(e,t,n){return data_user.access(e,t,n)},removeData:function(e,t){data_user.remove(e,t)},_data:function(e,t,n){return data_priv.access(e,t,n)},_removeData:function(e,t){data_priv.remove(e,t)}}),jQuery.fn.extend({data:function(e,t){var n,r,i,s=this[0],o=s&&s.attributes;if(e===undefined){if(this.length){i=data_user.get(s);if(s.nodeType===1&&!data_priv.get(s,"hasDataAttrs")){n=o.length;while(n--)o[n]&&(r=o[n].name,r.indexOf("data-")===0&&(r=jQuery.camelCase(r.slice(5)),dataAttr(s,r,i[r])));data_priv.set(s,"hasDataAttrs",!0)}}return i}return typeof e=="object"?this.each(function(){data_user.set(this,e)}):access(this,function(t){var n,r=jQuery.camelCase(e);if(s&&t===undefined){n=data_user.get(s,e);if(n!==undefined)return n;n=data_user.get(s,r);if(n!==undefined)return n;n=dataAttr(s,r,undefined);if(n!==undefined)return n;return}this.each(function(){var n=data_user.get(this,r);data_user.set(this,r,t),e.indexOf("-")!==-1&&n!==undefined&&data_user.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){data_user.remove(this,e)})}}),jQuery.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=data_priv.get(e,t),n&&(!r||jQuery.isArray(n)?r=data_priv.access(e,t,jQuery.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=jQuery.queue(e,t),r=n.length,i=n.shift(),s=jQuery._queueHooks(e,t),o=function(){jQuery.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return data_priv.get(e,n)||data_priv.access(e,n,{empty:jQuery.Callbacks("once memory").add(function(){data_priv.remove(e,[t+"queue",n])})})}}),jQuery.fn.extend({queue:function(e,t){var n=2;return typeof e!="string"&&(t=e,e="fx",n--),arguments.length<n?jQuery.queue(this[0],e):t===undefined?this:this.each(function(){var n=jQuery.queue(this,e,t);jQuery._queueHooks(this,e),e==="fx"&&n[0]!=="inprogress"&&jQuery.dequeue(this,e)})},dequeue:function(e){return this.each(function(){jQuery.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=jQuery.Deferred(),s=this,o=this.length,u=function(){--r||i.resolveWith(s,[s])};typeof e!="string"&&(t=e,e=undefined),e=e||"fx";while(o--)n=data_priv.get(s[o],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(u));return u(),i.promise(t)}});var pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,cssExpand=["Top","Right","Bottom","Left"],isHidden=function(e,t){return e=t||e,jQuery.css(e,"display")==="none"||!jQuery.contains(e.ownerDocument,e)},rcheckableType=/^(?:checkbox|radio)$/i;(function(){var e=document.createDocumentFragment(),t=e.appendChild(document.createElement("div")),n=document.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),support.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",support.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue})();var strundefined=typeof undefined;support.focusinBubbles="onfocusin"in window;var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,rtypenamespace=/^([^.]*)(?:\.(.+)|)$/;jQuery.event={global:{},add:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=data_priv.get(e);if(!m)return;n.handler&&(s=n,n=s.handler,i=s.selector),n.guid||(n.guid=jQuery.guid++),(a=m.events)||(a=m.events={}),(o=m.handle)||(o=m.handle=function(t){return typeof jQuery!==strundefined&&jQuery.event.triggered!==t.type?jQuery.event.dispatch.apply(e,arguments):undefined}),t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p)continue;c=jQuery.event.special[p]||{},p=(i?c.delegateType:c.bindType)||p,c=jQuery.event.special[p]||{},l=jQuery.extend({type:p,origType:v,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&jQuery.expr.match.needsContext.test(i),namespace:d.join(".")},s),(h=a[p])||(h=a[p]=[],h.delegateCount=0,(!c.setup||c.setup.call(e,r,d,o)===!1)&&e.addEventListener&&e.addEventListener(p,o,!1)),c.add&&(c.add.call(e,l),l.handler.guid||(l.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,l):h.push(l),jQuery.event.global[p]=!0}},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=data_priv.hasData(e)&&data_priv.get(e);if(!m||!(a=m.events))return;t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p){for(p in a)jQuery.event.remove(e,p+t[f],n,r,!0);continue}c=jQuery.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,h=a[p]||[],u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;while(s--)l=h[s],(i||v===l.origType)&&(!n||n.guid===l.guid)&&(!u||u.test(l.namespace))&&(!r||r===l.selector||r==="**"&&l.selector)&&(h.splice(s,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&((!c.teardown||c.teardown.call(e,d,m.handle)===!1)&&jQuery.removeEvent(e,p,m.handle),delete a[p])}jQuery.isEmptyObject(a)&&(delete m.handle,data_priv.remove(e,"events"))},trigger:function(e,t,n,r){var i,s,o,u,a,f,l,c=[n||document],h=hasOwn.call(e,"type")?e.type:e,p=hasOwn.call(e,"namespace")?e.namespace.split("."):[];s=o=n=n||document;if(n.nodeType===3||n.nodeType===8)return;if(rfocusMorph.test(h+jQuery.event.triggered))return;h.indexOf(".")>=0&&(p=h.split("."),h=p.shift(),p.sort()),a=h.indexOf(":")<0&&"on"+h,e=e[jQuery.expando]?e:new jQuery.Event(h,typeof e=="object"&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=undefined,e.target||(e.target=n),t=t==null?[e]:jQuery.makeArray(t,[e]),l=jQuery.event.special[h]||{};if(!r&&l.trigger&&l.trigger.apply(n,t)===!1)return;if(!r&&!l.noBubble&&!jQuery.isWindow(n)){u=l.delegateType||h,rfocusMorph.test(u+h)||(s=s.parentNode);for(;s;s=s.parentNode)c.push(s),o=s;o===(n.ownerDocument||document)&&c.push(o.defaultView||o.parentWindow||window)}i=0;while((s=c[i++])&&!e.isPropagationStopped())e.type=i>1?u:l.bindType||h,f=(data_priv.get(s,"events")||{})[e.type]&&data_priv.get(s,"handle"),f&&f.apply(s,t),f=a&&s[a],f&&f.apply&&jQuery.acceptData(s)&&(e.result=f.apply(s,t),e.result===!1&&e.preventDefault());return e.type=h,!r&&!e.isDefaultPrevented()&&(!l._default||l._default.apply(c.pop(),t)===!1)&&jQuery.acceptData(n)&&a&&jQuery.isFunction(n[h])&&!jQuery.isWindow(n)&&(o=n[a],o&&(n[a]=null),jQuery.event.triggered=h,n[h](),jQuery.event.triggered=undefined,o&&(n[a]=o)),e.result},dispatch:function(e){e=jQuery.event.fix(e);var t,n,r,i,s,o=[],u=slice.call(arguments),a=(data_priv.get(this,"events")||{})[e.type]||[],f=jQuery.event.special[e.type]||{};u[0]=e,e.delegateTarget=this;if(f.preDispatch&&f.preDispatch.call(this,e)===!1)return;o=jQuery.event.handlers.call(this,e,a),t=0;while((i=o[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((s=i.handlers[n++])&&!e.isImmediatePropagationStopped())if(!e.namespace_re||e.namespace_re.test(s.namespace))e.handleObj=s,e.data=s.data,r=((jQuery.event.special[s.origType]||{}).handle||s.handler).apply(i.elem,u),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation())}return f.postDispatch&&f.postDispatch.call(this,e),e.result},handlers:function(e,t){var n,r,i,s,o=[],u=t.delegateCount,a=e.target;if(u&&a.nodeType&&(!e.button||e.type!=="click"))for(;a!==this;a=a.parentNode||this)if(a.disabled!==!0||e.type!=="click"){r=[];for(n=0;n<u;n++)s=t[n],i=s.selector+" ",r[i]===undefined&&(r[i]=s.needsContext?jQuery(i,this).index(a)>=0:jQuery.find(i,this,null,[a]).length),r[i]&&r.push(s);r.length&&o.push({elem:a,handlers:r})}return u<t.length&&o.push({elem:this,handlers:t.slice(u)}),o},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return e.pageX==null&&t.clientX!=null&&(n=e.target.ownerDocument||document,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),!e.which&&s!==undefined&&(e.which=s&1?1:s&2?3:s&4?2:0),e}},fix:function(e){if(e[jQuery.expando])return e;var t,n,r,i=e.type,s=e,o=this.fixHooks[i];o||(this.fixHooks[i]=o=rmouseEvent.test(i)?this.mouseHooks:rkeyEvent.test(i)?this.keyHooks:{}),r=o.props?this.props.concat(o.props):this.props,e=new jQuery.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=document),e.target.nodeType===3&&(e.target=e.target.parentNode),o.filter?o.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==safeActiveElement()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===safeActiveElement()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(this.type==="checkbox"&&this.click&&jQuery.nodeName(this,"input"))return this.click(),!1},_default:function(e){return jQuery.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=jQuery.extend(new jQuery.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?jQuery.event.trigger(i,null,t):jQuery.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},jQuery.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},jQuery.Event=function(e,t){if(!(this instanceof jQuery.Event))return new jQuery.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.defaultPrevented===undefined&&e.returnValue===!1?returnTrue:returnFalse):this.type=e,t&&jQuery.extend(this,t),this.timeStamp=e&&e.timeStamp||jQuery.now(),this[jQuery.expando]=!0},jQuery.Event.prototype={isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){jQuery.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;if(!i||i!==r&&!jQuery.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),support.focusinBubbles||jQuery.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){jQuery.event.simulate(t,e.target,jQuery.event.fix(e),!0)};jQuery.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=data_priv.access(r,t);i||r.addEventListener(e,n,!0),data_priv.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=data_priv.access(r,t)-1;i?data_priv.access(r,t,i):(r.removeEventListener(e,n,!0),data_priv.remove(r,t))}}}),jQuery.fn.extend({on:function(e,t,n,r,i){var s,o;if(typeof e=="object"){typeof t!="string"&&(n=n||t,t=undefined);for(o in e)this.on(o,t,n,e[o],i);return this}n==null&&r==null?(r=t,n=t=undefined):r==null&&(typeof t=="string"?(r=n,n=undefined):(r=n,n=t,t=undefined));if(r===!1)r=returnFalse;else if(!r)return this;return i===1&&(s=r,r=function(e){return jQuery().off(e),s.apply(this,arguments)},r.guid=s.guid||(s.guid=jQuery.guid++)),this.each(function(){jQuery.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,jQuery(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if(typeof e=="object"){for(i in e)this.off(i,t,e[i]);return this}if(t===!1||typeof t=="function")n=t,t=undefined;return n===!1&&(n=returnFalse),this.each(function(){jQuery.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){jQuery.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return jQuery.event.trigger(e,t,n,!0)}});var rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,rtagName=/<([\w:]+)/,rhtml=/<|&#?\w+;/,rnoInnerhtml=/<(?:script|style|link)/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/^$|\/(?:java|ecma)script/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option,wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead,wrapMap.th=wrapMap.td,jQuery.extend({clone:function(e,t,n){var r,i,s,o,u=e.cloneNode(!0),a=jQuery.contains(e.ownerDocument,e);if(!support.noCloneChecked&&(e.nodeType===1||e.nodeType===11)&&!jQuery.isXMLDoc(e)){o=getAll(u),s=getAll(e);for(r=0,i=s.length;r<i;r++)fixInput(s[r],o[r])}if(t)if(n){s=s||getAll(e),o=o||getAll(u);for(r=0,i=s.length;r<i;r++)cloneCopyEvent(s[r],o[r])}else cloneCopyEvent(e,u);return o=getAll(u,"script"),o.length>0&&setGlobalEval(o,!a&&getAll(e,"script")),u},buildFragment:function(e,t,n,r){var i,s,o,u,a,f,l=t.createDocumentFragment(),c=[],h=0,p=e.length;for(;h<p;h++){i=e[h];if(i||i===0)if(jQuery.type(i)==="object")jQuery.merge(c,i.nodeType?[i]:i);else if(!rhtml.test(i))c.push(t.createTextNode(i));else{s=s||l.appendChild(t.createElement("div")),o=(rtagName.exec(i)||["",""])[1].toLowerCase(),u=wrapMap[o]||wrapMap._default,s.innerHTML=u[1]+i.replace(rxhtmlTag,"<$1></$2>")+u[2],f=u[0];while(f--)s=s.lastChild;jQuery.merge(c,s.childNodes),s=l.firstChild,s.textContent=""}}l.textContent="",h=0;while(i=c[h++]){if(r&&jQuery.inArray(i,r)!==-1)continue;a=jQuery.contains(i.ownerDocument,i),s=getAll(l.appendChild(i),"script"),a&&setGlobalEval(s);if(n){f=0;while(i=s[f++])rscriptType.test(i.type||"")&&n.push(i)}}return l},cleanData:function(e){var t,n,r,i,s=jQuery.event.special,o=0;for(;(n=e[o])!==undefined;o++){if(jQuery.acceptData(n)){i=n[data_priv.expando];if(i&&(t=data_priv.cache[i])){if(t.events)for(r in t.events)s[r]?jQuery.event.remove(n,r):jQuery.removeEvent(n,r,t.handle);data_priv.cache[i]&&delete data_priv.cache[i]}}delete data_user.cache[n[data_user.expando]]}}}),jQuery.fn.extend({text:function(e){return access(this,function(e){return e===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9)this.textContent=e})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?jQuery.filter(e,this):this,i=0;for(;(n=r[i])!=null;i++)!t&&n.nodeType===1&&jQuery.cleanData(getAll(n)),n.parentNode&&(t&&jQuery.contains(n.ownerDocument,n)&&setGlobalEval(getAll(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++)e.nodeType===1&&(jQuery.cleanData(getAll(e,!1)),e.textContent="");return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return jQuery.clone(this,e,t)})},html:function(e){return access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&t.nodeType===1)return t.innerHTML;if(typeof e=="string"&&!rnoInnerhtml.test(e)&&!wrapMap[(rtagName.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(rxhtmlTag,"<$1></$2>");try{for(;n<r;n++)t=this[n]||{},t.nodeType===1&&(jQuery.cleanData(getAll(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,jQuery.cleanData(getAll(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=concat.apply([],e);var n,r,i,s,o,u,a=0,f=this.length,l=this,c=f-1,h=e[0],p=jQuery.isFunction(h);if(p||f>1&&typeof h=="string"&&!support.checkClone&&rchecked.test(h))return this.each(function(n){var r=l.eq(n);p&&(e[0]=h.call(this,n,r.html())),r.domManip(e,t)});if(f){n=jQuery.buildFragment(e,this[0].ownerDocument,!1,this),r=n.firstChild,n.childNodes.length===1&&(n=r);if(r){i=jQuery.map(getAll(n,"script"),disableScript),s=i.length;for(;a<f;a++)o=n,a!==c&&(o=jQuery.clone(o,!0,!0),s&&jQuery.merge(i,getAll(o,"script"))),t.call(this[a],o,a);if(s){u=i[i.length-1].ownerDocument,jQuery.map(i,restoreScript);for(a=0;a<s;a++)o=i[a],rscriptType.test(o.type||"")&&!data_priv.access(o,"globalEval")&&jQuery.contains(u,o)&&(o.src?jQuery._evalUrl&&jQuery._evalUrl(o.src):jQuery.globalEval(o.textContent.replace(rcleanScript,"")))}}}return this}}),jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){jQuery.fn[e]=function(e){var n,r=[],i=jQuery(e),s=i.length-1,o=0;for(;o<=s;o++)n=o===s?this:this.clone(!0),jQuery(i[o])[t](n),push.apply(r,n.get());return this.pushStack(r)}});var iframe,elemdisplay={},rmargin=/^margin/,rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i"),getStyles=function(e){return e.ownerDocument.defaultView.getComputedStyle(e,null)};(function(){function s(){i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",i.innerHTML="",n.appendChild(r);var s=window.getComputedStyle(i,null);e=s.top!=="1%",t=s.width==="4px",n.removeChild(r)}var e,t,n=document.documentElement,r=document.createElement("div"),i=document.createElement("div");if(!i.style)return;i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",support.clearCloneStyle=i.style.backgroundClip==="content-box",r.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",r.appendChild(i),window.getComputedStyle&&jQuery.extend(support,{pixelPosition:function(){return s(),e},boxSizingReliable:function(){return t==null&&s(),t},reliableMarginRight:function(){var e,t=i.appendChild(document.createElement("div"));return t.style.cssText=i.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",i.style.width="1px",n.appendChild(r),e=!parseFloat(window.getComputedStyle(t,null).marginRight),n.removeChild(r),e}})})(),jQuery.swap=function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i};var rdisplayswap=/^(none|table(?!-c[ea]).+)/,rnumsplit=new RegExp("^("+pnum+")(.*)$","i"),rrelNum=new RegExp("^([+-])=("+pnum+")","i"),cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"];jQuery.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=curCSS(e,"opacity");return n===""?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var i,s,o,u=jQuery.camelCase(t),a=e.style;t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(a,u)),o=jQuery.cssHooks[t]||jQuery.cssHooks[u];if(n===undefined)return o&&"get"in o&&(i=o.get(e,!1,r))!==undefined?i:a[t];s=typeof n,s==="string"&&(i=rrelNum.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(jQuery.css(e,t)),s="number");if(n==null||n!==n)return;s==="number"&&!jQuery.cssNumber[u]&&(n+="px"),!support.clearCloneStyle&&n===""&&t.indexOf("background")===0&&(a[t]="inherit");if(!o||!("set"in o)||(n=o.set(e,n,r))!==undefined)a[t]=n},css:function(e,t,n,r){var i,s,o,u=jQuery.camelCase(t);return t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(e.style,u)),o=jQuery.cssHooks[t]||jQuery.cssHooks[u],o&&"get"in o&&(i=o.get(e,!0,n)),i===undefined&&(i=curCSS(e,t,r)),i==="normal"&&t in cssNormalTransform&&(i=cssNormalTransform[t]),n===""||n?(s=parseFloat(i),n===!0||jQuery.isNumeric(s)?s||0:i):i}}),jQuery.each(["height","width"],function(e,t){jQuery.cssHooks[t]={get:function(e,n,r){if(n)return rdisplayswap.test(jQuery.css(e,"display"))&&e.offsetWidth===0?jQuery.swap(e,cssShow,function(){return getWidthOrHeight(e,t,r)}):getWidthOrHeight(e,t,r)},set:function(e,n,r){var i=r&&getStyles(e);return setPositiveNumber(e,n,r?augmentWidthOrHeight(e,t,r,jQuery.css(e,"boxSizing",!1,i)==="border-box",i):0)}}}),jQuery.cssHooks.marginRight=addGetHookIf(support.reliableMarginRight,function(e,t){if(t)return jQuery.swap(e,{display:"inline-block"},curCSS,[e,"marginRight"])}),jQuery.each({margin:"",padding:"",border:"Width"},function(e,t){jQuery.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n=="string"?n.split(" "):[n];for(;r<4;r++)i[e+cssExpand[r]+t]=s[r]||s[r-2]||s[0];return i}},rmargin.test(e)||(jQuery.cssHooks[e+t].set=setPositiveNumber)}),jQuery.fn.extend
({css:function(e,t){return access(this,function(e,t,n){var r,i,s={},o=0;if(jQuery.isArray(t)){r=getStyles(e),i=t.length;for(;o<i;o++)s[t[o]]=jQuery.css(e,t[o],!1,r);return s}return n!==undefined?jQuery.style(e,t,n):jQuery.css(e,t)},e,t,arguments.length>1)},show:function(){return showHide(this,!0)},hide:function(){return showHide(this)},toggle:function(e){return typeof e=="boolean"?e?this.show():this.hide():this.each(function(){isHidden(this)?jQuery(this).show():jQuery(this).hide()})}}),jQuery.Tween=Tween,Tween.prototype={constructor:Tween,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(jQuery.cssNumber[n]?"":"px")},cur:function(){var e=Tween.propHooks[this.prop];return e&&e.get?e.get(this):Tween.propHooks._default.get(this)},run:function(e){var t,n=Tween.propHooks[this.prop];return this.options.duration?this.pos=t=jQuery.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Tween.propHooks._default.set(this),this}},Tween.prototype.init.prototype=Tween.prototype,Tween.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=jQuery.css(e.elem,e.prop,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){jQuery.fx.step[e.prop]?jQuery.fx.step[e.prop](e):e.elem.style&&(e.elem.style[jQuery.cssProps[e.prop]]!=null||jQuery.cssHooks[e.prop])?jQuery.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},jQuery.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},jQuery.fx=Tween.prototype.init,jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i"),rrun=/queueHooks$/,animationPrefilters=[defaultPrefilter],tweeners={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=rfxnum.exec(t),s=i&&i[3]||(jQuery.cssNumber[e]?"":"px"),o=(jQuery.cssNumber[e]||s!=="px"&&+r)&&rfxnum.exec(jQuery.css(n.elem,e)),u=1,a=20;if(o&&o[3]!==s){s=s||o[3],i=i||[],o=+r||1;do u=u||".5",o/=u,jQuery.style(n.elem,e,o+s);while(u!==(u=n.cur()/r)&&u!==1&&--a)}return i&&(o=n.start=+o||+r||0,n.unit=s,n.end=i[1]?o+(i[1]+1)*i[2]:+i[2]),n}]};jQuery.Animation=jQuery.extend(Animation,{tweener:function(e,t){jQuery.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],tweeners[n]=tweeners[n]||[],tweeners[n].unshift(t)},prefilter:function(e,t){t?animationPrefilters.unshift(e):animationPrefilters.push(e)}}),jQuery.speed=function(e,t,n){var r=e&&typeof e=="object"?jQuery.extend({},e):{complete:n||!n&&t||jQuery.isFunction(e)&&e,duration:e,easing:n&&t||t&&!jQuery.isFunction(t)&&t};r.duration=jQuery.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in jQuery.fx.speeds?jQuery.fx.speeds[r.duration]:jQuery.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){jQuery.isFunction(r.old)&&r.old.call(this),r.queue&&jQuery.dequeue(this,r.queue)},r},jQuery.fn.extend({fadeTo:function(e,t,n,r){return this.filter(isHidden).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=jQuery.isEmptyObject(e),s=jQuery.speed(t,n,r),o=function(){var t=Animation(this,jQuery.extend({},e),s);(i||data_priv.get(this,"finish"))&&t.stop(!0)};return o.finish=o,i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return typeof e!="string"&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=e!=null&&e+"queueHooks",s=jQuery.timers,o=data_priv.get(this);if(i)o[i]&&o[i].stop&&r(o[i]);else for(i in o)o[i]&&o[i].stop&&rrun.test(i)&&r(o[i]);for(i=s.length;i--;)s[i].elem===this&&(e==null||s[i].queue===e)&&(s[i].anim.stop(n),t=!1,s.splice(i,1));(t||!n)&&jQuery.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=data_priv.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=jQuery.timers,o=r?r.length:0;n.finish=!0,jQuery.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0);for(t=s.length;t--;)s[t].elem===this&&s[t].queue===e&&(s[t].anim.stop(!0),s.splice(t,1));for(t=0;t<o;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),jQuery.each(["toggle","show","hide"],function(e,t){var n=jQuery.fn[t];jQuery.fn[t]=function(e,r,i){return e==null||typeof e=="boolean"?n.apply(this,arguments):this.animate(genFx(t,!0),e,r,i)}}),jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){jQuery.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),jQuery.timers=[],jQuery.fx.tick=function(){var e,t=0,n=jQuery.timers;fxNow=jQuery.now();for(;t<n.length;t++)e=n[t],!e()&&n[t]===e&&n.splice(t--,1);n.length||jQuery.fx.stop(),fxNow=undefined},jQuery.fx.timer=function(e){jQuery.timers.push(e),e()?jQuery.fx.start():jQuery.timers.pop()},jQuery.fx.interval=13,jQuery.fx.start=function(){timerId||(timerId=setInterval(jQuery.fx.tick,jQuery.fx.interval))},jQuery.fx.stop=function(){clearInterval(timerId),timerId=null},jQuery.fx.speeds={slow:600,fast:200,_default:400},jQuery.fn.delay=function(e,t){return e=jQuery.fx?jQuery.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},function(){var e=document.createElement("input"),t=document.createElement("select"),n=t.appendChild(document.createElement("option"));e.type="checkbox",support.checkOn=e.value!=="",support.optSelected=n.selected,t.disabled=!0,support.optDisabled=!n.disabled,e=document.createElement("input"),e.value="t",e.type="radio",support.radioValue=e.value==="t"}();var nodeHook,boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(e,t){return access(this,jQuery.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){jQuery.removeAttr(this,e)})}}),jQuery.extend({attr:function(e,t,n){var r,i,s=e.nodeType;if(!e||s===3||s===8||s===2)return;if(typeof e.getAttribute===strundefined)return jQuery.prop(e,t,n);if(s!==1||!jQuery.isXMLDoc(e))t=t.toLowerCase(),r=jQuery.attrHooks[t]||(jQuery.expr.match.bool.test(t)?boolHook:nodeHook);if(n===undefined)return r&&"get"in r&&(i=r.get(e,t))!==null?i:(i=jQuery.find.attr(e,t),i==null?undefined:i);if(n!==null)return r&&"set"in r&&(i=r.set(e,n,t))!==undefined?i:(e.setAttribute(t,n+""),n);jQuery.removeAttr(e,t)},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(rnotwhite);if(s&&e.nodeType===1)while(n=s[i++])r=jQuery.propFix[n]||n,jQuery.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!support.radioValue&&t==="radio"&&jQuery.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),boolHook={set:function(e,t,n){return t===!1?jQuery.removeAttr(e,n):e.setAttribute(n,n),n}},jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(e,t){var n=attrHandle[t]||jQuery.find.attr;attrHandle[t]=function(e,t,r){var i,s;return r||(s=attrHandle[t],attrHandle[t]=i,i=n(e,t,r)!=null?t.toLowerCase():null,attrHandle[t]=s),i}});var rfocusable=/^(?:input|select|textarea|button)$/i;jQuery.fn.extend({prop:function(e,t){return access(this,jQuery.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[jQuery.propFix[e]||e]})}}),jQuery.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,s,o=e.nodeType;if(!e||o===3||o===8||o===2)return;return s=o!==1||!jQuery.isXMLDoc(e),s&&(t=jQuery.propFix[t]||t,i=jQuery.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&(r=i.get(e,t))!==null?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||rfocusable.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),support.optSelected||(jQuery.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});var rclass=/[\t\r\n\f]/g;jQuery.fn.extend({addClass:function(e){var t,n,r,i,s,o,u=typeof e=="string"&&e,a=0,f=this.length;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).addClass(e.call(this,t,this.className))});if(u){t=(e||"").match(rnotwhite)||[];for(;a<f;a++){n=this[a],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(rclass," "):" ");if(r){s=0;while(i=t[s++])r.indexOf(" "+i+" ")<0&&(r+=i+" ");o=jQuery.trim(r),n.className!==o&&(n.className=o)}}}return this},removeClass:function(e){var t,n,r,i,s,o,u=arguments.length===0||typeof e=="string"&&e,a=0,f=this.length;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).removeClass(e.call(this,t,this.className))});if(u){t=(e||"").match(rnotwhite)||[];for(;a<f;a++){n=this[a],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(rclass," "):"");if(r){s=0;while(i=t[s++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");o=e?jQuery.trim(r):"",n.className!==o&&(n.className=o)}}}return this},toggleClass:function(e,t){var n=typeof e;return typeof t=="boolean"&&n==="string"?t?this.addClass(e):this.removeClass(e):jQuery.isFunction(e)?this.each(function(n){jQuery(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var t,r=0,i=jQuery(this),s=e.match(rnotwhite)||[];while(t=s[r++])i.hasClass(t)?i.removeClass(t):i.addClass(t)}else if(n===strundefined||n==="boolean")this.className&&data_priv.set(this,"__className__",this.className),this.className=this.className||e===!1?"":data_priv.get(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(rclass," ").indexOf(t)>=0)return!0;return!1}});var rreturn=/\r/g;jQuery.fn.extend({val:function(e){var t,n,r,i=this[0];if(!arguments.length){if(i)return t=jQuery.valHooks[i.type]||jQuery.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,typeof n=="string"?n.replace(rreturn,""):n==null?"":n);return}return r=jQuery.isFunction(e),this.each(function(n){var i;if(this.nodeType!==1)return;r?i=e.call(this,n,jQuery(this).val()):i=e,i==null?i="":typeof i=="number"?i+="":jQuery.isArray(i)&&(i=jQuery.map(i,function(e){return e==null?"":e+""})),t=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!t||!("set"in t)||t.set(this,i,"value")===undefined)this.value=i})}}),jQuery.extend({valHooks:{option:{get:function(e){var t=jQuery.find.attr(e,"value");return t!=null?t:jQuery.trim(jQuery.text(e))}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!jQuery.nodeName(n.parentNode,"optgroup"))){t=jQuery(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n,r,i=e.options,s=jQuery.makeArray(t),o=i.length;while(o--){r=i[o];if(r.selected=jQuery.inArray(r.value,s)>=0)n=!0}return n||(e.selectedIndex=-1),s}}}}),jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(e,t){if(jQuery.isArray(t))return e.checked=jQuery.inArray(jQuery(e).val(),t)>=0}},support.checkOn||(jQuery.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})}),jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){jQuery.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),jQuery.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)}});var nonce=jQuery.now(),rquery=/\?/;jQuery.parseJSON=function(e){return JSON.parse(e+"")},jQuery.parseXML=function(e){var t,n;if(!e||typeof e!="string")return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&jQuery.error("Invalid XML: "+e),t};var ajaxLocParts,ajaxLocation,rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rurl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,prefilters={},transports={},allTypes="*/".concat("*");try{ajaxLocation=location.href}catch(e){ajaxLocation=document.createElement("a"),ajaxLocation.href="",ajaxLocation=ajaxLocation.href}ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[],jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ajaxLocation,type:"GET",isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ajaxExtend(ajaxExtend(e,jQuery.ajaxSettings),t):ajaxExtend(jQuery.ajaxSettings,e)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(e,t){function S(e,t,s,u){var f,m,g,b,E,S=t;if(y===2)return;y=2,o&&clearTimeout(o),n=undefined,i=u||"",w.readyState=e>0?4:0,f=e>=200&&e<300||e===304,s&&(b=ajaxHandleResponses(l,w,s)),b=ajaxConvert(l,b,w,f);if(f)l.ifModified&&(E=w.getResponseHeader("Last-Modified"),E&&(jQuery.lastModified[r]=E),E=w.getResponseHeader("etag"),E&&(jQuery.etag[r]=E)),e===204||l.type==="HEAD"?S="nocontent":e===304?S="notmodified":(S=b.state,m=b.data,g=b.error,f=!g);else{g=S;if(e||!S)S="error",e<0&&(e=0)}w.status=e,w.statusText=(t||S)+"",f?p.resolveWith(c,[m,S,w]):p.rejectWith(c,[w,S,g]),w.statusCode(v),v=undefined,a&&h.trigger(f?"ajaxSuccess":"ajaxError",[w,l,f?m:g]),d.fireWith(c,[w,S]),a&&(h.trigger("ajaxComplete",[w,l]),--jQuery.active||jQuery.event.trigger("ajaxStop"))}typeof e=="object"&&(t=e,e=undefined),t=t||{};var n,r,i,s,o,u,a,f,l=jQuery.ajaxSetup({},t),c=l.context||l,h=l.context&&(c.nodeType||c.jquery)?jQuery(c):jQuery.event,p=jQuery.Deferred(),d=jQuery.Callbacks("once memory"),v=l.statusCode||{},m={},g={},y=0,b="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(y===2){if(!s){s={};while(t=rheaders.exec(i))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return y===2?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return y||(e=g[n]=g[n]||e,m[e]=t),this},overrideMimeType:function(e){return y||(l.mimeType=e),this},statusCode:function(e){var t;if(e)if(y<2)for(t in e)v[t]=[v[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),S(0,t),this}};p.promise(w).complete=d.add,w.success=w.done,w.error=w.fail,l.url=((e||l.url||ajaxLocation)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//"),l.type=t.method||t.type||l.method||l.type,l.dataTypes=jQuery.trim(l.dataType||"*").toLowerCase().match(rnotwhite)||[""],l.crossDomain==null&&(u=rurl.exec(l.url.toLowerCase()),l.crossDomain=!(!u||u[1]===ajaxLocParts[1]&&u[2]===ajaxLocParts[2]&&(u[3]||(u[1]==="http:"?"80":"443"))===(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?"80":"443")))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=jQuery.param(l.data,l.traditional)),inspectPrefiltersOrTransports(prefilters,l,t,w);if(y===2)return w;a=l.global,a&&jQuery.active++===0&&jQuery.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rnoContent.test(l.type),r=l.url,l.hasContent||(l.data&&(r=l.url+=(rquery.test(r)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=rts.test(r)?r.replace(rts,"$1_="+nonce++):r+(rquery.test(r)?"&":"?")+"_="+nonce++)),l.ifModified&&(jQuery.lastModified[r]&&w.setRequestHeader("If-Modified-Since",jQuery.lastModified[r]),jQuery.etag[r]&&w.setRequestHeader("If-None-Match",jQuery.etag[r])),(l.data&&l.hasContent&&l.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):l.accepts["*"]);for(f in l.headers)w.setRequestHeader(f,l.headers[f]);if(!l.beforeSend||l.beforeSend.call(c,w,l)!==!1&&y!==2){b="abort";for(f in{success:1,error:1,complete:1})w[f](l[f]);n=inspectPrefiltersOrTransports(transports,l,t,w);if(!n)S(-1,"No Transport");else{w.readyState=1,a&&h.trigger("ajaxSend",[w,l]),l.async&&l.timeout>0&&(o=setTimeout(function(){w.abort("timeout")},l.timeout));try{y=1,n.send(m,S)}catch(E){if(!(y<2))throw E;S(-1,E)}}return w}return w.abort()},getJSON:function(e,t,n){return jQuery.get(e,t,n,"json")},getScript:function(e,t){return jQuery.get(e,undefined,t,"script")}}),jQuery.each(["get","post"],function(e,t){jQuery[t]=function(e,n,r,i){return jQuery.isFunction(n)&&(i=i||r,r=n,n=undefined),jQuery.ajax({url:e,type:t,dataType:i,data:n,success:r})}}),jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){jQuery.fn[t]=function(e){return this.on(t,e)}}),jQuery._evalUrl=function(e){return jQuery.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},jQuery.fn.extend({wrapAll:function(e){var t;return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapAll(e.call(this,t))}):(this[0]&&(t=jQuery(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapInner(e.call(this,t))}):this.each(function(){var t=jQuery(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=jQuery.isFunction(e);return this.each(function(n){jQuery(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){jQuery.nodeName(this,"body")||jQuery(this).replaceWith(this.childNodes)}).end()}}),jQuery.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},jQuery.expr.filters.visible=function(e){return!jQuery.expr.filters.hidden(e)};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;jQuery.param=function(e,t){var n,r=[],i=function(e,t){t=jQuery.isFunction(t)?t():t==null?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};t===undefined&&(t=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional);if(jQuery.isArray(e)||e.jquery&&!jQuery.isPlainObject(e))jQuery.each(e,function(){i(this.name,this.value)});else for(n in e)buildParams(n,e[n],t,i);return r.join("&").replace(r20,"+")},jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=jQuery.prop(this,"elements");return e?jQuery.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=jQuery(this).val();return n==null?null:jQuery.isArray(n)?jQuery.map(n,function(e){return{name:t.name,value:e.replace(rCRLF,"\r\n")}}):{name:t.name,value:n.replace(rCRLF,"\r\n")}}).get()}}),jQuery.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var xhrId=0,xhrCallbacks={},xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();window.ActiveXObject&&jQuery(window).on("unload",function(){for(var e in xhrCallbacks)xhrCallbacks[e]()}),support.cors=!!xhrSupported&&"withCredentials"in xhrSupported,support.ajax=xhrSupported=!!xhrSupported,jQuery.ajaxTransport(function(e){var t;if(support.cors||xhrSupported&&!e.crossDomain)return{send:function(n,r){var i,s=e.xhr(),o=++xhrId;s.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),!e.crossDomain&&!n["X-Requested-With"]&&(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete xhrCallbacks[o],t=s.onload=s.onerror=null,e==="abort"?s.abort():e==="error"?r(s.status,s.statusText):r(xhrSuccessStatus[s.status]||s.status,s.statusText,typeof s.responseText=="string"?{text:s.responseText}:undefined,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=xhrCallbacks[o]=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}}),jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return jQuery.globalEval(e),e}}}),jQuery.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),jQuery.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=jQuery("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i(e.type==="error"?404:200,e.type)}),document.head.appendChild(t[0])},abort:function(){n&&n()}}}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=oldCallbacks.pop()||jQuery.expando+"_"+nonce++;return this[e]=!0,e}}),jQuery.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,s,o=e.jsonp!==!1&&(rjsonp.test(e.url)?"url":typeof e.data=="string"&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&rjsonp.test(e.data)&&"data");if(o||e.dataTypes[0]==="jsonp")return r=e.jsonpCallback=jQuery.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,o?e[o]=e[o].replace(rjsonp,"$1"+r):e.jsonp!==!1&&(e.url+=(rquery.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return s||jQuery.error(r+" was not called"),s[0]},e.dataTypes[0]="json",i=window[r],window[r]=function(){s=arguments},n.always(function(){window[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,oldCallbacks.push(r)),s&&jQuery.isFunction(i)&&i(s[0]),s=i=undefined}),"script"}),jQuery.parseHTML=function(e,t,n){if(!e||typeof e!="string")return null;typeof t=="boolean"&&(n=t,t=!1),t=t||document;var r=rsingleTag.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=jQuery.buildFragment([e],t,i),i&&i.length&&jQuery(i).remove(),jQuery.merge([],r.childNodes))};var _load=jQuery.fn.load;jQuery.fn.load=function(e,t,n){if(typeof e!="string"&&_load)return _load.apply(this,arguments);var r,i,s,o=this,u=e.indexOf(" ");return u>=0&&(r=jQuery.trim(e.slice(u)),e=e.slice(0,u)),jQuery.isFunction(t)?(n=t,t=undefined):t&&typeof t=="object"&&(i="POST"),o.length>0&&jQuery.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){s=arguments,o.html(r?jQuery("<div>").append(jQuery.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){o.each(n,s||[e.responseText,t,e])}),this},jQuery.expr.filters.animated=function(e){return jQuery.grep(jQuery.timers,function(t){return e===t.elem}).length};var docElem=window.document.documentElement;jQuery.offset={setOffset:function(e,t,n){var r,i,s,o,u,a,f,l=jQuery.css(e,"position"),c=jQuery(e),h={};l==="static"&&(e.style.position="relative"),u=c.offset(),s=jQuery.css(e,"top"),a=jQuery.css(e,"left"),f=(l==="absolute"||l==="fixed")&&(s+a).indexOf("auto")>-1,f?(r=c.position(),o=r.top,i=r.left):(o=parseFloat(s)||0,i=parseFloat(a)||0),jQuery.isFunction(t)&&(t=t.call(e,n,u)),t.top!=null&&(h.top=t.top-u.top+o),t.left!=null&&(h.left=t.left-u.left+i),"using"in t?t.using.call(e,h):c.css(h)}},jQuery.fn.extend({offset:function(e){if(arguments.length)return e===undefined?this:this.each(function(t){jQuery.offset.setOffset(this,e,t)});var t,n,r=this[0],i={top:0,left:0},s=r&&r.ownerDocument;if(!s)return;return t=s.documentElement,jQuery.contains(t,r)?(typeof r.getBoundingClientRect!==strundefined&&(i=r.getBoundingClientRect()),n=getWindow(s),{top:i.top+n.pageYOffset-t.clientTop,left:i.left+n.pageXOffset-t.clientLeft}):i},position:function(){if(!this[0])return;var e,t,n=this[0],r={top:0,left:0};return jQuery.css(n,"position")==="fixed"?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),jQuery.nodeName(e[0],"html")||(r=e.offset()),r.top+=jQuery.css(e[0],"borderTopWidth",!0),r.left+=jQuery.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-jQuery.css(n,"marginTop",!0),left:t.left-r.left-jQuery.css(n,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||docElem;while(e&&!jQuery.nodeName(e,"html")&&jQuery.css(e,"position")==="static")e=e.offsetParent;return e||docElem})}}),jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;jQuery.fn[e]=function(r){return access(this,function(e,r,i){var s=getWindow(e);if(i===undefined)return s?s[t]:e[r];s?s.scrollTo(n?window.pageXOffset:i,n?i:window.pageYOffset):e[r]=i},e,r,arguments.length,null)}}),jQuery.each(["top","left"],function(e,t){jQuery.cssHooks[t]=addGetHookIf(support.pixelPosition,function(e,n){if(n)return n=curCSS(e,t),rnumnonpx.test(n)?jQuery(e).position()[t]+"px":n})}),jQuery.each({Height:"height",Width:"width"},function(e,t){jQuery.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){jQuery.fn[r]=function(r,i){var s=arguments.length&&(n||typeof r!="boolean"),o=n||(r===!0||i===!0?"margin":"border");return access(this,function(t,n,r){var i;return jQuery.isWindow(t)?t.document.documentElement["client"+e]:t.nodeType===9?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?jQuery.css(t,n,o):jQuery.style(t,n,r,o)},t,s?r:undefined,s,null)}})}),jQuery.fn.size=function(){return this.length},jQuery.fn.andSelf=jQuery.fn.addBack,typeof define=="function"&&define.amd&&define("jquery",[],function(){return jQuery});var _jQuery=window.jQuery,_$=window.$;return jQuery.noConflict=function(e){return window.$===jQuery&&(window.$=_$),e&&window.jQuery===jQuery&&(window.jQuery=_jQuery),jQuery},typeof noGlobal===strundefined&&(window.jQuery=window.$=jQuery),jQuery}),function(e,t){typeof define=="function"&&define.amd?define(t):typeof exports=="object"?module.exports=t():e.returnExports=t()}(this,function(){function h(){}function J(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function K(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function Q(e){var t,n,r;if(K(e))return e;n=e.valueOf;if(a(n)){t=n.call(e);if(K(t))return t}r=e.toString;if(a(r)){t=r.call(e);if(K(t))return t}throw new TypeError}var e=Function.prototype.call,t=Array.prototype,n=Object.prototype,r=t.slice,i=Array.prototype.splice,s=Array.prototype.push,o=Array.prototype.unshift,u=n.toString,a=function(e){return n.toString.call(e)==="[object Function]"},f=function(e){return n.toString.call(e)==="[object RegExp]"},l=function(t){return u.call(t)==="[object Array]"},c=function(t){var n=u.call(t),r=n==="[object Arguments]";return r||(r=!l(n)&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&a(t.callee)),r};Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(!a(n))throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=r.call(arguments,1),s=function(){if(this instanceof l){var e=n.apply(this,i.concat(r.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(r.call(arguments)))},o=Math.max(0,n.length-i.length),u=[];for(var f=0;f<o;f++)u.push("$"+f);var l=Function("binder","return function ("+u.join(",")+"){return binder.apply(this,arguments)}")(s);return n.prototype&&(h.prototype=n.prototype,l.prototype=new h,h.prototype=null),l});var p=e.bind(n.hasOwnProperty),d,v,m,g,y;if(y=p(n,"__defineGetter__"))d=e.bind(n.__defineGetter__),v=e.bind(n.__defineSetter__),m=e.bind(n.__lookupGetter__),g=e.bind(n.__lookupSetter__);var b=function(){var e={};return Array.prototype.splice.call(e,0,0,1),e.length===1}(),w=[1].splice(0).length===0,E=function(){var e=[1,2],t=e.splice();return e.length===2&&l(t)&&t.length===0}();E&&(Array.prototype.splice=function(t,n){return arguments.length===0?[]:i.apply(this,arguments)});if(!w||!b)Array.prototype.splice=function(t,n){if(arguments.length===0)return[];var s=arguments;return this.length=Math.max(J(this.length),0),arguments.length>0&&typeof n!="number"&&(s=r.call(arguments),s.length<2?s.push(J(n)):s[1]=J(n)),i.apply(this,s)};[].unshift(0)!==1&&(Array.prototype.unshift=function(){return o.apply(this,arguments),this.length}),Array.isArray||(Array.isArray=l);var S=Object("a"),x=S[0]!=="a"||!(0 in S),T=function(t){var n=!0,r=!0;return t&&(t.call("foo",function(e,t,r){typeof r!="object"&&(n=!1)}),t.call([1],function(){"use strict";r=typeof this=="string"},"x")),!!t&&n&&r};if(!Array.prototype.forEach||!T(Array.prototype.forEach))Array.prototype.forEach=function(t){var n=G(this),r=x&&u.call(this)==="[object String]"?this.split(""):n,i=arguments[1],s=-1,o=r.length>>>0;if(!a(t))throw new TypeError;while(++s<o)s in r&&t.call(i,r[s],s,n)};if(!Array.prototype.map||!T(Array.prototype.map))Array.prototype.map=function(t){var n=G(this),r=x&&u.call(this)==="[object String]"?this.split(""):n,i=r.length>>>0,s=Array(i),o=arguments[1];if(!a(t))throw new TypeError(t+" is not a function");for(var f=0;f<i;f++)f in r&&(s[f]=t.call(o,r[f],f,n));return s};if(!Array.prototype.filter||!T(Array.prototype.filter))Array.prototype.filter=function(t){var n=G(this),r=x&&u.call(this)==="[object String]"?this.split(""):n,i=r.length>>>0,s=[],o,f=arguments[1];if(!a(t))throw new TypeError(t+" is not a function");for(var l=0;l<i;l++)l in r&&(o=r[l],t.call(f,o,l,n)&&s.push(o));return s};if(!Array.prototype.every||!T(Array.prototype.every))Array.prototype.every=function(t){var n=G(this),r=x&&u.call(this)==="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(!a(t))throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&!t.call(s,r[o],o,n))return!1;return!0};if(!Array.prototype.some||!T(Array.prototype.some))Array.prototype.some=function(t){var n=G(this),r=x&&u.call(this)==="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(!a(t))throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&t.call(s,r[o],o,n))return!0;return!1};var N=!1;Array.prototype.reduce&&(N=typeof Array.prototype.reduce.call("es5",function(e,t,n,r){return r})=="object");if(!Array.prototype.reduce||!N)Array.prototype.reduce=function(t){var n=G(this),r=x&&u.call(this)==="[object String]"?this.split(""):n,i=r.length>>>0;if(!a(t))throw new TypeError(t+" is not a function");if(!i&&arguments.length===1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s<i;s++)s in r&&(o=t.call(void 0,o,r[s],s,n));return o};var C=!1;Array.prototype.reduceRight&&(C=typeof Array.prototype.reduceRight.call("es5",function(e,t,n,r){return r})=="object");if(!Array.prototype.reduceRight||!C)Array.prototype.reduceRight=function(t){var n=G(this),r=x&&u.call(this)==="[object String]"?this.split(""):n,i=r.length>>>0;if(!a(t))throw new TypeError(t+" is not a function");if(!i&&arguments.length===1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);if(o<0)return s;do o in r&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s};
if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!==-1)Array.prototype.indexOf=function(t){var n=x&&u.call(this)==="[object String]"?this.split(""):G(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=J(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!==-1)Array.prototype.lastIndexOf=function(t){var n=x&&u.call(this)==="[object String]"?this.split(""):G(this),r=n.length>>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,J(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};var k=Object.keys&&function(){return Object.keys(arguments).length===2}(1,2);if(!Object.keys){var L=!{toString:null}.propertyIsEnumerable("toString"),A=function(){}.propertyIsEnumerable("prototype"),O=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],M=O.length;Object.keys=function(t){var n=a(t),r=c(t),i=t!==null&&typeof t=="object",s=i&&u.call(t)==="[object String]";if(!i&&!n&&!r)throw new TypeError("Object.keys called on a non-object");var o=[],f=A&&n;if(s||r)for(var l=0;l<t.length;++l)o.push(String(l));else for(var h in t)(!f||h!=="prototype")&&p(t,h)&&o.push(String(h));if(L){var d=t.constructor,v=d&&d.prototype===t;for(var m=0;m<M;m++){var g=O[m];(!v||g!=="constructor")&&p(t,g)&&o.push(g)}}return o}}else if(!k){var _=Object.keys;Object.keys=function(t){return c(t)?_(Array.prototype.slice.call(t)):_(t)}}var D=-621987552e5,P="-000001";if(!Date.prototype.toISOString||(new Date(D)).toISOString().indexOf(P)===-1)Date.prototype.toISOString=function(){var t,n,r,i,s;if(!isFinite(this))throw new RangeError("Date.prototype.toISOString called on non-finite value.");i=this.getUTCFullYear(),s=this.getUTCMonth(),i+=Math.floor(s/12),s=(s%12+12)%12,t=[s+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()],i=(i<0?"-":i>9999?"+":"")+("00000"+Math.abs(i)).slice(0<=i&&i<=9999?-4:-6),n=t.length;while(n--)r=t[n],r<10&&(t[n]="0"+r);return i+"-"+t.slice(0,2).join("-")+"T"+t.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"};var H=!1;try{H=Date.prototype.toJSON&&(new Date(NaN)).toJSON()===null&&(new Date(D)).toJSON().indexOf(P)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return!0}})}catch(B){}H||(Date.prototype.toJSON=function(t){var n=Object(this),r=Q(n),i;if(typeof r=="number"&&!isFinite(r))return null;i=n.toISOString;if(typeof i!="function")throw new TypeError("toISOString property is not callable");return i.call(n)});var j=Date.parse("+033658-09-27T01:46:40.000Z")===1e15,F=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z")),I=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));if(!Date.parse||I||F||!j)Date=function(e){function t(n,r,i,s,o,u,a){var f=arguments.length;if(this instanceof e){var l=f===1&&String(n)===n?new e(t.parse(n)):f>=7?new e(n,r,i,s,o,u,a):f>=6?new e(n,r,i,s,o,u):f>=5?new e(n,r,i,s,o):f>=4?new e(n,r,i,s):f>=3?new e(n,r,i):f>=2?new e(n,r):f>=1?new e(n):new e;return l.constructor=t,l}return e.apply(this,arguments)}function i(e,t){var n=t>1?1:0;return r[t]+Math.floor((e-1969+n)/4)-Math.floor((e-1901+n)/100)+Math.floor((e-1601+n)/400)+365*(e-1970)}function s(t){return Number(new e(1970,0,1,0,0,0,t))}var n=new RegExp("^(\\d{4}|[+-]\\d{6})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2})(?:(\\.\\d{1,}))?)?(Z|(?:([-+])(\\d{2}):(\\d{2})))?)?)?)?$"),r=[0,31,59,90,120,151,181,212,243,273,304,334,365];for(var o in e)t[o]=e[o];return t.now=e.now,t.UTC=e.UTC,t.prototype=e.prototype,t.prototype.constructor=t,t.parse=function(r){var o=n.exec(r);if(o){var u=Number(o[1]),a=Number(o[2]||1)-1,f=Number(o[3]||1)-1,l=Number(o[4]||0),c=Number(o[5]||0),h=Number(o[6]||0),p=Math.floor(Number(o[7]||0)*1e3),d=Boolean(o[4]&&!o[8]),v=o[9]==="-"?1:-1,m=Number(o[10]||0),g=Number(o[11]||0),y;if(l<(c>0||h>0||p>0?24:25)&&c<60&&h<60&&p<1e3&&a>-1&&a<12&&m<24&&g<60&&f>-1&&f<i(u,a+1)-i(u,a)){y=((i(u,a)+f)*24+l+m*v)*60,y=((y+c+g*v)*60+h)*1e3+p,d&&(y=s(y));if(-864e13<=y&&y<=864e13)return y}return NaN}return e.parse.apply(this,arguments)},t}(Date);Date.now||(Date.now=function(){return(new Date).getTime()}),(!Number.prototype.toFixed||8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)==="0"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128")&&function(){function i(r,i){var s=-1;while(++s<t)i+=r*n[s],n[s]=i%e,i=Math.floor(i/e)}function s(r){var i=t,s=0;while(--i>=0)s+=n[i],n[i]=Math.floor(s/r),s=s%r*e}function o(){var e=t,r="";while(--e>=0)if(r!==""||e===0||n[e]!==0){var i=String(n[e]);r===""?r=i:r+="0000000".slice(0,7-i.length)+i}return r}function u(e,t,n){return t===0?n:t%2===1?u(e,t-1,n*e):u(e*e,t/2,n)}function a(e){var t=0;while(e>=4096)t+=12,e/=4096;while(e>=2)t+=1,e/=2;return t}var e,t,n,r;e=1e7,t=6,n=[0,0,0,0,0,0],Number.prototype.toFixed=function(t){var n,r,f,l,c,h,p,d;n=Number(t),n=n!==n?0:Math.floor(n);if(n<0||n>20)throw new RangeError("Number.toFixed called with invalid number of decimals");r=Number(this);if(r!==r)return"NaN";if(r<=-1e21||r>=1e21)return String(r);f="",r<0&&(f="-",r=-r),l="0";if(r>1e-21){c=a(r*u(2,69,1))-69,h=c<0?r*u(2,-c,1):r/u(2,c,1),h*=4503599627370496,c=52-c;if(c>0){i(0,h),p=n;while(p>=7)i(1e7,0),p-=7;i(u(10,p,1),0),p=c-1;while(p>=23)s(1<<23),p-=23;s(1<<p),i(1,1),s(2),l=o()}else i(0,h),i(1<<-c,0),l=o()+"0.00000000000000000000".slice(2,2+n)}return n>0?(d=l.length,d<=n?l=f+"0.0000000000000000000".slice(0,n-d+2)+l:l=f+l.slice(0,d-n)+"."+l.slice(d-n)):l=f+l,l}}();var q=String.prototype.split;"ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"test".split(/(?:)/,-1).length!==4||"".split(/.?/).length||".".split(/()()/).length>1?function(){var e=/()??/.exec("")[1]===void 0;String.prototype.split=function(t,n){var r=this;if(t===void 0&&n===0)return[];if(u.call(t)!=="[object RegExp]")return q.call(this,t,n);var i=[],s=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.extended?"x":"")+(t.sticky?"y":""),o=0,a,f,l,c;t=new RegExp(t.source,s+"g"),r+="",e||(a=new RegExp("^"+t.source+"$(?!\\s)",s)),n=n===void 0?-1>>>0:Y(n);while(f=t.exec(r)){l=f.index+f[0].length;if(l>o){i.push(r.slice(o,f.index)),!e&&f.length>1&&f[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===void 0&&(f[e]=void 0)}),f.length>1&&f.index<r.length&&Array.prototype.push.apply(i,f.slice(1)),c=f[0].length,o=l;if(i.length>=n)break}t.lastIndex===f.index&&t.lastIndex++}return o===r.length?(c||!t.test(""))&&i.push(""):i.push(r.slice(o)),i.length>n?i.slice(0,n):i}}():"0".split(void 0,0).length&&(String.prototype.split=function(t,n){return t===void 0&&n===0?[]:q.call(this,t,n)});var R=String.prototype.replace,U=function(){var e=[];return"x".replace(/x(.)?/g,function(t,n){e.push(n)}),e.length===1&&typeof e[0]=="undefined"}();U||(String.prototype.replace=function(t,n){var r=a(n),i=f(t)&&/\)[*?]/.test(t.source);if(!r||!i)return R.call(this,t,n);var s=function(e){var r=arguments.length,i=t.lastIndex;t.lastIndex=0;var s=t.exec(e);return t.lastIndex=i,s.push(arguments[r-2],arguments[r-1]),n.apply(this,s)};return R.call(this,t,s)});if("".substr&&"0b".substr(-1)!=="b"){var z=String.prototype.substr;String.prototype.substr=function(t,n){return z.call(this,t<0?(t=this.length+t)<0?0:t:t,n)}}var W=" \n \f\r   ᠎              \u2028\u2029",X="​";if(!String.prototype.trim||W.trim()||!X.trim()){W="["+W+"]";var V=new RegExp("^"+W+W+"*"),$=new RegExp(W+W+"*$");String.prototype.trim=function(){if(this===void 0||this===null)throw new TypeError("can't convert "+this+" to object");return String(this).replace(V,"").replace($,"")}}if(parseInt(W+"08")!==8||parseInt(W+"0x16")!==22)parseInt=function(e){var t=/^0[xX]/;return function(r,i){return r=String(r).trim(),Number(i)||(i=t.test(r)?16:10),e(r,i)}}(parseInt);var G=function(e){if(e==null)throw new TypeError("can't convert "+e+" to object");return Object(e)},Y=function(t){return t>>>0}}),window.Modernizr=function(e,t,n){function x(e){f.cssText=e}function T(e,t){return x(prefixes.join(e+";")+(t||""))}function N(e,t){return typeof e===t}function C(e,t){return!!~(""+e).indexOf(t)}function k(e,t){for(var r in e){var i=e[r];if(!C(i,"-")&&f[i]!==n)return t=="pfx"?i:!0}return!1}function L(e,t,r){for(var i in e){var s=t[e[i]];if(s!==n)return r===!1?e[i]:N(s,"function")?s.bind(r||t):s}return!1}function A(e,t,n){var r=e.charAt(0).toUpperCase()+e.slice(1),i=(e+" "+p.join(r+" ")+r).split(" ");return N(t,"string")||N(t,"undefined")?k(i,t):(i=(e+" "+d.join(r+" ")+r).split(" "),L(i,t,n))}var r="2.8.3",i={},s=!0,o=t.documentElement,u="modernizr",a=t.createElement(u),f=a.style,l,c={}.toString,h="Webkit Moz O ms",p=h.split(" "),d=h.toLowerCase().split(" "),v={},m={},g={},y=[],b=y.slice,w,E={}.hasOwnProperty,S;!N(E,"undefined")&&!N(E.call,"undefined")?S=function(e,t){return E.call(e,t)}:S=function(e,t){return t in e&&N(e.constructor.prototype[t],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError;var r=b.call(arguments,1),i=function(){if(this instanceof i){var e=function(){};e.prototype=n.prototype;var s=new e,o=n.apply(s,r.concat(b.call(arguments)));return Object(o)===o?o:s}return n.apply(t,r.concat(b.call(arguments)))};return i}),v.cssanimations=function(){return A("animationName")},v.csstransforms=function(){return!!A("transform")};for(var O in v)S(v,O)&&(w=O.toLowerCase(),i[w]=v[O](),y.push((i[w]?"":"no-")+w));return i.addTest=function(e,t){if(typeof e=="object")for(var r in e)S(e,r)&&i.addTest(r,e[r]);else{e=e.toLowerCase();if(i[e]!==n)return i;t=typeof t=="function"?t():t,typeof s!="undefined"&&s&&(o.className+=" "+(t?"":"no-")+e),i[e]=t}return i},x(""),a=l=null,i._version=r,i._domPrefixes=d,i._cssomPrefixes=p,i.testProp=function(e){return k([e])},i.testAllProps=A,o.className=o.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(s?" js "+y.join(" "):""),i}(this,this.document);var JSON;JSON||(JSON={}),function(){"use strict";function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1)u[n]=str(n,a)||"null";return i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]",gap=o,i}if(rep&&typeof rep=="object"){s=rep.length;for(n=0;n<s;n+=1)typeof rep[n]=="string"&&(r=rep[n],i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i))}else for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i));return i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}",gap=o,i}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(e,t,n){var r;gap="",indent="";if(typeof n=="number")for(r=0;r<n;r+=1)indent+=" ";else typeof n=="string"&&(indent=n);rep=t;if(!t||typeof t=="function"||typeof t=="object"&&typeof t.length=="number")return str("",{"":e});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i=="object")for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r=walk(i,n),r!==undefined?i[n]=r:delete i[n]);return reviver.call(e,t,i)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.4";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?null:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t||x.identity);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s},x.bind=function(e,t){if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));var n=u.call(arguments,2);return function(){return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return t.length===0&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,f<=0?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]==null&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var O=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=O(e[o],t[o],n,r)))break}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)){o++;if(!(u=x.has(t,c)&&O(e[c],t[c],n,r)))break}if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return O(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var M={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};M.unescape=x.invert(M.escape);var _={escape:new RegExp("["+x.keys(M.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(M.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(_[e],function(t){return M[e][t]})}}),x.result=function(e,t){if(e==null)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),j.call(this,n.apply(x,e))}})};var D=0;x.uniqueId=function(e){var t=++D+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,H={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||P).source,(n.interpolate||P).source,(n.evaluate||P).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(B,function(e){return"\\"+H[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var j=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],j.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return j.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(){function u(){try{return r in t&&t[r]}catch(e){return!1}}function a(){try{return i in t&&t[i]&&t[i][t.location.hostname]}catch(e){return!1}}var e={},t=window,n=t.document,r="localStorage",i="globalStorage",s="__storejs__",o;e.disabled=!1,e.set=function(e,t){},e.get=function(e){},e.remove=function(e){},e.clear=function(){},e.transact=function(t,n,r){var i=e.get(t);r==null&&(r=n,n=null),typeof i=="undefined"&&(i=n||{}),r(i),e.set(t,i)},e.getAll=function(){},e.serialize=function(e){return JSON.stringify(e)},e.deserialize=function(e){return typeof e!="string"?undefined:JSON.parse(e)};if(u())o=t[r],e.set=function(t,n){if(n===undefined)return e.remove(t);o.setItem(t,e.serialize(n))},e.get=function(t){return e.deserialize(o.getItem(t))},e.remove=function(e){o.removeItem(e)},e.clear=function(){o.clear()},e.getAll=function(){var t={};for(var n=0;n<o.length;++n){var r=o.key(n);t[r]=e.get(r)}return t};else if(a())o=t[i][t.location.hostname],e.set=function(t,n){if(n===undefined)return e.remove(t);o[t]=e.serialize(n)},e.get=function(t){return e.deserialize(o[t]&&o[t].value)},e.remove=function(e){delete o[e]},e.clear=function(){for(var e in o)delete o[e]},e.getAll=function(){var t={};for(var n=0;n<o.length;++n){var r=o.key(n);t[r]=e.get(r)}return t};else if(n.documentElement.addBehavior){var f,l;try{l=new ActiveXObject("htmlfile"),l.open(),l.write('<script>document.w=window</script><iframe src="/favicon.ico"></frame>'),l.close(),f=l.w.frames[0].document,o=f.createElement("div")}catch(c){o=n.createElement("div"),f=n.body}function h(t){return function(){var n=Array.prototype.slice.call(arguments,0);n.unshift(o),f.appendChild(o),o.addBehavior("#default#userData"),o.load(r);var i=t.apply(e,n);return f.removeChild(o),i}}function p(e){return"_"+e}e.set=h(function(t,n,i){n=p(n);if(i===undefined)return e.remove(n);t.setAttribute(n,e.serialize(i)),t.save(r)}),e.get=h(function(t,n){return n=p(n),e.deserialize(t.getAttribute(n))}),e.remove=h(function(e,t){t=p(t),e.removeAttribute(t),e.save(r)}),e.clear=h(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(r);for(var n=0,i;i=t[n];n++)e.removeAttribute(i.name);e.save(r)}),e.getAll=h(function(t){var n=t.XMLDocument.documentElement.attributes;t.load(r);var i={};for(var s=0,o;o=n[s];++s)i[o]=e.get(o);return i})}try{e.set(s,s),e.get(s)!=s&&(e.disabled=!0),e.remove(s)}catch(c){e.disabled=!0}typeof module!="undefined"&&typeof module!="function"?module.exports=e:typeof define=="function"&&define.amd?define(e):this.store=e}(),function(e,t){var n=function(e){this.defaults={locale_data:{messages:{"":{domain:"messages",lang:"en",plural_forms:"(n != 1);"}}},domain:"messages"},this.options=_.extend({},this.defaults,e),this.textdomain(this.options.domain);if(e.domain&&!this.options.locale_data[this.options.domain])throw new Error("Text domain set to non-existent domain: `"+e.domain+"`")};n.context_delimiter=String.fromCharCode(4);var r=_.memoize(function(e){function t(e,t){var n=e(t);return n===!0?1:n?n:0}var e=e||"(n != 1)";return _.partial(t,new Function("n","return "+e))});_.extend(n.prototype,{textdomain:function(e){if(!e)return this._textdomain;this._textdomain=e},gettext:function(e){return this.dcnpgettext.call(this,t,t,e)},dgettext:function(e,n){return this.dcnpgettext.call(this,e,t,n)},dcgettext:function(e,n){return this.dcnpgettext.call(this,e,t,n)},ngettext:function(e,n,r){return this.dcnpgettext.call(this,t,t,e,n,r)},dngettext:function(e,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},dcngettext:function(e,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},pgettext:function(e,n){return this.dcnpgettext.call(this,t,e,n)},dpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},dcpgettext:function(e,t,n){return this.dcnpgettext.call(this,e,t,n)},npgettext:function(e,n,r,i){return this.dcnpgettext.call(this,t,e,n,r,i)},dnpgettext:function(e,t,n,r,i){return this.dcnpgettext.call(this,e,t,n,r,i)},dcnpgettext:function(e,t,i,s,o){s=s||i,e=e||this._textdomain,o=typeof o=="undefined"?1:o;var u;if(!this.options)return u=new n,u.dcnpgettext.call(u,undefined,undefined,i,s,o);if(!this.options.locale_data)throw new Error("No locale data provided.");if(!this.options.locale_data[e])throw new Error("Domain `"+e+"` was not found.");if(!this.options.locale_data[e][""])throw new Error("No locale meta information provided.");if(!i)throw new Error("No translation key found.");if(typeof o!="number"){o=parseInt(o,10);if(isNaN(o))throw new Error("The number that was passed in is not a number.")}var a=t?t+n.context_delimiter+i:i,f=this.options.locale_data,l=f[e],c=l[""].plural_forms,h=r(c)(o)+1,p,d;if(!l)throw new Error("No domain named `"+e+"` could be found.");return p=l[a],!p||h>=p.length?(this.options.missing_key_callback&&this.options.missing_key_callback(a),d=[null,i,s],d[r()(o)+1]):(d=p[h],d?d:(d=[null,i,s],d[r()(o)+1]))}}),e.Jed=n}(this),+function(e){"use strict";function n(n,r){return this.each(function(){var i=e(this),s=i.data("bs.modal"),o=e.extend({},t.DEFAULTS,i.data(),typeof n=="object"&&n);s||i.data("bs.modal",s=new t(this,o)),typeof n=="string"?s[n](r):o.show&&s.show(r)})}var t=function(t,n){this.options=n,this.$body=e(document.body),this.$element=e(t),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};t.VERSION="3.2.0",t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},t.prototype.toggle=function(e){return this.isShown?this.hide():this.show(e)},t.prototype.show=function(t){var n=this,r=e.Event("show.bs.modal",{relatedTarget:t});this.$element.trigger(r);if(this.isShown||r.isDefaultPrevented())return;this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',e.proxy(this.hide,this)),this.backdrop(function(){var r=e.support.transition&&n.$element.hasClass("fade");n.$element.parent().length||n.$element.appendTo(n.$body),n.$element.show().scrollTop(0),r&&n.$element[0].offsetWidth,n.$element.addClass("in").attr("aria-hidden",!1),n.enforceFocus();var i=e.Event("shown.bs.modal",{relatedTarget:t});r?n.$element.find(".modal-dialog").one("bsTransitionEnd",function(){n.$element.trigger("focus").trigger
(i)}).emulateTransitionEnd(300):n.$element.trigger("focus").trigger(i)})},t.prototype.hide=function(t){t&&t.preventDefault(),t=e.Event("hide.bs.modal"),this.$element.trigger(t);if(!this.isShown||t.isDefaultPrevented())return;this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),e(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",e.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()},t.prototype.enforceFocus=function(){e(document).off("focusin.bs.modal").on("focusin.bs.modal",e.proxy(function(e){this.$element[0]!==e.target&&!this.$element.has(e.target).length&&this.$element.trigger("focus")},this))},t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",e.proxy(function(e){e.which==27&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},t.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){e.$element.trigger("hidden.bs.modal")})},t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},t.prototype.backdrop=function(t){var n=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",e.proxy(function(e){if(e.target!==e.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus.call(this.$element[0]):this.hide.call(this)},this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!t)return;i?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(150):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var s=function(){n.removeBackdrop(),t&&t()};e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",s).emulateTransitionEnd(150):s()}else t&&t()},t.prototype.checkScrollbar=function(){if(document.body.clientWidth>=window.innerWidth)return;this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar()},t.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",e+this.scrollbarWidth)},t.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},t.prototype.measureScrollbar=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",this.$body.append(e);var t=e.offsetWidth-e.clientWidth;return this.$body[0].removeChild(e),t};var r=e.fn.modal;e.fn.modal=n,e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=r,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=e(this),i=r.attr("href"),s=e(r.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},s.data(),r.data());r.is("a")&&t.preventDefault(),s.one("show.bs.modal",function(e){if(e.isDefaultPrevented())return;s.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})}),n.call(s,o,this)})}(jQuery),+function(e){"use strict";function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(e.style[n]!==undefined)return{end:t[n]};return!1}e.fn.emulateTransitionEnd=function(t){var n=!1,r=this;e(this).one("bsTransitionEnd",function(){n=!0});var i=function(){n||e(r).trigger(e.support.transition.end)};return setTimeout(i,t),this},e(function(){e.support.transition=t();if(!e.support.transition)return;e.event.special.bsTransitionEnd={bindType:e.support.transition.end,delegateType:e.support.transition.end,handle:function(t){if(e(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}}})}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s=typeof n=="object"&&n;if(!i&&n=="destroy")return;i||r.data("bs.tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(e,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",e,t)};t.VERSION="3.2.0",t.TRANSITION_DURATION=150,t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},t.prototype.init=function(t,n,r){this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&e(this.options.viewport.selector||this.options.viewport);var i=this.options.trigger.split(" ");for(var s=i.length;s--;){var o=i[s];if(o=="click")this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if(o!="manual"){var u=o=="hover"?"mouseenter":"focusin",a=o=="hover"?"mouseleave":"focusout";this.$element.on(u+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(a+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},t.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,r){n[e]!=r&&(t[e]=r)}),t},t.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);if(n&&n.$tip&&n.$tip.is(":visible")){n.hoverState="in";return}n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),clearTimeout(n.timeout),n.hoverState="in";if(!n.options.delay||!n.options.delay.show)return n.show();n.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},t.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),clearTimeout(n.timeout),n.hoverState="out";if(!n.options.delay||!n.options.delay.hide)return n.hide();n.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},t.prototype.show=function(){var n=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(n);var r=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(n.isDefaultPrevented()||!r)return;var i=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var u=typeof this.options.placement=="function"?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,f=a.test(u);f&&(u=u.replace(a,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(u).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element);var l=this.getPosition(),c=s[0].offsetWidth,h=s[0].offsetHeight;if(f){var p=u,d=this.options.container?e(this.options.container):this.$element.parent(),v=this.getPosition(d);u=u=="bottom"&&l.top+l.height+h-v.scroll>v.height?"top":u=="top"&&l.top-v.scroll-h<v.top?"bottom":u=="right"&&l.right+c>v.width?"left":u=="left"&&l.left-c<v.left?"right":u,s.removeClass(p).addClass(u)}var m=this.getCalculatedOffset(u,l,c,h);this.applyPlacement(m,u);var g=function(){i.$element.trigger("shown.bs."+i.type),i.hoverState=null};e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",g).emulateTransitionEnd(t.TRANSITION_DURATION):g()}},t.prototype.applyPlacement=function(t,n){var r=this.tip(),i=r[0].offsetWidth,s=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),u=parseInt(r.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(u)&&(u=0),t.top=t.top+o,t.left=t.left+u,e.offset.setOffset(r[0],e.extend({using:function(e){r.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),r.addClass("in");var a=r[0].offsetWidth,f=r[0].offsetHeight;n=="top"&&f!=s&&(t.top=t.top+s-f);var l=this.getViewportAdjustedDelta(n,t,a,f);l.left?t.left+=l.left:t.top+=l.top;var c=/top|bottom/.test(n),h=c?l.left*2-i+a:l.top*2-s+f,p=c?"offsetWidth":"offsetHeight";r.offset(t),this.replaceArrow(h,r[0][p],c)},t.prototype.replaceArrow=function(e,t,n){this.arrow().css(n?"left":"top",50*(1-e/t)+"%").css(n?"top":"left","")},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},t.prototype.hide=function(n){function o(){r.hoverState!="in"&&i.detach(),r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type),n&&n()}var r=this,i=this.tip(),s=e.Event("hide.bs."+this.type);this.$element.trigger(s);if(s.isDefaultPrevented())return;return i.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i.one("bsTransitionEnd",o).emulateTransitionEnd(t.TRANSITION_DURATION):o(),this.hoverState=null,this},t.prototype.fixTitle=function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},t.prototype.hasContent=function(){return this.getTitle()},t.prototype.getPosition=function(t){t=t||this.$element;var n=t[0],r=n.tagName=="BODY",i=n.getBoundingClientRect();i.width==null&&(i=e.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var s=r?{top:0,left:0}:t.offset(),o={scroll:r?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},u=r?{width:e(window).width(),height:e(window).height()}:null;return e.extend({},i,o,u,s)},t.prototype.getCalculatedOffset=function(e,t,n,r){return e=="bottom"?{top:t.top+t.height,left:t.left+t.width/2-n/2}:e=="top"?{top:t.top-r,left:t.left+t.width/2-n/2}:e=="left"?{top:t.top+t.height/2-r/2,left:t.left-n}:{top:t.top+t.height/2-r/2,left:t.left+t.width}},t.prototype.getViewportAdjustedDelta=function(e,t,n,r){var i={top:0,left:0};if(!this.$viewport)return i;var s=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(e)){var u=t.top-s-o.scroll,a=t.top+s-o.scroll+r;u<o.top?i.top=o.top-u:a>o.top+o.height&&(i.top=o.top+o.height-a)}else{var f=t.left-s,l=t.left+s+n;f<o.left?i.left=o.left-f:l>o.width&&(i.left=o.left+o.width-l)}return i},t.prototype.getTitle=function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},t.prototype.getUID=function(e){do e+=~~(Math.random()*1e6);while(document.getElementById(e));return e},t.prototype.tip=function(){return this.$tip=this.$tip||e(this.options.template)},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},t.prototype.enable=function(){this.enabled=!0},t.prototype.disable=function(){this.enabled=!1},t.prototype.toggleEnabled=function(){this.enabled=!this.enabled},t.prototype.toggle=function(t){var n=this;t&&(n=e(t.currentTarget).data("bs."+this.type),n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n))),n.tip().hasClass("in")?n.leave(n):n.enter(n)},t.prototype.destroy=function(){var e=this;clearTimeout(this.timeout),this.hide(function(){e.$element.off("."+e.type).removeData("bs."+e.type)})};var r=e.fn.tooltip;e.fn.tooltip=n,e.fn.tooltip.Constructor=t,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(jQuery),function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(s)return s(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var s=typeof require=="function"&&require;for(var o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){"use strict";function i(e){var t=[],n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(var r=0;r<e;r++)t.push(n.charAt(Math.floor(Math.random()*n.length)));return t.join("")}function s(){var e=Array.prototype.slice.call(arguments),t={},n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r].split("=",2),s=i[0].replace(/^\s+/,"");e.indexOf(s)!==-1&&(t[s]=i[1])}return t}function o(e,t,n){document.cookie=e+"="+t+"; expires="+n.toGMTString()+";"}function u(){if(window.r&&window.r.config&&window.r.config.logged)return{};var e=s("loid","loidcreated");if(e.loid)return e;var t=i(18),n=(new Date).toISOString(),r=new Date;return r.setFullYear(r.getFullYear()+2),o("loid",t,r),o("loidcreated",n,r),s("loid","loidcreated")}var r=t.exports=function(e){};r.prototype.getTrackingData=function(){return u()};if(typeof window!="undefined"){var a=window.redditlib=window.redditlib||{};a.Tracker=r}},{}]},{},[1]),jQuery.cookie=function(e,t,n){if(arguments.length>1&&String(t)!=="[object Object]"){n=jQuery.extend({},n);if(t===null||t===undefined)n.expires=-1;if(typeof n.expires=="number"){var r=n.expires,i=n.expires=new Date;i.setDate(i.getDate()+r)}return t=String(t),document.cookie=[encodeURIComponent(e),"=",n.raw?t:encodeURIComponent(t),n.expires?"; expires="+n.expires.toUTCString():"",n.path?"; path="+n.path:"",n.domain?"; domain="+n.domain:"",n.secure?"; secure":""].join("")}n=t||{};var s,o=n.raw?function(e){return e}:decodeURIComponent;return(s=(new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)")).exec(document.cookie))?o(s[1]):null},!function(e){"use strict";function n(){return e.performance?e.performance.now():(new Date).getTime()}function r(){var e=n(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t==="x"?n:n&3|8).toString(16)});return t}function i(e,t,n,r,i,s,o){o=o||{};if(!e)throw"Missing key; pass in event client key as the first argument.";this.clientKey=e;if(!t)throw"Missing secret; pass in event client secret as the second argument.";this.clientSecret=t;if(!n)throw"Missing post function; pass in ajax post function as the third argument.";this.postData=n;if(!r)throw"Missing url to post to; pass in url as the fourth argument.";this.eventsUrl=r;if(!i)throw"Missing appName; pass in appName as the fifth argument.";this.appName=i;if(!s)throw"Missing calculateHash; pass in calculateHash as the sixth argument.";this.calculateHash=s,typeof window!="undefined"&&(this.appendClientContext=typeof o.appendClientContext=="undefined"?!0:o.appendClientContext),this.bufferTimeout=o.bufferTimeout||100,this.bufferLength=o.bufferLength||40,this.buffer=[]}var t=/[^A-Za-z0-9]/;i.prototype.track=function(t,n,r){var i=this._buildData(t,n,r||{});this._buffer(i)},i.prototype.send=function(){if(this.buffer.length){var t=JSON.stringify(this.buffer),n=this.calculateHash(this.clientSecret,t),r={"Content-Type":"text/plain"};this.postData({url:this.eventsUrl,data:t,headers:r,query:{key:this.clientKey,mac:n}}),this.buffer=[]}},i.prototype._validateClientName=function(n){if(t.test(n))throw"Invalid client name, please use only letters or numbers",n},i.prototype._buildData=function(t,n,i){var s=new Date,o={event_topic:t,event_type:n,event_ts:s.getTime(),uuid:i.uuid||r(),payload:i};o.payload.app_name=this.appName,o.payload.utc_offset=s.getTimezoneOffset()/-60;if(this.appendClientContext){var u=this._buildClientContext();for(var a in u)o.payload[a]=u[a]}return o},i.prototype._buffer=function(t){this.buffer.push(t),this.buffer.length>=this.bufferLength||!this.bufferTimeout?this.send():this.bufferTimeout&&!this.timer&&this._resetTimer()},i.prototype._resetTimer=function(){this.timer&&(clearTimeout(this.timer),this.timer=undefined);var t=this;this.timer=setTimeout(function(){t.send(),t.timer=undefined},this.bufferTimeout)},i.prototype._buildClientContext=function(){return{user_agent:navigator.userAgent,domain:document.location.host,base_url:document.location.pathname+document.location.search+document.location.hash}},typeof module!="undefined"?module.exports=i:e.EventTracker=i}(typeof global!="undefined"?global:this);var CryptoJS=CryptoJS||function(e,t){var n={},r=n.lib={},i=function(){},s=r.Base={extend:function(e){i.prototype=this;var t=new i;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=r.WordArray=s.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;e=e.sigBytes,this.clamp();if(r%4)for(var i=0;i<e;i++)t[r+i>>>2]|=(n[i>>>2]>>>24-8*(i%4)&255)<<24-8*((r+i)%4);else if(65535<n.length)for(i=0;i<e;i+=4)t[r+i>>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-8*(n%4),t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(4294967296*e.random()|0);return new o.init(n,t)}}),u=n.enc={},a=u.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r<e;r++){var i=t[r>>>2]>>>24-8*(r%4)&255;n.push((i>>>4).toString(16)),n.push((i&15).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-4*(r%8);return new o.init(n,t/2)}},f=u.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r<e;r++)n.push(String.fromCharCode(t[r>>>2]>>>24-8*(r%4)&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(e.charCodeAt(r)&255)<<24-8*(r%4);return new o.init(n,t)}},l=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},c=r.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,s=this.blockSize,u=i/(4*s),u=t?e.ceil(u):e.max((u|0)-this._minBufferSize,0);t=u*s,i=e.min(4*t,i);if(t){for(var a=0;a<t;a+=s)this._doProcessBlock(r,a);a=r.splice(0,t),n.sigBytes-=i}return new o.init(a,i)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=c.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return(new e.init(n)).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return(new h.HMAC.init(e,n)).finalize(t)}}});var h=n.algo={};return n}(Math);(function(e){for(var t=CryptoJS,n=t.lib,r=n.WordArray,i=n.Hasher,n=t.algo,s=[],o=[],u=function(e){return 4294967296*(e-(e|0))|0},a=2,f=0;64>f;){var l;e:{l=a;for(var c=e.sqrt(l),h=2;h<=c;h++)if(!(l%h)){l=!1;break e}l=!0}l&&(8>f&&(s[f]=u(e.pow(a,.5))),o[f]=u(e.pow(a,1/3)),f++),a++}var p=[],n=n.SHA256=i.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],s=n[2],u=n[3],a=n[4],f=n[5],l=n[6],c=n[7],h=0;64>h;h++){if(16>h)p[h]=e[t+h]|0;else{var d=p[h-15],v=p[h-2];p[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+p[h-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+p[h-16]}d=c+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&f^~a&l)+o[h]+p[h],v=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&s^i&s),c=l,l=f,f=a,a=u+d|0,u=s,s=i,i=r,r=d+v|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+u|0,n[4]=n[4]+a|0,n[5]=n[5]+f|0,n[6]=n[6]+l|0,n[7]=n[7]+c|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[(i+64>>>9<<4)+14]=e.floor(r/4294967296),n[(i+64>>>9<<4)+15]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(n),t.HmacSHA256=i._createHmacHelper(n)})(Math),function(){var e=CryptoJS,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var o=this._oKey=n.clone(),u=this._iKey=n.clone(),a=o.words,f=u.words,l=0;l<r;l++)a[l]^=1549556828,f[l]^=909522486;o.sigBytes=u.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),!function(e,t){var n=/(?:\b(?:MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+(?:\.?\d+)?)/i,r=navigator.userAgent.match(n),i=r&&r[1]&&parseFloat(r[1]),s=navigator.doNotTrack||e.doNotTrack||navigator.msDoNotTrack;e.DO_NOT_TRACK=/^(yes|1)$/i.test(s)&&i!==10}(this),function(e){var t=e.fn.tooltip.Constructor.prototype,n=t.getCalculatedOffset;t.getCalculatedOffset=function(e,t,r,i){var s;return e!=="top-right"?n.apply(this,arguments):(s={top:t.top-i-10,left:t.left+t.width-r},this.$element.outerWidth()<=18&&(s.left+=4),s)},t.replaceArrow=function(e,t,n){var r=1-e/t;r!==1&&this.arrow().css(n?"left":"top",50*r+"%"),this.arrow().css(n?"top":"left","")}}(window.jQuery),r=window.r||{},r.setup=function(e){r.config=e;try{window.reddit={};function t(e){r.sendError(e,{tag:"reddit-config-migrate-error"})}var n=Object.keys(r.config);n.push("currentOrigin"),n.push("sr_cache"),n.forEach(function(e){Object.defineProperty(reddit,e,{configurable:!1,enumerable:!0,get:function(){var n="config property %(key)s accessed through global reddit object.";return t(n.format({key:e})),r.config[e]},set:function(n){var i="config property %(key)s set through global reddit object.";return t(i.format({key:e})),r.config[e]=n}})})}catch(i){window.reddit=e}r.logging.init(),r.config.currentOrigin=location.protocol+"//"+location.host,r.analytics.breadcrumbs.init(),r.analytics.event.init()},r.ajax=function(e){var t=e.url;if(e.type=="GET"&&_.isEmpty(e.data)){var n=r.preload.read(t);if(n!=null){e.dataFilter&&(n=e.dataFilter(n,"json")),e.success(n);var i=new jQuery.Deferred;return i.resolve(n),i}}var s=t&&(t[0]=="/"||t.lastIndexOf(r.config.currentOrigin,0)==0);return s&&(e.headers||(e.headers={}),e.headers["X-Modhash"]=r.config.modhash),$.ajax(e)},r.sync=function(e,t,n){var i=n.dataFilter;return n.dataFilter=function(e,t){var n;return t==="json"?n=r.utils.unescapeJson(e):n=e,i?i(n):n},r.backboneSync.call(Backbone,e,t,n)},store.safeGet=function(e,t){if(store.disabled)return t;try{return store.get(e)}catch(n){return r.sendError('Unable to read storage key "%(key)s" (%(err)s)'.format({key:e,err:n})),t}},store.safeSet=function(e,t){if(store.disabled)return!1;try{return store.set(e,t),!0}catch(n){return r.warn('Unable to set storage key "%(key)s" (%(err)s)'.format({key:e,err:n})),!1}},r.setupBackbone=function(){Backbone.emulateJSON=!0,Backbone.ajax=r.ajax,r.backboneSync||(r.backboneSync=Backbone.sync,Backbone.sync=r.sync)},!function(e){function n(e){this.name=e,this.called=!1,this._callbacks=[]}var t={};n.prototype.register=function(e){this.called?e.call(window):this._callbacks.push(e)},n.prototype.call=function(){if(this.called)throw"Hook "+this.name+" already called.";var e=this._callbacks;this.called=!0,this._callbacks=null;for(var t=0;t<e.length;t++)e[t].call(window)},e.hooks={create:function(e){if(e in t)throw'Hook "'+e+'" already exists.';var r=new n(e);return t[e]=r,r},get:function(e){if(e in t)return t[e];throw'Hook "'+e+"\" doesn't exist."},call:function(t){return e.hooks.get(t).call()}}}(window.r=window.r||{}),r.preload={timestamp:new Date,maxAge:3e5,data:{},isExpired:function(){return new Date-this.timestamp>this.maxAge},set:function(e){_.extend(this.data,e)},read:function(e){var t=this.data[e];if(e[0]=="#")return t;if(this.isExpired())return;return t}},r.logging={},r.logging.pageAgeLimit=300,r.logging.sendThrottle=8,r.logging.exceptionMessageTemplate=_.template('Client Error: "<%= errorType %>" thrown at L<%= line %>:<%= character %> in <%= file %> Message: "<%= message %>"'),r.logging.defaultExceptionValues={message:"UNKNOWN MESSAGE",file:"UNKNOWN FILE",line:"?",character:"?",errorType:"UNKNOWN ERROR TYPE"},r.logging.sendException=function(e){if(!e)throw"No exception object was passed in.";_.defaults(e,r.logging.defaultExceptionValues);var t=r.logging.exceptionMessageTemplate(e);r.logging.sendError(t,{tag:"unknown"})},r.logging.init=function(){_.each(["debug","log","warn","error"],function(e){r[e]=(e!="debug"||r.config.debug)&&window.console&&console[e]?_.bind(console[e],console):function(){}}),r.sendError=r.logging.sendError},r.logging.serverLogger={logCount:0,_queuedLogs:[],queueLog:function(e){if(!r.config)return;r.warn||(r.warn=function(){});if(this.logCount>=3){r.warn("Not sending debug log; already sent",this.logCount);return}var t=new Date/1e3-r.config.server_time;if(Math.abs(t)>r.logging.pageAgeLimit){r.warn("Not sending debug log; page too old:",t);return}if(!r.config.send_logs){r.warn("Server-side debug logging disabled");return}e.url=window.location.toString(),this._queuedLogs.push(e),this.logCount++,_.defer(_.bind(function(){this._sendLogs()},this))},_sendLogs:_.throttle(function(){var e=this._queuedLogs.length;r.ajax({type:"POST",url:"/web/log/error.json",data:{logs:JSON.stringify(this._queuedLogs)},headers:{"X-Loggit":!0},success:function(){r.log("Sent",e,"debug logs to server")},error:function(e,t,n){r.warn("Error sending debug logs to server:",t,";",n)}}),this._queuedLogs=[]},r.logging.sendThrottle*1e3)},r.logging.sendError=function(){var e=_.toArray(arguments),t=_.last(e),n={};_.isObject(t)&&(n=t,e.pop());var i=_.defaults({msg:e.join(" ")},n);r.error&&r.error.apply(r,arguments),r.logging.serverLogger.queueLog(i)},!function(e,t,n,r){"use strict";var i=e.onerror;e.onerror=function(t,r,s,o,u){var a=/^(chrome:\/\/|file:\/\/)/i,f=/((^Script error\.$)|(atomicFindClose))/i;if(a.test(r)||f.test(t))return;var l={message:t,file:r,line:s,character:o,errorType:u};n.logging.sendException(l),i&&i.apply(e,arguments)}}(this,jQuery,r,_),!function(e){var t="up",n="down",r,i=window.MouseEvent,s=document.createEvent;s&&(s=s.bind(document));try{i&&(r=new i("click",{bubbles:!0}))}catch(o){}try{!r&&s&&(r=s("MouseEvent"))}catch(o){}r||(r={}),window.MouseEvent=function(e,t){return r},document.createEvent=function(e){return e==="MouseEvent"||e==="MouseEvents"?r:s(e)},$(function(){$(document.body).on("click",".arrow",function(o){var u=$(this);if(!e.config.logged||e.access.isLinkRestricted(this))return;if(u.hasClass("archived")){u.show_unvotable_message();return}var a=u.thing(),f=a.thing_id(),l=u.hasClass(t)?1:u.hasClass(n)?-1:0,c;!o||!o.originalEvent?c=!1:i instanceof Function&&"isTrusted"in i.prototype?c=o.originalEvent.isTrusted:i instanceof Function?c=o.originalEvent instanceof i&&o.originalEvent!==r:c=o.originalEvent!==r;var h={id:f,dir:l,vh:e.config.vote_hash,isTrusted:c};$.request("vote",h),a.updateThing({voted:l})})})}(r),r.ui={},r.ui.Base=function(e){this.$el=$(e)},r.ui.collapsibleSideBox=function(e){var t=$("#"+e);return new r.ui.Collapse(t.find(".title"),t.find(".content"),e)},r.ui.Collapse=function(e,t,n){r.ui.Base.call(this,e),this.target=t,this.key="ui.collapse."+n,this.isCollapsed=store.safeGet(this.key)==1,this.$el.click($.proxy(this,"toggle",null,!1)),this.toggle(this.isCollapsed,!0)},r.ui.Collapse.prototype={animDuration:200,toggle:function(e,t){e==null&&(e=!this.isCollapsed);var n=t?0:this.animDuration;e?$(this.target).slideUp(n):$(this.target).slideDown(n),this.isCollapsed=e,store.safeSet(this.key,e),this.update()},update:function(){this.$el.find(".collapse-button").text(this.isCollapsed?"+":"-")}},r.ui.Summarize=function(e,t){r.ui.Base.call(this,e),this.maxCount=t,this._updateItems(),this.$hiddenItems.length>0&&(this.$toggleButton=$('<button class="expand-summary">').click($.proxy(this,"_toggle")),this.$el.after(this.$toggleButton),this._summarize())},r.ui.Summarize.prototype={_updateItems:function(){var e=this.$el.children(".important"),t=this.$el.children(":not(.important)"),n=this.maxCount?Math.max(0,this.maxCount-e.length):0,r=t.slice(0,n-1);this.$summaryItems=e.add(r),this.$hiddenItems=t.slice(n)},_summarize:function(){this.$el.addClass("summarized"),this.$hiddenItems.hide(),this.$toggleButton.text(r._("… and %(count)s more ⇒").format({count:this.$hiddenItems.length}))},_expand:function(){this.$el.removeClass("summarized"),this.$hiddenItems.show(),this.$toggleButton.text(r._("⇐ less"))},_toggle:function(e){this.$el.hasClass("summarized")?this._expand():this._summarize(),e.preventDefault()}},r.i18n={jed:new Jed({locale_data:{messages:{"":{domain:"messages",lang:"en"}}}}),setPluralForms:function(e){this.jed.options.locale_data.messages[""].plural_forms=e},addMessages:function(e){_.extend(this.jed.options.locale_data.messages,e)}},r._=_.bind(r.i18n.jed.gettext,r.i18n.jed),r.P_=_.bind(r.i18n.jed.ngettext,r.i18n.jed),r.N_=_.identity,r.NP_=function(e,t){return[e,t]},r.utils={replaceUrlParams:function(e,t){var n=document.createElement("a"),r=$.url(e),i=r.param();return Object.keys(t).forEach(function(e){i[e]=t[e]}),n.href=e,n.search=$.param(i),n.href},formatFileSize:function(e){var t=["bytes","KiB","MiB","GiB","TiB","EiB","ZiB"],n=e?parseInt(Math.log2(e)/10,10):0;return(e/(1<<n*10)).toFixed(3).replace(/\.?0+$/,"")+" "+t[n]},fullnameToId:function(e){var t=e.split("_"),n=t&&t[1];return n&&parseInt(n,36)},escapeSelector:function(e){return e.replace(/([ #;?%&,.+*~\':"!^$[\]()=>|\/@])/g,"\\$1")},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},staticURL:function(e){return r.config.static_root+"/"+e},s3HTTPS:function(e){return location.protocol=="https:"?e.replace("http://","https://s3.amazonaws.com/"):e},parseTimestamp:function(e){var t=e.data("timestamp"),n;return t||(n=e.attr("datetime"),t=Date.parse(n),e.data("timestamp",t)),t},joinURLs:function(){return _.map(arguments,function(e,t){return t>0&&e&&e[0]!="/"&&(e="/"+e),e}).join("")},_scOn:"<!-- SC_ON -->",_scOff:"<!-- SC_OFF -->",_scBetweenTags1:/>\s+/g,_scBetweenTags2:/\s+</g,_scSpaces:/\s+/g,_scDirectives:/(<!-- SC_ON -->|<!-- SC_OFF -->)/,spaceCompress:function(e){var t="",n=!0,r=e.split(this._scDirectives);for(var i=0;i<r.length;++i){var s=r[i];s===this._scOn?n=!0:s===this._scOff?n=!1:n?(s=s.replace(this._scSpaces," "),s=s.replace(this._scBetweenTags1,">"),s=s.replace(this._scBetweenTags2,"<"),t+=s):t+=s}return t},tup:function(e){return _.isArray(e)||(e=[e]),e},structuredMap:function(e,t){if(_.isArray(e))return _.map(e,function(e){return r.utils.structuredMap(e,t)});if(_.isObject(e)){var n={};return _.each(e,function(e,i){n[t(i,"key")]=r.utils.structuredMap(e,t)}),n}return t(e,"value")},unescapeJson:function(e){return r.utils.structuredMap(e,function(e){return _.isString(e)?_.unescape(e):e})},querySelectorFromEl:function(e,t){return $(e).parents().addBack().filter(t||"*").map(function(e,t){var n=[],r=$(t),i=r.data("fullname"),s=r.attr("id"),o=r.attr("class");return n.push(t.nodeName.toLowerCase()),i?n.push('[data-fullname="'+i+'"]'):s?n.push("#"+s):o&&n.push("."+_.compact(o.split(/\s+/)).join(".")),n.join("")}).toArray().join(" ")},serializeForm:function(e){var t={};return $.each(e.serializeArray(),function(e,n){t[n.name]=n.value}),t},_pyStrFormatRe:/%\((\w+)\)s/g,pyStrFormat:function(e,t){return e.replace(this._pyStrFormatRe,function(e,n){if(n in t)return t[n];throw"missing format parameter"})},_mdLinkRe:/\[(.*?)\]\((.*?)\)/g,formatMarkdownLinks:function(e){return _.escape(e).replace(this._mdLinkRe,function(e,t,n){return'<a href="'+n+'">'+t+"</a>"})},prettyNumber:function(e){var t=parseInt(e);return t?t.toString().replace(/\B(?=(\d{3})+(?!\d))/g
,","):e},LRUCache:function(e){var t=e>0?e:16,n=[],r={},i=function(e){s(e),n.push(e),n.length>t&&delete r[n.shift()]},s=function(e){var t=_.indexOf(n,e);t>=0&&n.splice(t,1)};this.remove=function(e){s(e),delete r[e]},this.set=function(e,t){_.isUndefined(t)?this.remove(e):(r[e]=t,i(e))},this.get=function(e){var t=r[e];return _.isUndefined(t)||i(e),t},this.ajax=function(e,t){var n=this.get(e);return _.isUndefined(n)?$.ajax(t).done(_.bind(this.set,this,e)):(new $.Deferred).resolve(n)}},parseError:function(e){var t=e[0],n=e[1],r=e[2];return{name:t,message:n,field:r}},onTrident:function(){return"ActiveXObject"in window}},String.prototype.format=function(e){return r.utils.pyStrFormat(this,e)},r.analytics={init:function(){$(document).delegate(".organic-listing .promotedlink.promoted","onshow",_.bind(function(e){this.fireTrackingPixel(e.target)},this)),$(".promotedlink.promoted:visible").trigger("onshow"),r.analytics.addEventPredicate("ads",function(){return!r.config.is_sponsor}),r.config.ads_virtual_page&&r.analytics.fireFunnelEvent("ads",r.config.ads_virtual_page);var e=r.config.tracker_url,t={dnt:window.DO_NOT_TRACK};if(!r.config.user_id){var n=new redditlib.Tracker,i=n.getTrackingData();i&&i.loid&&(t.loid=i.loid,i.loidcreated&&(t.loidcreated=i.loidcreated))}r.analytics.firePageTrackingPixel(e,t,r.analytics.stripAnalyticsParams)},_eventPredicates:{},addEventPredicate:function(e,t){var n=this._eventPredicates[e]||[];n.push(t),this._eventPredicates[e]=n},shouldFireEvent:function(e){var t=_.rest(arguments);return!this._eventPredicates[e]||this._eventPredicates[e].every(function(e){return e.apply(this,t)})},_isGALoaded:!1,isGALoaded:function(){if(this._isGALoaded)return!0;if(_.isArray(_gaq))return undefined;var e=!1;return _gaq.push(function(){e=!0}),this._isGALoaded=e,e},_wrapCallback:function(e){var t=e;return t.called=!1,e=function(){t.called||(t(),t.called=!0)},setTimeout(e,500),e},fireFunnelEvent:function(e,t,n,r){n=n||{},r=r||window.Function.prototype;var i="/"+_.compact([e,t,n.label]).join("-");if(n.tracker&&"_ga"in window&&window._ga.getByName&&window._ga.getByName(n.tracker)){window._ga(n.tracker+".send","pageview",{page:i,hitCallback:r}),n.value&&window._ga(n.tracker+".send","event",e,t,n.label,n.value);return}if(!window._gaq||!this.shouldFireEvent.apply(this,arguments)){r();return}var s=this.isGALoaded();s||(r=this._wrapCallback(r)),_gaq.push(["_trackPageview",i]),n.value&&_gaq.push(["_trackEvent",e,t,n.label,n.value]),_gaq.push(r)},fireGAEvent:function(e,t,n,r,i,s){n=n||"",r=r||0,i=!!i,s=s||function(){};if(!window._gaq||!this.shouldFireEvent.apply(this,arguments)){s();return}var o=this.isGALoaded();o||(s=this._wrapCallback(s)),_gaq.push(["_trackEvent",e,t,n,r,i]),_gaq.push(s)},fireTrackingPixel:function(e){var t=$(e),n=$("body").hasClass("comments-page");if(t.data("trackerFired")||n)return;var r=$("#siteTable_organic").is(":hidden"),i=new Image,s=t.data("impPixel");s&&!r&&(i.src=s);if(!r){var o=t.data("thirdPartyTrackingUrl");if(o){var u=new Image;u.src=o}var a=t.data("thirdPartyTrackingTwoUrl");if(a){var f=new Image;f.src=a}}var l=new Image,c=t.data("adserverImpPixel"),h=t.data("adserverClickUrl");c&&!r&&(l.src=c),t.data("trackerFired",!0)},fireUITrackingPixel:function(e,t,n){var i=new Image;i.src=r.config.uitracker_url+"?"+$.param(_.extend({act:e,sr:t,r:Math.round(Math.random()*2147483647)},r.analytics.breadcrumbs.toParams(),n))},firePageTrackingPixel:function(e,t,n){if(!e)return;t=t||{};var r=["r="+Math.random()],i=document.referrer||"",s=i.match(/\/\/([^\/]+)/);s&&s.length>1&&r.push("referrer_domain="+encodeURIComponent(s[1]));for(var o in t)t.hasOwnProperty(o)&&r.push(encodeURIComponent(o)+"="+encodeURIComponent(t[o]));var u=new Image;u.onload=u.onerror=n,u.src=e+"&"+r.join("&")},stripAnalyticsParams:function(){var e=!!window.history&&!!window.history.replaceState,t=$.url().param(),n=["ref","ref_source","ref_campaign"],r=_.omit(t,n);if(e&&!_.isEqual(t,r)){var i=document.createElement("a");i.href=window.location.href,i.search=$.param(r),window.history.replaceState({},document.title,i.href)}}},r.analytics.breadcrumbs={selector:".thing, .side, .sr-list, .srdrop, .tagline, .md, .organic-listing, .gadget, .sr-interest-bar, .trending-subreddits, a, button, input",maxLength:3,sendLength:2,init:function(){this.hasSessionStorage=this._checkSessionStorage(),this.data=this._load();var e=this.data[0]&&this.data[0].url==window.location;e||this._storeBreadcrumb(),$(document).delegate("a, button","click",$.proxy(function(e){this.storeLastClick($(e.target))},this))},_checkSessionStorage:function(){try{return sessionStorage.setItem("__test__","test"),sessionStorage.removeItem("__test__"),!0}catch(e){return!1}},_load:function(){if(!this.hasSessionStorage)return[{stored:!1}];var e;try{e=JSON.parse(sessionStorage.breadcrumbs)}catch(t){e=[]}return _.isArray(e)||(e=[]),e},store:function(){this.hasSessionStorage&&(sessionStorage.breadcrumbs=JSON.stringify(this.data))},_storeBreadcrumb:function(){var e={url:location.toString()};if("referrer"in document){var t=!document.referrer.match("^"+r.config.currentOrigin),n=this.data[0]&&document.referrer!=this.data[0].url;if(t||n)e.ref=document.referrer}this.data.unshift(e),this.data=this.data.slice(0,this.maxLength),this.store()},storeLastClick:function(e){try{this.data[0].click=r.utils.querySelectorFromEl(e,this.selector),this.store()}catch(t){}},lastClickFullname:function(){var e=_.find(this.data,function(e){return e.click});if(e){var t=e.click.match(/.*data-fullname="(\w+)"/);return t&&t[1]}},toParams:function(){params=[];for(var e=0;e<this.sendLength;e++)_.each(this.data[e],function(t,n){params["c"+e+"_"+n]=t});return params}},r.analytics.uuid=function(){var e=(new Date).getTime(),t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t=="x"?n:n&3|8).toString(16)});return t},r.analytics.event={init:function(){this.contextData={linkFullname:null,loid:null,srFullname:null,srName:null,userId:null,userName:null};if(r.config.user_id)this.contextData.userId=r.config.user_id,this.contextData.userName=r.config.logged;else{var e=new redditlib.Tracker,t=e.getTrackingData();this.contextData.loid=t.loid}r.config.post_site&&(this.contextData.srName=r.config.post_site),r.config.cur_site&&(this.contextData.srFullname=r.config.cur_site),r.config.cur_link&&(this.contextData.linkFullname=r.config.cur_link)},_eventPayload:function(){var e={};return this.contextData.userId?(e.user_id=this.contextData.userId,e.user_name=this.contextData.userName):e.loid=this.contextData.loid,this.contextData.srName&&(e.sr_name=this.contextData.srName),this.contextData.srFullname&&(e.sr_id=r.utils.fullnameToId(this.contextData.srFullname)),e},timeoutForbiddenEvent:function(e,t,n,i){var s="forbidden_actions",o="cs.forbidden_"+e,u=this._eventPayload();u.process_notes="IN_TIMEOUT",t&&(u.details_text=t),n&&(u.target_type=n),i&&(u.target_fullname=i,u.target_id=r.utils.fullnameToId(i)),r.events.track(s,o,u).send()}},!function(e){"use strict";function t(e){$.ajax({method:"POST",url:e.url+"?"+jQuery.param(e.query),data:e.data,contentType:"text/plain"})}function n(e,t){var n=CryptoJS.HmacSHA256(t,e);return n.toString(CryptoJS.enc.Hex)}var r;e.events={init:function(){e.config.events_collector_key&&e.config.events_collector_secret&&e.config.events_collector_url&&(r=new EventTracker(e.config.events_collector_key,e.config.events_collector_secret,t,e.config.events_collector_url,"reddit.com",n))},track:function(e,t,n){return r&&r.track(e,t,n),this},send:function(){return r&&r.send(),this}}}(r),!function(e){e.access={};var t=!1,n=[];_.extend(e.access,{init:function(){t=!0,n.forEach(function(e){e()}),n.length=0},isLinkRestricted:function(e){return!1},initHook:function(e){t?e():n.push(e)}})}(r),!function(e){var t=e.hooks.create("reddit-init");t.register(function(){try{e.analytics.init(),e.events.init(),e.access.init()}catch(t){e.sendError("Error during reddit-init.js init",t.toString())}}),$(function(){t.call()})}(r),function(e){function n(e){return t[e]?!1:(t[e]=!0,!0)}function i(e){delete t[e]}function s(t){return function(t){if(t.jquery){var n={};n[0]=jQuery,e.map(t.jquery,function(t){var r=t[0],i=t[1],s=t[2],o=t[3];if(typeof o=="string")o=e.unsafe(o);else for(var u=0;o.length&&u<o.length;u++)o[u]=e.unsafe(o[u]);s=="call"?n[i]=n[r].apply(n[r]._obj,o):s=="attr"?(n[i]=n[r][o],n[i]?n[i]._obj=n[r]:e.debug("unrecognized")):s=="refresh"?e.refresh():e.debug("unrecognized")})}}}e.log=function(e){window.console?window.console.debug?window.console.debug(e):window.console.log&&window.console.log(e):alert(e)},e.debug=function(t){if(e.with_default(r.config.debug,!1))return e.log(t)},e.fn.debug=function(){return e.debug(e(this)),e(this)},e.redirect=function(e){window.location=e},e.fn.redirect=function(t){e(this).filter("form").find(".status").show().html("redirecting...");var n=e(this).attr("target");if(n=="_top"){var r=window;while(r!=r.parent)r=r.parent;r.location=t}else e.redirect(t);return e(this)},e.refresh=function(){window.location.reload(!0)},e.defined=function(e){return typeof e!="undefined"},e.with_default=function(t,n){return e.defined(t)?t:n},e.websafe=function(e){return typeof e=="string"&&(e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/>/g,"&gt;").replace(/</g,"&lt;")),e||""},e.unsafe=function(e){return typeof e=="string"&&(e=e.replace(/&quot;/g,'"').replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")),e||""},e.uniq=function(e,t){var n=[],r={},i=t?t:e.length;for(var s=0;s<e.length&&n.length<i;s++)r[e[s]]||(r[e[s]]=!0,n.push(e[s]));return n},function(t,n){e.fn.show=function(n,r){return e(this).trigger("onshow"),t.call(this,n,r)},e.fn.hide=function(t,r){return e(this).trigger("onhide"),n.call(this,t,r)}}(e.fn.show,e.fn.hide);var t={};e.handleResponse=s;var o="/api/";e.request=function(t,u,a,f,l,c,h){var p=t,d=a;if(rate_limit(t)){h&&h("ratelimit");return}if(window!=window.top&&!r.config.external_frame)return;var v=!e.with_default(f,!1)||n(p);u=e.with_default(u,{}),a=e.with_default(a,s(p)),l=e.with_default(l,"json"),typeof a!="function"&&(a=s(p));var d=function(e){return i(p),a(e)};errorhandler_in=e.with_default(h,function(){}),h=function(e){return i(p),errorhandler_in(e)},c=e.with_default(c,!1),r.config.post_site&&(u.r=r.config.post_site),r.config.logged&&(u.uh=r.config.modhash),u.renderstyle=r.config.renderstyle,v&&(t=o+t,e.ajax({type:c?"GET":"POST",url:t,data:u,success:d,error:h,dataType:l}))};var u="up",a="upmod",f="down",l="downmod";rate_limit=function(){var e=333,t={vote:333,comment:333,ignore:0,ban:0,unban:0,assignad:0},n={},r=Date;return function(s){var o=new r,u=s in t?t[s]:e,a=n[s],f=a&&o-a<u;return n[s]=o,f}}(),e.fn.updateThing=function(t){var n=e(this),i=n.children(".entry");if("friend"in t){var s='<a class="friend" title="friend" href="/prefs/friends">F</a>';i.find(".author").addClass("friend").next(".userattrs").each(function(){var t=e(this);t.html()?t.find(".friend").length||t.find("a:first").before(s+","):t.html(" ["+s+"]")})}if("voted"in t){var o=n.children(".midcol"),c=o.find(".arrow."+u+", .arrow."+a),h=o.find(".arrow."+f+", .arrow."+l),p=e(o).add(i);switch(t.voted){case 1:p.addClass("likes").removeClass("dislikes unvoted"),c.removeClass(u).addClass(a),h.removeClass(l).addClass(f);break;case-1:p.addClass("dislikes").removeClass("likes unvoted"),c.removeClass(a).addClass(u),h.removeClass(f).addClass(l);break;default:p.addClass("unvoted").removeClass("likes dislikes"),c.removeClass(a).addClass(u),h.removeClass(l).addClass(f)}}"saved"in t&&(n.addClass("saved"),i.find(".save-button a").text(r._("unsave")))},e.fn.resetInput=function(){var t=e(this);return t.wrap("<form>").closest("form").get(0).reset(),t.unwrap(),this},e.fn.show_unvotable_message=function(){e(this).thing().find(".entry:first .unvotable-message").css("display","inline-block")},e.fn.thing=function(){return this.parents(".thing:first")},e.fn.all_things_by_id=function(){return this.thing().add(e.things(this.thing_id()))},e.fn.thing_id=function(){var t=this.hasClass("thing")?this:this.thing();if(!t.length)return"";var n=t.data("fullname");return n?n:(n=e.grep(t.get(0).className.match(/\S+/g),function(e){return e.match(/^id-/)}),n.length?n[0].slice(3,n[0].length):"")},e.things=function(){var t=e.map(arguments,function(e){return".thing.id-"+e}).join(", ");return e(t)},e.fn.things=function(){var t=e.map(arguments,function(e){return".thing.id-"+e}).join(", ");return this.find(t)},e.listing=function(t){t=t||"";var n="siteTable";if(t.slice(0,1)=="#"||t.slice(0,1)==".")t=t.slice(1,t.length);var r=t;t.slice(0,n.length)!=n?r=n+(t?"_"+t:""):t=t.slice(n.length+1,t.length);var i=e("#"+r).filter(":first");return i.length==0&&(i=e.things(t).find(".child").append(document.createElement("div")).children(":last").addClass("sitetable").attr("id",r)),i};var c=function(){};e.fn.set_thing_init=function(t){c=t,e(this).find(".thing:not(.stub)").each(function(){t(this)})},e.fn.new_thing_child=function(t,n){var r=this.thing_id(),i=n?e.listing(r):this.thing().find(".child:first"),s;return typeof t=="string"?s=i.prepend(t).children(":first"):s=t.hide().prependTo(i).show().find('input[name="parent"]').val(r).end(),s.randomize_ids()},e.fn.randomize_ids=function(){var t=(Math.random()+"").split(".")[1];return e(this).find("*[id]").each(function(){e(this).attr("id",e(this).attr("id")+t)}).end().find("label").each(function(){e(this).attr("for",e(this).attr("for")+t)}),e(this)},e.fn.replace_things=function(t,n,r,i){var s=this,o=e.map(t,function(t){var o=t.data,u=e(s).things(o.id);i&&(u=u.filter(".stub"));if(u.length==0){var a=e.things(o.parent);a.length&&(u=e("<div></div>"),a.find(".child:first").append(u))}u.after(e.unsafe(o.content));var f=u.next();return n&&(f.show().children(".midcol, .entry").hide().end().children(".child:first").html(u.children(".child:first").remove().html()).end(),r&&(u.hide(),f.children(".midcol, .entry").show()),f.find(".rank:first").html(u.find(".rank:first").html())),r?(u.hide(),n?f.children(".midcol, .entry").show():f.show(),u.remove()):(f.hide(),u.remove()),c(f),e(document).trigger("new_thing",f),f});return e(document).trigger("new_things_inserted"),o},e.insert_things=function(t,n){var r=e.map(t,function(t){var r=t.data,i=e.listing(r.parent);return n?i=i.append(e.unsafe(r.content)).children(".thing:last"):i=i.prepend(e.unsafe(r.content)).children(".thing:first"),c(i.hide().show()),e(document).trigger("new_thing",i),i});return e(document).trigger("new_things_inserted"),r},e.fn.delete_table_row=function(t){var n=this.parents("tr:first").get(0),r=this.parents("table").get(0);n?e(n).fadeOut(function(){r.deleteRow(n.rowIndex),t&&t()}):t&&t()},e.fn.insert_table_rows=function(t,n){var r=this.is("table")?this.filter("table"):this.parents("table:first");return e.map(r.get(),function(r){e.map(t,function(t){var i=n;i<0&&(i=Math.max(r.rows.length+i+1,0)),i=Math.min(i,r.rows.length);var s=e(r.insertRow(i)),o=e(e.parseHTML(e.unsafe(t)));o.hide(),s.replaceWith(o),o.trigger("insert-row"),o.css("display","table-row"),o.fadeIn()})}),this},e.fn.captcha=function(e){var t=this.find(".capimage");return e&&t.attr("src","/captcha/"+e+".png").siblings('input[name="iden"]').val(e),t},e.fn.insertAtCursor=function(t){return e(this).filter("textarea").each(function(){var n=e(this).get(0),r=n.scrollTop;if(document.selection){n.focus();var i=document.selection.createRange();i.text=t}else if(n.selectionStart){var s=n.selectionStart;n.value=n.value.substring(0,n.selectionStart)+t+n.value.substring(n.selectionEnd,n.value.length),s+=t.length,n.setSelectionRange(s,s)}else n.value+=t;n.scrollHeight&&(n.scrollTop=r),e(this).focus()}).end()},e.fn.select_line=function(t){return e(this).filter("textarea").each(function(){var n="\n",r=1,i=0,s=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());s&&(n="\r",r=0,i=1);var o=e(this).val().split(n);for(var u=0;u<t-1;u++)i+=o[u].length+r;var a=i;t<=o.length&&(a+=o[t-1].length+r),e(this).focus();if(this.createTextRange){var f=this.createTextRange();f.move("character",i);var l=this.createTextRange();l.move("character",a),f.setEndPoint("StartToEnd",l),f.select()}else this.selectionStart&&this.setSelectionRange(i,a);if(this.scrollHeight){var c=this.scrollHeight/o.length;this.scrollTop=(t-2)*c}})},e.apply_stylesheet=function(t){var n=e("head").children("link[title], style[title]").filter(":first").attr("title")||"preferred stylesheet";if(document.styleSheets[0].cssText){var r=document.styleSheets;for(var i=0;i<r.length;i++)if(r[i].title==n){r[i].cssText=t;break}}else{e("head").children('*[title="'+n+'"]').remove(),document.body.offsetHeight;var s=e('<style type="text/css" media="screen"></style>').attr("title",n).text(t).appendTo("head")}},e.apply_stylesheet_url=function(t,n){var r="applied_subreddit_stylesheet",i=e('link[title="'+r+'"]');i.length==0&&(e("head").append('<link type="text/css" title="'+r+'" rel="stylesheet">'),i=e('link[title="'+r+'"]')),i.attr("href",t),e("#sr_style_enabled").prop("checked",n),e("#sr_style_throbber").html("").css("display","none")},e.apply_header_image=function(t,n,r){var i=e("#header-img");i.is("a")&&(i.attr("id","header-img-a").text("").append('<img id="header-img"/>'),i=e("#header-img")),i.removeClass("default-header"),i.attr("src",t),i.attr("title",r),n?(i.attr("width",n[0]),i.attr("height",n[1])):(i.removeAttr("width"),i.removeAttr("height"))},e.remove_header_image=function(){var t=e("#header-img-a");t&&(t.addClass("default-header").attr("id","header-img").empty(),e("#header-img").empty(),t.attr("id","header-img"))};var h;e.default_cookie_domain=function(e){e&&(h=e)};var p;e.default_cookie_security=function(e){p=e};var d="_";e.cookie_name_prefix=function(e){e&&(d=e+"_")},e.cookie_write=function(t){if(t.name){var n={};n.expires=t.expires,n.domain=t.domain||h,n.path=t.path||"/",n.secure=t.secure||p;var r=d+t.name,i=t.data;i===null||i==""?i=null:typeof i!="string"&&(i=JSON.stringify(i)),e.cookie(r,i,n)}},e.cookie_read=function(t,n){var r=(n||d)+t,i=e.cookie(r);try{i=JSON.parse(i)}catch(s){}return{name:t,data:i}},e.fn.highlight=function(t){if(!t)return this;var n=e.websafe(t.trim()).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp("\\b"+n+"\\b","gi");return this.each(function(){if(this.children.length)return;this.innerHTML=this.innerHTML.replace(r,function(e){return"<mark>"+e+"</mark>"})})}}(jQuery),function(e){"use strict";function l(e){var t=e.offset();return e.outerWidth()+(t?t.left:0)}function c(){var e=a;return arguments.length&&(e=_.pick(e,_.toArray(arguments))),_.values(e).concat(u).join(" ")}function h(e){return!!e.data("bs.tooltip")}var t='<div class="c-tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',n="c-form-group",r="c-form-control",i="."+r,s="c-form-control-feedback-",o="."+s,u="c-has-feedback",a={loading:"c-has-throbber",success:"c-has-success",error:"c-has-error"},f={loading:"throbber",success:"success",error:"error"},p=function(e,t){this.initialize(e,t)};_.extend(p.prototype,{_currentState:null,_getFeedbackSelector:function(){var e=this.getCurrentState();return o+f[e]},initialize:function(t,r){return this.$el=e(t).closest("."+n),this},getCurrentState:function(){return this._currentState},set:function(e){return this._currentState!==e&&(this.clear(),this._currentState=e,this.$el.addClass(c(e))),arguments.length>1&&this.showMessage.apply(this,_.toArray(arguments).slice(1)),this},showMessage:function(n){if(!n)return;var r=this._getFeedbackSelector(),s=this.$el.find(i),o=this.$el.find(r);if(n===o.attr("data-original-title"))return;o.attr("title",n);if(h(o)){o.tooltip("fixTitle"),s.is(":focus")&&o.tooltip("show");return}o.tooltip({template:t,placement:"right",trigger:"manual"});if(s.is(":focus")||s.parents("form").find('[type="submit"]:focus').length){o.tooltip("show");var u=e("body"),a=o.data("bs.tooltip"),f=a.$tip;u.length&&l(u)<l(f)&&(a.options.placement="top-right",o.tooltip("show"))}s.on("focus.c.stateify",function(){s.parents("form").find(r).not(o).tooltip("hide");var e=o.data("bs.tooltip");e&&e.tip().off("bsTransitionEnd"),o.tooltip("show")}).on("blur.c.stateify",function(){o.tooltip("hide")}),o.on("mouseenter.c.stateify",function(){s.is(":focus")||o.tooltip("show")}).on("mouseleave.c.stateify",function(){s.is(":focus")||o.tooltip("hide")})},clear:function(){var e=this.$el.find(this._getFeedbackSelector()),t=this.$el.find(i);return e.tooltip("destroy").removeAttr("data-original-title").off("mouseenter.c.stateify mouseleave.c.stateify"),t.off("focus.c.stateify blur.c.stateify"),this.$el.removeClass(c()),this._currentState=null,this}}),e.fn.stateify=function(t){var n=_.toArray(arguments).slice(1);if(t&&/^get/.test(t)){var r=this.data("c.stateify");return r&&r[t].apply(r,n)}return this.each(function(){var r=e(this),i=r.data("c.stateify"),s=typeof t=="object"&&t;i||(i=new p(this,s),r.data("c.stateify",i)),typeof t=="string"&&i[t].apply(i,n)})}}(window.jQuery),function(e){"use strict";function n(n){var r=Array.prototype.slice.call(arguments,1);return this.each(function(){var i=e(this),s=i.data("c.validator"),o=typeof n=="object"&&n;s||(s=new t(this,o),i.data("c.validator",s)),typeof n=="string"&&s[n].apply(s,r)})}var t=function(e,t){this.initialize(e,t)};t.DEFAULTS={delay:600,loadingTimeout:250,https:!1},_.extend(t.prototype,{_loadingTimeout:!1,initialize:function(n,r){var i=this.$el=e(n),s=i.data("validate-on")||"keyup change blur";return this.options=e.extend({},t.DEFAULTS,r),i.on(s,_.debounce(e.proxy(this._validate,this),this.options.delay)),i.trigger("initialize.validator"),this},_validate:function(t){if(t.keyCode===9||t.keyCode===13)return;if(t.type==="blur"&&t.relatedTarget&&e(t.relatedTarget).is("[type=submit]"))return;var n=this,r=this.$el,i=r.data("validate-min"),s=r.val();if(t.type==="keyup"&&s.length<i){delete this._keyupValue,r.trigger("cleared.validator");return}if(/change|blur/.test(t.type)&&this._keyupValue===s)return;if(/^\s*$/.test(s)&&!r.data("validate-noclear")){r.trigger("cleared.validator");return}var o=r.parents("form"),u=r.data("validate-url"),a=(r.data("validate-with")||"").split(/,s*/),f={};if(this.options.https){var l=document.createElement("a");l.href=u,l.protocol="https:",u=l.href}f[r.attr("name")]=s,t.type==="keyup"&&(this._keyupValue=s),_.each(a,function(e){f[e]=o.find('[name="'+e+'"]').val()}),this._loadingTimeout=setTimeout(function(){r.trigger("loading.validator")},this.options.loadingTimeout),this.xhr&&this.xhr.readyState!==4&&this.xhr.abort(),this.xhr=e.ajax({type:"POST",url:u,data:f,dataType:"json",success:function(e,t,n){var i=e&&e.json;i&&i.errors&&i.errors.length?(r.trigger("invalid.validator",i),_.each(a,function(e){o.find('[name="'+e+'"]').trigger("invalid.validator",i)})):r.trigger("valid.validator")},error:function(e){if(e.status===0)return;if(e.status===409){r.trigger("cleared.validator");return}r.trigger("valid.validator")},complete:function(){clearTimeout(n._loadingTimeout),r.trigger("loaded.validator")}})}}),e.fn.validator=n,e.fn.validator.Constructor=t}(window.jQuery),function(e){"use strict";function a(e,t){return _.any(t,function(t){return t&&e.indexOf(t)!==-1})||_.any(n,function(t){return t.test(e)})}function f(e){return function(t){var n=new RegExp(e+"+","g"),r=t.match(n)||[];return _.reduce(r,function(e,t){return e+=t.length},0)}}function l(e){var t=_.toArray(e),n=_.unique(t).length,r=0;for(var i=0,s=t.length;i<s;i++)for(var o=0;o<s;o++)t[i]===t[o]&&i!==o&&(r+=Math.abs(s/(o-i)));return Math.ceil(n===0?r:r/n)}function c(e){return function(t){var n=t.toLowerCase(),r=0;for(var i=0,s=e.length-3;i<s;i++){var o=e.substring(i,i+3),u=_.toArray(o).reverse().join("");(n.indexOf(o)!=-1||n.indexOf(u)!=-1)&&r++}return r}}function p(e,t){var n=0;if(t.test instanceof Function)n=t.test(e);else{var r=e.match(t.test);n=r?r.length:0}return t.weight instanceof Function?t.weight(e,n):t.weight*n}function d(e,t){return e=e||"",a(e,t)?0:_.reduce(h,function(t,n){return t+=p(e,n)},0)}function v(n){var r=Array.prototype.slice.call(arguments,1);return this.each(function(){var i=e(this),s=i.data("c.strengthMeter"),o=typeof n=="object"&&n;s||(s=new t(this,o),i.data("c.strengthMeter",s)),typeof n=="string"&&s[n].apply(s,r)})}var t=function(e,t){this.initialize(e,t)};t.DEFAULTS={template:'<div class="strength-meter"><div class="strength-meter-fill"></div></div>',delay:100,minimumDisplay:5,trigger:"keyup change blur"};var n=[/^password(\d+)?$/i,/^letmein(\d+)?$/i,/^welcome(\d+)?$/i,/^secret(\d+)?$/i,/^reddit(\d+)?$/i,/^(reddit)\1+/i,/^(test)\1+$/i,/^abcd?e?f?1234?5?6?$/i,/^iloveyou$/i,/^admin$/i,/^trustno1$/i,/^.werty$/i,/^sunshine$/i,/^monkey$/i,/^shadow$/i,/^princess$/i,/^dragon$/i],r="abcdefghijklmnopqrstuvwxyz",i="qwertyuiopasdfghjklzxcvbnm",s="qazwsxedcrfvtgbyhnujmikolp",o="01234567890",u="!@#$%^&*()",h=[{test:/./g,weight:4},{test:/[A-Z]/g,weight:function(e,t){return!t||e.length===t?0:(e.length-t)*2}},{test:/[a-z]/g,weight:function(e,t){return!t||e.length===t?0:(e.length-t)*2}},{test:/\d/g,weight:function(e,t){return!t||e.length===t?0:t*4}},{test:/\W|_/g,weight:6},{test:/^[a-z]+$/i,weight:-1},{test:/^\d+$/i,weight:-1},{test:c(r),weight:-3},{test:c(i),weight:-3},{test:c(s),weight:-3},{test:c(o),weight:-3},{test:c(u),weight:-3},{test:f("[a-z]"),weight:-2},{test:f("[A-Z]"),weight:-2},{test:f("\\d"),weight:-2},{test:l,weight:-1}];_.extend(t.prototype,{_cancelScore:!1,initialize:function(n,r){this.options=e.extend({},t.DEFAULTS,r);var i=this.$el=e(n),s=this.$meter=e(this.options.template),o=this.options.trigger;o!=="manual"&&i.on(this.options.trigger,_.debounce(this.score.bind(this),this.options.delay)),s.insertAfter(i);var u=s.outerWidth(),a=u+5+"px";return i.css({"padding-right":a}),i.trigger("initialize.strengthMeter"),this},score:function(){var t=this.$el.val(),n=_.map(this.options.related,function(t){return e(t).val()||""}),r=d(t,n),i=Math.min(100,Math.max(this.options.minimumDisplay,r));this.$el.trigger("score.strengthMeter",i),this._cancelScore||this.$meter.find(".strength-meter-fill").css({width:i+"%"}),this._cancelScore=!1},cancelScore:function(){this._cancelScore=!0}}),e.fn.strengthMeter=v,e.fn.strengthMeter.Constructor=t}(window.jQuery),!function(e){"use strict";function n(n){var r=Array.prototype.slice.call(arguments,1);return this.each(function(){var i=e(this),s=i.data("c.toggle"),o=typeof n=="object"&&n;s||(s=new t(this,o),i.data("c.toggle",s)),typeof n=="string"&&s[n].apply(s,r)})}var t=function(e,t){this.initialize(e,t)};_.extend(t.prototype,{initialize:function(t,n){var r=this.$el=e(t);return r.on("click",function(t){var n=e(t.target),r=n.data("toggle");n.toggleClass("c-toggle-toggled"),e(r).toggleClass("c-toggle-content-toggled")}),this}}),e.fn.togglable=n,e.fn.togglable.Constructor=t}(window.jQuery);function open_menu(e){$(e).siblings(".drop-choices").not(".inuse").css("top",e.offsetHeight+"px").each(function(){$(this).css("left",$(e).position().left+"px").css("top",$(e).height()+$(e).position().top+"px")}).addClass("active inuse")}function close_menu(e){$(e).closest(".drop-choices").removeClass("active inuse")}function close_menus(e){$(".drop-choices.inuse").not(".active").removeClass("inuse"),$(".drop-choices.active").removeClass("active").trigger("close_menu"),$(".flairselector").empty(),$(e.target).closest("#search").length==0&&($("#moresearchinfo").slideUp(),$("#searchexpando").length==1?$("#searchexpando").slideUp(function(){$("#search_showmore").parent().show()}):$("#search_showmore").parent().show())}function select_tab_menu(e,t){var n="tabbedpane-"+t,r=$(e).parent().parent().parent();r.find(".tabmenu li").removeClass("selected"),$(e).parent().addClass("selected"),r.find(".tabbedpane").each(function(){this.style.display=this.id==n?"block":"none"})}function post_user(e,t){var n=$(e).find('input[name="user"]').val();return n==null?post_form(e,t):post_form(e,t+"/"+n)}function post_form(e,t,n,i,s){try{return n==null&&(n=function(e){return r.config.status_msg.submitting}),$(e).find(".error").not(".status").hide(),$(e).find(".status").html(n(e)).show(),simple_post_form(e,t,{},s)}catch(o){return!1}}function get_form_fields(e,t,n){return t=t||{},n||(n=function(e){return!0}),$(e).find("select, input, textarea").not(".gray, :disabled").each(function(){var e=$(this),r=e.attr("type");if(!n(this))return;if(e.data("send-checked"))t[e.attr("name")]=e.is(":checked");else if(r!="radio"&&r!="checkbox"||e.is(":checked"))t[e.attr("name")]=e.val()}),t.id==null&&(t.id=$(e).attr("id")?"#"+$(e).attr("id"):""),t}function form_error(e){return function(t){var n;t=="ratelimit"?n=r._("please wait a few seconds and try again."):n=r._("an error occurred (status: %(status)s)").format({status:t.status}),$(e).find(".status").text(n)}}function simple_post_form(e,t,n,r,i){return $.request(t,get_form_fields(e,n),i,r,"json",!1,form_error(e)),!1}function post_pseudo_form(e,t,n){var i=function(t){var n=$(t).parents("form:first");return n.length==0||n.get(0)==$(e).get(0)};return $(e).find(".error").not(".status").hide(),$(e).find(".status").html(r.config.status_msg.submitting).show(),$.request(t,get_form_fields(e,{},i),null,n,"json",!1,form_error(e)),!1}function post_multipart_form(e,t){return $(e).find(".error").not(".status").hide(),$(e).find(".status").html(r.config.status_msg.submitting).show(),!0}function showlang(){var e=$("#lang-popup").prop("innerHTML"),t=new r.ui.Popup({className:"lang-modal",content:e});return t.show(),!1}function deleteRow(e){$(e).delete_table_row()}function change_state(e,t,n,r,i){var s=$(e).parents("form").first(),o=s.find('input[name="id"]');return o.length?o=o.val():o=$(e).thing_id(),simple_post_form(s,t,{id:o},undefined,i),n&&n(s.length?s:e,t),$.defined(r)||s.html(s.find('[name="executed"]').val()),!1}function unread_thing(e){var t=$(e);t.hasClass("thing")||(t=t.thing()),$(t).addClass("new unread")}function read_thing(e){var t=$(e);t.hasClass("thing")||(t=t.thing()),$(t).hasClass("new")?$(t).removeClass("new"):$(t).removeClass("unread"),$.request("read_message",{id:$(t).thing_id()})}function click_thing(e){var t=$(e);t.hasClass("thing")||(t=t.thing()),t.hasClass("message")&&t.hasClass("recipient")&&(t.hasClass("unread")?t.removeClass("unread"):t.hasClass("new")&&read_thing(e))}function hide_thing(e){if($("body").hasClass("comments-page"))return;var t=$(e).thing();if(t.is(".comment")&&t.has(".child:not(:empty)").length){var n="["+_.escape(r._("deleted"))+"]",i=t.addClass("deleted").find(".entry:first");i.find(".usertext").addClass("grayed").find(".md").html("<p>"+n+"</p>"),i.find(".author").replaceWith("<em>"+n+"</em>"),i.find(".userattrs, .score, .buttons").remove()}else t.fadeOut(function(){$(this).toggleClass("hidden");var e=$(this).thing_id();$(document).trigger("hide_thing_"+e)})}function toggle_label(e,t,n){$(e).parent().find(".option").toggle(),$(e)[0].onclick=function(){return toggle_label(e,n,t)},t&&t(e)}function toggle(e,t,n){if(r.access.isLinkRestricted(e))return!1;r.analytics.breadcrumbs.storeLastClick(e);var i=$(e).parent().addBack().filter(".option"),s=i.removeClass("active").siblings().addClass("active").get(0);return n&&!s.onclick&&(s.onclick=function(){return toggle(s,n,t)}),t&&t(e),!1}function cancelToggleForm(e,t,n,r){if(n&&$(e).filter("button").length){var i=$(e).thing().find(n).children(":visible").filter(":first");toggle(i)}return $(e).thing().find(t).each(function(){r&&r($(this)),$(this).hide().remove()}),!1}function linkstatus(e){return r.config.status_msg.submitting}function subscribe(e){return function(){r.config.logged&&(r.config.cur_site==e&&$("body").addClass("subscriber"),$.things(e).find(".entry").addClass("likes"),$.request("subscribe",{sr:e,action:"sub"}),r.analytics.fireUITrackingPixel("sub",e,{has_subd:r.config.has_subscribed}))}}function unsubscribe(e){return function(){r.config.logged&&(r.config.cur_site==e&&$("body").removeClass("subscriber"),$.things(e).find(".entry").removeClass("likes"),$.request("subscribe",{sr:e,action:"unsub"}),r.analytics.fireUITrackingPixel("unsub",e))}}function quarantine_optout(e){return function(){r.config.logged&&($.request("quarantine_optout",{sr:e}),$.redirect("/"))}}function friend(e,t,n){return function(){r.config.logged&&(encoded=encodeURIComponent(document.referrer),$.request("friend?note="+encoded,{name:e,container:t,type:n}))}}function unfriend(e,t,n){return function(){$.request("unfriend",{name:e,container:t,type:n})}}function reject_promo(e){$(e).thing().find(".rejection-form").show().find("textare").focus()}function cancel_reject_promo(e){$(e).thing().find(".rejection-form").hide()}function complete_reject_promo(e){var t=$(e);t.thing().removeClass("accepted").addClass("rejected").find(".reject_promo").remove(),t.data("hide-after-seen")&&hide_thing(e)}function helpon(e){$(e).parents(".usertext-edit:first").children(".markhelp:first").show()}function helpoff(e){$(e).parents(".usertext-edit:first"
).children(".markhelp:first").hide()}function show_all_messages(e){var t=$(e).parents(".message"),n=t.find(".message"),r=t.add(n),i=[];return _.each(r,function(e){var t=$(e),n=t.find(".expand:first"),r=t.hasClass("collapsed");r&&(t.toggleClass("collapsed noncollapsed"),n.text("[-]"),i.push(t.thing_id()))}),i.length&&$.request("uncollapse_message",{id:i.join(",")}),!1}function hide_all_messages(e){var t=$(e).parents(".message"),n=t.find(".message"),r=t.add(n),i=[];return _.each(r,function(e){var t=$(e),n=t.find(".expand:first"),r=t.hasClass("collapsed");r||(t.toggleClass("collapsed noncollapsed"),n.text("[+]"),i.push(t.thing_id()))}),i.length&&$.request("collapse_message",{id:i.join(",")}),!1}function togglecomment(e){var t=$(e).thing(),n=t.find(".expand:first"),r=t.hasClass("collapsed");t.toggleClass("collapsed noncollapsed"),r?n.text("[–]"):n.text("[+]")}function toggleSrQuarantine(e){var t=$(".quarantine-tool"),n=t.find(".expand:first"),r=t.hasClass("collapsed");t.toggleClass("collapsed noncollapsed"),r?n.text("[–]"):n.text("[+]")}function togglemessage(e){var t=$(e).thing(),n=t.find(".expand:first"),r=t.hasClass("collapsed");t.toggleClass("collapsed noncollapsed"),r?(n.text("[–]"),$.request("uncollapse_message",{id:$(t).thing_id()})):(n.text("[+]"),$.request("collapse_message",{id:$(t).thing_id()}))}function morechildren(e,t,n,i,s){$(e).html(r.config.status_msg.loading).css("color","red");var o=$(e).parents(".thing.morechildren:first").thing_id(),u={link_id:t,sort:n,children:i,depth:s,id:o};return $.request("morechildren",u,undefined,undefined,undefined,!1),!1}function moremessages(e){return $(e).html(r.config.status_msg.loading).css("color","red"),$.request("moremessages",{parent_id:$(e).thing_id()}),!1}function add_thing_to_cookie(e,t){var n=$(e).thing_id();if(n&&n.length)return add_thing_id_to_cookie(n,t)}function add_thing_id_to_cookie(e,t){var n=$.cookie_read(t);n.data||(n.data="");if(n.data.substring(0,e.length)==e)return;n.data=e+","+n.data;var r=n.data.split(",");r.length>5&&(r=$.uniq(r,5),n.data=r.join(",")),$.cookie_write(n)}function clicked_items(){var e=$.cookie_read("recentclicks2");if(e&&e.data){var t=e.data.split(",");for(var n=t.length-1;n>=0;n--)(!t[n]||!t[n].length)&&t.splice(n,1);return t}return[]}function clear_clicked_items(){var e=$.cookie_read("recentclicks2");e.data="",$.cookie_write(e),$(".gadget").remove()}function updateEventHandlers(e){e=$(e);var t=e.parent();$(e).filter(".link").find("a.title, a.comments").mousedown(function(){add_thing_to_cookie(this,"recentclicks2")}),t.filter(".organic-listing").length&&(e.find(".hide-button a, .del-button a.yes, .report-button a.yes").each(function(){$(this).get(0).onclick=null}),e.find(".hide-button a").click(function(){var e=$(this).get(0);change_state(e,"hide",function(){r.spotlight.next()})}),e.find(".del-button a.yes").click(function(){var e=$(this).get(0);change_state(e,"del",function(){r.spotlight.next()})}),e.find(".report-button a.yes").click(function(){var e=$(this).get(0);change_state(e,"report",function(){r.spotlight.next()})}))}function last_click(){var e=r.analytics.breadcrumbs.lastClickFullname();e&&$("body").hasClass("listing-page")&&($(".last-clicked").removeClass("last-clicked"),$(".id-"+e).last().addClass("last-clicked"))}function login(e){return post_user(this,"login")}function register(e){return post_user(this,"register")}function fetch_title(){var e=$("#url-field"),t=e.find(".NO_URL"),n=e.find(".title-status"),i=$("#url").val();if(i){if($('form#newlink textarea[name="title"]').val()&&!confirm("This will replace your existing title, proceed?"))return;n.show().text(r.config.status_msg.loading),t.hide(),$.request("fetch_title",{url:i})}else n.hide(),t.show().text("a url is required")}function sr_cache(){return $.defined(r.config.sr_cache)||(r.config.sr_cache=new Array),r.config.sr_cache}function highlight_reddit(e){$("#sr-drop-down").children(".sr-selected").removeClass("sr-selected"),e&&$(e).addClass("sr-selected")}function update_dropdown(e){var t=$("#sr-drop-down");if(!e.length){t.hide();return}var n=t.children(":first");n.removeClass("sr-selected"),t.children().remove(),$.each(e,function(r){if(r>10)return;var i=e[r],s=n.clone();s.text(i),t.append(s)});var r=$("#sr-autocomplete").outerHeight();t.css("top",r),t.show()}function sr_search(e){e=e.toLowerCase();var t=sr_cache();t[e]?update_dropdown(t[e]):$.request("search_reddit_names.json",{query:e,include_over_18:r.config.over_18},function(n){t[e]=n.names,update_dropdown(n.names)})}function sr_name_up(e){var t=$("#sr-autocomplete").val(),n=window.old_sr_name||"";window.old_sr_name=t,t==""?hide_sr_name_list():e.keyCode!=38&&e.keyCode!=40&&e.keyCode!=9&&(e.keyCode==27&&r.config.orig_sr?($("#sr-autocomplete").val(r.config.orig_sr),hide_sr_name_list()):t!=n&&(r.config.orig_sr=t,sr_search($("#sr-autocomplete").val())))}function sr_name_down(e){var t=$("#sr-autocomplete");if(e.keyCode==38||e.keyCode==40){var n=e.keyCode==38&&"up"||"down",i=$("#sr-drop-down .sr-selected:first"),s=$("#sr-drop-down .sr-name-row:first"),o=$("#sr-drop-down .sr-name-row:last"),u=null;return n=="down"?i.length?i.get(0)==o.get(0)?u=null:u=i.next(":first"):u=s:i.length?i.get(0)==s.get(0)?u=null:u=i.prev(":first"):u=o,highlight_reddit(u),u?t.val($.trim(u.text())):t.val(r.config.orig_sr),!1}if(e.keyCode==13)return $("#sr-autocomplete").trigger("sr-changed"),hide_sr_name_list(),t.parents("form").submit(),!1}function hide_sr_name_list(e){$("#sr-drop-down").hide()}function sr_dropdown_mdown(e){return r.config.sr_mouse_row=e,!1}function sr_dropdown_mup(e){if(r.config.sr_mouse_row==e){var t=$(e).text();$("#sr-autocomplete").val(t),$("#sr-drop-down").hide(),$("#sr-autocomplete").trigger("sr-changed")}}function set_sr_name(e){var t=$(e).text();$("#sr-autocomplete").trigger("focus").val(t),$("#sr-autocomplete").trigger("sr-changed")}function select_form_tab(e,t,n){var r=$(e).parent();r.addClass("selected").siblings().removeClass("selected");var i=r.parent("ul").next(".formtabs-content");i.find(t).show().find(":input").removeAttr("disabled").end(),i.find(n).hide().find(":input").attr("disabled",!0)}function show_edit_usertext(e){var t=e.find(".usertext-edit"),n=e.find(".usertext-body"),r=t.find("div > textarea"),i=Math.max(n.children(".md").width(),500),s=Math.max(n.children(".md").height(),100);n.hide(),t.show(),r.css("width",""),r.css("height","");if(r.get(0).scrollHeight>r.height()){var o=Math.max(i-5,r.width());r.width(o),t.width(o);var u=Math.max(s,r.height());r.height(u)}e.find(".cancel, .save").show().end().find(".help-toggle").show().end(),r.focus()}function hide_edit_usertext(e){e.find(".usertext-edit").hide().end().find(".usertext-body").show().end().find(".cancel, .save").hide().end().find(".help-toggle").hide().end().find(".markhelp").hide().end()}function comment_reply_for_elem(e){e=$(e);var t=e.thing(),n=e.thing_id(),r=t.find(".child .usertext:first");if(!r.length||r.parent().thing_id()!=t.thing_id())r=$(".usertext.cloneable:first").clone(!0),e.new_thing_child(r),r.prop("thing_id").value=n,r.attr("id","commentreply_"+n),r.find(".error").hide();return r}function edit_usertext(e){var t=$(e).thing();t.find(".edit-usertext:first").parent("li").addBack().hide(),show_edit_usertext(t.find(".usertext:first"))}function cancel_usertext(e){var t=$(e);t.thing().find(".edit-usertext:first").parent("li").addBack().show(),hide_edit_usertext(t.closest(".usertext"))}function reply(e){if(r.access.isLinkRestricted(e))return;var t=comment_reply_for_elem(e),n=t.find("textarea");if(window.getSelection&&n.val().length==0){var i=window.getSelection(),s=$(i.focusNode).parents(".md").first(),o=$(i.anchorNode).parents(".md").first();if(s.length&&s.is(o)){var u=i.toString();u.length>0&&(u=u.replace(/^/gm,"> "),n.val(u+"\n\n"),n.scrollTop(n.scrollHeight))}}return show_edit_usertext(t),t.show(),t.find(".cancel").get(0).onclick=function(){t.hide()},$(e).thing().find(".showreplies:visible").click(),!1}function toggle_distinguish_span(e){var t=$(e).parents("form")[0];$(t).children().toggle()}function set_distinguish(e,t){t==="yes_sticky"&&($(e).parents("form").first().find('input[name="sticky"]').val("true"),t="yes"),change_state(e,"distinguish/"+t),$(e).children().toggle()}function toggle_clear_suggested_sort(e){var t=$(e).parents("form")[0];$(t).children().toggle()}function set_suggested_sort(e,t){$(e).parents("form").first().find('input[name="sort"]').val(t),change_state(e,"set_suggested_sort"),$(e).children().toggle()}function populate_click_gadget(){if($(".click-gadget").length){var e=clicked_items();e&&e.length&&(e=$.uniq(e,5),e.sort(),$.request("gadget/click/"+e.join(","),undefined,undefined,undefined,"json",!0))}}function fetch_parent(e,t,n){var i=$(e).thing(),s="";return $(e).css("color","red").html(r.config.status_msg.loading),$.getJSON(t,function(t){$.each(t,function(){this&&this.data.children&&$.each(this.data.children,function(){this.data.name==n&&(s=this.data.body_html)})}),s&&i.find(".md").first().before('<div class="parent rounded">'+$.unsafe(s)+"</div>"),$(e).parent("li").addBack().remove()}),!1}function big_mod_action(e,t){if(!e.hasClass("pressed")){e.addClass("pressed");var n=e.thing_id();d={id:n},e.siblings(".status-msg").hide(),t==-1?(d.spam=!1,$.request("remove",d,null,!0),e.siblings(".removed").show()):t==-2?($.request("remove",d,null,!0),e.siblings(".spammed").show()):t==1&&($.request("approve",d,null,!0),e.siblings(".approved").show())}return e.siblings(".pretty-button").removeClass("pressed"),!1}function big_mod_toggle(e,t,n){return e.toggleClass("pressed"),$.request(e.is(".pressed")?t:n,{id:e.thing_id()},null,!0),!1}$(function(){function t(){return toggle(this)}$("body").click(close_menus),$("body").set_thing_init(updateEventHandlers),"placeholder"in document.createElement("input")||$("textarea[placeholder], input[placeholder]").addClass("gray").each(function(){var e=$(this),t=e.attr("placeholder");e.val()==""&&e.val(t)}),$("textarea.gray, input.gray").focus(function(){$(this).attr("rows",7).filter(".gray").removeClass("gray").val("")}),r.config.logged&&$.cookie_name_prefix(r.config.logged),$.default_cookie_domain(r.config.cur_domain.split(":")[0]),$.default_cookie_security(r.config.https_forced),last_click(),$(window).on("pageshow",function(){last_click()}),$('#search input[name="q"]').focus(function(){$("#searchexpando").slideDown()}),$('#search input[name="restrict_sr"]').change(function(){store.safeSet("search.restrict_sr.checked",this.checked)}),$('#searchexpando input[name="restrict_sr"]').prop("checked",!!store.safeGet("search.restrict_sr.checked")),$("#search_showmore").click(function(e){$("#search_showmore").parent().hide(),$("#moresearchinfo").slideDown(),e.preventDefault()}),$("#moresearchinfo").prepend('<a href="#" id="search_hidemore">[-]</a>'),$("#search_hidemore").click(function(e){$("#search_showmore").parent().show(),$("#moresearchinfo").slideUp(),e.preventDefault()});var e=$('#search input[name="q"]').val();$(".search-result-listing").find(".search-title, .search-link, .search-subreddit-link, .search-result-body").highlight(e),$(".search-result-link").find("a.search-title, a.thumbnail").mousedown(function(){var e=$(this).closest("[data-fullname]").data("fullname");e&&add_thing_id_to_cookie(e,"recentclicks2")}),$("#shortlink-text").click(function(){$(this).select()}),$(".sr_style_toggle").change(function(){return $("#sr_style_throbber").html('<img src="'+r.utils.staticURL("throbber.gif")+'" />').css("display","inline-block"),post_form($(this).parent(),"set_sr_style_enabled")}),$(".reddit-themes .theme").click(function(){$("div.theme.selected").removeClass("selected"),$("input[name='enable_default_themes']").prop("checked",!0),$(this).hasClass("select-custom-theme")?$("#other_theme_selector").prop("checked",!0):$("input[name='theme_selector'][value='"+$(this).attr("id")+"']").prop("checked",!0),$(this).addClass("selected")}),$("body").delegate(".ajax-yn-button","submit",function(){var e=$(this).find('input[name="_op"]').val();return post_form(this,e),!1}).delegate(".ajax-yn-button .togglebutton","click",t).delegate(".ajax-yn-button .no","click",t).delegate(".ajax-yn-button .yes","click",function(){$(this).closest("form").submit()})}),!function(e,t,n){e.spotlight={_bindEvents:function(){this.$listing.off(".spotlight"),this.$listing.find(".arrow.prev").off(".spotlight"),this.$listing.find(".arrow.next").off(".spotlight"),n(document).off(".spotlight"),n(window).off(".spotlight"),this.$listing.on("click.spotlight",function(e){var t=n(e.target);t.is(".thumbnail, .title")&&(this.adWasClicked=!0)}.bind(this)),this.$listing.length&&(this.$listing.find(".arrow.prev").on("click.spotlight",this.prev),this.$listing.find(".arrow.next").on("click.spotlight",this.next)),this.showPromo&&("hidden"in document?n(document).on("visibilitychange.spotlight",this._requestOrSaveTimestamp.bind(this)):n(window).on("focus.spotlight blur.spotlight",this._requestOrSaveTimestamp.bind(this)))},setup:function(i,s,o,u){this.organics=[],this.lineup=[],this.adWasClicked=!1,this.interestProb=s,this.showPromo=o,this.srnames=u,this.loid=n.cookie("loid"),this.lastTabChangeTimestamp=Date.now(),this.MIN_PROMO_TIME=3e3,this.next=this._advance.bind(this,1),this.prev=this._advance.bind(this,-1),this.$listing=n(".organic-listing"),this.adBlockIsEnabled=n("#siteTable_organic").is(":hidden"),this.adBlockIsEnabled&&(this.showPromo=!1),this._bindEvents(),i.forEach(function(e){this.organics.push(e),this.lineup.push({fullname:e})},this),s&&this.lineup.push(".interestbar");var a,f=e.analytics.breadcrumbs.lastClickFullname(),l=n(f?".id-"+f:null);if(l.length&&this.$listing.has(l).length)e.debug("restoring spotlight selection to last click"),a={fullname:f};else{var c=this._isDocumentVisible()&&this.showPromo;a=this.chooseRandom(c)}this.lineup=t.chain(this.lineup).reject(function(e){return t.isEqual(a,e)}).shuffle().unshift(a).value(),this.lineup.pos=0,this._advance(0)},_requestOrSaveTimestamp:function(){this._isDocumentVisible()?this.requestNewPromo():this.lastTabChangeTimestamp=Date.now()},_isDocumentVisible:function(){return"hidden"in document?!document.hidden:document.hasFocus()},requestNewPromo:function(){var e=this.$listing.find(".promotedlink");if(!e.is(":visible"))return;if(this.adWasClicked)return;var t=e.next(".clearleft");if(this.adBlockIsEnabled||Date.now()-this.lastTabChangeTimestamp<this.MIN_PROMO_TIME)return;if(e.length&&e.offset().top<window.scrollY)return;var n=this.requestPromo({refresh:!0});n.then(function(r){if(!r||!r.length)return;var i=r.eq(0),s=i.data("fullname");e.length?(this.organics[this.lineup.pos]=s,this.lineup[this.lineup.pos]=n):(this.organics[this.lineup.pos+1]=s,this.lineup[this.lineup.pos+1]=n),i.hasClass("adsense-wrap")||(e.length?(e.add(t).remove(),r.show()):this.next()),this.$listing.hide().show()}.bind(this))},requestPromo:function(t){return t=t||{},n.ajax({type:"POST",url:"/api/request_promo",timeout:1e3,data:{srnames:this.srnames,r:e.config.post_site,loid:this.loid,is_refresh:t.refresh}}).pipe(function(e){var t=this.$listing.find(".promotedlink");if(e){this.showPromo&&n("#siteTable_organic").show("slow");var r=n(e);if(!r.hasClass("adsense-wrap"))r.hide().appendTo(this.$listing);else{var i=this.$listing.find(".promotedlink");i.remove(),r.appendTo(this.$listing)}return r}return!t.length&&!this.organics.length&&n("#siteTable_organic").hide(),!1}.bind(this))},chooseRandom:function(e){if(e)return this.requestPromo();if(Math.random()<this.interestProb)return".interestbar";var n=this.organics[t.random(this.organics.length)];return n?{fullname:n}:null},_materialize:function(t){if(!t||t instanceof n||t.promise)return t;var i;typeof t=="string"?i=t:t.campaign?i='[data-cid="'+t.campaign+'"]':i='[data-fullname="'+t.fullname+'"]';var s=this.$listing.find(i);if(s.length)return s;e.error("unable to locate spotlight item",i,t)},_advancePos:function(e){return(this.lineup.pos+e+this.lineup.length)%this.lineup.length},_materializePos:function(e){return this.lineup[e]=this._materialize(this.lineup[e])},_advance:function(e){var t=this.$listing.find(".nextprev"),r=this.$listing.find(".thing:visible"),i=this._advancePos(e),s=this._materializePos(i),o=setTimeout(function(){t.toggleClass("working",s.state&&s.state()=="pending")},200);this.lineup.pos=i;var u=n.when(s);u.always(function(n){clearTimeout(o);if(this.lineup.pos!=i)return;if(u.state()=="rejected"||!n){if(this.lineup.length>1){this._advance(e||1);return}this.$listing.hide();return}t.removeClass("working"),this.$listing.removeClass("loading");if(n){var s=n.css("background-color");s&&this.$listing.css("background-color",s)}r.hide(),n.show(),this.help(n),this.lineup.pos!=0&&(this._materializePos(this._advancePos(1)),this._materializePos(this._advancePos(-1)))}.bind(this))},help:function(t){var i=n("#spotlight-help");if(!i.length)return;n(function(){var n=i.data("HelpBubble");n||(n=new e.ui.Bubble({el:i.get(0)})),n.hide(function(){i.find(".help-section").hide(),t.hasClass("promoted")?i.find(".help-promoted").show():t.hasClass("interestbar")?i.find(".help-interestbar").show():t.hasClass("adsense-wrap")?i.find(".help-adserver").show():i.find(".help-organic").show()})})}}}(r,_,jQuery),!function(e,t,n){"use strict";e.r=e.r||{},r.adzerk={createSponsorshipAdFrame:function(e){var n=t("<iframe>");n.attr({id:"ad_sponsorship",src:"//"+r.config.media_domain+"/ads/display/300x250-companion",frameBorder:0,scrolling:"no"}),t(".side .sponsorshipbox").empty().append(n)}},t(e).on("message",function(e){e=e.originalEvent;if(!(new RegExp("^http(s)?:\\/\\/"+r.config.media_domain,"i")).test(e.origin))return;var t=e.data.split(":");t[0]=="ados.createAdFrame"&&r.adzerk.createSponsorshipAdFrame()})}(this,this.jQuery)}catch(err){r.sendError("Error running module","reddit-init.js",":",err.toString())};r.i18n.setPluralForms('(n != 1)');r.i18n.addMessages({"an error occurred (status: %(status)s)": [null, "an error occurred (status: %(status)s)"], "please wait a few seconds and try again.": [null, "please wait a few seconds and try again."], "unsave": [null, "unsave"], "deleted": [null, "deleted"]});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment