Skip to content

Instantly share code, notes, and snippets.

@dergachev
Created December 17, 2012 20:34
Show Gist options
  • Save dergachev/4321942 to your computer and use it in GitHub Desktop.
Save dergachev/4321942 to your computer and use it in GitHub Desktop.
Manual JS prettification of enterprisewiki.co. See http://news.ycombinator.com/item?id=4933049
// https://github.com/EightMedia/hammer.js/blob/master/hammer.js
function toId(t) {
return t.toLowerCase().replace(/[^a-z]/gi, "-").replace(/-+/gi, "-")
}
function toc() {
var t = $("#sidebar").html("");
$("h1,h2,h3").each(function() {
var e = $(this).clone(), n = $(this).offset().top;
"#" != e.html() && (e.is("h3") && e.html("‐ " + e.html()), t.append(e), e.on("click", function() {
$("body").animate({scrollTop: n}, 200)
}))
})
}
// https://github.com/EightMedia/hammer.js/blob/master/jquery.hammer.js
// http://code.google.com/p/rangyinputs/source/browse/trunk/jquery_plugin.js
// https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js
// ELASTIC
// possibly vaguely inspired by http://code.google.com/p/jquery-elastic/source/browse/trunk/jquery.elastic.source.js
$.fn.elastic = function(t) {
var e = {rows: 6,onHeightChange: function() {
}};
return t && $.extend(e, t), this.each(function() {
var t = $(this);
return t.data("elastic") ? t.data("elastic").update() : t.data("elastic", $.fn.elastic.newInstance(t, e)), t
})
},
$.fn.elastic.newInstance = function(t) {
function e() {
var e = t.val().replace(/&/g, "&amp;").replace(/ /g, "&nbsp;").replace(/<|>/g, "&gt;").replace(/\n/g, "<br />") + "&nbsp;";
if (e != n.html()) {
var i = n.show().width(t.width()).html(e).height();
n.hide();
var r = 1 + Math.ceil(i / a);
r >= s ? t.css("overflow", "auto").attr("rows", s) : o >= r ? t.css("overflow", "hidden").attr("rows", o) : t.css("overflow", "hidden").attr("rows", r)
}
}
if (t.is("textarea")) {
t.parent().find(".elastic-clone").remove();
for (var n =
$('<div class="elastic-clone"></div>')
.insertAfter(t)
.css({position: "absolute",display: "block","word-wrap": "break-word"}),
i = ["padding-top", "padding-right", "padding-bottom", "padding-left", "font-size", "line-height", "font-family", "font-weight"],
r = 0; i.length > r; r++)
n.css("" + i[r], t.css("" + i[r]));
var a = parseInt(t.css("line-height"), 10) || parseInt(t.css("font-size"), 10), o = parseInt(t.attr("rows"), 10), s = parseInt(t.attr("data-max-rows"), 999999999999);
return t.css("overflow", "hidden").on("keyup", e).on("change", e).on("paste", function() {
setTimeout(e, 100)
}), "none" !== t.css("display") && e(), {update: e,destroy: function() {
t.off("keyup"), t.off("paste")
}}
}
};
// END OF ELASTIC
// http://code.google.com/p/webapptools/source/browse/trunk/watools/crawler-ui/chrome/content/prettify/prettify.js?r=380
// -- the above minified links definitely includes http://code.google.com/p/google-code-prettify/source/browse/trunk/js-modules/prettify.js
// https://github.com/coreyti/showdown/blob/master/src/showdown.js
// https://github.com/coreyti/showdown/blob/master/src/extensions/table.js
// https://github.com/coreyti/showdown/blob/master/src/extensions/prettify.js
// https://github.com/coreyti/showdown/blob/master/src/extensions/github.js
// http://sharejs.org/channel/bcsocket.js
// http://sharejs.org/share/share.js
// for bcsocket source, see https://github.com/josephg/node-browserchannel/blob/master/lib/bcsocket.coffee
// for shareJs source, see https://github.com/josephg/ShareJS/blob/master/src/client/
// see http://sharejs.org/pad/pad.html#14b3gfm for a demo using share.js and bcsocket.js
// http://sharejs.org/share/textarea.js
$(function() {
var t = new Showdown.converter({extensions: ["prettify", "github", "table"]}),
e = $("#editor"),
n = $("#doc"),
i = $("#wiki-template").html(),
r = $("#sidebar"),
a = window.location.pathname.split("/")[2], o = function() {
return e.is(":visible") ? (e.hide(), n.css("visibility", "visible")) : (n.css("visibility", "hidden"), e.show()), !1
},
s = "",
c = function(i) {
var r = e.val();
if (!(1 > r.length || r == s)) {
s = r;
var a = t.makeHtml(r);
return n.html(a), toc(), prettyPrint(), e.elastic(), i.preventDefault(), !1
}
};
e.elastic(),
$(document).bind("keydown", "esc", o),
$(document).bind("keydown", "ctrl+e", o),
e.bind("keydown", "esc", o),
e.bind("keydown", "ctrl+e", o),
e.bind("keydown", "tab", function() {
var t = e.getSelection();
if (!t)
return !1;
if (1 > t.length)
e.insertText(" ", t.start, !0);
else {
var n = " " + t.text.replace(/\n/m, "\n ");
e.replaceSelectedText(n)
}
return !1
});
var h = 640 > $(window).width(), l = 1;
$(document.body).hammer(
{swipe: !0,drag: !0,css_hacks: !1,swipe_time: 1e3,swipe_min_distance: 100,transform: !1,tap: !1,tap_double: !1,hold: !1}
).bind("swipe", function(t) {
"left" == t.direction ? 1 == l ? (o(), l = 2) : 0 == l && (r.hide(), l = 1) : "right" == t.direction && (1 == l && h ? (r.show().one("click", function() {
r.hide(), l = 1
}), l = 0) : 2 == l && (o(), l = 1))
}), sharejs.open(a, "text", function(t, n) {
t ? (console.log(t), alert("An error has occurred, try refreshing!")) : (n.attach_textarea(e.get(0)), n.on("change", function() {
setTimeout(c, 100)
}), 1 > n.getText().length && (console.log("starting from template"), n.insert(0, i), e.val(i)), c())
})
});
// from http://enterprisewiki.co/bin/app.min.js
function Hammer(t,e,n){function i(t){return t.touches?t.touches.length:1}function r(t){if(t=t||window.event,P){for(var e,n=[],i=0,r=t.touches.length;r>i;i++)e=t.touches[i],n.push({x:e.pageX,y:e.pageY});return n}var a=document,o=a.body;return[{x:t.pageX||t.clientX+(a&&a.scrollLeft||o&&o.scrollLeft||0)-(a&&a.clientLeft||o&&a.clientLeft||0),y:t.pageY||t.clientY+(a&&a.scrollTop||o&&o.scrollTop||0)-(a&&a.clientTop||o&&a.clientTop||0)}]}function a(t,e){return 180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI}function o(t,e){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)}function s(t,e){if(2==t.length&&2==e.length){var n=o(t[0],t[1]),i=o(e[0],e[1]);return i/n}return 0}function c(t,e){if(2==t.length&&2==e.length){var n=a(t[1],t[0]),i=a(e[1],e[0]);return i-n}return 0}function h(t,e){e.touches=r(e.originalEvent),e.type=t,v(y["on"+t])&&y["on"+t].call(y,e)}function l(t){t=t||window.event,t.preventDefault?(t.preventDefault(),t.stopPropagation()):(t.returnValue=!1,t.cancelBubble=!0)}function u(){T={},N=!1,O=0,E=0,S=0,j=null}function f(n){function a(){T.start=r(n),I=(new Date).getTime(),O=i(n),N=!0,k=n;var e=t.getBoundingClientRect(),a=t.clientTop||document.body.clientTop||0,o=t.clientLeft||document.body.clientLeft||0,s=window.pageYOffset||t.scrollTop||document.body.scrollTop,c=window.pageXOffset||t.scrollLeft||document.body.scrollLeft;A={top:e.top+s-a,left:e.left+c-o},M=!0,X.hold(n)}var o;switch(n.type){case"mousedown":case"touchstart":o=i(n),D=1===o,2===o&&"drag"===j&&h("dragend",{originalEvent:n,direction:C,distance:E,angle:S}),a(),e.prevent_default&&l(n);break;case"mousemove":case"touchmove":if(o=i(n),!M&&1===o)return!1;M||2!==o||(D=!1,u(),a()),q=n,T.move=r(n),X.transform(n)||X.drag(n);break;case"mouseup":case"mouseout":case"touchcancel":case"touchend":var f=!0;if(M=!1,x=n,X.swipe(n),"drag"==j)h("dragend",{originalEvent:n,direction:C,distance:E,angle:S});else if("transform"==j){var p=T.center.x-T.startCenter.x,d=T.center.y-T.startCenter.y;h("transformend",{originalEvent:n,position:T.center,scale:s(T.start,T.move),rotation:c(T.start,T.move),distance:E,distanceX:p,distanceY:d}),1===i(n)&&(u(),a(),f=!1)}else D&&X.tap(k);_=j,h("release",{originalEvent:n,gesture:j,position:T.move||T.start}),f&&u()}}function p(e){d(t,e.relatedTarget)||f(e)}function d(t,e){if(!e&&window.event&&window.event.toElement&&(e=window.event.toElement),t===e)return!0;if(e)for(var n=e.parentNode;null!==n;){if(n===t)return!0;n=n.parentNode}return!1}function g(t,e){var n={};if(!e)return t;for(var i in t)n[i]=i in e?e[i]:t[i];return n}function v(t){return"[object Function]"==Object.prototype.toString.call(t)}function m(t,e,n){e=e.split(" ");for(var i=0,r=e.length;r>i;i++)t.addEventListener?t.addEventListener(e[i],n,!1):document.attachEvent&&t.attachEvent("on"+e[i],n)}function b(t,e,n){e=e.split(" ");for(var i=0,r=e.length;r>i;i++)t.removeEventListener?t.removeEventListener(e[i],n,!1):document.detachEvent&&t.detachEvent("on"+e[i],n)}var y=this,w={prevent_default:!1,css_hacks:!0,swipe:!0,swipe_time:200,swipe_min_distance:20,drag:!0,drag_vertical:!0,drag_horizontal:!0,drag_min_distance:20,transform:!0,scale_treshold:.1,rotation_treshold:15,tap:!0,tap_double:!0,tap_max_interval:300,tap_max_distance:10,tap_double_distance:20,hold:!0,hold_timeout:500};e=g(w,e),function(){if(!e.css_hacks)return!1;for(var n=["webkit","moz","ms","o",""],i={userSelect:"none",touchCallout:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"},r="",a=0;n.length>a;a++)for(var o in i)r=o,n[a]&&(r=n[a]+r.substring(0,1).toUpperCase()+r.substring(1)),t.style[r]=i[o]}();var k,q,x,E=0,S=0,C=0,T={},O=0,N=!1,j=null,_=null,I=null,R={x:0,y:0},$=null,L=null,A={},M=!1,P="ontouchstart"in window,D=!1;this.option=function(t,i){return i!==n&&(e[t]=i),e[t]},this.getDirectionFromAngle=function(t){var e,n,i={down:t>=45&&135>t,left:t>=135||-135>=t,up:-45>t&&t>-135,right:t>=-45&&45>=t};for(n in i)if(i[n]){e=n;break}return e},this.destroy=function(){P?b(t,"touchstart touchmove touchend touchcancel",f):(b(t,"mouseup mousedown mousemove",f),b(t,"mouseout",p))};var X={hold:function(t){e.hold&&(j="hold",clearTimeout(L),L=setTimeout(function(){"hold"==j&&h("hold",{originalEvent:t,position:T.start})},e.hold_timeout))},swipe:function(t){if(T.move&&"transform"!==j){var n=T.move[0].x-T.start[0].x,i=T.move[0].y-T.start[0].y;E=Math.sqrt(n*n+i*i);var r=(new Date).getTime(),o=r-I;if(e.swipe&&e.swipe_time>o&&E>e.swipe_min_distance){S=a(T.start[0],T.move[0]),C=y.getDirectionFromAngle(S),j="swipe";var s={x:T.move[0].x-A.left,y:T.move[0].y-A.top},c={originalEvent:t,position:s,direction:C,distance:E,distanceX:n,distanceY:i,angle:S};h("swipe",c)}}},drag:function(t){var n=T.move[0].x-T.start[0].x,i=T.move[0].y-T.start[0].y;if(E=Math.sqrt(n*n+i*i),e.drag&&E>e.drag_min_distance||"drag"==j){S=a(T.start[0],T.move[0]),C=y.getDirectionFromAngle(S);var r="up"==C||"down"==C;if((r&&!e.drag_vertical||!r&&!e.drag_horizontal)&&E>e.drag_min_distance)return;j="drag";var o={x:T.move[0].x-A.left,y:T.move[0].y-A.top},s={originalEvent:t,position:o,direction:C,distance:E,distanceX:n,distanceY:i,angle:S};N&&(h("dragstart",s),N=!1),h("drag",s),l(t)}},transform:function(t){if(e.transform){var n=i(t);if(2!==n)return!1;var r=c(T.start,T.move),a=s(T.start,T.move);if("transform"===j||Math.abs(1-a)>e.scale_treshold||Math.abs(r)>e.rotation_treshold){j="transform",T.center={x:(T.move[0].x+T.move[1].x)/2-A.left,y:(T.move[0].y+T.move[1].y)/2-A.top},N&&(T.startCenter=T.center);var o=T.center.x-T.startCenter.x,u=T.center.y-T.startCenter.y;E=Math.sqrt(o*o+u*u);var f={originalEvent:t,position:T.center,scale:a,rotation:r,distance:E,distanceX:o,distanceY:u};return N&&(h("transformstart",f),N=!1),h("transform",f),l(t),!0}}return!1},tap:function(t){var n=(new Date).getTime(),i=n-I;if(!e.hold||e.hold&&e.hold_timeout>i){var r=function(){if(R&&e.tap_double&&"tap"==_&&T.start&&e.tap_max_interval>I-$){var t=Math.abs(R[0].x-T.start[0].x),n=Math.abs(R[0].y-T.start[0].y);return R&&T.start&&Math.max(t,n)<e.tap_double_distance}return!1}();if(r)j="double_tap",$=null,h("doubletap",{originalEvent:t,position:T.start}),l(t);else{var a=T.move?Math.abs(T.move[0].x-T.start[0].x):0,o=T.move?Math.abs(T.move[0].y-T.start[0].y):0;E=Math.max(a,o),e.tap_max_distance>E&&(j="tap",$=n,R=T.start,e.tap&&(h("tap",{originalEvent:t,position:T.start}),l(t)))}}}};P?m(t,"touchstart touchmove touchend touchcancel",f):(m(t,"mouseup mousedown mousemove",f),m(t,"mouseout",p))}function toId(t){return t.toLowerCase().replace(/[^a-z]/gi,"-").replace(/-+/gi,"-")}function toc(){var t=$("#sidebar").html("");$("h1,h2,h3").each(function(){var e=$(this).clone(),n=$(this).offset().top;"#"!=e.html()&&(e.is("h3")&&e.html("&dash; "+e.html()),t.append(e),e.on("click",function(){$("body").animate({scrollTop:n},200)}))})}jQuery.fn.hammer=function(t){return this.each(function(){var e=new Hammer(this,t),n=jQuery(this);n.data("hammer",e);for(var i=["hold","tap","doubletap","transformstart","transform","transformend","dragstart","drag","dragend","swipe","release"],r=0;i.length>r;r++)e["on"+i[r]]=function(t,e){return function(n){t.trigger(jQuery.Event(e,n))}}(n,i[r])})},function(t){function e(t,e){var n=typeof t[e];return"function"===n||!("object"!=n||!t[e])||"unknown"==n}function n(t,e){return typeof t[e]!=m}function i(t,e){return!("object"!=typeof t[e]||!t[e])}function r(t){window.console&&window.console.log&&window.console.log("TextInputs module for Rangy not supported in your browser. Reason: "+t)}function a(t,e,n){return 0>e&&(e+=t.value.length),typeof n==m&&(n=e),0>n&&(n+=t.value.length),{start:e,end:n}}function o(t,e,n){return{start:e,end:n,length:n-e,text:t.value.slice(e,n)}}function s(){return i(document,"body")?document.body:document.getElementsByTagName("body")[0]}var c,h,l,u,f,p,d,g,v,m="undefined";t(document).ready(function(){function m(t,e){return function(){var n=this.jquery?this[0]:this,i=n.nodeName.toLowerCase();if(1==n.nodeType&&("textarea"==i||"input"==i&&"text"==n.type)){var r=[n].concat(Array.prototype.slice.call(arguments)),a=t.apply(this,r);if(!e)return a}return e?this:void 0}}var b=document.createElement("textarea");if(s().appendChild(b),n(b,"selectionStart")&&n(b,"selectionEnd"))c=function(t){var e=t.selectionStart,n=t.selectionEnd;return o(t,e,n)},h=function(t,e,n){var i=a(t,e,n);t.selectionStart=i.start,t.selectionEnd=i.end},v=function(t,e){e?t.selectionEnd=t.selectionStart:t.selectionStart=t.selectionEnd};else{if(!(e(b,"createTextRange")&&i(document,"selection")&&e(document.selection,"createRange")))return s().removeChild(b),r("No means of finding text input caret position"),void 0;c=function(t){var e,n,i,r,a=0,s=0,c=document.selection.createRange();return c&&c.parentElement()==t&&(i=t.value.length,e=t.value.replace(/\r\n/g,"\n"),n=t.createTextRange(),n.moveToBookmark(c.getBookmark()),r=t.createTextRange(),r.collapse(!1),n.compareEndPoints("StartToEnd",r)>-1?a=s=i:(a=-n.moveStart("character",-i),a+=e.slice(0,a).split("\n").length-1,n.compareEndPoints("EndToEnd",r)>-1?s=i:(s=-n.moveEnd("character",-i),s+=e.slice(0,s).split("\n").length-1))),o(t,a,s)};var y=function(t,e){return e-(t.value.slice(0,e).split("\r\n").length-1)};h=function(t,e,n){var i=a(t,e,n),r=t.createTextRange(),o=y(t,i.start);r.collapse(!0),i.start==i.end?r.move("character",o):(r.moveEnd("character",y(t,i.end)),r.moveStart("character",o)),r.select()},v=function(t,e){var n=document.selection.createRange();n.collapse(e),n.select()}}s().removeChild(b),u=function(t,e,n,i){var r;e!=n&&(r=t.value,t.value=r.slice(0,e)+r.slice(n)),i&&h(t,e,e)},l=function(t){var e=c(t);u(t,e.start,e.end,!0)},g=function(t){var e,n=c(t);return n.start!=n.end&&(e=t.value,t.value=e.slice(0,n.start)+e.slice(n.end)),h(t,n.start,n.start),n.text},f=function(t,e,n,i){var r,a=t.value;t.value=a.slice(0,n)+e+a.slice(n),i&&(r=n+e.length,h(t,r,r))},p=function(t,e){var n=c(t),i=t.value;t.value=i.slice(0,n.start)+e+i.slice(n.end);var r=n.start+e.length;h(t,r,r)},d=function(t,e,n){var i=c(t),r=t.value;t.value=r.slice(0,i.start)+e+i.text+n+r.slice(i.end);var a=i.start+e.length,o=a+i.length;h(t,a,o)},t.fn.extend({getSelection:m(c,!1),setSelection:m(h,!0),collapseSelection:m(v,!0),deleteSelectedText:m(l,!0),deleteText:m(u,!0),extractSelectedText:m(g,!1),insertText:m(f,!0),replaceSelectedText:m(p,!0),surroundSelectedText:m(d,!0)})})}(jQuery),function(t){function e(e){if("string"==typeof e.data){var n=e.handler,i=e.data.toLowerCase().split(" ");e.handler=function(e){if(this===e.target||!/textarea|select/i.test(e.target.nodeName)&&"text"!==e.target.type){var r="keypress"!==e.type&&t.hotkeys.specialKeys[e.which],a=String.fromCharCode(e.which).toLowerCase(),o="",s={};e.altKey&&"alt"!==r&&(o+="alt+"),e.ctrlKey&&"ctrl"!==r&&(o+="ctrl+"),e.metaKey&&!e.ctrlKey&&"meta"!==r&&(o+="meta+"),e.shiftKey&&"shift"!==r&&(o+="shift+"),r?s[o+r]=!0:(s[o+a]=!0,s[o+t.hotkeys.shiftNums[a]]=!0,"shift+"===o&&(s[t.hotkeys.shiftNums[a]]=!0));for(var c=0,h=i.length;h>c;c++)if(s[i[c]])return n.apply(this,arguments)}}}}t.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}},t.each(["keydown","keyup","keypress"],function(){t.event.special[this]={add:e}})}(jQuery),$.fn.elastic=function(t){var e={rows:6,onHeightChange:function(){}};return t&&$.extend(e,t),this.each(function(){var t=$(this);return t.data("elastic")?t.data("elastic").update():t.data("elastic",$.fn.elastic.newInstance(t,e)),t})},$.fn.elastic.newInstance=function(t){function e(){var e=t.val().replace(/&/g,"&amp;").replace(/ /g,"&nbsp;").replace(/<|>/g,"&gt;").replace(/\n/g,"<br />")+"&nbsp;";if(e!=n.html()){var i=n.show().width(t.width()).html(e).height();n.hide();var r=1+Math.ceil(i/a);r>=s?t.css("overflow","auto").attr("rows",s):o>=r?t.css("overflow","hidden").attr("rows",o):t.css("overflow","hidden").attr("rows",r)}}if(t.is("textarea")){t.parent().find(".elastic-clone").remove();for(var n=$('<div class="elastic-clone"></div>').insertAfter(t).css({position:"absolute",display:"block","word-wrap":"break-word"}),i=["padding-top","padding-right","padding-bottom","padding-left","font-size","line-height","font-family","font-weight"],r=0;i.length>r;r++)n.css(""+i[r],t.css(""+i[r]));var a=parseInt(t.css("line-height"),10)||parseInt(t.css("font-size"),10),o=parseInt(t.attr("rows"),10),s=parseInt(t.attr("data-max-rows"),999999999999);return t.css("overflow","hidden").on("keyup",e).on("change",e).on("paste",function(){setTimeout(e,100)}),"none"!==t.css("display")&&e(),{update:e,destroy:function(){t.off("keyup"),t.off("paste")}}}};var q=null;window.PR_SHOULD_USE_CONTINUATION=!0,function(){function t(t){function e(t){var e=t.charCodeAt(0);if(92!==e)return e;var n=t.charAt(1);return(e=u[n])?e:n>="0"&&"7">=n?parseInt(t.substring(1),8):"u"===n||"x"===n?parseInt(t.substring(2),16):t.charCodeAt(1)}function n(t){return 32>t?(16>t?"\\x0":"\\x")+t.toString(16):(t=String.fromCharCode(t),("\\"===t||"-"===t||"["===t||"]"===t)&&(t="\\"+t),t)}function i(t){for(var i=t.substring(1,t.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),t=[],r=[],a="^"===i[0],o=a?1:0,s=i.length;s>o;++o){var c=i[o];if(/\\[bdsw]/i.test(c))t.push(c);else{var h,c=e(c);s>o+2&&"-"===i[o+1]?(h=e(i[o+2]),o+=2):h=c,r.push([c,h]),65>h||c>122||(65>h||c>90||r.push([32|Math.max(65,c),32|Math.min(h,90)]),97>h||c>122||r.push([-33&Math.max(97,c),-33&Math.min(h,122)]))}}for(r.sort(function(t,e){return t[0]-e[0]||e[1]-t[1]}),i=[],c=[0/0,0/0],o=0;r.length>o;++o)s=r[o],s[0]<=c[1]+1?c[1]=Math.max(c[1],s[1]):i.push(c=s);for(r=["["],a&&r.push("^"),r.push.apply(r,t),o=0;i.length>o;++o)s=i[o],r.push(n(s[0])),s[1]>s[0]&&(s[1]+1>s[0]&&r.push("-"),r.push(n(s[1])));return r.push("]"),r.join("")}function r(t){for(var e=t.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),n=e.length,r=[],s=0,c=0;n>s;++s){var h=e[s];"("===h?++c:"\\"===h.charAt(0)&&(h=+h.substring(1))&&c>=h&&(r[h]=-1)}for(s=1;r.length>s;++s)-1===r[s]&&(r[s]=++a);for(c=s=0;n>s;++s)h=e[s],"("===h?(++c,void 0===r[c]&&(e[s]="(?:")):"\\"===h.charAt(0)&&(h=+h.substring(1))&&c>=h&&(e[s]="\\"+r[c]);for(c=s=0;n>s;++s)"^"===e[s]&&"^"!==e[s+1]&&(e[s]="");if(t.ignoreCase&&o)for(s=0;n>s;++s)h=e[s],t=h.charAt(0),h.length>=2&&"["===t?e[s]=i(h):"\\"!==t&&(e[s]=h.replace(/[A-Za-z]/g,function(t){return t=t.charCodeAt(0),"["+String.fromCharCode(-33&t,32|t)+"]"}));return e.join("")}for(var a=0,o=!1,s=!1,c=0,h=t.length;h>c;++c){var l=t[c];if(l.ignoreCase)s=!0;else if(/[a-z]/i.test(l.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){o=!0,s=!1;break}}for(var u={b:8,t:9,n:10,v:11,f:12,r:13},f=[],c=0,h=t.length;h>c;++c){if(l=t[c],l.global||l.multiline)throw Error(""+l);f.push("(?:"+r(l)+")")}return RegExp(f.join("|"),s?"gi":"g")}function e(t){function e(t){switch(t.nodeType){case 1:if(i.test(t.className))break;for(var n=t.firstChild;n;n=n.nextSibling)e(n);n=t.nodeName,("BR"===n||"LI"===n)&&(r[s]="\n",o[s<<1]=a++,o[1|s++<<1]=t);break;case 3:case 4:n=t.nodeValue,n.length&&(n=c?n.replace(/\r\n?/g,"\n"):n.replace(/[\t\n\r ]+/g," "),r[s]=n,o[s<<1]=a,a+=n.length,o[1|s++<<1]=t)}}var n,i=/(?:^|\s)nocode(?:\s|$)/,r=[],a=0,o=[],s=0;t.currentStyle?n=t.currentStyle.whiteSpace:window.getComputedStyle&&(n=document.defaultView.getComputedStyle(t,q).getPropertyValue("white-space"));var c=n&&"pre"===n.substring(0,3);return e(t),{a:r.join("").replace(/\n$/,""),c:o}}function n(t,e,n,i){e&&(t={a:e,d:t},n(t),i.push.apply(i,t.e))}function i(e,i){function r(t){for(var e=t.d,h=[e,"pln"],l=0,u=t.a.match(a)||[],f={},p=0,d=u.length;d>p;++p){var g,v=u[p],m=f[v],b=void 0;if("string"==typeof m)g=!1;else{var y=o[v.charAt(0)];if(y)b=v.match(y[1]),m=y[0];else{for(g=0;c>g;++g)if(y=i[g],b=v.match(y[1])){m=y[0];break}b||(m="pln")}!(g=m.length>=5&&"lang-"===m.substring(0,5))||b&&"string"==typeof b[1]||(g=!1,m="src"),g||(f[v]=m)}if(y=l,l+=v.length,g){g=b[1];var w=v.indexOf(g),k=w+g.length;b[2]&&(k=v.length-b[2].length,w=k-g.length),m=m.substring(5),n(e+y,v.substring(0,w),r,h),n(e+y+w,g,s(m,g),h),n(e+y+k,v.substring(k),r,h)}else h.push(e+y,m)}t.e=h}var a,o={};(function(){for(var n=e.concat(i),r=[],s={},c=0,h=n.length;h>c;++c){var l=n[c],u=l[3];if(u)for(var f=u.length;--f>=0;)o[u.charAt(f)]=l;l=l[1],u=""+l,s.hasOwnProperty(u)||(r.push(l),s[u]=q)}r.push(/[\S\s]/),a=t(r)})();var c=i.length;return r}function r(t){var e=[],n=[];t.tripleQuotedStrings?e.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):t.multiLineStrings?e.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,q,"'\"`"]):e.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]),t.verbatimStrings&&n.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var r=t.hashComments;return r&&(t.cStyleComments?(r>1?e.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):e.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),n.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):e.push(["com",/^#[^\n\r]*/,q,"#"])),t.cStyleComments&&(n.push(["com",/^\/\/[^\n\r]*/,q]),n.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q])),t.regexLiterals&&n.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]),(r=t.types)&&n.push(["typ",r]),t=(""+t.keywords).replace(/^ | $/g,""),t.length&&n.push(["kwd",RegExp("^(?:"+t.replace(/[\s,]+/g,"|")+")\\b"),q]),e.push(["pln",/^\s+/,q," \r\n  "]),n.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]),i(e,n)}function a(t,e){function n(t){switch(t.nodeType){case 1:if(a.test(t.className))break;if("BR"===t.nodeName)i(t),t.parentNode&&t.parentNode.removeChild(t);else for(t=t.firstChild;t;t=t.nextSibling)n(t);break;case 3:case 4:if(c){var e=t.nodeValue,r=e.match(o);if(r){var h=e.substring(0,r.index);t.nodeValue=h,(e=e.substring(r.index+r[0].length))&&t.parentNode.insertBefore(s.createTextNode(e),t.nextSibling),i(t),h||t.parentNode.removeChild(t)}}}}function i(t){function e(t,n){var i=n?t.cloneNode(!1):t,r=t.parentNode;if(r){var r=e(r,1),a=t.nextSibling;r.appendChild(i);for(var o=a;o;o=a)a=o.nextSibling,r.appendChild(o)}return i}for(;!t.nextSibling;)if(t=t.parentNode,!t)return;for(var n,t=e(t.nextSibling,0);(n=t.parentNode)&&1===n.nodeType;)t=n;h.push(t)}var r,a=/(?:^|\s)nocode(?:\s|$)/,o=/\r\n?|\n/,s=t.ownerDocument;t.currentStyle?r=t.currentStyle.whiteSpace:window.getComputedStyle&&(r=s.defaultView.getComputedStyle(t,q).getPropertyValue("white-space"));var c=r&&"pre"===r.substring(0,3);for(r=s.createElement("LI");t.firstChild;)r.appendChild(t.firstChild);for(var h=[r],l=0;h.length>l;++l)n(h[l]);e===(0|e)&&h[0].setAttribute("value",e);var u=s.createElement("OL");u.className="linenums";for(var f=Math.max(0,0|e-1)||0,l=0,p=h.length;p>l;++l)r=h[l],r.className="L"+(l+f)%10,r.firstChild||r.appendChild(s.createTextNode(" ")),u.appendChild(r);t.appendChild(u)}function o(t,e){for(var n=e.length;--n>=0;){var i=e[n];y.hasOwnProperty(i)?window.console&&console.warn("cannot override language handler %s",i):y[i]=t}}function s(t,e){return t&&y.hasOwnProperty(t)||(t=/^\s*</.test(e)?"default-markup":"default-code"),y[t]}function c(t){var n=t.g;try{var i=e(t.h),r=i.a;t.a=r,t.c=i.c,t.d=0,s(n,r)(t);var a=/\bMSIE\b/.test(navigator.userAgent),n=/\n/g,o=t.a,c=o.length,i=0,h=t.c,l=h.length,r=0,u=t.e,f=u.length,t=0;u[f]=c;var p,d;for(d=p=0;f>d;)u[d]!==u[d+2]?(u[p++]=u[d++],u[p++]=u[d++]):d+=2;for(f=p,d=p=0;f>d;){for(var g=u[d],v=u[d+1],m=d+2;f>=m+2&&u[m+1]===v;)m+=2;u[p++]=g,u[p++]=v,d=m}for(u.length=p;l>r;){var b,y=h[r+2]||c,w=u[t+2]||c,m=Math.min(y,w),k=h[r+1];if(1!==k.nodeType&&(b=o.substring(i,m))){a&&(b=b.replace(n,"\r")),k.nodeValue=b;var q=k.ownerDocument,x=q.createElement("SPAN");x.className=u[t+1];var E=k.parentNode;E.replaceChild(x,k),x.appendChild(k),y>i&&(h[r+1]=k=q.createTextNode(o.substring(m,y)),E.insertBefore(k,x.nextSibling))}i=m,i>=y&&(r+=2),i>=w&&(t+=2)}}catch(S){"console"in window&&console.log(S&&S.stack?S.stack:S)}}var h=["break,continue,do,else,for,if,return,while"],l=[[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],u=[l,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],f=[l,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],p=[f,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],l=[l,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],d=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],g=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],h=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],v=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,m=/\S/,b=r({keywords:[u,p,l,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+d,g,h],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),y={};o(b,["default-code"]),o(i([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),o(i([["pln",/^\s+/,q," \r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]),o(i([],[["atv",/^[\S\s]+/]]),["uq.val"]),o(r({keywords:u,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),o(r({keywords:"null,true,false"}),["json"]),o(r({keywords:p,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),o(r({keywords:f,cStyleComments:!0}),["java"]),o(r({keywords:h,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]),o(r({keywords:d,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]),o(r({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]),o(r({keywords:g,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]),o(r({keywords:l,cStyleComments:!0,regexLiterals:!0}),["js"]),o(r({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),o(i([],[["str",/^[\S\s]+/]]),["regex"]),window.prettyPrintOne=function(t,e,n){var i=document.createElement("PRE");return i.innerHTML=t,n&&a(i,n),c({g:e,i:n,h:i}),i.innerHTML},window.prettyPrint=function(t){function e(){for(var n=window.PR_SHOULD_USE_CONTINUATION?h.now()+250:1/0;i.length>u&&n>h.now();u++){var r=i[u],o=r.className;if(o.indexOf("prettyprint")>=0){var s,p,o=o.match(f);if(p=!o){p=r;for(var d=void 0,g=p.firstChild;g;g=g.nextSibling)var v=g.nodeType,d=1===v?d?p:g:3===v?m.test(g.nodeValue)?p:d:d;p=(s=d===p?void 0:d)&&"CODE"===s.tagName}for(p&&(o=s.className.match(f)),o&&(o=o[1]),p=!1,d=r.parentNode;d;d=d.parentNode)if(("pre"===d.tagName||"code"===d.tagName||"xmp"===d.tagName)&&d.className&&d.className.indexOf("prettyprint")>=0){p=!0;break}p||((p=(p=r.className.match(/\blinenums\b(?::(\d+))?/))?p[1]&&p[1].length?+p[1]:!0:!1)&&a(r,p),l={g:o,h:r,i:p},c(l))}}i.length>u?setTimeout(e,250):t&&t()}for(var n=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],i=[],r=0;n.length>r;++r)for(var o=0,s=n[r].length;s>o;++o)i.push(n[r][o]);var n=q,h=Date;h.now||(h={now:function(){return+new Date}});var l,u=0,f=/\blang(?:uage)?-([\w.]+)(?!\S)/;e()},window.PR={createSimpleLexer:i,registerLangHandler:o,sourceDecorator:r,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}}();var Showdown={extensions:{}},forEach=Showdown.forEach=function(t,e){if("function"==typeof t.forEach)t.forEach(e);else{var n,i=t.length;for(n=0;i>n;n++)e(t[n],n,t)}},stdExtName=function(t){return t.replace(/[_-]||\s/g,"").toLowerCase()};Showdown.converter=function(t){var e,n,i,r=0,a=[],o=[];if("undefind"!=typeof module&&"undefined"!=typeof exports&&"undefind"!=typeof require){var s=require("fs");if(s){var c=s.readdirSync((__dirname||".")+"/extensions").filter(function(t){return~t.indexOf(".js")}).map(function(t){return t.replace(/\.js$/,"")});Showdown.forEach(c,function(t){var e=stdExtName(t);Showdown.extensions[e]=require("./extensions/"+t)})}}if(this.makeHtml=function(t){return e={},n={},i=[],t=t.replace(/~/g,"~T"),t=t.replace(/\$/g,"~D"),t=t.replace(/\r\n/g,"\n"),t=t.replace(/\r/g,"\n"),t="\n\n"+t+"\n\n",t=P(t),t=t.replace(/^[ \t]+$/gm,""),Showdown.forEach(a,function(e){t=u(e,t)}),t=S(t),t=p(t),t=f(t),t=g(t),t=A(t),t=t.replace(/~D/g,"$$"),t=t.replace(/~T/g,"~"),Showdown.forEach(o,function(e){t=u(e,t)}),t},t&&t.extensions){var h=this;Showdown.forEach(t.extensions,function(t){if("string"==typeof t&&(t=Showdown.extensions[stdExtName(t)]),"function"!=typeof t)throw"Extension '"+t+"' could not be loaded. It was either not found or is not a valid extension.";Showdown.forEach(t(h),function(t){t.type?"language"===t.type||"lang"===t.type?a.push(t):("output"===t.type||"html"===t.type)&&o.push(t):o.push(t)})})}var l,u=function(t,e){if(t.regex){var n=RegExp(t.regex,"g");return e.replace(n,t.replace)}return t.filter?t.filter(e):void 0},f=function(t){return t+="~0",t=t.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|(?=~0))/gm,function(t,i,r,a,o){return i=i.toLowerCase(),e[i]=I(r),a?a+o:(o&&(n[i]=o.replace(/"/g,"&quot;")),"")}),t=t.replace(/~0/,"")},p=function(t){return t=t.replace(/\n/g,"\n\n"),t=t.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,d),t=t.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|style|section|header|footer|nav|article|aside)\b[^\r]*?<\/\2>[ \t]*(?=\n+)\n)/gm,d),t=t.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,d),t=t.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,d),t=t.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,d),t=t.replace(/\n\n/g,"\n")},d=function(t,e){var n=e;return n=n.replace(/\n\n/g,"\n"),n=n.replace(/^\n/,""),n=n.replace(/\n+$/g,""),n="\n\n~K"+(i.push(n)-1)+"K\n\n"},g=function(t){t=q(t);var e=C("<hr />");return t=t.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,e),t=t.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,e),t=t.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,e),t=x(t),t=E(t),t=j(t),t=p(t),t=_(t)},v=function(t){return t=T(t),t=m(t),t=R(t),t=w(t),t=b(t),t=$(t),t=I(t),t=N(t),t=t.replace(/ +\n/g," <br />\n")},m=function(t){var e=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;return t=t.replace(e,function(t){var e=t.replace(/(.)<\/?code>(?=.)/g,"$1`");return e=D(e,"\\`*_")})},b=function(t){return t=t.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,y),t=t.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,y),t=t.replace(/(\[([^\[\]]+)\])()()()()()/g,y)},y=function(t,i,r,a,o,s,c,h){void 0==h&&(h="");var l=i,u=r,f=a.toLowerCase(),p=o,d=h;if(""==p)if(""==f&&(f=u.toLowerCase().replace(/ ?\n/g," ")),p="#"+f,void 0!=e[f])p=e[f],void 0!=n[f]&&(d=n[f]);else{if(!(l.search(/\(\s*\)$/m)>-1))return l;p=""}p=D(p,"*_");var g='<a href="'+p+'"';return""!=d&&(d=d.replace(/"/g,"&quot;"),d=D(d,"*_"),g+=' title="'+d+'"'),g+=">"+u+"</a>"},w=function(t){return t=t.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,k),t=t.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,k)},k=function(t,i,r,a,o,s,c,h){var l=i,u=r,f=a.toLowerCase(),p=o,d=h;if(d||(d=""),""==p){if(""==f&&(f=u.toLowerCase().replace(/ ?\n/g," ")),p="#"+f,void 0==e[f])return l;p=e[f],void 0!=n[f]&&(d=n[f])}u=u.replace(/"/g,"&quot;"),p=D(p,"*_");var g='<img src="'+p+'" alt="'+u+'"';return d=d.replace(/"/g,"&quot;"),d=D(d,"*_"),g+=' title="'+d+'"',g+=" />"},q=function(t){function e(t){return t.replace(/[^\w]/g,"").toLowerCase()}return t=t.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(t,n){return C('<h1 id="'+e(n)+'">'+v(n)+"</h1>")}),t=t.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(t,n){return C('<h2 id="'+e(n)+'">'+v(n)+"</h2>")}),t=t.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(t,n,i){var r=n.length;return C("<h"+r+' id="'+e(i)+'">'+v(i)+"</h"+r+">")})},x=function(t){t+="~0";var e=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return r?t=t.replace(e,function(t,e,n){var i=e,r=n.search(/[*+-]/g)>-1?"ul":"ol";i=i.replace(/\n{2,}/g,"\n\n\n");var a=l(i);return a=a.replace(/\s+$/,""),a="<"+r+">"+a+"</"+r+">\n"}):(e=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,t=t.replace(e,function(t,e,n,i){var r=e,a=n,o=i.search(/[*+-]/g)>-1?"ul":"ol",a=a.replace(/\n{2,}/g,"\n\n\n"),s=l(a);return s=r+"<"+o+">\n"+s+"</"+o+">\n"})),t=t.replace(/~0/,"")};l=function(t){return r++,t=t.replace(/\n{2,}$/,"\n"),t+="~0",t=t.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,function(t,e,n,i,r){var a=r,o=e;
return o||a.search(/\n{2,}/)>-1?a=g(M(a)):(a=x(M(a)),a=a.replace(/\n$/,""),a=v(a)),"<li>"+a+"</li>\n"}),t=t.replace(/~0/g,""),r--,t};var E=function(t){return t+="~0",t=t.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(t,e,n){var i=e,r=n;return i=O(M(i)),i=P(i),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,""),i="<pre><code>"+i+"\n</code></pre>",C(i)+r}),t=t.replace(/~0/,"")},S=function(t){return t+="~0",t=t.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g,function(t,e,n){var i=e,r=n;return r=O(r),r=P(r),r=r.replace(/^\n+/g,""),r=r.replace(/\n+$/g,""),r="<pre><code"+(i?' class="'+i+'"':"")+">"+r+"\n</code></pre>",C(r)}),t=t.replace(/~0/,"")},C=function(t){return t=t.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(i.push(t)-1)+"K\n\n"},T=function(t){return t=t.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(t,e,n,i){var r=i;return r=r.replace(/^([ \t]*)/g,""),r=r.replace(/[ \t]*$/g,""),r=O(r),e+"<code>"+r+"</code>"})},O=function(t){return t=t.replace(/&/g,"&amp;"),t=t.replace(/</g,"&lt;"),t=t.replace(/>/g,"&gt;"),t=D(t,"*_{}[]\\",!1)},N=function(t){return t=t.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,"<strong>$2</strong>"),t=t.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,"<em>$2</em>")},j=function(t){return t=t.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(t,e){var n=e;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=g(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(t,e){var n=e;return n=n.replace(/^ /gm,"~0"),n=n.replace(/~0/g,"")}),C("<blockquote>\n"+n+"\n</blockquote>")})},_=function(t){t=t.replace(/^\n+/g,""),t=t.replace(/\n+$/g,"");for(var e=t.split(/\n{2,}/g),n=[],r=e.length,a=0;r>a;a++){var o=e[a];o.search(/~K(\d+)K/g)>=0?n.push(o):o.search(/\S/)>=0&&(o=v(o),o=o.replace(/^([ \t]*)/g,"<p>"),o+="</p>",n.push(o))}r=n.length;for(var a=0;r>a;a++)for(;n[a].search(/~K(\d+)K/)>=0;){var s=i[RegExp.$1];s=s.replace(/\$/g,"$$$$"),n[a]=n[a].replace(/~K\d+K/,s)}return n.join("\n\n")},I=function(t){return t=t.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&amp;"),t=t.replace(/<(?![a-z\/?\$!])/gi,"&lt;")},R=function(t){return t=t.replace(/\\(\\)/g,X),t=t.replace(/\\([`*_{}\[\]()>#+-.!])/g,X)},$=function(t){return t=t.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'<a href="$1">$1</a>'),t=t.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(t,e){return L(A(e))})},L=function(t){var e=[function(t){return"&#"+t.charCodeAt(0)+";"},function(t){return"&#x"+t.charCodeAt(0).toString(16)+";"},function(t){return t}];return t="mailto:"+t,t=t.replace(/./g,function(t){if("@"==t)t=e[Math.floor(2*Math.random())](t);else if(":"!=t){var n=Math.random();t=n>.9?e[2](t):n>.45?e[1](t):e[0](t)}return t}),t='<a href="'+t+'">'+t+"</a>",t=t.replace(/">.+:/g,'">')},A=function(t){return t=t.replace(/~E(\d+)E/g,function(t,e){var n=parseInt(e);return String.fromCharCode(n)})},M=function(t){return t=t.replace(/^(\t|[ ]{1,4})/gm,"~0"),t=t.replace(/~0/g,"")},P=function(t){return t=t.replace(/\t(?=\t)/g," "),t=t.replace(/\t/g,"~A~B"),t=t.replace(/~B(.+?)~A/g,function(t,e){for(var n=e,i=4-n.length%4,r=0;i>r;r++)n+=" ";return n}),t=t.replace(/~A/g," "),t=t.replace(/~B/g,"")},D=function(t,e,n){var i="(["+e.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(i="\\\\"+i);var r=RegExp(i,"g");return t=t.replace(r,X)},X=function(t,e){var n=e.charCodeAt(0);return"~E"+n+"E"}},"undefined"!=typeof module&&(module.exports=Showdown),"function"==typeof define&&define.amd&&define("showdown",function(){return Showdown}),function(){var t=function(t){var e,n={},i="text-align:left;";return n.th=function(t){if(""===t.trim())return"";var e=t.trim().replace(/ /g,"_").toLowerCase();return'<th id="'+e+'" style="'+i+'">'+t+"</th>"},n.td=function(e){return'<td style="'+i+'">'+t.makeHtml(e)+"</td>"},n.ths=function(){var t="",e=0,i=[].slice.apply(arguments);for(e;i.length>e;e+=1)t+=n.th(i[e])+"\n";return t},n.tds=function(){var t="",e=0,i=[].slice.apply(arguments);for(e;i.length>e;e+=1)t+=n.td(i[e])+"\n";return t},n.thead=function(){var t,e=[].slice.apply(arguments);return t="<thead>\n",t+="<tr>\n",t+=n.ths.apply(this,e),t+="</tr>\n",t+="</thead>\n"},n.tr=function(){var t,e=[].slice.apply(arguments);return t="<tr>\n",t+=n.tds.apply(this,e),t+="</tr>\n"},e=function(t){var e,i,r=0,a=t.split("\n"),o=[],s=[];for(r;a.length>r;r+=1){if(e=a[r],e.trim().match(/^[|]{1}.*[|]{1}$/)){if(e=e.trim(),o.push("<table>"),i=e.substring(1,e.length-1).split("|"),o.push(n.thead.apply(this,i)),e=a[++r],e.trim().match(/^[|]{1}[-=| ]+[|]{1}$/)){for(e=a[++r],o.push("<tbody>");e.trim().match(/^[|]{1}.*[|]{1}$/);)e=e.trim(),o.push(n.tr.apply(this,e.substring(1,e.length-1).split("|"))),e=a[++r];o.push("</tbody>"),o.push("</table>"),s.push(o.join("\n"));continue}e=a[--r]}s.push(e)}return s.join("\n")},[{type:"lang",filter:e}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.table=t),"undefined"!=typeof module&&(module.exports=t)}(),function(){var t=function(){return[{type:"output",filter:function(t){return t.replace(/(<pre>)?<code>/gi,function(t,e){return e?'<pre class="prettyprint linenums" tabIndex="0"><code data-inner="1">':'<code class="prettyprint">'})}}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.prettify=t),"undefined"!=typeof module&&(module.exports=t)}(),function(){var t=function(){return[{type:"lang",regex:"(~T){2}([^~]+)(~T){2}",replace:function(t,e,n){return"<del>"+n+"</del>"}}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.github=t),"undefined"!=typeof module&&(module.exports=t)}(),function(){function g(t){throw t}function aa(){return function(){}}function p(t){return function(e){this[t]=e}}function ba(t){return function(){return this[t]}}function ca(t){return function(){return t}}function ea(t){for(var e,t=t.split("."),n=r;e=t.shift();){if(n[e]==k)return k;n=n[e]}return n}function fa(){}function ga(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&t.splice!==void 0&&t.propertyIsEnumerable!==void 0&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||t.call!==void 0&&t.propertyIsEnumerable!==void 0&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&t.call===void 0)return"object";return e}function s(t){return"array"==ga(t)}function ha(t){var e=ga(t);return"array"==e||"object"==e&&"number"==typeof t.length}function t(t){return"string"==typeof t}function ia(t){return t[ja]||(t[ja]=++ka)}function la(t){return t.call.apply(t.bind,arguments)}function ma(t,e){if(t||g(Error()),arguments.length>2){var n=Array.prototype.slice.call(arguments,2);return function(){var i=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(i,n),t.apply(e,i)}}return function(){return t.apply(e,arguments)}}function u(){return u=Function.prototype.bind&&-1!=(""+Function.prototype.bind).indexOf("native code")?la:ma,u.apply(k,arguments)}function w(t,e){function n(){}n.prototype=e.prototype,t.za=e.prototype,t.prototype=new n}function na(t){this.stack=Error().stack||"",t&&(this.message=t+"")}function oa(t){for(var e=1;arguments.length>e;e++)var n=(arguments[e]+"").replace(/\$/g,"$$$$"),t=t.replace(/\%s/,n);return t}function qa(t){return t+="",pa.test(t)?t:encodeURIComponent(t)}function ra(t){return sa.test(t)?(-1!=t.indexOf("&")&&(t=t.replace(ta,"&amp;")),-1!=t.indexOf("<")&&(t=t.replace(ua,"&lt;")),-1!=t.indexOf(">")&&(t=t.replace(va,"&gt;")),-1!=t.indexOf('"')&&(t=t.replace(xa,"&quot;")),t):t}function ya(t,e){return e>t?-1:t>e?1:0}function za(t,e){e.unshift(t),na.call(this,oa.apply(k,e)),e.shift(),this.rc=t}function Aa(t){g(new za("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1)))}function Ca(t){var e,n=z;for(e in n)t.call(h,n[e],e,n)}function Da(t){var e,n=[],i=0;for(e in t)n[i++]=t[e];return n}function Ea(t){var e,n=[],i=0;for(e in t)n[i++]=e;return n}function Ga(t){for(var e,n,i=1;arguments.length>i;i++){n=arguments[i];for(e in n)t[e]=n[e];for(var r=0;Fa.length>r;r++)e=Fa[r],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function Ja(){return A.concat.apply(A,arguments)}function Ka(t){if(s(t))return Ja(t);for(var e=[],n=0,i=t.length;i>n;n++)e[n]=t[n];return e}function La(t){for(var e=1;arguments.length>e;e++){var n,i=arguments[e];if(s(i)||(n=ha(i))&&i.hasOwnProperty("callee"))t.push.apply(t,i);else if(n)for(var r=t.length,a=i.length,o=0;a>o;o++)t[r+o]=i[o];else t.push(i)}}function Ma(e){if("function"==typeof e.$)return e.$();if(t(e))return e.split("");if(ha(e)){for(var n=[],i=e.length,r=0;i>r;r++)n.push(e[r]);return n}return Da(e)}function B(e,n,i){if("function"==typeof e.forEach)e.forEach(n,i);else if(ha(e)||t(e))Ia(e,n,i);else{var r;if("function"==typeof e.ga)r=e.ga();else if("function"!=typeof e.$)if(ha(e)||t(e)){r=[];for(var a=e.length,o=0;a>o;o++)r.push(o)}else r=Ea(e);else r=h;for(var a=Ma(e),o=a.length,s=0;o>s;s++)n.call(i,a[s],r&&r[s],e)}}function Na(t){this.O={},this.j=[];var e=arguments.length;if(e>1){e%2&&g(Error("Uneven number of arguments"));for(var n=0;e>n;n+=2)this.set(arguments[n],arguments[n+1])}else if(t){t instanceof Na?(e=t.ga(),n=t.$()):(e=Ea(t),n=Da(t));for(var i=0;e.length>i;i++)this.set(e[i],n[i])}}function Oa(t){if(t.c!=t.j.length){for(var e=0,n=0;t.j.length>e;){var i=t.j[e];C(t.O,i)&&(t.j[n++]=i),e++}t.j.length=n}if(t.c!=t.j.length){for(var r={},n=e=0;t.j.length>e;)i=t.j[e],C(r,i)||(t.j[n++]=i,r[i]=1),e++;t.j.length=n}}function C(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D(t,e){var n;t instanceof D?(this.la(e==k?t.H:e),Pa(this,t.V),Qa(this,t.Da),Ra(this,t.L),Sa(this,t.ba),Ta(this,t.r),Ua(this,t.D.l()),Va(this,t.ra)):t&&(n=(t+"").match(Ba))?(this.la(!!e),Pa(this,n[1]||"",j),Qa(this,n[2]||"",j),Ra(this,n[3]||"",j),Sa(this,n[4]),Ta(this,n[5]||"",j),Ua(this,n[6]||"",j),Va(this,n[7]||"",j)):(this.la(!!e),this.D=new Wa(k,this,this.H))}function Pa(t,e,n){E(t),delete t.w,t.V=n?e?decodeURIComponent(e):"":e,t.V&&(t.V=t.V.replace(/:$/,""))}function Qa(t,e,n){E(t),delete t.w,t.Da=n?e?decodeURIComponent(e):"":e}function Ra(t,e,n){E(t),delete t.w,t.L=n?e?decodeURIComponent(e):"":e}function Sa(t,e){E(t),delete t.w,e?(e=Number(e),(isNaN(e)||0>e)&&g(Error("Bad port number "+e)),t.ba=e):t.ba=k}function Ta(t,e,n){E(t),delete t.w,t.r=n?e?decodeURIComponent(e):"":e}function Ua(t,e,n){E(t),delete t.w,e instanceof Wa?(t.D=e,t.D.kb=t,t.D.la(t.H)):(n||(e=Xa(e,cb)),t.D=new Wa(e,t,t.H))}function G(t,e,n){E(t),delete t.w,t.D.set(e,n)}function db(t,e,n){if(E(t),delete t.w,s(n)||(n=[n+""]),t=t.D,H(t),eb(t),e=I(t,e),t.K(e)){var i=t.g.get(e);s(i)?t.c-=i.length:t.c--}n.length>0&&(t.g.set(e,n),t.c+=n.length)}function Va(t,e,n){E(t),delete t.w,t.ra=n?e?decodeURIComponent(e):"":e}function J(t){return E(t),G(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^v()).toString(36)),t}function E(t){t.$b&&g(Error("Tried to modify a read-only Uri"))}function bb(t,e,n,i,r,a,o,s){return s=new D(k,s),t&&Pa(s,t),e&&Qa(s,e),n&&Ra(s,n),i&&Sa(s,i),r&&Ta(s,r),a&&Ua(s,a),o&&Va(s,o),s}function Xa(e,n){var i=k;return t(e)&&(i=e,fb.test(i)||(i=encodeURI(e)),i.search(n)>=0&&(i=i.replace(n,gb))),i}function gb(t){return t=t.charCodeAt(0),"%"+(15&t>>4).toString(16)+(15&t).toString(16)}function Wa(t,e,n){this.M=t||k,this.kb=e||k,this.H=!!n}function H(t){if(!t.g&&(t.g=new Na,t.c=0,t.M))for(var e=t.M.split("&"),n=0;e.length>n;n++){var i=e[n].indexOf("="),r=k,a=k;i>=0?(r=e[n].substring(0,i),a=e[n].substring(i+1)):r=e[n],r=decodeURIComponent(r.replace(/\+/g," ")),r=I(t,r),t.add(r,a?decodeURIComponent(a.replace(/\+/g," ")):"")}}function eb(t){delete t.ab,delete t.M,t.kb&&delete t.kb.w}function I(t,e){var n=e+"";return t.H&&(n=n.toLowerCase()),n}function hb(){}function jb(){}function kb(t){return(t=lb(t))?new ActiveXObject(t):new XMLHttpRequest}function mb(t){var e={};return lb(t)&&(e[0]=j,e[1]=j),e}function lb(t){if(!t.eb&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;e.length>n;n++){var i=e[n];try{return new ActiveXObject(i),t.eb=i}catch(r){}}g(Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed"))}return t.eb}function qb(){return r.navigator?r.navigator.userAgent:k}function N(t){var e;if(!(e=Eb[t])){e=0;for(var n=(xb+"").replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),i=(t+"").replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),r=Math.max(n.length,i.length),a=0;0==e&&r>a;a++){var o=n[a]||"",s=i[a]||"",c=RegExp("(\\d*)(\\D*)","g"),h=RegExp("(\\d*)(\\D*)","g");do{var l=c.exec(o)||["","",""],u=h.exec(s)||["","",""];if(0==l[0].length&&0==u[0].length)break;e=ya(0==l[1].length?0:parseInt(l[1],10),0==u[1].length?0:parseInt(u[1],10))||ya(0==l[2].length,0==u[2].length)||ya(l[2],u[2])}while(0==e)}e=Eb[t]=e>=0}return e}function Gb(){return Fb[9]||(Fb[9]=L&&document.documentMode&&document.documentMode>=9)}function Hb(){}function O(){}function Kb(){for(var t=0,e=arguments.length;e>t;++t){var n=arguments[t];ha(n)?Kb.apply(k,n):n&&"function"==typeof n.Ga&&n.Ga()}}function P(t,e){this.type=t,this.currentTarget=this.target=e}function Lb(t){return Lb[" "](t),t}function Mb(t,e){t&&this.La(t,e)}function Ob(t,e,n,i,a){if(e){if(s(e)){for(var o=0;e.length>o;o++)Ob(t,e[o],n,i,a);return k}var i=!!i,c=R;e in c||(c[e]={c:0,A:0}),c=c[e],i in c||(c[i]={c:0,A:0},c.c++);var h,c=c[i],l=ia(t);if(c.A++,c[l]){for(h=c[l],o=0;h.length>o;o++)if(c=h[o],c.wa==n&&c.cb==a){if(c.ja)break;return h[o].key}}else h=c[l]=[],c.c++;return o=Pb(),o.src=t,c=new Hb,c.La(n,o,t,e,i,a),n=c.key,o.key=n,h.push(c),Q[n]=c,z[l]||(z[l]=[]),z[l].push(c),t.addEventListener?(t==r||!t.rb)&&t.addEventListener(e,o,i):t.attachEvent(e in Nb?Nb[e]:Nb[e]="on"+e,o),n}g(Error("Invalid event type"))}function Pb(){var t=Qb,e=Jb?function(n){return t.call(e.src,e.key,n)}:function(n){return n=t.call(e.src,e.key,n),n?void 0:n};return e}function Rb(t,e,n,i,r){if(s(e))for(var a=0;e.length>a;a++)Rb(t,e[a],n,i,r);else if(i=!!i,a=R,t=e in a&&(a=a[e],i in a&&(a=a[i],t=ia(t),a[t]))?a[t]:k,t)for(a=0;t.length>a;a++)if(t[a].wa==n&&t[a].capture==i&&t[a].cb==r){Sb(t[a].key);break}}function Sb(t){if(!Q[t])return o;var e=Q[t];if(e.ja)return o;var n=e.src,i=e.type,a=e.Lb,s=e.capture;if(n.removeEventListener?(n==r||!n.rb)&&n.removeEventListener(i,a,s):n.detachEvent&&n.detachEvent(i in Nb?Nb[i]:Nb[i]="on"+i,a),n=ia(n),a=R[i][s][n],z[n]){var c=z[n],h=Ha(c,e);h>=0&&A.splice.call(c,h,1),0==c.length&&delete z[n]}return e.ja=j,a.Fb=j,Tb(i,s,n,a),delete Q[t],j}function Tb(t,e,n,i){if(!i.Ma&&i.Fb){for(var r=0,a=0;i.length>r;r++)i[r].ja?i[r].Lb.src=k:(r!=a&&(i[a]=i[r]),a++);i.length=a,i.Fb=o,0==a&&(delete R[t][e][n],R[t][e].c--,0==R[t][e].c&&(delete R[t][e],R[t].c--),0==R[t].c&&delete R[t])}}function Ub(t){var e,n=0,i=e==k;if(e=!!e,t==k)Ca(function(t){for(var r=t.length-1;r>=0;r--){var a=t[r];(i||e==a.capture)&&(Sb(a.key),n++)}});else if(t=ia(t),z[t])for(var t=z[t],r=t.length-1;r>=0;r--){var a=t[r];(i||e==a.capture)&&(Sb(a.key),n++)}}function Vb(t,e,n,i,r){var a=1,e=ia(e);if(t[e]){t.A--,t=t[e],t.Ma?t.Ma++:t.Ma=1;try{for(var s=t.length,c=0;s>c;c++){var h=t[c];h&&!h.ja&&(a&=Wb(h,r)!==o)}}finally{t.Ma--,Tb(n,i,e,t)}}return Boolean(a)}function Wb(t,e){var n=t.handleEvent(e);return t.pb&&Sb(t.key),n}function Qb(t,e){if(!Q[t])return j;var n=Q[t],i=n.type,r=R;if(!(i in r))return j;var a,s,r=r[i];if(!Jb){a=e||ea("window.event");var c=j in r,l=o in r;if(c){if(0>a.keyCode||a.returnValue!=h)return j;t:{var u=o;if(0==a.keyCode)try{a.keyCode=-1;break t}catch(f){u=j}(u||a.returnValue==h)&&(a.returnValue=j)}}u=new Mb,u.La(a,this),a=j;try{if(c){for(var p=[],d=u.currentTarget;d;d=d.parentNode)p.push(d);s=r[j],s.A=s.c;for(var g=p.length-1;!u.ia&&g>=0&&s.A;g--)u.currentTarget=p[g],a&=Vb(s,p[g],i,j,u);if(l)for(s=r[o],s.A=s.c,g=0;!u.ia&&p.length>g&&s.A;g++)u.currentTarget=p[g],a&=Vb(s,p[g],i,o,u)}else a=Wb(n,u)}finally{p&&(p.length=0),u.Ga()}return a}i=new Mb(e,this);try{a=Wb(n,i)}finally{i.Ga()}return a}function Xb(){}function Yb(t,e){this.sa=t||1,this.Ba=e||Zb,this.Xa=u(this.nc,this),this.ib=v()}function ac(t){this.e=t,this.j=[]}function S(t,e,n,i,r){this.h=t,this.a=e,this.X=n,this.B=i,this.ya=r||1,this.Aa=cc,this.ub=new ac(this),this.Oa=new Yb,this.Oa.setInterval(dc)}function ec(t,e){switch(t){case 0:return"Non-200 return code ("+e+")";case 1:return"XMLHTTP failure (no data)";case 2:return"HttpConnection timeout";default:return"Unknown error"}}function hc(t,e,n){t.Ca=1,t.S=J(e.l()),t.U=n,t.sb=j,ic(t,k)}function jc(t,e,n,i,r){t.Ca=1,t.S=J(e.l()),t.U=k,t.sb=n,r&&(t.Ob=o),ic(t,i)}function ic(t,e){t.ka=v(),kc(t),t.u=t.S.l(),db(t.u,"t",t.ya),t.Ea=0,t.p=t.h.$a(t.h.Sa()?e:k),Ob(t.p,"readystatechange",t.Sb,o,t);var n;if(t.t){n=t.t;var i,r={};for(i in n)r[i]=n[i];n=r}else n={};if(t.U?(t.ma="POST",n["Content-Type"]="application/x-www-form-urlencoded",t.p.send(t.u,t.ma,t.U,n)):(t.ma="GET",t.Ob&&!M&&(n.Connection="close"),t.p.send(t.u,t.ma,k,n)),r=t.U)for(n="",r=r.split("&"),i=0;r.length>i;i++){var a=r[i].split("=");if(a.length>1){var s=a[0],a=a[1],c=s.split("_");n+=c.length>=2&&"type"==c[1]?s+"="+a+"&":s+"=redacted&"}}else n=k;t.a.info("XMLHTTP REQ ("+t.B+") [attempt "+t.ya+"]: "+t.ma+"\n"+t.u+"\n"+n)}function pc(t,e,n){for(var i=j;!t.ea&&t.Ea<n.length;){var r=wc(t,n);if(r==gc){4==e&&(t.q=4,U(xc),i=o),qc(t.a,t.B,k,"[Incomplete Response]");break}if(r==fc){t.q=4,U(yc),qc(t.a,t.B,n,"[Invalid Chunk]"),i=o;break}qc(t.a,t.B,r,k),rc(t,r)}4==e&&0==n.length&&(t.q=1,U(zc),i=o),t.F=t.F&&i,i||(qc(t.a,t.B,n,"[Invalid Chunked Response]"),oc(t),uc(t))}function wc(t,e){var n=t.Ea,i=e.indexOf("\n",n);if(-1==i)return gc;if(n=Number(e.substring(n,i)),isNaN(n))return fc;if(i+=1,i+n>e.length)return gc;var r=e.substr(i,n);return t.Ea=i+n,r}function Ac(t,e){t.ka=v(),kc(t),t.G=new ActiveXObject("htmlfile");var n="",i="<html><body>";e&&(n=window.location.hostname,i+='<script>document.domain="'+n+'"</script>'),i+="</body></html>",t.G.open(),t.G.write(i),t.G.close(),t.G.parentWindow.m=u(t.hc,t),t.G.parentWindow.d=u(t.Kb,t,j),t.G.parentWindow.rpcClose=u(t.Kb,t,o),i=t.G.createElement("div"),t.G.parentWindow.document.body.appendChild(i),t.u=t.S.l(),G(t.u,"DOMAIN",n),G(t.u,"t",t.ya),i.innerHTML='<iframe src="'+t.u+'"></iframe>',t.a.info("TRIDENT REQ ("+t.B+") [ attempt "+t.ya+"]: GET\n"+t.u)}function kc(t){t.mb=v()+t.Aa,Cc(t,t.Aa)}function Cc(t,e){t.oa!=k&&g(Error("WatchDog timer not null")),t.oa=V(u(t.ic,t),e)}function mc(t){t.oa&&(r.clearTimeout(t.oa),t.oa=k)}function uc(t){!t.h.Ab()&&!t.ea&&t.h.ha(t)}function oc(t){t.Oa.stop();var e=t.ub;Ia(e.j,Sb),e.j.length=0,t.p&&(e=t.p,t.p=k,Rb(e,"readystatechange",t.Sb,o,t),e.abort()),t.G&&(t.G=k)}function rc(t,e){try{t.h.Hb(t,e)}catch(n){vc(t.a,n,"Error in httprequest callback")}}function Ec(a){return eval("("+a+")")}function Fc(){this.Qa=h}function Gc(t){var e=[];return Hc(new Fc,t,e),e.join("")}function Hc(t,e,n){switch(typeof e){case"string":Ic(e,n);break;case"number":n.push(isFinite(e)&&!isNaN(e)?e:"null");break;case"boolean":n.push(e);break;case"undefined":n.push("null");break;case"object":if(e==k){n.push("null");break}if(s(e)){var i=e.length;n.push("[");for(var r="",a=0;i>a;a++)n.push(r),r=e[a],Hc(t,t.Qa?t.Qa.call(e,a+"",r):r,n),r=",";n.push("]");break}n.push("{"),i="";for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(r=e[a],"function"!=typeof r&&(n.push(i),Ic(a,n),n.push(":"),Hc(t,t.Qa?t.Qa.call(e,a,r):r,n),i=","));n.push("}");break;case"function":break;default:g(Error("Unknown type: "+typeof e))}}function Ic(t,e){e.push('"',t.replace(Kc,function(t){if(t in Jc)return Jc[t];var e=t.charCodeAt(0),n="\\u";return 16>e?n+="000":256>e?n+="00":4096>e&&(n+="0"),Jc[t]=n+e.toString(16)}),'"')}function Lc(t){return Mc(t||arguments.callee.caller,[])}function Mc(t,e){var n=[];if(Ha(e,t)>=0)n.push("[...circular reference...]");else if(t&&50>e.length){n.push(Nc(t)+"(");for(var i=t.arguments,r=0;i.length>r;r++){r>0&&n.push(", ");var a;switch(a=i[r],typeof a){case"object":a=a?"object":"null";break;case"string":break;case"number":a+="";break;case"boolean":a=a?"true":"false";break;case"function":a=(a=Nc(a))?a:"[fn]";break;default:a=typeof a}a.length>40&&(a=a.substr(0,40)+"..."),n.push(a)}e.push(t),n.push(")\n");try{n.push(Mc(t.caller,e))}catch(o){n.push("[exception trying to get caller]\n")}}else t?n.push("[...long stack...]"):n.push("[end]");return n.join("")}function Nc(t){if(Oc[t])return Oc[t];if(t+="",!Oc[t]){var e=/function ([^\(]+)/.exec(t);Oc[t]=e?e[1]:"[Anonymous]"}return Oc[t]}function Pc(t,e,n,i,r){this.reset(t,e,n,i,r)}function W(t){this.bc=t}function Rc(t,e){this.name=t,this.value=e}function Xc(t){return t.va?t.va:t.Na?Xc(t.Na):(Aa("Root logger has no level set."),k)}function X(t,e){t.log(Wc,e,h)}function $c(t){Zc||(Zc=new W(""),Yc[""]=Zc,Zc.Pb(Vc));var e;if(!(e=Yc[t])){e=new W(t);var n=t.lastIndexOf("."),i=t.substr(n+1),n=$c(t.substr(0,n));n.Ya||(n.Ya={}),n.Ya[i]=e,e.Na=n,Yc[t]=e}return e}function ad(){this.o=$c("goog.net.BrowserChannel")}function qc(t,e,n,i){t.info("XMLHTTP TEXT ("+e+"): "+Bc(t,n)+(i?" "+i:""))}function bd(t,e){t.info(e)}function vc(t,e,n){t.I((n||"Exception")+e)}function Bc(t,e){if(!e||e==cd)return e;try{for(var n=Ec(e),i=0;n.length>i;i++)if(s(n[i])){var r=n[i];if(!(2>r.length)){var a=r[1];if(s(a)&&!(1>a.length)){var o=a[0];if("noop"!=o&&"stop"!=o)for(var c=1;a.length>c;c++)a[c]=""}}}return Gc(n)}catch(h){return t.info("Exception parsing expected JS array - probably was not JS"),e}}function dd(t){this.headers=new Na,this.pa=t||k}function fd(t,e){t.R=o,t.f&&(t.aa=j,t.f.abort(),t.aa=o),t.q=e,t.ua=5,gd(t),hd(t)}function gd(t){t.bb||(t.bb=j,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function id(t){if(t.R&&da!==void 0)if(t.Ua[1]&&4==T(t)&&2==nc(t))X(t.o,Y(t,"Local request error detected and ignored"));else if(t.Ka&&4==T(t))Zb.setTimeout(u(t.Gb,t),0);else if(t.dispatchEvent("readystatechange"),4==T(t)){X(t.o,Y(t,"Request complete")),t.R=o;var e,n=nc(t);t:switch(n){case 200:case 201:case 202:case 204:case 304:case 1223:e=j;break t;default:e=o}if(e||((n=0===n)&&(n=(t.hb+"").match(Ba)[1]||k,!n&&self.location&&(n=self.location.protocol,n=n.substr(0,n.length-1)),n=!ed.test(n?n.toLowerCase():"")),e=n),e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.ua=6;var i;try{i=T(t)>2?t.f.statusText:""}catch(r){X(t.o,"Can not get status: "+r.message),i=""}t.q=i+" ["+nc(t)+"]",gd(t)}hd(t)}}function hd(t,e){if(t.f){var n=t.f,i=t.Ua[0]?fa:k;t.f=k,t.Ua=k,t.ca&&(Zb.clearTimeout(t.ca),t.ca=k),e||t.dispatchEvent("ready");try{n.onreadystatechange=i}catch(r){t.o.I("Problem encountered resetting onreadystatechange: "+r.message)}}}function T(t){return t.f?t.f.readyState:0}function nc(t){try{return T(t)>2?t.f.status:-1}catch(e){return t.o.na("Can not get status: "+e.message),-1}}function lc(t){try{return t.f?t.f.responseText:""}catch(e){return X(t.o,"Can not get responseText: "+e.message),""}}function Y(t,e){return e+" ["+t.Cb+" "+t.hb+" "+nc(t)+"]"}function jd(){this.Mb=v()}function kd(t,e,n,i,a){if(bd(new ad,"TestLoadImageWithRetries: "+a),0==i)n(o);else{var s=a||0;i--,ld(t,e,function(a){a?n(j):r.setTimeout(function(){kd(t,e,n,i,s)},s)})}}function ld(t,e,n){var i=new ad;i.info("TestLoadImage: loading "+t);var a=new Image,s=k;createHandler=function(t,e){return function(){try{i.info("TestLoadImage: "+e),a.onload=k,a.onerror=k,a.onabort=k,a.ontimeout=k,r.clearTimeout(s),n(t)}catch(o){vc(i,o)}}},a.onload=createHandler(j,"loaded"),a.onerror=createHandler(o,"error"),a.onabort=createHandler(o,"abort"),a.ontimeout=createHandler(o,"timeout"),s=r.setTimeout(function(){a.ontimeout&&a.ontimeout()},e),a.src=t}function md(t,e){this.h=t,this.a=e}function pd(t){t.a.info("TestConnection: starting stage 2"),t.v=new S(t,t.a,h,h,h),t.v.W(t.t);var e=rd(t.h,t.N,t.r);if(U(sd),L){db(e,"TYPE","html");var n=t.v,t=Boolean(t.N);n.Ca=3,n.S=J(e.l()),Ac(n,t)}else db(e,"TYPE","xmlhttp"),jc(t.v,e,o,t.N,o)}function Dd(t){this.qb=t,this.b=Ed,this.s=[],this.P=[],this.a=new ad}function Fd(t,e){this.Eb=t,this.map=e}function Hd(t,e){P.call(this,"statevent",t),this.vc=e}function Id(t,e,n,i){P.call(this,"timingevent",t),this.size=e,this.uc=n,this.tc=i}function Kd(t){t.Y&&(t.Y.abort(),t.Y=k),t.k&&(t.k.cancel(),t.k=k),t.J&&(r.clearTimeout(t.J),t.J=k),Ld(t),t.n&&(t.n.cancel(),t.n=k),t.C&&(r.clearTimeout(t.C),t.C=k)}function Md(t){t.n||t.C||(t.C=V(u(t.Jb,t),0),t.T=0)}function Pd(t,e){var n,i;e?t.fa>6?(t.s=t.P.concat(t.s),t.P.length=0,n=t.xa-1,i=Nd(t)):(n=e.B,i=e.U):(n=t.xa++,i=Nd(t));var r=t.Ja.l();G(r,"SID",t.X),G(r,"RID",n),G(r,"AID",t.ta),Od(t,r),n=new S(t,t.a,t.X,n,t.T+1),n.W(t.t),n.setTimeout(Math.round(1e4)+Math.round(1e4*Math.random())),t.n=n,hc(n,r,i)}function Od(t,e){if(t.e){var n=t.e.getAdditionalParams(t);n&&B(n,function(t,n){G(e,n,t)})}}function Nd(t){var e,n=Math.min(t.s.length,1e3),i=["count="+n];t.fa>6&&n>0?(e=t.s[0].Eb,i.push("ofs="+e)):e=0;for(var r=0;n>r;r++){var a=t.s[r].Eb,o=t.s[r].map;6>=t.fa?a=r:a-=e;try{B(o,function(t,e){i.push("req"+a+"_"+e+"="+encodeURIComponent(t))})}catch(s){i.push("req"+a+"_type="+encodeURIComponent("_badmap")),t.e&&t.e.badMapError(t,o)}}return t.P=t.P.concat(t.s.splice(0,n)),i.join("&")}function Qd(t){t.k||t.J||(t.nb=1,t.J=V(u(t.Ib,t),0),t.da=0)}function Rd(t){return t.k||t.J?(t.a.I("Request already in progress"),o):t.da>=3?o:(t.a.info("Going to retry GET"),t.nb++,t.J=V(u(t.Ib,t),Sd(t,t.da)),t.da++,j)}function Jd(t){if(t.e){var e=t.e.okToMakeRequest(t);if(0!=e)return t.a.info("Handler returned error code from okToMakeRequest"),Z(t,e),o}return j}function xd(t,e,n){t.a.info("Test Connection Finished"),t.lb=t.Tb&&n,t.i=e.i,t.a.info("connectChannel_()"),t.Xb(Ed,0),t.Ja=nd(t,t.r),Md(t)}function td(t,e){t.a.info("Test Connection Failed"),t.i=e.i,Z(t,2)}function Ld(t){t.Z!=k&&(r.clearTimeout(t.Z),t.Z=k)}function Sd(t,e){var n=5e3+Math.floor(1e4*Math.random());return t.isActive()||(t.a.info("Inactive channel"),n*=2),n*=e}function Z(t,e){if(t.a.info("Error code "+e),2==e||9==e){var n=k;t.e&&(n=t.e.getNetworkTestImageUri(t));var i=u(t.mc,t);n||(n=new D("//www.google.com/images/cleardot.gif"),J(n)),ld(""+n,1e4,i)}else U(2);Td(t,e)}function Td(t,e){t.a.info("HttpChannel: error - "+e),t.b=0,t.e&&t.e.channelError(t,e),Ud(t),Kd(t)}function Ud(t){if(t.b=0,t.i=-1,t.e)if(0==t.P.length&&0==t.s.length)t.e.channelClosed(t);else{t.a.info("Number of undelivered maps, pending: "+t.P.length+", outgoing: "+t.s.length);var e=Ka(t.P),n=Ka(t.s);t.P.length=0,t.s.length=0,t.e.channelClosed(t,e,n)}}function nd(t,e){var n=zd(t,k,e);return t.a.info("GetForwardChannelUri: "+n),n}function rd(t,e,n){return e=zd(t,t.Sa()?e:k,n),t.a.info("GetBackChannelUri: "+e),e}function zd(t,e,n){var i=n instanceof D?n.l():new D(n,h);if(""!=i.L)e&&Ra(i,e+"."+i.L),Sa(i,i.ba);else var r=window.location,i=bb(r.protocol,k,e?e+"."+r.hostname:r.hostname,r.port,n);return t.qa&&B(t.qa,function(t,e){G(i,e,t)}),G(i,"VER",t.fa),Od(t,i),i}function V(t,e){return"function"!=ga(t)&&g(Error("Fn must not be null and must be a function")),r.setTimeout(function(){t()},e)}function U(t){Gd.dispatchEvent(new Hd(Gd,t))}function Vd(){}var h=void 0,j=!0,k=null,o=!1,q,da=da||{},r=this,ja="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ka=0,v=Date.now||function(){return+new Date};w(na,Error),na.prototype.name="CustomError";var pa=/^[a-zA-Z0-9\-_.!~*'()]*$/,ta=/&/g,ua=/</g,va=/>/g,xa=/\"/g,sa=/[&<>\"]/;w(za,na),za.prototype.name="AssertionError";var Ba=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),Fa="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),A=Array.prototype,Ha=A.indexOf?function(t,e,n){return A.indexOf.call(t,e,n)}:function(e,n,i){if(i=i==k?0:0>i?Math.max(0,e.length+i):i,t(e))return t(n)&&1==n.length?e.indexOf(n,i):-1;for(;e.length>i;i++)if(i in e&&e[i]===n)return i;return-1},Ia=A.forEach?function(t,e,n){A.forEach.call(t,e,n)}:function(e,n,i){for(var r=e.length,a=t(e)?e.split(""):e,o=0;r>o;o++)o in a&&n.call(i,a[o],o,e)};q=Na.prototype,q.c=0,q.Rb=0,q.$=function(){Oa(this);for(var t=[],e=0;this.j.length>e;e++)t.push(this.O[this.j[e]]);return t},q.ga=function(){return Oa(this),this.j.concat()},q.K=function(t){return C(this.O,t)},q.remove=function(t){return C(this.O,t)?(delete this.O[t],this.c--,this.Rb++,this.j.length>2*this.c&&Oa(this),j):o},q.get=function(t,e){return C(this.O,t)?this.O[t]:e},q.set=function(t,e){C(this.O,t)||(this.c++,this.j.push(t),this.Rb++),this.O[t]=e},q.l=function(){return new Na(this)},q=D.prototype,q.V="",q.Da="",q.L="",q.ba=k,q.r="",q.ra="",q.$b=o,q.H=o,q.toString=function(){if(this.w)return this.w;var e=[];this.V&&e.push(Xa(this.V,Ya),":"),this.L&&(e.push("//"),this.Da&&e.push(Xa(this.Da,Ya),"@"),e.push(t(this.L)?encodeURIComponent(this.L):k),this.ba!=k&&e.push(":",this.ba+"")),this.r&&(this.L&&"/"!=this.r.charAt(0)&&e.push("/"),e.push(Xa(this.r,"/"==this.r.charAt(0)?Za:$a)));var n=this.D+"";return n&&e.push("?",n),this.ra&&e.push("#",Xa(this.ra,ab)),this.w=e.join("")},q.l=function(){return bb(this.V,this.Da,this.L,this.ba,this.r,this.D.l(),this.ra,this.H)},q.la=function(t){return this.H=t,this.D&&this.D.la(t),this};var fb=/^[a-zA-Z0-9\-_.!~*'():\/;?]*$/,Ya=/[#\/\?@]/g,$a=/[\#\?:]/g,Za=/[\#\?]/g,cb=/[\#\?@]/g,ab=/#/g;q=Wa.prototype,q.g=k,q.c=k,q.add=function(t,e){if(H(this),eb(this),t=I(this,t),this.K(t)){var n=this.g.get(t);s(n)?n.push(e):this.g.set(t,[n,e])}else this.g.set(t,e);return this.c++,this},q.remove=function(t){if(H(this),t=I(this,t),this.g.K(t)){eb(this);var e=this.g.get(t);return s(e)?this.c-=e.length:this.c--,this.g.remove(t)}return o},q.K=function(t){return H(this),t=I(this,t),this.g.K(t)},q.ga=function(){H(this);for(var t=this.g.$(),e=this.g.ga(),n=[],i=0;e.length>i;i++){var r=t[i];if(s(r))for(var a=0;r.length>a;a++)n.push(e[i]);else n.push(e[i])}return n},q.$=function(t){if(H(this),t)if(t=I(this,t),this.K(t)){var e=this.g.get(t);if(s(e))return e;t=[],t.push(e)}else t=[];else for(var e=this.g.$(),t=[],n=0;e.length>n;n++){var i=e[n];s(i)?La(t,i):t.push(i)}return t},q.set=function(t,e){if(H(this),eb(this),t=I(this,t),this.K(t)){var n=this.g.get(t);s(n)?this.c-=n.length:this.c--}return this.g.set(t,e),this.c++,this},q.get=function(t,e){if(H(this),t=I(this,t),this.K(t)){var n=this.g.get(t);return s(n)?n[0]:n}return e},q.toString=function(){if(this.M)return this.M;if(!this.g)return"";for(var t=[],e=0,n=this.g.ga(),i=0;n.length>i;i++){var r=n[i],a=qa(r),r=this.g.get(r);if(s(r))for(var o=0;r.length>o;o++)e>0&&t.push("&"),t.push(a),""!==r[o]&&t.push("=",qa(r[o])),e++;else e>0&&t.push("&"),t.push(a),""!==r&&t.push("=",qa(r)),e++}return this.M=t.join("")},q.l=function(){var t=new Wa;return this.ab&&(t.ab=this.ab),this.M&&(t.M=this.M),this.g&&(t.g=this.g.l()),t},q.la=function(t){t&&!this.H&&(H(this),eb(this),B(this.g,function(t,e){var n=e.toLowerCase();e!=n&&(this.remove(e),this.add(n,t))},this)),this.H=t},hb.prototype.Fa=k;var ib;w(jb,hb),jb.prototype.eb=k,ib=new jb;var K,nb,ob,pb;pb=ob=nb=K=o;var rb;if(rb=qb()){var sb=r.navigator;K=0==rb.indexOf("Opera"),nb=!K&&-1!=rb.indexOf("MSIE"),ob=!K&&-1!=rb.indexOf("WebKit"),pb=!K&&!ob&&"Gecko"==sb.product}var tb=K,L=nb,ub=pb,M=ob,vb=r.navigator,wb=-1!=(vb&&vb.platform||"").indexOf("Mac"),xb;t:{var yb="",zb;if(tb&&r.opera)var Ab=r.opera.version,yb="function"==typeof Ab?Ab():Ab;else if(ub?zb=/rv\:([^\);]+)(\)|;)/:L?zb=/MSIE\s+([^\);]+)(\)|;)/:M&&(zb=/WebKit\/(\S+)/),zb)var Bb=zb.exec(qb()),yb=Bb?Bb[1]:"";if(L){var Cb,Db=r.document;if(Cb=Db?Db.documentMode:h,Cb>parseFloat(yb)){xb=Cb+"";break t}}xb=yb}var Eb={},Fb={},Ib=0;q=Hb.prototype,q.key=0,q.ja=o,q.pb=o,q.La=function(t,e,n,i,r,a){"function"==ga(t)?this.Bb=j:t&&t.handleEvent&&"function"==ga(t.handleEvent)?this.Bb=o:g(Error("Invalid listener argument")),this.wa=t,this.Lb=e,this.src=n,this.type=i,this.capture=!!r,this.cb=a,this.pb=o,this.key=++Ib,this.ja=o
},q.handleEvent=function(t){return this.Bb?this.wa.call(this.cb||this.src,t):this.wa.handleEvent.call(this.wa,t)},!L||Gb();var Jb=!L||Gb();L&&N("8"),!M||N("528"),ub&&N("1.9b")||L&&N("8")||tb&&N("9.5")||M&&N("528"),!ub||N("8"),O.prototype.tb=o,O.prototype.Ga=function(){this.tb||(this.tb=j,this.z())},O.prototype.z=function(){this.Wb&&Kb.apply(k,this.Wb)},w(P,O),P.prototype.z=function(){delete this.type,delete this.target,delete this.currentTarget},P.prototype.ia=o,P.prototype.Ra=j,Lb[" "]=fa,w(Mb,P),q=Mb.prototype,q.target=k,q.relatedTarget=k,q.offsetX=0,q.offsetY=0,q.clientX=0,q.clientY=0,q.screenX=0,q.screenY=0,q.button=0,q.keyCode=0,q.charCode=0,q.ctrlKey=o,q.altKey=o,q.shiftKey=o,q.metaKey=o,q.jc=o,q.vb=k,q.La=function(t,e){var n=this.type=t.type;P.call(this,n),this.target=t.target||t.srcElement,this.currentTarget=e;var i=t.relatedTarget;if(i){if(ub){var r;t:{try{Lb(i.nodeName),r=j;break t}catch(a){}r=o}r||(i=k)}}else"mouseover"==n?i=t.fromElement:"mouseout"==n&&(i=t.toElement);this.relatedTarget=i,this.offsetX=M||t.offsetX!==h?t.offsetX:t.layerX,this.offsetY=M||t.offsetY!==h?t.offsetY:t.layerY,this.clientX=t.clientX!==h?t.clientX:t.pageX,this.clientY=t.clientY!==h?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0,this.button=t.button,this.keyCode=t.keyCode||0,this.charCode=t.charCode||("keypress"==n?t.keyCode:0),this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.jc=wb?t.metaKey:t.ctrlKey,this.state=t.state,this.vb=t,delete this.Ra,delete this.ia},q.z=function(){Mb.za.z.call(this),this.relatedTarget=this.currentTarget=this.target=this.vb=k};var Q={},R={},z={},Nb={};w(Xb,O),q=Xb.prototype,q.rb=j,q.jb=k,q.addEventListener=function(t,e,n,i){Ob(this,t,e,n,i)},q.removeEventListener=function(t,e,n,i){Rb(this,t,e,n,i)},q.dispatchEvent=function(e){var n=e.type||e,i=R;if(n in i){if(t(e))e=new P(e,this);else if(e instanceof P)e.target=e.target||this;else{var r=e,e=new P(n,this);Ga(e,r)}var a,s,r=1,i=i[n],n=j in i;if(n){for(a=[],s=this;s;s=s.jb)a.push(s);s=i[j],s.A=s.c;for(var c=a.length-1;!e.ia&&c>=0&&s.A;c--)e.currentTarget=a[c],r&=Vb(s,a[c],e.type,j,e)&&e.Ra!=o}if(o in i)if(s=i[o],s.A=s.c,n)for(c=0;!e.ia&&a.length>c&&s.A;c++)e.currentTarget=a[c],r&=Vb(s,a[c],e.type,o,e)&&e.Ra!=o;else for(a=this;!e.ia&&a&&s.A;a=a.jb)e.currentTarget=a,r&=Vb(s,a,e.type,o,e)&&e.Ra!=o;e=Boolean(r)}else e=j;return e},q.z=function(){Xb.za.z.call(this),Ub(this),this.jb=k},w(Yb,Xb),Yb.prototype.enabled=o;var Zb=r.window;q=Yb.prototype,q.Q=k,q.setInterval=function(t){this.sa=t,this.Q&&this.enabled?(this.stop(),this.start()):this.Q&&this.stop()},q.nc=function(){if(this.enabled){var t=v()-this.ib;t>0&&.8*this.sa>t?this.Q=this.Ba.setTimeout(this.Xa,this.sa-t):(this.dispatchEvent($b),this.enabled&&(this.Q=this.Ba.setTimeout(this.Xa,this.sa),this.ib=v()))}},q.start=function(){this.enabled=j,this.Q||(this.Q=this.Ba.setTimeout(this.Xa,this.sa),this.ib=v())},q.stop=function(){this.enabled=o,this.Q&&(this.Ba.clearTimeout(this.Q),this.Q=k)},q.z=function(){Yb.za.z.call(this),this.stop(),delete this.Ba};var $b="tick";w(ac,O);var bc=[];ac.prototype.z=function(){ac.za.z.call(this),Ia(this.j,Sb),this.j.length=0},ac.prototype.handleEvent=function(){g(Error("EventHandler.handleEvent not implemented"))},q=S.prototype,q.t=k,q.F=o,q.oa=k,q.mb=k,q.ka=k,q.Ca=k,q.S=k,q.u=k,q.U=k,q.p=k,q.Ea=0,q.G=k,q.ma=k,q.q=k,q.i=-1,q.Ob=j,q.ea=o;var cc=45e3,dc=250,fc={},gc={};q=S.prototype,q.W=p("t"),q.setTimeout=p("Aa"),q.Sb=function(t){t=t.target;try{if(t==this.p)t:{var e=T(this.p);if(L||M&&!N("420+")){if(4>e)break t}else if(3>e||3==e&&!tb&&!lc(this.p))break t;mc(this);var n=nc(this.p);this.i=n;var i=lc(this.p);if(i||this.a.info("No response text for uri "+this.u+" status "+n),this.F=200==n,this.a.info("XMLHTTP RESP ("+this.B+") [ attempt "+this.ya+"]: "+this.ma+"\n"+this.u+"\n"+e+" "+n),this.F){if(4==e&&oc(this),this.sb){if(pc(this,e,i),tb&&3==e){var r=this.ub,a=this.Oa,c=this.kc,n=$b;for(s(n)||(bc[0]=n,n=bc),i=0;n.length>i;i++)r.j.push(Ob(a,n[i],c||r,o,r.e||r));this.Oa.start()}}else qc(this.a,this.B,i,k),rc(this,i);this.F&&!this.ea&&(4==e?this.h.ha(this):(this.F=o,kc(this)))}else 400==n&&i.indexOf("Unknown SID")>0?(this.q=3,U(sc)):(this.q=0,U(tc)),qc(this.a,this.B,i),oc(this),uc(this)}else this.a.na("Called back with an unexpected xmlhttp")}catch(h){this.a.info("Failed call to OnXmlHttpReadyStateChanged_"),this.p&&lc(this.p)?vc(this.a,h,"ResponseText: "+lc(this.p)):vc(this.a,h,"No response text")}finally{}},q.kc=function(){var t=T(this.p),e=lc(this.p);this.Ea<e.length&&(mc(this),pc(this,t,e),this.F&&4!=t&&kc(this))},q.hc=function(t){V(u(this.gc,this,t),0)},q.gc=function(t){if(!this.ea){var e=this.a;e.info("TRIDENT TEXT ("+this.B+"): "+Bc(e,t)),mc(this),rc(this,t),kc(this)}},q.Kb=function(t){V(u(this.fc,this,t),0)},q.fc=function(t){this.ea||(this.a.info("TRIDENT TEXT ("+this.B+"): "+t?"success":"failure"),mc(this),oc(this),this.F=t,this.h.ha(this))},q.Zb=function(){mc(this),this.h.ha(this)},q.cancel=function(){this.ea=j,mc(this),oc(this)},q.ic=function(){this.oa=k;var t=v();t-this.mb>=0?(this.F&&this.a.I("Received watchdog timeout even though request loaded successfully"),this.a.info("TIMEOUT: "+this.u),oc(this),this.q=2,U(Dc),uc(this)):(this.a.na("WatchDog timer called too early"),Cc(this,this.mb-t))},q.yb=ba("q");var Jc={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"," ":"\\u000b"},Kc=/\uffff/.test("ï¿¿")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,Oc={};Pc.prototype.lc=0,Pc.prototype.xb=k,Pc.prototype.wb=k;var Qc=0;Pc.prototype.reset=function(t,e,n,i,r){this.lc="number"==typeof r?r:Qc++,this.wc=i||v(),this.va=t,this.ac=e,this.qc=n,delete this.xb,delete this.wb},Pc.prototype.Pb=p("va"),W.prototype.Na=k,W.prototype.va=k,W.prototype.Ya=k,W.prototype.zb=k,Rc.prototype.toString=ba("name");var Sc=new Rc("SEVERE",1e3),Tc=new Rc("WARNING",900),Uc=new Rc("INFO",800),Vc=new Rc("CONFIG",700),Wc=new Rc("FINE",500);q=W.prototype,q.getParent=ba("Na"),q.Pb=p("va"),q.log=function(t,e,n){if(t.value>=Xc(this).value)for(t=this.Yb(t,e,n),e="log:"+t.ac,r.console&&(r.console.timeStamp?r.console.timeStamp(e):r.console.markTimeline&&r.console.markTimeline(e)),r.msWriteProfilerMark&&r.msWriteProfilerMark(e),e=this;e;){var n=e,i=t;if(n.zb)for(var a=0,o=h;o=n.zb[a];a++)o(i);e=e.getParent()}},q.Yb=function(e,n,i){var r=new Pc(e,n+"",this.bc);if(i){r.xb=i;var a,s=arguments.callee.caller;try{var c,h=ea("window.location.href");if(t(i))c={message:i,name:"Unknown error",lineNumber:"Not available",fileName:h,stack:"Not available"};else{var l,u,f=o;try{l=i.lineNumber||i.pc||"Not available"}catch(p){l="Not available",f=j}try{u=i.fileName||i.filename||i.sourceURL||h}catch(d){u="Not available",f=j}c=!f&&i.lineNumber&&i.fileName&&i.stack?i:{message:i.message,name:i.name,lineNumber:l,fileName:u,stack:i.stack||"Not available"}}a="Message: "+ra(c.message)+'\nUrl: <a href="view-source:'+c.fileName+'" target="_new">'+c.fileName+"</a>\nLine: "+c.lineNumber+"\n\nBrowser stack:\n"+ra(c.stack+"-> ")+"[end]\n\nJS stack traversal:\n"+ra(Lc(s)+"-> ")}catch(g){a="Exception trying to expose exception! You win, we lose. "+g}r.wb=a}return r},q.I=function(t,e){this.log(Sc,t,e)},q.na=function(t,e){this.log(Tc,t,e)},q.info=function(t,e){this.log(Uc,t,e)};var Yc={},Zc=k;ad.prototype.info=function(t){this.o.info(t)},ad.prototype.na=function(t){this.o.na(t)},ad.prototype.I=function(t){this.o.I(t)},w(dd,Xb),dd.prototype.o=$c("goog.net.XhrIo");var ed=/^https?$/i;q=dd.prototype,q.R=o,q.f=k,q.Ua=k,q.hb="",q.Cb="",q.ua=0,q.q="",q.bb=o,q.Ka=o,q.fb=o,q.aa=o,q.Ta=0,q.ca=k,q.Nb="",q.oc=o,q.send=function(t,e,n,i){this.f&&g(Error("[goog.net.XhrIo] Object is active with another request")),e=e?e.toUpperCase():"GET",this.hb=t,this.q="",this.ua=0,this.Cb=e,this.bb=o,this.R=j,this.f=this.pa?kb(this.pa):kb(ib),this.Ua=this.pa?this.pa.Fa||(this.pa.Fa=mb(this.pa)):ib.Fa||(ib.Fa=mb(ib)),this.f.onreadystatechange=u(this.Gb,this);try{X(this.o,Y(this,"Opening Xhr")),this.fb=j,this.f.open(e,t,j),this.fb=o}catch(r){return X(this.o,Y(this,"Error opening Xhr: "+r.message)),fd(this,r),void 0}var t=n||"",a=this.headers.l();i&&B(i,function(t,e){a.set(e,t)}),"POST"==e&&!a.K("Content-Type")&&a.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),B(a,function(t,e){this.f.setRequestHeader(e,t)},this),this.Nb&&(this.f.responseType=this.Nb),"withCredentials"in this.f&&(this.f.withCredentials=this.oc);try{this.ca&&(Zb.clearTimeout(this.ca),this.ca=k),this.Ta>0&&(X(this.o,Y(this,"Will abort after "+this.Ta+"ms if incomplete")),this.ca=Zb.setTimeout(u(this.Aa,this),this.Ta)),X(this.o,Y(this,"Sending request")),this.Ka=j,this.f.send(t),this.Ka=o}catch(s){X(this.o,Y(this,"Send error: "+s.message)),fd(this,s)}},q.Aa=function(){da!==void 0&&this.f&&(this.q="Timed out after "+this.Ta+"ms, aborting",this.ua=8,X(this.o,Y(this,this.q)),this.dispatchEvent("timeout"),this.abort(8))},q.abort=function(t){this.f&&this.R&&(X(this.o,Y(this,"Aborting")),this.R=o,this.aa=j,this.f.abort(),this.aa=o,this.ua=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),hd(this))},q.z=function(){this.f&&(this.R&&(this.R=o,this.aa=j,this.f.abort(),this.aa=o),hd(this,j)),dd.za.z.call(this)},q.Gb=function(){this.fb||this.Ka||this.aa?id(this):this.ec()},q.ec=function(){id(this)},q.isActive=function(){return!!this.f},q.yb=function(){return t(this.q)?this.q:this.q+""},new jd,jd.prototype.set=p("Mb"),jd.prototype.reset=function(){this.set(v())},jd.prototype.get=ba("Mb"),q=md.prototype,q.t=k,q.v=k,q.Pa=o,q.Qb=k,q.Ia=k,q.gb=k,q.r=k,q.b=k,q.i=-1,q.N=k,q.Wa=k,q.W=p("t"),q.Za=function(t){this.r=t,t=nd(this.h,this.r),U(od),db(t,"MODE","init"),this.v=new S(this,this.a,h,h,h),this.v.W(this.t),jc(this.v,t,o,k,j),this.b=0,this.Qb=v()},q.Vb=function(t){t?(this.b=2,pd(this)):(U(qd),t=this.h,t.a.info("Test Connection Blocked"),t.i=t.Y.i,Z(t,9))},q.$a=function(t){return this.h.$a(t)},q.abort=function(){this.v&&(this.v.cancel(),this.v=k),this.i=-1},q.Ab=ca(o),q.Hb=function(t,e){if(this.i=t.i,0==this.b)if(this.a.info("TestConnection: Got data for stage 1"),e){try{var n=Ec(e)}catch(i){return vc(this.a,i),td(this.h,this),void 0}this.N=this.h.correctHostPrefix(n[0]),this.Wa=n[1]}else this.a.info("TestConnection: Null responseText"),td(this.h,this);else 2==this.b&&(this.Pa?(U(ud),this.gb=v()):"11111"==e?(U(vd),this.Pa=j,this.Ia=v(),n=this.Ia-this.Qb,(!L||500>n)&&(this.i=200,this.v.cancel(),this.a.info("Test connection succeeded; using streaming connection"),U(wd),xd(this.h,this,j))):(U(yd),this.Ia=this.gb=v(),this.Pa=o))},q.ha=function(){if(this.i=this.v.i,this.v.F)if(0==this.b)if(this.a.info("TestConnection: request complete for initial check"),this.Wa){this.b=1;var t=zd(this.h,this.Wa,"/mail/images/cleardot.gif");J(t),kd(""+t,5e3,u(this.Vb,this),3,2e3)}else this.b=2,pd(this);else 2==this.b&&(this.a.info("TestConnection: request complete for stage 2"),t=o,(t=L?200>this.gb-this.Ia?o:j:this.Pa)?(this.a.info("Test connection succeeded; using streaming connection"),U(wd),xd(this.h,this,j)):(this.a.info("Test connection failed; not using streaming"),U(Ad),xd(this.h,this,o)));else this.a.info("TestConnection: request failed, in state "+this.b),0==this.b?U(Bd):2==this.b&&U(Cd),td(this.h,this)},q.Sa=function(){return this.h.Sa()},q.isActive=function(){return this.h.isActive()},q=Dd.prototype,q.t=k,q.qa=k,q.n=k,q.k=k,q.r=k,q.Ja=k,q.ob=k,q.N=k,q.Ub=j,q.xa=0,q.cc=0,q.Ha=o,q.e=k,q.C=k,q.J=k,q.Z=k,q.Y=k,q.lb=k,q.Tb=j,q.ta=-1,q.Db=-1,q.i=-1,q.T=0,q.da=0,q.fa=8;var Ed=1,Gd=new Xb;w(Hd,P),w(Id,P);var od=3,qd=4,sd=5,vd=6,ud=7,yd=8,Bd=9,Cd=10,Ad=11,wd=12,sc=13,tc=14,xc=15,yc=16,zc=17,Dc=18,cd="y2f%";q=Dd.prototype,q.Za=function(t,e,n,i,r){this.a.info("connect()"),U(0),this.r=e,this.qa=n||{},i&&r!==h&&(this.qa.OSID=i,this.qa.OAID=r),this.a.info("connectTest_()"),Jd(this)&&(this.Y=new md(this,this.a),this.Y.W(this.t),this.Y.Za(t))},q.W=p("t"),q.Ab=function(){return 0==this.b},q.Jb=function(t){if(this.C=k,this.a.info("startForwardChannel_"),Jd(this))if(this.b==Ed)if(t)this.a.I("Not supposed to retry the open");else{this.a.info("open_()"),this.xa=Math.floor(1e5*Math.random());var t=this.xa++,e=new S(this,this.a,"",t,h);e.W(this.t);var n=Nd(this),i=this.Ja.l();G(i,"RID",t),this.qb&&G(i,"CVER",this.qb),Od(this,i),hc(e,i,n),this.n=e,this.b=2}else 3==this.b&&(t?Pd(this,t):0==this.s.length?this.a.info("startForwardChannel_ returned: nothing to send"):this.n?this.a.I("startForwardChannel_ returned: connection already in progress"):(Pd(this),this.a.info("startForwardChannel_ finished, sent request")))},q.Ib=function(){if(this.J=k,Jd(this)){this.a.info("Creating new HttpRequest"),this.k=new S(this,this.a,this.X,"rpc",this.nb),this.k.W(this.t);var t=this.ob.l();if(G(t,"RID","rpc"),G(t,"SID",this.X),G(t,"CI",this.lb?"0":"1"),G(t,"AID",this.ta),Od(this,t),L){G(t,"TYPE","html");var e=this.k,n=Boolean(this.N);e.Ca=3,e.S=J(t.l()),Ac(e,n)}else G(t,"TYPE","xmlhttp"),jc(this.k,t,j,this.N,o);this.a.info("New Request created")}},q.Hb=function(t,e){if(0!=this.b&&(this.k==t||this.n==t))if(this.i=t.i,this.n==t&&3==this.b)if(this.fa>7){var n;try{n=Ec(e)}catch(i){n=k}if(s(n)&&3==n.length){var r=n;if(0==r[0])t:if(this.a.info("Server claims our backchannel is missing."),this.J)this.a.info("But we are currently starting the request.");else{if(this.k){if(!(this.k.ka+3e3<this.n.ka))break t;Ld(this),this.k.cancel(),this.k=k}else this.a.na("We do not have a BackChannel established");Rd(this),U(19)}else this.Db=r[1],n=this.Db-this.ta,n>0&&(r=r[2],this.a.info(r+" bytes (in "+n+" arrays) are outstanding on the BackChannel"),37500>r&&this.lb&&0==this.da&&!this.Z)&&(this.Z=V(u(this.dc,this),6e3))}else this.a.info("Bad POST response data returned"),Z(this,11)}else e!=cd&&(this.a.info("Bad data returned - missing/invald magic cookie"),Z(this,11));else if(this.k==t&&Ld(this),!/^[\s\xa0]*$/.test(e)){n=Ec(e);for(var r=this.e&&this.e.channelHandleMultipleArrays?[]:k,a=0;n.length>a;a++){var o=n[a];this.ta=o[0],o=o[1],2==this.b?"c"==o[0]?(this.X=o[1],this.N=this.correctHostPrefix(o[2]),o=o[3],this.fa=o!=k?o:6,this.b=3,this.e&&this.e.channelOpened(this),this.ob=rd(this,this.N,this.r),Qd(this)):"stop"==o[0]&&Z(this,7):3==this.b&&("stop"==o[0]?(r&&r.length&&(this.e.channelHandleMultipleArrays(this,r),r.length=0),Z(this,7)):"noop"!=o[0]&&(r?r.push(o):this.e&&this.e.channelHandleArray(this,o)),this.da=0)}r&&r.length&&this.e.channelHandleMultipleArrays(this,r)}},q.correctHostPrefix=function(t){return this.Ub?this.e?this.e.correctHostPrefix(t):t:k},q.dc=function(){this.Z!=k&&(this.Z=k,this.k.cancel(),this.k=k,Rd(this),U(20))},q.ha=function(t){this.a.info("Request complete");var e;if(this.k==t)Ld(this),this.k=k,e=2;else{if(this.n!=t)return;this.n=k,e=1}if(this.i=t.i,0!=this.b)if(t.F)1==e?(e=v()-t.ka,Gd.dispatchEvent(new Id(Gd,t.U?t.U.length:0,e,this.T)),Md(this),this.P.length=0):Qd(this);else{var n=t.yb();if(3==n||0==n&&this.i>0)this.a.info("Not retrying due to error type");else{this.a.info("Maybe retrying, last error: "+ec(n,this.i));var i;if((i=1==e)&&(this.n||this.C?(this.a.I("Request already in progress"),i=o):this.b==Ed||this.T>=(this.Ha?0:2)?i=o:(this.a.info("Going to retry POST"),this.C=V(u(this.Jb,this,t),Sd(this,this.T)),this.T++,i=j)),i)return;if(2==e&&Rd(this))return;this.a.info("Exceeded max number of retries")}switch(this.a.info("Error: HTTP request failed"),n){case 1:Z(this,5);break;case 4:Z(this,10);break;case 3:Z(this,6);break;default:Z(this,2)}}},q.Xb=function(){Ha(arguments,this.b)>=0||g(Error("Unexpected channel state: "+this.b))},q.mc=function(t){t?(this.a.info("Successfully pinged google.com"),U(2)):(this.a.info("Failed to ping google.com"),U(1),Td(this,8))},q.$a=function(t){return t?(g(Error("Can't create secondary domain capable XhrIo object.")),void 0):new dd},q.isActive=function(){return!!this.e&&this.e.isActive(this)},q.Sa=function(){return L},q=Vd.prototype,q.channelHandleMultipleArrays=k,q.okToMakeRequest=ca(0),q.channelOpened=aa(),q.channelHandleArray=aa(),q.channelError=aa(),q.channelClosed=aa(),q.getAdditionalParams=function(){return{}},q.getNetworkTestImageUri=ca(k),q.isActive=ca(j),q.badMapError=aa(),q.correctHostPrefix=function(t){return t};var $,Wd;Wd={0:"Ok",4:"User is logging out",6:"Unknown session ID",7:"Stopped by server",8:"General network error",2:"Request failed",9:"Blocked by a network administrator",5:"No data from server",10:"Got bad data from the server",11:"Got a bad response from the server"},$=function(t,e){var n,i,a,o,c,l,f,p,d;return f=this,t||(t="channel"),t.match(/:\/\//)&&t.replace(/^ws/,"http"),e||(e={}),s(e||"string"==typeof e)&&(e={}),c=e.reconnectTime||3e3,d=function(t){f.readyState=f.readyState=t},d(this.CLOSED),p=k,a=e.sc,n=new Vd,n.channelOpened=function(){return a=p,d($.OPEN),"function"==typeof f.onopen?f.onopen():h},i=k,n.channelError=function(t,e){var n;return n=Wd[e],i=e,d($.Va),"function"==typeof f.onerror?f.onerror(n,e):h},l=k,n.channelClosed=function(t,n,r){if(f.readyState!==$.CLOSED){p=k,t=i?Wd[i]:"Closed",d($.CLOSED);try{"function"==typeof f.onclose&&f.onclose(t,n,r)}catch(a){"undefined"!=typeof console&&console!==k&&console.error(a.stack)}return e.reconnect&&7!==i&&0!==i&&(n=6===i?0:c,clearTimeout(l),l=setTimeout(o,n)),i=k}},n.channelHandleArray=function(t,e){try{return"function"==typeof f.onmessage?f.onmessage(e):h}catch(n){return setTimeout(function(){g(n)},0)}},o=function(){if(p&&g(Error("Reconnect() called from invalid state")),d($.CONNECTING),"function"==typeof f.onconnecting&&f.onconnecting(),clearTimeout(l),p=new Dd(e.appVersion),p.e=n,i=k,e.failFast){var o=p;o.Ha=j,o.a.info("setFailFast: true"),(o.n||o.C)&&o.T>(o.Ha?0:2)&&(o.a.info("Retry count "+o.T+" > new maxRetries "+(o.Ha?0:2)+". Fail immediately!"),o.n?(o.n.cancel(),o.ha(o.n)):(r.clearTimeout(o.C),o.C=k,Z(o,2)))}return p.Za(""+t+"/test",""+t+"/bind",k,a!=k?a.X:h,a!=k?a.ta:h)},this.open=function(){return f.readyState!==f.CLOSED&&g(Error("Already open")),o()},this.close=function(){if(clearTimeout(l),i=0,f.readyState!==$.CLOSED){d($.Va);var t=p;if(t.a.info("disconnect()"),Kd(t),3==t.b){var e=t.xa++,n=t.Ja.l();G(n,"SID",t.X),G(n,"RID",e),G(n,"TYPE","terminate"),Od(t,n),e=new S(t,t.a,t.X,e,h),e.Ca=2,e.S=J(n.l()),n=new Image,n.src=e.S,n.onload=n.onerror=u(e.Zb,e),e.ka=v(),kc(e),Ud(t)}}},this.sendMap=function(t){var e;((e=f.readyState)===$.Va||e===$.CLOSED)&&g(Error("Cannot send to a closed connection")),e=p,0==e.b&&g(Error("Invalid operation: sending map when state is closed")),1e3==e.s.length&&e.a.I("Already have 1000 queued maps upon queueing "+Gc(t)),e.s.push(new Fd(e.cc++,t)),(2==e.b||3==e.b)&&Md(e)},this.send=function(t){return this.sendMap({JSON:Gc(t)})},o(),this},$.prototype.CONNECTING=$.CONNECTING=$.CONNECTING=0,$.prototype.OPEN=$.OPEN=$.OPEN=1,$.prototype.CLOSING=$.CLOSING=$.Va=2,$.prototype.CLOSED=$.CLOSED=$.CLOSED=3,("undefined"!=typeof exports&&exports!==k?exports:window).BCSocket=$}(),function(){var t,e,n,i,r,a,o,s,c,h,l,u,f,p,d,g,v=Array.prototype.slice,m=function(t,e){return function(){return t.apply(e,arguments)}},b=Array.prototype.indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};if(window.sharejs=c={version:"0.5.0-pre"},l=function(t){return setTimeout(t,0)},i=function(){function t(){}return t.prototype.on=function(t,e){var n;return this._events||(this._events={}),(n=this._events)[t]||(n[t]=[]),this._events[t].push(e),this},t.prototype.removeListener=function(t,e){var n,i,r,a=this;for(this._events||(this._events={}),i=(r=this._events)[t]||(r[t]=[]),n=0;i.length>n;)i[n]===e&&(i[n]=void 0),n++;return l(function(){var e;return a._events[t]=function(){var n,i,r=this._events[t],a=[];for(n=0,i=r.length;i>n;n++)e=r[n],e&&a.push(e);return a}.call(a)}),this},t.prototype.emit=function(){var t,e,n,i,r,a=arguments[0],o=arguments.length>=2?v.call(arguments,1):[];if(null!=(i=this._events)?!i[a]:true)return this;for(r=this._events[a],e=0,n=r.length;n>e;e++)t=r[e],t&&t.apply(this,o);return this},t}(),i.mixin=function(t){var e=t.prototype||t;return e.on=i.prototype.on,e.removeListener=i.prototype.removeListener,e.emit=i.prototype.emit,t},c._bt=a=function(t,e,n,i){var r,a=function(t,n,i,r){return e(i,t,n,"left"),e(r,n,t,"right")};return t.transformX=t.transformX=r=function(t,e){var o,s,c,h,l,u,f,p,d,g,v,m,b,y,w,k,q,x,E;for(n(t),n(e),l=[],g=0,y=e.length;y>g;g++){for(d=e[g],h=[],o=0;t.length>o;){if(u=[],a(t[o],d,h,u),o++,1!==u.length){if(0===u.length){for(x=t.slice(o),v=0,w=x.length;w>v;v++)s=x[v],i(h,s);d=null;break}for(E=r(t.slice(o),u),c=E[0],p=E[1],m=0,k=c.length;k>m;m++)s=c[m],i(h,s);for(b=0,q=p.length;q>b;b++)f=p[b],i(l,f);d=null;break}d=u[0]}null!=d&&i(l,d),t=h}return[t,l]},t.transform=t.transform=function(t,n,i){var a,o,s,c,h;if("left"!==i&&"right"!==i)throw Error("type must be 'left' or 'right'");return 0===n.length?t:1===t.length&&1===n.length?e([],t[0],n[0],i):"left"===i?(c=r(t,n),a=c[0],s=c[1],a):(h=r(n,t),s=h[0],o=h[1])}},f={},f.name="text",f.create=f.create=function(){return""},u=function(t,e,n){return t.slice(0,e)+n+t.slice(e)},o=function(t){var e,n;if("number"!=typeof t.p)throw Error("component missing position field");if(n=typeof t.i,e=typeof t.d,!("string"===n^"string"===e))throw Error("component needs an i or d field");if(!(t.p>=0))throw Error("position cannot be negative")},s=function(t){var e,n,i;for(n=0,i=t.length;i>n;n++)e=t[n],o(e);return!0},f.apply=function(t,e){var n,i,r,a;for(s(e),r=0,a=e.length;a>r;r++)if(n=e[r],null!=n.i)t=u(t,n.p,n.i);else{if(i=t.slice(n.p,n.p+n.d.length),n.d!==i)throw Error("Delete component '"+n.d+"' does not match deleted text '"+i+"'");t=t.slice(0,n.p)+t.slice(n.p+n.d.length)}return t},f._append=r=function(t,e){var n,i,r;if(""!==e.i&&""!==e.d)return 0===t.length?t.push(e):(n=t[t.length-1],null!=n.i&&null!=e.i&&n.p<=(i=e.p)&&n.p+n.i.length>=i?t[t.length-1]={i:u(n.i,e.p-n.p,e.i),p:n.p}:null!=n.d&&null!=e.d&&e.p<=(r=n.p)&&e.p+e.d.length>=r?t[t.length-1]={d:u(e.d,n.p-e.p,n.d),p:e.p}:t.push(e))},f.compose=function(t,e){var n,i,a,o;for(s(t),s(e),i=t.slice(),a=0,o=e.length;o>a;a++)n=e[a],r(i,n);return i},f.compress=function(t){return f.compose([],t)},f.normalize=function(t){var e,n,i,a=[];for((null!=t.i||null!=t.p)&&(t=[t]),n=0,i=t.length;i>n;n++)e=t[n],null==e.p&&(e.p=0),r(a,e);return a},d=function(t,e,n){return null!=e.i?t>e.p||e.p===t&&n?t+e.i.length:t:e.p>=t?t:e.p+e.d.length>=t?e.p:t-e.d.length},f.transformCursor=function(t,e,n){var i,r,a;for(r=0,a=e.length;a>r;r++)i=e[r],t=d(t,i,n);return t},f._tc=p=function(t,e,n,i){var a,o,c,h,l,u;if(s([e]),s([n]),null!=e.i)r(t,{i:e.i,p:d(e.p,n,"right"===i)});else if(null!=n.i)u=e.d,e.p<n.p&&(r(t,{d:u.slice(0,n.p-e.p),p:e.p}),u=u.slice(n.p-e.p)),""!==u&&r(t,{d:u,p:e.p+n.i.length});else if(e.p>=n.p+n.d.length)r(t,{d:e.d,p:e.p-n.d.length});else if(e.p+e.d.length<=n.p)r(t,e);else{if(h={d:"",p:e.p},e.p<n.p&&(h.d=e.d.slice(0,n.p-e.p)),e.p+e.d.length>n.p+n.d.length&&(h.d+=e.d.slice(n.p+n.d.length-e.p)),c=Math.max(e.p,n.p),o=Math.min(e.p+e.d.length,n.p+n.d.length),a=e.d.slice(c-e.p,o-e.p),l=n.d.slice(c-n.p,o-n.p),a!==l)throw Error("Delete ops delete different text in the same region of the document");""!==h.d&&(h.p=d(h.p,n),r(t,h))}return t},h=function(t){return null!=t.i?{d:t.i,p:t.p}:{i:t.d,p:t.p}},f.invert=function(t){var e,n,i,r=t.slice().reverse(),a=[];for(n=0,i=r.length;i>n;n++)e=r[n],a.push(h(e));return a},c.types||(c.types={}),a(f,p,s,r),c.types.text=f,f.api={provides:{text:!0},getLength:function(){return this.snapshot.length},getText:function(){return this.snapshot},insert:function(t,e,n){var i=[{p:t,i:e}];return this.submitOp(i,n),i},del:function(t,e,n){var i=[{p:t,d:this.snapshot.slice(t,t+e)}];return this.submitOp(i,n),i},_register:function(){return this.on("remoteop",function(t){var e,n,i,r=[];for(n=0,i=t.length;i>n;n++)e=t[n],void 0!==e.i?r.push(this.emit("insert",e.p,e.i)):r.push(this.emit("delete",e.p,e.d));return r})}},n=function(){function t(t,e,n){this.connection=t,this.name=e,this.flush=m(this.flush,this),n||(n={}),this.version=n.v,this.snapshot=n.snaphot,n.type&&this._setType(n.type),this.state="closed",this.autoOpen=!1,this._create=n.create,this.inflightOp=null,this.inflightCallbacks=[],this.inflightSubmittedIds=[],this.pendingOp=null,this.pendingCallbacks=[],this.serverOps={}}return t.prototype._xf=function(t,e){var n,i;return this.type.transformX?this.type.transformX(t,e):(n=this.type.transform(t,e,"left"),i=this.type.transform(e,t,"right"),[n,i])},t.prototype._otApply=function(t,e){var n=this.snapshot;return this.snapshot=this.type.apply(this.snapshot,t),this.emit("change",t,n),e?this.emit("remoteop",t,n):void 0},t.prototype._connectionStateChanged=function(t,e){switch(t){case"disconnected":this.state="closed",this.inflightOp&&this.inflightSubmittedIds.push(this.connection.id),this.emit("closed");break;case"ok":this.autoOpen&&this.open();break;case"stopped":"function"==typeof this._openCallback&&this._openCallback(e)}return this.emit(t,e)},t.prototype._setType=function(t){var e,n,i;if("string"==typeof t&&(t=g[t]),!t||!t.compose)throw Error("Support for types without compose() is not implemented");if(this.type=t,t.api){i=t.api;for(e in i)n=i[e],this[e]=n;return"function"==typeof this._register?this._register():void 0}return this.provides={}},t.prototype._onMessage=function(t){var e,n,i,r,a,o,s,c,h,l,u,f,p,d,g,v,m;if(t.open===!0)return this.state="open",this._create=!1,null==this.created&&(this.created=!!t.create),t.type&&this._setType(t.type),t.create?(this.created=!0,this.snapshot=this.type.create()):(this.created!==!0&&(this.created=!1),void 0!==t.snapshot&&(this.snapshot=t.snapshot)),null!=t.v&&(this.version=t.v),this.inflightOp?(o={doc:this.name,op:this.inflightOp,v:this.version},this.inflightSubmittedIds.length&&(o.dupIfSource=this.inflightSubmittedIds),this.connection.send(o)):this.flush(),this.emit("open"),"function"==typeof this._openCallback?this._openCallback(null):void 0;if(t.open===!1)return t.error&&("undefined"!=typeof console&&null!==console&&console.error("Could not open document: "+t.error),this.emit("error",t.error),"function"==typeof this._openCallback&&this._openCallback(t.error)),this.state="closed",this.emit("closed"),"function"==typeof this._closeCallback&&this._closeCallback(),this._closeCallback=null;if(null!==t.op||"Op already submitted"!==i){if(void 0===t.op&&void 0!==t.v||t.op&&(f=t.meta.source,b.call(this.inflightSubmittedIds,f)>=0)){if(r=this.inflightOp,this.inflightOp=null,this.inflightSubmittedIds.length=0,i=t.error,i)for(this.type.invert?(s=this.type.invert(r),this.pendingOp&&(p=this._xf(this.pendingOp,s),this.pendingOp=p[0],s=p[1]),this._otApply(s,!0)):this.emit("error","Op apply failed ("+i+") and the op could not be reverted"),d=this.inflightCallbacks,c=0,l=d.length;l>c;c++)e=d[c],e(i);else{if(t.v!==this.version)throw Error("Invalid version from server");for(this.serverOps[this.version]=r,this.version++,g=this.inflightCallbacks,h=0,u=g.length;u>h;h++)e=g[h],e(null,r)}return this.flush()}if(t.op){if(t.v<this.version)return;return t.doc!==this.name?this.emit("error","Expected docName '"+this.name+"' but got "+t.doc):t.v!==this.version?this.emit("error","Expected version "+this.version+" but got "+t.v):(a=t.op,this.serverOps[this.version]=a,n=a,null!==this.inflightOp&&(v=this._xf(this.inflightOp,n),this.inflightOp=v[0],n=v[1]),null!==this.pendingOp&&(m=this._xf(this.pendingOp,n),this.pendingOp=m[0],n=m[1]),this.version++,this._otApply(n,!0))}return"undefined"!=typeof console&&null!==console?console.warn("Unhandled document message:",t):void 0}},t.prototype.flush=function(){return"ok"===this.connection.state&&null===this.inflightOp&&null!==this.pendingOp?(this.inflightOp=this.pendingOp,this.inflightCallbacks=this.pendingCallbacks,this.pendingOp=null,this.pendingCallbacks=[],this.connection.send({doc:this.name,op:this.inflightOp,v:this.version})):void 0},t.prototype.submitOp=function(t,e){return null!=this.type.normalize&&(t=this.type.normalize(t)),this.snapshot=this.type.apply(this.snapshot,t),this.pendingOp=null!==this.pendingOp?this.type.compose(this.pendingOp,t):t,e&&this.pendingCallbacks.push(e),this.emit("change",t),setTimeout(this.flush,0)},t.prototype.open=function(t){var e,n=this;return this.autoOpen=!0,"closed"===this.state?(e={doc:this.name,open:!0},void 0===this.snapshot&&(e.snapshot=null),this.type&&(e.type=this.type.name),null!=this.version&&(e.v=this.version),this._create&&(e.create=!0),this.connection.send(e),this.state="opening",this._openCallback=function(e){return n._openCallback=null,"function"==typeof t?t(e):void 0}):void 0},t.prototype.close=function(t){return this.autoOpen=!1,"closed"===this.state?"function"==typeof t?t():void 0:(this.connection.send({doc:this.name,open:!1}),this.state="closed",this.emit("closing"),this._closeCallback=t)},t}(),i.mixin(n),c.Doc=n,g||(g=c.types),!window.BCSocket)throw Error("Must load browserchannel before this library");t=window.BCSocket,e=function(){function e(e){var n=this;this.docs={},this.state="connecting",this.socket=new t(e,{reconnect:!0}),this.socket.onmessage=function(t){var e;return null===t.auth?(n.lastError=t.error,n.disconnect(),n.emit("connect failed",t.error)):t.auth?(n.id=t.auth,n.setState("ok"),n.emit("connect"),void 0):(e=t.doc,void 0!==e?n.lastReceivedDoc=e:t.doc=e=n.lastReceivedDoc,n.docs[e]?n.docs[e]._onMessage(t):"undefined"!=typeof console&&null!==console?console.error("Unhandled message",t):void 0)},this.connected=!1,this.socket.onclose=function(t){return n.setState("disconnected",t),"Closed"===t||"Stopped by server"===t?n.setState("stopped",n.lastError||t):void 0},this.socket.onerror=function(t){return n.emit("error",t)},this.socket.onopen=function(){return n.lastError=n.lastReceivedDoc=n.lastSentDoc=null,n.setState("handshaking")},this.socket.onconnecting=function(){return n.setState("connecting")}}return e.prototype.setState=function(t,e){var n,i,r,a;if(this.state!==t){this.state=t,"disconnected"===t&&delete this.id,this.emit(t,e),r=this.docs,a=[];for(i in r)n=r[i],a.push(n._connectionStateChanged(t,e));return a}},e.prototype.send=function(t){var e=t.doc;return e===this.lastSentDoc?delete t.doc:this.lastSentDoc=e,this.socket.send(t)},e.prototype.disconnect=function(){return this.socket.close()},e.prototype.makeDoc=function(t,e,i){var r,a=this;if(this.docs[t])throw Error("Doc "+t+" already open");return r=new n(this,t,e),this.docs[t]=r,r.open(function(e){return e&&delete a.docs[t],i(e,e?void 0:r)})},e.prototype.openExisting=function(t,e){var n;return"stopped"===this.state?e("connection closed"):this.docs[t]?e(null,this.docs[t]):n=this.makeDoc(t,{},e)},e.prototype.open=function(t,e,n){var i;if("stopped"===this.state)return n("connection closed");if("function"==typeof e&&(n=e,e="text"),n||(n=function(){}),"string"==typeof e&&(e=g[e]),!e)throw Error("OT code for document type missing");if(null==t)throw Error("Server-generated random doc names are not currently supported");return this.docs[t]?(i=this.docs[t],i.type===e?n(null,i):n("Type mismatch",i),void 0):this.makeDoc(t,{create:!0,type:e.name},n)},e}(),i.mixin(e),c.Connection=e,c.open=function(){var t={},n=function(n){var i,r,a;return a=window.location,null==n&&(n=""+a.protocol+"//"+a.host+"/channel"),t[n]||(i=new e(n),r=function(){return delete t[n]},i.on("disconnecting",r),i.on("connect failed",r),t[n]=i),t[n]};return function(t,e,i,r){var a;return"function"==typeof i&&(r=i,i=null),a=n(i),a.numDocs++,a.open(t,e,function(t,e){return t?r(t):(e.on("closed",function(){var t,e,n=0,i=a.docs;for(e in i)t=i[e],("closed"!==t.state||t.autoOpen)&&n++;return 0===n?a.disconnect():void 0}),r(null,e))}),a.on("connect failed"),a}}()}.call(this),function(){var t;t=function(t,e,n){var i,r;if(e!==n){for(r=0;e.charAt(r)===n.charAt(r);)r++;for(i=0;e.charAt(e.length-1-i)===n.charAt(n.length-1-i)&&e.length>i+r&&n.length>i+r;)i++;return e.length!==r+i&&t.del(r,e.length-r-i),n.length!==r+i?t.insert(r,n.slice(r,n.length-i)):void 0}},window.sharejs.Doc.prototype.attach_textarea=function(e){var n,i,r,a,o,s,c,h,l;for(n=this,e.value=this.snapshot,a=e.value,o=function(t,n){var i,r;return i=[n(e.selectionStart),n(e.selectionEnd)],r=e.scrollTop,e.value=t,e.scrollTop!==r&&(e.scrollTop=r),e.selectionStart=i[0],e.selectionEnd=i[1],i
},this.on("insert",function(t,n){var i;return i=function(e){return e>t?e+n.length:e},a=e.value.replace(/\r\n/g,"\n"),o(a.slice(0,t)+n+a.slice(t),i)}),this.on("delete",function(t,n){var i;return i=function(e){return e>t?e-Math.min(n.length,e-t):e},a=e.value.replace(/\r\n/g,"\n"),o(a.slice(0,t)+a.slice(t+n.length),i)}),r=function(){var i;return i=function(t){return setTimeout(t,0)},i(function(){return e.value!==a?(a=e.value,t(n,n.getText(),e.value.replace(/\r\n/g,"\n"))):void 0})},h=["textInput","keydown","keyup","select","cut","paste"],l=[],s=0,c=h.length;c>s;s++)i=h[s],e.addEventListener?l.push(e.addEventListener(i,r,!1)):l.push(e.attachEvent("on"+i,r));return l}}.call(this),$(function(){var t=new Showdown.converter({extensions:["prettify","github","table"]}),e=$("#editor"),n=$("#doc"),i=$("#wiki-template").html(),r=$("#sidebar"),a=window.location.pathname.split("/")[2],o=function(){return e.is(":visible")?(e.hide(),n.css("visibility","visible")):(n.css("visibility","hidden"),e.show()),!1},s="",c=function(i){var r=e.val();if(!(1>r.length||r==s)){s=r;var a=t.makeHtml(r);return n.html(a),toc(),prettyPrint(),e.elastic(),i.preventDefault(),!1}};e.elastic(),$(document).bind("keydown","esc",o),$(document).bind("keydown","ctrl+e",o),e.bind("keydown","esc",o),e.bind("keydown","ctrl+e",o),e.bind("keydown","tab",function(){var t=e.getSelection();if(!t)return!1;if(1>t.length)e.insertText(" ",t.start,!0);else{var n=" "+t.text.replace(/\n/m,"\n ");e.replaceSelectedText(n)}return!1});var h=640>$(window).width(),l=1;$(document.body).hammer({swipe:!0,drag:!0,css_hacks:!1,swipe_time:1e3,swipe_min_distance:100,transform:!1,tap:!1,tap_double:!1,hold:!1}).bind("swipe",function(t){"left"==t.direction?1==l?(o(),l=2):0==l&&(r.hide(),l=1):"right"==t.direction&&(1==l&&h?(r.show().one("click",function(){r.hide(),l=1}),l=0):2==l&&(o(),l=1))}),sharejs.open(a,"text",function(t,n){t?(console.log(t),alert("An error has occurred, try refreshing!")):(n.attach_textarea(e.get(0)),n.on("change",function(){setTimeout(c,100)}),1>n.getText().length&&(console.log("starting from template"),n.insert(0,i),e.val(i)),c())})});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment