diff --git a/Gruntfile.js b/Gruntfile.js index f6998dbf..2c6e99f7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,19 +74,6 @@ module.exports = function(grunt) { }, }, 'string-replace': { - 'font-parameters': { - files: { - './': 'public/res-min/themes/*.css', - }, - options: { - replacements: [ - { - pattern: /(font\/fontello\.\w+)\?\w+/g, - replacement: '$1' - } - ] - } - }, 'constants': { files: { 'public/res/constants.js': 'public/res/constants.js' @@ -202,10 +189,8 @@ module.exports = function(grunt) { */ grunt.registerTask('build-css', function() { - // First compile less files + // Compile less files grunt.task.run('less:compile'); - // Remove fontello checksum arguments - grunt.task.run('string-replace:font-parameters'); }); diff --git a/public/cache.manifest b/public/cache.manifest index 88fb1cc6..1f86d4da 100644 --- a/public/cache.manifest +++ b/public/cache.manifest @@ -1,5 +1,5 @@ CACHE MANIFEST -#Date Sun Apr 20 2014 18:20:19 +#Date Tue Apr 22 2014 12:03:32 CACHE: res/worker.js diff --git a/public/res-min/img/menu-icon.png b/public/res-min/img/menu-icon.png index 29c29519..062c485b 100644 Binary files a/public/res-min/img/menu-icon.png and b/public/res-min/img/menu-icon.png differ diff --git a/public/res-min/main.js b/public/res-min/main.js index 734fab98..ab85de54 100644 --- a/public/res-min/main.js +++ b/public/res-min/main.js @@ -632,29 +632,29 @@ THE SOFTWARE. * Build date: 26 February 2012 */ -function printStackTrace(e){e=e||{guess:!0};var t=e.e||null,n=!!e.guess,i=new printStackTrace.implementation,r=i.run(t);return n?i.guessAnonymousFunctions(r):r}function diff_match_patch(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32}!function(e,t){function n(e){var t=e.length,n=ot.type(e);return ot.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function i(e){var t=ht[e]={};return ot.each(e.match(st)||[],function(e,n){t[n]=!0}),t}function r(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ot.expando+Math.random()}function o(e,n,i){var r;if(i===t&&1===e.nodeType)if(r="data-"+n.replace(bt,"-$1").toLowerCase(),i=e.getAttribute(r),"string"==typeof i){try{i="true"===i?!0:"false"===i?!1:"null"===i?null:+i+""===i?+i:vt.test(i)?JSON.parse(i):i}catch(o){}mt.set(e,n,i)}else i=t;return i}function a(){return!0}function s(){return!1}function l(){try{return z.activeElement}catch(e){}}function c(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function u(e,t,n){if(ot.isFunction(t))return ot.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return ot.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(It.test(t))return ot.filter(t,e,n);t=ot.filter(t,e)}return ot.grep(e,function(e){return tt.call(t,e)>=0!==n})}function d(e,t){return ot.nodeName(e,"table")&&ot.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function p(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function f(e){var t=jt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function h(e,t){for(var n=e.length,i=0;n>i;i++)gt.set(e[i],"globalEval",!t||gt.get(t[i],"globalEval"))}function m(e,t){var n,i,r,o,a,s,l,c;if(1===t.nodeType){if(gt.hasData(e)&&(o=gt.access(e),a=gt.set(t,o),c=o.events)){delete a.handle,a.events={};for(r in c)for(n=0,i=c[r].length;i>n;n++)ot.event.add(t,r,c[r][n])}mt.hasData(e)&&(s=mt.access(e),l=ot.extend({},s),mt.set(t,l))}}function g(e,n){var i=e.getElementsByTagName?e.getElementsByTagName(n||"*"):e.querySelectorAll?e.querySelectorAll(n||"*"):[];return n===t||n&&ot.nodeName(e,n)?ot.merge([e],i):i}function v(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ft.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function b(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),i=t,r=Zt.length;r--;)if(t=Zt[r]+n,t in e)return t;return i}function y(e,t){return e=t||e,"none"===ot.css(e,"display")||!ot.contains(e.ownerDocument,e)}function x(t){return e.getComputedStyle(t,null)}function w(e,t){for(var n,i,r,o=[],a=0,s=e.length;s>a;a++)i=e[a],i.style&&(o[a]=gt.get(i,"olddisplay"),n=i.style.display,t?(o[a]||"none"!==n||(i.style.display=""),""===i.style.display&&y(i)&&(o[a]=gt.access(i,"olddisplay",E(i.nodeName)))):o[a]||(r=y(i),(n&&"none"!==n||!r)&>.set(i,"olddisplay",r?n:ot.css(i,"display"))));for(a=0;s>a;a++)i=e[a],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?o[a]||"":"none"));return e}function S(e,t,n){var i=Vt.exec(t);return i?Math.max(0,i[1]-(n||0))+(i[2]||"px"):t}function C(e,t,n,i,r){for(var o=n===(i?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=ot.css(e,n+Yt[o],!0,r)),i?("content"===n&&(a-=ot.css(e,"padding"+Yt[o],!0,r)),"margin"!==n&&(a-=ot.css(e,"border"+Yt[o]+"Width",!0,r))):(a+=ot.css(e,"padding"+Yt[o],!0,r),"padding"!==n&&(a+=ot.css(e,"border"+Yt[o]+"Width",!0,r)));return a}function T(e,t,n){var i=!0,r="width"===t?e.offsetWidth:e.offsetHeight,o=x(e),a=ot.support.boxSizing&&"border-box"===ot.css(e,"boxSizing",!1,o);if(0>=r||null==r){if(r=qt(e,t,o),(0>r||null==r)&&(r=e.style[t]),Wt.test(r))return r;i=a&&(ot.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+C(e,t,n||(a?"border":"content"),i,o)+"px"}function E(e){var t=z,n=Xt[e];return n||(n=k(e,t),"none"!==n&&n||(Ut=(Ut||ot("").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Ut[0].contentWindow||Ut[0].contentDocument).document,t.write("
"),t.close(),n=k(e,t),Ut.detach()),Xt[e]=n),n}function k(e,t){var n=ot(t.createElement(e)).appendTo(t.body),i=ot.css(n[0],"display");return n.remove(),i}function _(e,t,n,i){var r;if(ot.isArray(t))ot.each(t,function(t,r){n||tn.test(e)?i(e,r):_(e+"["+("object"==typeof r?t:"")+"]",r,n,i)});else if(n||"object"!==ot.type(t))i(e,t);else for(r in t)_(e+"["+r+"]",t[r],n,i)}function I(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,r=0,o=t.toLowerCase().match(st)||[];if(ot.isFunction(n))for(;i=o[r++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function D(e,t,n,i){function r(s){var l;return o[s]=!0,ot.each(e[s]||[],function(e,s){var c=s(t,n,i);return"string"!=typeof c||a||o[c]?a?!(l=c):void 0:(t.dataTypes.unshift(c),r(c),!1)}),l}var o={},a=e===yn;return r(t.dataTypes[0])||!o["*"]&&r("*")}function N(e,n){var i,r,o=ot.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&ot.extend(!0,e,r),e}function L(e,n,i){for(var r,o,a,s,l=e.contents,c=e.dataTypes;"*"===c[0];)c.shift(),r===t&&(r=e.mimeType||n.getResponseHeader("Content-Type"));if(r)for(o in l)if(l[o]&&l[o].test(r)){c.unshift(o);break}if(c[0]in i)a=c[0];else{for(o in i){if(!c[0]||e.converters[o+" "+c[0]]){a=o;break}s||(s=o)}a=a||s}return a?(a!==c[0]&&c.unshift(a),i[a]):void 0}function M(e,t,n,i){var r,o,a,s,l,c={},u=e.dataTypes.slice();if(u[1])for(a in e.converters)c[a.toLowerCase()]=e.converters[a];for(o=u.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=u.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=c[l+" "+o]||c["* "+o],!a)for(r in c)if(s=r.split(" "),s[1]===o&&(a=c[l+" "+s[0]]||c["* "+s[0]])){a===!0?a=c[r]:c[r]!==!0&&(o=s[0],u.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(d){return{state:"parsererror",error:a?d:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}function A(){return setTimeout(function(){In=t}),In=ot.now()}function R(e,t,n){for(var i,r=(Rn[t]||[]).concat(Rn["*"]),o=0,a=r.length;a>o;o++)if(i=r[o].call(n,t,e))return i}function P(e,t,n){var i,r,o=0,a=An.length,s=ot.Deferred().always(function(){delete l.elem}),l=function(){if(r)return!1;for(var t=In||A(),n=Math.max(0,c.startTime+c.duration-t),i=n/c.duration||0,o=1-i,a=0,l=c.tweens.length;l>a;a++)c.tweens[a].run(o);return s.notifyWith(e,[c,o,n]),1>o&&l?n:(s.resolveWith(e,[c]),!1)},c=s.promise({elem:e,props:ot.extend({},t),opts:ot.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:In||A(),duration:n.duration,tweens:[],createTween:function(t,n){var i=ot.Tween(e,c.opts,t,n,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(i),i},stop:function(t){var n=0,i=t?c.tweens.length:0;if(r)return this;for(r=!0;i>n;n++)c.tweens[n].run(1);return t?s.resolveWith(e,[c,t]):s.rejectWith(e,[c,t]),this}}),u=c.props;for(F(u,c.opts.specialEasing);a>o;o++)if(i=An[o].call(c,e,u,c.opts))return i;return ot.map(u,R,c),ot.isFunction(c.opts.start)&&c.opts.start.call(e,c),ot.fx.timer(ot.extend(l,{elem:e,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function F(e,t){var n,i,r,o,a;for(n in e)if(i=ot.camelCase(n),r=t[i],o=e[n],ot.isArray(o)&&(r=o[1],o=e[n]=o[0]),n!==i&&(e[i]=o,delete e[n]),a=ot.cssHooks[i],a&&"expand"in a){o=a.expand(o),delete e[i];for(n in o)n in e||(e[n]=o[n],t[n]=r)}else t[i]=r}function O(e,n,i){var r,o,a,s,l,c,u=this,d={},p=e.style,f=e.nodeType&&y(e),h=gt.get(e,"fxshow");i.queue||(l=ot._queueHooks(e,"fx"),null==l.unqueued&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,u.always(function(){u.always(function(){l.unqueued--,ot.queue(e,"fx").length||l.empty.fire()})})),1===e.nodeType&&("height"in n||"width"in n)&&(i.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===ot.css(e,"display")&&"none"===ot.css(e,"float")&&(p.display="inline-block")),i.overflow&&(p.overflow="hidden",u.always(function(){p.overflow=i.overflow[0],p.overflowX=i.overflow[1],p.overflowY=i.overflow[2]}));for(r in n)if(o=n[r],Nn.exec(o)){if(delete n[r],a=a||"toggle"===o,o===(f?"hide":"show")){if("show"!==o||!h||h[r]===t)continue;f=!0}d[r]=h&&h[r]||ot.style(e,r)}if(!ot.isEmptyObject(d)){h?"hidden"in h&&(f=h.hidden):h=gt.access(e,"fxshow",{}),a&&(h.hidden=!f),f?ot(e).show():u.done(function(){ot(e).hide()}),u.done(function(){var t;gt.remove(e,"fxshow");for(t in d)ot.style(e,t,d[t])});for(r in d)s=R(f?h[r]:0,r,u),r in h||(h[r]=s.start,f&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function B(e,t,n,i,r){return new B.prototype.init(e,t,n,i,r)}function j(e,t){var n,i={height:e},r=0;for(t=t?1:0;4>r;r+=2-t)n=Yt[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function $(e){return ot.isWindow(e)?e:9===e.nodeType&&e.defaultView}var G,q,U=typeof t,H=e.location,z=e.document,V=z.documentElement,W=e.jQuery,Q=e.$,X={},K=[],J="2.0.3",Y=K.concat,Z=K.push,et=K.slice,tt=K.indexOf,nt=X.toString,it=X.hasOwnProperty,rt=J.trim,ot=function(e,t){return new ot.fn.init(e,t,G)},at=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,st=/\S+/g,lt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ct=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ut=/^-ms-/,dt=/-([\da-z])/gi,pt=function(e,t){return t.toUpperCase()},ft=function(){z.removeEventListener("DOMContentLoaded",ft,!1),e.removeEventListener("load",ft,!1),ot.ready()};ot.fn=ot.prototype={jquery:J,constructor:ot,init:function(e,n,i){var r,o;if(!e)return this;if("string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:lt.exec(e),!r||!r[1]&&n)return!n||n.jquery?(n||i).find(e):this.constructor(n).find(e);if(r[1]){if(n=n instanceof ot?n[0]:n,ot.merge(this,ot.parseHTML(r[1],n&&n.nodeType?n.ownerDocument||n:z,!0)),ct.test(r[1])&&ot.isPlainObject(n))for(r in n)ot.isFunction(this[r])?this[r](n[r]):this.attr(r,n[r]);return this}return o=z.getElementById(r[2]),o&&o.parentNode&&(this.length=1,this[0]=o),this.context=z,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):ot.isFunction(e)?i.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),ot.makeArray(e,this))},selector:"",length:0,toArray:function(){return et.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=ot.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return ot.each(this,e,t)},ready:function(e){return ot.ready.promise().done(e),this},slice:function(){return this.pushStack(et.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(ot.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:Z,sort:[].sort,splice:[].splice},ot.fn.init.prototype=ot.fn,ot.extend=ot.fn.extend=function(){var e,n,i,r,o,a,s=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),"object"==typeof s||ot.isFunction(s)||(s={}),c===l&&(s=this,--l);c>l;l++)if(null!=(e=arguments[l]))for(n in e)i=s[n],r=e[n],s!==r&&(u&&r&&(ot.isPlainObject(r)||(o=ot.isArray(r)))?(o?(o=!1,a=i&&ot.isArray(i)?i:[]):a=i&&ot.isPlainObject(i)?i:{},s[n]=ot.extend(u,a,r)):r!==t&&(s[n]=r));return s},ot.extend({expando:"jQuery"+(J+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===ot&&(e.$=Q),t&&e.jQuery===ot&&(e.jQuery=W),ot},isReady:!1,readyWait:1,holdReady:function(e){e?ot.readyWait++:ot.ready(!0)},ready:function(e){(e===!0?--ot.readyWait:ot.isReady)||(ot.isReady=!0,e!==!0&&--ot.readyWait>0||(q.resolveWith(z,[ot]),ot.fn.trigger&&ot(z).trigger("ready").off("ready")))},isFunction:function(e){return"function"===ot.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?String(e):"object"==typeof e||"function"==typeof e?X[nt.call(e)]||"object":typeof e},isPlainObject:function(e){if("object"!==ot.type(e)||e.nodeType||ot.isWindow(e))return!1;try{if(e.constructor&&!it.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||z;var i=ct.exec(e),r=!n&&[];return i?[t.createElement(i[1])]:(i=ot.buildFragment([e],t,r),r&&ot(r).remove(),ot.merge([],i.childNodes))},parseJSON:JSON.parse,parseXML:function(e){var n,i;if(!e||"string"!=typeof e)return null;try{i=new DOMParser,n=i.parseFromString(e,"text/xml")}catch(r){n=t}return(!n||n.getElementsByTagName("parsererror").length)&&ot.error("Invalid XML: "+e),n},noop:function(){},globalEval:function(e){var t,n=eval;e=ot.trim(e),e&&(1===e.indexOf("use strict")?(t=z.createElement("script"),t.text=e,z.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(ut,"ms-").replace(dt,pt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,i){var r,o=0,a=e.length,s=n(e);if(i){if(s)for(;a>o&&(r=t.apply(e[o],i),r!==!1);o++);else for(o in e)if(r=t.apply(e[o],i),r===!1)break}else if(s)for(;a>o&&(r=t.call(e[o],o,e[o]),r!==!1);o++);else for(o in e)if(r=t.call(e[o],o,e[o]),r===!1)break;return e},trim:function(e){return null==e?"":rt.call(e)},makeArray:function(e,t){var i=t||[];return null!=e&&(n(Object(e))?ot.merge(i,"string"==typeof e?[e]:e):Z.call(i,e)),i},inArray:function(e,t,n){return null==t?-1:tt.call(t,e,n)},merge:function(e,n){var i=n.length,r=e.length,o=0;if("number"==typeof i)for(;i>o;o++)e[r++]=n[o];else for(;n[o]!==t;)e[r++]=n[o++];return e.length=r,e},grep:function(e,t,n){var i,r=[],o=0,a=e.length;for(n=!!n;a>o;o++)i=!!t(e[o],o),n!==i&&r.push(e[o]);return r},map:function(e,t,i){var r,o=0,a=e.length,s=n(e),l=[];if(s)for(;a>o;o++)r=t(e[o],o,i),null!=r&&(l[l.length]=r);else for(o in e)r=t(e[o],o,i),null!=r&&(l[l.length]=r);return Y.apply([],l)},guid:1,proxy:function(e,n){var i,r,o;return"string"==typeof n&&(i=e[n],n=e,e=i),ot.isFunction(e)?(r=et.call(arguments,2),o=function(){return e.apply(n||this,r.concat(et.call(arguments)))},o.guid=e.guid=e.guid||ot.guid++,o):t},access:function(e,n,i,r,o,a,s){var l=0,c=e.length,u=null==i;if("object"===ot.type(i)){o=!0;for(l in i)ot.access(e,n,l,i[l],!0,a,s)}else if(r!==t&&(o=!0,ot.isFunction(r)||(s=!0),u&&(s?(n.call(e,r),n=null):(u=n,n=function(e,t,n){return u.call(ot(e),n)})),n))for(;c>l;l++)n(e[l],i,s?r:r.call(e[l],l,n(e[l],i)));return o?e:u?n.call(e):c?n(e[0],i):a},now:Date.now,swap:function(e,t,n,i){var r,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];r=n.apply(e,i||[]);for(o in t)e.style[o]=a[o];return r}}),ot.ready.promise=function(t){return q||(q=ot.Deferred(),"complete"===z.readyState?setTimeout(ot.ready):(z.addEventListener("DOMContentLoaded",ft,!1),e.addEventListener("load",ft,!1))),q.promise(t)},ot.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){X["[object "+t+"]"]=t.toLowerCase()}),G=ot(z),function(e,t){function n(e,t,n,i){var r,o,a,s,l,c,u,d,h,m;if((t?t.ownerDocument||t:$)!==M&&L(t),t=t||M,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(R&&!i){if(r=yt.exec(e))if(a=r[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&B(t,o)&&o.id===a)return n.push(o),n}else{if(r[2])return et.apply(n,t.getElementsByTagName(e)),n;if((a=r[3])&&C.getElementsByClassName&&t.getElementsByClassName)return et.apply(n,t.getElementsByClassName(a)),n}if(C.qsa&&(!P||!P.test(e))){if(d=u=j,h=t,m=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){for(c=p(e),(u=t.getAttribute("id"))?d=u.replace(St,"\\$&"):t.setAttribute("id",d),d="[id='"+d+"'] ",l=c.length;l--;)c[l]=d+f(c[l]);h=ft.test(e)&&t.parentNode||t,m=c.join(",")}if(m)try{return et.apply(n,h.querySelectorAll(m)),n}catch(g){}finally{u||t.removeAttribute("id")}}}return w(e.replace(ut,"$1"),t,n,i)}function i(){function e(n,i){return t.push(n+=" ")>E.cacheLength&&delete e[t.shift()],e[n]=i}var t=[];return e}function r(e){return e[j]=!0,e}function o(e){var t=M.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function a(e,t){for(var n=e.split("|"),i=e.length;i--;)E.attrHandle[n[i]]=t}function s(e,t){var n=t&&e,i=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||X)-(~e.sourceIndex||X);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function l(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function c(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function u(e){return r(function(t){return t=+t,r(function(n,i){for(var r,o=e([],n.length,t),a=o.length;a--;)n[r=o[a]]&&(n[r]=!(i[r]=n[r]))})})}function d(){}function p(e,t){var i,r,o,a,s,l,c,u=H[e+" "];if(u)return t?0:u.slice(0);for(s=e,l=[],c=E.preFilter;s;){(!i||(r=dt.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(o=[])),i=!1,(r=pt.exec(s))&&(i=r.shift(),o.push({value:i,type:r[0].replace(ut," ")}),s=s.slice(i.length));for(a in E.filter)!(r=vt[a].exec(s))||c[a]&&!(r=c[a](r))||(i=r.shift(),o.push({value:i,type:a,matches:r}),s=s.slice(i.length));if(!i)break}return t?s.length:s?n.error(e):H(e,l).slice(0)}function f(e){for(var t=0,n=e.length,i="";n>t;t++)i+=e[t].value;return i}function h(e,t,n){var i=t.dir,r=n&&"parentNode"===i,o=q++;return t.first?function(t,n,o){for(;t=t[i];)if(1===t.nodeType||r)return e(t,n,o)}:function(t,n,a){var s,l,c,u=G+" "+o;if(a){for(;t=t[i];)if((1===t.nodeType||r)&&e(t,n,a))return!0}else for(;t=t[i];)if(1===t.nodeType||r)if(c=t[j]||(t[j]={}),(l=c[i])&&l[0]===u){if((s=l[1])===!0||s===T)return s===!0}else if(l=c[i]=[u],l[1]=e(t,n,a)||T,l[1]===!0)return!0}}function m(e){return e.length>1?function(t,n,i){for(var r=e.length;r--;)if(!e[r](t,n,i))return!1;return!0}:e[0]}function g(e,t,n,i,r){for(var o,a=[],s=0,l=e.length,c=null!=t;l>s;s++)(o=e[s])&&(!n||n(o,i,r))&&(a.push(o),c&&t.push(s));return a}function v(e,t,n,i,o,a){return i&&!i[j]&&(i=v(i)),o&&!o[j]&&(o=v(o,a)),r(function(r,a,s,l){var c,u,d,p=[],f=[],h=a.length,m=r||x(t||"*",s.nodeType?[s]:s,[]),v=!e||!r&&t?m:g(m,p,e,s,l),b=n?o||(r?e:h||i)?[]:a:v;if(n&&n(v,b,s,l),i)for(c=g(b,f),i(c,[],s,l),u=c.length;u--;)(d=c[u])&&(b[f[u]]=!(v[f[u]]=d));if(r){if(o||e){if(o){for(c=[],u=b.length;u--;)(d=b[u])&&c.push(v[u]=d);o(null,b=[],c,l)}for(u=b.length;u--;)(d=b[u])&&(c=o?nt.call(r,d):p[u])>-1&&(r[c]=!(a[c]=d))}}else b=g(b===a?b.splice(h,b.length):b),o?o(null,a,b,l):et.apply(a,b)})}function b(e){for(var t,n,i,r=e.length,o=E.relative[e[0].type],a=o||E.relative[" "],s=o?1:0,l=h(function(e){return e===t},a,!0),c=h(function(e){return nt.call(t,e)>-1},a,!0),u=[function(e,n,i){return!o&&(i||n!==D)||((t=n).nodeType?l(e,n,i):c(e,n,i))}];r>s;s++)if(n=E.relative[e[s].type])u=[h(m(u),n)];else{if(n=E.filter[e[s].type].apply(null,e[s].matches),n[j]){for(i=++s;r>i&&!E.relative[e[i].type];i++);return v(s>1&&m(u),s>1&&f(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ut,"$1"),n,i>s&&b(e.slice(s,i)),r>i&&b(e=e.slice(i)),r>i&&f(e))}u.push(n)}return m(u)}function y(e,t){var i=0,o=t.length>0,a=e.length>0,s=function(r,s,l,c,u){var d,p,f,h=[],m=0,v="0",b=r&&[],y=null!=u,x=D,w=r||a&&E.find.TAG("*",u&&s.parentNode||s),S=G+=null==x?1:Math.random()||.1;for(y&&(D=s!==M&&s,T=i);null!=(d=w[v]);v++){if(a&&d){for(p=0;f=e[p++];)if(f(d,s,l)){c.push(d);break}y&&(G=S,T=++i)}o&&((d=!f&&d)&&m--,r&&b.push(d))}if(m+=v,o&&v!==m){for(p=0;f=t[p++];)f(b,h,s,l);if(r){if(m>0)for(;v--;)b[v]||h[v]||(h[v]=Y.call(c));h=g(h)}et.apply(c,h),y&&!r&&h.length>0&&m+t.length>1&&n.uniqueSort(c)}return y&&(G=S,D=x),b};return o?r(s):s}function x(e,t,i){for(var r=0,o=t.length;o>r;r++)n(e,t[r],i);return i}function w(e,t,n,i){var r,o,a,s,l,c=p(e);if(!i&&1===c.length){if(o=c[0]=c[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&C.getById&&9===t.nodeType&&R&&E.relative[o[1].type]){if(t=(E.find.ID(a.matches[0].replace(Ct,Tt),t)||[])[0],!t)return n;e=e.slice(o.shift().value.length)}for(r=vt.needsContext.test(e)?0:o.length;r--&&(a=o[r],!E.relative[s=a.type]);)if((l=E.find[s])&&(i=l(a.matches[0].replace(Ct,Tt),ft.test(o[0].type)&&t.parentNode||t))){if(o.splice(r,1),e=i.length&&f(o),!e)return et.apply(n,i),n;break}}return I(e,c)(i,t,!R,n,ft.test(e)),n}var S,C,T,E,k,_,I,D,N,L,M,A,R,P,F,O,B,j="sizzle"+-new Date,$=e.document,G=0,q=0,U=i(),H=i(),z=i(),V=!1,W=function(e,t){return e===t?(V=!0,0):0},Q=typeof t,X=1<<31,K={}.hasOwnProperty,J=[],Y=J.pop,Z=J.push,et=J.push,tt=J.slice,nt=J.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},it="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",rt="[\\x20\\t\\r\\n\\f]",at="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",st=at.replace("w","w#"),lt="\\["+rt+"*("+at+")"+rt+"*(?:([*^$|!~]?=)"+rt+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+st+")|)|)"+rt+"*\\]",ct=":("+at+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+lt.replace(3,8)+")*)|.*)\\)|)",ut=new RegExp("^"+rt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+rt+"+$","g"),dt=new RegExp("^"+rt+"*,"+rt+"*"),pt=new RegExp("^"+rt+"*([>+~]|"+rt+")"+rt+"*"),ft=new RegExp(rt+"*[+~]"),ht=new RegExp("="+rt+"*([^\\]'\"]*)"+rt+"*\\]","g"),mt=new RegExp(ct),gt=new RegExp("^"+st+"$"),vt={ID:new RegExp("^#("+at+")"),CLASS:new RegExp("^\\.("+at+")"),TAG:new RegExp("^("+at.replace("w","w*")+")"),ATTR:new RegExp("^"+lt),PSEUDO:new RegExp("^"+ct),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+rt+"*(even|odd|(([+-]|)(\\d*)n|)"+rt+"*(?:([+-]|)"+rt+"*(\\d+)|))"+rt+"*\\)|)","i"),bool:new RegExp("^(?:"+it+")$","i"),needsContext:new RegExp("^"+rt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+rt+"*((?:-\\d)?\\d*)"+rt+"*\\)|)(?=[^-]|$)","i")},bt=/^[^{]+\{\s*\[native \w/,yt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,xt=/^(?:input|select|textarea|button)$/i,wt=/^h\d$/i,St=/'|\\/g,Ct=new RegExp("\\\\([\\da-f]{1,6}"+rt+"?|("+rt+")|.)","ig"),Tt=function(e,t,n){var i="0x"+t-65536;return i!==i||n?t:0>i?String.fromCharCode(i+65536):String.fromCharCode(i>>10|55296,1023&i|56320)};try{et.apply(J=tt.call($.childNodes),$.childNodes),J[$.childNodes.length].nodeType}catch(Et){et={apply:J.length?function(e,t){Z.apply(e,tt.call(t))}:function(e,t){for(var n=e.length,i=0;e[n++]=t[i++];);e.length=n-1}}}_=n.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},C=n.support={},L=n.setDocument=function(e){var t=e?e.ownerDocument||e:$,n=t.defaultView;return t!==M&&9===t.nodeType&&t.documentElement?(M=t,A=t.documentElement,R=!_(t),n&&n.attachEvent&&n!==n.top&&n.attachEvent("onbeforeunload",function(){L()}),C.attributes=o(function(e){return e.className="i",!e.getAttribute("className")}),C.getElementsByTagName=o(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),C.getElementsByClassName=o(function(e){return e.innerHTML="",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),C.getById=o(function(e){return A.appendChild(e).id=j,!t.getElementsByName||!t.getElementsByName(j).length}),C.getById?(E.find.ID=function(e,t){if(typeof t.getElementById!==Q&&R){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},E.filter.ID=function(e){var t=e.replace(Ct,Tt);return function(e){return e.getAttribute("id")===t}}):(delete E.find.ID,E.filter.ID=function(e){var t=e.replace(Ct,Tt);return function(e){var n=typeof e.getAttributeNode!==Q&&e.getAttributeNode("id");return n&&n.value===t}}),E.find.TAG=C.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==Q?t.getElementsByTagName(e):void 0}:function(e,t){var n,i=[],r=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},E.find.CLASS=C.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==Q&&R?t.getElementsByClassName(e):void 0},F=[],P=[],(C.qsa=bt.test(t.querySelectorAll))&&(o(function(e){e.innerHTML="",e.querySelectorAll("[selected]").length||P.push("\\["+rt+"*(?:value|"+it+")"),e.querySelectorAll(":checked").length||P.push(":checked")}),o(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&P.push("[*^$]="+rt+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||P.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),P.push(",.*:")})),(C.matchesSelector=bt.test(O=A.webkitMatchesSelector||A.mozMatchesSelector||A.oMatchesSelector||A.msMatchesSelector))&&o(function(e){C.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),F.push("!=",ct)}),P=P.length&&new RegExp(P.join("|")),F=F.length&&new RegExp(F.join("|")),B=bt.test(A.contains)||A.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},W=A.compareDocumentPosition?function(e,n){if(e===n)return V=!0,0;var i=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return i?1&i||!C.sortDetached&&n.compareDocumentPosition(e)===i?e===t||B($,e)?-1:n===t||B($,n)?1:N?nt.call(N,e)-nt.call(N,n):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var i,r=0,o=e.parentNode,a=n.parentNode,l=[e],c=[n];if(e===n)return V=!0,0;if(!o||!a)return e===t?-1:n===t?1:o?-1:a?1:N?nt.call(N,e)-nt.call(N,n):0;if(o===a)return s(e,n);for(i=e;i=i.parentNode;)l.unshift(i);for(i=n;i=i.parentNode;)c.unshift(i);for(;l[r]===c[r];)r++;return r?s(l[r],c[r]):l[r]===$?-1:c[r]===$?1:0},t):M},n.matches=function(e,t){return n(e,null,null,t)},n.matchesSelector=function(e,t){if((e.ownerDocument||e)!==M&&L(e),t=t.replace(ht,"='$1']"),!(!C.matchesSelector||!R||F&&F.test(t)||P&&P.test(t)))try{var i=O.call(e,t);if(i||C.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(r){}return n(t,M,null,[e]).length>0},n.contains=function(e,t){return(e.ownerDocument||e)!==M&&L(e),B(e,t)},n.attr=function(e,n){(e.ownerDocument||e)!==M&&L(e);var i=E.attrHandle[n.toLowerCase()],r=i&&K.call(E.attrHandle,n.toLowerCase())?i(e,n,!R):t;return r===t?C.attributes||!R?e.getAttribute(n):(r=e.getAttributeNode(n))&&r.specified?r.value:null:r},n.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},n.uniqueSort=function(e){var t,n=[],i=0,r=0;if(V=!C.detectDuplicates,N=!C.sortStable&&e.slice(0),e.sort(W),V){for(;t=e[r++];)t===e[r]&&(i=n.push(r));for(;i--;)e.splice(n[i],1)}return e},k=n.getText=function(e){var t,n="",i=0,r=e.nodeType;if(r){if(1===r||9===r||11===r){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=k(e)}else if(3===r||4===r)return e.nodeValue}else for(;t=e[i];i++)n+=k(t);return n},E=n.selectors={cacheLength:50,createPseudo:r,match:vt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Ct,Tt),e[3]=(e[4]||e[5]||"").replace(Ct,Tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||n.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&n.error(e[0]),e},PSEUDO:function(e){var n,i=!e[5]&&e[2];return vt.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:i&&mt.test(i)&&(n=p(i,!0))&&(n=i.indexOf(")",i.length-n)-i.length)&&(e[0]=e[0].slice(0,n),e[2]=i.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Ct,Tt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=U[e+" "];return t||(t=new RegExp("(^|"+rt+")"+e+"("+rt+"|$)"))&&U(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==Q&&e.getAttribute("class")||"")})},ATTR:function(e,t,i){return function(r){var o=n.attr(r,e);return null==o?"!="===t:t?(o+="","="===t?o===i:"!="===t?o!==i:"^="===t?i&&0===o.indexOf(i):"*="===t?i&&o.indexOf(i)>-1:"$="===t?i&&o.slice(-i.length)===i:"~="===t?(" "+o+" ").indexOf(i)>-1:"|="===t?o===i||o.slice(0,i.length+1)===i+"-":!1):!0}},CHILD:function(e,t,n,i,r){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===i&&0===r?function(e){return!!e.parentNode}:function(t,n,l){var c,u,d,p,f,h,m=o!==a?"nextSibling":"previousSibling",g=t.parentNode,v=s&&t.nodeName.toLowerCase(),b=!l&&!s;if(g){if(o){for(;m;){for(d=t;d=d[m];)if(s?d.nodeName.toLowerCase()===v:1===d.nodeType)return!1;h=m="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?g.firstChild:g.lastChild],a&&b){for(u=g[j]||(g[j]={}),c=u[e]||[],f=c[0]===G&&c[1],p=c[0]===G&&c[2],d=f&&g.childNodes[f];d=++f&&d&&d[m]||(p=f=0)||h.pop();)if(1===d.nodeType&&++p&&d===t){u[e]=[G,f,p];break}}else if(b&&(c=(t[j]||(t[j]={}))[e])&&c[0]===G)p=c[1];else for(;(d=++f&&d&&d[m]||(p=f=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==v:1!==d.nodeType)||!++p||(b&&((d[j]||(d[j]={}))[e]=[G,p]),d!==t)););return p-=r,p===i||p%i===0&&p/i>=0}}},PSEUDO:function(e,t){var i,o=E.pseudos[e]||E.setFilters[e.toLowerCase()]||n.error("unsupported pseudo: "+e);return o[j]?o(t):o.length>1?(i=[e,e,"",t],E.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,n){for(var i,r=o(e,t),a=r.length;a--;)i=nt.call(e,r[a]),e[i]=!(n[i]=r[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=I(e.replace(ut,"$1"));return i[j]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),!n.pop()}}),has:r(function(e){return function(t){return n(e,t).length>0}}),contains:r(function(e){return function(t){return(t.textContent||t.innerText||k(t)).indexOf(e)>-1}}),lang:r(function(e){return gt.test(e||"")||n.error("unsupported lang: "+e),e=e.replace(Ct,Tt).toLowerCase(),function(t){var n;do if(n=R?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===A},focus:function(e){return e===M.activeElement&&(!M.hasFocus||M.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!E.pseudos.empty(e)},header:function(e){return wt.test(e.nodeName)},input:function(e){return xt.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:u(function(){return[0]}),last:u(function(e,t){return[t-1] -}),eq:u(function(e,t,n){return[0>n?n+t:n]}),even:u(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:u(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:u(function(e,t,n){for(var i=0>n?n+t:n;--i>=0;)e.push(i);return e}),gt:u(function(e,t,n){for(var i=0>n?n+t:n;++iAdds extra features to the original Markdown syntax.
\nAdds extra features to the original Markdown syntax.
\n"+i+"\n
","\n\n"+i+"\n\n"+r}),e=e.replace(/~0/,"")}function v(e){return e=e.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(O.push(e)-1)+"K\n\n"}function b(e){return e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,t,n,i){var r=i;return r=r.replace(/^([ \t]*)/g,""),r=r.replace(/[ \t]*$/g,""),r=y(r),r=r.replace(/:\/\//g,"~P"),t+""+r+"
"})}function y(e){return e=e.replace(/&/g,"&"),e=e.replace(//g,">"),e=L(e,"*_{}[]\\",!1)}function x(e){return e=e.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g,"$1$3$4"),e=e.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g,"$1$3$4")}function w(e){return e=e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,t){var n=t;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=o(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*[^\r]+?<\/pre>)/gm,function(e,t){var n=t;return n=n.replace(/^ /gm,"~0"),n=n.replace(/~0/g,"")}),v("\n"+n+"\n")})}function S(e,t){e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,"");for(var n=e.split(/\n{2,}/g),i=[],r=/~K(\d+)K/,o=n.length,s=0;o>s;s++){var l=n[s];r.test(l)?i.push(l):/\S/.test(l)&&(l=a(l),l=l.replace(/^([ \t]*)/g,""),l+="
",i.push(l))}if(!t){o=i.length;for(var s=0;o>s;s++)for(var c=!0;c;)c=!1,i[s]=i[s].replace(/~K(\d+)K/g,function(e,t){return c=!0,O[t]})}return i.join("\n\n")}function C(e){return e=e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),e=e.replace(/<(?![a-z\/?!]|~D)/gi,"<")}function T(e){return e=e.replace(/\\(\\)/g,M),e=e.replace(/\\([`*_{}\[\]()>#+-.!])/g,M)}function E(e,t,n,i){if(t)return e;if(")"!==i.charAt(i.length-1))return"<"+n+i+">";for(var r=i.match(/[()]/g),o=0,a=0;a=o?o=1:o++:o--;var s="";if(0>o){var l=new RegExp("\\){1,"+-o+"}$");i=i.replace(l,function(e){return s=e,""})}if(s){var c=i.charAt(i.length-1);H.test(c)||(s=c+s,i=i.substr(0,i.length-1))}return"<"+n+i+">"+s}function k(e){e=e.replace(U,E);var t=function(e,t){return''+R.plainLinkText(t)+""};return e=e.replace(/<((https?|ftp):[^'">\s]+)>/gi,t)}function _(e){return e=e.replace(/~E(\d+)E/g,function(e,t){var n=parseInt(t);return String.fromCharCode(n)})}function I(e){return e=e.replace(/^(\t|[ ]{1,4})/gm,"~0"),e=e.replace(/~0/g,"")}function D(e){if(!/\t/.test(e))return e;var t,n=[" "," "," "," "],i=0;return e.replace(/[\n\t]/g,function(e,r){return"\n"===e?(i=r+1,e):(t=(r-i)%4,i=r+1,n[t])})}function N(e){if(!e)return"";e.length;return e.replace(z,function(e){return"~D"==e?"%24":":"==e?":":"%"+e.charCodeAt(0).toString(16)})}function L(e,t,n){var i="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(i="\\\\"+i);var r=new RegExp(i,"g");return e=e.replace(r,M)}function M(e,t){var n=t.charCodeAt(0);return"~E"+n+"E"}var A={};this.setOptions=function(e){A=e};var R=this.hooks=new n;R.addNoop("plainLinkText"),R.addNoop("preConversion"),R.addNoop("postNormalization"),R.addNoop("preBlockGamut"),R.addNoop("postBlockGamut"),R.addNoop("preSpanGamut"),R.addNoop("postSpanGamut"),R.addNoop("postConversion");var P,F,O,B;this.makeHtml=function(n){if(P)throw new Error("Recursive call to converter.makeHtml");return P=new i,F=new i,O=[],B=0,n=R.preConversion(n),n=n.replace(/~/g,"~T"),n=n.replace(/\$/g,"~D"),n=n.replace(/\r\n/g,"\n"),n=n.replace(/\r/g,"\n"),n="\n\n"+n+"\n\n",n=D(n),n=n.replace(/^[ \t]+$/gm,""),n=R.postNormalization(n),n=t(n),n=e(n),n=o(n),n=_(n),n=n.replace(/~D/g,"$$"),n=n.replace(/~T/g,"~"),n=R.postConversion(n),O=F=P=null,n};var j=function(e){return o(e)},$={ol:"\\d+[.]",ul:"[*+-]"},G="[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]",q="[-A-Z0-9+&@#/%=~_|[\\])]",U=new RegExp('(="|<)?\\b(https?|ftp)(://'+G+"*"+q+")(?=$|\\W)","gi"),H=new RegExp(q,"i"),z=/(?:["'*()[\]:]|~D)/g}}(),define("libs/Markdown.Converter",function(){}),function(){function e(e){return e.replace(/^\s+|\s+$/g,"")}function t(e){return e.replace(/\s+$/g,"")}function n(e){return e.replace(new RegExp("^(\\t|[ ]{1,4})","gm"),"")}function i(e,t){return-1!=e.indexOf(t)}function r(e,t){return e.replace(/<[^>]*>?/gi,function(e){return e.match(t)?e:""})}function o(e,t){for(var n={},i=0;i ]*>|","<(br)\\s?\\/?>)$"].join(""),"i");Array.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t ~X"+(this.hashBlocks.push(e)-1)+"X\n"},Markdown.Extra.prototype.hashExtraInline=function(e){return"~X"+(this.hashBlocks.push(e)-1)+"X"},Markdown.Extra.prototype.unHashExtraBlocks=function(e){function t(){var i=!1;e=e.replace(/(?: )?~X(\d+)X(?:<\/p>)?/g,function(e,t){i=!0;var r=parseInt(t,10);return n.hashBlocks[r]}),i===!0&&t()}var n=this;return t(),e},Markdown.Extra.prototype.wrapHeaders=function(e){function t(e){return"\n"+e+"\n"}return e=e.replace(/^.+[ \t]*\n=+[ \t]*\n+/gm,t),e=e.replace(/^.+[ \t]*\n-+[ \t]*\n+/gm,t),e=e.replace(/^\#{1,6}[ \t]*.+?[ \t]*\#*\n+/gm,t)};var g="\\{[ \\t]*((?:[#.][-_:a-zA-Z0-9]+[ \\t]*)+)\\}",v=new RegExp("^(#{1,6}.*#{0,6})[ \\t]+"+g+"[ \\t]*(?:\\n|0x03)","gm"),b=new RegExp("^(.*)[ \\t]+"+g+"[ \\t]*\\n(?=[\\-|=]+\\s*(?:\\n|0x03))","gm"),y=new RegExp("^(```[ \\t]*[^{\\s]*)[ \\t]+"+g+"[ \\t]*\\n(?=([\\s\\S]*?)\\n```[ \\t]*(\\n|0x03))","gm");Markdown.Extra.prototype.hashHeaderAttributeBlocks=function(e){function t(e,t,i){return"
~XX"+(n.hashBlocks.push(i)-1)+"XX
\n"+t+"\n"}var n=this;return e=e.replace(v,t),e=e.replace(b,t)},Markdown.Extra.prototype.hashFcbAttributeBlocks=function(e){function t(e,t,i){return"~XX"+(n.hashBlocks.push(i)-1)+"XX
\n"+t+"\n"}var n=this;return e.replace(y,t)},Markdown.Extra.prototype.applyAttributeBlocks=function(e){var t=this,n=new RegExp('~XX(\\d+)XX
[\\s]*(?:<(h[1-6]|pre)(?: +class="(\\S+)")?(>[\\s\\S]*?\\2>))',"gm");return e=e.replace(n,function(e,n,i,r,a){if(!i)return"";for(var s=parseInt(n,10),l=t.hashBlocks[s],c=l.match(/#[^\s#.]+/g)||[],u=c[0]?' id="'+c[0].substr(1,c[0].length-1)+'"':"",d=l.match(/\.[^\s#.]+/g)||[],p=0;p0&&(f=' class="'+d.join(" ")+'"'),"<"+i+u+f+a})},Markdown.Extra.prototype.tables=function(t){function n(t,n,r,o){n=n.replace(/^ *[|]/m,""),r=r.replace(/^ *[|]/m,""),o=o.replace(/^ *[|]/gm,""),n=n.replace(/[|] *$/m,""),r=r.replace(/[|] *$/m,""),o=o.replace(/[|] *$/gm,""),alignspecs=r.split(/ *[|] */),align=[];for(var a=0;a \n","\n"," \n"].join("");for(a=0;u>a;a++){var f=l(e(c[a]),i);p+=[" \n\n";var h=o.split("\n");for(a=0;a",f," \n"].join("")}p+="v;v++)m.push("");for(p+=" \n",v=0;u>v;v++){var b=l(e(m[v]),i);p+=[" \n"}return p+="\n",i.hashExtraBlock(p)}var i=this,r=new RegExp(["^","[ ]{0,3}","[|]","(.+)\\n","[ ]{0,3}","[|]([ ]*[-:]+[-| :]*)\\n","(","(?:[ ]*[|].*\\n?)*",")","(?:\\n|$)"].join(""),"gm"),o=new RegExp(["^","[ ]{0,3}","(\\S.*[|].*)\\n","[ ]{0,3}","([-:]+[ ]*[|][-| :]*)\\n","(","(?:.*[|].*\\n?)*",")","(?:\\n|$)"].join(""),"gm");return t=t.replace(r,n),t=t.replace(o,n)},Markdown.Extra.prototype.stripFootnoteDefinitions=function(e){var t=this;return e=e.replace(/\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/g,function(e,n,i){return n=f(n),i+="\n",i=i.replace(/^[ ]{0,3}/g,""),t.footnotes[n]=i,"\n"})},Markdown.Extra.prototype.doFootnotes=function(e){var t=this;if(t.isConvertingFootnote===!0)return e;var n=0;return e=e.replace(/\[\^(.+?)\]/g,function(e,i){var r=f(i),o=t.footnotes[r];if(void 0===o)return e;n++,t.usedFootnotes.push(r);var a=''+n+"";return t.hashExtraInline(a)})},Markdown.Extra.prototype.printFootnotes=function(e){var t=this; -if(0===t.usedFootnotes.length)return e;e+='\n\n",b," \n"].join("")}p+="\n"},Markdown.Extra.prototype.fencedCodeBlocks=function(e){function t(e){return e=e.replace(/&/g,"&"),e=e.replace(//g,">"),e=e.replace(/~D/g,"$$"),e=e.replace(/~T/g,"~")}var n=this;return e=e.replace(/(?:^|\n)```[ \t]*(\S*)[ \t]*\n([\s\S]*?)\n```[ \t]*(?=\n)/g,function(e,i,r){var o=i,a=r,s=n.googleCodePrettify?' class="prettyprint"':"",l="";o&&(l=n.googleCodePrettify||n.highlightJs?' class="language-'+o+'"':' class="'+o+'"');var c=["
\n\n\n';for(var n=0;n
\n'+o+' ↩\n\n'}return e+=" "].join("");return n.hashExtraBlock(c)})},Markdown.Extra.prototype.educatePants=function(e){var t=this,n="",i=0;e.replace(/(?:)|(<)([a-zA-Z1-6]+)([^\n]*?>)([\s\S]*?)(<\/\2>)/g,function(r,o,a,s,l,c,u){var d=e.substring(i,u);return n+=t.applyPants(d),t.smartyPantsLastChar=n.substring(n.length-1),i=u+r.length,o?(/code|kbd|pre|script|noscript|iframe|math|ins|del|pre/i.test(a)?t.smartyPantsLastChar=l.substring(l.length-1):l=t.educatePants(l),void(n+=o+a+s+l+c)):void(n+=r)});var r=e.substring(i);return n+=t.applyPants(r),t.smartyPantsLastChar=n.substring(n.length-1),n},Markdown.Extra.prototype.applyPants=function(e){return e=e.replace(/---/g,"—").replace(/--/g,"–"),e=e.replace(/\.\.\./g,"…").replace(/\.\s\.\s\./g,"…"),e=e.replace(/``/g,"“").replace(/''/g,"”"),/^'$/.test(e)?/\S/.test(this.smartyPantsLastChar)?"’":"‘":/^"$/.test(e)?/\S/.test(this.smartyPantsLastChar)?"”":"“":(e=e.replace(/^'(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/,"’"),e=e.replace(/^"(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/,"”"),e=e.replace(/"'(?=\w)/g,"“‘"),e=e.replace(/'"(?=\w)/g,"‘“"),e=e.replace(/'(?=\d{2}s)/g,"’"),e=e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)'(?=\w)/g,"$1‘"),e=e.replace(/([^\s\[\{\(\-])'/g,"$1’"),e=e.replace(/'(?=\s|s\b)/g,"’"),e=e.replace(/'/g,"‘"),e=e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)"(?=\w)/g,"$1“"),e=e.replace(/([^\s\[\{\(\-])"/g,"$1”"),e=e.replace(/"(?=\s)/g,"”"),e=e.replace(/"/gi,"“"))},Markdown.Extra.prototype.runSmartyPants=function(e){return this.smartyPantsLastChar="",e=this.educatePants(e),e=e.replace(/(<([a-zA-Z1-6]+)\b([^\n>]*?)(\/)?>)/g,h)},Markdown.Extra.prototype.definitionLists=function(t){var n=new RegExp(["(\\x02\\n?|\\n\\n)","(?:","(","(","[ ]{0,3}","((?:[ \\t]*\\S.*\\n)+)","\\n?","[ ]{0,3}:[ ]+",")","([\\s\\S]+?)","(","(?=\\0x03)","|","(?=","\\n{2,}","(?=\\S)","(?!","[ ]{0,3}","(?:\\S.*\\n)+?","\\n?","[ ]{0,3}:[ ]+",")","(?!","[ ]{0,3}:[ ]+",")",")",")",")",")"].join(""),"gm"),i=this;return t=a(t),t=t.replace(n,function(t,n,r){var o=e(i.processDefListItems(r));return o="",t(a),"
\n"+o+"\n
",n+i.hashExtraBlock(o)+"\n\n"}),s(t)},Markdown.Extra.prototype.processDefListItems=function(i){var r=this,o=new RegExp(["(\\x02\\n?|\\n\\n+)","(","[ ]{0,3}","(?![:][ ]|[ ])","(?:\\S.*\\n)+?",")","(?=\\n?[ ]{0,3}:[ ])"].join(""),"gm"),u=new RegExp(["\\n(\\n+)?","(","[ ]{0,3}","[:][ ]+",")","([\\s\\S]+?)","(?=\\n*","(?:","\\n[ ]{0,3}[:][ ]|","|\\x03",")",")"].join(""),"gm");return i=a(i),i=i.replace(/\n{2,}(?=\\x03)/,"\n"),i=i.replace(o,function(t,n,i){for(var o=e(i).split("\n"),a="",s=0;s "}return a+"\n"}),i=i.replace(u,function(e,i,o,a){return i||a.match(/\n{2,}/)?(a=Array(o.length+1).join(" ")+a,a=n(a)+"\n\n",a="\n"+c(a,r)+"\n"):(a=t(a),a=l(n(a),r)),"\n"+c+" "+a+" \n"}),s(i)},Markdown.Extra.prototype.strikethrough=function(e){return e.replace(/([\W_]|^)~T~T(?=\S)([^\r]*?\S[\*_]*)~T~T([\W_]|$)/g,"$1$2$3")},Markdown.Extra.prototype.newlines=function(e){return e.replace(/(<(?:br|\/li)>)?\n/g,function(e,t){return t?e:"
\n"})}}(),define("pagedown-extra",function(){}),define("extensions/markdownExtra",["jquery","underscore","utils","classes/Extension","text!html/markdownExtraSettingsBlock.html","google-code-prettify","highlightjs","pagedown-extra"],function(e,t,n,i,r,o,a){var s=new i("markdownExtra","Markdown Extra",!0);s.settingsBlock=r,s.defaultConfig={extensions:["fenced_code_gfm","tables","def_list","attr_list","footnotes","smartypants","strikethrough","newlines"],intraword:!0,comments:!0,highlighter:"prettify"},s.onLoadSettings=function(){function e(e){return t.some(s.config.extensions,function(t){return t==e})}n.setInputChecked("#input-markdownextra-fencedcodegfm",e("fenced_code_gfm")),n.setInputChecked("#input-markdownextra-tables",e("tables")),n.setInputChecked("#input-markdownextra-deflist",e("def_list")),n.setInputChecked("#input-markdownextra-attrlist",e("attr_list")),n.setInputChecked("#input-markdownextra-footnotes",e("footnotes")),n.setInputChecked("#input-markdownextra-smartypants",e("smartypants")),n.setInputChecked("#input-markdownextra-strikethrough",e("strikethrough")),n.setInputChecked("#input-markdownextra-newlines",e("newlines")),n.setInputChecked("#input-markdownextra-intraword",s.config.intraword),n.setInputChecked("#input-markdownextra-comments",s.config.comments),n.setInputValue("#input-markdownextra-highlighter",s.config.highlighter)},s.onSaveSettings=function(e){e.extensions=[],n.getInputChecked("#input-markdownextra-fencedcodegfm")&&e.extensions.push("fenced_code_gfm"),n.getInputChecked("#input-markdownextra-tables")&&e.extensions.push("tables"),n.getInputChecked("#input-markdownextra-deflist")&&e.extensions.push("def_list"),n.getInputChecked("#input-markdownextra-attrlist")&&e.extensions.push("attr_list"),n.getInputChecked("#input-markdownextra-footnotes")&&e.extensions.push("footnotes"),n.getInputChecked("#input-markdownextra-smartypants")&&e.extensions.push("smartypants"),n.getInputChecked("#input-markdownextra-strikethrough")&&e.extensions.push("strikethrough"),n.getInputChecked("#input-markdownextra-newlines")&&e.extensions.push("newlines"),e.intraword=n.getInputChecked("#input-markdownextra-intraword"),e.comments=n.getInputChecked("#input-markdownextra-comments"),e.highlighter=n.getInputValue("#input-markdownextra-highlighter")};var l;return s.onEventMgrCreated=function(e){l=e},s.onPagedownConfigure=function(e){var n=e.getConverter();if(s.config.intraword===!0){var i={_DoItalicsAndBold:function(e){return e=e.replace(/([^\w*]|^)(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\2(?=[^\w*]|$)/g,"$1$3"),e=e.replace(/([^\w*]|^)(\*|_)(?=\S)(.+?)(?=\S)\2(?=[^\w*]|$)/g,"$1$3")}};n.setOptions(i)}s.config.comments===!0&&n.hooks.chain("postConversion",function(e){return e.replace(//g,function(e){return e.replace(/^$/,' $1 ')})});var r={extensions:s.config.extensions};if("highlight"==s.config.highlighter){r.highlighter="prettify";var l=document.getElementById("preview-contents");e.hooks.chain("onPreviewRefresh",function(){t.each(l.querySelectorAll(".prettyprint > code"),function(e){!e.highlighted&&a.highlightBlock(e),e.highlighted=!0})})}else"prettify"==s.config.highlighter&&(r.highlighter="prettify",e.hooks.chain("onPreviewRefresh",o.prettyPrint));Markdown.Extra.init(n,r)},s}),define("text!html/mathJaxSettingsBlock.html",[],function(){return'Allows StackEdit to interpret LaTeX mathematical expressions.
\n\n\nMore info'}),define("text!libs/mathjax_config.js",[],function(){return'MathJax.Hub.Config({\n "HTML-CSS": {\n preferredFont: "TeX",\n availableFonts: [\n "STIX",\n "TeX"\n ],\n linebreaks: {\n automatic: true\n },\n EqnChunk: 10,\n imageFont: null\n },\n tex2jax: <%= tex2jax || \'{ inlineMath: [["$","$"],["\\\\\\\\\\\\\\\\(","\\\\\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\\\\\[","\\\\\\\\]"]], processEscapes: true }\' %>,\n TeX: $.extend({\n noUndefined: {\n attributes: {\n mathcolor: "red",\n mathbackground: "#FFEEEE",\n mathsize: "90%"\n }\n },\n Safe: {\n allow: {\n URLs: "safe",\n classes: "safe",\n cssIDs: "safe",\n styles: "safe",\n fontsize: "all"\n }\n }\n }, <%= tex %>),\n messageStyle: "none"\n});\n'}),define("libs/mathjax_init",["settings","text!libs/mathjax_config.js"],function(e,t){var n=document.createElement("script");n.type="text/x-mathjax-config",n.innerHTML=_.template(t,{tex:e.extensionSettings.mathJax?e.extensionSettings.mathJax.tex:"undefined",tex2jax:e.extensionSettings.mathJax?e.extensionSettings.mathJax.tex2jax:void 0}),document.getElementsByTagName("head")[0].appendChild(n)}),define("extensions/mathJax",["utils","classes/Extension","text!html/mathJaxSettingsBlock.html","mathjax"],function(e,t,n){function i(e,t,n){var i=u.slice(e,t+1).join("").replace(/&/g,"&").replace(//g,">");for(x.Browser.isMSIE&&(i=i.replace(/(%[^\n]*)\n/g,"$1\n \n\n\n \n\n\n \n\n\n \n\n
\n"));t>e;)u[t]="",t--;u[e]="@@"+m.length+"@@",n&&(i=n(i)),m.push(i),d=p=f=null}function r(e){d=p=f=null,m=[];var t;/`/.test(e)?(e=e.replace(/~/g,"~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm,function(e){return e.replace(/\$/g,"~D")}),t=function(e){return e.replace(/~([TD])/g,function(e,t){return{T:"~",D:"$"}[t]})}):t=function(e){return e},u=w(e.replace(/\r\n?/g,"\n"),S);for(var e=1,n=u.length;n>e;e+=2){var r=u[e];"@"===r.charAt(0)?(u[e]="@@"+m.length+"@@",m.push(r)):d?r===p?h?f=e:i(d,e,t):r.match(/\n.*\n/)?(f&&(e=f,i(d,e,t)),d=p=f=null,h=0):"{"===r?h++:"}"===r&&h&&h--:r===y||"$$"===r?(d=e,p=r,h=0):"begin"===r.substr(1,5)&&(d=e,p="\\end"+r.substr(6),h=0)}return f&&i(d,f,t),t(u.join(""))}function o(e){return e=e.replace(/@@(\d+)@@/g,function(e,t){return m[t]}),m=null,e}function a(){v=!1,x.cancelTypeset=!1,x.Queue(["Typeset",x,b]),x.Queue(c)}function s(){!v&&(v=!0,x.Cancel(),x.Queue(a))}var l=new t("mathJax","MathJax",!0);l.settingsBlock=n,l.defaultConfig={tex:"{}",tex2jax:'{ inlineMath: [["$","$"],["\\\\\\\\(","\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true }'},l.onLoadSettings=function(){e.setInputValue("#input-mathjax-config-tex",l.config.tex),e.setInputValue("#input-mathjax-config-tex2jax",l.config.tex2jax)},l.onSaveSettings=function(t,n){t.tex=e.getInputJsValue("#input-mathjax-config-tex",n),t.tex2jax=e.getInputJsValue("#input-mathjax-config-tex2jax",n)},l.onPagedownConfigure=function(e){b=document.getElementById("preview-contents");var t=e.getConverter();t.hooks.chain("preConversion",r),t.hooks.chain("postConversion",o)};var c;l.onAsyncPreview=function(e){c=e,s()};var u,d,p,f,h,m,g=!1,v=!1,b=null,y="$",x=MathJax.Hub;x.Queue(function(){g=!0,x.processUpdateTime=50,x.Config({"HTML-CSS":{EqnChunk:10,EqnChunkFactor:1},SVG:{EqnChunk:10,EqnChunkFactor:1}})});var w,S=/(\$\$|\\(?:begin|end)\{[a-z]*\*?\}|\\[\\{}$]|[{}]|(?:\n\s*)+|@@\d+@@)/i;return w=3==="aba".split(/(b)/).length?function(e,t){return e.split(t)}:function(e,t){var n,i=[];if(!t.global){n=t.toString();var r="";n=n.replace(/^\/(.*)\/([im]*)$/,function(e,t,n){return r=n,t}),t=RegExp(n,r+"g")}for(var o=t.lastIndex=0;n=t.exec(e);)i.push(e.substring(o,n.index)),i.push.apply(i,n.slice(1)),o=n.index+n[0].length;return i.push(e.substring(o)),i},function(){var e=MathJax.Hub;if(!e.Cancel){e.cancelTypeset=!1,e.Register.StartupHook("HTML-CSS Jax Config",function(){var t=MathJax.OutputJax["HTML-CSS"],n=t.Translate;t.Augment({Translate:function(i,r){if(e.cancelTypeset||r.cancelled)throw Error("MathJax Canceled");return n.call(t,i,r)}})}),e.Register.StartupHook("SVG Jax Config",function(){var t=MathJax.OutputJax.SVG,n=t.Translate;t.Augment({Translate:function(i,r){if(e.cancelTypeset||r.cancelled)throw Error("MathJax Canceled");return n.call(t,i,r)}})}),e.Register.StartupHook("TeX Jax Config",function(){var t=MathJax.InputJax.TeX,n=t.Translate;t.Augment({Translate:function(i,r){if(e.cancelTypeset||r.cancelled)throw Error("MathJax Canceled");return n.call(t,i,r)}})});var t=e.processError;e.processError=function(n,i,r){return"MathJax Canceled"!==n.message?t.call(e,n,i,r):(MathJax.Message.Clear(0,0),i.jaxIDs=[],i.jax={},i.scripts=[],i.i=i.j=0,i.cancelled=!0,null)},e.Cancel=function(){this.cancelTypeset=!0}}}(),l}),define("text!html/partialRenderingSettingsBlock.html",[],function(){return"Renders modified sections only.
\n\n Note: Document sections are based on title elements (h1, h2...). Therefore if\n your document does not contain any title, performance will not be increased.\n"}),define("extensions/partialRendering",["underscore","crel","extensions/markdownExtra","classes/Extension","text!html/partialRenderingSettingsBlock.html"],function(e,t,n,i,r){function o(){var t=[],n="\n";if(m=!1,e.each(g,function(e){var i='\n\n\n'+e.text+"\n\n";h&&(i=i.replace(/^```.*\n[\s\S]*?\n```|\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/gm,function(e,t){return t?(m=!0,n+=e.replace(/^\s*\n/gm,"")+"\n",""):e})),i=i.replace(/^```.*\n[\s\S]*?\n```|^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(e,t){return t?(n+=e.replace(/^\s*\n/gm,"")+"\n",""):e}),t.push({id:e.id,text:i+"\n"})}),y=[],b=[],d=void 0,x===!0||u!=n)return x=!1,u=n,b=v,v=t,void(y=t);var i=v.length;e.some(v,function(e,n){return n>=t.length||e.text!=t[n].text?(i=n,!0):void 0});var r=-v.length;e.some(v.slice().reverse(),function(e,n){return n>=t.length||e.text!=t[t.length-n-1].text?(r=-n,!0):void 0}),i-r>v.length&&(r=i-v.length);var o=v.slice(0,i);y=t.slice(i,t.length+r);var a=v.slice(v.length+r,v.length);d=e.first(a),b=v.slice(i,v.length+r),v=o.concat(y).concat(a)}function a(e){var t=e.id.substring(3);w[t]=e}function s(){function n(n){for(var i=t("div",{id:"wmd-preview-section-"+n.id,"class":"wmd-preview-section preview-content"}),o=!1;r;){var s=r.nextSibling,l="se-preview-section-delimiter"==r.className;if(o===!0&&"DIV"==r.tagName&&l)break;o=!0,"DIV"==r.tagName&&"footnotes"==r.className?e.each(r.querySelectorAll("ol > li"),a):l||i.appendChild(r),r=s}return i}e.each(b,function(e){var t=document.getElementById("wmd-preview-section-"+e.id);f.removeChild(t)});var i=document.getElementById("wmd-preview"),r=i.firstChild,o=document.createDocumentFragment();e.each(y,function(e){o.appendChild(n(e))}),i.innerHTML="";var s=p;void 0!==d&&(s=document.getElementById("wmd-preview-section-"+d.id)),f.insertBefore(o,s),p.innerHTML="";var l=[];if(m===!0){var c=t("ol");e.each(f.querySelectorAll("a.footnote"),function(e,t){e.textContent=t+1;var n=e.id.substring(6);l.push(n),c.appendChild(w[n].cloneNode(!0))}),l.length>0&&p.appendChild(t("div",{"class":"footnotes"},t("hr"),c)),w=e.pick(w,l)}}var l=new i("partialRendering","Partial Rendering",!0);l.settingsBlock=r;var c,u,d,p,f,h=!1,m=!1,g=[],v=[],b=[],y=[],x=!1,w={};return l.onSectionsCreated=function(e){g=e},l.onPagedownConfigure=function(t){c=t.getConverter(),c.hooks.chain("preConversion",function(){o();var t=e.map(y,function(e){return e.text});return t.push(u+"\n\n"),t.join("")}),t.hooks.chain("onPreviewRefresh",function(){s()})},l.onInit=function(){n.enabled&&e.some(n.config.extensions,function(e){return"footnotes"==e})&&(h=!0)},l.onReady=function(){p=t("div",{id:"wmd-preview-section-footnotes","class":"preview-content"}),f=document.getElementById("preview-contents"),f.appendChild(p)},l.onFileSelected=function(){x=!0},l}),define("extensions/markdownSectionParser",["underscore","extensions/markdownExtra","extensions/mathJax","extensions/partialRendering","classes/Extension","crel"],function(e,t,n,i,r,o){function a(e,t){function n(e,t){var n=o.substring(a,t);u.push({id:++f,text:n,textWithFrontMatter:i+n}),i=""}if(e===p){var i=(p.frontMatter||{})._frontMatter||"",r=t.substring(i.length),o=r+"\n\n";u=[];var a=0;o.replace(d,function(e,t){n(a,t),a=t}),n(a,r.length),s.onSectionsCreated(u)}}var s,l=new r("markdownSectionParser","Markdown section parser");l.onEventMgrCreated=function(e){s=e};var c,u=[],d="^.+[ \\t]*\\n=+[ \\t]*\\n+|^.+[ \\t]*\\n-+[ \\t]*\\n+|^\\#{1,6}[ \\t]*.+?[ \\t]*\\#*\\n+";l.onPagedownConfigure=function(r){t.enabled&&e.some(t.config.extensions,function(e){return"fenced_code_gfm"==e})&&(d="^```.*\\n[\\s\\S]*?\\n```|"+d),n.enabled&&(d="^[ \\t]*\\n\\$\\$[\\s\\S]*?\\$\\$|"+d,d="^[ \\t]*\\n\\\\\\\\[[\\s\\S]*?\\\\\\\\]|"+d,d="^[ \\t]*\\n\\\\?\\\\begin\\{[a-z]*\\*?\\}[\\s\\S]*?\\\\end\\{[a-z]*\\*?\\}|"+d),d=new RegExp(d,"gm");var a=r.getConverter();i.enabled||(a.hooks.chain("preConversion",function(){return e.reduce(u,function(e,t){return e+'\n\n\n'+t.text+"\n\n"},"")}),r.hooks.chain("onPreviewRefresh",function(){function e(){for(var e=o("div",{"class":"wmd-preview-section preview-content"}),t=!1;n;){var i=n.nextSibling,r="se-preview-section-delimiter"==n.className;if(t===!0&&"DIV"==n.tagName&&r)break;t=!0,r||e.appendChild(n),n=i}return e}var t=document.getElementById("wmd-preview"),n=t.firstChild,i=document.createDocumentFragment();u.forEach(function(t){i.appendChild(e(t))}),c.innerHTML="",c.appendChild(t),c.appendChild(i)}))},l.onReady=function(){c=document.getElementById("preview-contents")};var p;l.onFileSelected=function(e){p=e};var f=0;return l.onFileOpen=a,l.onContentChanged=a,l}),define("text!html/buttonMarkdownSyntax.html",[],function(){return'\n \n'}),define("extensions/buttonMarkdownSyntax",["jquery","classes/Extension","text!html/buttonMarkdownSyntax.html"],function(e,t,n){var i=new t("buttonMarkdownSyntax",'Button "Markdown syntax',!0,!0);return i.settingsBlock='Adds a "Markdown syntax" button over the preview.
',i.onCreatePreviewButton=function(){return n},i}),define("extensions/googleAnalytics",["jquery","underscore","constants","utils","classes/Extension","settings"],function(e,t,n,i,r,o){function a(){i.currentTime-d>18e4&&(_gaq.push(["_trackPageview"]),d=i.currentTime)}var s=new r("googleAnalytics","Google Analytics",!0);s.settingsBlock="Sends anonymous statistics about usage and errors to help improve StackEdit.
";var l=!1,c=!1;window._gaq=[];var u=function(){if(l===!1&&c===!1){var t="/ga.js";location.search.match(/(\?|&)console/)&&(t="/u/ga_debug.js"),e.ajax({url:"https://ssl.google-analytics.com"+t,dataType:"script"}).done(function(){l=!0})}},d=0;s.onPeriodicRun=function(){a()},s.onReady=function(){_gaq.push(["_setAccount",n.GOOGLE_ANALYTICS_ACCOUNT_ID]),a(),_gaq.push(["_trackEvent","About","version",n.VERSION]),_gaq.push(["_trackEvent","Settings","layoutOrientation",""+o.layoutOrientation]),_gaq.push(["_trackEvent","Settings","theme",""+window.theme]),_gaq.push(["_trackEvent","Settings","lazyRendering",""+o.lazyRendering]),_gaq.push(["_trackEvent","Settings","editorFontFamily",""+o.editorFontFamily]),_gaq.push(["_trackEvent","Settings","editorFontSize",""+o.editorFontSize]),_gaq.push(["_trackEvent","Settings","defaultContent backlink",""+(-1!==o.defaultContent.indexOf(n.MAIN_URL))]),_gaq.push(["_trackEvent","Settings","commitMsg backlink",""+(-1!==o.commitMsg.indexOf(n.MAIN_URL))]),_gaq.push(["_trackEvent","Settings","sshProxy unchanged",""+(o.sshProxy==n.SSH_PROXY_URL)]),t.each(o.extensionSettings,function(e,t){_gaq.push(["_trackEvent","Extensions",t+" enabled",""+(e.enabled===!0)])}),window.onerror=function(e,t,n){_gaq.push(["_trackEvent","Error",e,t+":"+n+i.formatEventList()])},u()},s.onOfflineChanged=function(e){c=e,u()};var p=0;return s.onSyncRunning=function(e){e===!0&&(p=(new Date).getTime())},s.onPublishRunning=function(e){e===!0&&(p=(new Date).getTime())},s.onSyncSuccess=function(){var e=(new Date).getTime();_gaq.push(["_trackTiming","Sync","SyncTime",e-p])},s.onSyncImportSuccess=function(e,t){_gaq.push(["_trackEvent","Sync","SyncImport"]),_gaq.push(["_trackEvent","Sync","SyncImport provider",t.providerId])},s.onSyncExportSuccess=function(e,t){_gaq.push(["_trackEvent","Sync","SyncExport"]),_gaq.push(["_trackEvent","Sync","SyncExport provider",t.provider.providerId])},s.onPublishSuccess=function(e){var n=(new Date).getTime();_gaq.push(["_trackTiming","Publish","PublishSuccess",n-p]),t.each(e.publishLocations,function(e){_gaq.push(["_trackEvent","Publish","PublishSuccess provider",e.provider.providerId])})},s.onNewPublishSuccess=function(e,t){_gaq.push(["_trackEvent","Publish","NewPublish provider",t.provider.providerId])},s.onError=function(e){!t.isString(e)&&e.message&&_gaq.push(["_trackEvent","Error","message",e.message+i.formatEventList()])},s}),define("extensions/twitter",["jquery","underscore","constants","utils","classes/Extension"],function(e,t,n,i,r){var o=new r("twitter","Twitter",!1,!0),a=!1,s=!1,l=function(){a===!1&&s===!1&&e.ajax({url:"https://platform.twitter.com/widgets.js",dataType:"script"}).done(function(){a=!0})};return o.onReady=function(){l()},o.onOfflineChanged=function(e){s=e,l()},o.onTweet=function(){a&&window.twttr.widgets.load()},o}),define("text!html/dialogAbout.html",[],function(){return'\n\n'}),define("extensions/dialogAbout",["underscore","constants","utils","classes/Extension","text!html/dialogAbout.html"],function(e,t,n,i,r){var o=new i("dialogAbout",'Dialog "About"'),a={ACE:"http://ace.c9.io/",Bootstrap:"http://getbootstrap.com/","Bootstrap Tour":"http://bootstraptour.com/",crel:"https://github.com/KoryNunn/crel","Dropbox-js":"https://github.com/dropbox/dropbox-js","FileSaver.js":"https://github.com/eligrey/FileSaver.js/",Fontello:"http://fontello.com/","Font Awesome and others...":"res/libs/fontello/LICENSE.txt",Gatekeeper:"https://github.com/prose/gatekeeper","Github.js":"https://github.com/michael/github","Highlight.js":"http://softwaremaniacs.org/soft/highlight/en/",jGrowl:"https://github.com/stanlemon/jGrowl/",jQuery:"http://jquery.com/","lz-string":"http://pieroxy.net/blog/pages/lz-string/index.html",MathJax:"http://www.mathjax.org/",Mousetrap:"http://craig.is/killing/mice","PageDown ACE":"https://github.com/benweet/pagedown-ace","PageDown Extra":"https://github.com/jmcmanus/pagedown-extra/",Prettify:"https://code.google.com/p/google-code-prettify/",RequireJS:"http://requirejs.org/","RequireJS LESS plugin":"https://github.com/guybedford/require-less","stacktrace.js":"http://stacktracejs.com/","to-markdown":"https://github.com/domchristie/to-markdown","Typo.js":"https://github.com/cfinke/Typo.js","UI Layout":"http://layout.jquery-dev.net/","Underscore.js":"http://underscorejs.org/",waitForImages:"https://github.com/alexanderdickson/waitForImages",XRegExp:"https://github.com/slevithan/xregexp","yaml.js":"https://github.com/jeremyfa/yaml.js"},s={"StackEdit Download Proxy":"https://github.com/benweet/stackedit-download-proxy","StackEdit HTMLtoPDF":"https://github.com/benweet/stackedit-htmltopdf","StackEdit Picasa Proxy":"https://github.com/benweet/stackedit-picasa-proxy","StackEdit SSH Proxy":"https://github.com/benweet/stackedit-ssh-proxy","StackEdit Tumblr Proxy":"https://github.com/benweet/stackedit-tumblr-proxy","StackEdit WordPress Proxy":"https://github.com/benweet/stackedit-wordpress-proxy"};return o.onReady=function(){n.addModal("modal-about",e.template(r,{libraries:a,projects:s,version:t.VERSION}))},o}),define("text!html/dialogManagePublicationLocation.html",[],function(){return' \n\n'}),define("extensions/dialogManagePublication",["jquery","underscore","classes/Extension","text!html/dialogManagePublicationLocation.html"],function(e,t,n,i){var r,o=new n("dialogManagePublication",'Dialog "Manage publication"',!1,!0);o.onEventMgrCreated=function(e){r=e};var a,s,l,c=function(n){if(void 0===n||n===a){l.toggleClass("hide",0===t.size(a.publishLocations));var o=t.reduce(a.publishLocations,function(e,n){var r=t.omit(n,"provider","publishIndex","sharingLink");return r.password&&(r.password="********"),r=JSON.stringify(r).replace(/{|}|"/g,"").replace(/,/g,", "),e+t.template(i,{publishAttributes:n,publishDesc:r})},"");s.innerHTML=o,t.each(s.querySelectorAll(".remove-button"),function(t){var n=e(t),i=a.publishLocations[n.data("publishIndex")];n.click(function(){a.removePublishLocation(i),r.onPublishRemoved(a,i)})})}};return o.onFileSelected=function(e){a=e,c(e)},o.onNewPublishSuccess=c,o.onPublishRemoved=c,o.onReady=function(){var t=document.querySelector(".modal-manage-publish");s=t.querySelector(".publish-list"),l=e(document.querySelectorAll(".show-already-published"))},o}),define("text!html/dialogManageSynchronizationLocation.html",[],function(){return'\n' -}),define("extensions/dialogManageSynchronization",["jquery","underscore","classes/Extension","text!html/dialogManageSynchronizationLocation.html"],function(e,t,n,i){var r,o=new n("dialogManageSynchronization",'Dialog "Manage synchronization"',!1,!0);o.onEventMgrCreated=function(e){r=e};var a;o.onSynchronizerCreated=function(e){a=e};var s,l,c,u,d,p=function(n){if(void 0===n||n===s){t.size(s.syncLocations)>0?(c.removeClass("hide"),u.addClass("hide")):(c.addClass("hide"),u.removeClass("hide")),d.toggleClass("hide",0===t.size(s.syncLocations));var o=t.reduce(s.syncLocations,function(e,n){return e+t.template(i,{syncAttributes:n,syncDesc:n.id||n.path})},"");l.innerHTML=o,t.each(l.querySelectorAll(".remove-button"),function(t){var n=e(t),i=s.syncLocations[n.data("syncIndex")];n.click(function(){s.removeSyncLocation(i),r.onSyncRemoved(s,i)})})}};return o.onFileSelected=function(e){s=e,p(e)},o.onSyncExportSuccess=p,o.onSyncRemoved=p,o.onReady=function(){var t=document.querySelector(".modal-manage-sync");l=t.querySelector(".sync-list"),c=e(t.querySelectorAll(".msg-sync-list")),u=e(t.querySelectorAll(".msg-no-sync")),d=e(document.querySelectorAll(".show-already-synchronized"))},o}),define("text!html/dialogManageSharingLocation.html",[],function(){return' \n\n'}),define("extensions/dialogManageSharing",["jquery","underscore","classes/Extension","text!html/dialogManageSharingLocation.html"],function(e,t,n,i){var r,o=new n("dialogManageSharing",'Button "Share"',!1,!0);o.onEventMgrCreated=function(e){r=e};var a,s,l,c,u=function(e){if(void 0===e||e===a){var n=t.reduce(a.publishLocations,function(e,n){return n.sharingLink&&(e+=t.template(i,{link:n.sharingLink,title:a.title})),e},"");s.innerHTML=n,r.onTweet(),l.toggleClass("hide",0===n.length),c.toggleClass("hide",0!==n.length)}};return o.onFileSelected=function(e){a=e,u(e)},o.onNewPublishSuccess=function(t,n){u(t),n.sharingLink&&(e(".modal").modal("hide"),e(".modal-manage-sharing").modal("show"))},o.onPublishRemoved=u,o.onReady=function(){var t=document.querySelector(".modal-manage-sharing");s=t.querySelector(".share-list"),l=e(t.querySelectorAll(".msg-share-list")),c=e(t.querySelectorAll(".msg-no-share"))},o}),function(){var e=this,t={},n=!1;"undefined"!=typeof module&&module.exports?(module.exports=t,e.toMarkdown=t,n=!0):e.toMarkdown=t,t.converter=function(e){e&&e.elements&&$.isArray(e.elements)&&(c=c.concat(e.elements)),this.makeMd=function(e,t){var r;if(n){var o=require("jsdom");o.env({html:e,scripts:["http://code.jquery.com/jquery-1.6.4.min.js"],done:function(n,r){"function"==typeof t&&t(i(e,r.$))}})}else r=i(e,$);return r}};var i=function(e,t){e=e.replace(/(\d+)\. /g,"$1\\. ");var n=t(""),i=n.html(e);i.find("*:not(pre, code)").contents().filter(function(){return 3===this.nodeType&&/^\s+$/.test(this.nodeValue)}).remove();for(var r=[],o=0,s=c.length;s>o;o++)r.push(c[o].selector);for(r=r.join(",");i.find(r).length;)for(var o=0,s=c.length;s>o;o++)$matches=i.find(c[o].selector+':not(:has("'+r+'"))'),$matches.each(function(e,n){var i=t(n);i.before(c[o].replacement(i.html(),i)).remove()});return a(i.html())},r=function(e){return e.replace(/^[\n\r\f]+|[\n\r\f]+$/g,"")},o=function(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')},a=function(e){return e=e.replace(/^[\t\r\n]+|[\t\r\n]+$/g,""),e=e.replace(/\n\s+\n/g,"\n\n"),e=e.replace(/\n{3,}/g,"\n\n"),e=o(e)},s=function(e){return e=r(e),e?"**"+e+"**":""},l=function(e){return e=r(e),e?"_"+e+"_":""},c=[{selector:"p",replacement:function(e){return e=$.trim(e),e?"\n\n"+e+"\n\n":""}},{selector:"br",replacement:function(){return"\n"}},{selector:"h1,h2,h3,h4,h5,h6",replacement:function(e,t){e=$.trim(e);for(var n=t.prop("nodeName").charAt(1),i="",r=0;n>r;r++)i+="#";return e?"\n\n"+i+" "+e+"\n\n":""}},{selector:"hr",replacement:function(){return"\n\n* * *\n\n"}},{selector:"a[href]",replacement:function(e,t){if(e){e=r(e);var n=t.attr("href"),i=t.attr("title")||"";return"["+e+"]("+n+(i?' "'+i+'"':"")+")"}return!1}},{selector:"b",replacement:s},{selector:"strong",replacement:s},{selector:"i",replacement:l},{selector:"em",replacement:l},{selector:"code",replacement:function(e){return e=r(e),e?"`"+e+"`":""}},{selector:"img",replacement:function(e,t){var n=t.attr("alt")||"",i=t.attr("src")||"",r=t.attr("title")||"";return"!["+n+"]("+i+(r?' "'+r+'"':"")+")"}},{selector:"pre",replacement:function(e){return/^\s*\`/.test(e)?(e=e.replace(/\`/g,"")," "+e.replace(/\n/g,"\n ")):""}},{selector:"li",replacement:function(e,t){e=e.replace(/^\s+|\s+$/,"").replace(/\n/gm,"\n ");var n="* ",i="",r=t.parent(),o=r.contents().filter(function(){return 1===this.nodeType&&"LI"===this.nodeName||3===this.nodeType}),a=o.index(t)+1;return n=r.is("ol")?a+". ":"* ",a==o.length&&(t.parents("li").length||(i="\n"),e=e.replace(/\s+$/,""),t.unwrap()),n+e+i+"\n"}},{selector:"blockquote",replacement:function(e){return e=e=$.trim(e).replace(/\n{3,}/g,"\n\n"),e=e.replace(/\n/g,"\n> "),"> "+e}}]}(),define("toMarkdown",["jquery"],function(e){return function(){var t;return t||e.toMarkdown}}(this)),define("extensions/dialogOpenHarddrive",["jquery","underscore","constants","utils","classes/Extension","toMarkdown"],function(e,t,n,i,r,o){function a(i){i.stopPropagation(),i.preventDefault();var r=(i.dataTransfer||i.target).files;e(".modal-import-harddrive-markdown, .modal-import-harddrive-html").modal("hide"),t.each(r,function(t){if(!e(i.target).is("#wmd-input *")||!t.name.match(/.(jpe?g|png|gif)$/i)){var r=new FileReader;r.onload=function(e){return function(t){var n=t.target.result;if(n.match(/\uFFFD/))return void p.onError(e.name+" is a binary file.");if(n=f?f(n):n,void 0===n)return void p.onError(e.name+" is not a valid HTML file.");var i=e.name,r=i.lastIndexOf(".");i=-1!==r?i.substring(0,r):i;var o=u.createFile(i,n);u.selectFile(o)}}(t);var o=t.slice(0,n.IMPORT_FILE_MAX_CONTENT_SIZE);r.readAsText(o)}})}function s(e){f=void 0,a(e)}function l(e){f=m,a(e)}function c(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"}var u,d=new r("dialogOpenHarddrive",'Dialog "Open from"');d.onFileMgrCreated=function(e){u=e};var p;d.onEventMgrCreated=function(e){p=e};var f,h,m=function(e){return h.makeMd(e)};return d.onReady=function(){h=new o.converter,e("#input-file-import-harddrive-markdown").change(s),e("#dropzone-import-harddrive-markdown, #wmd-input").each(function(){this.addEventListener("dragover",c,!1),this.addEventListener("drop",s,!1)}),e("#input-file-import-harddrive-html").change(l),e("#dropzone-import-harddrive-html").each(function(){this.addEventListener("dragover",c,!1),this.addEventListener("drop",l,!1)}),e(".action-convert-html").click(function(e){var t=i.getInputTextValue("#input-convert-html",e);if(void 0!==t){if(t=h.makeMd(t),void 0===t)return void p.onError("Invalid HTML code.");var n=u.createFile(void 0,t);u.selectFile(n)}})},d}),define("extensions/documentTitle",["jquery","underscore","classes/Extension"],function(e,t,n){var i,r,o=new n("documentTitle","Document Title"),a=t.debounce(function(t){if(t===i){var n=i.title;document.title="StackEdit – "+n,r.html(i.composeTitle()),e(".file-title").text(n),e(".input-file-title").val(n)}},50);return o.onFileSelected=function(e){i=e,a(e)},o.onTitleChanged=a,o.onSyncExportSuccess=a,o.onSyncRemoved=a,o.onNewPublishSuccess=a,o.onPublishRemoved=a,o.onReady=a,o.onReady=function(){r=e(".file-title-navbar"),r.hover(function(){var e=r[0].scrollWidth-r.outerWidth();r.stop(!0,!0).animate({scrollLeft:e},15*e,"linear")},function(){r.stop(!0,!0).scrollLeft(0)}).click(function(){r.stop(!0,!0).scrollLeft(0)})},o}),function(e,t){function n(e,t,n){return e.addEventListener?void e.addEventListener(t,n,!1):void e.attachEvent("on"+t,n)}function i(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return T[e.which]?T[e.which]:E[e.which]?E[e.which]:String.fromCharCode(e.which).toLowerCase()}function r(e,t){return e.sort().join(",")===t.sort().join(",")}function o(e){e=e||{};var t,n=!1;for(t in N)e[t]?n=!0:N[t]=0;n||(A=!1)}function a(e,t,n,i,o,a){var s,l,c=[],u=n.type;if(!I[e])return[];for("keyup"==u&&f(e)&&(t=[e]),s=0;s95&&112>e||T.hasOwnProperty(e)&&(S[T[e]]=e)}return S}function g(e,t,n){return n||(n=m()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function v(e,t,n,r){function a(t){return function(){A=t,++N[e],h()}}function s(t){u(n,t,e),"keyup"!==r&&(L=i(t)),setTimeout(o,10)}N[e]=0;for(var l=0;l1?void v(e,s,t,n):(o=y(e,n),I[o.key]=I[o.key]||[],a(o.key,o.modifiers,{type:o.action},i,e,r),void I[o.key][i?"unshift":"push"]({callback:t,modifiers:o.modifiers,action:o.action,seq:i,level:r,combo:e}))}function w(e,t,n){for(var i=0;i ":".","?":"/","|":"\\"},_={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},I={},D={},N={},L=!1,M=!1,A=!1,R=1;20>R;++R)T[111+R]="f"+R;for(R=0;9>=R;++R)T[R+96]=R;n(t,"keypress",p),n(t,"keydown",p),n(t,"keyup",p);var P={bind:function(e,t,n){return e=e instanceof Array?e:[e],w(e,t,n),this},unbind:function(e,t){return P.bind(e,function(){},t)},trigger:function(e,t){return D[e+":"+t]&&D[e+":"+t]({},e),this},reset:function(){return I={},D={},this},stopCallback:function(e,t){return(" "+t.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},handleKey:d};e.Mousetrap=P,"function"==typeof define&&define.amd&&define("mousetrap",P)}(window,document),define("classes/FileDescriptor",["underscore","utils","storage"],function(e,t,n){function i(e,t,i,r){this.fileIndex=e,this._title=t||n[e+".title"],this._editorScrollTop=parseInt(n[e+".editorScrollTop"])||0,this._editorStart=parseInt(n[e+".editorEnd"])||0,this._editorEnd=parseInt(n[e+".editorEnd"])||0,this._previewScrollTop=parseInt(n[e+".previewScrollTop"])||0,this._selectTime=parseInt(n[e+".selectTime"])||0,this._discussionList=JSON.parse(n[e+".discussionList"]||"{}"),this.syncLocations=i||{},this.publishLocations=r||{},Object.defineProperty(this,"title",{get:function(){return this._title},set:function(e){this._title=e,n[this.fileIndex+".title"]=e}}),Object.defineProperty(this,"content",{get:function(){return n[this.fileIndex+".content"]},set:function(e){n[this.fileIndex+".content"]=e}}),Object.defineProperty(this,"editorScrollTop",{get:function(){return this._editorScrollTop},set:function(e){this._editorScrollTop=e,n[this.fileIndex+".editorScrollTop"]=e}}),Object.defineProperty(this,"editorStart",{get:function(){return this._editorStart},set:function(e){this._editorStart=e,n[this.fileIndex+".editorStart"]=e}}),Object.defineProperty(this,"editorEnd",{get:function(){return this._editorEnd},set:function(e){this._editorEnd=e,n[this.fileIndex+".editorEnd"]=e}}),Object.defineProperty(this,"previewScrollTop",{get:function(){return this._previewScrollTop},set:function(e){this._previewScrollTop=e,n[this.fileIndex+".previewScrollTop"]=e}}),Object.defineProperty(this,"selectTime",{get:function(){return this._selectTime},set:function(e){this._selectTime=e,n[this.fileIndex+".selectTime"]=e}}),Object.defineProperty(this,"discussionList",{get:function(){return this._discussionList},set:function(e){this._discussionList=e,n[this.fileIndex+".discussionList"]=JSON.stringify(e)}}),Object.defineProperty(this,"discussionListJSON",{get:function(){return n[this.fileIndex+".discussionList"]||"{}"},set:function(e){this._discussionList=JSON.parse(e),n[this.fileIndex+".discussionList"]=e}})}return i.prototype.addSyncLocation=function(e){t.storeAttributes(e),t.appendIndexToArray(this.fileIndex+".sync",e.syncIndex),this.syncLocations[e.syncIndex]=e},i.prototype.removeSyncLocation=function(e){t.removeIndexFromArray(this.fileIndex+".sync",e.syncIndex),delete this.syncLocations[e.syncIndex]},i.prototype.addPublishLocation=function(e){t.storeAttributes(e),t.appendIndexToArray(this.fileIndex+".publish",e.publishIndex),this.publishLocations[e.publishIndex]=e},i.prototype.removePublishLocation=function(e){t.removeIndexFromArray(this.fileIndex+".publish",e.publishIndex),delete this.publishLocations[e.publishIndex]},i.prototype.composeTitle=function(){var t=[];return e.chain(this.syncLocations).sortBy(function(e){return e.provider.providerId}).each(function(e){t.push('')}),0!==e.size(this.syncLocations)&&t.push(''),e.chain(this.publishLocations).sortBy(function(e){return e.provider.providerId}).each(function(e){t.push('')}),0!==e.size(this.publishLocations)&&t.push(''),t.push(e.escape(this.title)),t.join("")},i}),define("fileSystem",["underscore","utils","classes/FileDescriptor","storage"],function(e,t,n,i){var r={};return t.retrieveIndexArray("file.list").forEach(function(e){r[e]=new n(e)}),Object.keys(i).forEach(function(e){var t=e.match(/(file\.\S+?)\.\S+/);t&&!r.hasOwnProperty(t[1])&&i.removeItem(e)}),r}),define("text!html/documentSelectorSettingsBlock.html",[],function(){return' Allows toggling document with keyboard shortcuts.
\n\n'}),define("extensions/documentSelector",["jquery","underscore","crel","utils","classes/Extension","mousetrap","fileSystem","text!html/documentSelectorSettingsBlock.html"],function(e,t,n,i,r,o,a,s){var l=new r("documentSelector","Document Selector",!0);l.settingsBlock=s,l.defaultConfig={orderBy:"mru",shortcutPrevious:"Ctrl+[",shortcutNext:"Ctrl+]"},l.onLoadSettings=function(){i.setInputValue("#select-document-selector-orderby",l.config.orderBy),i.setInputValue("#input-document-selector-shortcut-previous",l.config.shortcutPrevious),i.setInputValue("#input-document-selector-shortcut-next",l.config.shortcutNext)},l.onSaveSettings=function(e,t){e.orderBy=i.getInputValue("#select-document-selector-orderby"),e.shortcutPrevious=i.getInputTextValue("#input-document-selector-shortcut-previous",t),e.shortcutNext=i.getInputTextValue("#input-document-selector-shortcut-next",t)};var c;l.onFileMgrCreated=function(e){c=e};var u,d,p,f,h,m,g,v=['\n \n\n\n \n\n\n \n\n\n \n\n\n \n\n\n \n\n" data-file-index="<%= fileDesc.fileIndex %>">',' '," <%= fileDesc.composeTitle() %>"," "," "].join(""),b=t.debounce(function(){var n=t.chain(a).sortBy(f).reduce(function(e,n){return e+t.template(v,{fileDesc:n,isCurrent:n===h})},"").value();u.innerHTML=n,p=[],d={},t.each(u.querySelectorAll("li"),function(t){var n=e(t);p.push(n);var i=a[n.data("fileIndex")];d[i.fileIndex]=n,n.find("a").click(function(){m=void 0,n.hasClass("disabled")?g.focus():c.selectFile(i)})})},50);return l.onFileSelected=function(e){h=e,b()},l.onFileCreated=b,l.onFileDeleted=b,l.onTitleChanged=b,l.onSyncExportSuccess=b,l.onSyncRemoved=b,l.onNewPublishSuccess=b,l.onPublishRemoved=b,l.onReady=function(){g=e("#wmd-input"),"title"==l.config.orderBy?f=function(e){return e.title.toLowerCase()}:"mru"==l.config.orderBy&&(f=function(e){return-e.selectTime}),u=n("ul",{"class":"dropdown-menu dropdown-file-selector"}),document.querySelector(".navbar").appendChild(n("div",n("div",{"data-toggle":"dropdown"}),u));var i=e(u).dropdown(),r=e(".document-panel .collapse-button");r.prop("title",t.template("<%= title %> <%= shortcutPrevious %> <%= shortcutNext %>",{title:r.prop("title"),shortcutPrevious:l.config.shortcutPrevious,shortcutNext:l.config.shortcutNext}));var a=l.config.shortcutPrevious.toLowerCase();o.bind(a,function(){void 0===m&&(i.dropdown("toggle"),m=d[h.fileIndex]);var e=t.indexOf(p,m)-1;return-2===e&&(e=-1),m=p[(e+p.length)%p.length],setTimeout(function(){m.find("a").focus()},10),!1});var s=l.config.shortcutNext.toLowerCase();o.bind(l.config.shortcutNext.toLowerCase(),function(){void 0===m&&(i.dropdown("toggle"),m=d[h.fileIndex]);var e=t.indexOf(p,m)+1;return m=p[e%p.length],setTimeout(function(){m.find("a").focus()},10),!1});var c=a.indexOf("+"),v=-1===c?a:a.substring(0,c),b=s.indexOf("+"),y=-1===b?s:s.substring(0,b);o.bind([v,y],function(){void 0!==m&&m.find("a").click()},"keyup")},l}),define("classes/FolderDescriptor",["underscore","utils","storage","fileSystem"],function(e,t,n,i){function r(r,o){this.folderIndex=r,this._name=o||n[r+".name"],this.fileList={},e.each(t.retrieveIndexArray(r+".files"),function(e){try{var n=i[e];n.folder=this,this.fileList[e]=n}catch(o){t.removeIndexFromArray(r+".files",e)}},this),Object.defineProperty(this,"name",{get:function(){return this._name},set:function(e){this._name=e,n[this.folderIndex+".name"]=e}})}return r.prototype.addFile=function(e){e.folder=this,t.appendIndexToArray(this.folderIndex+".files",e.fileIndex),this.fileList[e.fileIndex]=e},r.prototype.removeFile=function(e){e.folder=void 0,t.removeIndexFromArray(this.folderIndex+".files",e.fileIndex),delete this.fileList[e.fileIndex]},r}),define("folderList",["underscore","utils","storage","classes/FolderDescriptor","storage"],function(e,t,n,i){var r={};return t.retrieveIndexArray("folder.list").forEach(function(e){r[e]=new i(e)}),Object.keys(n).forEach(function(e){var t=e.match(/(folder\.\S+?)\.\S+/);t&&!r.hasOwnProperty(t[1])&&n.removeItem(e)}),r}),define("extensions/documentPanel",["jquery","underscore","utils","classes/Extension","folderList","fileSystem"],function(e,t,n,i,r,o){function a(n){if(n!=y){if(y=n,b.scrollTop=0,!n)return f.addClass("hide"),void d.removeClass("hide");var i=n.toLowerCase().split(/\s+/);t.each(p.querySelectorAll(".file"),function(n){var r=e(n),o=r.text().toLowerCase();r.toggle(!t.some(i,function(e){return-1===o.indexOf(e)}))}),f.removeClass("hide"),d.addClass("hide")}}var s,l=new i("documentPanel","Document Panel");l.onFileMgrCreated=function(e){s=e};var c,u,d,p,f,h,m=['',''," <%= _.size(folderDesc.fileList) %>","",' <%= folderDesc.name %>',"",''," <%= fileListHtml %>",""].join(""),g=['"',' data-file-index="<%= fileDesc.fileIndex %>">'," <%= fileDesc.composeTitle() %>",""].join(""),v=t.debounce(function(){var n=t.filter(o,function(e){return void 0===e.folder}),i=t.chain(n).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+""+t.template(g,{fileDesc:n,selectedFileDesc:h})+" "},"").value();i=i&&' ",t.chain(r).sortBy(function(e){return e.name.toLowerCase()}).each(function(e){var n=t.chain(e.fileList).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+""+t.template(g,{fileDesc:n,selectedFileDesc:h})+" "},"").value();n=n&&' ",i+=t.template(m,{folderDesc:e,fileListHtml:n,id:e.folderIndex.replace(".","")})}),u.innerHTML=i;var a=t.chain(o).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+""+t.template(g,{fileDesc:n,selectedFileDesc:h})+" "},"").value();a=' ",p.innerHTML=a,t.each(c.querySelectorAll(".file"),function(t){var n=e(t);n.click(function(){var e=o[n.data("fileIndex")];e&&e!==h&&s.selectFile(e)})})},50);l.onFileSelected=function(e){h=e,v()},l.onFileCreated=v,l.onFileDeleted=v,l.onTitleChanged=v,l.onSyncExportSuccess=v,l.onSyncRemoved=v,l.onNewPublishSuccess=v,l.onPublishRemoved=v,l.onFoldersChanged=v;var b,y="";return l.onReady=function(){c=document.querySelector(".document-panel"),b=c.querySelector(".panel-content"),u=c.querySelector(".document-list"),d=e(u),p=c.querySelector(".document-list-filtered"),f=e(p),e(c).on("show.layout.toggle",function(){var t=h.folder;void 0!==t&&e(c.querySelector(".file-list."+t.folderIndex.replace(".",""))).collapse("show")}).on("shown.layout.toggle",function(){var e=u.querySelector(".file.active");e&&(b.scrollTop+=e.getBoundingClientRect().top-240)}).on("hidden.layout.toggle",function(){t.val(""),a("")});var t=e(c.querySelector(".search-bar .form-control"));t.bind("propertychange keyup input paste",function(){a(t.val())})},l}),define("extensions/documentManager",["jquery","underscore","constants","utils","storage","classes/Extension","classes/FolderDescriptor","folderList","fileSystem"],function(e,t,n,i,r,o,a,s,l){function c(){N=[],D=[],t.each(b.querySelectorAll('input[type="checkbox"]:checked'),function(t){var n=e(t.parentNode.parentNode),i=s[n.data("folderIndex")],r=l[n.data("fileIndex")];void 0!==i?N.push(i):void 0!==r&&D.push(r)})}function u(){if(0===t.size(D))return void d();var n=t.chain(D).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+t.template(I,{fileDesc:n})},"").value();y.innerHTML=''+n+"
",e(v.querySelectorAll(".document-list")).addClass("hide"),e(v.querySelectorAll(".confirm-delete, .selected-document-list")).removeClass("hide")}function d(){t.each(D,function(e){e.folder&&e.folder.removeFile(e),f.deleteFile(e)}),t.each(N,function(e){i.removeIndexFromArray("folder.list",e.folderIndex),delete s[e.folderIndex]}),m.onFoldersChanged()}function p(){c(),x.toggleClass("disabled",0===t.size(s)||0===t.size(D)),w.toggleClass("disabled",0===t.size(N)&&0===t.size(D))}var f,h=new o("documentManager","Document Manager",!1,!0);h.onFileMgrCreated=function(e){f=e};var m;h.onEventMgrCreated=function(e){m=e};var g,v,b,y,x,w,S,C,T,E=['','','','','<%= _.size(folderDesc.fileList) %>','',"<%= folderDesc.name %>",'','<%= fileListHtml %>'].join(""),k=['','','','',' '].join(""),_=['','<%= fileDesc.composeTitle() %>','<%= _.size(folderDesc.fileList) %>','',"<%= folderDesc.name %>"].join(""),I=['',' '].join(""),D=[],N=[],L=t.debounce(function(){if(g!==!1){p(),C.text(t.size(l)),T.text(t.size(s)+1),S=t.filter(l,function(e){return void 0===e.folder});var n=['','','<%= fileDesc.composeTitle() %>',t.size(S),"",'',"ROOT folder"].join(""),i=t.chain(S).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+t.template(k,{fileDesc:n})},"").value();i=i&&' ",n+=''+i+"",t.chain(s).sortBy(function(e){return e.name.toLowerCase()}).each(function(e){var i=t.chain(e.fileList).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+t.template(k,{fileDesc:n})},"").value();i=i&&' ",n+=t.template(E,{folderDesc:e,fileListHtml:i,id:e.folderIndex.replace(".","")})}),b.innerHTML=n,t.each(b.querySelectorAll(".button-delete"),function(t){var n=e(t);n.click(function(e){e.stopPropagation();var t=n.parent(),i=s[t.data("folderIndex")],r=l[t.data("fileIndex")];D=[],N=[],i?(N.push(i),D=i.fileList):r&&D.push(r),u()})}),t.each(b.querySelectorAll(".button-rename"),function(t){var n=e(t);n.click(function(e){e.stopPropagation();var t,i=n.parent(),r=s[i.data("folderIndex")],o=l[i.data("fileIndex")];r?t=r.name:o&&(t=o.title),i.find(".name").addClass("hide"),i.find(".input-rename").removeClass("hide").val(t)[0].select()})}),t.each(b.querySelectorAll(".input-rename"),function(t){function n(){var t=i.parent(),n=e.trim(i.val()),r=s[t.data("folderIndex")],o=l[t.data("fileIndex")];n&&r&&n!=r.name?(r.name=n,m.onFoldersChanged()):n&&o&&n!=o.title?(o.title=n,m.onTitleChanged(o)):(i.addClass("hide"),t.find(".name").removeClass("hide"))}var i=e(t);i.blur(function(){n()}).keyup(function(e){13==e.keyCode&&(n(),e.stopPropagation()),27==e.keyCode&&(i.val(""),n(),e.stopPropagation())})}),t.each(b.querySelectorAll(".file .checkbox"),function(t){var n=e(t);n.click(function(e){e.stopPropagation()}).find("[type=checkbox]").change(function(){n.parents(".list-group").find(".folder [type=checkbox]").prop("checked",!1)})}),t.each(b.querySelectorAll(".folder .checkbox"),function(t){var n=e(t);n.click(function(e){e.stopPropagation()}).find("[type=checkbox]").change(function(){n.parent().next().find("[type=checkbox]").prop("checked",this.checked)})}),e(b.querySelectorAll("[type=checkbox]")).change(p)}},50);return h.onFileCreated=L,h.onFileDeleted=L,h.onSyncExportSuccess=L,h.onSyncRemoved=L,h.onNewPublishSuccess=L,h.onPublishRemoved=L,h.onFoldersChanged=L,h.onTitleChanged=function(t){g!==!1&&(e(b).find('[data-file-index="'+t.fileIndex+'"] .name').html(t.composeTitle()).removeClass("hide"),e(b.querySelectorAll(".input-rename")).addClass("hide"))},h.onReady=function(){v=document.querySelector(".modal-document-manager"),b=v.querySelector(".list-group.document-list"),C=e(v.querySelectorAll(".document-count")),T=e(v.querySelectorAll(".folder-count")),y=v.querySelector(".list-group.selected-document-list");var o=v.querySelector(".list-group.select-folder-list");e(v).on("show.bs.modal",function(){g=!0,L(),setTimeout(function(){e(b.querySelectorAll(".root-folder")).click()},250)}).on("hide.bs.modal",function(){g=!1,b.innerHTML=""}),e(v.querySelectorAll(".action-create-folder")).click(function(){var o;do o="folder."+i.randomString();while(t.has(s,o));r[o+".name"]=n.DEFAULT_FOLDER_NAME;var l=new a(o,n.DEFAULT_FOLDER_NAME);i.appendIndexToArray("folder.list",o),s[o]=l,m.onFoldersChanged(),setTimeout(function(){var t=e(v.querySelector('[data-folder-index="'+o+'"] .button-rename')).click();v.scrollTop+=t.offset().top-50},60)}),e(v.querySelectorAll(".action-select-all")).click(function(){e(b.querySelectorAll('input[type="checkbox"]')).prop("checked",!0).change()}),e(v.querySelectorAll(".action-unselect-all")).click(function(){e(b.querySelectorAll('input[type="checkbox"]')).prop("checked",!1).change()});var l=e(v.querySelectorAll(".action-delete-items")).click(function(){w.hasClass("disabled")||(c(),u())});w=l.parent(),e(v.querySelectorAll(".action-delete-items-confirm")).click(function(){d(),e(v.querySelectorAll(".document-list")).removeClass("hide"),e(v.querySelectorAll(".confirm-delete, .selected-document-list")).addClass("hide")});var p=e(v.querySelectorAll(".action-move-items")).click(function(){if(!x.hasClass("disabled")){c();var n=['','',t.size(S),"",'',"ROOT folder"].join("");n+=t.chain(s).sortBy(function(e){return e.name.toLowerCase()}).reduce(function(e,n){return e+t.template(_,{folderDesc:n})},"").value(),o.innerHTML=n,t.each(o.querySelectorAll(".folder"),function(n){n=e(n),n.click(function(){var i=s[n.data("folderIndex")];t.each(D,function(e){e.folder&&e.folder.removeFile(e),i&&i.addFile(e) -}),m.onFoldersChanged(),e(v.querySelectorAll(".document-list")).removeClass("hide"),e(v.querySelectorAll(".choose-folder, .select-folder-list")).addClass("hide")})}),e(v.querySelectorAll(".document-list")).addClass("hide"),e(v.querySelectorAll(".choose-folder, .select-folder-list")).removeClass("hide")}});x=p.parent(),e(v.querySelectorAll(".action-cancel")).click(function(){e(v.querySelectorAll(".document-list")).removeClass("hide"),e(v.querySelectorAll(".confirm-delete, .choose-folder, .selected-document-list, .select-folder-list")).addClass("hide")})},h}),define("extensions/workingIndicator",["jquery","underscore","crel","classes/Extension"],function(e,t,n,i){var r,o,a=new i("workingIndicator","Working Indicator"),s=["@<%= prefix %>keyframes <%= name %> {"," 0% { opacity:<%= z %>; }"," <%= start %>.01% { opacity:<%= alpha %>; }"," <%= start %>.02% { opacity:1; }"," <%= ((start + trail) % 100) %>.01% { opacity:<%= alpha %>; }"," 100% { opacity:<%= z %>; }","}"].join("\n");return a.onAsyncRunning=function(e){r.toggleClass("working",e),o.toggleClass("hide",!e)},a.onReady=function(){function i(e){e.z=Math.max(1-(1-e.alpha)/e.trail*(100-e.start),e.alpha),a+=t.template(s,t.extend({prefix:""},e)),a+=t.template(s,t.extend({prefix:"-webkit-"},e))}var a="";r=e(document.body),o=e(''),e(".working-indicator").append(o);for(var l=0;3>l;l++){var c="working-indicator-bar"+l;i({name:c,alpha:.25,start:20*l,trail:50});var u=c+" 0.7s linear infinite";o.append(e('\n\n '),this.interval=setInterval(function(){e(n).data("jGrowl.instance").update()},parseInt(this.defaults.check)),t&&e(this.element).addClass("ie6")},shutdown:function(){e(this.element).removeClass("jGrowl").find("div.jGrowl-notification").remove(),clearInterval(this.interval)},close:function(){e(this.element).find("div.jGrowl-notification").each(function(){e(this).trigger("jGrowl.beforeClose")})}}),e.jGrowl.defaults=e.fn.jGrowl.prototype.defaults}(jQuery),define("jgrowl",["jquery"],function(e){return function(){var t;return t||e.jQuery.jGrowl}}(this)),define("text!html/notificationsSettingsBlock.html",[],function(){return'Shows notification messages in the bottom-right corner of the\n screen.
\n\n'}),define("extensions/notifications",["jquery","underscore","utils","logger","classes/Extension","jgrowl","text!html/notificationsSettingsBlock.html"],function(e,t,n,i,r,o,a){function s(){f===!1&&(o.defaults.life=u.config.timeout,o.defaults.closer=!1,o.defaults.closeTemplate="",o.defaults.position="bottom-right",f=!0)}function l(e,n,r){if(i.info(e),s(),e){var a=e.indexOf("|");(-1===a||(e=e.substring(0,a)))&&(r=r||{},n=n||"icon-info-circled",o(" "+t.escape(e).replace(/\n/g,"\n \n\n\n ms\n\n
"),r))}}function c(){h!==!1&&(d.toggleClass("hide",!m),p.toggleClass("hide",m))}var u=new r("notifications","Notifications");u.settingsBlock=a,u.defaultConfig={timeout:8e3},u.onLoadSettings=function(){n.setInputValue("#input-notifications-timeout",u.config.timeout)},u.onSaveSettings=function(e,t){e.timeout=n.getInputIntValue("#input-notifications-timeout",t,1,6e4)};var d,p,f=!1,h=!1;u.onReady=function(){h=!0,d=e(".navbar .offline-status"),p=e(".navbar .extension-buttons"),c()},u.onMessage=function(e){l(e)},u.onError=function(e){i.error(e),t.isString(e)?l(e,"icon-attention"):t.isObject(e)&&l(e.message,"icon-attention")};var m=!1;return u.onOfflineChanged=function(e){m=e,c(),m===!0?l("You are offline.","icon-attention-circled msg-offline"):l("You are back online!","icon-signal")},u.onSyncImportSuccess=function(e,n){var i=t.map(e,function(e){return e.title}).join(", ");l(i+" imported successfully from "+n.providerName+".")},u.onSyncExportSuccess=function(e,t){l('"'+e.title+'" will now be synchronized on '+t.provider.providerName+".")},u.onSyncRemoved=function(e,t){l(t.provider.providerName+" synchronized location has been removed.")},u.onPublishSuccess=function(e){l('"'+e.title+'" successfully published.')},u.onNewPublishSuccess=function(e,t){l('"'+e.title+'" is now published on '+t.provider.providerName+".")},u.onPublishRemoved=function(e,t){l(t.provider.providerName+" publish location has been removed.")},u}),define("text!html/buttonToc.html",[],function(){return'\n \n'}),define("text!html/tocSettingsBlock.html",[],function(){return'Generates a table of contents when a [TOC] marker is found.
\n\n'}),define("extensions/toc",["jquery","underscore","utils","classes/Extension","text!html/buttonToc.html","text!html/tocSettingsBlock.html"],function(e,t,n,i,r,o){function a(e,t,n){this.tagName=e,this.anchor=t,this.text=n,this.children=[]}function s(e,n){function i(){void 0!==r&&(r.children.length>0&&(r.children=s(r.children,n+1)),l.push(r))}n=n||1;var r,o="H"+n,l=[];return t.each(e,function(e){e.tagName!=o?n!==c.config.maxDepth&&(void 0===r&&(r=new a),r.children.push(e)):(i(),r=e)}),i(),l}function l(){function e(e){for(var r=e.id||n.slugify(e.textContent)||"title",o=r,a=0;t.has(i,o);)o=r+"-"+ ++a;return i[o]=!0,e.id=o,o}var i={},r=[];return t.each(u.querySelectorAll("h1, h2, h3, h4, h5, h6"),function(t){r.push(new a(t.tagName,e(t),t.textContent))}),r=s(r),'\n \n\n\n \n \n\n\n \n\n\n \n\n\n \n\n \n\n\n\n \n\n\n\n"}var c=new i("toc","Table of Contents",!0);c.settingsBlock=o,c.defaultConfig={marker:"\\[(TOC|toc)\\]",maxDepth:6,button:!0},c.onLoadSettings=function(){n.setInputValue("#input-toc-marker",c.config.marker),n.setInputValue("#input-toc-maxdepth",c.config.maxDepth),n.setInputChecked("#input-toc-button",c.config.button)},c.onSaveSettings=function(e,t){e.marker=n.getInputRegExpValue("#input-toc-marker",t),e.maxDepth=n.getInputIntValue("#input-toc-maxdepth"),e.button=n.getInputChecked("#input-toc-button")},c.onCreatePreviewButton=function(){return c.config.button?r:void 0},a.prototype.childrenToString=function(){if(0===this.children.length)return"";var e="\n'+r.join("")+"
\n\n";return t.each(this.children,function(t){e+=t.toString()}),e+="
\n"},a.prototype.toString=function(){var e="";return this.anchor&&this.text&&(e+=''+this.text+""),e+=this.childrenToString()+" \n"};var u;return c.onPagedownConfigure=function(e){u=document.getElementById("preview-contents");var n=new RegExp("^\\s*"+c.config.marker+"\\s*$");e.hooks.chain("onPreviewRefresh",function(){var e=document.querySelectorAll(".table-of-contents, .toc"),i=l();t.each(u.getElementsByTagName("p"),function(e){n.test(e.innerHTML)&&(e.innerHTML=i)}),t.each(e,function(e){e.innerHTML=i})})},c}),define("extensions/emailConverter",["classes/Extension"],function(e){var t=new e("emailConverter","Markdown Email",!0);return t.settingsBlock="Converts email adresses in the form <email@example.com> into clickable links.
",t.onPagedownConfigure=function(e){e.getConverter().hooks.chain("postConversion",function(e){return e.replace(/<(mailto\:)?([^\s>]+@[^\s>]+\.\S+?)>/g,function(e,t,n){return''+n+""})})},t}),define("text!html/scrollSyncSettingsBlock.html",[],function(){return"Binds together editor and preview scrollbars.
\n\n Note: The mapping between Markdown and HTML is based on the\n position of the title elements (h1, h2...) in the page. Therefore if\n your document does not contain any title, the mapping will be linear and\n consequently less accurate.\n"}),define("extensions/scrollSync",["jquery","underscore","classes/Extension","text!html/scrollSyncSettingsBlock.html"],function(e,t,n,i){var r=new n("scrollSync","Scroll Sync",!0,!0);r.settingsBlock=i,e.easing.easeOutSine=function(e){return Math.cos((1-e)*Math.PI/2)};var o;r.onSectionsCreated=function(e){o=e};var a,s,l,c,u=!0,d=[],p=[],f=t.debounce(function(){if(u){d=[];var t,n,i=a.scrollTop();a.find(".wmd-input-section").each(function(){if(void 0===t)return void(t=0);var n=e(this.firstChild),r=n.position().top+i;d.push({startOffset:t,endOffset:r,height:r-t}),t=r}),n=a.prop("scrollHeight"),d.push({startOffset:t,endOffset:n,height:n-t}),p=[];var r,o=s.scrollTop();s.find(".wmd-preview-section").each(function(){if(void 0===r)return void(r=0);var t=e(this),n=t.position().top+o;p.push({startOffset:r,endOffset:n,height:n-r}),r=n}),n=s.prop("scrollHeight"),p.push({startOffset:r,endOffset:n,height:n-r}),l=-10,c=-10,y()}},500),h=!1,m=!1,g=!1,v=!1,b=e(""),y=t.throttle(function(){function e(e,n,i){var r,o=t.find(n,function(t,n){return r=n,e'}),t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),t.prototype.constructor=t,t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},t.prototype.hasContent=function(){return this.getTitle()||this.getContent()},t.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||("function"==typeof t.content?t.content.call(e[0]):t.content)},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},t.prototype.tip=function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip};var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var i=e(this),r=i.data("bs.popover"),o="object"==typeof n&&n;r||i.data("bs.popover",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.popover.Constructor=t,e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(jQuery),+function(e){function t(n,i){var r,o=e.proxy(this.process,this);this.$element=e(e(n).is("body")?window:n),this.$body=e("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",o),this.options=e.extend({},t.DEFAULTS,i),this.selector=(this.options.target||(r=e(n).attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=e([]),this.targets=e([]),this.activeTarget=null,this.refresh(),this.process()}t.DEFAULTS={offset:10},t.prototype.refresh=function(){var t=this.$element[0]==window?"offset":"position";this.offsets=e([]),this.targets=e([]);{var n=this;this.$body.find(this.selector).map(function(){var i=e(this),r=i.data("target")||i.attr("href"),o=/^#\w/.test(r)&&e(r);return o&&o.length&&[[o[t]().top+(!e.isWindow(n.$scrollElement.get(0))&&n.$scrollElement.scrollTop()),r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){n.offsets.push(this[0]),n.targets.push(this[1])})}},t.prototype.process=function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,n=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,i=n-this.$scrollElement.height(),r=this.offsets,o=this.targets,a=this.activeTarget;if(t>=i)return a!=(e=o.last()[0])&&this.activate(e);for(e=r.length;e--;)a!=o[e]&&t>=r[e]&&(!r[e+1]||t<=r[e+1])&&this.activate(o[e])},t.prototype.activate=function(t){this.activeTarget=t,e(this.selector).parents(".active").removeClass("active");var n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=e(n).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var i=e(this),r=i.data("bs.scrollspy"),o="object"==typeof n&&n;r||i.data("bs.scrollspy",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(jQuery),+function(e){var t=function(t){this.element=e(t)};t.prototype.show=function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=t.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var r=n.find(".active:last a")[0],o=e.Event("show.bs.tab",{relatedTarget:r});if(t.trigger(o),!o.isDefaultPrevented()){var a=e(i);this.activate(t.parent("li"),n),this.activate(a,a.parent(),function(){t.trigger({type:"shown.bs.tab",relatedTarget:r})})}}},t.prototype.activate=function(t,n,i){function r(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),a?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),i&&i()}var o=n.find("> .active"),a=i&&e.support.transition&&o.hasClass("fade");a?o.one(e.support.transition.end,r).emulateTransitionEnd(150):r(),o.removeClass("in")};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var i=e(this),r=i.data("bs.tab");r||i.data("bs.tab",r=new t(this)),"string"==typeof n&&r[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(jQuery),+function(e){var t=function(n,i){this.options=e.extend({},t.DEFAULTS,i),this.$window=e(window).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(n),this.affixed=this.unpin=null,this.checkPosition()};t.RESET="affix affix-top affix-bottom",t.DEFAULTS={offset:0},t.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},t.prototype.checkPosition=function(){if(this.$element.is(":visible")){var n=e(document).height(),i=this.$window.scrollTop(),r=this.$element.offset(),o=this.options.offset,a=o.top,s=o.bottom;"object"!=typeof o&&(s=a=o),"function"==typeof a&&(a=o.top()),"function"==typeof s&&(s=o.bottom());var l=null!=this.unpin&&i+this.unpin<=r.top?!1:null!=s&&r.top+this.$element.height()>=n-s?"bottom":null!=a&&a>=i?"top":!1;this.affixed!==l&&(this.unpin&&this.$element.css("top",""),this.affixed=l,this.unpin="bottom"==l?r.top-i:null,this.$element.removeClass(t.RESET).addClass("affix"+(l?"-"+l:"")),"bottom"==l&&this.$element.offset({top:document.body.offsetHeight-s-this.$element.height()}))}};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var i=e(this),r=i.data("bs.affix"),o="object"==typeof n&&n;r||i.data("bs.affix",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.affix.Constructor=t,e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(jQuery),define("bootstrap",function(){}),function(e,t){var n,i;return i=t.document,n=function(){function n(n){this._options=e.extend({name:"tour",container:"body",keyboard:!0,storage:t.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,duration:!1,basePath:"",template:"n&&(n=0);var i,r=s.scrollTop();if(h===!0){if(Math.abs(n-l)<=9)return;if(h=!1,l=n,i=e(n,d,p),i=t.min([i,s.prop("scrollHeight")-s.outerHeight()]),Math.abs(i-r)<=9)return void(c=r);b.stop("scrollSyncFx",!0).css("value",0).animate({value:i-r},{easing:"easeOutSine",duration:200,queue:"scrollSyncFx",step:function(e){v=!0,c=r+e,s.scrollTop(c)},done:function(){setTimeout(function(){v=!1},10)}}).dequeue("scrollSyncFx")}else if(m===!0){if(Math.abs(r-c)<=9)return;if(m=!1,c=r,i=e(r,p,d),i=t.min([i,a.prop("scrollHeight")-a.outerHeight()]),Math.abs(i-n)<=9)return void(l=n);b.stop("scrollSyncFx",!0).css("value",0).animate({value:i-n},{easing:"easeOutSine",duration:200,queue:"scrollSyncFx",step:function(e){g=!0,l=n+e,a.scrollTop(l)},done:function(){setTimeout(function(){g=!1},10)}}).dequeue("scrollSyncFx")}}},100);r.onLayoutResize=function(){h=!0,f()},r.onFileClosed=function(){d=[]};var x=!1;r.onReady=function(){s=e(".preview-container"),a=e("#wmd-input"),s.scroll(function(){v===!1&&x===!1&&(m=!0,h=!1,y()),x=!1}),a.scroll(function(){g===!1&&(h=!0,m=!1,y())}),s.on("hide.layout.toggle",function(){u=!1}),s.on("shown.layout.toggle",function(){u=!0})};var w;return r.onPagedownConfigure=function(t){w=e("#preview-contents"),t.getConverter().hooks.chain("postConversion",function(e){return w.height(w.height()),e})},r.onPreviewFinished=function(){var e=w.height();w.height("auto");var t=w.height();h=!0,e>t&&(x=!0),f()},r}),define("text!html/buttonSyncSettingsBlock.html",[],function(){return' Adds a "Synchronize documents" button in the navigation bar.
\n\n'}),define("extensions/buttonSync",["jquery","underscore","crel","utils","classes/Extension","mousetrap","text!html/buttonSyncSettingsBlock.html"],function(e,t,n,i,r,o,a){var s=new r("buttonSync",'Button "Synchronize"',!1,!0);s.settingsBlock=a,s.defaultConfig={syncPeriod:18e4,syncShortcut:"mod+s"},s.onLoadSettings=function(){i.setInputValue("#input-sync-period",s.config.syncPeriod),i.setInputValue("#input-sync-shortcut",s.config.syncShortcut)},s.onSaveSettings=function(e,t){e.syncPeriod=i.getInputIntValue("#input-sync-period",t,0),e.syncShortcut=i.getInputTextValue("#input-sync-shortcut",t)};var l;s.onSynchronizerCreated=function(e){l=e};var c,u=!1,d=!1,p=function(){void 0!==c&&(u===!0||l.hasSync()===!1||d?c.addClass("disabled"):c.removeClass("disabled"))},f=0;return s.onPeriodicRun=function(){!s.config.syncPeriod||f+s.config.syncPeriod>i.currentTime||l.sync()&&(f=i.currentTime)},s.onCreateButton=function(){var t=n("a",{"class":"btn btn-success button-synchronize",title:"Force synchronization Ctrl/Cmd+S"},n("i",{"class":"icon-refresh"}));return c=e(t),c.click(function(){c.hasClass("disabled")||l.sync()&&(f=i.currentTime)}),t},s.onReady=p,s.onFileCreated=p,s.onFileDeleted=p,s.onSyncImportSuccess=p,s.onSyncExportSuccess=p,s.onSyncRemoved=p,s.onSyncRunning=function(e){u=e,p()},s.onOfflineChanged=function(e){d=e,p()},s.onReady=function(){o.bind(s.config.syncShortcut,function(e){l.sync()&&(f=i.currentTime),e.preventDefault()}),e(".action-force-synchronization").click(function(){l.sync()&&(f=i.currentTime)})},s}),define("extensions/buttonPublish",["jquery","underscore","crel","classes/Extension"],function(e,t,n,i){function r(){void 0!==o&&(c===!0||u===!1||d===!0?o.addClass("disabled"):o.removeClass("disabled"))}var o,a,s,l=new i("buttonPublish",'Button "Publish"'),c=!1,u=!1,d=!1;l.onPublisherCreated=function(e){s=e},l.onCreateButton=function(){var t=n("a",{"class":"btn btn-success button-publish",title:"Update document publication"},n("i",{"class":"icon-upload"}));return o=e(t).click(function(){o.hasClass("disabled")||s.publish()}),t},l.onPublishRunning=function(e){c=e,r()},l.onOfflineChanged=function(e){d=e,r()};var p=function(){u=0===t.size(a.publishLocations)?!1:!0,r()};return l.onFileSelected=function(e){a=e,p()},l.onReady=function(){e(".action-update-publication").click(s.publish)},l.onPublishRemoved=p,l.onNewPublishSuccess=p,l}),define("text!html/buttonStat.html",[],function(){return'\n \n'}),define("text!html/buttonStatSettingsBlock.html",[],function(){return'\n \n\n\n ms\n\n\n \n\n\n \n\nAdds a "Document statistics" button over the preview.
\n\n\n'}),define("extensions/buttonStat",["jquery","underscore","utils","classes/Extension","text!html/buttonStat.html","text!html/buttonStatSettingsBlock.html"],function(e,t,n,i,r,o){var a=new i("buttonStat",'Button "Statistics"',!0,!0);a.settingsBlock=o,a.defaultConfig={name1:"Characters",value1:"\\S",name2:"Words",value2:"\\S+",name3:"Paragraphs",value3:"\\S.*"},a.onLoadSettings=function(){t.each([1,2,3],function(e){n.setInputValue("#input-stat-name"+e,a.config["name"+e]),n.setInputValue("#input-stat-value"+e,a.config["value"+e])})},a.onSaveSettings=function(e,i){t.each([1,2,3],function(t){e["name"+t]=n.getInputTextValue("#input-stat-name"+t,i),e["value"+t]=n.getInputRegExpValue("#input-stat-value"+t,i)})},a.onCreatePreviewButton=function(){return t.template(r,a.config)};var s,l,c,u;return a.onReady=function(){s=document.getElementById("preview-contents"),l=document.getElementById("span-stat-value1"),c=document.getElementById("span-stat-value2"),u=document.getElementById("span-stat-value3")},a.onPreviewFinished=function(){for(var e=s.cloneNode(!0),t=e.getElementsByTagName("script"),n=t.length-1;n>=0;n--){var i=t[n];i.parentNode.removeChild(i)}var r=e.textContent;l.textContent=(r.match(new RegExp(a.config.value1,"g"))||[]).length,c.textContent=(r.match(new RegExp(a.config.value2,"g"))||[]).length,u.textContent=(r.match(new RegExp(a.config.value3,"g"))||[]).length},a}),define("text!html/buttonHtmlCode.html",[],function(){return'\n \n'}),define("text!html/buttonHtmlCodeSettingsBlock.html",[],function(){return'\n \n\n\n \n\n\n \n\nAdds a "HTML code" button over the preview.
\n\n'}),define("extensions/buttonHtmlCode",["jquery","underscore","utils","classes/Extension","text!html/buttonHtmlCode.html","text!html/buttonHtmlCodeSettingsBlock.html"],function(e,t,n,i,r,o){var a=new i("buttonHtmlCode",'Button "HTML code"',!0,!0);a.settingsBlock=o,a.defaultConfig={template:"<%= documentHTML %>"},a.onLoadSettings=function(){n.setInputValue("#textarea-html-code-template",a.config.template)},a.onSaveSettings=function(e){e.template=n.getInputValue("#textarea-html-code-template")};var s;a.onEventMgrCreated=function(e){s=e},a.onCreatePreviewButton=function(){return r};var l;a.onFileSelected=function(e){l=e};var c,u;return a.onPreviewFinished=function(e,t){c=e,u=t},a.onReady=function(){var n=document.getElementById("input-html-code");e(".action-html-code").click(function(){setTimeout(function(){e("#input-html-code").each(function(){e(this).is(":hidden")||this.select()})},10)}).parent().on("show.bs.dropdown",function(){try{var e=t.template(a.config.template,{documentTitle:l.title,documentMarkdown:l.content,strippedDocumentMarkdown:l.content.substring(l.frontMatter?l.frontMatter._frontMatter.length:0),documentHTML:u,documentHTMLWithComments:c,frontMatter:l.frontMatter,publishAttributes:void 0});n.value=e}catch(i){s.onError(i)}})},a}),define("text!html/buttonViewer.html",[],function(){return'\n \n\n'}),define("extensions/buttonViewer",["jquery","classes/Extension","text!html/buttonViewer.html"],function(e,t,n){var i=new t("buttonViewer",'Button "Viewer"',!0,!0);return i.settingsBlock='\n \n\n\n \n\nAdds a "Viewer" button over the preview.
',i.onCreatePreviewButton=function(){return n},i}),"undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(e){function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(void 0!==e.style[n])return{end:t[n]}}e.fn.emulateTransitionEnd=function(t){var n=!1,i=this;e(this).one(e.support.transition.end,function(){n=!0});var r=function(){n||e(i).trigger(e.support.transition.end)};return setTimeout(r,t),this},e(function(){e.support.transition=t()})}(jQuery),+function(e){var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function n(){o.trigger("closed.bs.alert").remove()}var i=e(this),r=i.attr("data-target");r||(r=i.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));var o=e(r);t&&t.preventDefault(),o.length||(o=i.hasClass("alert")?i:i.parent()),o.trigger(t=e.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.one(e.support.transition.end,n).emulateTransitionEnd(150):n())};var i=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var i=e(this),r=i.data("bs.alert");r||i.data("bs.alert",r=new n(this)),"string"==typeof t&&r[t].call(i)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.bs.alert.data-api",t,n.prototype.close)}(jQuery),+function(e){var t=function(n,i){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,i)};t.DEFAULTS={loadingText:"loading..."},t.prototype.setState=function(e){var t="disabled",n=this.$element,i=n.is("input")?"val":"html",r=n.data();e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){"loadingText"==e?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons"]'),t=!0;if(e.length){var n=this.$element.find("input");"radio"===n.prop("type")&&(n.prop("checked")&&this.$element.hasClass("active")?t=!1:e.find(".active").removeClass("active")),t&&n.prop("checked",!this.$element.hasClass("active")).trigger("change")}t&&this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var i=e(this),r=i.data("bs.button"),o="object"==typeof n&&n;r||i.data("bs.button",r=new t(this,o)),"toggle"==n?r.toggle():n&&r.setState(n)})},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.bs.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle"),t.preventDefault()})}(jQuery),+function(e){var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},t.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},t.prototype.to=function(t){var n=this,i=this.getActiveIndex();return t>this.$items.length-1||0>t?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){n.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",e(this.$items[t]))},t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},t.prototype.next=function(){return this.sliding?void 0:this.slide("next")},t.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},t.prototype.slide=function(t,n){var i=this.$element.find(".item.active"),r=n||i[t](),o=this.interval,a="next"==t?"left":"right",s="next"==t?"first":"last",l=this;if(!r.length){if(!this.options.wrap)return;r=this.$element.find(".item")[s]()}this.sliding=!0,o&&this.pause();var c=e.Event("slide.bs.carousel",{relatedTarget:r[0],direction:a});if(!r.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var t=e(l.$indicators.children()[l.getActiveIndex()]);t&&t.addClass("active")})),e.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(c),c.isDefaultPrevented())return;r.addClass(t),r[0].offsetWidth,i.addClass(a),r.addClass(a),i.one(e.support.transition.end,function(){r.removeClass([t,a].join(" ")).addClass("active"),i.removeClass(["active",a].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(c),c.isDefaultPrevented())return;i.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return o&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var i=e(this),r=i.data("bs.carousel"),o=e.extend({},t.DEFAULTS,i.data(),"object"==typeof n&&n),a="string"==typeof n?n:o.slide;r||i.data("bs.carousel",r=new t(this,o)),"number"==typeof n?r.to(n):a?r[a]():o.interval&&r.pause().cycle()})},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n,i=e(this),r=e(i.attr("data-target")||(n=i.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"")),o=e.extend({},r.data(),i.data()),a=i.attr("data-slide-to");a&&(o.interval=!1),r.carousel(o),(a=i.attr("data-slide-to"))&&r.data("bs.carousel").to(a),t.preventDefault()}),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var t=e(this);t.carousel(t.data())})})}(jQuery),+function(e){var t=function(n,i){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,i),this.transitioning=null,this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.DEFAULTS={toggle:!0},t.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},t.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t=e.Event("show.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var n=this.$parent&&this.$parent.find("> .panel > .in");if(n&&n.length){var i=n.data("bs.collapse");if(i&&i.transitioning)return;n.collapse("hide"),i||n.data("bs.collapse",null)}var r=this.dimension(); -this.$element.removeClass("collapse").addClass("collapsing")[r](0),this.transitioning=1;var o=function(){this.$element.removeClass("collapsing").addClass("in")[r]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return o.call(this);var a=e.camelCase(["scroll",r].join("-"));this.$element.one(e.support.transition.end,e.proxy(o,this)).emulateTransitionEnd(350)[r](this.$element[0][a])}}},t.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=e.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return e.support.transition?void this.$element[n](0).one(e.support.transition.end,e.proxy(i,this)).emulateTransitionEnd(350):i.call(this)}}},t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var i=e(this),r=i.data("bs.collapse"),o=e.extend({},t.DEFAULTS,i.data(),"object"==typeof n&&n);r||i.data("bs.collapse",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(t){var n,i=e(this),r=i.attr("data-target")||t.preventDefault()||(n=i.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""),o=e(r),a=o.data("bs.collapse"),s=a?"toggle":i.data(),l=i.attr("data-parent"),c=l&&e(l);a&&a.transitioning||(c&&c.find('[data-toggle=collapse][data-parent="'+l+'"]').not(i).addClass("collapsed"),i[o.hasClass("in")?"addClass":"removeClass"]("collapsed")),o.collapse(s)})}(jQuery),+function(e){function t(){e(i).remove(),e(r).each(function(t){var i=n(e(this));i.hasClass("open")&&(i.trigger(t=e.Event("hide.bs.dropdown")),t.isDefaultPrevented()||i.removeClass("open").trigger("hidden.bs.dropdown"))})}function n(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var i=n&&e(n);return i&&i.length?i:t.parent()}var i=".dropdown-backdrop",r="[data-toggle=dropdown]",o=function(t){e(t).on("click.bs.dropdown",this.toggle)};o.prototype.toggle=function(i){var r=e(this);if(!r.is(".disabled, :disabled")){var o=n(r),a=o.hasClass("open");if(t(),!a){if("ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&e('').insertAfter(e(this)).on("click",t),o.trigger(i=e.Event("show.bs.dropdown")),i.isDefaultPrevented())return;o.toggleClass("open").trigger("shown.bs.dropdown"),r.focus()}return!1}},o.prototype.keydown=function(t){if(/(38|40|27)/.test(t.keyCode)){var i=e(this);if(t.preventDefault(),t.stopPropagation(),!i.is(".disabled, :disabled")){var o=n(i),a=o.hasClass("open");if(!a||a&&27==t.keyCode)return 27==t.which&&o.find(r).focus(),i.click();var s=e("[role=menu] li:not(.divider):visible a",o);if(s.length){var l=s.index(s.filter(":focus"));38==t.keyCode&&l>0&&l--,40==t.keyCode&&l').appendTo(document.body),this.$element.on("click.dismiss.modal",e.proxy(function(e){e.target===e.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;i?this.$backdrop.one(e.support.transition.end,t).emulateTransitionEnd(150):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t).emulateTransitionEnd(150):t()):t&&t()};var n=e.fn.modal;e.fn.modal=function(n,i){return this.each(function(){var r=e(this),o=r.data("bs.modal"),a=e.extend({},t.DEFAULTS,r.data(),"object"==typeof n&&n);o||r.data("bs.modal",o=new t(this,a)),"string"==typeof n?o[n](i):a.show&&o.show(i)})},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),i=n.attr("href"),r=e(n.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),o=r.data("modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},r.data(),n.data());t.preventDefault(),r.modal(o,this).one("hide",function(){n.is(":visible")&&n.focus()})}),e(document).on("show.bs.modal",".modal",function(){e(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){e(document.body).removeClass("modal-open")})}(jQuery),+function(e){var t=function(e,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",e,t)};t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:' ',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},t.prototype.init=function(t,n,i){this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(i);for(var r=this.options.trigger.split(" "),o=r.length;o--;){var a=r[o];if("click"==a)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=a){var s="hover"==a?"mouseenter":"focus",l="hover"==a?"mouseleave":"blur";this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},t.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,i){n[e]!=i&&(t[e]=i)}),t},t.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(n.timeout),n.hoverState="in",n.options.delay&&n.options.delay.show?void(n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show)):n.show()},t.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(n.timeout),n.hoverState="out",n.options.delay&&n.options.delay.hide?void(n.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide)):n.hide()},t.prototype.show=function(){var t=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(t),t.isDefaultPrevented())return;var n=this.tip();this.setContent(),this.options.animation&&n.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,n[0],this.$element[0]):this.options.placement,r=/\s?auto?\s?/i,o=r.test(i);o&&(i=i.replace(r,"")||"top"),n.detach().css({top:0,left:0,display:"block"}).addClass(i),this.options.container?n.appendTo(this.options.container):n.insertAfter(this.$element);var a=this.getPosition(),s=n[0].offsetWidth,l=n[0].offsetHeight;if(o){var c=this.$element.parent(),u=i,d=document.documentElement.scrollTop||document.body.scrollTop,p="body"==this.options.container?window.innerWidth:c.outerWidth(),f="body"==this.options.container?window.innerHeight:c.outerHeight(),h="body"==this.options.container?0:c.offset().left;i="bottom"==i&&a.top+a.height+l-d>f?"top":"top"==i&&a.top-d-l<0?"bottom":"right"==i&&a.right+s>p?"left":"left"==i&&a.left-s",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){},onPause:function(){},onResume:function(){}},n),this._force=!1,this._inited=!1,this._steps=[],this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return n.prototype.setState=function(e,t){var n,i;if(this._options.storage){i=""+this._options.name+"_"+e;try{this._options.storage.setItem(i,t)}catch(r){n=r,n.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. setState failed.")}return this._options.afterSetState(i,t)}return null==this._state&&(this._state={}),this._state[e]=t},n.prototype.removeState=function(e){var t;return this._options.storage?(t=""+this._options.name+"_"+e,this._options.storage.removeItem(t),this._options.afterRemoveState(t)):null!=this._state?delete this._state[e]:void 0},n.prototype.getState=function(e){var t,n;return this._options.storage?(t=""+this._options.name+"_"+e,n=this._options.storage.getItem(t)):null!=this._state&&(n=this._state[e]),(void 0===n||"null"===n)&&(n=null),this._options.afterGetState(e,n),n},n.prototype.addSteps=function(e){var t,n,i,r;for(r=[],n=0,i=e.length;i>n;n++)t=e[n],r.push(this.addStep(t));return r},n.prototype.addStep=function(e){return this._steps.push(e)},n.prototype.getStep=function(t){return null!=this._steps[t]?e.extend({id:"step-"+t,path:"",placement:"right",title:"",content:"",next:t===this._steps.length-1?-1:t+1,prev:t-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,duration:this._options.duration,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume},this._steps[t]):void 0},n.prototype.init=function(e){var t=this;return this._force=e,this.ended()?this._debug("Tour ended, init prevented."):(this.setCurrentStep(),this._setupMouseNavigation(),this._setupKeyboardNavigation(),this._onResize(function(){return t.showStep(t._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},n.prototype.start=function(e){var t;return null==e&&(e=!1),this._inited||this.init(e),null===this._current?(t=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(t,this.showStep,0)):void 0},n.prototype.next=function(){var e;return this.ended()?this._debug("Tour ended, next prevented."):(e=this.hideStep(this._current),this._callOnPromiseDone(e,this._showNextStep))},n.prototype.prev=function(){var e;return this.ended()?this._debug("Tour ended, prev prevented."):(e=this.hideStep(this._current),this._callOnPromiseDone(e,this._showPrevStep))},n.prototype.goTo=function(e){var t;return this.ended()?this._debug("Tour ended, goTo prevented."):(t=this.hideStep(this._current),this._callOnPromiseDone(t,this.showStep,e))},n.prototype.end=function(){var n,r,o=this;return n=function(){return e(i).off("click.tour-"+o._options.name),e(i).off("keyup.tour-"+o._options.name),e(t).off("resize.tour-"+o._options.name),o.setState("end","yes"),o._inited=!1,o._force=!1,o._clearTimer(),null!=o._options.onEnd?o._options.onEnd(o):void 0},r=this.hideStep(this._current),this._callOnPromiseDone(r,n)},n.prototype.ended=function(){return!this.force&&!!this.getState("end")},n.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},n.prototype.pause=function(){var e;return e=this.getStep(this._current),e&&e.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,t.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=e.onPause?e.onPause(this,this._duration):void 0):void 0},n.prototype.resume=function(){var e,n=this;return e=this.getStep(this._current),e&&e.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||e.duration,this._timer=t.setTimeout(function(){return n._isLast()?n.next():n.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=e.onResume&&this._duration!==e.duration?e.onResume(this,this._duration):void 0):void 0},n.prototype.hideStep=function(t){var n,i,r,o=this;return(r=this.getStep(t))?(this._clearTimer(),i=this._makePromise(null!=r.onHide?r.onHide(this,t):void 0),n=function(){var t;return t=e(r.element),t.data("bs.popover")||t.data("popover")||(t=e("body")),t.popover("destroy"),r.reflex&&t.css("cursor","").off("click.tour-"+o._options.name),r.backdrop&&o._hideBackdrop(),null!=r.onHidden?r.onHidden(o):void 0},this._callOnPromiseDone(i,n),i):void 0},n.prototype.showStep=function(t){var n,r,o,a,s=this;return(a=this.getStep(t))?(o=t").parent().html(),i.popover({placement:t.placement,trigger:"manual",title:t.title,content:t.content,html:!0,animation:t.animation,container:t.container,template:t.template,selector:t.element}).popover("show"),a=i.data("bs.popover")?i.data("bs.popover").tip():i.data("popover").tip(),a.attr("id",t.id),this._reposition(a,t),s?this._center(a):void 0},n.prototype._reposition=function(t,n){var r,o,a,s,l,c,u;if(s=t[0].offsetWidth,o=t[0].offsetHeight,u=t.offset(),l=u.left,c=u.top,r=e(i).outerHeight()-u.top-t.outerHeight(),0>r&&(u.top=u.top+r),a=e("html").outerWidth()-u.left-t.outerWidth(),0>a&&(u.left=u.left+a),u.top<0&&(u.top=0),u.left<0&&(u.left=0),t.offset(u),"bottom"===n.placement||"top"===n.placement){if(l!==u.left)return this._replaceArrow(t,2*(u.left-l),s,"left")}else if(c!==u.top)return this._replaceArrow(t,2*(u.top-c),o,"top")},n.prototype._center=function(n){return n.css("top",e(t).outerHeight()/2-n.outerHeight()/2)},n.prototype._replaceArrow=function(e,t,n,i){return e.find(".arrow").css(i,t?50*(1-t/n)+"%":"")},n.prototype._scrollIntoView=function(n,i){var r,o,a,s,l,c=this;return n?(r=e(n),o=e(t),a=r.offset().top,l=o.height(),s=Math.max(0,a-l/2),this._debug("Scroll into view. ScrollTop: "+s+". Element offset: "+a+". Window height: "+l+"."),e("body").stop().animate({scrollTop:Math.ceil(s)},function(){return i(),c._debug("Scroll into view. Animation end element offset: "+r.offset().top+". Window height: "+o.height()+".")})):i()},n.prototype._onResize=function(n,i){return e(t).on("resize.tour-"+this._options.name,function(){return clearTimeout(i),i=setTimeout(n,100)})},n.prototype._setupMouseNavigation=function(){var t=this;return t=this,e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)",function(e){return e.preventDefault(),t.next()}),e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)",function(e){return e.preventDefault(),t.prev()}),e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]",function(e){return e.preventDefault(),t.end() -}),e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]",function(n){var i;return n.preventDefault(),i=e(this),i.text(i.data(t._paused?"pause-text":"resume-text")),t._paused?t.resume():t.pause()})},n.prototype._setupKeyboardNavigation=function(){var t=this;if(this._options.keyboard)return e(i).on("keyup.tour-"+this._options.name,function(e){if(e.which)switch(e.which){case 39:return e.preventDefault(),t._isLast()?t.next():t.end();case 37:if(e.preventDefault(),t._current>0)return t.prev();break;case 27:return e.preventDefault(),t.end()}})},n.prototype._makePromise=function(t){return t&&e.isFunction(t.then)?t:null},n.prototype._callOnPromiseDone=function(e,t,n){var i=this;return e?e.then(function(){return t.call(i,n)}):t.call(this,n)},n.prototype._showBackdrop=function(){return this.backdrop.backgroundShown?void 0:(this.backdrop=e("",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,e("body").append(this.backdrop))},n.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},n.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},n.prototype._showOverlayElement=function(t){var n,i,r;if(!this.backdrop.overlayElementShown)return this.backdrop.overlayElementShown=!0,i=e(t),n=e(""),r=i.offset(),r.top=r.top,r.left=r.left,n.width(i.innerWidth()).height(i.innerHeight()).addClass("tour-step-background").offset(r),i.addClass("tour-step-backdrop"),e("body").append(n),this.backdrop.$element=i,this.backdrop.$background=n},n.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},n.prototype._clearTimer=function(){return t.clearTimeout(this._timer),this._timer=null,this._duration=null},n}(),t.Tour=n}(jQuery,window),define("bootstrap-tour",["bootstrap"],function(e){return function(){var t;return t||e.Tour}}(this)),define("extensions/welcomeTour",["underscore","jquery","storage","classes/Extension","bootstrap-tour"],function(e,t,n,i,r){var o,a=new i("welcomeTour","Welcome tour",!1,!0);return a.onEventMgrCreated=function(e){o=e},a.onReady=function(){function i(e,n,i){var r=t(e).tooltip({html:!0,placement:i,trigger:"manual",title:n}).tooltip("show").addClass("info-tooltip");r.one("click",function(){r.tooltip("hide").removeClass("info-tooltip")}),setTimeout(function(){r.tooltip("hide").removeClass("info-tooltip")},2e4)}var a=new r({keyboard:!1,storage:{getItem:function(){},setItem:function(){},removeItem:function(){}},onEnd:function(){n.welcomeTour="done",i(".menu-panel .toggle-button *","Synchronize, publish and more...","right"),i(".document-panel .toggle-button *","Create and manage documents","left"),i(".extension-preview-buttons .btn-group:first","Need help with Markdown syntax?","left"),i(".layout-toggler-preview","Toggle preview","right")},template:[' ',' ',' ',' ',' ",""].join("")});a.addSteps([{element:".navbar-inner",title:"StackEdit 4 beta preview!",content:["What's new?
","","
",'- New contenteditable editor (thanks to Dabblet, Editorially...)
","- New layout with CSS3 transitions (lighter supposedly)
","- Comments/discussions support (see the new icon in the navigation bar)
","- Auto-merge and conflict detection using standard synchronization
","- Dropped real time sync support :( since you can collaborate using standard synchronization
","Please provide your feedback here and declare new issues on GitHub... Thanks!
',''].join(""),placement:"bottom",onShown:function(){o.onTweet()}}]),e.has(n,"welcomeTour")||a.start(),t(".action-welcome-tour").click(function(){a.restart()})},a}),define("text!extensions/shortcutsDefaultMapping.settings",[],function(){return"{\n 'mod+b': bindPagedownButton('bold'),\n 'mod+i': bindPagedownButton('italic'),\n 'mod+l': bindPagedownButton('link'),\n 'mod+q': bindPagedownButton('quote'),\n 'mod+k': bindPagedownButton('code'),\n 'mod+g': bindPagedownButton('image'),\n 'mod+o': bindPagedownButton('olist'),\n 'mod+u': bindPagedownButton('ulist'),\n 'mod+h': bindPagedownButton('heading'),\n 'mod+r': bindPagedownButton('hr'),\n 'mod+z': bindPagedownButton('undo'),\n 'mod+y': bindPagedownButton('redo'),\n 'mod+shift+z': bindPagedownButton('redo'),\n 'mod+m': function(evt) {\n $('.button-open-discussion').click();\n evt.preventDefault();\n },\n '= = > space': function() {\n expand('==> ', '⇒ ');\n },\n '< = = space': function() {\n expand('<== ', '⇠');\n },\n 'S t a c k E d i t': function() {\n eventMgr.onMessage(\"You are stunned!!! Aren't you?\");\n }\n}\n"}),define("text!html/shortcutsSettingsBlock.html",[],function(){return'Maps keyboard shortcuts to JavaScript functions.
\n\n\n'}),define("extensions/shortcuts",["jquery","underscore","utils","mousetrap","classes/Extension","text!extensions/shortcutsDefaultMapping.settings","text!html/shortcutsSettingsBlock.html"],function($,_,utils,mousetrap,Extension,shortcutsDefaultMapping,shortcutsSettingsBlockHTML){function bindPagedownButton(e){return function(t){pagedownEditor.uiManager.doClick(pagedownEditor.uiManager.buttons[e]),t.preventDefault()}}function expand(e,t){utils.defer(function(){require("editor").replacePreviousText(e,t)})}var shortcuts=new Extension("shortcuts","Shortcuts",!0,!0);shortcuts.settingsBlock=shortcutsSettingsBlockHTML,shortcuts.defaultConfig={mapping:shortcutsDefaultMapping};var eventMgr,pagedownEditor;return shortcuts.onEventMgrCreated=function(e){eventMgr=e,eventMgr.addListener("onPagedownConfigure",function(e){pagedownEditor=e})},shortcuts.onLoadSettings=function(){utils.setInputValue("#textarea-shortcuts-mapping",shortcuts.config.mapping)},shortcuts.onSaveSettings=function(newConfig,event){newConfig.code=utils.getInputValue("#textarea-shortcuts-mapping");try{eval("var test = "+newConfig.code)}catch(e){eventMgr.onError(e),utils.getInputTextValue("#textarea-shortcuts-mapping",event,/^$/)}},shortcuts.onInit=function(){try{var shortcutMap;eval("shortcutMap = "+shortcuts.config.mapping),_.each(shortcutMap,function(e,t){mousetrap.bind(t,e)})}catch(e){console.error(e)}},shortcuts}),define("text!html/userCustomSettingsBlock.html",[],function(){return'\n \n\n\n \n\nAllows users to implement their own extension.
\n\n\nMore info'}),define("extensions/userCustom",["jquery","underscore","utils","classes/Extension","fileSystem","settings","text!html/userCustomSettingsBlock.html"],function($,_,utils,Extension,fileSystem,settings,userCustomSettingsBlockHTML){var userCustom=new Extension("userCustom","UserCustom extension",!0);userCustom.settingsBlock=userCustomSettingsBlockHTML,userCustom.defaultConfig={code:""};var fileMgr;userCustom.onFileMgrCreated=function(e){fileMgr=e};var synchronizer;userCustom.onSynchronizerCreated=function(e){synchronizer=e};var publisher;userCustom.onPublisherCreated=function(e){publisher=e};var eventMgr;return userCustom.onEventMgrCreated=function(e){eventMgr=e},userCustom.onLoadSettings=function(){utils.setInputValue("#textarea-usercustom-code",userCustom.config.code)},userCustom.onSaveSettings=function(newConfig,event){newConfig.code=utils.getInputValue("#textarea-usercustom-code");try{eval(newConfig.code)}catch(e){eventMgr.onError(e),utils.getInputTextValue("#textarea-usercustom-code",event,/^$/)}},userCustom.onInit=function(){try{eval(userCustom.config.code)}catch(e){console.error(e)}},userCustom}),define("text!html/commentsPopoverContent.html",[],function(){return'\n \n\n\n \n\n\n\n<%= commentList %>\n\n\n\n \n \n\n\n \n\n
\n'}),define("extensions/comments",["jquery","underscore","utils","storage","crel","rangy","classes/Extension","text!html/commentsPopoverContent.html","bootstrap"],function(e,t,n,i,r,o,a,s){function l(e,t,n){t=Math.round(t);for(var i=t-21;t+22>i;)w[i]&&(t=i+22),i++;!n&&(w[t]=1);var r=-8;-1!==e.className.indexOf(" icon-split")&&(r=-12);var o=t+r;e.style.top=o+"px",e.style.right="12px"}function c(t,n){this.commentElt=t,this.$commentElt=e(t).addClass("active"),this.fileDesc=n,this.discussionIndex=t.discussionIndex}function u(e){var t=C.getPopoverElt(),n=0;t.offsetWidthi&&(t.style.top=parseInt(t.style.top)+i+"px")}function d(){C&&C.$commentElt.popover("toggle").popover("destroy")}function p(){var e=C.getDiscussion(),n=i["author.name"],r=[];return e.commentList&&(r=e.commentList.map(function(e){var i=e.author||"Anonymous";return t.template(m,{author:i,content:e.content,reply:e.author!=n})})),"conflict"==e.type&&r.unshift(t.template(m,{author:"StackEdit",content:"Multiple users have made conflicting modifications.",reply:!0})),r.join("")}var f,h=new a("comments","Comments",!1,!0),m=[" \">",'"].join(""),g=[' ',' ',' ',' '," "," “<%- title %>â€",""].join("");h.onEventMgrCreated=function(e){f=e};var v,b;h.onEditorCreated=function(e){v=e,b=v.selectionMgr};var y,x,w=[],S=r("a",{"class":"discussion icon-comment new"});c.prototype.getDiscussion=function(){return this.discussionIndex?this.fileDesc.discussionList[this.discussionIndex]:this.fileDesc.newDiscussion},c.prototype.getPopoverElt=function(){return document.querySelector(".comments-popover .popover:last-child")};var C,T,E,k,_,I,D={},N=[],L=!1,M=t.debounce(function(){function e(){var i;if(0===o.length)return t.filter(D,function(e,n){return!t.has(E.discussionList,n)}).forEach(function(e){x.removeChild(e),delete D[e.discussionIndex]}),C&&!C.discussionIndex&&(i=b.getCoordinates(C.getDiscussion().selectionEnd),l(S,i.y,!0),y.scrollTop+=parseInt(S.style.top)-y.scrollTop-3*y.offsetHeight/4,u(S)),N=t.sortBy(D,function(e){return e.selectionEnd}),_.toggleClass("some",0!==N.length),_.toggleClass("replied",L),void I.toggleClass("icon-chat",0!==N.length);var a=o.shift(),s=D[a.discussionIndex];s||(s=r("a"));var c="discussion",d=!a.commentList||t.last(a.commentList).author!=n;d&&(L=!0),c+="conflict"==a.type?" icon-split":" icon-comment",c+=d?" replied":" added",s.className=c,s.discussionIndex=a.discussionIndex,s.selectionEnd=a.selectionEnd,i=b.getCoordinates(a.selectionEnd),l(s,i.y),x.appendChild(s),D[a.discussionIndex]=s,C&&C.getDiscussion()===a&&(y.scrollTop+=parseInt(s.style.top)-y.scrollTop-3*y.offsetHeight/4,u(s)),k=setTimeout(e,5)}if(void 0!==E){L=!1,N=[];var n=i["author.name"];w=[];var o=t.sortBy(E.discussionList,function(e){return e.selectionEnd});clearTimeout(k),k=setTimeout(e,5)}},50);return h.onLayoutResize=M,h.onFileOpen=function(e){E=e,M()},h.onContentChanged=function(e){E===e&&M()},h.onCommentsChanged=function(e){if(E===e){if(void 0!==C){var t=C;t.discussionIndex&&(t.getPopoverElt().querySelector(".discussion-comment-list").innerHTML=p());try{T.undoToRange(t.rangyRange)}catch(n){}var i=t.getDiscussion();t.selectionRange=b.createRange(i.selectionStart,i.selectionEnd),t.rangyRange=o.createRange(),t.rangyRange.setStart(t.selectionRange.startContainer,t.selectionRange.startOffset),t.rangyRange.setEnd(t.selectionRange.endContainer,t.selectionRange.endOffset),setTimeout(function(){C===t&&T.applyToRange(t.rangyRange)},50)}M()}},h.onDiscussionCreated=function(e){E===e&&M()},h.onDiscussionRemoved=function(e,t){E===e&&(void 0!==C&&C.discussionIndex==t.discussionIndex&&d(),M())},h.onReady=function(){T=o.createCssClassApplier("comment-highlight",{normalize:!1});var a="";y=document.getElementById("wmd-input"),x=document.querySelector("#wmd-input > .editor-margin"),x.appendChild(S);var h=e(r("div",{"class":"comments-popover"}));e(document.body).append(h).on("click",function(e){C&&C.$commentElt[0]!==e.target&&d()}).popover({placement:"auto top",container:".comments-popover",html:!0,title:function(){if(!C)return!0;var e=C.getDiscussion(),n=e.selectionEnd-e.selectionStart,i=v.getValue().substr(e.selectionStart,n>20?20:n);return n>20&&(i+="..."),t.template(g,{title:i})},content:function(){var e=t.template(s,{commentList:p()});return e},selector:"#wmd-input > .editor-margin > .discussion"}),e(x).on("show.bs.popover",function(e){d();var t=new c(e.target,E);C=t;var n=t.getDiscussion();if(!n){var i=Math.min(b.selectionStart,b.selectionEnd),r=Math.max(b.selectionStart,b.selectionEnd);if(i===r){var o=b.getClosestWordOffset(i);i=o.start,r=o.end}n={selectionStart:i,selectionEnd:r,commentList:[]},E.newDiscussion=n;var a=b.getCoordinates(i);l(S,a.y,!0)}t.selectionRange=b.createRange(n.selectionStart,n.selectionEnd),y.scrollTop+=parseInt(e.target.style.top)-y.scrollTop-3*y.offsetHeight/4}).on("shown.bs.popover",function(r){var s=C,l=s.getPopoverElt();s.$authorInputElt=e(l.querySelector(".input-comment-author")).val(i["author.name"]),s.$contentInputElt=e(l.querySelector(".input-comment-content")),s.hr=l.querySelector("hr"),u(s.commentElt),l.querySelector(".scrollport").scrollTop=9999999;var c=e(l.querySelector(".action-add-comment"));e().add(s.$contentInputElt).add(s.$authorInputElt).keydown(function(e){switch(e.which){case 13:return e.preventDefault(),void c.click();case 27:return e.preventDefault(),d(),v.focus(),void v.adjustCursorPosition()}}),c.click(function(e){var i=n.getInputTextValue(s.$authorInputElt),r=n.getInputTextValue(s.$contentInputElt,e);if(!e.isPropagationStopped()){var o=s.getDiscussion();s.$contentInputElt.val(""),d(),o.commentList=o.commentList||[],o.commentList.push({author:i,content:r});var a=s.fileDesc.discussionList||{};if(o.discussionIndex)s.fileDesc.discussionList=a,f.onCommentsChanged(s.fileDesc);else{var l;do l=n.randomString();while(t.has(a,l));o.discussionIndex=l,a[l]=o,s.fileDesc.discussionList=a,f.onDiscussionCreated(s.fileDesc,o)}y.focus()}});var p=e(l.querySelector(".action-remove-discussion"));r.target.discussionIndex?p.click(function(){d();var e=s.getDiscussion();delete s.fileDesc.discussionList[e.discussionIndex],s.fileDesc.discussionList=s.fileDesc.discussionList,f.onDiscussionRemoved(s.fileDesc,e),y.focus()}):p.hide(),s.rangyRange=o.createRange(),s.rangyRange.setStart(s.selectionRange.startContainer,s.selectionRange.startOffset),s.rangyRange.setEnd(s.selectionRange.endContainer,s.selectionRange.endOffset),setTimeout(function(){C===s&&T.applyToRange(s.rangyRange)},50),s.$contentInputElt.focus().val(a)}).on("hide.bs.popover",function(){C&&(C.$commentElt.removeClass("active"),a=C.$contentInputElt.val(),i["author.name"]=C.$authorInputElt.val(),T.undoToRange(C.rangyRange),C=void 0,delete E.newDiscussion)}),h.on("click",".popover",function(e){e.stopPropagation()});var m=e(S);_=e(".button-open-discussion").click(function(n){var i=m;if(C)if(C.discussionIndex){var r=-1;N.some(function(e,t){return e===C.commentElt?(r=t,!0):void 0}),i=e(N[r+1])}else i=e(t.first(N));0===i.length?(d(),v.focus(),v.adjustCursorPosition()):i.click(),n.stopPropagation()}),I=_.find("i")},h}),function(e){var t="waitForImages";e.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage"]},e.expr[":"].uncached=function(t){if(!e(t).is('img[src!=""]'))return!1;var n=new Image;return n.src=t.src,!n.complete},e.fn.waitForImages=function(n,i,r){var o=0,a=0;if(e.isPlainObject(arguments[0])&&(r=arguments[0].waitForAll,i=arguments[0].each,n=arguments[0].finished),n=n||e.noop,i=i||e.noop,r=!!r,!e.isFunction(n)||!e.isFunction(i))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var s=e(this),l=[],c=e.waitForImages.hasImageProperties||[],u=/url\(\s*(['"]?)(.*?)\1\s*\)/g;r?s.find("*").andSelf().each(function(){var t=e(this);t.is("img:uncached")&&l.push({src:t.attr("src"),element:t[0]}),e.each(c,function(e,n){var i,r=t.css(n);if(!r)return!0;for(;i=u.exec(r);)l.push({src:i[2],element:t[0]})})}):s.find("img:uncached").each(function(){l.push({src:this.src,element:this})}),o=l.length,a=0,0===o&&n.call(s[0]),e.each(l,function(r,l){var c=new Image;e(c).bind("load."+t+" error."+t,function(e){return a++,i.call(l.element,a,o,"load"==e.type),a==o?(n.call(s[0]),!1):void 0}),c.src=l.src})})}}(jQuery),define("jquery-waitforimages",function(){}),define("eventMgr",["jquery","underscore","crel","utils","logger","classes/Extension","settings","text!html/settingsExtensionsAccordion.html","extensions/yamlFrontMatterParser","extensions/markdownSectionParser","extensions/partialRendering","extensions/buttonMarkdownSyntax","extensions/googleAnalytics","extensions/twitter","extensions/dialogAbout","extensions/dialogManagePublication","extensions/dialogManageSynchronization","extensions/dialogManageSharing","extensions/dialogOpenHarddrive","extensions/documentTitle","extensions/documentSelector","extensions/documentPanel","extensions/documentManager","extensions/workingIndicator","extensions/notifications","extensions/markdownExtra","extensions/toc","extensions/mathJax","extensions/emailConverter","extensions/scrollSync","extensions/buttonSync","extensions/buttonPublish","extensions/buttonStat","extensions/buttonHtmlCode","extensions/buttonViewer","extensions/welcomeTour","extensions/shortcuts","extensions/userCustom","extensions/comments","bootstrap","jquery-waitforimages"],function(e,t,n,i,r,o,a,s){function l(e){return t.chain(p).map(function(t){return t.enabled&&t[e]}).compact().value()}function c(e){return h[e]=l(e),function(){r.log(e,arguments);var n=arguments;t.each(h[e],function(e){try{e.apply(null,n)}catch(i){console.error(t.isObject(i)?i.stack:i)}})}}function u(e){d[e]=c(e)}var d={},p=t.chain(arguments).map(function(e){return e instanceof o&&e}).compact().value(),f=a.extensionSettings||{};t.each(p,function(e){e.config=t.extend({},e.defaultConfig,f[e.extensionId]),e.enabled=window.viewerMode===!0&&e.disableInViewer===!0?!1:!e.isOptional||void 0===e.config.enabled||e.config.enabled===!0});var h={};d.addListener=function(e,t){try{h[e].push(t)}catch(n){console.error("No event listener called "+e)}},c("onInit")(),d.onLoadSettings=function(){r.log("onLoadSettings"),t.each(p,function(e){var t=!e.isOptional||void 0===e.config.enabled||e.config.enabled===!0;i.setInputChecked("#input-enable-extension-"+e.extensionId,t),"markdownExtra"==e.extensionId?i.setInputChecked("#input-settings-markdown-extra",t):"mathJax"==e.extensionId&&i.setInputChecked("#input-settings-mathjax",t);var n=e.onLoadSettings;n&&n()})},d.onSaveSettings=function(e,n){r.log("onSaveSettings"),t.each(p,function(r){var o=t.extend({},r.defaultConfig);o.enabled=i.getInputChecked("#input-enable-extension-"+r.extensionId);var a;"markdownExtra"==r.extensionId?(a=i.getInputChecked("#input-settings-markdown-extra"),a!=r.enabled&&(o.enabled=a)):"mathJax"==r.extensionId&&(a=i.getInputChecked("#input-settings-mathjax"),a!=r.enabled&&(o.enabled=a));var s=r.onSaveSettings;s&&s(o,n),e[r.extensionId]=o})},u("onMessage"),u("onError"),u("onOfflineChanged"),u("onUserActive"),u("onAsyncRunning"),u("onPeriodicRun"),u("onEditorCreated"),u("onFileMgrCreated"),u("onSynchronizerCreated"),u("onPublisherCreated"),u("onEventMgrCreated"),u("onFileCreated"),u("onFileDeleted"),u("onFileSelected"),u("onFileOpen"),u("onFileClosed"),u("onContentChanged"),u("onTitleChanged"),u("onFoldersChanged"),u("onSyncRunning"),u("onSyncSuccess"),u("onSyncImportSuccess"),u("onSyncExportSuccess"),u("onSyncRemoved"),u("onPublishRunning"),u("onPublishSuccess"),u("onNewPublishSuccess"),u("onPublishRemoved"),u("onLayoutCreated"),u("onLayoutResize"),u("onPagedownConfigure"),u("onSectionsCreated"),u("onCursorCoordinates"),u("onDiscussionCreated"),u("onDiscussionRemoved"),u("onCommentsChanged"),u("onTweet");var m,g,v=c("onPreviewFinished"),b=l("onAsyncPreview");d.onAsyncPreview=function(){function e(n){var r=n.length?n.shift():function(){setTimeout(function(){var e="";t.each(m.children,function(t){e+=t.innerHTML});var n=i.trim(e),r=n.replace(/ .*?<\/span> /g,"");v(n,r)},10)};r(function(){e(n)})}r.log("onAsyncPreview"),e(b.concat([function(e){g.waitForImages(e)}]))};var y=c("onReady");return d.onReady=function(){m=document.getElementById("preview-contents"),g=e(m);var i=function(e){var i=n("div",{"class":"btn-group"}),r=e();return t.isString(r)?i.innerHTML=r:t.isElement(r)&&i.appendChild(r),i};if(window.viewerMode===!1){var o=t.chain(p).sortBy(function(e){return e.extensionName.toLowerCase()}).reduce(function(e,n){return e+(n.settingsBlock?t.template(s,{extensionId:n.extensionId,extensionName:n.extensionName,isOptional:n.isOptional,settingsBlock:n.settingsBlock}):"")},"").value();document.querySelector(".accordion-extensions").innerHTML=o,r.log("onCreateButton");var a=l("onCreateButton"),c=document.createDocumentFragment();t.each(a,function(e){c.appendChild(i(e))}),document.querySelector(".extension-buttons").appendChild(c)}r.log("onCreatePreviewButton");var u=l("onCreatePreviewButton"),d=document.createDocumentFragment();t.each(u,function(e){d.appendChild(i(e))});var f=document.querySelector(".extension-preview-buttons");f.appendChild(d),y()},d.onEventMgrCreated(d),d}),function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var i={};for(var r in e)e.hasOwnProperty(r)&&(i[r]=t.util.clone(e[r]));return i;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var i=t.util.clone(t.languages[e]);for(var r in n)i[r]=n[r];return i},insertBefore:function(e,n,i,r){r=r||t.languages;var o=r[e],a={};for(var s in o)if(o.hasOwnProperty(s)){if(s==n)for(var l in i)i.hasOwnProperty(l)&&(a[l]=i[l]);a[s]=o[s]}return r[e]=a},DFS:function(e,n){for(var i in e)n.call(e,i,e[i]),"Object"===t.util.type(e)&&t.languages.DFS(e[i],n)}},highlightAll:function(e,n){for(var i,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),o=0;i=r[o++];)t.highlightElement(i,e===!0,n)},highlightElement:function(i,r,o){for(var a,s,l=i;l&&!e.test(l.className);)l=l.parentNode;if(l&&(a=(l.className.match(e)||[,""])[1],s=t.languages[a]),s){i.className=i.className.replace(e,"").replace(/\s+/g," ")+" language-"+a,l=i.parentNode,/pre/i.test(l.nodeName)&&(l.className=l.className.replace(e,"").replace(/\s+/g," ")+" language-"+a);var c=i.textContent;if(c){c=c.replace(/&/g,"&").replace(/e.length)break e;if(!(p instanceof i)){s.lastIndex=0;var f=s.exec(p);if(f){c&&(u=f[1].length);var h=f.index-1+u,f=f[0].slice(u),m=f.length,g=h+m,v=p.slice(0,h+1),b=p.slice(g+1),y=[d,1];v&&y.push(v);var x=new i(a,l?t.tokenize(f,l):f);y.push(x),b&&y.push(b),Array.prototype.splice.apply(r,y)}}}}return r},hooks:{all:{},add:function(e,n){var i=t.hooks.all;i[e]=i[e]||[],i[e].push(n)},run:function(e,n){var i=t.hooks.all[e];if(i&&i.length)for(var r,o=0;r=i[o++];)r(n)}}},n=t.Token=function(e,t){this.type=e,this.content=t};if(n.stringify=function(e,i,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,i,e)}).join("");var o={type:e.type,content:n.stringify(e.content,i,r),tag:"span",classes:["token",e.type],attributes:{},language:i,parent:r};"comment"==o.type&&(o.attributes.spellcheck="true"),t.hooks.run("wrap",o);var a="";for(var s in o.attributes)a+=s+'="'+(o.attributes[s]||"")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'" '+a+">"+o.content+""+o.tag+">"},!self.document)return void self.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,r=n.code;self.postMessage(JSON.stringify(t.tokenize(r,t.languages[i]))),self.close()},!1);var i=document.getElementsByTagName("script");i=i[i.length-1],i&&(t.filename=i.src,document.addEventListener&&!i.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll))}(),define("prism-core",function(e){return function(){var t;return t||e.Prism}}(this));var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;diff_match_patch.Diff,diff_match_patch.prototype.diff_main=function(e,t,n,i){"undefined"==typeof i&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var r=i;if(null==e||null==t)throw new Error("Null input. (diff_main)");if(e==t)return e?[[DIFF_EQUAL,e]]:[];"undefined"==typeof n&&(n=!0);var o=n,a=this.diff_commonPrefix(e,t),s=e.substring(0,a);e=e.substring(a),t=t.substring(a),a=this.diff_commonSuffix(e,t);var l=e.substring(e.length-a);e=e.substring(0,e.length-a),t=t.substring(0,t.length-a);var c=this.diff_compute_(e,t,o,r);return s&&c.unshift([DIFF_EQUAL,s]),l&&c.push([DIFF_EQUAL,l]),this.diff_cleanupMerge(c),c},diff_match_patch.prototype.diff_compute_=function(e,t,n,i){var r;if(!e)return[[DIFF_INSERT,t]];if(!t)return[[DIFF_DELETE,e]];var o=e.length>t.length?e:t,a=e.length>t.length?t:e,s=o.indexOf(a);if(-1!=s)return r=[[DIFF_INSERT,o.substring(0,s)],[DIFF_EQUAL,a],[DIFF_INSERT,o.substring(s+a.length)]],e.length>t.length&&(r[0][0]=r[2][0]=DIFF_DELETE),r;if(1==a.length)return[[DIFF_DELETE,e],[DIFF_INSERT,t]];var l=this.diff_halfMatch_(e,t);if(l){var c=l[0],u=l[1],d=l[2],p=l[3],f=l[4],h=this.diff_main(c,d,n,i),m=this.diff_main(u,p,n,i);return h.concat([[DIFF_EQUAL,f]],m)}return n&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,i):this.diff_bisect_(e,t,i)},diff_match_patch.prototype.diff_lineMode_=function(e,t,n){var i=this.diff_linesToChars_(e,t);e=i.chars1,t=i.chars2;var r=i.lineArray,o=this.diff_main(e,t,!1,n);this.diff_charsToLines_(o,r),this.diff_cleanupSemantic(o),o.push([DIFF_EQUAL,""]);for(var a=0,s=0,l=0,c="",u="";a<%= content %>',"=1&&l>=1){o.splice(a-s-l,s+l),a=a-s-l;for(var i=this.diff_main(c,u,!1,n),d=i.length-1;d>=0;d--)o.splice(a,0,i[d]);a+=i.length}l=0,s=0,c="",u=""}a++}return o.pop(),o},diff_match_patch.prototype.diff_bisect_=function(e,t,n){for(var i=e.length,r=t.length,o=Math.ceil((i+r)/2),a=o,s=2*o,l=new Array(s),c=new Array(s),u=0;s>u;u++)l[u]=-1,c[u]=-1;l[a+1]=0,c[a+1]=0;for(var d=i-r,p=d%2!=0,f=0,h=0,m=0,g=0,v=0;o>v&&!((new Date).getTime()>n);v++){for(var b=-v+f;v-h>=b;b+=2){var y,x=a+b;y=b==-v||b!=v&&l[x-1] y&&r>w&&e.charAt(y)==t.charAt(w);)y++,w++;if(l[x]=y,y>i)h+=2;else if(w>r)f+=2;else if(p){var S=a+d-b;if(S>=0&&s>S&&-1!=c[S]){var C=i-c[S];if(y>=C)return this.diff_bisectSplit_(e,t,y,w,n)}}}for(var T=-v+m;v-g>=T;T+=2){var C,S=a+T;C=T==-v||T!=v&&c[S-1] C&&r>E&&e.charAt(i-C-1)==t.charAt(r-E-1);)C++,E++;if(c[S]=C,C>i)g+=2;else if(E>r)m+=2;else if(!p){var x=a+d-T;if(x>=0&&s>x&&-1!=l[x]){var y=l[x],w=a+y-x;if(C=i-C,y>=C)return this.diff_bisectSplit_(e,t,y,w,n)}}}}return[[DIFF_DELETE,e],[DIFF_INSERT,t]]},diff_match_patch.prototype.diff_bisectSplit_=function(e,t,n,i,r){var o=e.substring(0,n),a=t.substring(0,i),s=e.substring(n),l=t.substring(i),c=this.diff_main(o,a,!1,r),u=this.diff_main(s,l,!1,r);return c.concat(u)},diff_match_patch.prototype.diff_linesToChars_=function(e,t){function n(e){for(var t="",n=0,o=-1,a=i.length;o n;)e.substring(o,r)==t.substring(o,r)?(n=r,o=n):i=r,r=Math.floor((i-n)/2+n);return r},diff_match_patch.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,i=Math.min(e.length,t.length),r=i,o=0;r>n;)e.substring(e.length-r,e.length-o)==t.substring(t.length-r,t.length-o)?(n=r,o=n):i=r,r=Math.floor((i-n)/2+n);return r},diff_match_patch.prototype.diff_commonOverlap_=function(e,t){var n=e.length,i=t.length;if(0==n||0==i)return 0;n>i?e=e.substring(n-i):i>n&&(t=t.substring(0,n));var r=Math.min(n,i);if(e==t)return r;for(var o=0,a=1;;){var s=e.substring(r-a),l=t.indexOf(s);if(-1==l)return o;a+=l,(0==l||e.substring(r-a)==t.substring(0,a))&&(o=a,a++)}},diff_match_patch.prototype.diff_halfMatch_=function(e,t){function n(e,t,n){for(var i,r,o,s,l=e.substring(n,n+Math.floor(e.length/4)),c=-1,u="";-1!=(c=t.indexOf(l,c+1));){var d=a.diff_commonPrefix(e.substring(n),t.substring(c)),p=a.diff_commonSuffix(e.substring(0,n),t.substring(0,c)); -u.length =e.length?[i,r,o,s,u]:null}if(this.Diff_Timeout<=0)return null;var i=e.length>t.length?e:t,r=e.length>t.length?t:e;if(i.length<4||2*r.length
l[4].length?s:l:l:s;var c,u,d,p;e.length>t.length?(c=o[0],u=o[1],d=o[2],p=o[3]):(d=o[0],p=o[1],c=o[2],u=o[3]);var f=o[4];return[c,u,d,p,f]},diff_match_patch.prototype.diff_cleanupSemantic=function(e){for(var t=!1,n=[],i=0,r=null,o=0,a=0,s=0,l=0,c=0;o 0?n[i-1]:-1,a=0,s=0,l=0,c=0,r=null,t=!0)),o++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),o=1;o =f?(p>=u.length/2||p>=d.length/2)&&(e.splice(o,0,[DIFF_EQUAL,d.substring(0,p)]),e[o-1][1]=u.substring(0,u.length-p),e[o+1][1]=d.substring(p),o++):(f>=u.length/2||f>=d.length/2)&&(e.splice(o,0,[DIFF_EQUAL,u.substring(0,f)]),e[o-1][0]=DIFF_INSERT,e[o-1][1]=d.substring(0,d.length-f),e[o+1][0]=DIFF_DELETE,e[o+1][1]=u.substring(f),o++),o++}o++}},diff_match_patch.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),i=t.charAt(0),r=n.match(diff_match_patch.nonAlphaNumericRegex_),o=i.match(diff_match_patch.nonAlphaNumericRegex_),a=r&&n.match(diff_match_patch.whitespaceRegex_),s=o&&i.match(diff_match_patch.whitespaceRegex_),l=a&&n.match(diff_match_patch.linebreakRegex_),c=s&&i.match(diff_match_patch.linebreakRegex_),u=l&&e.match(diff_match_patch.blanklineEndRegex_),d=c&&t.match(diff_match_patch.blanklineStartRegex_);return u||d?5:l||c?4:r&&!a&&s?3:a||s?2:r||o?1:0}for(var n=1;n =d&&(d=p,l=i,c=r,u=o)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=c,u?e[n+1][1]=u:(e.splice(n+1,1),n--))}n++}},diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,diff_match_patch.whitespaceRegex_=/\s/,diff_match_patch.linebreakRegex_=/[\r\n]/,diff_match_patch.blanklineEndRegex_=/\n\r?\n$/,diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/,diff_match_patch.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,n=[],i=0,r=null,o=0,a=!1,s=!1,l=!1,c=!1;o 0?n[i-1]:-1,l=c=!1),t=!0)),o++;t&&this.diff_cleanupMerge(e)},diff_match_patch.prototype.diff_cleanupMerge=function(e){e.push([DIFF_EQUAL,""]);for(var t,n=0,i=0,r=0,o="",a="";n 1?(0!==i&&0!==r&&(t=this.diff_commonPrefix(a,o),0!==t&&(n-i-r>0&&e[n-i-r-1][0]==DIFF_EQUAL?e[n-i-r-1][1]+=a.substring(0,t):(e.splice(0,0,[DIFF_EQUAL,a.substring(0,t)]),n++),a=a.substring(t),o=o.substring(t)),t=this.diff_commonSuffix(a,o),0!==t&&(e[n][1]=a.substring(a.length-t)+e[n][1],a=a.substring(0,a.length-t),o=o.substring(0,o.length-t))),0===i?e.splice(n-r,i+r,[DIFF_INSERT,a]):0===r?e.splice(n-i,i+r,[DIFF_DELETE,o]):e.splice(n-i-r,i+r,[DIFF_DELETE,o],[DIFF_INSERT,a]),n=n-i-r+(i?1:0)+(r?1:0)+1):0!==n&&e[n-1][0]==DIFF_EQUAL?(e[n-1][1]+=e[n][1],e.splice(n,1)):n++,r=0,i=0,o="",a=""}""===e[e.length-1][1]&&e.pop();var s=!1;for(n=1;n t));n++)o=i,a=r;return e.length!=n&&e[n][0]===DIFF_DELETE?a:a+(t-o)},diff_match_patch.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,i=//g,o=/\n/g,a=0;a ");switch(s){case DIFF_INSERT:t[a]=''+c+"";break;case DIFF_DELETE:t[a]=' '+c+"";break;case DIFF_EQUAL:t[a]=""+c+""}}return t.join("")},diff_match_patch.prototype.diff_text1=function(e){for(var t=[],n=0;nc)throw new Error("Invalid number in diff_fromDelta: "+s);var u=e.substring(r,r+=c);n[i++]="="==o[a].charAt(0)?[DIFF_EQUAL,u]:[DIFF_DELETE,u];break;default:if(o[a])throw new Error("Invalid diff operation in diff_fromDelta: "+o[a])}}if(r!=e.length)throw new Error("Delta length ("+r+") does not equal source text length ("+e.length+").");return n},diff_match_patch.prototype.match_main=function(e,t,n){if(null==e||null==t||null==n)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},diff_match_patch.prototype.match_bitap_=function(e,t,n){function i(e,i){var r=e/t.length,a=Math.abs(n-i);return o.Match_Distance?r+a/o.Match_Distance:a?1:r}if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var r=this.match_alphabet_(t),o=this,a=this.Match_Threshold,s=e.indexOf(t,n);-1!=s&&(a=Math.min(i(0,s),a),s=e.lastIndexOf(t,n+t.length),-1!=s&&(a=Math.min(i(0,s),a)));var l=1< c;)i(f,n+u)<=a?c=u:p=u,u=Math.floor((p-c)/2+c);p=u;var h=Math.max(1,n-u+1),m=Math.min(n+u,e.length)+t.length,g=Array(m+2);g[m+1]=(1< =h;v--){var b=r[e.charAt(v-1)];if(g[v]=0===f?(g[v+1]<<1|1)&b:(g[v+1]<<1|1)&b|((d[v+1]|d[v])<<1|1)|d[v+1],g[v]&l){var y=i(f,v-1);if(a>=y){if(a=y,s=v-1,!(s>n))break;h=Math.max(1,2*n-s)}}}if(i(f+1,n)>a)break;d=g}return s},diff_match_patch.prototype.match_alphabet_=function(e){for(var t={},n=0;n 2&&(this.diff_cleanupSemantic(r),this.diff_cleanupEfficiency(r));else if(e&&"object"==typeof e&&"undefined"==typeof t&&"undefined"==typeof n)r=e,i=this.diff_text1(r);else if("string"==typeof e&&t&&"object"==typeof t&&"undefined"==typeof n)i=e,r=t;else{if("string"!=typeof e||"string"!=typeof t||!n||"object"!=typeof n)throw new Error("Unknown call format to patch_make.");i=e,r=n}if(0===r.length)return[];for(var o=[],a=new diff_match_patch.patch_obj,s=0,l=0,c=0,u=i,d=i,p=0;p =2*this.Patch_Margin&&s&&(this.patch_addContext_(a,u),o.push(a),a=new diff_match_patch.patch_obj,s=0,u=d,l=c)}f!==DIFF_INSERT&&(l+=h.length),f!==DIFF_DELETE&&(c+=h.length)}return s&&(this.patch_addContext_(a,u),o.push(a)),o},diff_match_patch.prototype.patch_deepCopy=function(e){for(var t=[],n=0;n this.Match_MaxBits?(a=this.match_main(t,l.substring(0,this.Match_MaxBits),s),-1!=a&&(c=this.match_main(t,l.substring(l.length-this.Match_MaxBits),s+l.length-this.Match_MaxBits),(-1==c||a>=c)&&(a=-1))):a=this.match_main(t,l,s),-1==a)r[o]=!1,i-=e[o].length2-e[o].length1;else{r[o]=!0,i=a-s;var u;if(u=-1==c?t.substring(a,a+l.length):t.substring(a,c+this.Match_MaxBits),l==u)t=t.substring(0,a)+this.diff_text2(e[o].diffs)+t.substring(a+l.length);else{var d=this.diff_main(l,u,!1);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(d)/l.length>this.Patch_DeleteThreshold)r[o]=!1;else{this.diff_cleanupSemanticLossless(d);for(var p,f=0,h=0;h =i;i++)n+=String.fromCharCode(i);for(var i=0;i o[0][1].length){var a=t-o[0][1].length;o[0][1]=n.substring(o[0][1].length)+o[0][1],r.start1-=a,r.start2-=a,r.length1+=a,r.length2+=a}if(r=e[e.length-1],o=r.diffs,0==o.length||o[o.length-1][0]!=DIFF_EQUAL)o.push([DIFF_EQUAL,n]),r.length1+=t,r.length2+=t;else if(t>o[o.length-1][1].length){var a=t-o[o.length-1][1].length;o[o.length-1][1]+=n.substring(0,a),r.length1+=a,r.length2+=a}return n},diff_match_patch.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,n=0;n 2*t?(s.length1+=u.length,r+=u.length,l=!1,s.diffs.push([c,u]),i.diffs.shift()):(u=u.substring(0,t-s.length1-this.Patch_Margin),s.length1+=u.length,r+=u.length,c===DIFF_EQUAL?(s.length2+=u.length,o+=u.length):l=!1,s.diffs.push([c,u]),u==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(u.length))}a=this.diff_text2(s.diffs),a=a.substring(a.length-this.Patch_Margin);var d=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);""!==d&&(s.length1+=d.length,s.length2+=d.length,0!==s.diffs.length&&s.diffs[s.diffs.length-1][0]===DIFF_EQUAL?s.diffs[s.diffs.length-1][1]+=d:s.diffs.push([DIFF_EQUAL,d])),l||e.splice(++n,0,s)}}},diff_match_patch.prototype.patch_toText=function(e){for(var t=[],n=0;n 0)){var i=n.shift();i()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},{}],2:[function(e,t,n){var i=e("../pipe").Pipe,r=function(){};r.prototype.setResult=function(e){return this.result=e,this.hasResult=!0,this},r.prototype.exit=function(){return this.exiting=!0,this},r.prototype.switchTo=function(e,t){return"string"==typeof e||e instanceof i?this.nextPipe=e:(this.next=e,t&&(this.nextPipe=t)),this},r.prototype.push=function(e,t){return e.parent=this,"undefined"!=typeof t&&(e.childName=t),e.root=this.root||this,e.options=e.options||this.options,this.children?(this.children[this.children.length-1].next=e,this.children.push(e)):(this.children=[e],this.nextAfterChildren=this.next||null,this.next=e),e.next=this,this},n.Context=r},{"../pipe":15}],3:[function(e,t,n){var i=e("./context").Context,r=function(e,t){this.left=e,this.right=t,this.pipe="diff"};r.prototype=new i,n.DiffContext=r},{"./context":2}],4:[function(e,t,n){var i=e("./context").Context,r=function(e,t){this.left=e,this.delta=t,this.pipe="patch"};r.prototype=new i,n.PatchContext=r},{"./context":2}],5:[function(e,t,n){var i=e("./context").Context,r=function(e){this.delta=e,this.pipe="reverse"};r.prototype=new i,n.ReverseContext=r},{"./context":2}],6:[function(e,t){t.exports=function(e,t){var n;return"string"==typeof t&&(n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(Z|([+\-])(\d{2}):(\d{2}))$/.exec(t))?new Date(Date.UTC(+n[1],+n[2]-1,+n[3],+n[4],+n[5],+n[6])):t}},{}],7:[function(e,t,n){var i=e("./processor").Processor,r=e("./pipe").Pipe,o=e("./contexts/diff").DiffContext,a=e("./contexts/patch").PatchContext,s=e("./contexts/reverse").ReverseContext,l=e("./filters/trivial"),c=e("./filters/nested"),u=e("./filters/arrays"),d=e("./filters/dates"),p=e("./filters/texts"),f=function(e){this.processor=new i(e),this.processor.pipe(new r("diff").append(c.collectChildrenDiffFilter,l.diffFilter,d.diffFilter,p.diffFilter,c.objectsDiffFilter,u.diffFilter).shouldHaveResult()),this.processor.pipe(new r("patch").append(c.collectChildrenPatchFilter,u.collectChildrenPatchFilter,l.patchFilter,p.patchFilter,c.patchFilter,u.patchFilter).shouldHaveResult()),this.processor.pipe(new r("reverse").append(c.collectChildrenReverseFilter,u.collectChildrenReverseFilter,l.reverseFilter,p.reverseFilter,c.reverseFilter,u.reverseFilter).shouldHaveResult())};f.prototype.options=function(){return this.processor.options.apply(this.processor,arguments)},f.prototype.diff=function(e,t){return this.processor.process(new o(e,t))},f.prototype.patch=function(e,t){return this.processor.process(new a(e,t))},f.prototype.reverse=function(e){return this.processor.process(new s(e))},f.prototype.unpatch=function(e,t){return this.patch(e,this.reverse(t))},n.DiffPatcher=f},{"./contexts/diff":3,"./contexts/patch":4,"./contexts/reverse":5,"./filters/arrays":9,"./filters/dates":10,"./filters/nested":12,"./filters/texts":13,"./filters/trivial":14,"./pipe":15,"./processor":16}],8:[function(e,t,n){(function(t){var i=e("./diffpatcher").DiffPatcher;n.DiffPatcher=i,n.create=function(e){return new i(e)},n.dateReviver=e("./date-reviver");var r;n.diff=function(){return r||(r=new i),r.diff.apply(r,arguments)},n.patch=function(){return r||(r=new i),r.patch.apply(r,arguments)},n.unpatch=function(){return r||(r=new i),r.unpatch.apply(r,arguments)},n.reverse=function(){return r||(r=new i),r.reverse.apply(r,arguments)};var o="undefined"!=typeof t&&"string"==typeof t.execPath;if(o){var a=e("./formatters/index");n.formatters=a,n.console=a.console}else n.homepage="https://github.com/benjamine/jsondiffpatch",n.version="0.1.5"}).call(this,e("/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./date-reviver":6,"./diffpatcher":7,"/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":1}],9:[function(e,t,n){var i=e("../contexts/diff").DiffContext,r=e("../contexts/patch").PatchContext,o=e("../contexts/reverse").ReverseContext,a=e("./lcs"),s=3,l="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},c="function"==typeof Array.prototype.indexOf?function(e,t){return e.indexOf(t)}:function(e,t){for(var n=e.length,i=0;n>i;i++)if(e[i]===t)return i;return-1},u=function(e){if(e.leftIsArray){for(var t,n,r,o,l=e.options&&e.options.objectHash,u=function(e,t,n,i,r){var o=e[n],a=t[i];if(o===a)return!0;if("object"!=typeof o||"object"!=typeof a)return!1;if(!l)return!1;var s,c;return"number"==typeof n?(r.hashCache1=r.hashCache1||[],s=r.hashCache1[n],"undefined"==typeof s&&(r.hashCache1[n]=s=l(o,n))):s=l(o),"undefined"==typeof s?!1:("number"==typeof i?(r.hashCache2=r.hashCache2||[],c=r.hashCache2[i],"undefined"==typeof c&&(r.hashCache2[i]=c=l(a,i))):c=l(a),"undefined"==typeof c?!1:s===c)},d={},p=0,f=0,h=e.left,m=e.right,g=h.length,v=m.length;g>p&&v>p&&u(h,m,p,p,d);)t=p,o=new i(e.left[t],e.right[t]),e.push(o,t),p++;for(;g>f+p&&v>f+p&&u(h,m,g-1-f,v-1-f,d);)n=g-1-f,r=v-1-f,o=new i(e.left[n],e.right[r]),e.push(o,r),f++;var b;if(p+f===g){if(g===v)return void e.setResult(void 0).exit();for(b=b||{_t:"a"},t=p;v-f>t;t++)b[t]=[m[t]];return void e.setResult(b).exit()}if(p+f===v){for(b=b||{_t:"a"},t=p;g-f>t;t++)b["_"+t]=[h[t],0,0];return void e.setResult(b).exit()}d={};var y=h.slice(p,g-f),x=m.slice(p,v-f),w=a.get(y,x,u,d),S=[];for(b=b||{_t:"a"},t=p;g-f>t;t++)c(w.indices1,t-p)<0&&(b["_"+t]=[h[t],0,0],S.push(t));var C=!0;e.options&&e.options.arrays&&e.options.arrays.detectMove===!1&&(C=!1);var T=!1;e.options&&e.options.arrays&&e.options.arrays.includeValueOnMove&&(T=!0);var E=S.length;for(t=p;v-f>t;t++){var k=c(w.indices2,t-p);if(0>k){var _=!1;if(C&&E>0)for(n=0;E>n;n++)if(u(y,x,S[n]-p,t-p,d)){b["_"+S[n]].splice(1,2,t,s),T||(b["_"+S[n]][0]=""),n=S[n],r=t,o=new i(e.left[n],e.right[r]),e.push(o,r),S.splice(n,1),_=!0;break}_||(b[t]=[m[t]])}else n=w.indices1[k]+p,r=w.indices2[k]+p,o=new i(e.left[n],e.right[r]),e.push(o,r)}e.setResult(b).exit()}};u.filterName="arrays";var d={numerically:function(e,t){return e-t},numericallyBy:function(e){return function(t,n){return t[e]-n[e]}}},p=function(e){if(e.nested&&"a"===e.delta._t){var t,n,i=e.delta,o=e.left,a=[],l=[],c=[];for(t in i)if("_t"!==t)if("_"===t[0]){if(0!==i[t][2]&&i[t][2]!==s)throw new Error("only removal or move can be applied at original array indices, invalid diff type: "+i[t][2]);a.push(parseInt(t.slice(1),10))}else 1===i[t].length?l.push({index:parseInt(t,10),value:i[t][0]}):c.push({index:parseInt(t,10),delta:i[t]});for(a=a.sort(d.numerically),t=a.length-1;t>=0;t--){n=a[t];var u=i["_"+n],p=o.splice(n,1)[0];u[2]===s&&l.push({index:u[1],value:p})}l=l.sort(d.numericallyBy("index"));var f=l.length;for(t=0;f>t;t++){var h=l[t];o.splice(h.index,0,h.value)}var m,g=c.length;if(g>0)for(t=0;g>t;t++){var v=c[t];m=new r(e.left[v.index],v.delta),e.push(m,v.index)}return e.children?void e.exit():void e.setResult(e.left).exit()}};p.filterName="arrays";var f=function(e){if(e&&e.children&&"a"===e.delta._t){for(var t,n=e.children.length,i=0;n>i;i++)t=e.children[i],e.left[t.childName]=t.result;e.setResult(e.left).exit()}};f.filterName="arraysCollectChildren";var h=function(e){if(!e.nested)return void(e.delta[2]===s&&(e.newName="_"+e.delta[1],e.setResult([e.delta[0],parseInt(e.childName.substr(1),10),s]).exit()));if("a"===e.delta._t){var t,n;for(t in e.delta)"_t"!==t&&(n=new o(e.delta[t]),e.push(n,t));e.exit()}};h.filterName="arrays";var m=function(e,t,n){var i=t;if("string"==typeof t&&"_"===t[0])i=parseInt(t.substr(1),10);else{var r="_"+t;if(l(n)&&0===n[2])i=r;else for(var o in e){var a=e[o];l(a)&&a[2]===s&&a[1].toString()===t&&(i=o.substr(1))}}return i},g=function(e){if(e&&e.children&&"a"===e.delta._t){for(var t,n=e.children.length,i={_t:"a"},r=0;n>r;r++){t=e.children[r];var o=t.newName;"undefined"==typeof o&&(o=m(e.delta,t.childName,t.result)),i[o]!==t.result&&(i[o]=t.result)}e.setResult(i).exit()}};g.filterName="arraysCollectChildren",n.diffFilter=u,n.patchFilter=p,n.collectChildrenPatchFilter=f,n.reverseFilter=h,n.collectChildrenReverseFilter=g},{"../contexts/diff":3,"../contexts/patch":4,"../contexts/reverse":5,"./lcs":11}],10:[function(e,t,n){var i=function(e){e.left instanceof Date?(e.setResult(e.right instanceof Date?e.left.getTime()!==e.right.getTime()?[e.left,e.right]:void 0:[e.left,e.right]),e.exit()):e.right instanceof Date&&e.setResult([e.left,e.right]).exit()};i.filterName="dates",n.diffFilter=i},{}],11:[function(e,t,n){var i=function(e,t,n,i){return e[n]===t[i]},r=function(e,t,n,i){var r,o,a=e.length,s=t.length,l=[a+1];for(r=0;a+1>r;r++)for(l[r]=[s+1],o=0;s+1>o;o++)l[r][o]=0;for(l.match=n,r=1;a+1>r;r++)for(o=1;s+1>o;o++)l[r][o]=n(e,t,r-1,o-1,i)?l[r-1][o-1]+1:Math.max(l[r-1][o],l[r][o-1]);return l},o=function(e,t,n,i,r,a){if(0===i||0===r)return{sequence:[],indices1:[],indices2:[]};if(e.match(t,n,i-1,r-1,a)){var s=o(e,t,n,i-1,r-1,a);return s.sequence.push(t[i-1]),s.indices1.push(i-1),s.indices2.push(r-1),s}return e[i][r-1]>e[i-1][r]?o(e,t,n,i,r-1,a):o(e,t,n,i-1,r,a)},a=function(e,t,n,a){a=a||{};var s=r(e,t,n||i,a),l=o(s,e,t,e.length,t.length,a);return"string"==typeof e&&"string"==typeof t&&(l.sequence=l.sequence.join("")),l};n.get=a},{}],12:[function(e,t,n){var i=e("../contexts/diff").DiffContext,r=e("../contexts/patch").PatchContext,o=e("../contexts/reverse").ReverseContext,a=function(e){if(e&&e.children){for(var t,n=e.children.length,i=e.result,r=0;n>r;r++)t=e.children[r],"undefined"!=typeof t.result&&(i=i||{},i[t.childName]=t.result);i&&e.leftIsArray&&(i._t="a"),e.setResult(i).exit()}};a.filterName="collectChildren";var s=function(e){if(!e.leftIsArray&&"object"===e.leftType){var t,n;for(t in e.left)n=new i(e.left[t],e.right[t]),e.push(n,t);for(t in e.right)"undefined"==typeof e.left[t]&&(n=new i(void 0,e.right[t]),e.push(n,t));return e.children&&0!==e.children.length?void e.exit():void e.setResult(void 0).exit()}};s.filterName="objects";var l=function(e){if(e.nested&&!e.delta._t){var t,n;for(t in e.delta)n=new r(e.left[t],e.delta[t]),e.push(n,t);e.exit()}};l.filterName="objects";var c=function(e){if(e&&e.children&&!e.delta._t){for(var t,n=e.children.length,i=0;n>i;i++)t=e.children[i],e.left[t.childName]!==t.result&&(e.left[t.childName]=t.result);e.setResult(e.left).exit()}};c.filterName="collectChildren";var u=function(e){if(e.nested&&!e.delta._t){var t,n;for(t in e.delta)n=new o(e.delta[t]),e.push(n,t);e.exit()}};u.filterName="objects";var d=function(e){if(e&&e.children&&!e.delta._t){for(var t,n=e.children.length,i={},r=0;n>r;r++)t=e.children[r],i[t.childName]!==t.result&&(i[t.childName]=t.result);e.setResult(i).exit()}};d.filterName="collectChildren",n.collectChildrenDiffFilter=a,n.objectsDiffFilter=s,n.patchFilter=l,n.collectChildrenPatchFilter=c,n.reverseFilter=u,n.collectChildrenReverseFilter=d},{"../contexts/diff":3,"../contexts/patch":4,"../contexts/reverse":5}],13:[function(e,t,n){var i=2,r=60,o=null,a=function(){if(!o){var t;if("undefined"!=typeof diff_match_patch)t=new diff_match_patch;else if("function"==typeof e){var n=e("../../external/diff_match_patch_uncompressed");t=new n.diff_match_patch}if(!t){var i=new Error("text diff_match_patch library not found");throw i.diff_match_patch_not_found=!0,i}o={diff:function(e,n){return t.patch_toText(t.patch_make(e,n))},patch:function(e,n){for(var i=t.patch_apply(t.patch_fromText(n),e),r=0;rt;t++){r=i[t];var d=r.slice(0,1);"@"===d?(c=u.exec(r),a=t,s=null,l=null,i[a]="@@ -"+c[3]+","+c[4]+" +"+c[1]+","+c[2]+" @@"):"+"===d?(s=t,i[t]="-"+i[t].slice(1),"+"===i[t-1].slice(0,1)&&(o=i[t],i[t]=i[t-1],i[t-1]=o)):"-"===d&&(l=t,i[t]="+"+i[t].slice(1))}return i.join("\n")},u=function(e){e.nested||e.delta[2]===i&&e.setResult([c(e.delta[0]),0,i]).exit()};u.filterName="texts",n.diffFilter=s,n.patchFilter=l,n.reverseFilter=u},{}],14:[function(e,t,n){var i="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},r=function(e){if(e.left===e.right)return void e.setResult(void 0).exit();if("undefined"==typeof e.left){if("function"==typeof e.right)throw new Error("functions are not supported");return void e.setResult([e.right]).exit()}if("undefined"==typeof e.right)return void e.setResult([e.left,0,0]).exit();if("function"==typeof e.left||"function"==typeof e.right)throw new Error("functions are not supported");return e.leftType=null===e.left?"null":typeof e.left,e.rightType=null===e.right?"null":typeof e.right,e.leftType!==e.rightType?void e.setResult([e.left,e.right]).exit():"boolean"===e.leftType||"number"===e.leftType?void e.setResult([e.left,e.right]).exit():("object"===e.leftType&&(e.leftIsArray=i(e.left)),"object"===e.rightType&&(e.rightIsArray=i(e.right)),e.leftIsArray!==e.rightIsArray?void e.setResult([e.left,e.right]).exit():void 0)};r.filterName="trivial";var o=function(e){return"undefined"==typeof e.delta?void e.setResult(e.left).exit():(e.nested=!i(e.delta),e.nested?void 0:1===e.delta.length?void e.setResult(e.delta[0]).exit():2===e.delta.length?void e.setResult(e.delta[1]).exit():3===e.delta.length&&0===e.delta[2]?void e.setResult(void 0).exit():void 0)};o.filterName="trivial";var a=function(e){return"undefined"==typeof e.delta?void e.setResult(e.delta).exit():(e.nested=!i(e.delta),e.nested?void 0:1===e.delta.length?void e.setResult([e.delta[0],0,0]).exit():2===e.delta.length?void e.setResult([e.delta[1],e.delta[0]]).exit():3===e.delta.length&&0===e.delta[2]?void e.setResult([e.delta[0]]).exit():void 0)};a.filterName="trivial",n.diffFilter=r,n.patchFilter=o,n.reverseFilter=a},{}],15:[function(e,t,n){var i=function(e){this.name=e,this.filters=[]};i.prototype.process=function(e){if(!this.processor)throw new Error("add this pipe to a processor before using it");for(var t=this.debug,n=this.filters.length,i=e,r=0;n>r;r++){var o=this.filters[r];if(t&&this.log("filter: "+o.filterName),o(i),"object"==typeof i&&i.exiting){i.exiting=!1;break}}!i.next&&this.resultCheck&&this.resultCheck(i)},i.prototype.log=function(e){console.log("[jsondiffpatch] "+this.name+" pipe, "+e)},i.prototype.append=function(){return this.filters.push.apply(this.filters,arguments),this},i.prototype.prepend=function(){return this.filters.unshift.apply(this.filters,arguments),this},i.prototype.indexOf=function(e){if(!e)throw new Error("a filter name is required");for(var t=0;t >>0)+(t++ +"__")};n.prototype={set:function(t,n){var i=t[this.name];i&&i[0]===t?i[1]=n:e(t,this.name,{value:[t,n],writable:!0})},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){this.set(e,void 0)}},window.WeakMap=n}(),define("WeakMap",function(){}),function(e){function t(e){x.push(e),y||(y=!0,g(i))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function i(){y=!1;var e=x;x=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callback_(n,e),t=!0)}),t&&i()}function r(e){e.nodes_.forEach(function(t){var n=m.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function o(e,t){for(var n=e;n;n=n.parentNode){var i=m.get(n);if(i)for(var r=0;r 0){var r=n[i-1],o=f(r,e);if(o)return void(n[i-1]=o)}else t(this.observer);n[i]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=m.get(e);t||m.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=m.get(e),n=0;n /g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),define("bower-libs/prism/components/prism-markup",function(){}),Prism.languages.latex={keyword:/\\(?:[^a-zA-Z]|[a-zA-Z]+)/g,lparen:/[[({]/g,rparen:/[\])}]/g,comment:/%.*/g},define("libs/prism-latex",function(){}),Prism.languages.md=function(){var e=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>\[\]'"]+|\([^\s()<>\[\]'"]*\))+(?:\([^\s()<>\[\]'"]*\)|[^\s`!()\[\]{}:'".,<>?«»“â€â€˜â€™]))/gi,t=/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b/gi,n=Prism.languages.latex,i={};i.pre={pattern:/(^|(?:^|(?:^|\n)(?![ \t]*([*+\-]|\d+\.)[ \t]).*\n)\s*?\n)(\s*(?: {4}|\t).*(?:\n|$))+/g,lookbehind:!0,inside:{}},i["pre gfm"]={pattern:/^ {0,3}`{3}.*?\n(.*?\n)*? {0,3}`{3} *$/gm,inside:{"md md-pre":/`{3}/}},i["h1 alt"]={pattern:/^(.+)[ \t]*\n=+[ \t]*$/gm,inside:{}},i["h2 alt"]={pattern:/^(.+)[ \t]*\n-+[ \t]*$/gm,inside:{}},i.hr={pattern:/^([*\-_] *){3,}$/gm},i.li={pattern:/^[ \t]*([*+\-]|\d+\.)[ \t].+$/gm,inside:{"md md-li":/^ ?([*+\-]|\d+\.)[ \t]/m,"md md-li2":/^ ?(?: {2}|\t{1})([*+\-]|\d+\.)[ \t]/m,"md md-li3":/^ ?(?: {4}|\t{2})([*+\-]|\d+\.)[ \t]/m,"md md-li4":/^ ?(?: {6}|\t{3})([*+\-]|\d+\.)[ \t]/m,"md md-li5":/^ ?(?: {8}|\t{4})([*+\-]|\d+\.)[ \t]/m,"md md-li6":/^ ?(?: {10}|\t{5})([*+\-]|\d+\.)[ \t]/m,"md md-li7":/^ ?(?: {12}|\t{6})([*+\-]|\d+\.)[ \t]/m,"md md-li8":/^ ?(?: {14}|\t{7})([*+\-]|\d+\.)[ \t]/m,"md md-li9":/^ ?(?: {16}|\t{8})([*+\-]|\d+\.)[ \t]/m,"md md-li10":/^ ?(?: {18}|\t{9})([*+\-]|\d+\.)[ \t]/m,"md md-li11":/^ ?(?: {20}|\t{10})([*+\-]|\d+\.)[ \t]/m}};for(var r=6;r>=1;r--)i["h"+r]={pattern:new RegExp("^#{"+r+"}.+$","gm"),inside:{"md md-hash":new RegExp("^#{"+r+"} ")}};i.blockquote={pattern:/^ {0,3}> *[^\n]+$/gm,inside:{"md md-gt":/^ {0,3}> */,li:i.li}},i["math block"]={pattern:/(\$\$|\\\\\[|\\\\\\\\\()[\s\S]*?(\$\$|\\\\\]|\\\\\\\\\))/g,inside:{"md md-bracket-start":/^(\$\$|\\\\\[|\\\\\\\\\()/,"md md-bracket-end":/(\$\$|\\\\\]|\\\\\\\\\))/,lf:/\n/gm,rest:n}},i["latex block"]={pattern:/\\?\\begin\{[a-z]*\*?\}[\s\S]*?\\?\\end\{[a-z]*\*?\}/g,inside:{keyword:/\\?\\(begin|end)/,lf:/\n/gm,rest:n}},i.fndef={pattern:/^ {0,3}\[\^.*?\]:[ \t]+.*$/gm,inside:{"ref-id":{pattern:/\[\^.*?\]/,inside:{"md md-bracket-start":/\[/,"md md-bracket-end":/\]/}}}},i.linkdef={pattern:/^ {0,3}\[.*?\]:[ \t]+.*$/gm,inside:{"link-id":{pattern:/\[.*?\]/,inside:{"md md-bracket-start":/\[/,"md md-bracket-end":/\]/}},url:e,linktitle:/['\"\(][^\'\"\)]*['\"\)]/}},i.p={pattern:/.+/g,inside:{"md md-toc":/^\s*\[(toc|TOC)\]\s*$/g}},i.lf=/^\n$/gm,i.img={pattern:/!\[[^\]]*\]\([^\)]+\)/g,inside:{"md md-bang":/^!/,"md md-bracket-start":/\[/,"md md-alt":/[^\[]+(?=\])/,"md md-bracket-end":/\](?=\()/,"md img-parens":{pattern:/\([^\)]+\)/,inside:{"md md-paren-start":/^\(/,"md md-title":/(['‘][^'’]*['’]|["“][^"â€]*["â€])(?=\)$)/,"md md-src":/[^\('" \t]+(?=[\)'" \t])/,"md md-paren-end":/\)$/}}}},i.link={pattern:/\[(?:(\\.)|[^\[\]])*\]\([^\(\)\s]+(\(\S*?\))??[^\(\)\s]*?(\s(['‘][^'’]*['’]|["“][^"â€]*["â€]))?\)/gm,inside:{"md md-bracket-start":{pattern:/(^|[^\\])\[/,lookbehind:!0},"md md-underlined-text":{pattern:/(?:(\\.)|[^\[\]])+(?=\])/},"md md-bracket-end":/\]\s?\(/,"md md-paren-end":/\)$/,"md md-href":/.*/}},i.fn={pattern:/\[\^(.*?)\]/g,inside:{ref:{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-ref":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},i.imgref={pattern:/!\[(.*?)\] ?\[(.*?)\]/g,inside:{"md md-bang":/^!/,"ref-end":{pattern:/\[[^\[\]]+\]$/,inside:{"md md-bracket-start":/\[/,"md md-href":/[^\[\]]+(?=]$)/,"md md-bracket-end":/\]/}},"ref-start":{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-alt":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},i.linkref={pattern:/\[(.*?)\] ?\[(.*?)\]/g,inside:{"ref-end":{pattern:/\[[^\[\]]+\]$/,inside:{"md md-bracket-start":/\[/,"md md-href":/[^\[\]]+(?=]$)/,"md md-bracket-end":/\]/}},"ref-start":{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-underlined-text":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},i.email={pattern:t},i.code={pattern:/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/g,lookbehind:!0,inside:{"md md-code":/`/}},i.math={pattern:/\$.*?\$/g,inside:{"md md-bracket-start":/^\$/,"md md-bracket-end":/\$$/,rest:n}},i.strong={pattern:/([_\*])\1((?!\1{2}).)*\1{2}/g,inside:{"md md-strong":/([_\*])\1/g}},i.em={pattern:/(^|[^\\])(\*|_)(\S[^\2]*?)??[^\s\\]+?\2/g,lookbehind:!0,inside:{"md md-em md-start":/^(\*|_)/,"md md-em md-close":/(\*|_)$/}},i.strike={pattern:/(^|\n|\W)(~~)(?=\S)([^\r]*?\S)\2/gm,lookbehind:!0,inside:{"md md-s":/(~~)/,"md-strike-text":/[^~]+/}};for(var o={code:i.code,math:i.math,fn:i.fn,img:i.img,link:i.link,imgref:i.imgref,linkref:i.linkref,url:i.url,email:i.email,strong:i.strong,em:i.em,strike:i.strike,conflict:/⧸⧸/g,comment:Prism.languages.markup.comment,tag:Prism.languages.markup.tag,entity:Prism.languages.markup.entity},a=6;a>=1;a--)i["h"+a].inside.rest=o;i["h1 alt"].inside.rest=o,i["h2 alt"].inside.rest=o,i.p.inside.rest=o,i.blockquote.inside.rest=o,i.li.inside.rest=o,i.fndef.inside.rest=o,o={code:i.code,fn:i.fn,link:i.link,linkref:i.linkref,conflict:/⧸⧸/g},i.strong.inside.rest=o,i.em.inside.rest=o,i.strike.inside.rest=o;var s={code:i.code,strong:i.strong,em:i.em,strike:i.strike,conflict:/⧸⧸/g,comment:Prism.languages.markup.comment,tag:Prism.languages.markup.tag,entity:Prism.languages.markup.entity};return i.link.inside["md md-underlined-text"].inside=s,i.linkref.inside["ref-start"].inside["md md-underlined-text"].inside=s,i}(),define("libs/prism-markdown",function(){}),define("editor",["jquery","underscore","utils","settings","eventMgr","prism-core","diff_match_patch_uncompressed","jsondiffpatch","crel","rangy","MutationObservers","libs/prism-markdown"],function(e,t,n,i,r,o,a,s,l,c){function u(){this.isWatching=!1;var e;this.startWatching=function(){this.isWatching=!0,e=e||new MutationObserver(y),e.observe(_,{childList:!0,subtree:!0,characterData:!0})},this.stopWatching=function(){e.disconnect(),this.isWatching=!1},this.noWatch=function(e){this.isWatching===!0?(this.stopWatching(),e(),this.startWatching()):e()}}function d(){var e=this;this.selectionStart=0,this.selectionEnd=0,this.cursorY=0,this.findOffset=function(e){for(var t=document.createTreeWalker(_,4),n="";t.nextNode();){if(n=t.currentNode.nodeValue||"",n.length>e)return{container:t.currentNode,offset:e};e-=n.length}return{container:t.currentNode,offset:n.length}},this.createRange=function(e,n){e=0>e?0:e,n=0>n?0:n;var i=document.createRange(),r=t.isObject(e)?e:this.findOffset(e);return i.setStart(r.container,r.offset),n&&n!=e&&(r=t.isObject(n)?n:this.findOffset(n)),i.setEnd(r.container,r.offset),i},this.setSelectionStartEnd=function(e,t,n,i){void 0===e&&(e=this.selectionStart),void 0===t&&(t=this.selectionEnd),this.selectionStart=e,this.selectionEnd=t;var o=Math.min(e,t),a=Math.max(e,t);if(n=n||this.createRange(o,a),!i){var s=c.getSelection();s.removeAllRanges(),s.addRange(n,e>t)}F.editorStart=this.selectionStart,F.editorEnd=this.selectionEnd,k.toggleClass("has-selection",this.selectionStart!==this.selectionEnd);var l=this.getCoordinates(this.selectionEnd,this.selectionEndContainer,this.selectionEndOffset);return this.cursorY!==l.y&&(this.cursorY=l.y,r.onCursorCoordinates(l.x,l.y)),n},this.saveSelectionState=function(){function t(){if(O===!1){var t,n=e.selectionStart,i=e.selectionEnd,r=c.getSelection();if(r.rangeCount>0){var o=r.getRangeAt(0),a=o.startContainer;if(16&_.compareDocumentPosition(a)){t=o;var s=a,l=t.startOffset;do{for(;a=a.previousSibling;)a.textContent&&(l+=a.textContent.length);a=s=s.parentNode}while(a&&a!=E);r.isBackwards()?(n=l+(t+"").length,i=l):(n=l,i=l+(t+"").length)}}e.setSelectionStartEnd(n,i,t,!0)}H.saveSelectionState()}var i=n.debounce(t);return function(e){e?i():t()}}(),this.getCoordinates=function(e,t,n){t||(n=this.findOffset(e),t=n.container,n=n.offset);var i=0,r=0;if("\n"==t.textContent)r=t.parentNode.offsetTop+t.parentNode.offsetHeight/2;else{var o=U[e],a={container:t,offset:n},s={container:t,offset:n};e>0&&(void 0===o||"\n"==o)?0===a.offset?a=e-1:a.offset-=1:s.offset===t.textContent.length?s=e+1:s.offset+=1;var l=this.createRange(a,s),c=l.getBoundingClientRect();r=c.top+c.height/2-E.getBoundingClientRect().top+E.scrollTop,l.detach()}return{x:i,y:r}},this.getClosestWordOffset=function(e){var t=0,n=0,i=0;return U.split(/\s/).some(function(r){return r&&(t=i,n=i+r.length,n>e)?!0:void(i+=r.length+1)}),{start:t,end:n}}}function p(e){var t=j.diff_commonPrefix(U,e);t===U.length&&t--;var n=Math.min(j.diff_commonSuffix(U,e),U.length-t,e.length-t),i=e.substring(t,e.length-n),r=G.createRange(t,U.length-n);r.deleteContents(),r.insertNode(document.createTextNode(i))}function f(e,t){var n=G.selectionStart;if(n!==G.selectionEnd)return!1;var i=G.createRange(n-e.length,n);return""+i!=e?!1:(i.deleteContents(),i.insertNode(document.createTextNode(t)),n=n-e.length+t.length,G.setSelectionStartEnd(n,n),!0)}function h(e){p(e),U=e}function m(){return U}function g(){I.focus(),G.setSelectionStartEnd(),E.scrollTop=R}function v(){function e(e,n,i){B.noWatch(function(){U!=e.content&&(h(e.content),F.content=e.content,r.onContentChanged(F,e.content)),G.setSelectionStartEnd(n,i);var o=F.discussionListJSON;if(o!=e.discussionListJSON){var a=F.discussionList;F.discussionListJSON=e.discussionListJSON;var s=F.discussionList,l=$.diff(a,s),c=!1;t.each(l,function(e,n){t.isArray(e)?1===e.length?r.onDiscussionCreated(F,s[n]):r.onDiscussionRemoved(F,a[n]):c=!0}),c&&r.onCommentsChanged(F)}}),s=n,l=i,a=e,this.currentMode=void 0,o=void 0,this.onButtonStateChange(),q()}var i,o,a,s,l,c=[],u=[];this.setCommandMode=function(){this.currentMode="command"},this.setMode=function(){},this.onButtonStateChange=function(){},this.saveState=n.debounce(function(){u=[];var e=Date.now();"comment"==this.currentMode||this.currentMode!=o&&"newlines"!=o||e-i>1e3?(c.push(a),100===c.length&&c.shift()):(s=a.selectionStartBefore,l=a.selectionEndBefore),a={selectionStartBefore:s,selectionEndBefore:l,selectionStartAfter:G.selectionStart,selectionEndAfter:G.selectionEnd,content:U,discussionListJSON:F.discussionListJSON},i=e,o=this.currentMode,this.currentMode=void 0,this.onButtonStateChange()},this),this.saveSelectionState=t.debounce(function(){void 0===this.currentMode&&(s=G.selectionStart,l=G.selectionEnd)},10),this.canUndo=function(){return c.length},this.canRedo=function(){return u.length},this.undo=function(){var t=c.pop();t&&(u.push(a),e.call(this,t,a.selectionStartBefore,a.selectionEndBefore))},this.redo=function(){var t=u.pop();t&&(c.push(a),e.call(this,t,t.selectionStartAfter,t.selectionEndAfter))},this.init=function(){var e=F.content;c=[],u=[],i=0,a={selectionStartAfter:F.selectionStart,selectionEndAfter:F.selectionEnd,content:e,discussionListJSON:F.discussionListJSON},this.currentMode=void 0,o=void 0,_.textContent=e,y()}}function b(){B.isWatching===!0&&(H.currentMode=H.currentMode||"comment",H.saveState())}function y(){var e=E.textContent;if(_.lastChild===z&&"\n"==z.textContent.slice(-1)&&(e=e.slice(0,-1)),O===!1){if(e==U)return void(0===_.children.length&&(_.innerHTML="",W.forEach(function(e){_.appendChild(e.elt)}),C()));H.currentMode=H.currentMode||"typing";var n=t.values(F.discussionList);F.newDiscussion&&n.push(F.newDiscussion);var i=x(U,e,n);U=e,i===!0&&(F.discussionList=F.discussionList),F.content=U,G.saveSelectionState(),r.onContentChanged(F,U),i&&r.onCommentsChanged(F),H.saveState()}else U=e,G.setSelectionStartEnd(F.editorStart,F.editorEnd),G.saveSelectionState(),r.onFileOpen(F,U),L.scrollTop=F.previewScrollTop,R=F.editorScrollTop,E.scrollTop=R,O=!1}function x(e,t,n){if(n.length){var i=j.diff_main(e,t),r=!1,o=0;return i.forEach(function(e){var t=e[0],i=e[1];if(0===t)return void(o+=i.length);var a=o,s=i.length;-1===t&&(a+=s,s=-s),n.forEach(function(e){e.selectionEnd>a?(e.selectionEnd+=s,e.discussionIndex&&(r=!0)):e.selectionEnd>o&&(e.selectionEnd=o,e.discussionIndex&&(r=!0)),e.selectionStart>=a?(e.selectionStart+=s,e.discussionIndex&&(r=!0)):e.selectionStart>o&&(e.selectionStart=o,e.discussionIndex&&(r=!0))}),1===t&&(o+=i.length)}),r}}function w(e){if(X=[],Q=[],V=void 0,O===!0)return Q=W,W=e,void(X=e);var n=W.length;t.some(W,function(t,i){var r=e[i];return i>=e.length||t.textWithFrontMatter!=r.textWithFrontMatter||t.elt.parentNode!==_||t.elt.textContent!=r.textWithFrontMatter?(n=i,!0):void 0});var i=-W.length;t.some(W.slice().reverse(),function(t,n){var r=e[e.length-n-1];return n>=e.length||t.textWithFrontMatter!=r.textWithFrontMatter||t.elt.parentNode!==_||t.elt.textContent!=r.textWithFrontMatter?(i=-n,!0):void 0}),n-i>W.length&&(i=n-W.length);var r=W.slice(0,n);X=e.slice(n,e.length+i);var o=W.slice(W.length+i,W.length);V=t.first(o),Q=W.slice(n,W.length+i),W=r.concat(X).concat(o)}function S(){var e=document.createDocumentFragment();X.forEach(function(t){T(t),e.appendChild(t.elt)}),B.noWatch(function(){if(O===!0)_.innerHTML="",_.appendChild(e);else{Q.forEach(function(e){e.elt.parentNode===_&&_.removeChild(e.elt)}),void 0!==V?_.insertBefore(e,V.elt):_.appendChild(e);for(var t=_.firstChild;t;){var n=t.nextSibling;t.generated||_.removeChild(t),t=n}}C(),G.setSelectionStartEnd()})}function C(){z=l("span",{"class":"token lf"}),z.textContent="\n",_.appendChild(z)}function T(e){var t=K(e.text);window.viewerMode||(t=o.highlight(t,o.languages.md));var n=e.textWithFrontMatter.substring(0,e.textWithFrontMatter.length-e.text.length);n.length&&(n=K(n),n=n.replace(/\n/g,'\n'),t=''+n+""+t);var i=l("span",{id:"wmd-input-section-"+e.id,"class":"wmd-input-section"});i.generated=!0,i.innerHTML=t,e.elt=i}var E,k,_,I,D,N,L,M,A={},R=0,P=function(){var e=0,n=function(){var t=Date.now();M.refreshPreview(),e=Date.now()-t};return i.lazyRendering===!0?t.debounce(n,500):function(){setTimeout(n,2e3>e?e:2e3)}}();r.addListener("onPagedownConfigure",function(e){M=e}),r.addListener("onSectionsCreated",function(e){w(e),S(),O===!0?M.refreshPreview():P()});var F,O=!0;r.addListener("onFileSelected",function(e){O=!0,F=e});var B=new u;A.watcher=B;var j=new a,$=s.create({objectHash:function(e){return JSON.stringify(e)},arrays:{detectMove:!1},textDiff:{minLength:9999999}}),G=new d;A.selectionMgr=G,e(document).on("selectionchange",".editor-content",t.bind(G.saveSelectionState,G,!0));var q=function(){var e=n.debounce(function(){var e=E.offsetHeight/2;e>130&&(e=130);var t=E.scrollTop+e,n=E.scrollTop+E.offsetHeight-e;G.cursorY n&&(E.scrollTop+=G.cursorY-n)});return function(){void 0!==E&&(G.saveSelectionState(!0),e())}}();A.adjustCursorPosition=q;var U;A.setValue=p,A.replacePreviousText=f,A.setValueNoWatch=h,A.getValue=m,A.focus=g;var H=new v;A.undoMgr=H,r.addListener("onDiscussionCreated",b),r.addListener("onDiscussionRemoved",b),r.addListener("onCommentsChanged",b);var z;A.adjustCommentOffsets=x,A.init=function(){if(E=document.getElementById("wmd-input"),k=e(E),_=E.querySelector(".editor-content"),I=e(_),D=E.querySelector(".editor-margin"),N=e(D),L=document.querySelector(".preview-container"),k.addClass(i.editorFontClass),B.startWatching(),e(E).scroll(function(){R=E.scrollTop,O===!1&&(F.editorScrollTop=R)}),e(L).scroll(function(){O===!1&&(F.previewScrollTop=L.scrollTop)}),/AppleWebKit\/([\d.]+)/.exec(navigator.userAgent)){var n=e('').appendTo("html");I.blur(function(){n[0].setSelectionRange(0,0),n.blur()})}E.focus=g,Object.defineProperty(E,"value",{get:function(){return U},set:p}),Object.defineProperty(E,"selectionStart",{get:function(){return Math.min(G.selectionStart,G.selectionEnd)},set:function(e){G.setSelectionStartEnd(e)},enumerable:!0,configurable:!0}),Object.defineProperty(E,"selectionEnd",{get:function(){return Math.max(G.selectionStart,G.selectionEnd)},set:function(e){G.setSelectionStartEnd(void 0,e)},enumerable:!0,configurable:!0});var r=!1;I.on("keydown",function(e){if(17!==e.which&&91!==e.which&&18!==e.which&&16!==e.which){G.saveSelectionState();var t=e.metaKey||e.ctrlKey;switch(t||q(),e.which){case 9:t||(o("indent",{inverse:e.shiftKey}),e.preventDefault());break;case 13:o("newline"),e.preventDefault()}13!==e.which&&(r=!1)}}).on("mouseup",t.bind(G.saveSelectionState,G,!0)).on("paste",function(){H.currentMode="paste",q()}).on("cut",function(){H.currentMode="cut",q()});var o=function(e,t){t=t||{};var n=m(),i=t.start||G.selectionStart,r=t.end||G.selectionEnd,o={selectionStart:i,selectionEnd:r,before:n.slice(0,i),after:n.slice(r),selection:n.slice(i,r)};a[e](o,t),p(o.before+o.selection+o.after),G.setSelectionStartEnd(o.selectionStart,o.selectionEnd)},a={indent:function(e,t){function n(e,t,n,i){return n=+n||0,i=i||"",e.slice(0,t)+i+e.slice(t+n)}var i=e.before.lastIndexOf("\n")+1;if(t.inverse)/\s/.test(e.before.charAt(i))&&(e.before=n(e.before,i,1),e.selectionStart--,e.selectionEnd--),e.selection=e.selection.replace(/^[ \t]/gm,"");else{if(!e.selection)return e.before+=" ",e.selectionStart++,void e.selectionEnd++;e.before=n(e.before,i,0," "),e.selection=e.selection.replace(/\r?\n(?=[\s\S])/g,"\n "),e.selectionStart++,e.selectionEnd++}e.selectionEnd=e.selectionStart+e.selection.length},newline:function(e){var t=e.before.lastIndexOf("\n")+1;if(r)return e.before=e.before.substring(0,t),e.selection="",e.selectionStart=t,e.selectionEnd=t,void(r=!1);r=!1;var n=e.before.slice(t),i=n.match(/^ {0,3}>[ ]*|^[ \t]*(?:[*+\-]|(\d+)\.)[ \t]|^\s+/),o=(i||[""])[0];if(i&&i[1]){var a=parseInt(i[1],10);o=o.replace(/\d+/,a+1)}o.length&&(r=!0),H.currentMode="newlines",e.before+="\n"+o,e.selection="",e.selectionStart+=o.length+1,e.selectionEnd=e.selectionStart}}};var V,W=[],Q=[],X=[],K=function(){var e={"&":"&","<":"<"," ":" "};return function(t){return t.replace(/[&<\u00a0]/g,function(t){return e[t]})}}();return r.onEditorCreated(A),A}),function(e,t){function n(){i.READY||(b.determineEventTypes(),h.each(i.gestures,function(e){x.register(e)}),b.onTouch(i.DOCUMENT,p,x.detect),b.onTouch(i.DOCUMENT,f,x.detect),i.READY=!0)}var i=function(e,t){return new i.Instance(e,t||{})};i.VERSION="1.0.10",i.defaults={stop_browser_behavior:{userSelect:"none",touchAction:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},i.HAS_POINTEREVENTS=e.navigator.pointerEnabled||e.navigator.msPointerEnabled,i.HAS_TOUCHEVENTS="ontouchstart"in e,i.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android|silk/i,i.NO_MOUSEEVENTS=i.HAS_TOUCHEVENTS&&e.navigator.userAgent.match(i.MOBILE_REGEX),i.EVENT_TYPES={},i.UPDATE_VELOCITY_INTERVAL=16,i.DOCUMENT=e.document;var r=i.DIRECTION_DOWN="down",o=i.DIRECTION_LEFT="left",a=i.DIRECTION_UP="up",s=i.DIRECTION_RIGHT="right",l=i.POINTER_MOUSE="mouse",c=i.POINTER_TOUCH="touch",u=i.POINTER_PEN="pen",d=i.EVENT_START="start",p=i.EVENT_MOVE="move",f=i.EVENT_END="end";i.plugins=i.plugins||{},i.gestures=i.gestures||{},i.READY=!1;var h=i.utils={extend:function(e,n,i){for(var r in n)e[r]!==t&&i||(e[r]=n[r]);return e},each:function(e,n,i){var r,o;if("forEach"in e)e.forEach(n,i);else if(e.length!==t){for(r=-1;o=e[++r];)if(n.call(i,o,r,e)===!1)return}else for(r in e)if(e.hasOwnProperty(r)&&n.call(i,e[r],r,e)===!1)return},inStr:function(e,t){return e.indexOf(t)>-1},hasParent:function(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1},getCenter:function(e){var t=[],n=[],i=[],r=[],o=Math.min,a=Math.max;return 1===e.length?{pageX:e[0].pageX,pageY:e[0].pageY,clientX:e[0].clientX,clientY:e[0].clientY}:(h.each(e,function(e){t.push(e.pageX),n.push(e.pageY),i.push(e.clientX),r.push(e.clientY)}),{pageX:(o.apply(Math,t)+a.apply(Math,t))/2,pageY:(o.apply(Math,n)+a.apply(Math,n))/2,clientX:(o.apply(Math,i)+a.apply(Math,i))/2,clientY:(o.apply(Math,r)+a.apply(Math,r))/2})},getVelocity:function(e,t,n){return{x:Math.abs(t/e)||0,y:Math.abs(n/e)||0}},getAngle:function(e,t){var n=t.clientX-e.clientX,i=t.clientY-e.clientY;return 180*Math.atan2(i,n)/Math.PI},getDirection:function(e,t){var n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY);return n>=i?e.clientX-t.clientX>0?o:s:e.clientY-t.clientY>0?a:r},getDistance:function(e,t){var n=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.sqrt(n*n+i*i)},getScale:function(e,t){return e.length>=2&&t.length>=2?this.getDistance(t[0],t[1])/this.getDistance(e[0],e[1]):1},getRotation:function(e,t){return e.length>=2&&t.length>=2?this.getAngle(t[1],t[0])-this.getAngle(e[1],e[0]):0},isVertical:function(e){return e==a||e==r},toggleDefaultBehavior:function(e,t,n){if(t&&e&&e.style){h.each(["webkit","moz","Moz","ms","o",""],function(i){h.each(t,function(t,r){i&&(r=i+r.substring(0,1).toUpperCase()+r.substring(1)),r in e.style&&(e.style[r]=!n&&t)})});var i=function(){return!1};"none"==t.userSelect&&(e.onselectstart=!n&&i),"none"==t.userDrag&&(e.ondragstart=!n&&i)}}};i.Instance=function(e,t){var r=this;return n(),this.element=e,this.enabled=!0,this.options=h.extend(h.extend({},i.defaults),t||{}),this.options.stop_browser_behavior&&h.toggleDefaultBehavior(this.element,this.options.stop_browser_behavior,!1),this.eventStartHandler=b.onTouch(e,d,function(e){r.enabled&&x.startDetect(r,e)}),this.eventHandlers=[],this},i.Instance.prototype={on:function(e,t){var n=e.split(" ");return h.each(n,function(e){this.element.addEventListener(e,t,!1),this.eventHandlers.push({gesture:e,handler:t})},this),this},off:function(e,t){var n,i,r=e.split(" ");return h.each(r,function(e){for(this.element.removeEventListener(e,t,!1),n=-1;i=this.eventHandlers[++n];)i.gesture===e&&i.handler===t&&this.eventHandlers.splice(n,1)},this),this},trigger:function(e,t){t||(t={});var n=i.DOCUMENT.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t;var r=this.element;return h.hasParent(t.target,r)&&(r=t.target),r.dispatchEvent(n),this},enable:function(e){return this.enabled=e,this},dispose:function(){var e,t;for(this.options.stop_browser_behavior&&h.toggleDefaultBehavior(this.element,this.options.stop_browser_behavior,!0),e=-1;t=this.eventHandlers[++e];)this.element.removeEventListener(t.gesture,t.handler,!1);return this.eventHandlers=[],b.unbindDom(this.element,i.EVENT_TYPES[d],this.eventStartHandler),null}};var m=null,g=!1,v=!1,b=i.event={bindDom:function(e,t,n){var i=t.split(" ");h.each(i,function(t){e.addEventListener(t,n,!1)})},unbindDom:function(e,t,n){var i=t.split(" ");h.each(i,function(t){e.removeEventListener(t,n,!1)})},onTouch:function(e,t,n){var r=this,o=function(o){var a=o.type.toLowerCase();if(!h.inStr(a,"mouse")||!v){h.inStr(a,"touch")||h.inStr(a,"pointerdown")||h.inStr(a,"mouse")&&1===o.which?g=!0:h.inStr(a,"mouse")&&!o.which&&(g=!1),(h.inStr(a,"touch")||h.inStr(a,"pointer"))&&(v=!0);var s=0;g&&(i.HAS_POINTEREVENTS&&t!=f?s=y.updatePointer(t,o):h.inStr(a,"touch")?s=o.touches.length:v||(s=h.inStr(a,"up")?0:1),s>0&&t==f?t=p:s||(t=f),(s||null===m)&&(m=o),n.call(x,r.collectEventData(e,t,r.getTouchList(m,t),o)),i.HAS_POINTEREVENTS&&t==f&&(s=y.updatePointer(t,o))),s||(m=null,g=!1,v=!1,y.reset())}};return this.bindDom(e,i.EVENT_TYPES[t],o),o},determineEventTypes:function(){var e;e=i.HAS_POINTEREVENTS?y.getEvents():i.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],i.EVENT_TYPES[d]=e[0],i.EVENT_TYPES[p]=e[1],i.EVENT_TYPES[f]=e[2]},getTouchList:function(e){return i.HAS_POINTEREVENTS?y.getTouchList():e.touches?e.touches:(e.identifier=1,[e])},collectEventData:function(e,t,n,i){var r=c;return(h.inStr(i.type,"mouse")||y.matchType(l,i))&&(r=l),{center:h.getCenter(n),timeStamp:Date.now(),target:i.target,touches:n,eventType:t,pointerType:r,srcEvent:i,preventDefault:function(){var e=this.srcEvent;e.preventManipulation&&e.preventManipulation(),e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return x.stopDetect()}}}},y=i.PointerEvent={pointers:{},getTouchList:function(){var e=[];return h.each(this.pointers,function(t){e.push(t)}),e},updatePointer:function(e,t){return e==f?delete this.pointers[t.pointerId]:(t.identifier=t.pointerId,this.pointers[t.pointerId]=t),Object.keys(this.pointers).length},matchType:function(e,t){if(!t.pointerType)return!1;var n=t.pointerType,i={};return i[l]=n===l,i[c]=n===c,i[u]=n===u,i[e]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},x=i.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(e,t){this.current||(this.stopped=!1,this.current={inst:e,startEvent:h.extend({},t),lastEvent:!1,lastVelocityEvent:!1,velocity:!1,name:""},this.detect(t)) -},detect:function(e){if(this.current&&!this.stopped){e=this.extendEventData(e);var t=this.current.inst,n=t.options;return h.each(this.gestures,function(i){return this.stopped||n[i.name]===!1||t.enabled===!1||i.handler.call(i,e,t)!==!1?void 0:(this.stopDetect(),!1)},this),this.current&&(this.current.lastEvent=e),e.eventType==f&&!e.touches.length-1&&this.stopDetect(),e}},stopDetect:function(){this.previous=h.extend({},this.current),this.current=null,this.stopped=!0},getVelocityData:function(e,t,n,r){var o=this.current,a=o.lastVelocityEvent,s=o.velocity;a&&e.timeStamp-a.timeStamp>i.UPDATE_VELOCITY_INTERVAL?(s=h.getVelocity(e.timeStamp-a.timeStamp,e.center.clientX-a.center.clientX,e.center.clientY-a.center.clientY),o.lastVelocityEvent=e):o.velocity||(s=h.getVelocity(t,n,r),o.lastVelocityEvent=e),o.velocity=s,e.velocityX=s.x,e.velocityY=s.y},getInterimData:function(e){var t,n,i=this.current.lastEvent;e.eventType==f?(t=i&&i.interimAngle,n=i&&i.interimDirection):(t=i&&h.getAngle(i.center,e.center),n=i&&h.getDirection(i.center,e.center)),e.interimAngle=t,e.interimDirection=n},extendEventData:function(e){var t=this.current,n=t.startEvent;(e.touches.length!=n.touches.length||e.touches===n.touches)&&(n.touches=[],h.each(e.touches,function(e){n.touches.push(h.extend({},e))}));var i=e.timeStamp-n.timeStamp,r=e.center.clientX-n.center.clientX,o=e.center.clientY-n.center.clientY;return this.getVelocityData(e,i,r,o),this.getInterimData(e),h.extend(e,{startEvent:n,deltaTime:i,deltaX:r,deltaY:o,distance:h.getDistance(n.center,e.center),angle:h.getAngle(n.center,e.center),direction:h.getDirection(n.center,e.center),scale:h.getScale(n.touches,e.touches),rotation:h.getRotation(n.touches,e.touches)}),e},register:function(e){var n=e.defaults||{};return n[e.name]===t&&(n[e.name]=!0),h.extend(i.defaults,n,!0),e.index=e.index||1e3,this.gestures.push(e),this.gestures.sort(function(e,t){return e.index t.index?1:0}),this.gestures}};i.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,correct_for_drag_min_distance:!0,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1,drag_lock_min_distance:25},triggered:!1,handler:function(e,t){var n=x.current;if(n.name!=this.name&&this.triggered)return t.trigger(this.name+"end",e),void(this.triggered=!1);if(!(t.options.drag_max_touches>0&&e.touches.length>t.options.drag_max_touches))switch(e.eventType){case d:this.triggered=!1;break;case p:if(e.distance 0)){var l=Math.abs(t.options.drag_min_distance/e.distance);i.pageX+=e.deltaX*l,i.pageY+=e.deltaY*l,i.clientX+=e.deltaX*l,i.clientY+=e.deltaY*l,e=x.extendEventData(e)}(n.lastEvent.drag_locked_to_axis||t.options.drag_lock_to_axis&&t.options.drag_lock_min_distance<=e.distance)&&(e.drag_locked_to_axis=!0);var c=n.lastEvent.direction;e.drag_locked_to_axis&&c!==e.direction&&(e.direction=h.isVertical(c)?e.deltaY<0?a:r:e.deltaX<0?o:s),this.triggered||(t.trigger(this.name+"start",e),this.triggered=!0),t.trigger(this.name,e),t.trigger(this.name+e.direction,e);var u=h.isVertical(e.direction);(t.options.drag_block_vertical&&u||t.options.drag_block_horizontal&&!u)&&e.preventDefault();break;case f:this.triggered&&t.trigger(this.name+"end",e),this.triggered=!1}}},i.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:2},timer:null,handler:function(e,t){switch(e.eventType){case d:clearTimeout(this.timer),x.current.name=this.name,this.timer=setTimeout(function(){"hold"==x.current.name&&t.trigger("hold",e)},t.options.hold_timeout);break;case p:e.distance>t.options.hold_threshold&&clearTimeout(this.timer);break;case f:clearTimeout(this.timer)}}},i.gestures.Release={name:"release",index:1/0,handler:function(e,t){e.eventType==f&&t.trigger(this.name,e)}},i.gestures.Swipe={name:"swipe",index:40,defaults:{swipe_min_touches:1,swipe_max_touches:1,swipe_velocity:.7},handler:function(e,t){if(e.eventType==f){if(e.touches.length t.options.swipe_max_touches)return;(e.velocityX>t.options.swipe_velocity||e.velocityY>t.options.swipe_velocity)&&(t.trigger(this.name,e),t.trigger(this.name+e.direction,e))}}},i.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},has_moved:!1,handler:function(e,t){var n,i,r;e.eventType==d?this.has_moved=!1:e.eventType!=p||this.moved?e.eventType==f&&"touchcancel"!=e.srcEvent.type&&e.deltaTime t.options.tap_max_distance}},i.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(e,t){return t.options.prevent_mouseevents&&e.pointerType==l?void e.stopDetect():(t.options.prevent_default&&e.preventDefault(),void(e.eventType==d&&t.trigger(this.name,e)))}},i.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1,transform_within_instance:!1},triggered:!1,handler:function(e,t){if(x.current.name!=this.name&&this.triggered)return t.trigger(this.name+"end",e),void(this.triggered=!1);if(!(e.touches.length<2)){if(t.options.transform_always_block&&e.preventDefault(),t.options.transform_within_instance)for(var n=-1;e.touches[++n];)if(!h.hasParent(e.touches[n].target,t.element))return;switch(e.eventType){case d:this.triggered=!1;break;case p:var i=Math.abs(1-e.scale),r=Math.abs(e.rotation);if(i t.options.transform_min_rotation&&t.trigger("rotate",e),i>t.options.transform_min_scale&&(t.trigger("pinch",e),t.trigger("pinch"+(e.scale<1?"in":"out"),e));break;case f:this.triggered&&t.trigger(this.name+"end",e),this.triggered=!1}}}},"function"==typeof define&&define.amd?define("hammerjs",[],function(){return i}):"object"==typeof module&&module.exports?module.exports=i:e.Hammer=i}(window),define("layout",["jquery","underscore","utils","constants","settings","eventMgr","crel","mousetrap","hammerjs"],function(e,t,n,i,r,o,a,s,l){function c(){j=!0,g.$elt.addClass("layout-animate")}function u(){j=!1,g.$elt.removeClass("layout-animate")}function d(t){this.selector=t,this.elt=document.querySelector(t),this.$elt=e(this.elt)}function p(){return t.find(K,function(e){return m.width>e.screenWidth}).maxWidth}function f(){var e=b.height-60,t=(S.elt.offsetWidth-p())/2;t \n \n\n \n\n \n \n\n\n\n\n \n\n\n \n\n \n\n\n\n\n \n\n\n \n\n \n\n \n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n' -}),define("text!html/bodyViewer.html",[],function(){return'\n\n \n\n\n\n\n\n\n \n\n \n \n\n\n\n\n \n\n\n\n\n\n\n \n\n\n \n\n \n\n \n \n\n\n\n'}),define("text!html/settingsTemplateTooltip.html",[],function(){return'Available variables:\n\n\n \n
\n\n
\nExamples:\n- \n documentTitle: document title
\n- \n documentMarkdown: document in Markdown format
\n- \n strippedDocumentMarkdown: document without front matter
\n- \n documentHTML: document in HTML format
\n- \n frontMatter: YAML front matter object (undefined if not present)
\n- \n publishAttributes: attributes of the publish location (undefined if\n not publishing)
\n
<title><%= documentTitle %></title>\n
<div><%- documentHTML %></div>\n
<%\n
if(publishAttributes.provider.providerId == "github") print(documentMarkdown);\n
%>\n
\n
\nMore\n info\n
\n
\n\n Careful! Template is subject to malicious code. Don\'t copy/paste untrusted\n content.\n'}),define("text!html/settingsShortcutsExtensionTooltip.html",[],function(){return'You can create expanding macros like this:\n
\n
\n\'- - > space\': function() {\n
\n expand(\'--> \', \'→ \');\n
\n}\n
\n
\nMore\n info\n
\n
\n Careful! This is subject to malicious code. Don\'t copy/paste untrusted content.\n'}),define("text!html/settingsUserCustomExtensionTooltip.html",[],function(){return'Extension variable name:\nuserCustom\n
\n
\nExample:\n
\nuserCustom.onPreviewFinished = function() {\n
\n eventMgr.onMessage("Finished!");\n
\n};\n
\n
\nMore\n info\n
\n
\n Careful! This is subject to malicious code. Don\'t copy/paste untrusted content.'}),function(){function e(){}function t(e){this.buttonBar=d.getElementById("wmd-button-bar"+e),this.preview=d.getElementById("wmd-preview"+e),this.input=d.getElementById("wmd-input"+e)}function n(e,t){var n,r,o,a=this,s=[],c=0,u="none",d=function(e,t){u!=e&&(u=e,t||f()),m.isIE&&"moving"==u?o=null:r=setTimeout(p,1)},p=function(e){o=new i(t,e),r=void 0};this.setCommandMode=function(){u="command",f(),r=setTimeout(p,0)},this.canUndo=function(){return c>1},this.canRedo=function(){return s[c+1]?!0:!1},this.undo=function(){a.canUndo()&&(n?(n.restore(),n=null):(s[c]=new i(t),s[--c].restore(),e&&e())),u="none",t.input.focus(),p()},this.redo=function(){a.canRedo()&&(s[++c].restore(),e&&e()),u="none",t.input.focus(),p()};var f=function(){var r=o||new i(t);return r?"moving"==u?void(n||(n=r)):(n&&(s[c-1].text!=n.text&&(s[c++]=n),n=null),s[c++]=r,s[c+1]=null,void(e&&e())):!1},h=function(e){if(!e.ctrlKey&&!e.metaKey){var t=e.keyCode;t>=33&&40>=t||t>=63232&&63235>=t?d("moving"):8==t||46==t||127==t?d("deleting"):13==t?d("newlines"):27==t?d("escape"):(16>t||t>20)&&91!=t&&d("typing")}},g=function(){l.addEvent(t.input,"keypress",function(e){!e.ctrlKey&&!e.metaKey||e.altKey||89!=e.keyCode&&90!=e.keyCode||e.preventDefault()});var e=function(){(m.isIE||o&&o.text!=t.input.value)&&void 0==r&&(u="paste",f(),p())};l.addEvent(t.input,"keydown",h),l.addEvent(t.input,"mousedown",function(){d("moving")}),t.input.onpaste=e,t.input.ondrop=e},v=function(){g(),p(!0)};this.reinit=function(e,t,i,a){s=[],c=0,u="none",n=void 0,r=void 0,p(),o.text=e,o.start=t,o.end=i,o.scrollTop=a,o.setInputAreaSelection(),f()},this.setMode=d,v()}function i(t){var n=this,i=t.input;this.init=function(){l.isVisible(i)&&(this.setInputAreaSelectionStartEnd(),this.scrollTop=i.scrollTop,(!this.text&&i.selectionStart||0===i.selectionStart)&&(this.text=i.value))},this.setInputAreaSelection=function(){if(l.isVisible(i))if(void 0===i.selectionStart||m.isOpera){if(d.selection){i.focus();var e=i.createTextRange();e.moveStart("character",-i.value.length),e.moveEnd("character",-i.value.length),e.moveEnd("character",n.end),e.moveStart("character",n.start),e.select()}}else i.focus(),i.selectionStart=n.start,i.selectionEnd=n.end,i.scrollTop=n.scrollTop},this.setInputAreaSelectionStartEnd=function(){if(t.ieCachedRange||!i.selectionStart&&0!==i.selectionStart){if(d.selection){n.text=l.fixEolChars(i.value);var e=t.ieCachedRange||d.selection.createRange(),r=l.fixEolChars(e.text),o="",a=o+r+o;e.text=a;var s=l.fixEolChars(i.value);e.moveStart("character",-a.length),e.text=r,n.start=s.indexOf(o),n.end=s.lastIndexOf(o)-o.length;var c=n.text.length-l.fixEolChars(i.value).length;if(c){for(e.moveStart("character",-r.length);c--;)r+="\n",n.end+=1;e.text=r}t.ieCachedRange&&(n.scrollTop=t.ieCachedScrollTop),t.ieCachedRange=null,this.setInputAreaSelection()}}else n.start=i.selectionStart,n.end=i.selectionEnd},this.restore=function(){void 0!=n.text&&n.text!=i.value&&(i.value=n.text),this.setInputAreaSelection(),setTimeout(function(){i.scrollTop=n.scrollTop},0)},this.getChunks=function(){var t=new e;return t.before=l.fixEolChars(n.text.substring(0,n.start)),t.startTag="",t.selection=l.fixEolChars(n.text.substring(n.start,n.end)),t.endTag="",t.after=l.fixEolChars(n.text.substring(n.end)),t.scrollTop=n.scrollTop,t},this.setChunks=function(e){e.before=e.before+e.startTag,e.after=e.endTag+e.after,this.start=e.before.length,this.end=e.before.length+e.selection.length,this.text=e.before+e.selection+e.after,this.scrollTop=e.scrollTop},this.init()}function r(e,t,n){var i,r,o,a=3e3,s="manual",c=function(e,t){l.addEvent(e,"input",t),e.onpaste=t,e.ondrop=t,l.addEvent(e,"keypress",t),l.addEvent(e,"keydown",t)},u=function(){if(t.preview){var n=t.input.value;if(!n||n!=o){o=n;var i=(new Date).getTime();n=e.makeHtml(n);var a=(new Date).getTime();r=a-i,g(n)}}},d=function(){if(i&&(clearTimeout(i),i=void 0),"manual"!==s){var e=0;"delayed"===s&&(e=r),e>a&&(e=a),i=setTimeout(u,e)}};this.refresh=function(e){e?(o="",u()):d()},this.processingTime=function(){return r};var p,f=function(e){var n=t.preview,i=n.parentNode,r=n.nextSibling;i.removeChild(n),n.innerHTML=e,r?i.insertBefore(n,r):i.appendChild(n)},h=function(e){t.preview.innerHTML=e},m=function(e){if(p)return p(e);try{h(e),p=h}catch(t){p=f,p(e)}},g=function(e){t.preview&&(m(e),n())},v=function(){c(t.input,d),t.preview&&(t.preview.scrollTop=0)};v()}function o(e,t,n,r,o,a,s){function c(e){h.focus();var o="wmd-link-button"==e.id||"wmd-image-button"==e.id;if(e.textOp){n&&!o&&n.setCommandMode();var a=new i(t);if(!a)return;var s=a.getChunks(),l=function(){h.focus(),s&&a.setChunks(s),a.restore(),r.refresh()},c=e.textOp(s,l);c||(l(),o||h.dispatchEvent(new Event("keydown")))}e.execute&&e.execute(n)}function u(e,n){var i="0px",r="-20px",o="-40px",a=e.getElementsByTagName("span")[0];n?(a.style.backgroundPosition=e.XShift+" "+i,e.onmouseover=function(){a.style.backgroundPosition=this.XShift+" "+o},e.onmouseout=function(){a.style.backgroundPosition=this.XShift+" "+i},m.isIE&&(e.onmousedown=function(){t.ieCachedRange=document.selection.createRange(),t.ieCachedScrollTop=t.input.scrollTop}),e.isHelp||(e.onclick=function(){return this.onmouseout&&this.onmouseout(),c(this),!1}),e.className=e.className.replace(/ disabled/g,"")):(a.style.backgroundPosition=e.XShift+" "+r,e.onmouseover=e.onmouseout=e.onclick=function(){},e.className+=" disabled")}function d(e){return"string"==typeof e&&(e=o[e]),function(){e.apply(o,arguments)}}function p(){var n=t.buttonBar,i=document.createElement("ul");i.id="wmd-button-row"+e,i.className="wmd-button-row",i=n.appendChild(i);var r=0,o=function(t,n,o,a){var s=document.createElement("li");s.className="wmd-button",s.style.left=r+"px",r+=25;var l=document.createElement("span");return s.id=t+e,s.appendChild(l),s.title=n,s.XShift=o,a&&(s.textOp=a),u(s,!0),i.appendChild(s),s},l=function(t){var n=document.createElement("li");n.className="wmd-spacer wmd-spacer"+t,n.id="wmd-spacer"+t+e,i.appendChild(n),r+=25};if(g.bold=o("wmd-bold-button",s("bold"),"0px",d("doBold")),g.italic=o("wmd-italic-button",s("italic"),"-20px",d("doItalic")),l(1),g.link=o("wmd-link-button",s("link"),"-40px",d(function(e,t){return this.doLinkOrImage(e,t,!1)})),g.quote=o("wmd-quote-button",s("quote"),"-60px",d("doBlockquote")),g.code=o("wmd-code-button",s("code"),"-80px",d("doCode")),g.image=o("wmd-image-button",s("image"),"-100px",d(function(e,t){return this.doLinkOrImage(e,t,!0)})),l(2),g.olist=o("wmd-olist-button",s("olist"),"-120px",d(function(e,t){this.doList(e,t,!0)})),g.ulist=o("wmd-ulist-button",s("ulist"),"-140px",d(function(e,t){this.doList(e,t,!1)})),g.heading=o("wmd-heading-button",s("heading"),"-160px",d("doHeading")),g.hr=o("wmd-hr-button",s("hr"),"-180px",d("doHorizontalRule")),l(3),g.undo=o("wmd-undo-button",s("undo"),"-200px",null),g.undo.execute=function(e){e&&e.undo()},g.redo=o("wmd-redo-button",s("redo"),"-220px",null),g.redo.execute=function(e){e&&e.redo()},a){var c=document.createElement("li"),p=document.createElement("span");c.appendChild(p),c.className="wmd-button wmd-help-button",c.id="wmd-help-button"+e,c.XShift="-240px",c.isHelp=!0,c.style.right="0px",c.title=s("help"),c.onclick=a.handler,u(c,!0),i.appendChild(c),g.help=c}f()}function f(){n&&(u(g.undo,n.canUndo()),u(g.redo,n.canRedo()))}var h=t.input,g={};p();var v="keydown";m.isOpera&&(v="keypress"),l.addEvent(h,"keyup",function(e){if(e.shiftKey&&!e.ctrlKey&&!e.metaKey){var t=e.charCode||e.keyCode;if(13===t){var n={};n.textOp=d("doAutoindent"),c(n)}}}),m.isIE&&l.addEvent(h,"keydown",function(e){var t=e.keyCode;return 27===t?!1:void 0}),this.setUndoRedoButtonStates=f,this.buttons=g,this.doClick=c}function a(e,t){this.hooks=e,this.getString=t}function s(e){return e.replace(/^\s*(.*?)(?:\s+"(.+)")?\s*$/,function(e,t,n){return t=t.replace(/\?.*$/,function(e){return e.replace(/\+/g," ")}),t=decodeURIComponent(t),t=encodeURI(t).replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29"),t=t.replace(/\?.*$/,function(e){return e.replace(/\+/g,"%2b")}),n&&(n=n.trim?n.trim():n.replace(/^\s*/,"").replace(/\s*$/,""),n=n.replace(/"/g,"quot;").replace(/\(/g,"(").replace(/\)/g,")").replace(//g,">")),n?t+' "'+n+'"':t})}var l={},c={},u={},d=window.document,p=window.RegExp,f=window.navigator,h={lineLength:72},m={isIE:/msie/.test(f.userAgent.toLowerCase()),isIE_5or6:/msie 6/.test(f.userAgent.toLowerCase())||/msie 5/.test(f.userAgent.toLowerCase()),isOpera:/opera/.test(f.userAgent.toLowerCase())},g={bold:"Strong Ctrl/Cmd+B",boldexample:"strong text",italic:"Emphasis Ctrl/Cmd+I",italicexample:"emphasized text",link:"Hyperlink Ctrl/Cmd+L",linkdescription:"enter link description here",linkdialog:'Insert Hyperlink
http://example.com/ "optional title"
',quote:"BlockquoteCtrl/Cmd+Q",quoteexample:"Blockquote",code:"Code Sample"),e=e.replace(/(\*|_)(?=\S)(.+?)(?=\S)\1/g,"$2")}};n.setOptions(r),M=new Markdown.Editor(n,void 0,{undoManager:i.undoMgr}),M.hooks.set("insertLinkDialog",function(t){return T.insertLinkCallback=t,a.resetModalInputs(),e(".modal-insert-link").modal(),!0}),M.hooks.set("insertImageDialog",function(t){return T.insertLinkCallback=t,T.catchModal?!0:(a.resetModalInputs(),e(".modal-insert-image").modal(),!0)}),c.onPagedownConfigure(M),M.hooks.chain("onPreviewRefresh",c.onAsyncPreview),M.run(),i.undoMgr.init(),e(".wmd-button-row li").addClass("btn btn-success").css("left",0).find("span").hide();var o=e(".wmd-button-group1");e("#wmd-bold-button").append(e('')).appendTo(o),e("#wmd-italic-button").append(e('')).appendTo(o),o=e(".wmd-button-group2"),e("#wmd-link-button").append(e('')).appendTo(o),e("#wmd-quote-button").append(e('')).appendTo(o),e("#wmd-code-button").append(e('')).appendTo(o),e("#wmd-image-button").append(e('')).appendTo(o),o=e(".wmd-button-group3"),e("#wmd-olist-button").append(e('')).appendTo(o),e("#wmd-ulist-button").append(e('')).appendTo(o),e("#wmd-heading-button").append(e('')).appendTo(o),e("#wmd-hr-button").append(e('')).appendTo(o),o=e(".wmd-button-group5"),e("#wmd-undo-button").append(e('')).appendTo(o),e("#wmd-redo-button").append(e('')).appendTo(o)},T.onReady=function(){document.body.className+=" "+l.editMode,document.body.innerHTML=window.viewerMode===!0?d:u,a.init(),e(window).on("offline",T.setOffline),e(window).on("online",b),navigator.onLine===!1&&T.setOffline(),e(document).mousemove(m).keypress(m),r.init(),i.init(),S=window.setInterval(function(){a.updateCurrentTime(),v(),(g()===!0||window.viewerMode===!0)&&(c.onPeriodicRun(),y())},1e3),c.onReady()},c.addListener("onReady",function(){function n(e){if(e=e||"default",u!=e){var t="less!themes/"+e;-1!==window.baseDir.indexOf("-min")&&(t="css!themes/"+e),requirejs.undef(t),require([t]),u=e}}function r(n,i){t.each(document.querySelectorAll(n),function(t){var n=e(t);n.tooltip({html:!0,container:n.parents(".modal-content"),placement:"right",trigger:"manual",title:i}).click(function(){var t=this;m&&m[0]===t||a.defer(function(){e(document).on("click.close-tooltip",function(){m&&m.tooltip("hide"),m=void 0,e(document).off("click.close-tooltip")}),m=e(t).tooltip("show")})})})}e(".modal").on("shown.bs.modal",function(){var t=e(this);setTimeout(function(){t.find(".btn:first").focus(),t.find("button:first").focus(),t.find("input:enabled:visible:first").focus()},50)}).on("hidden.bs.modal",function(){i.focus(),n(window.theme)}).keyup(function(t){13!=t.which||e(t.target).is("textarea")||e(this).find(".modal-footer a:last").click()}),e(".action-insert-link").click(function(t){var n=a.getInputTextValue(e("#input-insert-link"),t);void 0!==n&&(T.insertLinkCallback(n),T.insertLinkCallback=void 0)}),e(".action-insert-image").click(function(t){var n=a.getInputTextValue(e("#input-insert-image"),t);void 0!==n&&(T.insertLinkCallback(n),T.insertLinkCallback=void 0)}),e(".modal-insert-link, .modal-insert-image").on("hidden.bs.modal",function(){void 0!==T.insertLinkCallback&&(T.insertLinkCallback(null),T.insertLinkCallback=void 0)}),e(".action-load-settings").click(function(){x()}),e(".action-apply-settings").click(function(e){w(e),e.isPropagationStopped()||window.location.reload()});var u=window.theme;L=e("#input-settings-theme"),L.on("change",function(){n(this.value)}),e(".action-import-docs-settings").click(function(){e("#input-file-import-docs-settings").click()});var d;e("#input-file-import-docs-settings").change(function(n){var i=(n.dataTransfer||n.target).files;e(".modal-settings").modal("hide"),t.each(i,function(t){var n=new FileReader;n.onload=function(t){return function(n){try{d=JSON.parse(n.target.result);var i=parseInt(d.version.match(/^v(\d+)$/)[1],10),r=parseInt(s.version.match(/^v(\d+)$/)[1],10);i>r?c.onError("Incompatible version. Please upgrade StackEdit."):e(".modal-import-docs-settings").modal("show")}catch(o){c.onError("Wrong format: "+t.name)}e("#input-file-import-docs-settings").val("")}}(t),n.readAsText(t)})}),e(".action-import-docs-settings-confirm").click(function(){s.clear();var e=/^file\.|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^author\.|^themeV3$|^version$/;t.each(d,function(t,n){e.test(n)&&(s[n]=t)}),window.location.reload()}),e(".action-export-docs-settings").click(function(){a.saveAs(JSON.stringify(s),"StackEdit local storage.json")}),e(".action-default-settings").click(function(){s.removeItem("settings"),s.removeItem("theme"),l.dropboxFullAccess||s.removeItem("dropbox.lastChangeId"),window.location.reload()}),e(".action-app-reset").click(function(){s.clear(),window.location.reload()}),e(".action-reset-input").click(function(){a.resetModalInputs()});var m;if(r(".tooltip-lazy-rendering","Disable preview rendering while typing in order to offload CPU. Refresh preview after 500 ms of inactivity."),r(".tooltip-default-content",["Thanks for supporting StackEdit by adding a backlink in your documents!Ctrl/Cmd+K",codeexample:"enter code here",image:"Image Ctrl/Cmd+G",imagedescription:"enter image description here",imagedialog:"
Insert Image
http://example.com/images/diagram.jpg \"optional title\"
",olist:"Numbered List
Need free image hosting?Ctrl/Cmd+O",ulist:"Bulleted List
Ctrl/Cmd+U",litem:"List item",heading:"Heading
/
Ctrl/Cmd+H",headingexample:"Heading",hr:"Horizontal Rule
Ctrl/Cmd+R",undo:"Undo - Ctrl/Cmd+Z",redo:"Redo - Ctrl/Cmd+Y",help:"Markdown Editing Help"},v="http://",b="http://";Markdown.Editor=function(e,i,s){s=s||{},"function"==typeof s.handler&&(s={helpButton:s}),s.strings=s.strings||{},s.helpButton&&(s.strings.help=s.strings.help||s.helpButton.title);var l=function(e){return s.strings[e]||g[e]};i=i||"";var c=this.hooks=new Markdown.HookCollection;c.addNoop("onPreviewRefresh"),c.addNoop("postBlockquoteCreation"),c.addFalse("insertImageDialog"),c.addFalse("insertLinkDialog"),this.getConverter=function(){return e};var u,p,f=this;this.run=function(){if(!u){u=new t(i);var h,m=new a(c,l),g=new r(e,u,function(){c.onPreviewRefresh()});s.undoManager?(p=s.undoManager,p.onButtonStateChange=function(){h.setUndoRedoButtonStates()},h&&h.setUndoRedoButtonStates()):/\?noundo/.test(d.location.href)||(p=new n(function(){g.refresh(),h&&h.setUndoRedoButtonStates()},u),this.textOperation=function(e){p.setCommandMode(),e(),f.refreshPreview()}),h=new o(i,u,p,g,m,s.helpButton,l),h.setUndoRedoButtonStates();{f.refreshPreview=function(){g.refresh(!0)}}f.undoManager=p,f.uiManager=h}}},e.prototype.findTags=function(e,t){var n,i=this;e&&(n=l.extendRegExp(e,"","$"),this.before=this.before.replace(n,function(e){return i.startTag=i.startTag+e,""}),n=l.extendRegExp(e,"^",""),this.selection=this.selection.replace(n,function(e){return i.startTag=i.startTag+e,""})),t&&(n=l.extendRegExp(t,"","$"),this.selection=this.selection.replace(n,function(e){return i.endTag=e+i.endTag,""}),n=l.extendRegExp(t,"^",""),this.after=this.after.replace(n,function(e){return i.endTag=e+i.endTag,""}))},e.prototype.trimWhitespace=function(e){var t,n,i=this;e?t=n="":(t=function(e){return i.before+=e,""},n=function(e){return i.after=e+i.after,""}),this.selection=this.selection.replace(/^(\s*)/,t).replace(/(\s*)$/,n)},e.prototype.skipLines=function(e,t,n){void 0===e&&(e=1),void 0===t&&(t=1),e++,t++;var i,r;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+p.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+p.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+p.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+p.$1,this.before){for(i=r="";e--;)i+="\\n?",r+="\n";n&&(i="\\n*"),this.before=this.before.replace(new p(i+"$",""),r)}if(this.after){for(i=r="";t--;)i+="\\n?",r+="\n";n&&(i="\\n*"),this.after=this.after.replace(new p(i,""),r)}},l.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},l.addEvent=function(e,t,n){e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener(t,n,!1)},l.removeEvent=function(e,t,n){e.detachEvent?e.detachEvent("on"+t,n):e.removeEventListener(t,n,!1)},l.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},l.extendRegExp=function(e,t,n){(null===t||void 0===t)&&(t=""),(null===n||void 0===n)&&(n="");var i,r=e.toString();return r=r.replace(/\/([gim]*)$/,function(e,t){return i=t,""}),r=r.replace(/(^\/|\/$)/g,""),r=t+r+n,new p(r,i)},c.getTop=function(e,t){var n=e.offsetTop;if(!t)for(;e=e.offsetParent;)n+=e.offsetTop;return n},c.getHeight=function(e){return e.offsetHeight||e.scrollHeight},c.getWidth=function(e){return e.offsetWidth||e.scrollWidth},c.getPageSize=function(){var e,t,n,i;self.innerHeight&&self.scrollMaxY?(e=d.body.scrollWidth,t=self.innerHeight+self.scrollMaxY):d.body.scrollHeight>d.body.offsetHeight?(e=d.body.scrollWidth,t=d.body.scrollHeight):(e=d.body.offsetWidth,t=d.body.offsetHeight),self.innerHeight?(n=self.innerWidth,i=self.innerHeight):d.documentElement&&d.documentElement.clientHeight?(n=d.documentElement.clientWidth,i=d.documentElement.clientHeight):d.body&&(n=d.body.clientWidth,i=d.body.clientHeight);var r=Math.max(e,n),o=Math.max(t,i);return[r,o,n,i]},u.createBackground=function(){var e=d.createElement("div"),t=e.style;e.className="wmd-prompt-background",t.position="absolute",t.top="0",t.zIndex="1000",m.isIE?t.filter="alpha(opacity=50)":t.opacity="0.5";var n=c.getPageSize();return t.height=n[1]+"px",m.isIE?(t.left=d.documentElement.scrollLeft,t.width=d.documentElement.clientWidth):(t.left="0",t.width="100%"),d.body.appendChild(e),e},u.prompt=function(e,t,n){var i,r;void 0===t&&(t="");var o=function(e){var t=e.charCode||e.keyCode;27===t&&a(!0)},a=function(e){l.removeEvent(d.body,"keydown",o);var t=r.value;return e?t=null:(t=t.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(t)||(t="http://"+t)),i.parentNode.removeChild(i),n(t),!1},s=function(){i=d.createElement("div"),i.className="wmd-prompt-dialog",i.style.padding="10px;",i.style.position="fixed",i.style.width="400px",i.style.zIndex="1001";var n=d.createElement("div");n.innerHTML=e,n.style.padding="5px",i.appendChild(n);var s=d.createElement("form"),u=s.style;s.onsubmit=function(){return a(!1)},u.padding="0",u.margin="0",u.cssFloat="left",u.width="100%",u.textAlign="center",u.position="relative",i.appendChild(s),r=d.createElement("input"),r.type="text",r.value=t,u=r.style,u.display="block",u.width="80%",u.marginLeft=u.marginRight="auto",s.appendChild(r);var p=d.createElement("input");p.type="button",p.onclick=function(){return a(!1)},p.value="OK",u=p.style,u.margin="10px",u.display="inline",u.width="7em";var f=d.createElement("input");f.type="button",f.onclick=function(){return a(!0)},f.value="Cancel",u=f.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(p),s.appendChild(f),l.addEvent(d.body,"keydown",o),i.style.top="50%",i.style.left="50%",i.style.display="block",m.isIE_5or6&&(i.style.position="absolute",i.style.top=d.documentElement.scrollTop+200+"px",i.style.left="50%"),d.body.appendChild(i),i.style.marginTop=-(c.getHeight(i)/2)+"px",i.style.marginLeft=-(c.getWidth(i)/2)+"px"};setTimeout(function(){s();var e=t.length;if(void 0!==r.selectionStart)r.selectionStart=0,r.selectionEnd=e;else if(r.createTextRange){var n=r.createTextRange();n.collapse(!1),n.moveStart("character",-e),n.moveEnd("character",e),n.select()}r.focus()},0)};var y=a.prototype;y.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",y.unwrap=function(e){var t=new p("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");e.selection=e.selection.replace(t,"$1 $2")},y.wrap=function(e,t){this.unwrap(e);var n=new p("(.{1,"+t+"})( +|$\\n?)","gm"),i=this;e.selection=e.selection.replace(n,function(e,t){return new p("^"+i.prefixes,"").test(e)?e:t+"\n"}),e.selection=e.selection.replace(/\s+$/,"")},y.doBold=function(e,t){return this.doBorI(e,t,2,this.getString("boldexample"))},y.doItalic=function(e,t){return this.doBorI(e,t,1,this.getString("italicexample"))},y.doBorI=function(e,t,n,i){e.trimWhitespace(),e.selection=e.selection.replace(/\n{2,}/g,"\n");var r=/(\**$)/.exec(e.before)[0],o=/(^\**)/.exec(e.after)[0],a=Math.min(r.length,o.length);if(a>=n&&(2!=a||1!=n))e.before=e.before.replace(p("[*]{"+n+"}$",""),""),e.after=e.after.replace(p("^[*]{"+n+"}",""),"");else if(!e.selection&&o){e.after=e.after.replace(/^([*_]*)/,""),e.before=e.before.replace(/(\s?)$/,"");var s=p.$1;e.before=e.before+o+s}else{e.selection||o||(e.selection=i);var l=1>=n?"*":"**";e.before=e.before+l,e.after=l+e.after}},y.stripLinkDefs=function(e,t){return e=e.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(e,n,i,r,o){return t[n]=e.replace(/\s*$/,""),r?(t[n]=e.replace(/["(](.+?)[")]$/,""),r+o):""})},y.addLinkDef=function(e,t){var n=0,i={};e.before=this.stripLinkDefs(e.before,i),e.selection=this.stripLinkDefs(e.selection,i),e.after=this.stripLinkDefs(e.after,i);var r="",o=/(\[)((?:\[[^\]]*\]|[^\[\]])*)(\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g,a=function(e){n++,e=e.replace(/^[ ]{0,3}\[(\d+)\]:/," ["+n+"]:"),r+="\n"+e},s=function(e,t,r,l,c,u){return r=r.replace(o,s),i[c]?(a(i[c]),t+r+l+n+u):e};e.before=e.before.replace(o,s),t?a(t):e.selection=e.selection.replace(o,s);var l=n;return e.after=e.after.replace(o,s),e.after&&(e.after=e.after.replace(/\n*$/,"")),e.after||(e.selection=e.selection.replace(/\n*$/,"")),e.after+="\n\n"+r,l},y.doLinkOrImage=function(e,t,n){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);var i;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return void this.addLinkDef(e,null);var r=this,o=function(o){if(i.parentNode.removeChild(i),null!==o){e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1);var a=" [999]: "+s(o),l=r.addLinkDef(e,a);e.startTag=n?"![":"[",e.endTag="]["+l+"]",e.selection||(e.selection=r.getString(n?"imagedescription":"linkdescription"))}t()};return i=u.createBackground(),n?this.hooks.insertImageDialog(o)||u.prompt(this.getString("imagedialog"),v,o):this.hooks.insertLinkDialog(o)||u.prompt(this.getString("linkdialog"),b,o),!0}e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",this.addLinkDef(e,null)},y.doAutoindent=function(e){var t=this,n=!1;e.before=e.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"),e.selection||/^[ \t]*(?:\n|$)/.test(e.after)||(e.after=e.after.replace(/^[^\n]*/,function(t){return e.selection=t,""}),n=!0),/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(e.before)&&t.doList&&t.doList(e),/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(e.before)&&t.doBlockquote&&t.doBlockquote(e),/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&t.doCode&&t.doCode(e),n&&(e.after=e.selection+e.after,e.selection="")},y.doBlockquote=function(e){e.selection=e.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(t,n,i,r){return e.before+=n,e.after=r+e.after,i}),e.before=e.before.replace(/(>[ \t]*)$/,function(t,n){return e.selection=n+e.selection,""}),e.selection=e.selection.replace(/^(\s|>)+$/,""),e.selection=e.selection||this.getString("quoteexample");var t,n="",i="";if(e.before){for(var r=e.before.replace(/\n$/,"").split("\n"),o=!1,a=0;a0,/^>/.test(t)?(s=!0,!o&&t.length>1&&(o=!0)):s=/^[ \t]*$/.test(t)?!0:o,s?n+=t+"\n":(i+=n+t,n="\n")}/(^|\n)>/.test(n)||(i+=n,n="")}e.startTag=n,e.before=i,e.after&&(e.after=e.after.replace(/^\n?/,"\n")),e.after=e.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(t){return e.endTag=t,""});var l=function(t){var n=t?"> ":"";e.startTag&&(e.startTag=e.startTag.replace(/\n((>|\s)*)\n$/,function(e,t){return"\n"+t.replace(/^[ ]{0,3}>?[ \t]*$/gm,n)+"\n"})),e.endTag&&(e.endTag=e.endTag.replace(/^\n((>|\s)*)\n/,function(e,t){return"\n"+t.replace(/^[ ]{0,3}>?[ \t]*$/gm,n)+"\n"}))};/^(?![ ]{0,3}>)/m.test(e.selection)?(this.wrap(e,h.lineLength-2),e.selection=e.selection.replace(/^/gm,"> "),l(!0),e.skipLines()):(e.selection=e.selection.replace(/^[ ]{0,3}> ?/gm,""),this.unwrap(e),l(!1),!/^(\n|^)[ ]{0,3}>/.test(e.selection)&&e.startTag&&(e.startTag=e.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(e.selection)&&e.endTag&&(e.endTag=e.endTag.replace(/^\n{0,2}/,"\n\n"))),e.selection=this.hooks.postBlockquoteCreation(e.selection),/\n/.test(e.selection)||(e.selection=e.selection.replace(/^(> *)/,function(t,n){return e.startTag+=n,""}))},y.doCode=function(e){var t=/\S[ ]*$/.test(e.before),n=/^[ ]*\S/.test(e.after);if(!n&&!t||/\n/.test(e.selection)){e.before=e.before.replace(/[ ]{4}$/,function(t){return e.selection=t+e.selection,""});var i=1,r=1;/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&(i=0),/^\n(\t|[ ]{4,})/.test(e.after)&&(r=0),e.skipLines(i,r),e.selection?/^[ ]{0,3}\S/m.test(e.selection)?/\n/.test(e.selection)?e.selection=e.selection.replace(/^/gm," "):e.before+=" ":e.selection=e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm,""):(e.startTag=" ",e.selection=this.getString("codeexample"))}else e.trimWhitespace(),e.findTags(/`/,/`/),e.startTag||e.endTag?e.endTag&&!e.startTag?(e.before+=e.endTag,e.endTag=""):e.startTag=e.endTag="":(e.startTag=e.endTag="`",e.selection||(e.selection=this.getString("codeexample")))},y.doList=function(e,t,n){var i=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,r=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/,o="-",a=1,s=function(){var e;return n?(e=" "+a+". ",a++):e=" "+o+" ",e},l=function(e){return void 0===n&&(n=/^\s*\d/.test(e)),e=e.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(){return s()})};if(e.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null),!e.before||/\n$/.test(e.before)||/^\n/.test(e.startTag)||(e.before+=e.startTag,e.startTag=""),e.startTag){var c=/\d+[.]/.test(e.startTag);if(e.startTag="",e.selection=e.selection.replace(/\n[ ]{4}/g,"\n"),this.unwrap(e),e.skipLines(),c&&(e.after=e.after.replace(r,l)),n==c)return}var u=1;e.before=e.before.replace(i,function(e){return/^\s*([*+-])/.test(e)&&(o=p.$1),u=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.selection||(e.selection=this.getString("litem"));var d=s(),f=1;e.after=e.after.replace(r,function(e){return f=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.trimWhitespace(!0),e.skipLines(u,f,!0),e.startTag=d;var m=d.replace(/./g," ");this.wrap(e,h.lineLength-m.length),e.selection=e.selection.replace(/\n/g,"\n"+m)},y.doHeading=function(e){if(e.selection=e.selection.replace(/\s+/g," "),e.selection=e.selection.replace(/(^\s+|\s+$)/g,""),!e.selection)return e.startTag="## ",e.selection=this.getString("headingexample"),void(e.endTag=" ##");var t=0;e.findTags(/#+[ ]*/,/[ ]*#+/),/#+/.test(e.startTag)&&(t=p.lastMatch.length),e.startTag=e.endTag="",e.findTags(null,/\s?(-+|=+)/),/=+/.test(e.endTag)&&(t=1),/-+/.test(e.endTag)&&(t=2),e.startTag=e.endTag="",e.skipLines(1,1);var n=0==t?2:t-1;if(n>0){var i=n>=2?"-":"=",r=e.selection.length;for(r>h.lineLength&&(r=h.lineLength),e.endTag="\n";r--;)e.endTag+=i}},y.doHorizontalRule=function(e){e.startTag="----------\n",e.selection="",e.skipLines(2,1,!0)}}(),define("pagedown",function(){}),define("core",["jquery","underscore","crel","editor","layout","constants","utils","storage","settings","eventMgr","text!html/bodyIndex.html","text!html/bodyViewer.html","text!html/settingsTemplateTooltip.html","text!html/settingsShortcutsExtensionTooltip.html","text!html/settingsUserCustomExtensionTooltip.html","storage","pagedown"],function(e,t,n,i,r,o,a,s,l,c,u,d,p,f,h){function m(){E=!0,k=!0;var e=a.currentTime;e>I+1e3&&(I=e,c.onUserActive())}function g(){return a.currentTime-I>o.USER_IDLE_THRESHOLD&&(k=!1),k&&_}function v(){if(E!==!1&&_!==!1){void 0===C&&(C=a.randomString(),s.frontWindowId=C);var t=s.frontWindowId;t!=C&&(_=!1,void 0!==S&&clearInterval(S),e(".modal").modal("hide"),e(".modal-non-unique").modal("show"),window.close())}}function b(){D===!0&&(D=!1,c.onOfflineChanged(!1))}function y(){D===!0&&navigator.onLine===!0&&N+o.CHECK_ONLINE_PERIOD $2
",'NOTE: Backlinks in Stack Exchange Q/A are not welcome.'].join("")),r(".tooltip-shortcuts-extension",f),r(".tooltip-usercustom-extension",h),r(".tooltip-template",p),e("div.dropdown-menu").click(function(e){e.stopPropagation()}),e(".modal-non-unique").modal({backdrop:"static",keyboard:!1,show:!1}),t.each(document.querySelectorAll("img"),function(t){var n=e(t),i=n.data("stackeditSrc");i&&n.attr("src",window.baseDir+"/img/"+i)}),window.viewerMode===!1){var g=t.reduce(o.THEME_LIST,function(e,t,n){return e+'"},"");document.getElementById("input-settings-theme").innerHTML=g}}),T}),define("text!WELCOME.md",[],function(){return'Welcome to StackEdit! {#welcome}\n=====================\n\n\nHello, I am your first Markdown document within **StackEdit**[^stackedit]. Don\'t delete me, I can be helpful. I can be recovered anyway in the `Utils` tab of the `Settings` dialog.\n\n----------\n\n\nDocuments\n---------\n\n**StackEdit** stores your documents in your browser, which means all your documents are automatically saved locally and are accessible **offline!**\n\n> **NOTE:**\n> \n> - StackEdit is accessible offline after the application has been loaded for the first time.\n> - Your local documents are not shared between different browsers or computers.\n> - Clearing your browser\'s data may **delete all your local documents!** Make sure your documents are backed up using **Google Drive** or **Dropbox** synchronization (see [ Synchronization](#synchronization) section).\n\n#### Create a document\n\nYou can create a new document by clicking the button in the navigation bar. It will switch from the current document to the new one.\n\n#### Switch to another document\n\nYou can list all your local documents and switch from one to another by clicking the button in the navigation bar.\n\n#### Rename a document\n\nYou can rename the current document by clicking the document title in the navigation bar.\n\n#### Delete a document\n\nYou can delete the current document by clicking the button in the navigation bar.\n\n#### Save a document\n\nYou can save the current document to a file using the `Save as...` sub-menu from the menu.\n\n> **Tip:** See [ Publish a document](#publish-a-document) section for a description of the different output formats.\n\n\n----------\n\n\nSynchronization\n---------------\n\n**StackEdit** can be combined with **Google Drive** and **Dropbox** to have your documents centralized in the *Cloud*. The synchronization mechanism will take care of uploading your modifications or downloading the latest version of your documents.\n\n> **NOTE:**\n> \n> - Full access to **Google Drive** or **Dropbox** is required to be able to import any document in StackEdit.\n> - Imported documents are downloaded in your browser and are not transmitted to a server.\n> - If you experience problems exporting documents to Google Drive, check and optionally disable browser extensions, such as Disconnect.\n\n#### Import a document\n\nYou can import a document from the *Cloud* by going to the `Google Drive` or the `Dropbox` sub-menu and by clicking `Import from...`. Once imported, your document will be automatically synchronized with the **Google Drive** / **Dropbox** file.\n\n#### Export a document\n\nYou can export any document by going to the `Google Drive` or the `Dropbox` sub-menu and by clicking `Export to...`. Even if your document is already synchronized with **Google Drive** or **Dropbox**, you can export it to a another location. **StackEdit** can synchronize one document with multiple locations.\n\n> **Tip:** Using **Google Drive**, you can create collaborative documents to work in real time with other users. Just check the box `Create a real time collaborative document` in the dialog options when exporting to Google Drive.\n\n#### Synchronize a document\n\nOnce your document is linked to a **Google Drive** or a **Dropbox** file, **StackEdit** will periodically (every 3 minutes) synchronize it by downloading/uploading any modification. Any conflict will be detected, and a local copy of your document will be created as a backup if necessary.\n\nIf you just have modified your document and you want to force the synchronization, click the button in the navigation bar.\n\n> **NOTE:** The button is disabled when you have no document to synchronize.\n\n#### Manage document synchronization\n\nSince one document can be synchronized with multiple locations, you can list and manage synchronized locations by clicking `Manage synchronization` in the menu. This will open a dialog box allowing you to add or remove synchronization links that are associated to your document.\n\n> **NOTE:** If you delete the file from **Google Drive** or from **Dropbox**, the document will no longer be synchronized with that location.\n\n----------\n\n\nPublication\n-----------\n\nOnce you are happy with your document, you can publish it on different websites directly from **StackEdit**. As for now, **StackEdit** can publish on **Blogger**, **Dropbox**, **Gist**, **GitHub**, **Google Drive**, **Tumblr**, **WordPress** and on any SSH server.\n\n#### Publish a document\n\nYou can publish your document by going to the `Publish on` sub-menu and by choosing a website. In the dialog box, you can choose the publication format:\n\n- Markdown, to publish the Markdown text on a website that can interpret it (**GitHub** for instance),\n- HTML, to publish the document converted into HTML (on a blog for instance),\n- Template, to have a full control of the output.\n\n> **NOTE:** The default template is a simple webpage wrapping your document in HTML format. You can customize it in the `Services` tab of the `Settings` dialog.\n\n#### Update a publication\n\nAfter publishing, **StackEdit** will keep your document linked to that publish location so that you can update it easily. Once you have modified your document and you want to update your publication, click on the button in the navigation bar.\n\n> **NOTE:** The button is disabled when the document has not been published yet.\n\n#### Manage document publication\n\nSince one document can be published on multiple locations, you can list and manage publish locations by clicking `Manage publication` in the menu. This will open a dialog box allowing you to remove publication links that are associated to your document.\n\n> **NOTE:** In some cases, if the file has been removed from the website or the blog, the document will no longer be published on that location.\n\n----------\n\n\nMarkdown Extra\n--------------\n\n**StackEdit** supports **Markdown Extra**, which extends **Markdown** syntax with some nice features.\n\n> **Tip:** You can disable any **Markdown Extra** feature in the `Extensions` tab of the `Settings` dialog.\n\n\n### Tables\n\n**Markdown Extra** has a special syntax for tables:\n\nItem | Value\n--------- | -----\nComputer | 1600 USD\nPhone | 12 USD\nPipe | 1 USD\n\nYou can specify column alignment with one or two colons:\n\n| Item | Value | Qty |\n| :-------- | --------:| :--: |\n| Computer | 1600 USD | 5 |\n| Phone | 12 USD | 12 |\n| Pipe | 1 USD | 234 |\n\n\n### Definition Lists\n\n**Markdown Extra** has a special syntax for definition lists too:\n\nTerm 1\nTerm 2\n: Definition A\n: Definition B\n\nTerm 3\n\n: Definition C\n\n: Definition D\n\n > part of definition D\n\n\n### Fenced code blocks\n\nGitHub\'s fenced code blocks[^gfm] are also supported with **Prettify** syntax highlighting:\n\n```\n// Foo\nvar bar = 0;\n```\n\n> **Tip:** To use **Highlight.js** instead of **Prettify**, just configure the `Markdown Extra` extension in the `Settings` dialog.\n\n\n### Footnotes\n\nYou can create footnotes like this[^footnote].\n\n [^footnote]: Here is the *text* of the **footnote**.\n\n\n### SmartyPants\n\nSmartyPants converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example:\n\n| | ASCII | HTML |\n ------------------|------------------------------------------|-------------------------------------\n| Single backticks | `\'Isn\'t this fun?\'` | ‘Isn’t this fun?’ |\n| Quotes | `"Isn\'t this fun?"` | “Isn’t this fun?” |\n| Dashes | `-- is an en-dash and --- is an em-dash` | – is an en-dash and — is an em-dash |\n\n\n### Table of contents\n\nYou can insert a table of contents using the marker `[TOC]`:\n\n[TOC]\n\n\n### Comments\n\nUsually, comments in Markdown are just standard HTML comments. \n**StackEdit** extends HTML comments in order to produce useful, highlighted comments in the preview but not in your exported documents. \n\n\n### MathJax\n \nYou can render *LaTeX* mathematical expressions using **MathJax**, as on [math.stackexchange.com][1]:\n\nThe *Gamma function* satisfying $\\Gamma(n) = (n-1)!\\quad\\forall\nn\\in\\mathbb N$ is via the Euler integral\n\n$$\n\\Gamma(z) = \\int_0^\\infty t^{z-1}e^{-t}dt\\,.\n$$\n\n> **Tip:** Make sure you include MathJax into your publications to render mathematical expression correctly. Your page/template should include something like: \n\n```\n\n```\n\n> **NOTE:** You can find more information:\n>\n> - about **Markdown** syntax [here][2],\n> - about **Markdown Extra** extension [here][3],\n> - about **LaTeX** mathematical expressions [here][4],\n> - about **Prettify** syntax highlighting [here][5],\n> - about **Highlight.js** syntax highlighting [here][6].\n\n [^stackedit]: [StackEdit](https://stackedit.io/) is a full-featured, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.\n\n [^gfm]: **GitHub Flavored Markdown** (GFM) is supported by StackEdit.\n\n\n [1]: http://math.stackexchange.com/\n [2]: http://daringfireball.net/projects/markdown/syntax "Markdown"\n [3]: https://github.com/jmcmanus/pagedown-extra "Pagedown Extra"\n [4]: http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference\n [5]: https://code.google.com/p/google-code-prettify/\n [6]: http://highlightjs.org/'}),define("fileMgr",["jquery","underscore","constants","core","utils","storage","settings","eventMgr","fileSystem","classes/FileDescriptor","text!WELCOME.md"],function(e,t,n,i,r,o,a,s,l,c,u){var d={};return d.currentFile=void 0,d.selectFile=function(r){if(r=r||d.currentFile,void 0===r){var o=t.size(l);r=0===o?d.createFile(n.WELCOME_DOCUMENT_TITLE,u):t.max(l,function(e){return e.selectTime||0})}d.currentFile!==r&&(d.currentFile=r,r.selectTime=(new Date).getTime(),s.onFileSelected(r),e(".action-edit-document").toggleClass("hide",r.fileIndex!=n.TEMPORARY_FILE_INDEX)),i.initEditor(r)},d.createFile=function(e,i,u,d,p){if(i=void 0!==i?i:a.defaultContent,!e){e=n.DEFAULT_FILE_TITLE;for(var f=2,h=function(t){return t.title==e};t.some(l,h);)e=n.DEFAULT_FILE_TITLE+f++}var m=n.TEMPORARY_FILE_INDEX;if(!p)do m="file."+r.randomString();while(t.has(l,m));d=d||{};var g=t.reduce(d,function(e,t){return r.storeAttributes(t),e+t.syncIndex+";"},";");o[m+".title"]=e,o[m+".content"]=i,o[m+".sync"]=g,o[m+".publish"]=";";var v=new c(m,e,d);return u&&(v.discussionListJSON=u),p||(r.appendIndexToArray("file.list",m),l[m]=v,s.onFileCreated(v)),v},d.deleteFile=function(e){e=e||d.currentFile,e.folder&&(e.folder.removeFile(e),s.onFoldersChanged()),r.removeIndexFromArray("file.list",e.fileIndex),delete l[e.fileIndex],d.currentFile===e&&(d.currentFile=void 0,d.selectFile()),s.onFileDeleted(e)},d.getFileFromSyncIndex=function(e){return t.find(l,function(n){return t.has(n.syncLocations,e)})},d.getFileFromPublishIndex=function(e){return t.find(l,function(n){return t.has(n.publishLocations,e)})},s.addListener("onReady",function(){function t(){o.addClass("hide"),r.removeClass("hide");var t=e.trim(o.val()),n=d.currentFile;t&&t!=n.title&&(n.title=t,s.onTitleChanged(n)),o.val(n.title),i.focus()}var i=e("#wmd-input");d.selectFile();var r=e(".file-title-navbar"),o=e(".input-file-title");e(".action-create-file").click(function(){setTimeout(function(){var e=d.createFile();d.selectFile(e),r.click()},400)}),e(".action-remove-file-confirm").click(function(){e(".modal-remove-file-confirm").modal("show")}),e(".action-remove-file").click(function(){d.deleteFile()}),r.click(function(){if(window.viewerMode!==!0){r.addClass("hide");var e=o.removeClass("hide");setTimeout(function(){e.focus().get(0).select()},10)}}),o.blur(function(){t()}).keyup(function(e){13==e.keyCode&&t(),27==e.keyCode&&(o.val(""),t())}),e(".action-open-stackedit").click(function(){window.location.href="."}),e(".action-edit-document").click(function(){var e=i.val(),t=d.currentFile.title,n=d.createFile(t,e);d.selectFile(n),window.location.href="."}),e(".action-welcome-file").click(function(){var e=d.createFile(n.WELCOME_DOCUMENT_TITLE,u);d.selectFile(e)})}),s.onFileMgrCreated(d),d}),define("classes/Provider",["underscore","utils","settings","eventMgr","fileMgr","editor","diff_match_patch_uncompressed","jsondiffpatch"],function(e,t,n,i,r,o,a,s){function l(e,t){this.providerId=e,this.providerName=t,this.isPublishEnabled=!0}l.prototype.parseDiscussionList=function(t){try{var n=JSON.parse(t);return e.each(n,function(t,n){if(t.discussionIndex!=n||!e.isNumber(t.selectionStart)||!e.isNumber(t.selectionEnd))throw"invalid";t.commentList&&t.commentList.forEach(function(t){if(t.author&&!e.isString(t.author)||!e.isString(t.content))throw"invalid"})}),n}catch(i){}},l.prototype.serializeContent=function(e,t){return t.length>2?e+"":e},l.prototype.parseContent=function(e){var t,n="{}",i=/$/.exec(e);return i&&(t=this.parseDiscussionList(i[1]))&&(e=e.substring(0,i.index),n=i[1]),{content:e,discussionList:t||{},discussionListJSON:n}};var c=new a;c.Match_Threshold=0,c.Patch_DeleteThreshold=0;var u=s.create({objectHash:function(e){return JSON.stringify(e)},textDiff:{minLength:9999999}}),d="merge"==n.conflictMode;return l.prototype.syncMerge=function(n,a,s,l,p,f){function h(e){function t(){(i[1]||r[1])&&(i[1]&&r[1]?(i[1]="∕∕"+i[1]+"∕∕",r[1]+="∕∕",n.push(i),n.push(r)):n.push([0,i[1]+r[1]]),i=[-1,""],r=[1,""])}var n=[],i=[-1,""],r=[1,""],o=20;return e.forEach(function(a,s){function l(){return 0===s||s===e.length-1}var c=a[0],u=a[1];if(0===c)if(l()||u.length>o){if(i[1]||r[1]){var d=/\s/.exec(u);if(d){var p=d.index,f=u.substring(0,p);u=u.substring(p),i[1]+=f,r[1]+=f}}if(u){for(var h=u.length;h&&/\S/.test(u[h-1]);)h--;var m=u.substring(h);u=u.substring(0,h),l()||u.length>o?(t(),n.push([0,u])):(i[1]+=u,r[1]+=u),i[1]+=m,r[1]+=m}}else i[1]+=u,r[1]+=u;else-1===c?i[1]+=u:1===c&&(r[1]+=u)}),i[1]==r[1]?n.push([0,r[1]]):t(),n}var m=n.content,g=n.title,v=n.discussionListJSON,b=n.discussionList,y=t.crc32(m),x=t.crc32(g),w=t.crc32(v),S=t.crc32(s),C=t.crc32(l),T=t.crc32(f),E=a.contentCRC!=y,k=a.contentCRC!=S,_=m!=s&&k,I=_&&E;a.titleCRC=a.titleCRC||x;var D,N,L=a.titleCRC!=x,M=a.titleCRC!=C,A=g!=l&&M,R=A&&L,P=a.discussionListCRC!=w,F=a.discussionListCRC!=T,O=v!=f&&F,B=O&&P,j=[],$=s,G=l,q=p,U=!1,H=!1,z=!1;if(!d&&(I||R||B)||I&&void 0===a.content||R&&void 0===a.title||B&&void 0===a.discussionList)r.createFile(g+" (backup)",m,v),i.onMessage('Conflict detected on "'+g+'". A backup has been created locally.');else{if(I){var V=a.content;D=c.diff_main(V,m),c.diff_cleanupSemantic(D),N=c.patch_make(V,D);var W=c.patch_apply(N,s);if($=W[0],!W[1].every(e.identity)){D=c.diff_main(m,$),D=h(D),$="";var Q;D.forEach(function(e){var t=e[0],n=e[1];0===t||Q?0===t&&Q&&(Q.selectionEnd=$.length,j.push(Q),Q=void 0):Q={selectionStart:$.length,type:"conflict"},$+=n}),Q&&(Q.selectionEnd=$.length,j.push(Q))}}_&&(P&&(U=!0),F?H=!0:(U=!0,q=b)),B&&(z=!0),R&&(N=c.patch_make(a.title,g),G=c.patch_apply(N,l)[0])}var X;if(_){var K=[];r.currentFile===n&&(X={selectionStart:o.selectionMgr.selectionStart,selectionEnd:o.selectionMgr.selectionEnd},K.push(X),n.newDiscussion&&K.push(n.newDiscussion)),U&&(K=K.concat(e.values(b))),O|=o.adjustCommentOffsets(m,$,K)}if(H){var J=e.values(p);o.adjustCommentOffsets(s,$,J)}if(z){var Y=JSON.parse(a.discussionList);D=u.diff(Y,b),u.patch(p,D),e.each(p,function(e,t){e||delete p[t]})}return j.length&&(O=!0,j.forEach(function(n){var i;do i=t.randomString()+t.randomString();while(e.has(q,i));n.discussionIndex=i,q[i]=n})),A&&(n.title=G,i.onTitleChanged(n),i.onMessage('"'+g+'" has been renamed to "'+G+'" on '+this.providerName+".")),(_||O)&&o.watcher.noWatch(e.bind(function(){if(_&&(r.currentFile===n&&(o.setValueNoWatch($),X&&o.selectionMgr.setSelectionStartEnd(X.selectionStart,X.selectionEnd)),n.content=$,i.onContentChanged(n,$)),O){n.discussionList=q;var t=u.diff(b,q),a=!1;e.each(t,function(t,r){e.isArray(t)?1===t.length?i.onDiscussionCreated(n,q[r]):i.onDiscussionRemoved(n,b[r]):a=!0}),a&&i.onCommentsChanged(n)}o.undoMgr.currentMode="sync",o.undoMgr.saveState(),i.onMessage('"'+l+'" has been updated from '+this.providerName+"."),j.length&&i.onMessage('"'+l+'" has conflicts that you have to review.')},this)),{contentCRC:S,titleCRC:C,discussionListCRC:T}},l}),define("classes/AsyncTask",["underscore","constants","utils","eventMgr"],function(e,t,n,i){function r(e){this.finished=!1,this.timeout=t.ASYNC_TASK_DEFAULT_TIMEOUT,this.retryCounter=0,this.runCallbacks=[],this.successCallbacks=[],this.errorCallbacks=[],this.force=e}function o(){if(c===!0)return void(l+u.timeout=t)return void this.error(e);var i=1e3*Math.pow(2,this.retryCounter++);l=n.currentTime+i,c=!1,o()}},r.prototype.enqueue=function(){s.push(this),o()};var u,d=!1,p=!1;return i.addListener("onUserActive",function(){p=!0}),i.addListener("onPeriodicRun",o),r}),define("helpers/dropboxHelper",["jquery","underscore","constants","core","utils","storage","logger","settings","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s,l,c){function u(t){t.onRun(function(){return v===!0?(h=void 0,void t.error(new Error("Operation not available in offline mode.|stopPublish"))):void 0!==h?void t.chain():void e.ajax({url:"libs/dropbox.min.js",dataType:"script",timeout:n.AJAX_TIMEOUT}).done(function(){h=new Dropbox.Client({key:s.dropboxFullAccess===!0?n.DROPBOX_APP_KEY:n.DROPBOX_RESTRICTED_APP_KEY,secret:s.dropboxFullAccess===!0?n.DROPBOX_APP_SECRET:n.DROPBOX_RESTRICTED_APP_SECRET}),h.authDriver(new Dropbox.AuthDriver.Popup({receiverUrl:n.BASE_URL+"html/dropbox-oauth-receiver.html",rememberUser:!0})),t.chain()}).fail(function(e){var n={status:e.status,responseText:e.statusText};p(n,t)})})}function d(e){e.onRun(function(){function t(){r.redirectConfirm("You are being redirected to Dropbox authorization page.",function(){e.chain(i)},function(){e.error(new Error("Operation canceled."))})}function i(){o===!1?e.timeout=n.ASYNC_TASK_LONG_TIMEOUT:h.reset(),h.authenticate({interactive:!o},function(n,i){return i.isAuthenticated()===!0?(m=!0,void e.chain()):o===!0?(o=!1,void e.chain(t)):void e.error(new Error("Access to Dropbox account is not authorized."))})}if(m===!0)return void e.chain();var o=!0;e.chain(i)})}function p(e,n){var r=!0;if(e)if(a.error(e),"string"==typeof e)r=e;else{if(r="Dropbox error ("+e.status+": "+e.responseText+").",401===e.status||403===e.status)return m=!1,r="Access to Dropbox account is not authorized.",void n.retry(new Error(r),1);if(400===e.status&&-1!==e.responseText.indexOf("oauth_nonce"))return t.each(t.keys(o),function(e){0===e.indexOf("dropbox-auth")&&o.removeItem(e)}),m=!1,void n.retry(new Error(r),1);e.status<=0&&(h=void 0,m=!1,i.setOffline(),r="|stopPublish")}n.error(new Error(r))}function f(t){t.onRun(function(){function i(){r.redirectConfirm("You are being redirected to Dropbox Chooser page.",function(){t.chain()},function(){t.error(new Error("Operation canceled."))})}return b===!0?void t.chain():void e.ajax({url:"https://www.dropbox.com/static/api/1/dropbox.js",dataType:"script",timeout:n.AJAX_TIMEOUT}).done(function(){b=!0,t.chain(i)}).fail(function(e){var n={status:e.status,responseText:e.statusText};p(n,t)})})}var h,m=!1,g={},v=!1;l.addListener("onOfflineChanged",function(e){v=e}),g.upload=function(e,t,n){var i,r=new c;u(r),d(r),r.onRun(function(){h.writeFile(e,t,function(t,n){return t?(400===t.status&&(t='Could not upload document into path "'+e+'".'),void p(t,r)):(i=n,void r.chain())})}),r.onSuccess(function(){n(void 0,i)}),r.onError(function(e){n(e)}),r.enqueue()},g.checkChanges=function(e,t){var n=[],i=e||0,r=new c;u(r),d(r),r.onRun(function(){function e(){h.pullChanges(i,function(t,o){return t?void p(t,r):(i=o.cursor(),void 0!==o.changes&&(n=n.concat(o.changes)),void(o.shouldPullAgain?r.chain(e):r.chain()))})}r.chain(e)}),r.onSuccess(function(){t(void 0,n,i)}),r.onError(function(e){t(e)}),r.enqueue()},g.downloadMetadata=function(e,t){var n=[],i=new c;u(i),d(i),i.onRun(function(){function t(){if(0===e.length)return void i.chain();var r=e[0];h.stat(r,function(r,o){return o?(n.push(o),e.shift(),void i.chain(t)):void p(r,i)})}i.chain(t)}),i.onSuccess(function(){t(void 0,n)}),i.onError(function(e){t(e)}),i.enqueue()},g.downloadContent=function(e,n){var i=[],r=new c;u(r),d(r),r.onRun(function(){function n(){if(0===e.length)return void r.chain();var o=e[0];i.push(o);var a;return o.isFile===!0?a=o:void 0!==o.wasRemoved&&(a=o.stat),a?void h.readFile(a.path,function(i,o){return t.isString(o)?(a.content=o,e.shift(),void r.chain(n)):void p(i,r)}):(e.shift(),void r.chain(n))}r.chain(n)}),r.onSuccess(function(){n(void 0,i)}),r.onError(function(e){n(e)}),r.enqueue()};var b=!1;return g.picker=function(e){var t=[],i=new c;i.timeout=n.ASYNC_TASK_LONG_TIMEOUT,u(i),f(i),i.onRun(function(){var e={};e.multiselect=!0,e.linkType="direct",e.success=function(e){for(var n=0;n :"\|?\*]+$/)?0!==e.indexOf("/")?"/"+e:e:void o.onError('"'+e+'" contains invalid characters.')}function c(e){return"sync."+p+"."+encodeURIComponent(e.toLowerCase())}function u(e,n,i,r){r=r||"{}";var o={};return o.provider=f,o.path=e,o.version=n,o.contentCRC=t.crc32(i),o.discussionListCRC=t.crc32(r),o.syncIndex=c(e),h===!0&&(o.content=i,o.discussionList=r),o}function d(t){s.downloadMetadata(t,function(t,n){t||s.downloadContent(n,function(t,n){if(!t){var i=[];e.each(n,function(e){var t=f.parseContent(e.content),n=u(e.path,e.versionTag,t.content,t.discussionListJSON),r={};r[n.syncIndex]=n;var o=a.createFile(e.name,t.content,t.discussionListJSON,r);a.selectFile(o),i.push(o)}),0!==i.length&&o.onSyncImportSuccess(i,f)}})})}var p="dropbox",f=new r(p,"Dropbox");f.defaultPublishFormat="template";var h="merge"==i.conflictMode;return f.importFiles=function(){s.picker(function(t,n){if(!t&&0!==n.length){var i=[];e.each(n,function(e){var t=c(e),n=a.getFileFromSyncIndex(t);return void 0!==n?o.onError('"'+n.title+'" was already imported.'):void i.push(e)}),d(i)}})},f.exportFile=function(e,n,i,r,d){var p=t.getInputTextValue("#input-sync-export-dropbox-path",e);if(p=l(p),void 0===p)return d(!0);var f=c(p),h=a.getFileFromSyncIndex(f);if(void 0!==h){var m=h.title;return o.onError('File path is already synchronized with "'+m+'".'),d(!0)}s.upload(p,i,function(e,t){if(e)return d(e);var n=u(t.path,t.versionTag,i,r);d(void 0,n)})},f.syncUp=function(e,t,n,i,r,o,a,l){if(a.contentCRC==t&&a.discussionListCRC==o)return l(void 0,!1);var c=f.serializeContent(e,r);s.upload(a.path,c,function(n,s){return n?l(n,!0):(a.version=s.versionTag,h===!0&&(a.content=e,a.discussionList=r),a.contentCRC=t,a.titleCRC=i,a.discussionListCRC=o,void l(void 0,!0)) -})},f.syncDown=function(i){var r=n[p+".lastChangeId"];s.checkChanges(r,function(r,l,u){if(r)return i(r);var d=[];e.each(l,function(e){var t=c(e.path),n=a.getFileFromSyncIndex(t),i=n&&n.syncLocations[t];return i?(e.fileDesc=n,e.syncAttributes=i,e.wasRemoved===!0?void d.push(e):void(i.version!=e.stat.versionTag&&d.push(e))):void 0}),s.downloadContent(d,function(e,r){function a(){if(0===r.length)return n[p+".lastChangeId"]=u,i();var e=r.pop(),s=e.fileDesc,l=e.syncAttributes;if(e.wasRemoved===!0)return o.onError('"'+s.title+'" has been removed from Dropbox.'),s.removeSyncLocation(l),o.onSyncRemoved(s,l);var c=e.stat,d=f.parseContent(c.content),h=d.content,m=d.discussionListJSON,g=d.discussionList,v=f.syncMerge(s,l,h,s.title,g,m);l.version=c.versionTag,a===!0&&(l.content=h,l.discussionList=g),l.contentCRC=v.contentCRC,l.discussionListCRC=v.discussionListCRC,t.storeAttributes(l),setTimeout(a,5)}return e?void i(e):void setTimeout(a,5)})})},f.publish=function(e,t,n,i,r){var o=l(e.path);return void 0===o?r(!0):void s.upload(o,i,r)},f.newPublishAttributes=function(e){var n={};return n.path=t.getInputTextValue("#input-publish-dropbox-path",e),e.isPropagationStopped()?void 0:n},f}),define("helpers/googleHelper",["underscore","jquery","constants","core","utils","storage","logger","settings","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s,l,c){function u(t){var n={profile:!0},i=!0;e.each((o[t+".permissions"]||"").split(";"),function(e){e&&(n[e]=!0)}),this.setRefreshFlag=function(){i=!0},this.isAuthorized=function(t){return i===!1&&e.has(n,t)},this.add=function(r){n[r]=!0,o[t+".permissions"]=e.keys(n).join(";"),i=!1},this.getListWithNew=function(t){var i=e.keys(n);return e.has(n,t)||i.push(t),i};var r=o[t+".userId"];this.setUserId=function(e){r=e,o[t+".userId"]=r},this.getUserId=function(){return r}}function d(e){e.onRun(function(){return y===!0?(g=!1,void e.error(new Error("Operation not available in offline mode.|stopPublish"))):g===!0?void e.chain():(window.delayedFunction=function(){gapi.load("client",function(){gapi.client.load("drive","v2",function(){g=!0,e.chain()})})},void t.ajax({url:"https://apis.google.com/js/api.js?onload=runDelayedFunction",dataType:"script",timeout:n.AJAX_TIMEOUT}).fail(function(t){var n={code:t.status,message:t.statusText};h(n,e)}))})}function p(i,o,a){var s=v[a];s||(s=new u(a),v[a]=s),i.onRun(function(){function a(){t.ajax({url:"https://www.googleapis.com/oauth2/v1/tokeninfo",data:{access_token:d.access_token},timeout:n.AJAX_TIMEOUT,type:"GET"}).done(function(e){s.getUserId()&&s.getUserId()!=e.user_id?u():(s.setUserId(e.user_id),s.add(o),s.token=d,i.chain())}).fail(function(e){var t={code:e.status,message:e.statusText};h(t,i)})}function l(){if(m>5)return void i.error(new Error("Unable to authenticate user "+s.getUserId()+", please sign in with Google."));p===!1&&(i.timeout=n.ASYNC_TASK_LONG_TIMEOUT);var t=e.chain(x).pick(s.getListWithNew(o)).flatten().value();gapi.auth.authorize({client_id:n.GOOGLE_CLIENT_ID,scope:t,immediate:p,authuser:p===!1?"":m},function(e){d=gapi.auth.getToken(),gapi.auth.setToken(f),!e||e.error?g===!0&&p===!0?(p=!1,i.chain(c)):i.error(new Error("Access to Google account is not authorized.")):(p===!0&&m++,i.chain(a))})}function c(){return p===!0?void i.chain(l):void r.redirectConfirm("You are being redirected to Google authorization page.",function(){i.chain(l)},function(){i.error(new Error("Operation canceled."))})}function u(){return p=!0,s.token&&s.isAuthorized(o)?void i.chain():(s.getUserId()||(p=!1),void i.chain(c))}var d,p,f=gapi.auth.getToken(),m=0;u()})}function f(e,t){var n=gapi.auth.getToken(),i=v[e];gapi.auth.setToken(i.token),t(),gapi.auth.setToken(n)}function h(t,n){var r;if(t)if(a.error(t),"string"==typeof t)r=t;else{if(r="Google error ("+t.code+": "+t.message+").",t.code>=500&&t.code<600)return void n.retry(new Error(r));if(401===t.code||403===t.code||"token_refresh_required"==t.code)return e.each(v,function(e){e.setRefreshFlag()}),r="Access to Google account is not authorized.",void n.retry(new Error(r),1);(0===t.code||-1===t.code)&&(g=!1,e.each(v,function(e){e.setRefreshFlag()}),i.setOffline(),r="|stopPublish")}n.error(new Error(r))}function m(e){e.onRun(function(){return w===!0?void e.chain():void t.ajax({url:"//www.google.com/jsapi",data:{key:n.GOOGLE_API_KEY},dataType:"script",timeout:n.AJAX_TIMEOUT}).done(function(){google.load("picker","1",{callback:function(){e.chain()}}),w=!0}).fail(function(t){var n={code:t.status,message:t.statusText};h(n,e)})})}var g=!1,v={},b={},y=!1;l.addListener("onOfflineChanged",function(e){y=e});var x={profile:["https://www.googleapis.com/auth/userinfo.profile"],gdrive:["https://www.googleapis.com/auth/drive.install",s.gdriveFullAccess===!0?"https://www.googleapis.com/auth/drive":"https://www.googleapis.com/auth/drive.file"],blogger:["https://www.googleapis.com/auth/blogger"],picasa:["https://picasaweb.google.com/data/"]};b.refreshGdriveToken=function(e){var t=new c;d(t);var n=v[e];n&&n.setRefreshFlag(),p(t,"gdrive",e),t.enqueue()},b.upload=function(e,t,n,i,a,s,l,u){var m,g=new c;d(g),p(g,"gdrive",l),g.onRun(function(){var s="-------314159265358979323846",c="\r\n--"+s+"\r\n",u="\r\n--"+s+"--";a=a||"text/x-markdown";var d={title:n,mimeType:a};t&&(d.parents=[{kind:"drive#fileLink",id:t}]);var p="/upload/drive/v2/files",v="POST";e&&(p+="/"+e,v="PUT");var b={"Content-Type":'multipart/mixed; boundary="'+s+'"'},y=r.encodeBase64(i),x=[c,"Content-Type: application/json\r\n\r\n",JSON.stringify(d),c,"Content-Type: ",a,"\r\n","Content-Transfer-Encoding: base64\r\n","\r\n",y,u].join("");f(l,function(){var t=gapi.client.request({path:p,method:v,params:{uploadType:"multipart"},headers:b,body:x});t.execute(function(t){if(t&&t.id)return m=t,m.content=i,void g.chain();var n=t.error;void 0!==n&&void 0!==e&&(404===n.code?n='File ID "'+e+'" not found on Google Drive.|removePublish':412===n.code&&(o.removeItem(l+".gdrive.lastChangeId"),n='Conflict on file ID "'+e+'". Please restart the synchronization.')),h(n,g)})})}),g.onSuccess(function(){u(void 0,m)}),g.onError(function(e){u(e)}),g.enqueue()},b.rename=function(e,t,n,i){var r,o=new c;d(o),p(o,"gdrive",n),o.onRun(function(){var i={title:t};f(n,function(){var t=gapi.client.drive.files.patch({fileId:e,resource:i});t.execute(function(t){if(t&&t.id)return r=t,void o.chain();var n=t.error;void 0!==n&&void 0!==e&&404===n.code&&(n='File ID "'+e+'" not found on Google Drive.|removePublish'),h(n,o)})})}),o.onSuccess(function(){i(void 0,r)}),o.onError(function(e){i(e)}),o.enqueue()},b.checkChanges=function(e,t,n){var i=[],r=e||0,o=new c;d(o),p(o,"gdrive",t),o.onRun(function(){function e(){f(t,function(){var t;t=gapi.client.drive.changes.list(void 0===n?{startChangeId:r+1}:{pageToken:n}),t.execute(function(t){return t&&t.largestChangeId?(r=t.largestChangeId,n=t.nextPageToken,void 0!==t.items&&(i=i.concat(t.items)),void(void 0!==n?o.chain(e):o.chain())):void h(t.error,o)})})}var n;o.chain(e)}),o.onSuccess(function(){n(void 0,i,r)}),o.onError(function(e){n(e)}),o.enqueue()},b.downloadMetadata=function(e,i,r,o){var a=[],s=new c;d(s),o||p(s,"gdrive",i),s.onRun(function(){function r(){if(0===e.length)return void s.chain();var o=e[0],l={},c=v[i];c&&c.token&&(l.Authorization="Bearer "+c.token.access_token),t.ajax({url:"https://www.googleapis.com/drive/v2/files/"+o,headers:l,data:{key:n.GOOGLE_API_KEY},dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(t){a.push(t),e.shift(),s.chain(r)}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&(t='File ID "'+o+'" not found on Google Drive.'),h(t,s)})}s.chain(r)}),s.onSuccess(function(){r(void 0,a)}),s.onError(function(e){r(e)}),s.enqueue()},b.downloadContent=function(e,i,r,o){var a=[],s=new c;s.timeout=n.ASYNC_TASK_LONG_TIMEOUT,d(s),o||p(s,"gdrive",i),s.onRun(function(){function r(){if(0===e.length)return void s.chain();var o=e[0];a.push(o);var l;if("drive#file"==o.kind?l=o:"drive#change"==o.kind&&(l=o.file),!l)return e.shift(),void s.chain(r);var c=l.downloadUrl;0===l.mimeType.indexOf("application/vnd.google-apps.drive-sdk")&&(l.isRealtime=!0,c="https://www.googleapis.com/drive/v2/files/"+l.id+"/realtime");var u={},d=v[i];d&&d.token&&(u.Authorization="Bearer "+d.token.access_token),t.ajax({url:c,headers:u,data:{key:n.GOOGLE_API_KEY},dataType:l.isRealtime?"json":"text",timeout:n.AJAX_TIMEOUT}).done(function(t){l.content=l.isRealtime?t.data.value.content.value:t,e.shift(),s.chain(r)}).fail(function(e){var t={code:e.status,message:e.statusText};h(t,s)})}s.chain(r)}),s.onSuccess(function(){r(void 0,a)}),s.onError(function(e){r(e)}),s.enqueue()},b.uploadImg=function(e,i,r,o){var a,s="google.picasa0",l=new c;d(l),p(l,"picasa",s),l.onRun(function(){var o={Slug:e};e.match(/.jpe?g$/i)?o["Content-Type"]="image/jpeg":e.match(/.png$/i)?o["Content-Type"]="image/png":e.match(/.gif$/i)&&(o["Content-Type"]="image/gif");var c=v[s];c&&c.token&&(o.Authorization="Bearer "+c.token.access_token),t.ajax({url:n.PICASA_PROXY_URL+"upload/"+r,headers:o,data:i,processData:!1,dataType:"xml",timeout:n.AJAX_TIMEOUT,type:"POST"}).done(function(e){a=e,l.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};200==t.code&&(t.message=e.responseText),h(t,l)})}),l.onSuccess(function(){o(void 0,a)}),l.onError(function(e){o(e)}),l.enqueue()};var w=!1;return b.picker=function(e,i,o){function a(){void 0!==s&&(s.setVisible(!1),t(".modal-backdrop, .picker").remove())}var s,l=[],u=new c;u.timeout=n.ASYNC_TASK_LONG_TIMEOUT,d(u),"doc"==i||"folder"==i?p(u,"gdrive",o):(o="google.picasa0",p(u,"picasa",o)),m(u),u.onRun(function(){var e=v[o],c=new google.picker.PickerBuilder;c.setAppId(n.GOOGLE_DRIVE_APP_ID);var d;"doc"==i?(d=new google.picker.DocsView(google.picker.ViewId.DOCS),d.setParent("root"),d.setIncludeFolders(!0),d.setMimeTypes(["text/x-markdown","text/plain","application/octet-stream","application/vnd.google-apps.drive-sdk."+n.GOOGLE_DRIVE_APP_ID].join(",")),c.enableFeature(google.picker.Feature.NAV_HIDDEN),c.enableFeature(google.picker.Feature.MULTISELECT_ENABLED),c.addView(d),e&&e.token&&c.setOAuthToken(e.token.access_token)):"folder"==i?(d=new google.picker.DocsView(google.picker.ViewId.FOLDERS),d.setParent("root"),d.setIncludeFolders(!0),d.setSelectFolderEnabled(!0),d.setMimeTypes("application/vnd.google-apps.folder"),c.enableFeature(google.picker.Feature.NAV_HIDDEN),c.addView(d),e&&e.token&&c.setOAuthToken(e.token.access_token)):"img"==i&&(d=new google.picker.PhotosView,d.setType("flat"),c.addView(d),d=new google.picker.PhotosView,d.setType("ofuser"),c.addView(d),c.addView(google.picker.ViewId.PHOTO_UPLOAD),e&&e.token&&c.setOAuthToken(e.token.access_token)),c.setCallback(function(e){(e.action==google.picker.Action.PICKED||e.action==google.picker.Action.CANCEL)&&(e.action==google.picker.Action.PICKED&&(l=e.docs),a(),u.chain())}),s=c.build(),t(r.createBackdrop()).click(function(){a(),u.chain()}),s.setVisible(!0)}),u.onSuccess(function(){e(void 0,l)}),u.onError(function(t){a(),e(t)}),u.enqueue()},b.uploadBlogger=function(e,i,r,o,a,s,l,u,f){var m="google.blogger0",g=new c;d(g),p(g,"blogger",m),g.onRun(function(){function c(){var e="https://www.googleapis.com/blogger/v3/blogs/"+i+"/posts/",a={kind:"blogger#post",blog:{id:i},labels:o,title:l,content:u},s="POST";void 0!==r&&(e+=r,a.id=r,s="PUT"),t.ajax({url:e,data:JSON.stringify(a),headers:f,type:s,contentType:"application/json",dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){r=e.id,g.chain(d)}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&void 0!==r&&(t="Post "+r+" not found on Blogger.|removePublish"),h(t,g)})}function d(){var e="https://www.googleapis.com/blogger/v3/blogs/"+i+"/posts/"+r;a?e+="/revert":(e+="/publish",s&&(e+="?publishDate="+s.toISOString())),t.ajax({url:e,headers:f,type:"POST",dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(){g.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&(t="Post "+r+" not found on Blogger.|removePublish"),h(t,g)})}function p(){return void 0!==i?void g.chain(c):void t.ajax({url:"https://www.googleapis.com/blogger/v3/blogs/byurl",data:{url:e},headers:f,dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){i=e.id,g.chain(c)}).fail(function(t){var n={code:t.status,message:t.statusText};404===n.code&&(n='Blog "'+e+'" not found on Blogger.|removePublish'),h(n,g)})}var f={},b=v[m];b&&b.token&&(f.Authorization="Bearer "+b.token.access_token),g.chain(p)}),g.onSuccess(function(){f(void 0,i,r)}),g.onError(function(e){f(e)}),g.enqueue()},b.uploadBloggerPage=function(e,i,r,o,a,s,l,u){var f="google.blogger0",m=new c;d(m),p(m,"blogger",f),m.onRun(function(){function o(){var e="https://www.googleapis.com/blogger/v3/blogs/"+i+"/pages/",o={kind:"blogger#page",blog:{id:i},title:s,content:l},a="POST";void 0!==r&&(e+=r,o.id=r,a="PUT"),t.ajax({url:e,data:JSON.stringify(o),headers:c,type:a,contentType:"application/json",dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){r=e.id,m.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&void 0!==r&&(t="Page "+r+" not found on Blogger.|removePublish"),h(t,m)})}function a(){return void 0!==i?void m.chain(o):void t.ajax({url:"https://www.googleapis.com/blogger/v3/blogs/byurl",data:{url:e},headers:c,dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){i=e.id,m.chain(o)}).fail(function(t){var n={code:t.status,message:t.statusText};404===n.code&&(n='Blog "'+e+'" not found on Blogger.|removePublish'),h(n,m)})}var c={},u=v[f];u&&u.token&&(c.Authorization="Bearer "+u.token.access_token),m.chain(a)}),m.onSuccess(function(){u(void 0,i,r)}),m.onError(function(e){u(e)}),m.enqueue()},window.delayedFunction=void 0,window.runDelayedFunction=function(){void 0!==window.delayedFunction&&window.delayedFunction()},b}),define("text!html/dialogExportGdrive.html",[],function(){return' \n\n'}),define("text!html/dialogAutoSyncGdrive.html",[],function(){return' \n\n\n'}),define("providers/gdriveProviderBuilder",["jquery","underscore","constants","utils","storage","logger","classes/Provider","settings","eventMgr","fileMgr","editor","helpers/googleHelper","text!html/dialogExportGdrive.html","text!html/dialogAutoSyncGdrive.html"],function(e,t,n,i,r,o,a,s,l,c,u,d,p,f){return function(o,u,h){function m(e){return"sync."+o+"."+e}function g(e,t,n,r,o){o=o||"{}";var a={};return a.provider=y,a.id=e,a.etag=t,a.contentCRC=i.crc32(n),a.titleCRC=i.crc32(r),a.discussionListCRC=i.crc32(o),a.syncIndex=m(e),x===!0&&(a.content=n,a.title=r,a.discussionList=o),a}function v(e){d.downloadMetadata(e,b,function(e,n){e||d.downloadContent(n,b,function(e,n){if(!e){var i,r=[];t.each(n,function(e){var t,n=y.parseContent(e.content);if(e.isRealtime)l.onError("Real time synchronization is not supported anymore. Please use standard synchronization.");else{var o=g(e.id,e.etag,n.content,e.title,n.discussionListJSON);t={},t[o.syncIndex]=o}i=c.createFile(e.title,n.content,n.discussionListJSON,t),r.push(i)}),void 0!==i&&(l.onSyncImportSuccess(r,y),c.selectFile(i))}})})}var b="google.gdrive"+h,y=new a(o,u);y.defaultPublishFormat="template",y.exportPreferencesInputIds=[o+"-parentid"];var x="merge"==s.conflictMode;return y.importFiles=function(){d.picker(function(e,n){if(!e&&0!==n.length){var i=[];t.each(n,function(e){var t=m(e.id),n=c.getFileFromSyncIndex(t);return void 0!==n?void l.onError('"'+n.title+'" was already imported.'):void i.push(e.id)}),v(i)}},"doc",b)},y.exportFile=function(e,t,n,r,a){var s=i.getInputTextValue("#input-sync-export-"+o+"-fileid");if(s){var u=m(s),p=c.getFileFromSyncIndex(u);if(void 0!==p)return l.onError('File ID is already synchronized with "'+p.title+'".'),void a(!0)}var f=i.getInputTextValue("#input-sync-export-"+o+"-parentid");d.upload(s,f,t,n,void 0,void 0,b,function(e,i){if(e)return void a(e);var o=g(i.id,i.etag,n,t,r);a(void 0,o)})},y.syncUp=function(e,t,n,i,r,o,a,s){if(a.contentCRC==t&&a.titleCRC==i&&a.discussionListCRC==o)return s(void 0,!1);if(a.isRealtime){var u=c.getFileFromSyncIndex(a.syncIndex);return u.removeSyncLocation(a),l.onSyncRemoved(u,a),l.onError("Real time synchronization is not supported anymore. Please use standard synchronization.")}var p=y.serializeContent(e,r);d.upload(a.id,void 0,n,p,void 0,a.etag,b,function(l,c){return l?void s(l,!0):(a.etag=c.etag,delete a.isRealtime,x===!0&&(a.content=e,a.title=n,a.discussionList=r),a.contentCRC=t,a.titleCRC=i,a.discussionListCRC=o,void s(void 0,!0))})},y.syncDown=function(e){var n=parseInt(r[b+".gdrive.lastChangeId"],10);d.checkChanges(n,b,function(n,o,a){if(n)return void e(n);var s=[];t.each(o,function(e){var t=m(e.fileId),n=c.getFileFromSyncIndex(t),i=n&&n.syncLocations[t];return i?(e.fileDesc=n,e.syncAttributes=i,e.deleted===!0?void s.push(e):void(i.etag!=e.file.etag&&s.push(e))):void 0}),d.downloadContent(s,b,function(t,n){function o(){if(0===n.length)return r[b+".gdrive.lastChangeId"]=a,e();var t=n.pop(),s=t.fileDesc,c=t.syncAttributes;if(t.deleted===!0)return l.onError('"'+s.title+'" has been removed from '+u+"."),s.removeSyncLocation(c),l.onSyncRemoved(s,c);var d=t.file,p=y.parseContent(d.content),f=p.content,h=d.title,m=p.discussionListJSON,g=p.discussionList,v=y.syncMerge(s,c,f,h,g,m);c.etag=d.etag,o===!0&&(c.content=f,c.title=h,c.discussionList=m),c.contentCRC=v.contentCRC,c.titleCRC=v.titleCRC,c.discussionListCRC=v.discussionListCRC,i.storeAttributes(c),setTimeout(o,5)}return t?void e(t):void setTimeout(o,5)})})},y.publish=function(e,t,n,i,r){var o="markdown"!=e.format?"text/html":void 0;d.upload(e.id,void 0,e.fileName||n,i,o,void 0,b,function(t,n){return t?void r(t):(e.id=n.id,void r())})},y.newPublishAttributes=function(e){var t={};return t.id=i.getInputTextValue("#input-publish-"+o+"-fileid"),t.fileName=i.getInputTextValue("#input-publish-"+o+"-filename"),e.isPropagationStopped()?void 0:t},y.setAutosyncDialogConfig=function(){var e=y.autosyncConfig;i.setInputRadio("radio-autosync-"+o+"-mode",e.mode||"off"),i.setInputValue("#input-autosync-"+o+"-parentid",e.parentId)},y.getAutosyncDialogConfig=function(){var e={};return e.mode=i.getInputRadio("radio-autosync-"+o+"-mode"),e.parentId=i.getInputTextValue("#input-autosync-"+o+"-parentid"),e},y.autosyncFile=function(e,t,n,i,r){var o=i.parentId;d.upload(void 0,o,e,t,void 0,void 0,b,function(i,o){if(i)return void r(i);var a=g(o.id,o.etag,t,e,n);r(void 0,a)})},y.isPublishEnabled=s.gdriveMultiAccount>h,l.addListener("onReady",function(){e(".submenu-sync-"+o).toggle(s.gdriveMultiAccount>h);var a=document.querySelector(".modal-upload-"+o);a&&(a.innerHTML=t.template(p,{providerId:o,providerName:u}));var y=document.querySelector(".modal-autosync-"+o);if(y&&(y.innerHTML=t.template(f,{providerId:o,providerName:u})),e(".action-export-"+o+"-choose-folder").click(function(){d.picker(function(t,n){t||0===n.length||(e(".modal-upload-"+o).modal(),i.setInputValue("#input-sync-export-"+o+"-parentid",n[0].id))},"folder",b)}),e(".action-autosync-"+o+"-choose-folder").click(function(){d.picker(function(t,n){t||0===n.length||(e(".modal-autosync-"+o).modal(),i.setInputValue("#input-autosync-"+o+"-parentid",n[0].id))},"folder",b)}),!(h>=s.gdriveMultiAccount)){var x=i.retrieveIgnoreError(o+".state"),w=r[b+".userId"];if(!(void 0===x||w&&x.userId!=w))if(r.removeItem(o+".state"),"create"==x.action)d.upload(void 0,x.folderId,n.GDRIVE_DEFAULT_FILE_TITLE,s.defaultContent,void 0,void 0,b,function(e,t){if(!e){var n=g(t.id,t.etag,t.content,t.title),i={};i[n.syncIndex]=n;var r=c.createFile(t.title,t.content,void 0,i);c.selectFile(r),l.onMessage('"'+t.title+'" created successfully on '+u+".")}});else if("open"==x.action){var S=[];t.each(x.ids,function(e){var t=m(e),n=c.getFileFromSyncIndex(t);void 0!==n?n!==c.currentFile&&c.selectFile(n):S.push(e)}),v(S)}}}),y}}),define("providers/gdriveProvider",["providers/gdriveProviderBuilder"],function(e){return e("gdrive","Google Drive",0)}),define("providers/gdrivesecProvider",["providers/gdriveProviderBuilder"],function(e){return e("gdrivesec","Google Drive (2nd account)",1)}),define("providers/gdriveterProvider",["providers/gdriveProviderBuilder"],function(e){return e("gdriveter","Google Drive (3rd account)",2)}),define("synchronizer",["jquery","underscore","utils","storage","eventMgr","fileSystem","fileMgr","classes/Provider","providers/dropboxProvider","providers/gdriveProvider","providers/gdrivesecProvider","providers/gdriveterProvider"],function(e,t,n,i,r,o,a,s){function l(e){function i(){function o(){if(0===s.length)return i();var t=s.pop();t.provider.syncUp(c,u,d,p,f,m,t,function(i,r){return r===!0&&(h=!0),i?e(i):(r&&n.storeAttributes(t),void o())})}if(0===r.length)return l(e);var a=r.pop(),s=t.values(a.syncLocations);if(0===s.length)return i();var c=a.content,u=n.crc32(c),d=a.title,p=n.crc32(d),f=a.discussionListJSON,m=n.crc32(f);o()}var r=[];h===!0?(h=!1,r=t.values(o),i()):e()}function c(e){function n(){if(0===i.length)return e();var t=i.pop();return p.hasSync(t)?void t.syncDown(function(t){return t?e(t):void n()}):n()}var i=t.values(f);n()}function u(e){function n(){function o(){if(0===s.length)return n();var t=s.pop();t.autosyncFile(a.title,a.content,a.discussionListJSON,t.autosyncConfig,function(t,n){return t?e(t):(a.addSyncLocation(n),r.onSyncExportSuccess(a,n),void o())})}if(0===i.length)return e();var a=i.pop(),s=t.filter(f,function(e){return"all"==e.autosyncConfig.mode});o()}var i=t.filter(o,function(e){return 0===t.size(e.syncLocations)});n()}function d(i){n.resetModalInputs();var r=n.retrieveIgnoreError(i.providerId+".exportPreferences");r&&t.each(i.exportPreferencesInputIds,function(e){var i=r[e];t.isBoolean(i)?n.setInputChecked("#input-sync-export-"+e,i):n.setInputValue("#input-sync-export-"+e,i)}),e(".modal-upload-"+i.providerId).modal()}var p={},f=t.chain(arguments).map(function(e){return e instanceof s&&[e.providerId,e]}).compact().object().value();!function(){var e={};t.each(o,function(t){n.retrieveIndexArray(t.fileIndex+".sync").forEach(function(o){try{var a=JSON.parse(i[o]);a.syncIndex=o;var s=f[a.provider];if(!s)throw new Error("Invalid provider ID: "+a.provider);a.provider=s,t.syncLocations[o]=a,e[o]=a}catch(l){r.onError(l),n.removeIndexFromArray(t.fileIndex+".sync",o)}})}),Object.keys(i).forEach(function(t){var n=t.match(/sync\.\S+/);n&&!e.hasOwnProperty(n[0])&&i.removeItem(t)})}(),t.each(f,function(e){e.autosyncConfig=n.retrieveIgnoreError(e.providerId+".autosyncConfig")||{}}),p.hasSync=function(e){return t.some(o,function(n){return t.some(n.syncLocations,function(t){return void 0===e||t.provider===e})})};var h=!1,m=!1;r.addListener("onOfflineChanged",function(e){m=e});var g=!1;return p.sync=function(){function e(e){return void 0!==e?(g=!1,r.onSyncRunning(!1),!0):!1}return g===!0||m===!0?!1:(g=!0,r.onSyncRunning(!0),h=!0,u(function(t){e(t)||c(function(t){e(t)||l(function(t){e(t)||(g=!1,r.onSyncRunning(!1),r.onSyncSuccess())})})}),!0)},r.addListener("onFileCreated",function(e){0===t.size(e.syncLocations)&&t.each(f,function(t){"new"==t.autosyncConfig.mode&&t.autosyncFile(e.title,e.content,e.discussionListJSON,t.autosyncConfig,function(t,n){t||(e.addSyncLocation(n),r.onSyncExportSuccess(e,n))})})}),r.addListener("onReady",function(){t.each(f,function(o){e(".action-sync-import-"+o.providerId).click(function(e){o.importFiles(e)}),e(".action-sync-export-dialog-"+o.providerId).click(function(){d(o)}),e(".action-autosync-dialog-"+o.providerId).click(function(){n.resetModalInputs(),o.setAutosyncDialogConfig(o),e(".modal-autosync-"+o.providerId).modal()}),e(".action-sync-export-"+o.providerId).click(function(e){var n=a.currentFile;o.exportFile(e,n.title,n.content,n.discussionListJSON,function(e,t){e||(n.addSyncLocation(t),r.onSyncExportSuccess(n,t))});var s={};t.each(o.exportPreferencesInputIds,function(e){var t=document.getElementById("input-sync-export-"+e);s[e]="checkbox"==t.type?t.checked:t.value}),i[o.providerId+".exportPreferences"]=JSON.stringify(s)}),e(".action-autosync-"+o.providerId).click(function(e){var t=o.getAutosyncDialogConfig(e);void 0!==t&&(i[o.providerId+".autosyncConfig"]=JSON.stringify(t),o.autosyncConfig=t)})})}),r.onSynchronizerCreated(p),p}),define("providers/downloadProvider",["jquery","constants","eventMgr","utils","fileMgr","classes/Provider","classes/AsyncTask"],function(e,t,n,i,r,o,a){var s=new o("download");return s.sharingAttributes=["url"],s.importPublic=function(n,i){var r,o,s=new a(!0);s.onRun(function(){var i=n.url,a=i.lastIndexOf("/");return-1===a?void s.error(new Error("Invalid URL parameter.")):(r=i.substring(a+1),void e.ajax({url:t.DOWNLOAD_PROXY_URL+"download?url="+i,type:"GET",dataType:"text",timeout:t.AJAX_TIMEOUT}).done(function(e){o=e,s.chain()}).fail(function(){s.error(new Error("Unable to access URL "+i))}))}),s.onSuccess(function(){i(void 0,r,o)}),s.onError(function(e){i(e)}),s.enqueue()},n.addListener("onReady",function(){e(".action-import-url").click(function(e){var t=i.getInputTextValue("#input-import-url",e);t&&s.importPublic({url:t},function(e,t,n){if(!e){var i=r.createFile(t,n);r.selectFile(i)}})})}),s}),define("helpers/githubHelper",["jquery","constants","core","utils","storage","logger","settings","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s,l){function c(n){n.onRun(function(){return m===!0?(p=!1,void n.error(new Error("Operation not available in offline mode.|stopPublish"))):p===!0?void n.chain():void e.ajax({url:"libs/github.js",dataType:"script",timeout:t.AJAX_TIMEOUT}).done(function(){p=!0,n.chain()}).fail(function(e){var t={error:e.status,message:e.statusText};d(t,n)})})}function u(n){var o,s;n.onRun(function(){function l(){i.redirectConfirm("You are being redirected to GitHub authorization page.",function(){n.chain(c)},function(){n.error(new Error("Operation canceled."))})}function c(){r.removeItem("githubCode");var e=a.githubFullAccess?"repo,gist":"public_repo,gist";o=i.popupWindow("html/github-oauth-client.html?client_id="+t.GITHUB_CLIENT_ID+"&scope="+e,"stackedit-github-oauth",960,600),o.focus(),s=setInterval(function(){if(o.closed===!0){if(clearInterval(s),o=void 0,s=void 0,h=r.githubCode,void 0===h)return void n.error(new Error(p));r.removeItem("githubCode"),n.chain(u)}},500)}function u(){e.getJSON(t.GATEKEEPER_URL+"authenticate/"+h,function(e){void 0!==e.token?(d=e.token,r.githubToken=d,f=new Github({token:d,auth:"oauth"}),n.chain()):n.error(new Error(p))})}if(void 0!==f)return void n.chain();var d=r.githubToken;if(void 0!==d)return f=new Github({token:d,auth:"oauth"}),void n.chain();var p="Failed to retrieve a token from GitHub.";n.timeout=t.ASYNC_TASK_LONG_TIMEOUT;var h;n.chain(l)}),n.onError(function(){void 0!==s&&clearInterval(s),void 0!==o&&o.close()})}function d(e,t){var i;if(e)if(o.error(e),"string"==typeof e)i=e;else{if(i="Could not publish on GitHub.",401===e.error||403===e.error)return f=void 0,r.removeItem("githubToken"),i="Access to GitHub account is not authorized.",void t.retry(new Error(i),1);e.error<=0&&(p=!1,f=void 0,n.setOffline(),i="|stopPublish")}t.error(new Error(i))}var p,f,h={},m=!1;return s.addListener("onOfflineChanged",function(e){m=e -}),h.upload=function(e,t,n,i,r,o,a){var s=new l;c(s),u(s),s.onRun(function(){function a(){var e=f.getUser();e.show(void 0,function(e,n){return e?void d(e,s):(t=n.login,void s.chain(l))})}function l(){var a=f.getRepo(t,e);a.write(n,i,r,o,function(e){return e?void d(e,s):void s.chain()})}s.chain(t?l:a)}),s.onSuccess(function(){a()}),s.onError(function(e){a(e)}),s.enqueue()},h.uploadGist=function(e,t,n,i,r,o){var a=new l;c(a),u(a),a.onRun(function(){var o=f.getGist(e),s={};s[t]={content:r};var l=o.update;void 0===e&&(l=o.create),l({description:i,"public":n,files:s},function(t,n){return t?(404===t.error&&void 0!==e&&(t="Gist "+e+" not found on GitHub.|removePublish"),void d(t,a)):(e=n.id,void a.chain())})}),a.onSuccess(function(){o(void 0,e)}),a.onError(function(e){o(e)}),a.enqueue()},h.downloadGist=function(e,t,n){var i=new l(!0);c(i);var r,o;i.onRun(function(){var n=new Github({}),a=n.getGist(e);a.read(function(n,a){if(n)return void i.error(new Error("Error trying to access Gist "+e+"."));r=a.description;var s=a.files[t];return void 0===s?void i.error(new Error("Gist "+e+' does not contain "'+t+'".')):(o=s.content,void i.chain())})}),i.onSuccess(function(){n(void 0,r,o)}),i.onError(function(e){n(e)}),i.enqueue()},h}),define("providers/gistProvider",["utils","classes/Provider","helpers/githubHelper"],function(e,t,n){var i=new t("gist","Gist");return i.publishPreferencesInputIds=["gist-public"],i.sharingAttributes=["gistId","filename"],i.publish=function(e,t,i,r,o){n.uploadGist(e.gistId,e.filename,e.isPublic,i,r,function(t,n){return t?void o(t):(e.gistId=n,void o())})},i.newPublishAttributes=function(t){var n={};return n.gistId=e.getInputTextValue("#input-publish-gist-id"),n.filename=e.getInputTextValue("#input-publish-filename",t),n.isPublic=e.getInputChecked("#input-publish-gist-public"),t.isPropagationStopped()?void 0:n},i.importPublic=function(e,t){n.downloadGist(e.gistId,e.filename,t)},i}),define("sharing",["jquery","underscore","constants","utils","eventMgr","fileMgr","classes/AsyncTask","classes/Provider","providers/downloadProvider","providers/gistProvider"],function(e,t,n,i,r,o,a,s){var l={},c=t.chain(arguments).map(function(e){return e instanceof s&&[e.providerId,e]}).compact().object().value(),u=!1;return r.addListener("onOfflineChanged",function(e){u=e}),l.createLink=function(e,i){var r=c[e.provider.providerId];if(void 0!==e.sharingLink||void 0===r||"markdown"!=e.format)return void i();var o=[n.MAIN_URL,"viewer#!provider=",r.providerId];t.each(r.sharingAttributes,function(t){o.push("&"),o.push(t),o.push("="),o.push(encodeURIComponent(e[t]))}),e.sharingLink=o.join(""),i()},r.addListener("onReady",function(){if(window.viewerMode!==!1){var n=i.getURLParameter("provider");void 0===n&&(n="download");var r=c[n];if(void 0!==r){var a={};t.each(r.sharingAttributes,function(e){var t=i.getURLParameter(e);return t?void(a[e]=t):void(a=void 0)}),void 0!==a&&(e("#preview-contents, .navbar .file-title-navbar").hide(),r.importPublic(a,function(t,n,i){if(e("#preview-contents, .navbar .file-title-navbar").show(),!t){var r=o.createFile(n,i,void 0,void 0,!0);o.selectFile(r)}}))}}}),l}),define("providers/bloggerProvider",["underscore","utils","classes/Provider","helpers/googleHelper"],function(e,t,n,i){var r=new n("blogger","Blogger");return r.defaultPublishFormat="html",r.publishPreferencesInputIds=["blogger-url"],r.publish=function(t,n,r,o,a){var s=t.labelList||[];n&&void 0!==n.tags&&(s=n.tags),e.isString(s)&&(s=e.compact(s.split(/[\s,]/)));var l=n&&n.published===!1,c=n&&n.date;i.uploadBlogger(t.blogUrl,t.blogId,t.postId,s,l,c,r,o,function(e,n,i){return e?void a(e):(t.blogId=n,t.postId=i,void a())})},r.newPublishAttributes=function(e){var n={},i=t.getInputTextValue("#input-publish-blogger-url",e);return void 0!==i&&(n.blogUrl=t.checkUrl(i)),n.postId=t.getInputTextValue("#input-publish-postid"),e.isPropagationStopped()?void 0:n},r}),define("providers/bloggerPageProvider",["underscore","utils","classes/Provider","helpers/googleHelper"],function(e,t,n,i){var r=new n("bloggerpage","Blogger Page");return r.defaultPublishFormat="html",r.publishPreferencesInputIds=["blogger-url"],r.publish=function(e,t,n,r,o){var a=t&&t.published===!1,s=t&&t.date;i.uploadBloggerPage(e.blogUrl,e.blogId,e.pageId,a,s,n,r,function(t,n,i){return t?void o(t):(e.blogId=n,e.pageId=i,void o())})},r.newPublishAttributes=function(e){var n={},i=t.getInputTextValue("#input-publish-blogger-url",e);return void 0!==i&&(n.blogUrl=t.checkUrl(i)),n.pageId=t.getInputTextValue("#input-publish-pageid"),e.isPropagationStopped()?void 0:n},r}),define("providers/githubProvider",["utils","classes/Provider","settings","helpers/githubHelper"],function(e,t,n,i){var r=new t("github","GitHub");return r.publishPreferencesInputIds=["github-reponame","github-username","github-branch"],r.publish=function(e,t,r,o,a){var s=n.commitMsg;i.upload(e.repository,e.username,e.branch,e.path,o,s,a)},r.newPublishAttributes=function(t){var n={};return n.repository=e.getInputTextValue("#input-publish-github-reponame",t),n.username=e.getInputTextValue("#input-publish-github-username"),n.branch=e.getInputTextValue("#input-publish-github-branch",t),n.path=e.getInputTextValue("#input-publish-file-path",t),t.isPropagationStopped()?void 0:n},r}),define("helpers/sshHelper",["jquery","constants","core","logger","eventMgr","settings","classes/AsyncTask"],function(e,t,n,i,r,o,a){function s(e){e.onRun(function(){return u===!0?void e.error(new Error("Operation not available in offline mode.|stopPublish")):void e.chain()})}function l(e,t){var r;e&&(i.error(e),"string"==typeof e?r="SSH error: "+e+".":(r="Could not publish on SSH server.",e.code<=0&&(n.setOffline(),r="|stopPublish"))),t.error(new Error(r))}var c={},u=!1;return r.addListener("onOfflineChanged",function(e){u=e}),c.upload=function(n,i,r,c,u,d,p,f){var h=new a;s(h),h.onRun(function(){var a=o.sshProxy+"upload",s={host:n,port:i,username:r,password:c,path:u,title:d,content:p};e.ajax({url:a,data:s,type:"POST",dataType:"json",timeout:t.AJAX_TIMEOUT}).done(function(e){return void 0===e.error?void h.chain():void l(e.error,h)}).fail(function(e){var t={code:e.status,message:e.statusText};l(t,h)})}),h.onSuccess(function(){f()}),h.onError(function(e){f(e)}),h.enqueue()},c}),define("providers/sshProvider",["utils","classes/Provider","helpers/sshHelper"],function(e,t,n){var i=new t("ssh","SSH server");return i.publishPreferencesInputIds=["ssh-host","ssh-port","ssh-username","ssh-password"],i.publish=function(e,t,i,r,o){n.upload(e.host,e.port,e.username,e.password,e.path,i,r,o)},i.newPublishAttributes=function(t){var n={};return n.host=e.getInputTextValue("#input-publish-ssh-host",t,/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),n.port=e.getInputIntValue("#input-publish-ssh-port",void 0,0),n.username=e.getInputTextValue("#input-publish-ssh-username",t),n.password=e.getInputTextValue("#input-publish-ssh-password",t),n.path=e.getInputTextValue("#input-publish-file-path",t),t.isPropagationStopped()?void 0:n},i}),define("helpers/tumblrHelper",["jquery","constants","core","utils","storage","logger","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s){function l(e){e.onRun(function(){return f===!0?void e.error(new Error("Operation not available in offline mode.|stopPublish")):void e.chain()})}function c(n){var o,a;n.onRun(function(){function s(){e.getJSON(t.TUMBLR_PROXY_URL+"request_token",function(e){void 0!==e.oauth_token?(h=e,n.chain(l)):n.error(new Error(f))})}function l(){i.redirectConfirm("You are being redirected to Tumblr authorization page.",function(){n.chain(c)},function(){n.error(new Error("Operation canceled."))})}function c(){r.removeItem("tumblrVerifier"),o=i.popupWindow("html/tumblr-oauth-client.html?oauth_token="+h.oauth_token,"stackedit-tumblr-oauth",800,600),o.focus(),a=setInterval(function(){if(o.closed===!0){if(clearInterval(a),o=void 0,a=void 0,h.oauth_verifier=r.tumblrVerifier,void 0===h.oauth_verifier)return void n.error(new Error(f));r.removeItem("tumblrVerifier"),n.chain(u)}},500)}function u(){e.getJSON(t.TUMBLR_PROXY_URL+"access_token",h,function(e){void 0!==e.access_token&&void 0!==e.access_token_secret?(r.tumblrOauthParams=JSON.stringify(e),d=e,n.chain()):n.error(new Error(f))})}if(void 0!==d)return void n.chain();var p=r.tumblrOauthParams;if(void 0!==p)return d=JSON.parse(p),void n.chain();var f="Failed to retrieve a token from Tumblr.";n.timeout=t.ASYNC_TASK_LONG_TIMEOUT;var h;n.chain(s)}),n.onError(function(){void 0!==a&&clearInterval(a),void 0!==o&&o.close()})}function u(e,t){var i;if(e)if(o.error(e),"string"==typeof e)i=e;else{if(i="Could not publish on Tumblr.",401===e.code||403===e.code)return d=void 0,r.removeItem("tumblrOauthParams"),i="Access to Tumblr account is not authorized.",void t.retry(new Error(i),1);e.code<=0&&(n.setOffline(),i="|stopPublish")}t.error(new Error(i))}var d,p={},f=!1;return a.addListener("onOfflineChanged",function(e){f=e}),p.upload=function(n,i,r,o,a,p,f,h,m){var g=new s;l(g),c(g),g.onRun(function(){var s=e.extend({blog_hostname:n,post_id:i,tags:r,format:o,state:a,date:p,title:f,content:h},d);e.ajax({url:t.TUMBLR_PROXY_URL+"post",data:s,type:"POST",dataType:"json",timeout:t.AJAX_TIMEOUT}).done(function(e){i=e.id,g.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&void 0!==i&&(t="Post "+i+" not found on Tumblr.|removePublish"),u(t,g)})}),g.onSuccess(function(){m(void 0,i)}),g.onError(function(e){m(e)}),g.enqueue()},p}),define("providers/tumblrProvider",["underscore","settings","utils","classes/Provider","helpers/tumblrHelper"],function(e,t,n,i,r){var o=new i("tumblr","Tumblr");return o.publishPreferencesInputIds=["tumblr-hostname"],o.publish=function(n,i,o,a,s){var l=n.tags||[];i&&void 0!==i.tags&&(l=i.tags),e.isString(l)&&(l=e.compact(l.split(/[\s,]/)));var c=function(){if("html"==n.format)return"html";if("template"==n.format){var e=n.customTmpl||t.template;if(-1!==e.indexOf("documentHTML"))return"html"}return"markdown"}(),u=i&&i.published===!1?"draft":"published",d=i&&i.date;r.upload(n.blogHostname,n.postId,l.join(","),c,u,d,o,a,function(e,t){return e?void s(e):(n.postId=t,void s())})},o.newPublishAttributes=function(e){var t={};return t.blogHostname=n.getInputTextValue("#input-publish-tumblr-hostname",e,/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),t.postId=n.getInputTextValue("#input-publish-postid"),e.isPropagationStopped()?void 0:t},o}),define("helpers/wordpressHelper",["jquery","constants","core","utils","storage","logger","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s){function l(e){e.onRun(function(){return f===!0?void e.error(new Error("Operation not available in offline mode.|stopPublish")):void e.chain()})}function c(n){var o,a;n.onRun(function(){function s(){i.redirectConfirm("You are being redirected to WordPress authorization page.",function(){n.chain(l)},function(){n.error(new Error("Operation canceled."))})}function l(){r.removeItem("wordpressCode"),o=i.popupWindow("html/wordpress-oauth-client.html?client_id="+t.WORDPRESS_CLIENT_ID,"stackedit-wordpress-oauth",960,600),o.focus(),a=setInterval(function(){if(o.closed===!0){if(clearInterval(a),o=void 0,a=void 0,p=r.wordpressCode,void 0===p)return void n.error(new Error(u));r.removeItem("wordpressCode"),n.chain(c)}},500)}function c(){e.getJSON(t.WORDPRESS_PROXY_URL+"authenticate/"+p,function(e){void 0!==e.token?(d=e.token,r.wordpressToken=d,n.chain()):n.error(new Error(u))})}if(d=r.wordpressToken,void 0!==d)return void n.chain();var u="Failed to retrieve a token from Wordpress.";n.timeout=t.ASYNC_TASK_LONG_TIMEOUT;var p;n.chain(s)}),n.onError(function(){void 0!==a&&clearInterval(a),void 0!==o&&o.close()})}function u(e,t){var i;if(e)if(o.error(e),"string"==typeof e)i=e;else{if(i="Could not publish on WordPress.",400===e.code&&"invalid_token"==e.message||401===e.code||403===e.code)return r.removeItem("wordpressToken"),i="Access to WordPress account is not authorized.",void t.retry(new Error(i),1);e.code<=0&&(n.setOffline(),i="|stopPublish")}t.error(new Error(i))}var d,p={},f=!1;return a.addListener("onOfflineChanged",function(e){f=e}),p.upload=function(n,i,r,o,a,p,f,h){var m=new s;l(m),c(m),m.onRun(function(){var s=t.WORDPRESS_PROXY_URL+"post",l={token:d,site:n,postId:i,tags:r,status:o,date:a,title:p,content:f};e.ajax({url:s,data:l,type:"POST",dataType:"json",timeout:t.AJAX_TIMEOUT}).done(function(e){if(e.body.ID)return i=e.body.ID,void m.chain();var t={code:e.code,message:e.body.error};404===t.code&&("unknown_blog"==t.message?t='Site "'+n+'" not found on WordPress.|removePublish':"unknown_post"==t.message&&(t="Post "+i+" not found on WordPress.|removePublish")),u(t,m)}).fail(function(e){var t={code:e.status,message:e.statusText};u(t,m)})}),m.onSuccess(function(){h(void 0,i)}),m.onError(function(e){h(e)}),m.enqueue()},p}),define("providers/wordpressProvider",["underscore","utils","classes/Provider","helpers/wordpressHelper"],function(e,t,n,i){var r=new n("wordpress","WordPress");return r.defaultPublishFormat="html",r.publishPreferencesInputIds=["wordpress-site"],r.publish=function(t,n,r,o,a){var s=t.tags||[];n&&void 0!==n.tags&&(s=n.tags);var l=n&&n.published===!1?"draft":"publish",c=n&&n.date;e.isString(s)&&(s=e.compact(s.split(/[\s,]/))),i.upload(t.site,t.postId,s.join(","),l,c,r,o,function(e,n){return e?void a(e):(t.postId=n,void a())})},r.newPublishAttributes=function(e){var n={};return n.site=t.getInputTextValue("#input-publish-wordpress-site",e,/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),n.postId=t.getInputTextValue("#input-publish-postid"),e.isPropagationStopped()?void 0:n},r}),define("publisher",["jquery","underscore","constants","utils","storage","settings","eventMgr","fileSystem","fileMgr","sharing","classes/Provider","classes/AsyncTask","providers/bloggerProvider","providers/bloggerPageProvider","providers/dropboxProvider","providers/gistProvider","providers/githubProvider","providers/gdriveProvider","providers/gdrivesecProvider","providers/gdriveterProvider","providers/sshProvider","providers/tumblrProvider","providers/wordpressProvider"],function(e,t,n,i,r,o,a,s,l,c,u,d){function p(e,t,n){return void 0===t.format&&(t.format=i.getInputRadio("radio-publish-format"),"template"==t.format&&i.getInputChecked("#checkbox-publish-custom-template")&&(t.customTmpl=i.getInputValue("#textarea-publish-custom-template"))),"markdown"==t.format?e.content:"html"==t.format?n.withoutComments:v.applyTemplate(e,t,n)}function f(e,t){if(0===S.length)return void e(t);var n=S.pop(),i=p(y,n,x),r=(y.frontMatter||{}).title||y.title;n.provider.publish(n,y.frontMatter,r,i,function(i){if(void 0!==i){var r=i.toString();if(-1!==r.indexOf("|removePublish")&&(y.removePublishLocation(n),a.onPublishRemoved(y,n)),-1!==r.indexOf("|stopPublish"))return void e(i)}f(e,t||i)})}function h(e,n){var o;do o="publish."+i.randomString();while(t.has(r,o));n.publishIndex=o,e.addPublishLocation(n),a.onNewPublishSuccess(e,n)}function m(n){var r=n.defaultPublishFormat||"markdown";E=n,e(".publish-provider-name").text(n.providerName),e('.modal-publish [class*=" modal-publish-"]').hide().filter(".modal-publish-"+n.providerId).show(),i.resetModalInputs(),i.setInputRadio("radio-publish-format",r),i.setInputChecked("#checkbox-publish-custom-template",!1),i.setInputValue("#textarea-publish-custom-template",o.template);var a=i.retrieveIgnoreError(n.providerId+".publishPreferences");a&&(t.each(n.publishPreferencesInputIds,function(e){var n=a[e];t.isBoolean(n)?i.setInputChecked("#input-publish-"+e,n):i.setInputValue("#input-publish-"+e,n)}),i.setInputRadio("radio-publish-format",a.format),i.setInputChecked("#checkbox-publish-custom-template",void 0!==a.customTmpl),i.setInputValue("#textarea-publish-custom-template",a.customTmpl||o.template)),e(".modal-publish").modal()}function g(e){var n=E,i=n.newPublishAttributes(e);if(void 0!==i){var o=l.currentFile,a=p(o,i,w),s=o.frontMatter&&o.frontMatter.title||o.title;n.publish(i,o.frontMatter,s,a,function(e){void 0===e&&(i.provider=n,c.createLink(i,function(){h(o,i)}))});var u={};t.each(n.publishPreferencesInputIds,function(e){var t=document.getElementById("input-publish-"+e);u[e]="checkbox"==t.type?t.checked:t.value}),u.format=i.format,u.customTmpl=i.customTmpl,r[n.providerId+".publishPreferences"]=JSON.stringify(u)}}var v={},b=t.chain(arguments).map(function(e){return e instanceof u&&e.isPublishEnabled===!0&&[e.providerId,e]}).compact().object().value();!function(){var e={};t.each(s,function(t){i.retrieveIndexArray(t.fileIndex+".publish").forEach(function(n){try{var o=JSON.parse(r[n]);o.publishIndex=n;var s=b[o.provider];if(!s)throw new Error("Invalid provider ID: "+o.provider);o.provider=s,t.publishLocations[n]=o,e[n]=o}catch(l){a.onError(l),i.removeIndexFromArray(t.fileIndex+".publish",n)}})}),Object.keys(r).forEach(function(t){var n=t.match(/publish\.\S+/);n&&!e.hasOwnProperty(n[0])&&r.removeItem(t)})}(),v.applyTemplate=function(e,n,i){try{var r=n&&n.customTmpl||o.template;return t.template(r,{documentTitle:e.title,documentMarkdown:e.content,strippedDocumentMarkdown:e.content.substring(e.frontMatter?e.frontMatter._frontMatter.length:0),documentHTML:i.withoutComments,documentHTMLWithComments:i.withComments,frontMatter:e.frontMatter,publishAttributes:n})}catch(s){return a.onError(s),s.message}};var y,x,w,S=[];a.addListener("onPreviewFinished",function(e,t){w={withComments:e,withoutComments:t}});var C=!1;a.addListener("onOfflineChanged",function(e){C=e});var T=!1;v.publish=function(){T!==!0&&C!==!0&&(T=!0,a.onPublishRunning(!0),y=l.currentFile,x=w,S=t.values(y.publishLocations),f(function(e){T=!1,a.onPublishRunning(!1),void 0===e&&a.onPublishSuccess(y)}))};var E,k=[" \n",' ',' <%= provider.providerName %>'," "," "].join("");return a.addListener("onReady",function(){if(window.viewerMode===!1){var r=document.querySelector(".menu-panel .publish-on-provider-list"),s=t.reduce(b,function(e,n){return e+t.template(k,{provider:n})},"");r.innerHTML=s,t.each(b,function(t){e(r.querySelector(".action-init-publish-"+t.providerId)).click(function(){m(t)}),e(".action-publish-"+t.providerId).click(function(){m(t)})})}e(".action-process-publish").click(g);var c=e(".publish-custom-template-collapse").collapse({toggle:!1}),u=e("#textarea-publish-custom-template"),p=t.debounce(function(){c.collapse("template"==i.getInputRadio("radio-publish-format")?"show":"hide")},100);e("#checkbox-publish-custom-template").change(function(){u.prop("disabled",!this.checked)}),e("input:radio[name=radio-publish-format]").change(function(){p()}),e(".modal-publish").on("hidden.bs.modal",function(){c.collapse("hide")}),e(".action-download-md").click(function(){var e=l.currentFile.content,t=l.currentFile.title;i.saveAs(e,t+".md")}),e(".action-download-html").click(function(){var e=l.currentFile.title;i.saveAs(w.withoutComments,e+".html")}),e(".action-download-template").click(function(){var e=l.currentFile,t=v.applyTemplate(e,void 0,w);i.saveAs(t,e.title+(-1===o.template.indexOf("documentHTML")?".md":".html"))}),e(".action-download-pdf").click(function(){var e,t=l.currentFile,r=v.applyTemplate(t,{customTmpl:o.pdfTemplate},w),s=new d;s.onRun(function(){if(C===!0)return a.onError("Operation not available in offline mode."),void s.chain();var t=new XMLHttpRequest;t.open("POST",n.HTMLTOPDF_URL,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.setRequestHeader("page-size",o.pdfPageSize),t.responseType="blob",t.onreadystatechange=function(){4==this.readyState&&(200==this.status?e=this.response:a.onError("Error when trying to generate PDF: "+this.status),s.chain())},t.send(r)}),s.onSuccess(function(){void 0!==e&&i.saveAs(e,l.currentFile.title+".pdf")}),s.enqueue()})}),a.onPublisherCreated(v),v}),define("providers/gplusProvider",["jquery","underscore","utils","storage","classes/Provider","eventMgr","helpers/googleHelper"],function(e,t,n,i,r,o,a){function s(e,n){var i;return t.find(e.thumbnails,function(e){var t=!1;return e.url.replace(/^(.*[\/=]s)\d.*?(\/[^\/]+)?$/,function(e,r,o){i=r+n+(o||""),t=!0}),t}),i}function l(){return c.thumbnails?(n.resetModalInputs(),e(".modal-import-image img").prop("src",s(c,128)),n.setInputValue("#input-import-image-title",c.name),f&&n.setInputValue("#input-import-image-size",f.size),void e(".modal-import-image").modal()):(o.onError("Image "+c.name+" is not accessible."),void u(!0))}var c,u,d="gplus",p=new r(d,"Google+"),f=n.retrieveIgnoreError(d+".importImagePreferences");return p.importImage=function(e){u=e,a.picker(function(t,n){return t||0===n.length?void e(t):(c=n[0],void l())},"img")},p.uploadImage=function(t,n,i){u=i,a.uploadImg(t,n,"default",function(n,r){return n||!r?void i(n):(c={name:t,thumbnails:[]},e(r).find("thumbnail").each(function(){c.thumbnails.push({url:e(this).attr("url")})}),void l())})},o.addListener("onReady",function(){e(".action-import-image").click(function(){var e=n.getInputIntValue("#input-import-image-size",void 0,0)||0,t=n.getInputTextValue("#input-import-image-title"),r=s(c,e);t&&(r+=' "'+t+'"'),u(void 0,r),f={},e&&(f.size=e),i[d+".importImagePreferences"]=JSON.stringify(f)})}),p}),define("mediaImporter",["jquery","underscore","constants","classes/Provider","core","eventMgr","providers/gplusProvider"],function(e,t,n,i,r,o){var a={},s=t.chain(arguments).map(function(e){return e instanceof i&&[e.providerId,e]}).compact().object().value();return o.addListener("onReady",function(){function i(i){var o=(i.dataTransfer||i.target).files,a=t.first(o);if(a.name.match(/.(jpe?g|png|gif)$/i)){i.stopPropagation(),i.preventDefault();var l=new FileReader;l.onload=function(t){return function(n){var i=new Uint8Array(n.target.result);s.gplus.uploadImage(t.name,i,function(t,n){if(!t){r.catchModal=!0,e("#wmd-image-button").click(),r.catchModal=!1;var i=r.insertLinkCallback;r.insertLinkCallback=void 0,i(n||null)}})}}(a);var c=a.slice(0,n.IMPORT_IMG_MAX_CONTENT_SIZE);l.readAsArrayBuffer(c)}}function o(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"}t.each(s,function(t){e(".action-import-image-"+t.providerId).click(function(){var e=r.insertLinkCallback;r.insertLinkCallback=void 0,t.importImage(function(t,n){return t?void e(null):void e(n||null)})})}),e("#wmd-input").each(function(){this.addEventListener("dragover",o,!1),this.addEventListener("drop",i,!1)})}),a}),define("css/css",[],function(){if("undefined"==typeof window)return{load:function(e,t,n){n()}};var e=document.getElementsByTagName("head")[0],t=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)/)||0,n=!1,i=!0;t[1]||t[7]?n=parseInt(t[1])<6||parseInt(t[7])<=9:t[2]?i=!1:t[4]&&(n=parseInt(t[4])<18);var r={};r.pluginBuilder="./css-builder";var o,a=function(){o=document.createElement("style"),e.appendChild(o)},s=function(e,t){a();var n=o.styleSheet||o.sheet;if(n&&n.addImport)n.addImport(e),o.onload=t;else{o.textContent='@import "'+e+'";';var i=setInterval(function(){try{o.sheet.cssRules,clearInterval(i),t()}catch(e){}},10)}},l=function(t,n){var r=document.createElement("link");if(r.type="text/css",r.rel="stylesheet",i)r.onload=function(){r.onload=function(){},setTimeout(n,7)};else var o=setInterval(function(){for(var e=0;eo;++o)if(n=e.attributes[o],r=n.name,"class"!=r){if(i=t.attributes.getNamedItem(r),n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function p(e,t){for(var n,i=0,r=e.attributes.length;r>i;++i)if(n=e.attributes[i].name,(!t||!k.arrayContains(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}function f(e,t){for(var n in t)if(t.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0}function h(e){var t;return e&&1==e.nodeType&&((t=e.parentNode)&&9==t.nodeType&&"on"==t.designMode||D(e)&&!D(e.parentNode))}function m(e){return(D(e)||1!=e.nodeType&&D(e.parentNode))&&!h(e)}function g(e){return e&&1==e.nodeType&&!N.test(E(e,"display"))}function v(e){if(0==e.data.length)return!0;if(L.test(e.data))return!1;var t=E(e.parentNode,"whiteSpace");switch(t){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(e.data))return!1}return g(e.previousSibling)||g(e.nextSibling)}function b(e,t){return k.isCharacterDataNode(e)?0==t?!!e.previousSibling:t==e.length?!!e.nextSibling:!0:t>0&&t a;++a)"*"==i[a]?this.applyToAnyTagName=!0:this.tagNames.push(i[a].toLowerCase());else this.tagNames=[this.elementTagName]}function T(e,t,n){return new C(e,t,n)}e.requireModules(["WrappedSelection","WrappedRange"]);var E,k=e.dom,_="span",I=function(){function e(e,t,n){return t&&n?" ":""}return function(t,n){t.className&&(t.className=t.className.replace(new RegExp("(?:^|\\s)"+n+"(?:\\s|$)"),e))}}();"undefined"!=typeof window.getComputedStyle?E=function(e,t){return k.getWindow(e).getComputedStyle(e,null)[t]}:"undefined"!=typeof document.documentElement.currentStyle?E=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found");var D;!function(){var e=document.createElement("div");D="boolean"==typeof e.isContentEditable?function(e){return e&&1==e.nodeType&&e.isContentEditable}:function(e){return e&&1==e.nodeType&&"false"!=e.contentEditable?"true"==e.contentEditable||D(e.parentNode):!1}}();var N=/^inline(-block|-table)?$/i,L=/[^\r\n\t\f \u200B]/,M=w(!1),A=w(!0);S.prototype={doMerge:function(){for(var e,t,n,i=[],r=0,o=this.textNodes.length;o>r;++r)e=this.textNodes[r],t=e.parentNode,i[r]=e.data,r&&(t.removeChild(e),t.hasChildNodes()||t.parentNode.removeChild(t));return this.firstTextNode.data=n=i.join(""),n},getLength:function(){for(var e=this.textNodes.length,t=0;e--;)t+=this.textNodes[e].length;return t},toString:function(){for(var e=[],t=0,n=this.textNodes.length;n>t;++t)e[t]="'"+this.textNodes[t].data+"'";return"[Merge("+e.join(",")+")]"}};var R=["elementTagName","ignoreWhiteSpace","applyToEditableOnly"],P={"class":"className"};C.prototype={elementTagName:_,elementProperties:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,hasClass:function(e){return 1==e.nodeType&&k.arrayContains(this.tagNames,e.tagName.toLowerCase())&&i(e,this.cssClass)},getSelfOrAncestorWithClass:function(e){for(;e;){if(this.hasClass(e,this.cssClass))return e;e=e.parentNode}return null},isModifiable:function(e){return!this.applyToEditableOnly||m(e)},isIgnorableWhiteSpaceNode:function(e){return this.ignoreWhiteSpace&&e&&3==e.nodeType&&v(e)},postApply:function(e,t,n){for(var i,r,o,a=e[0],s=e[e.length-1],l=[],c=a,u=s,d=0,p=s.length,f=0,h=e.length;h>f;++f)r=e[f],o=M(r,!n),o?(i||(i=new S(o),l.push(i)),i.textNodes.push(r),r===a&&(c=i.firstTextNode,d=c.length),r===s&&(u=i.firstTextNode,p=i.getLength())):i=null;var m=A(s,!n);if(m&&(i||(i=new S(s),l.push(i)),i.textNodes.push(m)),l.length){for(f=0,h=l.length;h>f;++f)l[f].doMerge();t.setStart(c,d),t.setEnd(u,p)}},createContainer:function(t){var n=t.createElement(this.elementTagName);return e.util.extend(n,this.elementProperties),r(n,this.cssClass),n},applyToTextNode:function(e){var t=e.parentNode;if(1==t.childNodes.length&&k.arrayContains(this.tagNames,t.tagName.toLowerCase()))r(t,this.cssClass);else{var n=this.createContainer(k.getDocument(e));e.parentNode.insertBefore(n,e),n.appendChild(e)}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&a(e)==this.elementSortedClassName&&f(e,this.elementProperties)&&!p(e,this.attrExceptions)&&this.isModifiable(e)},undoToTextNode:function(e,t,n){if(!t.containsNode(n)){var i=t.cloneRange();i.selectNode(n),i.isPointInRange(t.endContainer,t.endOffset)&&(y(n,t.endContainer,t.endOffset,[t]),t.setEndAfter(n)),i.isPointInRange(t.startContainer,t.startOffset)&&(n=y(n,t.startContainer,t.startOffset,[t]))}this.isRemovable(n)?l(n):I(n,this.cssClass)},applyToRange:function(e){e.splitBoundaries();var t=u(e);if(t.length){for(var n,i=0,r=t.length;r>i;++i)n=t[i],this.isIgnorableWhiteSpaceNode(n)||this.getSelfOrAncestorWithClass(n)||!this.isModifiable(n)||this.applyToTextNode(n);e.setStart(t[0],0),n=t[t.length-1],e.setEnd(n,n.length),this.normalize&&this.postApply(t,e,!1)}},applyToSelection:function(t){t=t||window;var n,i=e.getSelection(t),r=i.getAllRanges();i.removeAllRanges();for(var o=r.length;o--;)n=r[o],this.applyToRange(n),i.addRange(n)},undoToRange:function(e){e.splitBoundaries();var t,n,i=u(e),r=i[i.length-1];if(i.length){for(var o=0,a=i.length;a>o;++o)t=i[o],n=this.getSelfOrAncestorWithClass(t),n&&this.isModifiable(t)&&this.undoToTextNode(t,e,n),e.setStart(i[0],0),e.setEnd(r,r.length);this.normalize&&this.postApply(i,e,!0)}},undoToSelection:function(t){t=t||window;var n,i=e.getSelection(t),r=i.getAllRanges();i.removeAllRanges();for(var o=0,a=r.length;a>o;++o)n=r[o],this.undoToRange(n),i.addRange(n)},getTextSelectedByRange:function(e,t){var n=t.cloneRange(); -n.selectNodeContents(e);var i=n.intersection(t),r=i?i.toString():"";return n.detach(),r},isAppliedToRange:function(e){if(e.collapsed)return!!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);for(var t,n=e.getNodes([3]),i=0;t=n[i++];)if(!this.isIgnorableWhiteSpaceNode(t)&&c(e,t)&&this.isModifiable(t)&&!this.getSelfOrAncestorWithClass(t))return!1;return!0},isAppliedToSelection:function(t){t=t||window;for(var n=e.getSelection(t),i=n.getAllRanges(),r=i.length;r--;)if(!this.isAppliedToRange(i[r]))return!1;return!0},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},detach:function(){}},C.util={hasClass:i,addClass:r,removeClass:I,hasSameClasses:s,replaceWithOwnChildren:l,elementsHaveSameNonClassAttributes:d,elementHasNonClassAttributes:p,splitNodeAt:y,isEditableElement:D,isEditingHost:h,isEditable:m},e.CssClassApplier=C,e.createCssClassApplier=T}),define("rangy-cssclassapplier",function(){}),requirejs.config({waitSeconds:0,packages:[{name:"css",location:"bower-libs/require-css",main:"css"},{name:"less",location:"bower-libs/require-less",main:"less"}],paths:{jquery:"bower-libs/jquery/jquery",underscore:"bower-libs/underscore/underscore",crel:"bower-libs/crel/crel",jgrowl:"bower-libs/jgrowl/jquery.jgrowl",mousetrap:"bower-libs/mousetrap/mousetrap","mousetrap-record":"bower-libs/mousetrap/plugins/record/mousetrap-record",toMarkdown:"bower-libs/to-markdown/src/to-markdown",text:"bower-libs/requirejs-text/text",mathjax:"../libs/MathJax/MathJax.js?config=TeX-AMS_HTML",bootstrap:"bower-libs/bootstrap/dist/js/bootstrap",requirejs:"bower-libs/requirejs/require","google-code-prettify":"bower-libs/google-code-prettify/src/prettify",highlightjs:"libs/highlight/highlight.pack","jquery-waitforimages":"bower-libs/waitForImages/src/jquery.waitforimages","jquery-ui":"bower-libs/jquery-ui/ui/jquery-ui","jquery-ui-core":"bower-libs/jquery-ui/ui/jquery.ui.core","jquery-ui-widget":"bower-libs/jquery-ui/ui/jquery.ui.widget","jquery-ui-mouse":"bower-libs/jquery-ui/ui/jquery.ui.mouse","jquery-ui-draggable":"bower-libs/jquery-ui/ui/jquery.ui.draggable","jquery-ui-effect":"bower-libs/jquery-ui/ui/jquery.ui.effect","jquery-ui-effect-slide":"bower-libs/jquery-ui/ui/jquery.ui.effect-slide",FileSaver:"bower-libs/FileSaver/FileSaver",stacktrace:"bower-libs/stacktrace/stacktrace","requirejs-text":"bower-libs/requirejs-text/text","bootstrap-tour":"bower-libs/bootstrap-tour/build/js/bootstrap-tour",css_browser_selector:"bower-libs/css_browser_selector/css_browser_selector","pagedown-extra":"bower-libs/pagedown-extra/Markdown.Extra",pagedown:"libs/Markdown.Editor","require-css":"bower-libs/require-css/css",xregexp:"bower-libs/xregexp/xregexp-all",yaml:"bower-libs/yaml.js","yaml.js":"bower-libs/yaml.js","yaml-js":"bower-libs/yaml.js/bin/yaml",css:"bower-libs/require-css/css","css-builder":"bower-libs/require-css/css-builder",normalize:"bower-libs/require-css/normalize",prism:"bower-libs/prism/prism","prism-core":"bower-libs/prism/components/prism-core",MutationObservers:"bower-libs/MutationObservers/MutationObserver",WeakMap:"bower-libs/WeakMap/weakmap",rangy:"bower-libs/rangy/rangy-core","rangy-cssclassapplier":"bower-libs/rangy/rangy-cssclassapplier",diff_match_patch:"bower-libs/google-diff-match-patch-js/diff_match_patch",diff_match_patch_uncompressed:"bower-libs/google-diff-match-patch-js/diff_match_patch_uncompressed",jsondiffpatch:"bower-libs/jsondiffpatch/build/bundle",hammerjs:"bower-libs/hammerjs/hammer"},shim:{underscore:{exports:"_"},mathjax:["libs/mathjax_init"],jgrowl:{deps:["jquery"],exports:"jQuery.jGrowl"},diff_match_patch_uncompressed:{exports:"diff_match_patch"},jsondiffpatch:["diff_match_patch_uncompressed"],rangy:{exports:"rangy"},"rangy-cssclassapplier":["rangy"],mousetrap:{exports:"Mousetrap"},"yaml-js":{exports:"YAML"},"prism-core":{exports:"Prism"},"bower-libs/prism/components/prism-markup":["prism-core"],"libs/prism-latex":["prism-core"],"libs/prism-markdown":["bower-libs/prism/components/prism-markup","libs/prism-latex"],"bootstrap-record":["mousetrap"],toMarkdown:{deps:["jquery"],exports:"toMarkdown"},stacktrace:{exports:"printStackTrace"},FileSaver:{exports:"saveAs"},MutationObservers:["WeakMap"],highlightjs:{exports:"hljs"},"bootstrap-tour":{deps:["bootstrap"],exports:"Tour"},bootstrap:["jquery"],"jquery-waitforimages":["jquery"],uilayout:["jquery-ui-effect-slide"],"jquery-ui-effect-slide":["jquery-ui-effect"],"jquery-ui-effect":["jquery-ui-draggable"],"jquery-ui-draggable":["jquery-ui-mouse"],"jquery-ui-mouse":["jquery-ui-widget"],"jquery-ui-widget":["jquery-ui-core"],"jquery-ui-core":["jquery"],pagedown:["libs/Markdown.Converter"],"pagedown-extra":["libs/Markdown.Converter"]}});try{var test="seLocalStorageCheck";localStorage.setItem(test,test),localStorage.removeItem(test);var obj={};Object.defineProperty(obj,"prop",{get:function(){},set:function(){}})}catch(e){throw alert("Your browser is not supported, sorry!"),e}window.viewerMode=/(^| )viewer($| )/.test(document.body.className),window.theme=localStorage.themeV3||"default";var themeModule="less!themes/"+window.theme;-1!==window.baseDir.indexOf("-min")&&(themeModule="css!themes/"+window.theme),require(["jquery","rangy","core","eventMgr","synchronizer","publisher","mediaImporter","css","rangy-cssclassapplier",themeModule],function(e,t,n,i){window.noStart||e(function(){t.init(),n.onReady(),window.applicationCache&&window.applicationCache.addEventListener("updateready",function(){window.applicationCache.status===window.applicationCache.UPDATEREADY&&(window.applicationCache.swapCache(),i.onMessage("New version available!\nJust refresh the page to upgrade."))},!1)})}),define("main",function(){}); \ No newline at end of file +}),hljs.registerLanguage("vhdl",function(e){return{cI:!0,k:{keyword:"abs access after alias all and architecture array assert attribute begin block body buffer bus case component configuration constant context cover disconnect downto default else elsif end entity exit fairness file for force function generate generic group guarded if impure in inertial inout is label library linkage literal loop map mod nand new next nor not null of on open or others out package port postponed procedure process property protected pure range record register reject release rem report restrict restrict_guarantee return rol ror select sequence severity shared signal sla sll sra srl strong subtype then to transport type unaffected units until use variable vmode vprop vunit wait when while with xnor xor",typename:"boolean bit character severity_level integer time delay_length natural positive string bit_vector file_open_kind file_open_status std_ulogic std_ulogic_vector std_logic std_logic_vector unsigned signed boolean_vector integer_vector real_vector time_vector"},i:"{",c:[e.CBLCLM,{cN:"comment",b:"--",e:"$"},e.QSM,e.CNM,{cN:"literal",b:"'(U|X|0|1|Z|W|L|H|-)'",c:[e.BE]},{cN:"attribute",b:"'[A-Za-z](_?[A-Za-z0-9])*",c:[e.BE]}]}}),hljs.registerLanguage("coffeescript",function(e){var t={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module exports global window document"},n="[A-Za-z$_][0-9A-Za-z$_]*",i=e.inherit(e.TM,{b:n}),r={cN:"subst",b:/#\{/,e:/}/,k:t},o=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,r]},{b:/"/,e:/"/,c:[e.BE,r]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[r,e.HCM]},{b:"//[gim]*",r:0},{b:"/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)"}]},{cN:"property",b:"@"+n},{b:"`",e:"`",eB:!0,eE:!0,sL:"javascript"}];return r.c=o,{k:t,c:o.concat([{cN:"comment",b:"###",e:"###"},e.HCM,{cN:"function",b:"("+n+"\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>",e:"[-=]>",rB:!0,c:[i,{cN:"params",b:"\\(",rB:!0,c:[{b:/\(/,e:/\)/,k:t,c:["self"].concat(o)}]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{cN:"attribute",b:n+":",e:":",rB:!0,eE:!0,r:0}])}}),hljs.registerLanguage("mizar",function(){return{k:["environ vocabularies notations constructors definitions registrations theorems schemes requirements","begin end definition registration cluster existence pred func defpred deffunc theorem proof","let take assume then thus hence ex for st holds consider reconsider such that and in provided of as from","be being by means equals implies iff redefine define now not or attr is mode suppose per cases set","thesis contradiction scheme reserve struct","correctness compatibility coherence symmetry assymetry reflexivity irreflexivity","connectedness uniqueness commutativity idempotence involutiveness projectivity"].join(" "),c:[{cN:"comment",b:"::",e:"$"}]}}),hljs.registerLanguage("nginx",function(e){var t={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},n={eW:!0,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,t],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0},{cN:"regexp",c:[e.BE,t],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},t]};return{c:[e.HCM,{b:e.UIR+"\\s",e:";|{",rB:!0,c:[e.inherit(e.UTM,{starts:n})],r:0}],i:"[^\\s\\}]"}}),hljs.registerLanguage("erlang-repl",function(e){return{k:{special_functions:"spawn spawn_link self",reserved:"after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse|10 query receive rem try when xor"},c:[{cN:"prompt",b:"^[0-9]+> ",r:10},{cN:"comment",b:"%",e:"$"},{cN:"number",b:"\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)",r:0},e.ASM,e.QSM,{cN:"constant",b:"\\?(::)?([A-Z]\\w*(::)?)+"},{cN:"arrow",b:"->"},{cN:"ok",b:"ok"},{cN:"exclamation_mark",b:"!"},{cN:"function_or_atom",b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{cN:"variable",b:"[A-Z][a-zA-Z0-9_']*",r:0}]}}),hljs.registerLanguage("r",function(e){var t="([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*";return{c:[e.HCM,{b:t,l:t,k:{keyword:"function if in break next repeat else for return switch while try tryCatch|10 stop warning require library attach detach source setMethod setGeneric setGroupGeneric setClass ...|10",literal:"NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10"},r:0},{cN:"number",b:"0[xX][0-9a-fA-F]+[Li]?\\b",r:0},{cN:"number",b:"\\d+(?:[eE][+\\-]?\\d*)?L\\b",r:0},{cN:"number",b:"\\d+\\.(?!\\d)(?:i\\b)?",r:0},{cN:"number",b:"\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{cN:"number",b:"\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b",r:0},{b:"`",e:"`",r:0},{cN:"string",c:[e.BE],v:[{b:'"',e:'"'},{b:"'",e:"'"}]}]}}),hljs.registerLanguage("json",function(e){var t={literal:"true false null"},n=[e.QSM,e.CNM],i={cN:"value",e:",",eW:!0,eE:!0,c:n,k:t},r={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:!0,eE:!0,c:[e.BE],i:"\\n",starts:i}],i:"\\S"},o={b:"\\[",e:"\\]",c:[e.inherit(i,{cN:null})],i:"\\S"};return n.splice(n.length,0,r,o),{c:n,k:t,i:"\\S"}}),hljs.registerLanguage("django",function(){var e={cN:"filter",b:/\|[A-Za-z]+\:?/,k:"truncatewords removetags linebreaksbr yesno get_digit timesince random striptags filesizeformat escape linebreaks length_is ljust rjust cut urlize fix_ampersands title floatformat capfirst pprint divisibleby add make_list unordered_list urlencode timeuntil urlizetrunc wordcount stringformat linenumbers slice date dictsort dictsortreversed default_if_none pluralize lower join center default truncatewords_html upper length phone2numeric wordwrap time addslashes slugify first escapejs force_escape iriencode last safe safeseq truncatechars localize unlocalize localtime utc timezone",c:[{cN:"argument",b:/"/,e:/"/},{cN:"argument",b:/'/,e:/'/}]};return{cI:!0,sL:"xml",subLanguageMode:"continuous",c:[{cN:"template_comment",b:/\{%\s*comment\s*%}/,e:/\{%\s*endcomment\s*%}/},{cN:"template_comment",b:/\{#/,e:/#}/},{cN:"template_tag",b:/\{%/,e:/%}/,k:"comment endcomment load templatetag ifchanged endifchanged if endif firstof for endfor in ifnotequal endifnotequal widthratio extends include spaceless endspaceless regroup by as ifequal endifequal ssi now with cycle url filter endfilter debug block endblock else autoescape endautoescape csrf_token empty elif endwith static trans blocktrans endblocktrans get_static_prefix get_media_prefix plural get_current_language language get_available_languages get_current_language_bidi get_language_info get_language_info_list localize endlocalize localtime endlocaltime timezone endtimezone get_current_timezone verbatim",c:[e]},{cN:"variable",b:/\{\{/,e:/}}/,c:[e]}]}}),hljs.registerLanguage("delphi",function(e){var t="exports register file shl array record property for mod while set ally label uses raise not stored class safecall var interface or private static exit index inherited to else stdcall override shr asm far resourcestring finalization packed virtual out and protected library do xorwrite goto near function end div overload object unit begin string on inline repeat until destructor write message program with read initialization except default nil if case cdecl in downto threadvar of try pascal const external constructor type public then implementation finally published procedure",n={cN:"comment",v:[{b:/\{/,e:/\}/,r:0},{b:/\(\*/,e:/\*\)/,r:10}]},i={cN:"string",b:/'/,e:/'/,c:[{b:/''/}]},r={cN:"string",b:/(#\d+)+/},o={b:e.IR+"\\s*=\\s*class\\s*\\(",rB:!0,c:[e.TM]},a={cN:"function",bK:"function constructor destructor procedure",e:/[:;]/,k:"function constructor|10 destructor|10 procedure|10",c:[e.TM,{cN:"params",b:/\(/,e:/\)/,k:t,c:[i,r]},n]};return{cI:!0,k:t,i:/("|\$[G-Zg-z]|\/\*|<\/)/,c:[n,e.CLCM,i,r,e.NM,o,a]}}),hljs.registerLanguage("vbscript",function(e){return{cI:!0,k:{keyword:"call class const dim do loop erase execute executeglobal exit for each next function if then else on error option explicit new private property let get public randomize redim rem select case set stop sub while wend with end to elseif is or xor and not class_initialize class_terminate default preserve in me byval byref step resume goto",built_in:"lcase month vartype instrrev ubound setlocale getobject rgb getref string weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency conversions csng timevalue second year space abs clng timeserial fixs len asc isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion scriptengine split scriptengineminorversion cint sin datepart ltrim sqr scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw chrw regexp server response request cstr err",literal:"true false null nothing empty"},i:"//",c:[e.inherit(e.QSM,{c:[{b:'""'}]}),{cN:"comment",b:/'/,e:/$/,r:0},e.CNM]}}),hljs.registerLanguage("oxygene",function(e){var t="abstract add and array as asc aspect assembly async begin break block by case class concat const copy constructor continue create default delegate desc distinct div do downto dynamic each else empty end ensure enum equals event except exit extension external false final finalize finalizer finally flags for forward from function future global group has if implementation implements implies in index inherited inline interface into invariants is iterator join locked locking loop matching method mod module namespace nested new nil not notify nullable of old on operator or order out override parallel params partial pinned private procedure property protected public queryable raise read readonly record reintroduce remove repeat require result reverse sealed select self sequence set shl shr skip static step soft take then to true try tuple type union unit unsafe until uses using var virtual raises volatile where while with write xor yield await mapped deprecated stdcall cdecl pascal register safecall overload library platform reference packed strict published autoreleasepool selector strong weak unretained",n={cN:"comment",b:"{",e:"}",r:0},i={cN:"comment",b:"\\(\\*",e:"\\*\\)",r:10},r={cN:"string",b:"'",e:"'",c:[{b:"''"}]},o={cN:"string",b:"(#\\d+)+"},a={cN:"function",bK:"function constructor destructor procedure method",e:"[:;]",k:"function constructor|10 destructor|10 procedure|10 method|10",c:[e.TM,{cN:"params",b:"\\(",e:"\\)",k:t,c:[r,o]},n,i]};return{cI:!0,k:t,i:'("|\\$[G-Zg-z]|\\/\\*|)',c:[n,i,e.CLCM,r,o,e.NM,a,{cN:"class",b:"=\\bclass\\b",e:"end;",k:t,c:[r,o,n,i,e.CLCM,a]}]}}),hljs.registerLanguage("mel",function(e){return{k:"int float string vector matrix if else switch case default while do for in break continue global proc return about abs addAttr addAttributeEditorNodeHelp addDynamic addNewShelfTab addPP addPanelCategory addPrefixToName advanceToNextDrivenKey affectedNet affects aimConstraint air alias aliasAttr align alignCtx alignCurve alignSurface allViewFit ambientLight angle angleBetween animCone animCurveEditor animDisplay animView annotate appendStringArray applicationName applyAttrPreset applyTake arcLenDimContext arcLengthDimension arclen arrayMapper art3dPaintCtx artAttrCtx artAttrPaintVertexCtx artAttrSkinPaintCtx artAttrTool artBuildPaintMenu artFluidAttrCtx artPuttyCtx artSelectCtx artSetPaintCtx artUserPaintCtx assignCommand assignInputDevice assignViewportFactories attachCurve attachDeviceAttr attachSurface attrColorSliderGrp attrCompatibility attrControlGrp attrEnumOptionMenu attrEnumOptionMenuGrp attrFieldGrp attrFieldSliderGrp attrNavigationControlGrp attrPresetEditWin attributeExists attributeInfo attributeMenu attributeQuery autoKeyframe autoPlace bakeClip bakeFluidShading bakePartialHistory bakeResults bakeSimulation basename basenameEx batchRender bessel bevel bevelPlus binMembership bindSkin blend2 blendShape blendShapeEditor blendShapePanel blendTwoAttr blindDataType boneLattice boundary boxDollyCtx boxZoomCtx bufferCurve buildBookmarkMenu buildKeyframeMenu button buttonManip CBG cacheFile cacheFileCombine cacheFileMerge cacheFileTrack camera cameraView canCreateManip canvas capitalizeString catch catchQuiet ceil changeSubdivComponentDisplayLevel changeSubdivRegion channelBox character characterMap characterOutlineEditor characterize chdir checkBox checkBoxGrp checkDefaultRenderGlobals choice circle circularFillet clamp clear clearCache clip clipEditor clipEditorCurrentTimeCtx clipSchedule clipSchedulerOutliner clipTrimBefore closeCurve closeSurface cluster cmdFileOutput cmdScrollFieldExecuter cmdScrollFieldReporter cmdShell coarsenSubdivSelectionList collision color colorAtPoint colorEditor colorIndex colorIndexSliderGrp colorSliderButtonGrp colorSliderGrp columnLayout commandEcho commandLine commandPort compactHairSystem componentEditor compositingInterop computePolysetVolume condition cone confirmDialog connectAttr connectControl connectDynamic connectJoint connectionInfo constrain constrainValue constructionHistory container containsMultibyte contextInfo control convertFromOldLayers convertIffToPsd convertLightmap convertSolidTx convertTessellation convertUnit copyArray copyFlexor copyKey copySkinWeights cos cpButton cpCache cpClothSet cpCollision cpConstraint cpConvClothToMesh cpForces cpGetSolverAttr cpPanel cpProperty cpRigidCollisionFilter cpSeam cpSetEdit cpSetSolverAttr cpSolver cpSolverTypes cpTool cpUpdateClothUVs createDisplayLayer createDrawCtx createEditor createLayeredPsdFile createMotionField createNewShelf createNode createRenderLayer createSubdivRegion cross crossProduct ctxAbort ctxCompletion ctxEditMode ctxTraverse currentCtx currentTime currentTimeCtx currentUnit curve curveAddPtCtx curveCVCtx curveEPCtx curveEditorCtx curveIntersect curveMoveEPCtx curveOnSurface curveSketchCtx cutKey cycleCheck cylinder dagPose date defaultLightListCheckBox defaultNavigation defineDataServer defineVirtualDevice deformer deg_to_rad delete deleteAttr deleteShadingGroupsAndMaterials deleteShelfTab deleteUI deleteUnusedBrushes delrandstr detachCurve detachDeviceAttr detachSurface deviceEditor devicePanel dgInfo dgdirty dgeval dgtimer dimWhen directKeyCtx directionalLight dirmap dirname disable disconnectAttr disconnectJoint diskCache displacementToPoly displayAffected displayColor displayCull displayLevelOfDetail displayPref displayRGBColor displaySmoothness displayStats displayString displaySurface distanceDimContext distanceDimension doBlur dolly dollyCtx dopeSheetEditor dot dotProduct doubleProfileBirailSurface drag dragAttrContext draggerContext dropoffLocator duplicate duplicateCurve duplicateSurface dynCache dynControl dynExport dynExpression dynGlobals dynPaintEditor dynParticleCtx dynPref dynRelEdPanel dynRelEditor dynamicLoad editAttrLimits editDisplayLayerGlobals editDisplayLayerMembers editRenderLayerAdjustment editRenderLayerGlobals editRenderLayerMembers editor editorTemplate effector emit emitter enableDevice encodeString endString endsWith env equivalent equivalentTol erf error eval evalDeferred evalEcho event exactWorldBoundingBox exclusiveLightCheckBox exec executeForEachObject exists exp expression expressionEditorListen extendCurve extendSurface extrude fcheck fclose feof fflush fgetline fgetword file fileBrowserDialog fileDialog fileExtension fileInfo filetest filletCurve filter filterCurve filterExpand filterStudioImport findAllIntersections findAnimCurves findKeyframe findMenuItem findRelatedSkinCluster finder firstParentOf fitBspline flexor floatEq floatField floatFieldGrp floatScrollBar floatSlider floatSlider2 floatSliderButtonGrp floatSliderGrp floor flow fluidCacheInfo fluidEmitter fluidVoxelInfo flushUndo fmod fontDialog fopen formLayout format fprint frameLayout fread freeFormFillet frewind fromNativePath fwrite gamma gauss geometryConstraint getApplicationVersionAsFloat getAttr getClassification getDefaultBrush getFileList getFluidAttr getInputDeviceRange getMayaPanelTypes getModifiers getPanel getParticleAttr getPluginResource getenv getpid glRender glRenderEditor globalStitch gmatch goal gotoBindPose grabColor gradientControl gradientControlNoAttr graphDollyCtx graphSelectContext graphTrackCtx gravity grid gridLayout group groupObjectsByName HfAddAttractorToAS HfAssignAS HfBuildEqualMap HfBuildFurFiles HfBuildFurImages HfCancelAFR HfConnectASToHF HfCreateAttractor HfDeleteAS HfEditAS HfPerformCreateAS HfRemoveAttractorFromAS HfSelectAttached HfSelectAttractors HfUnAssignAS hardenPointCurve hardware hardwareRenderPanel headsUpDisplay headsUpMessage help helpLine hermite hide hilite hitTest hotBox hotkey hotkeyCheck hsv_to_rgb hudButton hudSlider hudSliderButton hwReflectionMap hwRender hwRenderLoad hyperGraph hyperPanel hyperShade hypot iconTextButton iconTextCheckBox iconTextRadioButton iconTextRadioCollection iconTextScrollList iconTextStaticLabel ikHandle ikHandleCtx ikHandleDisplayScale ikSolver ikSplineHandleCtx ikSystem ikSystemInfo ikfkDisplayMethod illustratorCurves image imfPlugins inheritTransform insertJoint insertJointCtx insertKeyCtx insertKnotCurve insertKnotSurface instance instanceable instancer intField intFieldGrp intScrollBar intSlider intSliderGrp interToUI internalVar intersect iprEngine isAnimCurve isConnected isDirty isParentOf isSameObject isTrue isValidObjectName isValidString isValidUiName isolateSelect itemFilter itemFilterAttr itemFilterRender itemFilterType joint jointCluster jointCtx jointDisplayScale jointLattice keyTangent keyframe keyframeOutliner keyframeRegionCurrentTimeCtx keyframeRegionDirectKeyCtx keyframeRegionDollyCtx keyframeRegionInsertKeyCtx keyframeRegionMoveKeyCtx keyframeRegionScaleKeyCtx keyframeRegionSelectKeyCtx keyframeRegionSetKeyCtx keyframeRegionTrackCtx keyframeStats lassoContext lattice latticeDeformKeyCtx launch launchImageEditor layerButton layeredShaderPort layeredTexturePort layout layoutDialog lightList lightListEditor lightListPanel lightlink lineIntersection linearPrecision linstep listAnimatable listAttr listCameras listConnections listDeviceAttachments listHistory listInputDeviceAxes listInputDeviceButtons listInputDevices listMenuAnnotation listNodeTypes listPanelCategories listRelatives listSets listTransforms listUnselected listerEditor loadFluid loadNewShelf loadPlugin loadPluginLanguageResources loadPrefObjects localizedPanelLabel lockNode loft log longNameOf lookThru ls lsThroughFilter lsType lsUI Mayatomr mag makeIdentity makeLive makePaintable makeRoll makeSingleSurface makeTubeOn makebot manipMoveContext manipMoveLimitsCtx manipOptions manipRotateContext manipRotateLimitsCtx manipScaleContext manipScaleLimitsCtx marker match max memory menu menuBarLayout menuEditor menuItem menuItemToShelf menuSet menuSetPref messageLine min minimizeApp mirrorJoint modelCurrentTimeCtx modelEditor modelPanel mouse movIn movOut move moveIKtoFK moveKeyCtx moveVertexAlongDirection multiProfileBirailSurface mute nParticle nameCommand nameField namespace namespaceInfo newPanelItems newton nodeCast nodeIconButton nodeOutliner nodePreset nodeType noise nonLinear normalConstraint normalize nurbsBoolean nurbsCopyUVSet nurbsCube nurbsEditUV nurbsPlane nurbsSelect nurbsSquare nurbsToPoly nurbsToPolygonsPref nurbsToSubdiv nurbsToSubdivPref nurbsUVSet nurbsViewDirectionVector objExists objectCenter objectLayer objectType objectTypeUI obsoleteProc oceanNurbsPreviewPlane offsetCurve offsetCurveOnSurface offsetSurface openGLExtension openMayaPref optionMenu optionMenuGrp optionVar orbit orbitCtx orientConstraint outlinerEditor outlinerPanel overrideModifier paintEffectsDisplay pairBlend palettePort paneLayout panel panelConfiguration panelHistory paramDimContext paramDimension paramLocator parent parentConstraint particle particleExists particleInstancer particleRenderInfo partition pasteKey pathAnimation pause pclose percent performanceOptions pfxstrokes pickWalk picture pixelMove planarSrf plane play playbackOptions playblast plugAttr plugNode pluginInfo pluginResourceUtil pointConstraint pointCurveConstraint pointLight pointMatrixMult pointOnCurve pointOnSurface pointPosition poleVectorConstraint polyAppend polyAppendFacetCtx polyAppendVertex polyAutoProjection polyAverageNormal polyAverageVertex polyBevel polyBlendColor polyBlindData polyBoolOp polyBridgeEdge polyCacheMonitor polyCheck polyChipOff polyClipboard polyCloseBorder polyCollapseEdge polyCollapseFacet polyColorBlindData polyColorDel polyColorPerVertex polyColorSet polyCompare polyCone polyCopyUV polyCrease polyCreaseCtx polyCreateFacet polyCreateFacetCtx polyCube polyCut polyCutCtx polyCylinder polyCylindricalProjection polyDelEdge polyDelFacet polyDelVertex polyDuplicateAndConnect polyDuplicateEdge polyEditUV polyEditUVShell polyEvaluate polyExtrudeEdge polyExtrudeFacet polyExtrudeVertex polyFlipEdge polyFlipUV polyForceUV polyGeoSampler polyHelix polyInfo polyInstallAction polyLayoutUV polyListComponentConversion polyMapCut polyMapDel polyMapSew polyMapSewMove polyMergeEdge polyMergeEdgeCtx polyMergeFacet polyMergeFacetCtx polyMergeUV polyMergeVertex polyMirrorFace polyMoveEdge polyMoveFacet polyMoveFacetUV polyMoveUV polyMoveVertex polyNormal polyNormalPerVertex polyNormalizeUV polyOptUvs polyOptions polyOutput polyPipe polyPlanarProjection polyPlane polyPlatonicSolid polyPoke polyPrimitive polyPrism polyProjection polyPyramid polyQuad polyQueryBlindData polyReduce polySelect polySelectConstraint polySelectConstraintMonitor polySelectCtx polySelectEditCtx polySeparate polySetToFaceNormal polySewEdge polyShortestPathCtx polySmooth polySoftEdge polySphere polySphericalProjection polySplit polySplitCtx polySplitEdge polySplitRing polySplitVertex polyStraightenUVBorder polySubdivideEdge polySubdivideFacet polyToSubdiv polyTorus polyTransfer polyTriangulate polyUVSet polyUnite polyWedgeFace popen popupMenu pose pow preloadRefEd print progressBar progressWindow projFileViewer projectCurve projectTangent projectionContext projectionManip promptDialog propModCtx propMove psdChannelOutliner psdEditTextureFile psdExport psdTextureFile putenv pwd python querySubdiv quit rad_to_deg radial radioButton radioButtonGrp radioCollection radioMenuItemCollection rampColorPort rand randomizeFollicles randstate rangeControl readTake rebuildCurve rebuildSurface recordAttr recordDevice redo reference referenceEdit referenceQuery refineSubdivSelectionList refresh refreshAE registerPluginResource rehash reloadImage removeJoint removeMultiInstance removePanelCategory rename renameAttr renameSelectionList renameUI render renderGlobalsNode renderInfo renderLayerButton renderLayerParent renderLayerPostProcess renderLayerUnparent renderManip renderPartition renderQualityNode renderSettings renderThumbnailUpdate renderWindowEditor renderWindowSelectContext renderer reorder reorderDeformers requires reroot resampleFluid resetAE resetPfxToPolyCamera resetTool resolutionNode retarget reverseCurve reverseSurface revolve rgb_to_hsv rigidBody rigidSolver roll rollCtx rootOf rot rotate rotationInterpolation roundConstantRadius rowColumnLayout rowLayout runTimeCommand runup sampleImage saveAllShelves saveAttrPreset saveFluid saveImage saveInitialState saveMenu savePrefObjects savePrefs saveShelf saveToolSettings scale scaleBrushBrightness scaleComponents scaleConstraint scaleKey scaleKeyCtx sceneEditor sceneUIReplacement scmh scriptCtx scriptEditorInfo scriptJob scriptNode scriptTable scriptToShelf scriptedPanel scriptedPanelType scrollField scrollLayout sculpt searchPathArray seed selLoadSettings select selectContext selectCurveCV selectKey selectKeyCtx selectKeyframeRegionCtx selectMode selectPref selectPriority selectType selectedNodes selectionConnection separator setAttr setAttrEnumResource setAttrMapping setAttrNiceNameResource setConstraintRestPosition setDefaultShadingGroup setDrivenKeyframe setDynamic setEditCtx setEditor setFluidAttr setFocus setInfinity setInputDeviceMapping setKeyCtx setKeyPath setKeyframe setKeyframeBlendshapeTargetWts setMenuMode setNodeNiceNameResource setNodeTypeFlag setParent setParticleAttr setPfxToPolyCamera setPluginResource setProject setStampDensity setStartupMessage setState setToolTo setUITemplate setXformManip sets shadingConnection shadingGeometryRelCtx shadingLightRelCtx shadingNetworkCompare shadingNode shapeCompare shelfButton shelfLayout shelfTabLayout shellField shortNameOf showHelp showHidden showManipCtx showSelectionInTitle showShadingGroupAttrEditor showWindow sign simplify sin singleProfileBirailSurface size sizeBytes skinCluster skinPercent smoothCurve smoothTangentSurface smoothstep snap2to2 snapKey snapMode snapTogetherCtx snapshot soft softMod softModCtx sort sound soundControl source spaceLocator sphere sphrand spotLight spotLightPreviewPort spreadSheetEditor spring sqrt squareSurface srtContext stackTrace startString startsWith stitchAndExplodeShell stitchSurface stitchSurfacePoints strcmp stringArrayCatenate stringArrayContains stringArrayCount stringArrayInsertAtIndex stringArrayIntersector stringArrayRemove stringArrayRemoveAtIndex stringArrayRemoveDuplicates stringArrayRemoveExact stringArrayToString stringToStringArray strip stripPrefixFromName stroke subdAutoProjection subdCleanTopology subdCollapse subdDuplicateAndConnect subdEditUV subdListComponentConversion subdMapCut subdMapSewMove subdMatchTopology subdMirror subdToBlind subdToPoly subdTransferUVsToCache subdiv subdivCrease subdivDisplaySmoothness substitute substituteAllString substituteGeometry substring surface surfaceSampler surfaceShaderList swatchDisplayPort switchTable symbolButton symbolCheckBox sysFile system tabLayout tan tangentConstraint texLatticeDeformContext texManipContext texMoveContext texMoveUVShellContext texRotateContext texScaleContext texSelectContext texSelectShortestPathCtx texSmudgeUVContext texWinToolCtx text textCurves textField textFieldButtonGrp textFieldGrp textManip textScrollList textToShelf textureDisplacePlane textureHairColor texturePlacementContext textureWindow threadCount threePointArcCtx timeControl timePort timerX toNativePath toggle toggleAxis toggleWindowVisibility tokenize tokenizeList tolerance tolower toolButton toolCollection toolDropped toolHasOptions toolPropertyWindow torus toupper trace track trackCtx transferAttributes transformCompare transformLimits translator trim trunc truncateFluidCache truncateHairCache tumble tumbleCtx turbulence twoPointArcCtx uiRes uiTemplate unassignInputDevice undo undoInfo ungroup uniform unit unloadPlugin untangleUV untitledFileName untrim upAxis updateAE userCtx uvLink uvSnapshot validateShelfName vectorize view2dToolCtx viewCamera viewClipPlane viewFit viewHeadOn viewLookAt viewManip viewPlace viewSet visor volumeAxis vortex waitCursor warning webBrowser webBrowserPrefs whatIs window windowPref wire wireContext workspace wrinkle wrinkleContext writeTake xbmLangPathList xform",i:"",c:[e.CNM,e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE]},{cN:"variable",v:[{b:"\\$\\d"},{b:"[\\$\\%\\@](\\^\\w\\b|#\\w+|[^\\s\\w{]|{\\w+}|\\w+)"},{b:"\\*(\\^\\w\\b|#\\w+|[^\\s\\w{]|{\\w+}|\\w+)",r:0}]},e.CLCM,e.CBLCLM]}}),hljs.registerLanguage("dos",function(){return{cI:!0,k:{flow:"if else goto for in do call exit not exist errorlevel defined equ neq lss leq gtr geq",keyword:"shift cd dir echo setlocal endlocal set pause copy",stream:"prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux",winutils:"ping net ipconfig taskkill xcopy ren del"},c:[{cN:"envvar",b:"%%[^ ]"},{cN:"envvar",b:"%[^ ]+?%"},{cN:"envvar",b:"![^ ]+?!"},{cN:"number",b:"\\b\\d+",r:0},{cN:"comment",b:"@?rem",e:"$"}]}}),hljs.registerLanguage("apache",function(e){var t={cN:"number",b:"[\\$%]\\d+"};return{cI:!0,c:[e.HCM,{cN:"tag",b:"?",e:">"},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",t]},t,e.QSM]}}],i:/\S/}}),hljs.registerLanguage("scss",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",n={cN:"function",b:t+"\\(",e:"\\)",c:["self",e.NM,e.ASM,e.QSM]},i={cN:"hexcolor",b:"#[0-9A-Fa-f]+"};return{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:!0,i:"[^\\s]",starts:{cN:"value",eW:!0,eE:!0,c:[n,i,e.NM,e.QSM,e.ASM,e.CBLCLM,{cN:"important",b:"!important"}]}},{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBLCLM,{cN:"function",b:t+"\\(",e:"\\)",c:["self",e.NM,e.ASM,e.QSM]},{cN:"id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{cN:"pseudo",b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{cN:"pseudo",b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{cN:"value",b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{cN:"value",b:":",e:";",c:[i,e.NM,e.QSM,e.ASM,{cN:"important",b:"!important"}]},{cN:"at_rule",b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[n,e.QSM,e.ASM,i,e.NM,{cN:"preprocessor",b:"\\s[A-Za-z0-9_.-]+",r:0}]}]} +}),hljs.registerLanguage("applescript",function(e){var t=e.inherit(e.QSM,{i:""}),n={cN:"params",b:"\\(",e:"\\)",c:["self",e.CNM,t]},i=[{cN:"comment",b:"--",e:"$"},{cN:"comment",b:"\\(\\*",e:"\\*\\)",c:["self",{b:"--",e:"$"}]},e.HCM];return{k:{keyword:"about above after against and around as at back before beginning behind below beneath beside between but by considering contain contains continue copy div does eighth else end equal equals error every exit fifth first for fourth from front get given global if ignoring in into is it its last local me middle mod my ninth not of on onto or over prop property put ref reference repeat returning script second set seventh since sixth some tell tenth that the then third through thru timeout times to transaction try until where while whose with without",constant:"AppleScript false linefeed return pi quote result space tab true",type:"alias application boolean class constant date file integer list number real record string text",command:"activate beep count delay launch log offset read round run say summarize write",property:"character characters contents day frontmost id item length month name paragraph paragraphs rest reverse running time version weekday word words year"},c:[t,e.CNM,{cN:"type",b:"\\bPOSIX file\\b"},{cN:"command",b:"\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\b|^\\s*return\\b"},{cN:"constant",b:"\\b(text item delimiters|current application|missing value)\\b"},{cN:"keyword",b:"\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\b"},{cN:"property",b:"\\b(POSIX path|(date|time) string|quoted form)\\b"},{cN:"function_start",bK:"on",i:"[${=;\\n]",c:[e.UTM,n]}].concat(i),i:"//"}}),hljs.registerLanguage("lasso",function(e){var t="[a-zA-Z_][a-zA-Z0-9_.]*",n="<\\?(lasso(script)?|=)",i="\\]|\\?>",r={literal:"true false none minimal full all void and or not bw nbw ew new cn ncn lt lte gt gte eq neq rx nrx ft",built_in:"array date decimal duration integer map pair string tag xml null bytes list queue set stack staticarray tie local var variable global data self inherited",keyword:"error_code error_msg error_pop error_push error_reset cache database_names database_schemanames database_tablenames define_tag define_type email_batch encode_set html_comment handle handle_error header if inline iterate ljax_target link link_currentaction link_currentgroup link_currentrecord link_detail link_firstgroup link_firstrecord link_lastgroup link_lastrecord link_nextgroup link_nextrecord link_prevgroup link_prevrecord log loop namespace_using output_none portal private protect records referer referrer repeating resultset rows search_args search_arguments select sort_args sort_arguments thread_atomic value_list while abort case else if_empty if_false if_null if_true loop_abort loop_continue loop_count params params_up return return_value run_children soap_definetag soap_lastrequest soap_lastresponse tag_name ascending average by define descending do equals frozen group handle_failure import in into join let match max min on order parent protected provide public require returnhome skip split_thread sum take thread to trait type where with yield yieldhome"},o={cN:"comment",b:"",r:0},a={cN:"preprocessor",b:"\\[noprocess\\]",starts:{cN:"markup",e:"\\[/noprocess\\]",rE:!0,c:[o]}},s={cN:"preprocessor",b:"\\[/noprocess|"+n},l={cN:"variable",b:"'"+t+"'"},c=[e.CLCM,{cN:"javadoc",b:"/\\*\\*!",e:"\\*/"},e.CBLCLM,e.inherit(e.CNM,{b:e.CNR+"|-?(infinity|nan)\\b"}),e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null}),{cN:"string",b:"`",e:"`"},{cN:"variable",v:[{b:"[#$]"+t},{b:"#",e:"\\d+",i:"\\W"}]},{cN:"tag",b:"::\\s*",e:t,i:"\\W"},{cN:"attribute",b:"\\.\\.\\.|-"+e.UIR},{cN:"subst",v:[{b:"->\\s*",c:[l]},{b:":=|/(?!\\w)=?|[-+*%=<>&|!?\\\\]+",r:0}]},{cN:"built_in",b:"\\.\\.?",r:0,c:[l]},{cN:"class",bK:"define",rE:!0,e:"\\(|=>",c:[e.inherit(e.TM,{b:e.UIR+"(=(?!>))?"})]}];return{aliases:["ls","lassoscript"],cI:!0,l:t+"|&[lg]t;",k:r,c:[{cN:"preprocessor",b:i,r:0,starts:{cN:"markup",e:"\\[|"+n,rE:!0,r:0,c:[o]}},a,s,{cN:"preprocessor",b:"\\[no_square_brackets",starts:{e:"\\[/no_square_brackets\\]",l:t+"|&[lg]t;",k:r,c:[{cN:"preprocessor",b:i,r:0,starts:{cN:"markup",e:n,rE:!0,c:[o]}},a,s].concat(c)}},{cN:"preprocessor",b:"\\[",r:0},{cN:"shebang",b:"^#!.+lasso9\\b",r:10}].concat(c)}}),hljs.registerLanguage("cpp",function(e){var t={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"};return{aliases:["c"],k:t,i:"",c:[e.CLCM,e.CBLCLM,e.QSM,{cN:"string",b:"'\\\\?.",e:"'",i:"."},{cN:"number",b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},e.CNM,{cN:"preprocessor",b:"#",e:"$",c:[{b:"include\\s*<",e:">",i:"\\n"},e.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:t,r:10,c:["self"]}]}}),hljs.registerLanguage("matlab",function(e){var t=[e.CNM,{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]}];return{k:{keyword:"break case catch classdef continue else elseif end enumerated events for function global if methods otherwise parfor persistent properties return spmd switch try while",built_in:"sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal rosser toeplitz vander wilkinson"},i:'(//|"|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function",e:"$",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)"},{cN:"params",b:"\\[",e:"\\]"}]},{cN:"transposed_variable",b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:"",r:0},{cN:"matrix",b:"\\[",e:"\\]'*[\\.']*",c:t,r:0},{cN:"cell",b:"\\{",e:"\\}'*[\\.']*",c:t,i:/:/},{cN:"comment",b:"\\%",e:"$"}].concat(t)}}),hljs.registerLanguage("scilab",function(e){var t=[e.CNM,{cN:"string",b:"'|\"",e:"'|\"",c:[e.BE,{b:"''"}]}];return{k:{keyword:"abort break case clear catch continue do elseif else endfunction end for functionglobal if pause return resume select try then while%f %F %t %T %pi %eps %inf %nan %e %i %z %s",built_in:"abs and acos asin atan ceil cd chdir clearglobal cosh cos cumprod deff disp errorexec execstr exists exp eye gettext floor fprintf fread fsolve imag isdef isemptyisinfisnan isvector lasterror length load linspace list listfiles log10 log2 logmax min msprintf mclose mopen ones or pathconvert poly printf prod pwd rand realround sinh sin size gsort sprintf sqrt strcat strcmps tring sum system tanh tantype typename warning zeros matrix"},i:'("|#|/\\*|\\s+/\\w+)',c:[{cN:"function",bK:"function endfunction",e:"$",k:"function endfunction|10",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)"}]},{cN:"transposed_variable",b:"[a-zA-Z_][a-zA-Z_0-9]*('+[\\.']*|[\\.']+)",e:"",r:0},{cN:"matrix",b:"\\[",e:"\\]'*[\\.']*",r:0,c:t},{cN:"comment",b:"//",e:"$"}].concat(t)}}),hljs.registerLanguage("makefile",function(e){var t={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[t]}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,c:[e.QSM,t]}]}}),hljs.registerLanguage("asciidoc",function(){return{c:[{cN:"comment",b:"^/{4,}\\n",e:"\\n/{4,}$",r:10},{cN:"comment",b:"^//",e:"$",r:0},{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"header",b:"^(={1,5}) .+?( \\1)?$",r:10},{cN:"header",b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$",r:10},{cN:"attribute",b:"^:.+?:",e:"\\s",eE:!0,r:10},{cN:"attribute",b:"^\\[.+?\\]$",r:0},{cN:"blockquote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"label",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"smartquote",b:"``.+?''",r:10},{cN:"smartquote",b:"`.+?'",r:10},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{cN:"horizontal_rule",b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:!0,c:[{b:"(link|image:?):",r:0},{cN:"link_url",b:"\\w",e:"[^\\[]+",r:0},{cN:"link_label",b:"\\[",e:"\\]",eB:!0,eE:!0,r:0}],r:10}]}}),hljs.registerLanguage("parser3",function(e){return{sL:"xml",r:0,c:[{cN:"comment",b:"^#",e:"$"},{cN:"comment",b:"\\^rem{",e:"}",r:10,c:[{b:"{",e:"}",c:["self"]}]},{cN:"preprocessor",b:"^@(?:BASE|USE|CLASS|OPTIONS)$",r:10},{cN:"title",b:"@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$"},{cN:"variable",b:"\\$\\{?[\\w\\-\\.\\:]+\\}?"},{cN:"keyword",b:"\\^[\\w\\-\\.\\:]+"},{cN:"number",b:"\\^#[0-9a-fA-F]+"},e.CNM]}}),hljs.registerLanguage("clojure",function(e){var t={built_in:"def cond apply if-not if-let if not not= = < < > <= <= >= == + / * - rem quot neg? pos? delay? symbol? keyword? true? false? integer? empty? coll? list? set? ifn? fn? associative? sequential? sorted? counted? reversible? number? decimal? class? distinct? isa? float? rational? reduced? ratio? odd? even? char? seq? vector? string? map? nil? contains? zero? instance? not-every? not-any? libspec? -> ->> .. . inc compare do dotimes mapcat take remove take-while drop letfn drop-last take-last drop-while while intern condp case reduced cycle split-at split-with repeat replicate iterate range merge zipmap declare line-seq sort comparator sort-by dorun doall nthnext nthrest partition eval doseq await await-for let agent atom send send-off release-pending-sends add-watch mapv filterv remove-watch agent-error restart-agent set-error-handler error-handler set-error-mode! error-mode shutdown-agents quote var fn loop recur throw try monitor-enter monitor-exit defmacro defn defn- macroexpand macroexpand-1 for dosync and or when when-not when-let comp juxt partial sequence memoize constantly complement identity assert peek pop doto proxy defstruct first rest cons defprotocol cast coll deftype defrecord last butlast sigs reify second ffirst fnext nfirst nnext defmulti defmethod meta with-meta ns in-ns create-ns import refer keys select-keys vals key val rseq name namespace promise into transient persistent! conj! assoc! dissoc! pop! disj! use class type num float double short byte boolean bigint biginteger bigdec print-method print-dup throw-if printf format load compile get-in update-in pr pr-on newline flush read slurp read-line subvec with-open memfn time re-find re-groups rand-int rand mod locking assert-valid-fdecl alias resolve ref deref refset swap! reset! set-validator! compare-and-set! alter-meta! reset-meta! commute get-validator alter ref-set ref-history-count ref-min-history ref-max-history ensure sync io! new next conj set! to-array future future-call into-array aset gen-class reduce map filter find empty hash-map hash-set sorted-map sorted-map-by sorted-set sorted-set-by vec vector seq flatten reverse assoc dissoc list disj get union difference intersection extend extend-type extend-protocol int nth delay count concat chunk chunk-buffer chunk-append chunk-first chunk-rest max min dec unchecked-inc-int unchecked-inc unchecked-dec-inc unchecked-dec unchecked-negate unchecked-add-int unchecked-add unchecked-subtract-int unchecked-subtract chunk-next chunk-cons chunked-seq? prn vary-meta lazy-seq spread list* str find-keyword keyword symbol gensym force rationalize"},n="[a-zA-Z_0-9\\!\\.\\?\\-\\+\\*\\/\\<\\=\\>\\&\\#\\$';]+",i="[\\s:\\(\\{]+\\d+(\\.\\d+)?",r={cN:"number",b:i,r:0},o=e.inherit(e.QSM,{i:null}),a={cN:"comment",b:";",e:"$",r:0},s={cN:"collection",b:"[\\[\\{]",e:"[\\]\\}]"},l={cN:"comment",b:"\\^"+n},c={cN:"comment",b:"\\^\\{",e:"\\}"},u={cN:"attribute",b:"[:]"+n},d={cN:"list",b:"\\(",e:"\\)"},p={eW:!0,k:{literal:"true false nil"},r:0},f={k:t,l:n,cN:"title",b:n,starts:p};return d.c=[{cN:"comment",b:"comment"},f,p],p.c=[d,o,l,c,a,u,s,r],s.c=[d,o,l,a,u,s,r],{i:/\S/,c:[a,d,{cN:"prompt",b:/^=> /,starts:{e:/\n\n|\Z/}}]}}),hljs.registerLanguage("go",function(e){var t={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer",constant:"true false iota nil",typename:"bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:t,i:"",c:[e.CLCM,e.CBLCLM,e.QSM,{cN:"string",b:"'",e:"[^\\\\]'"},{cN:"string",b:"`",e:"`"},{cN:"number",b:"[^a-zA-Z_0-9](\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?",r:0},e.CNM]}}),define("highlightjs",function(e){return function(){var t;return t||e.hljs}}(this));var Markdown;if(Markdown="object"==typeof exports&&"function"==typeof require?exports:{},function(){function e(e){return e}function t(){return!1}function n(){}function i(){}n.prototype={chain:function(t,n){var i=this[t];if(!i)throw new Error("unknown hook "+t);this[t]=i===e?n:function(){var e=Array.prototype.slice.call(arguments,0);return e[0]=i.apply(null,e),n.apply(null,e)}},set:function(e,t){if(!this[e])throw new Error("unknown hook "+e);this[e]=t},addNoop:function(t){this[t]=e},addFalse:function(e){this[e]=t}},Markdown.HookCollection=n,i.prototype={set:function(e,t){this["s_"+e]=t},get:function(e){return this["s_"+e]}},Markdown.Converter=function(){function e(e){return e=e.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(e,t,n,i,r,o){return t=t.toLowerCase(),P.set(t,C(n)),r?i:(o&&F.set(t,o.replace(/"/g,""")),"")})}function t(e){return e=e.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,r),e=e.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,r),e=e.replace(/\n[ ]{0,3}((<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,r),e=e.replace(/\n\n[ ]{0,3}(-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g,r),e=e.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,r)}function r(e,t){var n=t;return n=n.replace(/^\n+/,""),n=n.replace(/\n+$/g,""),n="\n\n~K"+(O.push(n)-1)+"K\n\n"}function o(e,n){e=R.preBlockGamut(e,j),e=f(e);var i="
\n";return e=e.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,i),e=e.replace(/^[ ]{0,2}([ ]?-[ ]?){3,}[ \t]*$/gm,i),e=e.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm,i),e=h(e),e=g(e),e=w(e),e=R.postBlockGamut(e,j),e=t(e),e=S(e,n)}function a(e){return e=R.preSpanGamut(e),e=b(e),e=s(e),e=T(e),e=u(e),e=l(e),e=k(e),e=e.replace(/~P/g,"://"),e=C(e),e=A._DoItalicsAndBold?A._DoItalicsAndBold(e):x(e),e=e.replace(/ +\n/g,"
\n"),e=R.postSpanGamut(e)}function s(e){var t=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|-]|-[^>])(?:[^-]|-[^-])*)--)>)/gi;return e=e.replace(t,function(e){var t=e.replace(/(.)<\/?code>(?=.)/g,"$1`");return t=L(t,"!"==e.charAt(1)?"\\`*_/":"\\`*_")})}function l(e){return e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,c),e=e.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()((?:\([^)]*\)|[^()\s])*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,c),e=e.replace(/(\[([^\[\]]+)\])()()()()()/g,c)}function c(e,t,n,i,r,o,a,s){void 0==s&&(s="");var l=t,c=n.replace(/:\/\//g,"~P"),u=i.toLowerCase(),p=r,f=s;if(""==p)if(""==u&&(u=c.toLowerCase().replace(/ ?\n/g," ")),p="#"+u,void 0!=P.get(u))p=P.get(u),void 0!=F.get(u)&&(f=F.get(u));else{if(!(l.search(/\(\s*\)$/m)>-1))return l;p=""}p=N(p),p=L(p,"*_");var h='"+c+""}function u(e){return e=e.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,p),e=e.replace(/(!\[(.*?)\]\s?\([ \t]*()(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,p)}function d(e){return e.replace(/>/g,">").replace(/"}function f(e){return e=e.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(e,t){return""+a(t)+"
\n\n"}),e=e.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(e,t){return""+a(t)+"
\n\n"}),e=e.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(e,t,n){var i=t.length;return""+a(n)+" \n\n"})}function h(e,t){e+="~0";var n=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return B?e=e.replace(n,function(e,n,i){var r=n,o=i.search(/[*+-]/g)>-1?"ul":"ol",a=m(r,o,t);return a=a.replace(/\s+$/,""),a="<"+o+">"+a+""+o+">\n"}):(n=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,e=e.replace(n,function(e,t,n,i){var r=t,o=n,a=i.search(/[*+-]/g)>-1?"ul":"ol",s=m(o,a);return s=r+"<"+a+">\n"+s+""+a+">\n"})),e=e.replace(/~0/,"")}function m(e,t,n){B++,e=e.replace(/\n{2,}$/,"\n"),e+="~0";var i=$[t],r=new RegExp("(^[ \\t]*)("+i+")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1("+i+")[ \\t]+))","gm"),s=!1;return e=e.replace(r,function(e,t,i,r){var l=r,c=/\n\n$/.test(l),u=c||l.search(/\n{2,}/)>-1;return u||s?l=o(I(l),!0):(l=h(I(l),!0),l=l.replace(/\n$/,""),n||(l=a(l))),s=c,""+l+" \n"}),e=e.replace(/~0/g,""),B--,e}function g(e){return e+="~0",e=e.replace(/(?:\n\n|^\n?)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(e,t,n){var i=t,r=n;return i=y(I(i)),i=D(i),i=i.replace(/^\n+/g,""),i=i.replace(/\n+$/g,""),i="","\n\n"+i+"\n\n"+r}),e=e.replace(/~0/,"")}function v(e){return e=e.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(O.push(e)-1)+"K\n\n"}function b(e){return e=e.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(e,t,n,i){var r=i;return r=r.replace(/^([ \t]*)/g,""),r=r.replace(/[ \t]*$/g,""),r=y(r),r=r.replace(/:\/\//g,"~P"),t+""+i+"\n
"+r+"
"})}function y(e){return e=e.replace(/&/g,"&"),e=e.replace(//g,">"),e=L(e,"*_{}[]\\",!1)}function x(e){return e=e.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g,"$1$3$4"),e=e.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g,"$1$3$4")}function w(e){return e=e.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(e,t){var n=t;return n=n.replace(/^[ \t]*>[ \t]?/gm,"~0"),n=n.replace(/~0/g,""),n=n.replace(/^[ \t]+$/gm,""),n=o(n),n=n.replace(/(^|\n)/g,"$1 "),n=n.replace(/(\s*[^\r]+?<\/pre>)/gm,function(e,t){var n=t;return n=n.replace(/^ /gm,"~0"),n=n.replace(/~0/g,"")}),v("\n"+n+"\n")})}function S(e,t){e=e.replace(/^\n+/g,""),e=e.replace(/\n+$/g,"");for(var n=e.split(/\n{2,}/g),i=[],r=/~K(\d+)K/,o=n.length,s=0;o>s;s++){var l=n[s];r.test(l)?i.push(l):/\S/.test(l)&&(l=a(l),l=l.replace(/^([ \t]*)/g,""),l+="
",i.push(l))}if(!t){o=i.length;for(var s=0;o>s;s++)for(var c=!0;c;)c=!1,i[s]=i[s].replace(/~K(\d+)K/g,function(e,t){return c=!0,O[t]})}return i.join("\n\n")}function C(e){return e=e.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),e=e.replace(/<(?![a-z\/?!]|~D)/gi,"<")}function T(e){return e=e.replace(/\\(\\)/g,M),e=e.replace(/\\([`*_{}\[\]()>#+-.!])/g,M)}function E(e,t,n,i){if(t)return e;if(")"!==i.charAt(i.length-1))return"<"+n+i+">";for(var r=i.match(/[()]/g),o=0,a=0;a=o?o=1:o++:o--;var s="";if(0>o){var l=new RegExp("\\){1,"+-o+"}$");i=i.replace(l,function(e){return s=e,""})}if(s){var c=i.charAt(i.length-1);U.test(c)||(s=c+s,i=i.substr(0,i.length-1))}return"<"+n+i+">"+s}function k(e){e=e.replace(H,E);var t=function(e,t){return''+R.plainLinkText(t)+""};return e=e.replace(/<((https?|ftp):[^'">\s]+)>/gi,t)}function _(e){return e=e.replace(/~E(\d+)E/g,function(e,t){var n=parseInt(t);return String.fromCharCode(n)})}function I(e){return e=e.replace(/^(\t|[ ]{1,4})/gm,"~0"),e=e.replace(/~0/g,"")}function D(e){if(!/\t/.test(e))return e;var t,n=[" "," "," "," "],i=0;return e.replace(/[\n\t]/g,function(e,r){return"\n"===e?(i=r+1,e):(t=(r-i)%4,i=r+1,n[t])})}function N(e){return e?(e.length,e.replace(z,function(e){return"~D"==e?"%24":":"==e?":":"%"+e.charCodeAt(0).toString(16)})):""}function L(e,t,n){var i="(["+t.replace(/([\[\]\\])/g,"\\$1")+"])";n&&(i="\\\\"+i);var r=new RegExp(i,"g");return e=e.replace(r,M)}function M(e,t){var n=t.charCodeAt(0);return"~E"+n+"E"}var A={};this.setOptions=function(e){A=e};var R=this.hooks=new n;R.addNoop("plainLinkText"),R.addNoop("preConversion"),R.addNoop("postNormalization"),R.addNoop("preBlockGamut"),R.addNoop("postBlockGamut"),R.addNoop("preSpanGamut"),R.addNoop("postSpanGamut"),R.addNoop("postConversion");var P,F,O,B;this.makeHtml=function(n){if(P)throw new Error("Recursive call to converter.makeHtml");return P=new i,F=new i,O=[],B=0,n=R.preConversion(n),n=n.replace(/~/g,"~T"),n=n.replace(/\$/g,"~D"),n=n.replace(/\r\n/g,"\n"),n=n.replace(/\r/g,"\n"),n="\n\n"+n+"\n\n",n=D(n),n=n.replace(/^[ \t]+$/gm,""),n=R.postNormalization(n),n=t(n),n=e(n),n=o(n),n=_(n),n=n.replace(/~D/g,"$$"),n=n.replace(/~T/g,"~"),n=R.postConversion(n),O=F=P=null,n};var j=function(e){return o(e)},$={ol:"\\d+[.]",ul:"[*+-]"},G="[-A-Z0-9+&@#/%?=~_|[\\]()!:,.;]",q="[-A-Z0-9+&@#/%=~_|[\\])]",H=new RegExp('(="|<)?\\b(https?|ftp)(://'+G+"*"+q+")(?=$|\\W)","gi"),U=new RegExp(q,"i"),z=/(?:["'*()[\]:]|~D)/g}}(),define("libs/Markdown.Converter",function(){}),function(){function e(e){return e.replace(/^\s+|\s+$/g,"")}function t(e){return e.replace(/\s+$/g,"")}function n(e){return e.replace(new RegExp("^(\\t|[ ]{1,4})","gm"),"")}function i(e,t){return-1!=e.indexOf(t)}function r(e,t){return e.replace(/<[^>]*>?/gi,function(e){return e.match(t)?e:""})}function o(e,t){for(var n={},i=0;i ]*>|","<(br)\\s?\\/?>)$"].join(""),"i");Array.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t ~X"+(this.hashBlocks.push(e)-1)+"X\n"},Markdown.Extra.prototype.hashExtraInline=function(e){return"~X"+(this.hashBlocks.push(e)-1)+"X"},Markdown.Extra.prototype.unHashExtraBlocks=function(e){function t(){var i=!1;e=e.replace(/(?: )?~X(\d+)X(?:<\/p>)?/g,function(e,t){i=!0;var r=parseInt(t,10);return n.hashBlocks[r]}),i===!0&&t()}var n=this;return t(),e},Markdown.Extra.prototype.wrapHeaders=function(e){function t(e){return"\n"+e+"\n"}return e=e.replace(/^.+[ \t]*\n=+[ \t]*\n+/gm,t),e=e.replace(/^.+[ \t]*\n-+[ \t]*\n+/gm,t),e=e.replace(/^\#{1,6}[ \t]*.+?[ \t]*\#*\n+/gm,t)};var g="\\{[ \\t]*((?:[#.][-_:a-zA-Z0-9]+[ \\t]*)+)\\}",v=new RegExp("^(#{1,6}.*#{0,6})[ \\t]+"+g+"[ \\t]*(?:\\n|0x03)","gm"),b=new RegExp("^(.*)[ \\t]+"+g+"[ \\t]*\\n"+"(?=[\\-|=]+\\s*(?:\\n|0x03))","gm"),y=new RegExp("^(```[ \\t]*[^{\\s]*)[ \\t]+"+g+"[ \\t]*\\n"+"(?=([\\s\\S]*?)\\n```[ \\t]*(\\n|0x03))","gm");Markdown.Extra.prototype.hashHeaderAttributeBlocks=function(e){function t(e,t,i){return"
~XX"+(n.hashBlocks.push(i)-1)+"XX
\n"+t+"\n"}var n=this;return e=e.replace(v,t),e=e.replace(b,t)},Markdown.Extra.prototype.hashFcbAttributeBlocks=function(e){function t(e,t,i){return"~XX"+(n.hashBlocks.push(i)-1)+"XX
\n"+t+"\n"}var n=this;return e.replace(y,t)},Markdown.Extra.prototype.applyAttributeBlocks=function(e){var t=this,n=new RegExp('~XX(\\d+)XX
[\\s]*(?:<(h[1-6]|pre)(?: +class="(\\S+)")?(>[\\s\\S]*?\\2>))',"gm");return e=e.replace(n,function(e,n,i,r,a){if(!i)return"";for(var s=parseInt(n,10),l=t.hashBlocks[s],c=l.match(/#[^\s#.]+/g)||[],u=c[0]?' id="'+c[0].substr(1,c[0].length-1)+'"':"",d=l.match(/\.[^\s#.]+/g)||[],p=0;p0&&(f=' class="'+d.join(" ")+'"'),"<"+i+u+f+a})},Markdown.Extra.prototype.tables=function(t){function n(t,n,r,o){n=n.replace(/^ *[|]/m,""),r=r.replace(/^ *[|]/m,""),o=o.replace(/^ *[|]/gm,""),n=n.replace(/[|] *$/m,""),r=r.replace(/[|] *$/m,""),o=o.replace(/[|] *$/gm,""),alignspecs=r.split(/ *[|] */),align=[];for(var a=0;a \n","\n"," \n"].join("");for(a=0;u>a;a++){var f=l(e(c[a]),i);p+=[" \n\n";var h=o.split("\n");for(a=0;a",f," \n"].join("")}p+="v;v++)m.push("");for(p+=" \n",v=0;u>v;v++){var b=l(e(m[v]),i);p+=[" \n"}return p+="\n",i.hashExtraBlock(p)}var i=this,r=new RegExp(["^","[ ]{0,3}","[|]","(.+)\\n","[ ]{0,3}","[|]([ ]*[-:]+[-| :]*)\\n","(","(?:[ ]*[|].*\\n?)*",")","(?:\\n|$)"].join(""),"gm"),o=new RegExp(["^","[ ]{0,3}","(\\S.*[|].*)\\n","[ ]{0,3}","([-:]+[ ]*[|][-| :]*)\\n","(","(?:.*[|].*\\n?)*",")","(?:\\n|$)"].join(""),"gm");return t=t.replace(r,n),t=t.replace(o,n)},Markdown.Extra.prototype.stripFootnoteDefinitions=function(e){var t=this;return e=e.replace(/\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/g,function(e,n,i){return n=f(n),i+="\n",i=i.replace(/^[ ]{0,3}/g,""),t.footnotes[n]=i,"\n"})},Markdown.Extra.prototype.doFootnotes=function(e){var t=this;if(t.isConvertingFootnote===!0)return e;var n=0;return e=e.replace(/\[\^(.+?)\]/g,function(e,i){var r=f(i),o=t.footnotes[r];if(void 0===o)return e;n++,t.usedFootnotes.push(r);var a=''+n+"";return t.hashExtraInline(a)})},Markdown.Extra.prototype.printFootnotes=function(e){var t=this; +if(0===t.usedFootnotes.length)return e;e+='\n\n",b," \n"].join("")}p+="\n"},Markdown.Extra.prototype.fencedCodeBlocks=function(e){function t(e){return e=e.replace(/&/g,"&"),e=e.replace(//g,">"),e=e.replace(/~D/g,"$$"),e=e.replace(/~T/g,"~")}var n=this;return e=e.replace(/(?:^|\n)```[ \t]*(\S*)[ \t]*\n([\s\S]*?)\n```[ \t]*(?=\n)/g,function(e,i,r){var o=i,a=r,s=n.googleCodePrettify?' class="prettyprint"':"",l="";o&&(l=n.googleCodePrettify||n.highlightJs?' class="language-'+o+'"':' class="'+o+'"');var c=["
\n\n\n';for(var n=0;n
\n'+o+' ↩\n\n'}return e+=" "].join("");return n.hashExtraBlock(c)})},Markdown.Extra.prototype.educatePants=function(e){var t=this,n="",i=0;e.replace(/(?:)|(<)([a-zA-Z1-6]+)([^\n]*?>)([\s\S]*?)(<\/\2>)/g,function(r,o,a,s,l,c,u){var d=e.substring(i,u);return n+=t.applyPants(d),t.smartyPantsLastChar=n.substring(n.length-1),i=u+r.length,o?(/code|kbd|pre|script|noscript|iframe|math|ins|del|pre/i.test(a)?t.smartyPantsLastChar=l.substring(l.length-1):l=t.educatePants(l),n+=o+a+s+l+c,void 0):(n+=r,void 0)});var r=e.substring(i);return n+=t.applyPants(r),t.smartyPantsLastChar=n.substring(n.length-1),n},Markdown.Extra.prototype.applyPants=function(e){return e=e.replace(/---/g,"—").replace(/--/g,"–"),e=e.replace(/\.\.\./g,"…").replace(/\.\s\.\s\./g,"…"),e=e.replace(/``/g,"“").replace(/''/g,"”"),/^'$/.test(e)?/\S/.test(this.smartyPantsLastChar)?"’":"‘":/^"$/.test(e)?/\S/.test(this.smartyPantsLastChar)?"”":"“":(e=e.replace(/^'(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/,"’"),e=e.replace(/^"(?=[!"#\$\%'()*+,\-.\/:;<=>?\@\[\\]\^_`{|}~]\B)/,"”"),e=e.replace(/"'(?=\w)/g,"“‘"),e=e.replace(/'"(?=\w)/g,"‘“"),e=e.replace(/'(?=\d{2}s)/g,"’"),e=e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)'(?=\w)/g,"$1‘"),e=e.replace(/([^\s\[\{\(\-])'/g,"$1’"),e=e.replace(/'(?=\s|s\b)/g,"’"),e=e.replace(/'/g,"‘"),e=e.replace(/(\s| |--|&[mn]dash;|&\#8211;|&\#8212;|&\#x201[34];)"(?=\w)/g,"$1“"),e=e.replace(/([^\s\[\{\(\-])"/g,"$1”"),e=e.replace(/"(?=\s)/g,"”"),e=e.replace(/"/gi,"“"))},Markdown.Extra.prototype.runSmartyPants=function(e){return this.smartyPantsLastChar="",e=this.educatePants(e),e=e.replace(/(<([a-zA-Z1-6]+)\b([^\n>]*?)(\/)?>)/g,h)},Markdown.Extra.prototype.definitionLists=function(t){var n=new RegExp(["(\\x02\\n?|\\n\\n)","(?:","(","(","[ ]{0,3}","((?:[ \\t]*\\S.*\\n)+)","\\n?","[ ]{0,3}:[ ]+",")","([\\s\\S]+?)","(","(?=\\0x03)","|","(?=","\\n{2,}","(?=\\S)","(?!","[ ]{0,3}","(?:\\S.*\\n)+?","\\n?","[ ]{0,3}:[ ]+",")","(?!","[ ]{0,3}:[ ]+",")",")",")",")",")"].join(""),"gm"),i=this;return t=a(t),t=t.replace(n,function(t,n,r){var o=e(i.processDefListItems(r));return o="",t(a),"
\n"+o+"\n
",n+i.hashExtraBlock(o)+"\n\n"}),s(t)},Markdown.Extra.prototype.processDefListItems=function(i){var r=this,o=new RegExp(["(\\x02\\n?|\\n\\n+)","(","[ ]{0,3}","(?![:][ ]|[ ])","(?:\\S.*\\n)+?",")","(?=\\n?[ ]{0,3}:[ ])"].join(""),"gm"),u=new RegExp(["\\n(\\n+)?","(","[ ]{0,3}","[:][ ]+",")","([\\s\\S]+?)","(?=\\n*","(?:","\\n[ ]{0,3}[:][ ]|","|\\x03",")",")"].join(""),"gm");return i=a(i),i=i.replace(/\n{2,}(?=\\x03)/,"\n"),i=i.replace(o,function(t,n,i){for(var o=e(i).split("\n"),a="",s=0;s "}return a+"\n"}),i=i.replace(u,function(e,i,o,a){return i||a.match(/\n{2,}/)?(a=Array(o.length+1).join(" ")+a,a=n(a)+"\n\n",a="\n"+c(a,r)+"\n"):(a=t(a),a=l(n(a),r)),"\n"+c+" "+a+" \n"}),s(i)},Markdown.Extra.prototype.strikethrough=function(e){return e.replace(/([\W_]|^)~T~T(?=\S)([^\r]*?\S[\*_]*)~T~T([\W_]|$)/g,"$1$2$3")},Markdown.Extra.prototype.newlines=function(e){return e.replace(/(<(?:br|\/li)>)?\n/g,function(e,t){return t?e:"
\n"})}}(),define("pagedown-extra",function(){}),define("extensions/markdownExtra",["jquery","underscore","utils","classes/Extension","text!html/markdownExtraSettingsBlock.html","google-code-prettify","highlightjs","pagedown-extra"],function(e,t,n,i,r,o,a){var s=new i("markdownExtra","Markdown Extra",!0);s.settingsBlock=r,s.defaultConfig={extensions:["fenced_code_gfm","tables","def_list","attr_list","footnotes","smartypants","strikethrough","newlines"],intraword:!0,comments:!0,highlighter:"prettify"},s.onLoadSettings=function(){function e(e){return t.some(s.config.extensions,function(t){return t==e})}n.setInputChecked("#input-markdownextra-fencedcodegfm",e("fenced_code_gfm")),n.setInputChecked("#input-markdownextra-tables",e("tables")),n.setInputChecked("#input-markdownextra-deflist",e("def_list")),n.setInputChecked("#input-markdownextra-attrlist",e("attr_list")),n.setInputChecked("#input-markdownextra-footnotes",e("footnotes")),n.setInputChecked("#input-markdownextra-smartypants",e("smartypants")),n.setInputChecked("#input-markdownextra-strikethrough",e("strikethrough")),n.setInputChecked("#input-markdownextra-newlines",e("newlines")),n.setInputChecked("#input-markdownextra-intraword",s.config.intraword),n.setInputChecked("#input-markdownextra-comments",s.config.comments),n.setInputValue("#input-markdownextra-highlighter",s.config.highlighter)},s.onSaveSettings=function(e){e.extensions=[],n.getInputChecked("#input-markdownextra-fencedcodegfm")&&e.extensions.push("fenced_code_gfm"),n.getInputChecked("#input-markdownextra-tables")&&e.extensions.push("tables"),n.getInputChecked("#input-markdownextra-deflist")&&e.extensions.push("def_list"),n.getInputChecked("#input-markdownextra-attrlist")&&e.extensions.push("attr_list"),n.getInputChecked("#input-markdownextra-footnotes")&&e.extensions.push("footnotes"),n.getInputChecked("#input-markdownextra-smartypants")&&e.extensions.push("smartypants"),n.getInputChecked("#input-markdownextra-strikethrough")&&e.extensions.push("strikethrough"),n.getInputChecked("#input-markdownextra-newlines")&&e.extensions.push("newlines"),e.intraword=n.getInputChecked("#input-markdownextra-intraword"),e.comments=n.getInputChecked("#input-markdownextra-comments"),e.highlighter=n.getInputValue("#input-markdownextra-highlighter")};var l;return s.onEventMgrCreated=function(e){l=e},s.onPagedownConfigure=function(e){var n=e.getConverter();if(s.config.intraword===!0){var i={_DoItalicsAndBold:function(e){return e=e.replace(/([^\w*]|^)(\*\*|__)(?=\S)(.+?[*_]*)(?=\S)\2(?=[^\w*]|$)/g,"$1$3"),e=e.replace(/([^\w*]|^)(\*|_)(?=\S)(.+?)(?=\S)\2(?=[^\w*]|$)/g,"$1$3")}};n.setOptions(i)}s.config.comments===!0&&n.hooks.chain("postConversion",function(e){return e.replace(//g,function(e){return e.replace(/^$/,' $1 ')})});var r={extensions:s.config.extensions};if("highlight"==s.config.highlighter){r.highlighter="prettify";var l=document.getElementById("preview-contents");e.hooks.chain("onPreviewRefresh",function(){t.each(l.querySelectorAll(".prettyprint > code"),function(e){!e.highlighted&&a.highlightBlock(e),e.highlighted=!0})})}else"prettify"==s.config.highlighter&&(r.highlighter="prettify",e.hooks.chain("onPreviewRefresh",o.prettyPrint));Markdown.Extra.init(n,r)},s}),define("text!html/mathJaxSettingsBlock.html",[],function(){return'Allows StackEdit to interpret LaTeX mathematical expressions.
\n\n\nMore info'}),define("text!libs/mathjax_config.js",[],function(){return'MathJax.Hub.Config({\n "HTML-CSS": {\n preferredFont: "TeX",\n availableFonts: [\n "STIX",\n "TeX"\n ],\n linebreaks: {\n automatic: true\n },\n EqnChunk: 10,\n imageFont: null\n },\n tex2jax: <%= tex2jax || \'{ inlineMath: [["$","$"],["\\\\\\\\\\\\\\\\(","\\\\\\\\\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\\\\\[","\\\\\\\\]"]], processEscapes: true }\' %>,\n TeX: $.extend({\n noUndefined: {\n attributes: {\n mathcolor: "red",\n mathbackground: "#FFEEEE",\n mathsize: "90%"\n }\n },\n Safe: {\n allow: {\n URLs: "safe",\n classes: "safe",\n cssIDs: "safe",\n styles: "safe",\n fontsize: "all"\n }\n }\n }, <%= tex %>),\n messageStyle: "none"\n});\n'}),define("libs/mathjax_init",["settings","text!libs/mathjax_config.js"],function(e,t){var n=document.createElement("script");n.type="text/x-mathjax-config",n.innerHTML=_.template(t,{tex:e.extensionSettings.mathJax?e.extensionSettings.mathJax.tex:"undefined",tex2jax:e.extensionSettings.mathJax?e.extensionSettings.mathJax.tex2jax:void 0}),document.getElementsByTagName("head")[0].appendChild(n)}),define("extensions/mathJax",["utils","classes/Extension","text!html/mathJaxSettingsBlock.html","mathjax"],function(e,t,n){function i(e,t,n){var i=u.slice(e,t+1).join("").replace(/&/g,"&").replace(//g,">");for(x.Browser.isMSIE&&(i=i.replace(/(%[^\n]*)\n/g,"$1\n \n\n\n \n\n\n \n\n\n \n\n
\n"));t>e;)u[t]="",t--;u[e]="@@"+m.length+"@@",n&&(i=n(i)),m.push(i),d=p=f=null}function r(e){d=p=f=null,m=[];var t;/`/.test(e)?(e=e.replace(/~/g,"~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm,function(e){return e.replace(/\$/g,"~D")}),t=function(e){return e.replace(/~([TD])/g,function(e,t){return{T:"~",D:"$"}[t]})}):t=function(e){return e},u=w(e.replace(/\r\n?/g,"\n"),S);for(var e=1,n=u.length;n>e;e+=2){var r=u[e];"@"===r.charAt(0)?(u[e]="@@"+m.length+"@@",m.push(r)):d?r===p?h?f=e:i(d,e,t):r.match(/\n.*\n/)?(f&&(e=f,i(d,e,t)),d=p=f=null,h=0):"{"===r?h++:"}"===r&&h&&h--:r===y||"$$"===r?(d=e,p=r,h=0):"begin"===r.substr(1,5)&&(d=e,p="\\end"+r.substr(6),h=0)}return f&&i(d,f,t),t(u.join(""))}function o(e){return e=e.replace(/@@(\d+)@@/g,function(e,t){return m[t]}),m=null,e}function a(){v=!1,x.cancelTypeset=!1,x.Queue(["Typeset",x,b]),x.Queue(c)}function s(){!v&&(v=!0,x.Cancel(),x.Queue(a))}var l=new t("mathJax","MathJax",!0);l.settingsBlock=n,l.defaultConfig={tex:"{}",tex2jax:'{ inlineMath: [["$","$"],["\\\\\\\\(","\\\\\\\\)"]], displayMath: [["$$","$$"],["\\\\[","\\\\]"]], processEscapes: true }'},l.onLoadSettings=function(){e.setInputValue("#input-mathjax-config-tex",l.config.tex),e.setInputValue("#input-mathjax-config-tex2jax",l.config.tex2jax)},l.onSaveSettings=function(t,n){t.tex=e.getInputJsValue("#input-mathjax-config-tex",n),t.tex2jax=e.getInputJsValue("#input-mathjax-config-tex2jax",n)},l.onPagedownConfigure=function(e){b=document.getElementById("preview-contents");var t=e.getConverter();t.hooks.chain("preConversion",r),t.hooks.chain("postConversion",o)};var c;l.onAsyncPreview=function(e){c=e,s()};var u,d,p,f,h,m,g=!1,v=!1,b=null,y="$",x=MathJax.Hub;x.Queue(function(){g=!0,x.processUpdateTime=50,x.Config({"HTML-CSS":{EqnChunk:10,EqnChunkFactor:1},SVG:{EqnChunk:10,EqnChunkFactor:1}})});var w,S=/(\$\$|\\(?:begin|end)\{[a-z]*\*?\}|\\[\\{}$]|[{}]|(?:\n\s*)+|@@\d+@@)/i;return w=3==="aba".split(/(b)/).length?function(e,t){return e.split(t)}:function(e,t){var n,i=[];if(!t.global){n=t.toString();var r="";n=n.replace(/^\/(.*)\/([im]*)$/,function(e,t,n){return r=n,t}),t=RegExp(n,r+"g")}for(var o=t.lastIndex=0;n=t.exec(e);)i.push(e.substring(o,n.index)),i.push.apply(i,n.slice(1)),o=n.index+n[0].length;return i.push(e.substring(o)),i},function(){var e=MathJax.Hub;if(!e.Cancel){e.cancelTypeset=!1,e.Register.StartupHook("HTML-CSS Jax Config",function(){var t=MathJax.OutputJax["HTML-CSS"],n=t.Translate;t.Augment({Translate:function(i,r){if(e.cancelTypeset||r.cancelled)throw Error("MathJax Canceled");return n.call(t,i,r)}})}),e.Register.StartupHook("SVG Jax Config",function(){var t=MathJax.OutputJax.SVG,n=t.Translate;t.Augment({Translate:function(i,r){if(e.cancelTypeset||r.cancelled)throw Error("MathJax Canceled");return n.call(t,i,r)}})}),e.Register.StartupHook("TeX Jax Config",function(){var t=MathJax.InputJax.TeX,n=t.Translate;t.Augment({Translate:function(i,r){if(e.cancelTypeset||r.cancelled)throw Error("MathJax Canceled");return n.call(t,i,r)}})});var t=e.processError;e.processError=function(n,i,r){return"MathJax Canceled"!==n.message?t.call(e,n,i,r):(MathJax.Message.Clear(0,0),i.jaxIDs=[],i.jax={},i.scripts=[],i.i=i.j=0,i.cancelled=!0,null)},e.Cancel=function(){this.cancelTypeset=!0}}}(),l}),define("text!html/partialRenderingSettingsBlock.html",[],function(){return"Renders modified sections only.
\n\n Note: Document sections are based on title elements (h1, h2...). Therefore if\n your document does not contain any title, performance will not be increased.\n"}),define("extensions/partialRendering",["underscore","crel","extensions/markdownExtra","classes/Extension","text!html/partialRenderingSettingsBlock.html"],function(e,t,n,i,r){function o(){var t=[],n="\n";if(m=!1,e.each(g,function(e){var i='\n\n\n'+e.text+"\n\n";h&&(i=i.replace(/^```.*\n[\s\S]*?\n```|\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/gm,function(e,t){return t?(m=!0,n+=e.replace(/^\s*\n/gm,"")+"\n",""):e})),i=i.replace(/^```.*\n[\s\S]*?\n```|^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(e,t){return t?(n+=e.replace(/^\s*\n/gm,"")+"\n",""):e}),t.push({id:e.id,text:i+"\n"})}),y=[],b=[],d=void 0,x===!0||u!=n)return x=!1,u=n,b=v,v=t,y=t,void 0;var i=v.length;e.some(v,function(e,n){return n>=t.length||e.text!=t[n].text?(i=n,!0):void 0});var r=-v.length;e.some(v.slice().reverse(),function(e,n){return n>=t.length||e.text!=t[t.length-n-1].text?(r=-n,!0):void 0}),i-r>v.length&&(r=i-v.length);var o=v.slice(0,i);y=t.slice(i,t.length+r);var a=v.slice(v.length+r,v.length);d=e.first(a),b=v.slice(i,v.length+r),v=o.concat(y).concat(a)}function a(e){var t=e.id.substring(3);w[t]=e}function s(){function n(n){for(var i=t("div",{id:"wmd-preview-section-"+n.id,"class":"wmd-preview-section preview-content"}),o=!1;r;){var s=r.nextSibling,l="se-preview-section-delimiter"==r.className;if(o===!0&&"DIV"==r.tagName&&l)break;o=!0,"DIV"==r.tagName&&"footnotes"==r.className?e.each(r.querySelectorAll("ol > li"),a):l||i.appendChild(r),r=s}return i}e.each(b,function(e){var t=document.getElementById("wmd-preview-section-"+e.id);f.removeChild(t)});var i=document.getElementById("wmd-preview"),r=i.firstChild,o=document.createDocumentFragment();e.each(y,function(e){o.appendChild(n(e))}),i.innerHTML="";var s=p;void 0!==d&&(s=document.getElementById("wmd-preview-section-"+d.id)),f.insertBefore(o,s),p.innerHTML="";var l=[];if(m===!0){var c=t("ol");e.each(f.querySelectorAll("a.footnote"),function(e,t){e.textContent=t+1;var n=e.id.substring(6);l.push(n),c.appendChild(w[n].cloneNode(!0))}),l.length>0&&p.appendChild(t("div",{"class":"footnotes"},t("hr"),c)),w=e.pick(w,l)}}var l=new i("partialRendering","Partial Rendering",!0);l.settingsBlock=r;var c,u,d,p,f,h=!1,m=!1,g=[],v=[],b=[],y=[],x=!1,w={};return l.onSectionsCreated=function(e){g=e},l.onPagedownConfigure=function(t){c=t.getConverter(),c.hooks.chain("preConversion",function(){o();var t=e.map(y,function(e){return e.text});return t.push(u+"\n\n"),t.join("")}),t.hooks.chain("onPreviewRefresh",function(){s()})},l.onInit=function(){n.enabled&&e.some(n.config.extensions,function(e){return"footnotes"==e})&&(h=!0)},l.onReady=function(){p=t("div",{id:"wmd-preview-section-footnotes","class":"preview-content"}),f=document.getElementById("preview-contents"),f.appendChild(p)},l.onFileSelected=function(){x=!0},l}),define("extensions/markdownSectionParser",["underscore","extensions/markdownExtra","extensions/mathJax","extensions/partialRendering","classes/Extension","crel"],function(e,t,n,i,r,o){function a(e,t){function n(e,t){var n=o.substring(a,t);u.push({id:++f,text:n,textWithFrontMatter:i+n}),i=""}if(e===p){var i=(p.frontMatter||{})._frontMatter||"",r=t.substring(i.length),o=r+"\n\n";u=[];var a=0;o.replace(d,function(e,t){n(a,t),a=t}),n(a,r.length),s.onSectionsCreated(u)}}var s,l=new r("markdownSectionParser","Markdown section parser");l.onEventMgrCreated=function(e){s=e};var c,u=[],d="^.+[ \\t]*\\n=+[ \\t]*\\n+|^.+[ \\t]*\\n-+[ \\t]*\\n+|^\\#{1,6}[ \\t]*.+?[ \\t]*\\#*\\n+";l.onPagedownConfigure=function(r){t.enabled&&e.some(t.config.extensions,function(e){return"fenced_code_gfm"==e})&&(d="^```.*\\n[\\s\\S]*?\\n```|"+d),n.enabled&&(d="^[ \\t]*\\n\\$\\$[\\s\\S]*?\\$\\$|"+d,d="^[ \\t]*\\n\\\\\\\\[[\\s\\S]*?\\\\\\\\]|"+d,d="^[ \\t]*\\n\\\\?\\\\begin\\{[a-z]*\\*?\\}[\\s\\S]*?\\\\end\\{[a-z]*\\*?\\}|"+d),d=new RegExp(d,"gm");var a=r.getConverter();i.enabled||(a.hooks.chain("preConversion",function(){return e.reduce(u,function(e,t){return e+'\n\n\n'+t.text+"\n\n"},"")}),r.hooks.chain("onPreviewRefresh",function(){function e(){for(var e=o("div",{"class":"wmd-preview-section preview-content"}),t=!1;n;){var i=n.nextSibling,r="se-preview-section-delimiter"==n.className;if(t===!0&&"DIV"==n.tagName&&r)break;t=!0,r||e.appendChild(n),n=i}return e}var t=document.getElementById("wmd-preview"),n=t.firstChild,i=document.createDocumentFragment();u.forEach(function(t){i.appendChild(e(t))}),c.innerHTML="",c.appendChild(t),c.appendChild(i)}))},l.onReady=function(){c=document.getElementById("preview-contents")};var p;l.onFileSelected=function(e){p=e};var f=0;return l.onFileOpen=a,l.onContentChanged=a,l}),define("text!html/buttonMarkdownSyntax.html",[],function(){return'\n \n'}),define("extensions/buttonMarkdownSyntax",["jquery","classes/Extension","text!html/buttonMarkdownSyntax.html"],function(e,t,n){var i=new t("buttonMarkdownSyntax",'Button "Markdown syntax',!0,!0);return i.settingsBlock='Adds a "Markdown syntax" button over the preview.
',i.onCreatePreviewButton=function(){return n},i}),define("extensions/googleAnalytics",["jquery","underscore","constants","utils","classes/Extension","settings"],function(e,t,n,i,r,o){function a(){i.currentTime-d>18e4&&(_gaq.push(["_trackPageview"]),d=i.currentTime)}var s=new r("googleAnalytics","Google Analytics",!0);s.settingsBlock="Sends anonymous statistics about usage and errors to help improve StackEdit.
";var l=!1,c=!1;window._gaq=[];var u=function(){if(l===!1&&c===!1){var t="/ga.js";location.search.match(/(\?|&)console/)&&(t="/u/ga_debug.js"),e.ajax({url:"https://ssl.google-analytics.com"+t,dataType:"script"}).done(function(){l=!0})}},d=0;s.onPeriodicRun=function(){a()},s.onReady=function(){_gaq.push(["_setAccount",n.GOOGLE_ANALYTICS_ACCOUNT_ID]),a(),_gaq.push(["_trackEvent","About","version",n.VERSION]),_gaq.push(["_trackEvent","Settings","layoutOrientation",""+o.layoutOrientation]),_gaq.push(["_trackEvent","Settings","theme",""+window.theme]),_gaq.push(["_trackEvent","Settings","lazyRendering",""+o.lazyRendering]),_gaq.push(["_trackEvent","Settings","editorFontFamily",""+o.editorFontFamily]),_gaq.push(["_trackEvent","Settings","editorFontSize",""+o.editorFontSize]),_gaq.push(["_trackEvent","Settings","defaultContent backlink",""+(-1!==o.defaultContent.indexOf(n.MAIN_URL))]),_gaq.push(["_trackEvent","Settings","commitMsg backlink",""+(-1!==o.commitMsg.indexOf(n.MAIN_URL))]),_gaq.push(["_trackEvent","Settings","sshProxy unchanged",""+(o.sshProxy==n.SSH_PROXY_URL)]),t.each(o.extensionSettings,function(e,t){_gaq.push(["_trackEvent","Extensions",t+" enabled",""+(e.enabled===!0)])}),window.onerror=function(e,t,n){_gaq.push(["_trackEvent","Error",e,t+":"+n+i.formatEventList()])},u()},s.onOfflineChanged=function(e){c=e,u()};var p=0;return s.onSyncRunning=function(e){e===!0&&(p=(new Date).getTime())},s.onPublishRunning=function(e){e===!0&&(p=(new Date).getTime())},s.onSyncSuccess=function(){var e=(new Date).getTime();_gaq.push(["_trackTiming","Sync","SyncTime",e-p])},s.onSyncImportSuccess=function(e,t){_gaq.push(["_trackEvent","Sync","SyncImport"]),_gaq.push(["_trackEvent","Sync","SyncImport provider",t.providerId])},s.onSyncExportSuccess=function(e,t){_gaq.push(["_trackEvent","Sync","SyncExport"]),_gaq.push(["_trackEvent","Sync","SyncExport provider",t.provider.providerId])},s.onPublishSuccess=function(e){var n=(new Date).getTime();_gaq.push(["_trackTiming","Publish","PublishSuccess",n-p]),t.each(e.publishLocations,function(e){_gaq.push(["_trackEvent","Publish","PublishSuccess provider",e.provider.providerId])})},s.onNewPublishSuccess=function(e,t){_gaq.push(["_trackEvent","Publish","NewPublish provider",t.provider.providerId])},s.onError=function(e){!t.isString(e)&&e.message&&_gaq.push(["_trackEvent","Error","message",e.message+i.formatEventList()])},s}),define("extensions/twitter",["jquery","underscore","constants","utils","classes/Extension"],function(e,t,n,i,r){var o=new r("twitter","Twitter",!1,!0),a=!1,s=!1,l=function(){a===!1&&s===!1&&e.ajax({url:"https://platform.twitter.com/widgets.js",dataType:"script"}).done(function(){a=!0})};return o.onReady=function(){l()},o.onOfflineChanged=function(e){s=e,l()},o.onTweet=function(){a&&window.twttr.widgets.load()},o}),define("text!html/dialogAbout.html",[],function(){return'\n\n'}),define("extensions/dialogAbout",["underscore","constants","utils","classes/Extension","text!html/dialogAbout.html"],function(e,t,n,i,r){var o=new i("dialogAbout",'Dialog "About"'),a={Bootstrap:"http://getbootstrap.com/","Bootstrap Tour":"http://bootstraptour.com/",crel:"https://github.com/KoryNunn/crel","FileSaver.js":"https://github.com/eligrey/FileSaver.js/",Fontello:"http://fontello.com/","Font Awesome and others...":"res/libs/fontello/LICENSE.txt",Gatekeeper:"https://github.com/prose/gatekeeper","Github.js":"https://github.com/michael/github","Hammer.js":"http://eightmedia.github.io/hammer.js/","Highlight.js":"http://softwaremaniacs.org/soft/highlight/en/",jGrowl:"https://github.com/stanlemon/jGrowl/",jQuery:"http://jquery.com/",jsondiffpatch:"https://github.com/benjamine/jsondiffpatch",MathJax:"http://www.mathjax.org/",Mousetrap:"http://craig.is/killing/mice",PageDown:"https://code.google.com/p/pagedown/","PageDown Extra":"https://github.com/jmcmanus/pagedown-extra/",Prettify:"https://code.google.com/p/google-code-prettify/",Prism:"http://prismjs.com/",Rangy:"https://code.google.com/p/rangy/",RequireJS:"http://requirejs.org/","RequireJS LESS plugin":"https://github.com/guybedford/require-less","stacktrace.js":"http://stacktracejs.com/","to-markdown":"https://github.com/domchristie/to-markdown","Underscore.js":"http://underscorejs.org/",waitForImages:"https://github.com/alexanderdickson/waitForImages",XRegExp:"https://github.com/slevithan/xregexp","yaml.js":"https://github.com/jeremyfa/yaml.js"},s={"StackEdit Download Proxy":"https://github.com/benweet/stackedit-download-proxy","StackEdit HTMLtoPDF":"https://github.com/benweet/stackedit-htmltopdf","StackEdit Picasa Proxy":"https://github.com/benweet/stackedit-picasa-proxy","StackEdit SSH Proxy":"https://github.com/benweet/stackedit-ssh-proxy","StackEdit Tumblr Proxy":"https://github.com/benweet/stackedit-tumblr-proxy","StackEdit WordPress Proxy":"https://github.com/benweet/stackedit-wordpress-proxy"};return o.onReady=function(){n.addModal("modal-about",e.template(r,{libraries:a,projects:s,version:t.VERSION}))},o}),define("text!html/dialogManagePublicationLocation.html",[],function(){return' \n\n'}),define("extensions/dialogManagePublication",["jquery","underscore","classes/Extension","text!html/dialogManagePublicationLocation.html"],function(e,t,n,i){var r,o=new n("dialogManagePublication",'Dialog "Manage publication"',!1,!0);o.onEventMgrCreated=function(e){r=e};var a,s,l,c=function(n){if(void 0===n||n===a){l.toggleClass("hide",0===t.size(a.publishLocations));var o=t.reduce(a.publishLocations,function(e,n){var r=t.omit(n,"provider","publishIndex","sharingLink");return r.password&&(r.password="********"),r=JSON.stringify(r).replace(/{|}|"/g,"").replace(/,/g,", "),e+t.template(i,{publishAttributes:n,publishDesc:r})},"");s.innerHTML=o,t.each(s.querySelectorAll(".remove-button"),function(t){var n=e(t),i=a.publishLocations[n.data("publishIndex")];n.click(function(){a.removePublishLocation(i),r.onPublishRemoved(a,i)})})}};return o.onFileSelected=function(e){a=e,c(e)},o.onNewPublishSuccess=c,o.onPublishRemoved=c,o.onReady=function(){var t=document.querySelector(".modal-manage-publish");s=t.querySelector(".publish-list"),l=e(document.querySelectorAll(".show-already-published"))},o}),define("text!html/dialogManageSynchronizationLocation.html",[],function(){return'\n' +}),define("extensions/dialogManageSynchronization",["jquery","underscore","classes/Extension","text!html/dialogManageSynchronizationLocation.html"],function(e,t,n,i){var r,o=new n("dialogManageSynchronization",'Dialog "Manage synchronization"',!1,!0);o.onEventMgrCreated=function(e){r=e};var a;o.onSynchronizerCreated=function(e){a=e};var s,l,c,u,d,p=function(n){if(void 0===n||n===s){t.size(s.syncLocations)>0?(c.removeClass("hide"),u.addClass("hide")):(c.addClass("hide"),u.removeClass("hide")),d.toggleClass("hide",0===t.size(s.syncLocations));var o=t.reduce(s.syncLocations,function(e,n){return e+t.template(i,{syncAttributes:n,syncDesc:n.id||n.path})},"");l.innerHTML=o,t.each(l.querySelectorAll(".remove-button"),function(t){var n=e(t),i=s.syncLocations[n.data("syncIndex")];n.click(function(){s.removeSyncLocation(i),r.onSyncRemoved(s,i)})})}};return o.onFileSelected=function(e){s=e,p(e)},o.onSyncExportSuccess=p,o.onSyncRemoved=p,o.onReady=function(){var t=document.querySelector(".modal-manage-sync");l=t.querySelector(".sync-list"),c=e(t.querySelectorAll(".msg-sync-list")),u=e(t.querySelectorAll(".msg-no-sync")),d=e(document.querySelectorAll(".show-already-synchronized"))},o}),define("text!html/dialogManageSharingLocation.html",[],function(){return' \n\n'}),define("extensions/dialogManageSharing",["jquery","underscore","classes/Extension","text!html/dialogManageSharingLocation.html"],function(e,t,n,i){var r,o=new n("dialogManageSharing",'Button "Share"',!1,!0);o.onEventMgrCreated=function(e){r=e};var a,s,l,c,u=function(e){if(void 0===e||e===a){var n=t.reduce(a.publishLocations,function(e,n){return n.sharingLink&&(e+=t.template(i,{link:n.sharingLink,title:a.title})),e},"");s.innerHTML=n,r.onTweet(),l.toggleClass("hide",0===n.length),c.toggleClass("hide",0!==n.length)}};return o.onFileSelected=function(e){a=e,u(e)},o.onNewPublishSuccess=function(t,n){u(t),n.sharingLink&&(e(".modal").modal("hide"),e(".modal-manage-sharing").modal("show"))},o.onPublishRemoved=u,o.onReady=function(){var t=document.querySelector(".modal-manage-sharing");s=t.querySelector(".share-list"),l=e(t.querySelectorAll(".msg-share-list")),c=e(t.querySelectorAll(".msg-no-share"))},o}),function(){var e=this,t={},n=!1;"undefined"!=typeof module&&module.exports?(module.exports=t,e.toMarkdown=t,n=!0):e.toMarkdown=t,t.converter=function(e){e&&e.elements&&$.isArray(e.elements)&&(c=c.concat(e.elements)),this.makeMd=function(e,t){var r;if(n){var o=require("jsdom");o.env({html:e,scripts:["http://code.jquery.com/jquery-1.6.4.min.js"],done:function(n,r){"function"==typeof t&&t(i(e,r.$))}})}else r=i(e,$);return r}};var i=function(e,t){e=e.replace(/(\d+)\. /g,"$1\\. ");var n=t(""),i=n.html(e);i.find("*:not(pre, code)").contents().filter(function(){return 3===this.nodeType&&/^\s+$/.test(this.nodeValue)}).remove();for(var r=[],o=0,s=c.length;s>o;o++)r.push(c[o].selector);for(r=r.join(",");i.find(r).length;)for(var o=0,s=c.length;s>o;o++)$matches=i.find(c[o].selector+':not(:has("'+r+'"))'),$matches.each(function(e,n){var i=t(n);i.before(c[o].replacement(i.html(),i)).remove()});return a(i.html())},r=function(e){return e.replace(/^[\n\r\f]+|[\n\r\f]+$/g,"")},o=function(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"')},a=function(e){return e=e.replace(/^[\t\r\n]+|[\t\r\n]+$/g,""),e=e.replace(/\n\s+\n/g,"\n\n"),e=e.replace(/\n{3,}/g,"\n\n"),e=o(e)},s=function(e){return e=r(e),e?"**"+e+"**":""},l=function(e){return e=r(e),e?"_"+e+"_":""},c=[{selector:"p",replacement:function(e){return e=$.trim(e),e?"\n\n"+e+"\n\n":""}},{selector:"br",replacement:function(){return"\n"}},{selector:"h1,h2,h3,h4,h5,h6",replacement:function(e,t){e=$.trim(e);for(var n=t.prop("nodeName").charAt(1),i="",r=0;n>r;r++)i+="#";return e?"\n\n"+i+" "+e+"\n\n":""}},{selector:"hr",replacement:function(){return"\n\n* * *\n\n"}},{selector:"a[href]",replacement:function(e,t){if(e){e=r(e);var n=t.attr("href"),i=t.attr("title")||"";return"["+e+"]"+"("+n+(i?' "'+i+'"':"")+")"}return!1}},{selector:"b",replacement:s},{selector:"strong",replacement:s},{selector:"i",replacement:l},{selector:"em",replacement:l},{selector:"code",replacement:function(e){return e=r(e),e?"`"+e+"`":""}},{selector:"img",replacement:function(e,t){var n=t.attr("alt")||"",i=t.attr("src")||"",r=t.attr("title")||"";return"!["+n+"]"+"("+i+(r?' "'+r+'"':"")+")"}},{selector:"pre",replacement:function(e){return/^\s*\`/.test(e)?(e=e.replace(/\`/g,"")," "+e.replace(/\n/g,"\n ")):""}},{selector:"li",replacement:function(e,t){e=e.replace(/^\s+|\s+$/,"").replace(/\n/gm,"\n ");var n="* ",i="",r=t.parent(),o=r.contents().filter(function(){return 1===this.nodeType&&"LI"===this.nodeName||3===this.nodeType}),a=o.index(t)+1;return n=r.is("ol")?a+". ":"* ",a==o.length&&(t.parents("li").length||(i="\n"),e=e.replace(/\s+$/,""),t.unwrap()),n+e+i+"\n"}},{selector:"blockquote",replacement:function(e){return e=e=$.trim(e).replace(/\n{3,}/g,"\n\n"),e=e.replace(/\n/g,"\n> "),"> "+e}}]}(),define("toMarkdown",["jquery"],function(e){return function(){var t;return t||e.toMarkdown}}(this)),define("extensions/dialogOpenHarddrive",["jquery","underscore","constants","utils","classes/Extension","toMarkdown"],function(e,t,n,i,r,o){function a(i){i.stopPropagation(),i.preventDefault();var r=(i.dataTransfer||i.target).files;e(".modal-import-harddrive-markdown, .modal-import-harddrive-html").modal("hide"),t.each(r,function(t){if(!e(i.target).is("#wmd-input *")||!t.name.match(/.(jpe?g|png|gif)$/i)){var r=new FileReader;r.onload=function(e){return function(t){var n=t.target.result;if(n.match(/\uFFFD/))return p.onError(e.name+" is a binary file."),void 0;if(n=f?f(n):n,void 0===n)return p.onError(e.name+" is not a valid HTML file."),void 0;var i=e.name,r=i.lastIndexOf(".");i=-1!==r?i.substring(0,r):i;var o=u.createFile(i,n);u.selectFile(o)}}(t);var o=t.slice(0,n.IMPORT_FILE_MAX_CONTENT_SIZE);r.readAsText(o)}})}function s(e){f=void 0,a(e)}function l(e){f=m,a(e)}function c(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"}var u,d=new r("dialogOpenHarddrive",'Dialog "Open from"');d.onFileMgrCreated=function(e){u=e};var p;d.onEventMgrCreated=function(e){p=e};var f,h,m=function(e){return h.makeMd(e)};return d.onReady=function(){h=new o.converter,e("#input-file-import-harddrive-markdown").change(s),e("#dropzone-import-harddrive-markdown, #wmd-input").each(function(){this.addEventListener("dragover",c,!1),this.addEventListener("drop",s,!1)}),e("#input-file-import-harddrive-html").change(l),e("#dropzone-import-harddrive-html").each(function(){this.addEventListener("dragover",c,!1),this.addEventListener("drop",l,!1)}),e(".action-convert-html").click(function(e){var t=i.getInputTextValue("#input-convert-html",e);if(void 0!==t){if(t=h.makeMd(t),void 0===t)return p.onError("Invalid HTML code."),void 0;var n=u.createFile(void 0,t);u.selectFile(n)}})},d}),define("extensions/documentTitle",["jquery","underscore","classes/Extension"],function(e,t,n){var i,r,o=new n("documentTitle","Document Title"),a=t.debounce(function(t){if(t===i){var n=i.title;document.title="StackEdit – "+n,r.html(i.composeTitle()),e(".file-title").text(n),e(".input-file-title").val(n)}},50);return o.onFileSelected=function(e){i=e,a(e)},o.onTitleChanged=a,o.onSyncExportSuccess=a,o.onSyncRemoved=a,o.onNewPublishSuccess=a,o.onPublishRemoved=a,o.onReady=a,o.onReady=function(){r=e(".file-title-navbar"),r.hover(function(){var e=r[0].scrollWidth-r.outerWidth();r.stop(!0,!0).animate({scrollLeft:e},15*e,"linear")},function(){r.stop(!0,!0).scrollLeft(0)}).click(function(){r.stop(!0,!0).scrollLeft(0)})},o}),function(e,t){function n(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),void 0):(e.attachEvent("on"+t,n),void 0)}function i(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return T[e.which]?T[e.which]:E[e.which]?E[e.which]:String.fromCharCode(e.which).toLowerCase()}function r(e,t){return e.sort().join(",")===t.sort().join(",")}function o(e){e=e||{};var t,n=!1;for(t in N)e[t]?n=!0:N[t]=0;n||(A=!1)}function a(e,t,n,i,o,a){var s,l,c=[],u=n.type;if(!I[e])return[];for("keyup"==u&&f(e)&&(t=[e]),s=0;s95&&112>e||T.hasOwnProperty(e)&&(S[T[e]]=e)}return S}function g(e,t,n){return n||(n=m()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function v(e,t,n,r){function a(t){return function(){A=t,++N[e],h()}}function s(t){u(n,t,e),"keyup"!==r&&(L=i(t)),setTimeout(o,10)}N[e]=0;for(var l=0;l1?(v(e,s,t,n),void 0):(o=y(e,n),I[o.key]=I[o.key]||[],a(o.key,o.modifiers,{type:o.action},i,e,r),I[o.key][i?"unshift":"push"]({callback:t,modifiers:o.modifiers,action:o.action,seq:i,level:r,combo:e}),void 0)}function w(e,t,n){for(var i=0;i ":".","?":"/","|":"\\"},_={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},I={},D={},N={},L=!1,M=!1,A=!1,R=1;20>R;++R)T[111+R]="f"+R;for(R=0;9>=R;++R)T[R+96]=R;n(t,"keypress",p),n(t,"keydown",p),n(t,"keyup",p);var P={bind:function(e,t,n){return e=e instanceof Array?e:[e],w(e,t,n),this},unbind:function(e,t){return P.bind(e,function(){},t)},trigger:function(e,t){return D[e+":"+t]&&D[e+":"+t]({},e),this},reset:function(){return I={},D={},this},stopCallback:function(e,t){return(" "+t.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},handleKey:d};e.Mousetrap=P,"function"==typeof define&&define.amd&&define("mousetrap",P)}(window,document),define("classes/FileDescriptor",["underscore","utils","storage"],function(e,t,n){function i(e,t,i,r){this.fileIndex=e,this._title=t||n[e+".title"],this._editorScrollTop=parseInt(n[e+".editorScrollTop"])||0,this._editorStart=parseInt(n[e+".editorEnd"])||0,this._editorEnd=parseInt(n[e+".editorEnd"])||0,this._previewScrollTop=parseInt(n[e+".previewScrollTop"])||0,this._selectTime=parseInt(n[e+".selectTime"])||0,this._discussionList=JSON.parse(n[e+".discussionList"]||"{}"),this.syncLocations=i||{},this.publishLocations=r||{},Object.defineProperty(this,"title",{get:function(){return this._title},set:function(e){this._title=e,n[this.fileIndex+".title"]=e}}),Object.defineProperty(this,"content",{get:function(){return n[this.fileIndex+".content"]},set:function(e){n[this.fileIndex+".content"]=e}}),Object.defineProperty(this,"editorScrollTop",{get:function(){return this._editorScrollTop},set:function(e){this._editorScrollTop=e,n[this.fileIndex+".editorScrollTop"]=e}}),Object.defineProperty(this,"editorStart",{get:function(){return this._editorStart},set:function(e){this._editorStart=e,n[this.fileIndex+".editorStart"]=e}}),Object.defineProperty(this,"editorEnd",{get:function(){return this._editorEnd},set:function(e){this._editorEnd=e,n[this.fileIndex+".editorEnd"]=e}}),Object.defineProperty(this,"previewScrollTop",{get:function(){return this._previewScrollTop},set:function(e){this._previewScrollTop=e,n[this.fileIndex+".previewScrollTop"]=e}}),Object.defineProperty(this,"selectTime",{get:function(){return this._selectTime},set:function(e){this._selectTime=e,n[this.fileIndex+".selectTime"]=e}}),Object.defineProperty(this,"discussionList",{get:function(){return this._discussionList},set:function(e){this._discussionList=e,n[this.fileIndex+".discussionList"]=JSON.stringify(e)}}),Object.defineProperty(this,"discussionListJSON",{get:function(){return n[this.fileIndex+".discussionList"]||"{}"},set:function(e){this._discussionList=JSON.parse(e),n[this.fileIndex+".discussionList"]=e}})}return i.prototype.addSyncLocation=function(e){t.storeAttributes(e),t.appendIndexToArray(this.fileIndex+".sync",e.syncIndex),this.syncLocations[e.syncIndex]=e},i.prototype.removeSyncLocation=function(e){t.removeIndexFromArray(this.fileIndex+".sync",e.syncIndex),delete this.syncLocations[e.syncIndex]},i.prototype.addPublishLocation=function(e){t.storeAttributes(e),t.appendIndexToArray(this.fileIndex+".publish",e.publishIndex),this.publishLocations[e.publishIndex]=e},i.prototype.removePublishLocation=function(e){t.removeIndexFromArray(this.fileIndex+".publish",e.publishIndex),delete this.publishLocations[e.publishIndex]},i.prototype.composeTitle=function(){var t=[];return e.chain(this.syncLocations).sortBy(function(e){return e.provider.providerId}).each(function(e){t.push('')}),0!==e.size(this.syncLocations)&&t.push(''),e.chain(this.publishLocations).sortBy(function(e){return e.provider.providerId}).each(function(e){t.push('')}),0!==e.size(this.publishLocations)&&t.push(''),t.push(e.escape(this.title)),t.join("")},i}),define("fileSystem",["underscore","utils","classes/FileDescriptor","storage"],function(e,t,n,i){var r={};return t.retrieveIndexArray("file.list").forEach(function(e){r[e]=new n(e)}),Object.keys(i).forEach(function(e){var t=e.match(/(file\.\S+?)\.\S+/);t&&!r.hasOwnProperty(t[1])&&i.removeItem(e)}),r}),define("text!html/documentSelectorSettingsBlock.html",[],function(){return' Allows toggling document with keyboard shortcuts.
\n\n'}),define("extensions/documentSelector",["jquery","underscore","crel","utils","classes/Extension","mousetrap","fileSystem","text!html/documentSelectorSettingsBlock.html"],function(e,t,n,i,r,o,a,s){var l=new r("documentSelector","Document Selector",!0);l.settingsBlock=s,l.defaultConfig={orderBy:"mru",shortcutPrevious:"Ctrl+[",shortcutNext:"Ctrl+]"},l.onLoadSettings=function(){i.setInputValue("#select-document-selector-orderby",l.config.orderBy),i.setInputValue("#input-document-selector-shortcut-previous",l.config.shortcutPrevious),i.setInputValue("#input-document-selector-shortcut-next",l.config.shortcutNext)},l.onSaveSettings=function(e,t){e.orderBy=i.getInputValue("#select-document-selector-orderby"),e.shortcutPrevious=i.getInputTextValue("#input-document-selector-shortcut-previous",t),e.shortcutNext=i.getInputTextValue("#input-document-selector-shortcut-next",t)};var c;l.onFileMgrCreated=function(e){c=e};var u,d,p,f,h,m,g,v=['\n \n\n\n \n\n\n \n\n\n \n\n\n \n\n\n \n\n" data-file-index="<%= fileDesc.fileIndex %>">',' '," <%= fileDesc.composeTitle() %>"," "," "].join(""),b=t.debounce(function(){var n=t.chain(a).sortBy(f).reduce(function(e,n){return e+t.template(v,{fileDesc:n,isCurrent:n===h})},"").value();u.innerHTML=n,p=[],d={},t.each(u.querySelectorAll("li"),function(t){var n=e(t);p.push(n);var i=a[n.data("fileIndex")];d[i.fileIndex]=n,n.find("a").click(function(){m=void 0,n.hasClass("disabled")?g.focus():c.selectFile(i)})})},50);return l.onFileSelected=function(e){h=e,b()},l.onFileCreated=b,l.onFileDeleted=b,l.onTitleChanged=b,l.onSyncExportSuccess=b,l.onSyncRemoved=b,l.onNewPublishSuccess=b,l.onPublishRemoved=b,l.onReady=function(){g=e("#wmd-input"),"title"==l.config.orderBy?f=function(e){return e.title.toLowerCase()}:"mru"==l.config.orderBy&&(f=function(e){return-e.selectTime}),u=n("ul",{"class":"dropdown-menu dropdown-file-selector"}),document.querySelector(".navbar").appendChild(n("div",n("div",{"data-toggle":"dropdown"}),u));var i=e(u).dropdown(),r=e(".document-panel .collapse-button");r.prop("title",t.template("<%= title %> <%= shortcutPrevious %> <%= shortcutNext %>",{title:r.prop("title"),shortcutPrevious:l.config.shortcutPrevious,shortcutNext:l.config.shortcutNext}));var a=l.config.shortcutPrevious.toLowerCase();o.bind(a,function(){void 0===m&&(i.dropdown("toggle"),m=d[h.fileIndex]);var e=t.indexOf(p,m)-1;return-2===e&&(e=-1),m=p[(e+p.length)%p.length],setTimeout(function(){m.find("a").focus()},10),!1});var s=l.config.shortcutNext.toLowerCase();o.bind(l.config.shortcutNext.toLowerCase(),function(){void 0===m&&(i.dropdown("toggle"),m=d[h.fileIndex]);var e=t.indexOf(p,m)+1;return m=p[e%p.length],setTimeout(function(){m.find("a").focus()},10),!1});var c=a.indexOf("+"),v=-1===c?a:a.substring(0,c),b=s.indexOf("+"),y=-1===b?s:s.substring(0,b);o.bind([v,y],function(){void 0!==m&&m.find("a").click()},"keyup")},l}),define("classes/FolderDescriptor",["underscore","utils","storage","fileSystem"],function(e,t,n,i){function r(r,o){this.folderIndex=r,this._name=o||n[r+".name"],this.fileList={},e.each(t.retrieveIndexArray(r+".files"),function(e){try{var n=i[e];n.folder=this,this.fileList[e]=n}catch(o){t.removeIndexFromArray(r+".files",e)}},this),Object.defineProperty(this,"name",{get:function(){return this._name},set:function(e){this._name=e,n[this.folderIndex+".name"]=e}})}return r.prototype.addFile=function(e){e.folder=this,t.appendIndexToArray(this.folderIndex+".files",e.fileIndex),this.fileList[e.fileIndex]=e},r.prototype.removeFile=function(e){e.folder=void 0,t.removeIndexFromArray(this.folderIndex+".files",e.fileIndex),delete this.fileList[e.fileIndex]},r}),define("folderList",["underscore","utils","storage","classes/FolderDescriptor","storage"],function(e,t,n,i){var r={};return t.retrieveIndexArray("folder.list").forEach(function(e){r[e]=new i(e)}),Object.keys(n).forEach(function(e){var t=e.match(/(folder\.\S+?)\.\S+/);t&&!r.hasOwnProperty(t[1])&&n.removeItem(e)}),r}),define("extensions/documentPanel",["jquery","underscore","utils","classes/Extension","folderList","fileSystem"],function(e,t,n,i,r,o){function a(n){if(n!=y){if(y=n,b.scrollTop=0,!n)return f.addClass("hide"),d.removeClass("hide"),void 0;var i=n.toLowerCase().split(/\s+/);t.each(p.querySelectorAll(".file"),function(n){var r=e(n),o=r.text().toLowerCase();r.toggle(!t.some(i,function(e){return-1===o.indexOf(e)}))}),f.removeClass("hide"),d.addClass("hide")}}var s,l=new i("documentPanel","Document Panel");l.onFileMgrCreated=function(e){s=e};var c,u,d,p,f,h,m=['',''," <%= _.size(folderDesc.fileList) %>","",' <%= folderDesc.name %>',"",''," <%= fileListHtml %>",""].join(""),g=['"',' data-file-index="<%= fileDesc.fileIndex %>">'," <%= fileDesc.composeTitle() %>",""].join(""),v=t.debounce(function(){var n=t.filter(o,function(e){return void 0===e.folder}),i=t.chain(n).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+""+t.template(g,{fileDesc:n,selectedFileDesc:h})+" "},"").value();i=i&&' ",t.chain(r).sortBy(function(e){return e.name.toLowerCase()}).each(function(e){var n=t.chain(e.fileList).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+""+t.template(g,{fileDesc:n,selectedFileDesc:h})+" "},"").value();n=n&&' ",i+=t.template(m,{folderDesc:e,fileListHtml:n,id:e.folderIndex.replace(".","")})}),u.innerHTML=i;var a=t.chain(o).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+""+t.template(g,{fileDesc:n,selectedFileDesc:h})+" "},"").value();a=' ",p.innerHTML=a,t.each(c.querySelectorAll(".file"),function(t){var n=e(t);n.click(function(){var e=o[n.data("fileIndex")];e&&e!==h&&s.selectFile(e)})})},50);l.onFileSelected=function(e){h=e,v()},l.onFileCreated=v,l.onFileDeleted=v,l.onTitleChanged=v,l.onSyncExportSuccess=v,l.onSyncRemoved=v,l.onNewPublishSuccess=v,l.onPublishRemoved=v,l.onFoldersChanged=v;var b,y="";return l.onReady=function(){c=document.querySelector(".document-panel"),b=c.querySelector(".panel-content"),u=c.querySelector(".document-list"),d=e(u),p=c.querySelector(".document-list-filtered"),f=e(p),e(c).on("show.layout.toggle",function(){var t=h.folder;void 0!==t&&e(c.querySelector(".file-list."+t.folderIndex.replace(".",""))).collapse("show")}).on("shown.layout.toggle",function(){var e=u.querySelector(".file.active");e&&(b.scrollTop+=e.getBoundingClientRect().top-240)}).on("hidden.layout.toggle",function(){t.val(""),a("")});var t=e(c.querySelector(".search-bar .form-control"));t.bind("propertychange keyup input paste",function(){a(t.val())})},l}),define("extensions/documentManager",["jquery","underscore","constants","utils","storage","classes/Extension","classes/FolderDescriptor","folderList","fileSystem"],function(e,t,n,i,r,o,a,s,l){function c(){N=[],D=[],t.each(b.querySelectorAll('input[type="checkbox"]:checked'),function(t){var n=e(t.parentNode.parentNode),i=s[n.data("folderIndex")],r=l[n.data("fileIndex")];void 0!==i?N.push(i):void 0!==r&&D.push(r)})}function u(){if(0===t.size(D))return d(),void 0;var n=t.chain(D).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+t.template(I,{fileDesc:n})},"").value();y.innerHTML=''+n+"
",e(v.querySelectorAll(".document-list")).addClass("hide"),e(v.querySelectorAll(".confirm-delete, .selected-document-list")).removeClass("hide")}function d(){t.each(D,function(e){e.folder&&e.folder.removeFile(e),f.deleteFile(e)}),t.each(N,function(e){i.removeIndexFromArray("folder.list",e.folderIndex),delete s[e.folderIndex]}),m.onFoldersChanged()}function p(){c(),x.toggleClass("disabled",0===t.size(s)||0===t.size(D)),w.toggleClass("disabled",0===t.size(N)&&0===t.size(D))}var f,h=new o("documentManager","Document Manager",!1,!0);h.onFileMgrCreated=function(e){f=e};var m;h.onEventMgrCreated=function(e){m=e};var g,v,b,y,x,w,S,C,T,E=['','','','','<%= _.size(folderDesc.fileList) %>','',"<%= folderDesc.name %>",'','<%= fileListHtml %>'].join(""),k=['','','','',' '].join(""),_=['','<%= fileDesc.composeTitle() %>','<%= _.size(folderDesc.fileList) %>','',"<%= folderDesc.name %>"].join(""),I=['',' '].join(""),D=[],N=[],L=t.debounce(function(){if(g!==!1){p(),C.text(t.size(l)),T.text(t.size(s)+1),S=t.filter(l,function(e){return void 0===e.folder});var n=['','','<%= fileDesc.composeTitle() %>',t.size(S),"",'',"ROOT folder"].join(""),i=t.chain(S).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+t.template(k,{fileDesc:n})},"").value();i=i&&' ",n+=''+i+"",t.chain(s).sortBy(function(e){return e.name.toLowerCase()}).each(function(e){var i=t.chain(e.fileList).sortBy(function(e){return e.title.toLowerCase()}).reduce(function(e,n){return e+t.template(k,{fileDesc:n})},"").value();i=i&&' ",n+=t.template(E,{folderDesc:e,fileListHtml:i,id:e.folderIndex.replace(".","")})}),b.innerHTML=n,t.each(b.querySelectorAll(".button-delete"),function(t){var n=e(t);n.click(function(e){e.stopPropagation();var t=n.parent(),i=s[t.data("folderIndex")],r=l[t.data("fileIndex")];D=[],N=[],i?(N.push(i),D=i.fileList):r&&D.push(r),u()})}),t.each(b.querySelectorAll(".button-rename"),function(t){var n=e(t);n.click(function(e){e.stopPropagation();var t,i=n.parent(),r=s[i.data("folderIndex")],o=l[i.data("fileIndex")];r?t=r.name:o&&(t=o.title),i.find(".name").addClass("hide"),i.find(".input-rename").removeClass("hide").val(t)[0].select()})}),t.each(b.querySelectorAll(".input-rename"),function(t){function n(){var t=i.parent(),n=e.trim(i.val()),r=s[t.data("folderIndex")],o=l[t.data("fileIndex")];n&&r&&n!=r.name?(r.name=n,m.onFoldersChanged()):n&&o&&n!=o.title?(o.title=n,m.onTitleChanged(o)):(i.addClass("hide"),t.find(".name").removeClass("hide"))}var i=e(t);i.blur(function(){n()}).keyup(function(e){13==e.keyCode&&(n(),e.stopPropagation()),27==e.keyCode&&(i.val(""),n(),e.stopPropagation())})}),t.each(b.querySelectorAll(".file .checkbox"),function(t){var n=e(t);n.click(function(e){e.stopPropagation()}).find("[type=checkbox]").change(function(){n.parents(".list-group").find(".folder [type=checkbox]").prop("checked",!1)})}),t.each(b.querySelectorAll(".folder .checkbox"),function(t){var n=e(t);n.click(function(e){e.stopPropagation()}).find("[type=checkbox]").change(function(){n.parent().next().find("[type=checkbox]").prop("checked",this.checked)})}),e(b.querySelectorAll("[type=checkbox]")).change(p)}},50);return h.onFileCreated=L,h.onFileDeleted=L,h.onSyncExportSuccess=L,h.onSyncRemoved=L,h.onNewPublishSuccess=L,h.onPublishRemoved=L,h.onFoldersChanged=L,h.onTitleChanged=function(t){g!==!1&&(e(b).find('[data-file-index="'+t.fileIndex+'"] .name').html(t.composeTitle()).removeClass("hide"),e(b.querySelectorAll(".input-rename")).addClass("hide"))},h.onReady=function(){v=document.querySelector(".modal-document-manager"),b=v.querySelector(".list-group.document-list"),C=e(v.querySelectorAll(".document-count")),T=e(v.querySelectorAll(".folder-count")),y=v.querySelector(".list-group.selected-document-list");var o=v.querySelector(".list-group.select-folder-list");e(v).on("show.bs.modal",function(){g=!0,L(),setTimeout(function(){e(b.querySelectorAll(".root-folder")).click()},250)}).on("hide.bs.modal",function(){g=!1,b.innerHTML=""}),e(v.querySelectorAll(".action-create-folder")).click(function(){var o;do o="folder."+i.randomString();while(t.has(s,o));r[o+".name"]=n.DEFAULT_FOLDER_NAME;var l=new a(o,n.DEFAULT_FOLDER_NAME);i.appendIndexToArray("folder.list",o),s[o]=l,m.onFoldersChanged(),setTimeout(function(){var t=e(v.querySelector('[data-folder-index="'+o+'"] .button-rename')).click();v.scrollTop+=t.offset().top-50},60)}),e(v.querySelectorAll(".action-select-all")).click(function(){e(b.querySelectorAll('input[type="checkbox"]')).prop("checked",!0).change()}),e(v.querySelectorAll(".action-unselect-all")).click(function(){e(b.querySelectorAll('input[type="checkbox"]')).prop("checked",!1).change()});var l=e(v.querySelectorAll(".action-delete-items")).click(function(){w.hasClass("disabled")||(c(),u())});w=l.parent(),e(v.querySelectorAll(".action-delete-items-confirm")).click(function(){d(),e(v.querySelectorAll(".document-list")).removeClass("hide"),e(v.querySelectorAll(".confirm-delete, .selected-document-list")).addClass("hide")});var p=e(v.querySelectorAll(".action-move-items")).click(function(){if(!x.hasClass("disabled")){c();var n=['','',t.size(S),"",'',"ROOT folder"].join("");n+=t.chain(s).sortBy(function(e){return e.name.toLowerCase()}).reduce(function(e,n){return e+t.template(_,{folderDesc:n})},"").value(),o.innerHTML=n,t.each(o.querySelectorAll(".folder"),function(n){n=e(n),n.click(function(){var i=s[n.data("folderIndex")]; +t.each(D,function(e){e.folder&&e.folder.removeFile(e),i&&i.addFile(e)}),m.onFoldersChanged(),e(v.querySelectorAll(".document-list")).removeClass("hide"),e(v.querySelectorAll(".choose-folder, .select-folder-list")).addClass("hide")})}),e(v.querySelectorAll(".document-list")).addClass("hide"),e(v.querySelectorAll(".choose-folder, .select-folder-list")).removeClass("hide")}});x=p.parent(),e(v.querySelectorAll(".action-cancel")).click(function(){e(v.querySelectorAll(".document-list")).removeClass("hide"),e(v.querySelectorAll(".confirm-delete, .choose-folder, .selected-document-list, .select-folder-list")).addClass("hide")})},h}),define("extensions/workingIndicator",["jquery","underscore","crel","classes/Extension"],function(e,t,n,i){var r,o,a=new i("workingIndicator","Working Indicator"),s=["@<%= prefix %>keyframes <%= name %> {"," 0% { opacity:<%= z %>; }"," <%= start %>.01% { opacity:<%= alpha %>; }"," <%= start %>.02% { opacity:1; }"," <%= ((start + trail) % 100) %>.01% { opacity:<%= alpha %>; }"," 100% { opacity:<%= z %>; }","}"].join("\n");return a.onAsyncRunning=function(e){r.toggleClass("working",e),o.toggleClass("hide",!e)},a.onReady=function(){function i(e){e.z=Math.max(1-(1-e.alpha)/e.trail*(100-e.start),e.alpha),a+=t.template(s,t.extend({prefix:""},e)),a+=t.template(s,t.extend({prefix:"-webkit-"},e))}var a="";r=e(document.body),o=e(''),e(".working-indicator").append(o);for(var l=0;3>l;l++){var c="working-indicator-bar"+l;i({name:c,alpha:.25,start:20*l,trail:50});var u=c+" 0.7s linear infinite";o.append(e('\n\n '),this.interval=setInterval(function(){e(n).data("jGrowl.instance").update()},parseInt(this.defaults.check)),t&&e(this.element).addClass("ie6")},shutdown:function(){e(this.element).removeClass("jGrowl").find("div.jGrowl-notification").remove(),clearInterval(this.interval)},close:function(){e(this.element).find("div.jGrowl-notification").each(function(){e(this).trigger("jGrowl.beforeClose")})}}),e.jGrowl.defaults=e.fn.jGrowl.prototype.defaults}(jQuery),define("jgrowl",["jquery"],function(e){return function(){var t;return t||e.jQuery.jGrowl}}(this)),define("text!html/notificationsSettingsBlock.html",[],function(){return'Shows notification messages in the bottom-right corner of the\n screen.
\n\n'}),define("extensions/notifications",["jquery","underscore","utils","logger","classes/Extension","jgrowl","text!html/notificationsSettingsBlock.html"],function(e,t,n,i,r,o,a){function s(){f===!1&&(o.defaults.life=u.config.timeout,o.defaults.closer=!1,o.defaults.closeTemplate="",o.defaults.position="bottom-right",f=!0)}function l(e,n,r){if(i.info(e),s(),e){var a=e.indexOf("|");(-1===a||(e=e.substring(0,a)))&&(r=r||{},n=n||"icon-info-circled",o(" "+t.escape(e).replace(/\n/g,"\n \n\n\n ms\n\n
"),r))}}function c(){h!==!1&&(d.toggleClass("hide",!m),p.toggleClass("hide",m))}var u=new r("notifications","Notifications");u.settingsBlock=a,u.defaultConfig={timeout:8e3},u.onLoadSettings=function(){n.setInputValue("#input-notifications-timeout",u.config.timeout)},u.onSaveSettings=function(e,t){e.timeout=n.getInputIntValue("#input-notifications-timeout",t,1,6e4)};var d,p,f=!1,h=!1;u.onReady=function(){h=!0,d=e(".navbar .offline-status"),p=e(".navbar .extension-buttons"),c()},u.onMessage=function(e){l(e)},u.onError=function(e){i.error(e),t.isString(e)?l(e,"icon-attention"):t.isObject(e)&&l(e.message,"icon-attention")};var m=!1;return u.onOfflineChanged=function(e){m=e,c(),m===!0?l("You are offline.","icon-attention-circled msg-offline"):l("You are back online!","icon-signal")},u.onSyncImportSuccess=function(e,n){var i=t.map(e,function(e){return e.title}).join(", ");l(i+" imported successfully from "+n.providerName+".")},u.onSyncExportSuccess=function(e,t){l('"'+e.title+'" will now be synchronized on '+t.provider.providerName+".")},u.onSyncRemoved=function(e,t){l(t.provider.providerName+" synchronized location has been removed.")},u.onPublishSuccess=function(e){l('"'+e.title+'" successfully published.')},u.onNewPublishSuccess=function(e,t){l('"'+e.title+'" is now published on '+t.provider.providerName+".")},u.onPublishRemoved=function(e,t){l(t.provider.providerName+" publish location has been removed.")},u}),define("text!html/buttonToc.html",[],function(){return'\n \n'}),define("text!html/tocSettingsBlock.html",[],function(){return'Generates a table of contents when a [TOC] marker is found.
\n\n'}),define("extensions/toc",["jquery","underscore","utils","classes/Extension","text!html/buttonToc.html","text!html/tocSettingsBlock.html"],function(e,t,n,i,r,o){function a(e,t,n){this.tagName=e,this.anchor=t,this.text=n,this.children=[]}function s(e,n){function i(){void 0!==r&&(r.children.length>0&&(r.children=s(r.children,n+1)),l.push(r))}n=n||1;var r,o="H"+n,l=[];return t.each(e,function(e){e.tagName!=o?n!==c.config.maxDepth&&(void 0===r&&(r=new a),r.children.push(e)):(i(),r=e)}),i(),l}function l(){function e(e){for(var r=e.id||n.slugify(e.textContent)||"title",o=r,a=0;t.has(i,o);)o=r+"-"+ ++a;return i[o]=!0,e.id=o,o}var i={},r=[];return t.each(u.querySelectorAll("h1, h2, h3, h4, h5, h6"),function(t){r.push(new a(t.tagName,e(t),t.textContent))}),r=s(r),'\n \n\n\n \n \n\n\n \n\n\n \n\n\n \n\n \n\n\n\n \n\n\n\n"}var c=new i("toc","Table of Contents",!0);c.settingsBlock=o,c.defaultConfig={marker:"\\[(TOC|toc)\\]",maxDepth:6,button:!0},c.onLoadSettings=function(){n.setInputValue("#input-toc-marker",c.config.marker),n.setInputValue("#input-toc-maxdepth",c.config.maxDepth),n.setInputChecked("#input-toc-button",c.config.button)},c.onSaveSettings=function(e,t){e.marker=n.getInputRegExpValue("#input-toc-marker",t),e.maxDepth=n.getInputIntValue("#input-toc-maxdepth"),e.button=n.getInputChecked("#input-toc-button")},c.onCreatePreviewButton=function(){return c.config.button?r:void 0},a.prototype.childrenToString=function(){if(0===this.children.length)return"";var e="\n'+r.join("")+"
\n\n";return t.each(this.children,function(t){e+=t.toString()}),e+="
\n"},a.prototype.toString=function(){var e="";return this.anchor&&this.text&&(e+=''+this.text+""),e+=this.childrenToString()+" \n"};var u;return c.onPagedownConfigure=function(e){u=document.getElementById("preview-contents");var n=new RegExp("^\\s*"+c.config.marker+"\\s*$");e.hooks.chain("onPreviewRefresh",function(){var e=document.querySelectorAll(".table-of-contents, .toc"),i=l();t.each(u.getElementsByTagName("p"),function(e){n.test(e.innerHTML)&&(e.innerHTML=i)}),t.each(e,function(e){e.innerHTML=i})})},c}),define("extensions/emailConverter",["classes/Extension"],function(e){var t=new e("emailConverter","Markdown Email",!0);return t.settingsBlock="Converts email adresses in the form <email@example.com> into clickable links.
",t.onPagedownConfigure=function(e){e.getConverter().hooks.chain("postConversion",function(e){return e.replace(/<(mailto\:)?([^\s>]+@[^\s>]+\.\S+?)>/g,function(e,t,n){return''+n+""})})},t}),define("text!html/scrollSyncSettingsBlock.html",[],function(){return"Binds together editor and preview scrollbars.
\n\n Note: The mapping between Markdown and HTML is based on the\n position of the title elements (h1, h2...) in the page. Therefore if\n your document does not contain any title, the mapping will be linear and\n consequently less accurate.\n"}),define("extensions/scrollSync",["jquery","underscore","classes/Extension","text!html/scrollSyncSettingsBlock.html"],function(e,t,n,i){var r=new n("scrollSync","Scroll Sync",!0,!0);r.settingsBlock=i,e.easing.easeOutSine=function(e){return Math.cos((1-e)*Math.PI/2)};var o;r.onSectionsCreated=function(e){o=e};var a,s,l,c,u=!0,d=[],p=[],f=t.debounce(function(){if(u){d=[];var t,n,i=a.scrollTop();a.find(".wmd-input-section").each(function(){if(void 0===t)return t=0,void 0;var n=e(this.firstChild),r=n.position().top+i;d.push({startOffset:t,endOffset:r,height:r-t}),t=r}),n=a.prop("scrollHeight"),d.push({startOffset:t,endOffset:n,height:n-t}),p=[];var r,o=s.scrollTop();s.find(".wmd-preview-section").each(function(){if(void 0===r)return r=0,void 0;var t=e(this),n=t.position().top+o;p.push({startOffset:r,endOffset:n,height:n-r}),r=n}),n=s.prop("scrollHeight"),p.push({startOffset:r,endOffset:n,height:n-r}),l=-10,c=-10,y()}},500),h=!1,m=!1,g=!1,v=!1,b=e(""),y=t.throttle(function(){function e(e,n,i){var r,o=t.find(n,function(t,n){return r=n,e'}),t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),t.prototype.constructor=t,t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},t.prototype.hasContent=function(){return this.getTitle()||this.getContent()},t.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||("function"==typeof t.content?t.content.call(e[0]):t.content)},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},t.prototype.tip=function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip};var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var i=e(this),r=i.data("bs.popover"),o="object"==typeof n&&n;r||i.data("bs.popover",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.popover.Constructor=t,e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(jQuery),+function(e){function t(n,i){var r,o=e.proxy(this.process,this);this.$element=e(n).is("body")?e(window):e(n),this.$body=e("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",o),this.options=e.extend({},t.DEFAULTS,i),this.selector=(this.options.target||(r=e(n).attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=e([]),this.targets=e([]),this.activeTarget=null,this.refresh(),this.process()}t.DEFAULTS={offset:10},t.prototype.refresh=function(){var t=this.$element[0]==window?"offset":"position";this.offsets=e([]),this.targets=e([]);var n=this;this.$body.find(this.selector).map(function(){var i=e(this),r=i.data("target")||i.attr("href"),o=/^#\w/.test(r)&&e(r);return o&&o.length&&[[o[t]().top+(!e.isWindow(n.$scrollElement.get(0))&&n.$scrollElement.scrollTop()),r]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){n.offsets.push(this[0]),n.targets.push(this[1])})},t.prototype.process=function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,n=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,i=n-this.$scrollElement.height(),r=this.offsets,o=this.targets,a=this.activeTarget;if(t>=i)return a!=(e=o.last()[0])&&this.activate(e);for(e=r.length;e--;)a!=o[e]&&t>=r[e]&&(!r[e+1]||t<=r[e+1])&&this.activate(o[e])},t.prototype.activate=function(t){this.activeTarget=t,e(this.selector).parents(".active").removeClass("active");var n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=e(n).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var i=e(this),r=i.data("bs.scrollspy"),o="object"==typeof n&&n;r||i.data("bs.scrollspy",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(jQuery),+function(e){var t=function(t){this.element=e(t)};t.prototype.show=function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=t.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var r=n.find(".active:last a")[0],o=e.Event("show.bs.tab",{relatedTarget:r});if(t.trigger(o),!o.isDefaultPrevented()){var a=e(i);this.activate(t.parent("li"),n),this.activate(a,a.parent(),function(){t.trigger({type:"shown.bs.tab",relatedTarget:r})})}}},t.prototype.activate=function(t,n,i){function r(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),a?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),i&&i()}var o=n.find("> .active"),a=i&&e.support.transition&&o.hasClass("fade");a?o.one(e.support.transition.end,r).emulateTransitionEnd(150):r(),o.removeClass("in")};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var i=e(this),r=i.data("bs.tab");r||i.data("bs.tab",r=new t(this)),"string"==typeof n&&r[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(jQuery),+function(e){var t=function(n,i){this.options=e.extend({},t.DEFAULTS,i),this.$window=e(window).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(n),this.affixed=this.unpin=null,this.checkPosition()};t.RESET="affix affix-top affix-bottom",t.DEFAULTS={offset:0},t.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},t.prototype.checkPosition=function(){if(this.$element.is(":visible")){var n=e(document).height(),i=this.$window.scrollTop(),r=this.$element.offset(),o=this.options.offset,a=o.top,s=o.bottom;"object"!=typeof o&&(s=a=o),"function"==typeof a&&(a=o.top()),"function"==typeof s&&(s=o.bottom());var l=null!=this.unpin&&i+this.unpin<=r.top?!1:null!=s&&r.top+this.$element.height()>=n-s?"bottom":null!=a&&a>=i?"top":!1;this.affixed!==l&&(this.unpin&&this.$element.css("top",""),this.affixed=l,this.unpin="bottom"==l?r.top-i:null,this.$element.removeClass(t.RESET).addClass("affix"+(l?"-"+l:"")),"bottom"==l&&this.$element.offset({top:document.body.offsetHeight-s-this.$element.height()}))}};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var i=e(this),r=i.data("bs.affix"),o="object"==typeof n&&n;r||i.data("bs.affix",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.affix.Constructor=t,e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(jQuery),define("bootstrap",function(){}),function(e,t){var n,i;return i=t.document,n=function(){function n(n){this._options=e.extend({name:"tour",container:"body",keyboard:!0,storage:t.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,duration:!1,basePath:"",template:"n&&(n=0);var i,r=s.scrollTop();if(h===!0){if(Math.abs(n-l)<=9)return;if(h=!1,l=n,i=e(n,d,p),i=t.min([i,s.prop("scrollHeight")-s.outerHeight()]),Math.abs(i-r)<=9)return c=r,void 0;b.stop("scrollSyncFx",!0).css("value",0).animate({value:i-r},{easing:"easeOutSine",duration:200,queue:"scrollSyncFx",step:function(e){v=!0,c=r+e,s.scrollTop(c)},done:function(){setTimeout(function(){v=!1},10)}}).dequeue("scrollSyncFx")}else if(m===!0){if(Math.abs(r-c)<=9)return;if(m=!1,c=r,i=e(r,p,d),i=t.min([i,a.prop("scrollHeight")-a.outerHeight()]),Math.abs(i-n)<=9)return l=n,void 0;b.stop("scrollSyncFx",!0).css("value",0).animate({value:i-n},{easing:"easeOutSine",duration:200,queue:"scrollSyncFx",step:function(e){g=!0,l=n+e,a.scrollTop(l)},done:function(){setTimeout(function(){g=!1},10)}}).dequeue("scrollSyncFx")}}},100);r.onLayoutResize=function(){h=!0,f()},r.onFileClosed=function(){d=[]};var x=!1;r.onReady=function(){s=e(".preview-container"),a=e("#wmd-input"),s.scroll(function(){v===!1&&x===!1&&(m=!0,h=!1,y()),x=!1}),a.scroll(function(){g===!1&&(h=!0,m=!1,y())}),s.on("hide.layout.toggle",function(){u=!1}),s.on("shown.layout.toggle",function(){u=!0})};var w;return r.onPagedownConfigure=function(t){w=e("#preview-contents"),t.getConverter().hooks.chain("postConversion",function(e){return w.height(w.height()),e})},r.onPreviewFinished=function(){var e=w.height();w.height("auto");var t=w.height();h=!0,e>t&&(x=!0),f()},r}),define("text!html/buttonSyncSettingsBlock.html",[],function(){return' Adds a "Synchronize documents" button in the navigation bar.
\n\n'}),define("extensions/buttonSync",["jquery","underscore","crel","utils","classes/Extension","mousetrap","text!html/buttonSyncSettingsBlock.html"],function(e,t,n,i,r,o,a){var s=new r("buttonSync",'Button "Synchronize"',!1,!0);s.settingsBlock=a,s.defaultConfig={syncPeriod:18e4,syncShortcut:"mod+s"},s.onLoadSettings=function(){i.setInputValue("#input-sync-period",s.config.syncPeriod),i.setInputValue("#input-sync-shortcut",s.config.syncShortcut)},s.onSaveSettings=function(e,t){e.syncPeriod=i.getInputIntValue("#input-sync-period",t,0),e.syncShortcut=i.getInputTextValue("#input-sync-shortcut",t)};var l;s.onSynchronizerCreated=function(e){l=e};var c,u=!1,d=!1,p=function(){void 0!==c&&(u===!0||l.hasSync()===!1||d?c.addClass("disabled"):c.removeClass("disabled"))},f=0;return s.onPeriodicRun=function(){!s.config.syncPeriod||f+s.config.syncPeriod>i.currentTime||l.sync()&&(f=i.currentTime)},s.onCreateButton=function(){var t=n("a",{"class":"btn btn-success button-synchronize",title:"Force synchronization Ctrl/Cmd+S"},n("i",{"class":"icon-refresh"}));return c=e(t),c.click(function(){c.hasClass("disabled")||l.sync()&&(f=i.currentTime)}),t},s.onReady=p,s.onFileCreated=p,s.onFileDeleted=p,s.onSyncImportSuccess=p,s.onSyncExportSuccess=p,s.onSyncRemoved=p,s.onSyncRunning=function(e){u=e,p()},s.onOfflineChanged=function(e){d=e,p()},s.onReady=function(){o.bind(s.config.syncShortcut,function(e){l.sync()&&(f=i.currentTime),e.preventDefault()}),e(".action-force-synchronization").click(function(){l.sync()&&(f=i.currentTime)})},s}),define("extensions/buttonPublish",["jquery","underscore","crel","classes/Extension"],function(e,t,n,i){function r(){void 0!==o&&(c===!0||u===!1||d===!0?o.addClass("disabled"):o.removeClass("disabled"))}var o,a,s,l=new i("buttonPublish",'Button "Publish"'),c=!1,u=!1,d=!1;l.onPublisherCreated=function(e){s=e},l.onCreateButton=function(){var t=n("a",{"class":"btn btn-success button-publish",title:"Update document publication"},n("i",{"class":"icon-upload"}));return o=e(t).click(function(){o.hasClass("disabled")||s.publish()}),t},l.onPublishRunning=function(e){c=e,r()},l.onOfflineChanged=function(e){d=e,r()};var p=function(){u=0===t.size(a.publishLocations)?!1:!0,r()};return l.onFileSelected=function(e){a=e,p()},l.onReady=function(){e(".action-update-publication").click(s.publish)},l.onPublishRemoved=p,l.onNewPublishSuccess=p,l}),define("text!html/buttonStat.html",[],function(){return'\n \n'}),define("text!html/buttonStatSettingsBlock.html",[],function(){return'\n \n\n\n ms\n\n\n \n\n\n \n\nAdds a "Document statistics" button over the preview.
\n\n\n'}),define("extensions/buttonStat",["jquery","underscore","utils","classes/Extension","text!html/buttonStat.html","text!html/buttonStatSettingsBlock.html"],function(e,t,n,i,r,o){var a=new i("buttonStat",'Button "Statistics"',!0,!0);a.settingsBlock=o,a.defaultConfig={name1:"Characters",value1:"\\S",name2:"Words",value2:"\\S+",name3:"Paragraphs",value3:"\\S.*"},a.onLoadSettings=function(){t.each([1,2,3],function(e){n.setInputValue("#input-stat-name"+e,a.config["name"+e]),n.setInputValue("#input-stat-value"+e,a.config["value"+e])})},a.onSaveSettings=function(e,i){t.each([1,2,3],function(t){e["name"+t]=n.getInputTextValue("#input-stat-name"+t,i),e["value"+t]=n.getInputRegExpValue("#input-stat-value"+t,i)})},a.onCreatePreviewButton=function(){return t.template(r,a.config)};var s,l,c,u;return a.onReady=function(){s=document.getElementById("preview-contents"),l=document.getElementById("span-stat-value1"),c=document.getElementById("span-stat-value2"),u=document.getElementById("span-stat-value3")},a.onPreviewFinished=function(){for(var e=s.cloneNode(!0),t=e.getElementsByTagName("script"),n=t.length-1;n>=0;n--){var i=t[n];i.parentNode.removeChild(i)}var r=e.textContent;l.textContent=(r.match(new RegExp(a.config.value1,"g"))||[]).length,c.textContent=(r.match(new RegExp(a.config.value2,"g"))||[]).length,u.textContent=(r.match(new RegExp(a.config.value3,"g"))||[]).length},a}),define("text!html/buttonHtmlCode.html",[],function(){return'\n \n'}),define("text!html/buttonHtmlCodeSettingsBlock.html",[],function(){return'\n \n\n\n \n\n\n \n\nAdds a "HTML code" button over the preview.
\n\n'}),define("extensions/buttonHtmlCode",["jquery","underscore","utils","classes/Extension","text!html/buttonHtmlCode.html","text!html/buttonHtmlCodeSettingsBlock.html"],function(e,t,n,i,r,o){var a=new i("buttonHtmlCode",'Button "HTML code"',!0,!0);a.settingsBlock=o,a.defaultConfig={template:"<%= documentHTML %>"},a.onLoadSettings=function(){n.setInputValue("#textarea-html-code-template",a.config.template)},a.onSaveSettings=function(e){e.template=n.getInputValue("#textarea-html-code-template")};var s;a.onEventMgrCreated=function(e){s=e},a.onCreatePreviewButton=function(){return r};var l;a.onFileSelected=function(e){l=e};var c,u;return a.onPreviewFinished=function(e,t){c=e,u=t},a.onReady=function(){var n=document.getElementById("input-html-code");e(".action-html-code").click(function(){setTimeout(function(){e("#input-html-code").each(function(){e(this).is(":hidden")||this.select()})},10)}).parent().on("show.bs.dropdown",function(){try{var e=t.template(a.config.template,{documentTitle:l.title,documentMarkdown:l.content,strippedDocumentMarkdown:l.content.substring(l.frontMatter?l.frontMatter._frontMatter.length:0),documentHTML:u,documentHTMLWithComments:c,frontMatter:l.frontMatter,publishAttributes:void 0});n.value=e}catch(i){s.onError(i)}})},a}),define("text!html/buttonViewer.html",[],function(){return'\n \n\n'}),define("extensions/buttonViewer",["jquery","classes/Extension","text!html/buttonViewer.html"],function(e,t,n){var i=new t("buttonViewer",'Button "Viewer"',!0,!0);return i.settingsBlock='\n \n\n\n \n\nAdds a "Viewer" button over the preview.
',i.onCreatePreviewButton=function(){return n},i}),"undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(e){function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(void 0!==e.style[n])return{end:t[n]}}e.fn.emulateTransitionEnd=function(t){var n=!1,i=this;e(this).one(e.support.transition.end,function(){n=!0});var r=function(){n||e(i).trigger(e.support.transition.end)};return setTimeout(r,t),this},e(function(){e.support.transition=t()})}(jQuery),+function(e){var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function n(){o.trigger("closed.bs.alert").remove()}var i=e(this),r=i.attr("data-target");r||(r=i.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));var o=e(r);t&&t.preventDefault(),o.length||(o=i.hasClass("alert")?i:i.parent()),o.trigger(t=e.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.one(e.support.transition.end,n).emulateTransitionEnd(150):n())};var i=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var i=e(this),r=i.data("bs.alert");r||i.data("bs.alert",r=new n(this)),"string"==typeof t&&r[t].call(i)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.bs.alert.data-api",t,n.prototype.close)}(jQuery),+function(e){var t=function(n,i){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,i)};t.DEFAULTS={loadingText:"loading..."},t.prototype.setState=function(e){var t="disabled",n=this.$element,i=n.is("input")?"val":"html",r=n.data();e+="Text",r.resetText||n.data("resetText",n[i]()),n[i](r[e]||this.options[e]),setTimeout(function(){"loadingText"==e?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons"]'),t=!0;if(e.length){var n=this.$element.find("input");"radio"===n.prop("type")&&(n.prop("checked")&&this.$element.hasClass("active")?t=!1:e.find(".active").removeClass("active")),t&&n.prop("checked",!this.$element.hasClass("active")).trigger("change")}t&&this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var i=e(this),r=i.data("bs.button"),o="object"==typeof n&&n;r||i.data("bs.button",r=new t(this,o)),"toggle"==n?r.toggle():n&&r.setState(n)})},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.bs.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle"),t.preventDefault()})}(jQuery),+function(e){var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},t.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},t.prototype.to=function(t){var n=this,i=this.getActiveIndex();return t>this.$items.length-1||0>t?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){n.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",e(this.$items[t]))},t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},t.prototype.next=function(){return this.sliding?void 0:this.slide("next")},t.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},t.prototype.slide=function(t,n){var i=this.$element.find(".item.active"),r=n||i[t](),o=this.interval,a="next"==t?"left":"right",s="next"==t?"first":"last",l=this;if(!r.length){if(!this.options.wrap)return;r=this.$element.find(".item")[s]()}this.sliding=!0,o&&this.pause();var c=e.Event("slide.bs.carousel",{relatedTarget:r[0],direction:a});if(!r.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var t=e(l.$indicators.children()[l.getActiveIndex()]);t&&t.addClass("active")})),e.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(c),c.isDefaultPrevented())return;r.addClass(t),r[0].offsetWidth,i.addClass(a),r.addClass(a),i.one(e.support.transition.end,function(){r.removeClass([t,a].join(" ")).addClass("active"),i.removeClass(["active",a].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(c),c.isDefaultPrevented())return;i.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return o&&this.cycle(),this}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var i=e(this),r=i.data("bs.carousel"),o=e.extend({},t.DEFAULTS,i.data(),"object"==typeof n&&n),a="string"==typeof n?n:o.slide;r||i.data("bs.carousel",r=new t(this,o)),"number"==typeof n?r.to(n):a?r[a]():o.interval&&r.pause().cycle()})},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n,i=e(this),r=e(i.attr("data-target")||(n=i.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"")),o=e.extend({},r.data(),i.data()),a=i.attr("data-slide-to");a&&(o.interval=!1),r.carousel(o),(a=i.attr("data-slide-to"))&&r.data("bs.carousel").to(a),t.preventDefault()}),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var t=e(this);t.carousel(t.data())})})}(jQuery),+function(e){var t=function(n,i){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,i),this.transitioning=null,this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.DEFAULTS={toggle:!0},t.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},t.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t=e.Event("show.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var n=this.$parent&&this.$parent.find("> .panel > .in");if(n&&n.length){var i=n.data("bs.collapse");if(i&&i.transitioning)return; +n.collapse("hide"),i||n.data("bs.collapse",null)}var r=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[r](0),this.transitioning=1;var o=function(){this.$element.removeClass("collapsing").addClass("in")[r]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return o.call(this);var a=e.camelCase(["scroll",r].join("-"));this.$element.one(e.support.transition.end,e.proxy(o,this)).emulateTransitionEnd(350)[r](this.$element[0][a])}}},t.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=e.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var n=this.dimension();this.$element[n](this.$element[n]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return e.support.transition?(this.$element[n](0).one(e.support.transition.end,e.proxy(i,this)).emulateTransitionEnd(350),void 0):i.call(this)}}},t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var i=e(this),r=i.data("bs.collapse"),o=e.extend({},t.DEFAULTS,i.data(),"object"==typeof n&&n);r||i.data("bs.collapse",r=new t(this,o)),"string"==typeof n&&r[n]()})},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(t){var n,i=e(this),r=i.attr("data-target")||t.preventDefault()||(n=i.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""),o=e(r),a=o.data("bs.collapse"),s=a?"toggle":i.data(),l=i.attr("data-parent"),c=l&&e(l);a&&a.transitioning||(c&&c.find('[data-toggle=collapse][data-parent="'+l+'"]').not(i).addClass("collapsed"),i[o.hasClass("in")?"addClass":"removeClass"]("collapsed")),o.collapse(s)})}(jQuery),+function(e){function t(){e(i).remove(),e(r).each(function(t){var i=n(e(this));i.hasClass("open")&&(i.trigger(t=e.Event("hide.bs.dropdown")),t.isDefaultPrevented()||i.removeClass("open").trigger("hidden.bs.dropdown"))})}function n(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var i=n&&e(n);return i&&i.length?i:t.parent()}var i=".dropdown-backdrop",r="[data-toggle=dropdown]",o=function(t){e(t).on("click.bs.dropdown",this.toggle)};o.prototype.toggle=function(i){var r=e(this);if(!r.is(".disabled, :disabled")){var o=n(r),a=o.hasClass("open");if(t(),!a){if("ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&e('').insertAfter(e(this)).on("click",t),o.trigger(i=e.Event("show.bs.dropdown")),i.isDefaultPrevented())return;o.toggleClass("open").trigger("shown.bs.dropdown"),r.focus()}return!1}},o.prototype.keydown=function(t){if(/(38|40|27)/.test(t.keyCode)){var i=e(this);if(t.preventDefault(),t.stopPropagation(),!i.is(".disabled, :disabled")){var o=n(i),a=o.hasClass("open");if(!a||a&&27==t.keyCode)return 27==t.which&&o.find(r).focus(),i.click();var s=e("[role=menu] li:not(.divider):visible a",o);if(s.length){var l=s.index(s.filter(":focus"));38==t.keyCode&&l>0&&l--,40==t.keyCode&&l').appendTo(document.body),this.$element.on("click.dismiss.modal",e.proxy(function(e){e.target===e.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;i?this.$backdrop.one(e.support.transition.end,t).emulateTransitionEnd(150):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t).emulateTransitionEnd(150):t()):t&&t()};var n=e.fn.modal;e.fn.modal=function(n,i){return this.each(function(){var r=e(this),o=r.data("bs.modal"),a=e.extend({},t.DEFAULTS,r.data(),"object"==typeof n&&n);o||r.data("bs.modal",o=new t(this,a)),"string"==typeof n?o[n](i):a.show&&o.show(i)})},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),i=n.attr("href"),r=e(n.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),o=r.data("modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},r.data(),n.data());t.preventDefault(),r.modal(o,this).one("hide",function(){n.is(":visible")&&n.focus()})}),e(document).on("show.bs.modal",".modal",function(){e(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){e(document.body).removeClass("modal-open")})}(jQuery),+function(e){var t=function(e,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",e,t)};t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:' ',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},t.prototype.init=function(t,n,i){this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(i);for(var r=this.options.trigger.split(" "),o=r.length;o--;){var a=r[o];if("click"==a)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=a){var s="hover"==a?"mouseenter":"focus",l="hover"==a?"mouseleave":"blur";this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},t.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,i){n[e]!=i&&(t[e]=i)}),t},t.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(n.timeout),n.hoverState="in",n.options.delay&&n.options.delay.show?(n.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show),void 0):n.show()},t.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(n.timeout),n.hoverState="out",n.options.delay&&n.options.delay.hide?(n.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide),void 0):n.hide()},t.prototype.show=function(){var t=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(t),t.isDefaultPrevented())return;var n=this.tip();this.setContent(),this.options.animation&&n.addClass("fade");var i="function"==typeof this.options.placement?this.options.placement.call(this,n[0],this.$element[0]):this.options.placement,r=/\s?auto?\s?/i,o=r.test(i);o&&(i=i.replace(r,"")||"top"),n.detach().css({top:0,left:0,display:"block"}).addClass(i),this.options.container?n.appendTo(this.options.container):n.insertAfter(this.$element);var a=this.getPosition(),s=n[0].offsetWidth,l=n[0].offsetHeight;if(o){var c=this.$element.parent(),u=i,d=document.documentElement.scrollTop||document.body.scrollTop,p="body"==this.options.container?window.innerWidth:c.outerWidth(),f="body"==this.options.container?window.innerHeight:c.outerHeight(),h="body"==this.options.container?0:c.offset().left;i="bottom"==i&&a.top+a.height+l-d>f?"top":"top"==i&&a.top-d-l<0?"bottom":"right"==i&&a.right+s>p?"left":"left"==i&&a.left-s",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){},onPause:function(){},onResume:function(){}},n),this._force=!1,this._inited=!1,this._steps=[],this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return n.prototype.setState=function(e,t){var n,i;if(this._options.storage){i=""+this._options.name+"_"+e;try{this._options.storage.setItem(i,t)}catch(r){n=r,n.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. setState failed.")}return this._options.afterSetState(i,t)}return null==this._state&&(this._state={}),this._state[e]=t},n.prototype.removeState=function(e){var t;return this._options.storage?(t=""+this._options.name+"_"+e,this._options.storage.removeItem(t),this._options.afterRemoveState(t)):null!=this._state?delete this._state[e]:void 0},n.prototype.getState=function(e){var t,n;return this._options.storage?(t=""+this._options.name+"_"+e,n=this._options.storage.getItem(t)):null!=this._state&&(n=this._state[e]),(void 0===n||"null"===n)&&(n=null),this._options.afterGetState(e,n),n},n.prototype.addSteps=function(e){var t,n,i,r;for(r=[],n=0,i=e.length;i>n;n++)t=e[n],r.push(this.addStep(t));return r},n.prototype.addStep=function(e){return this._steps.push(e)},n.prototype.getStep=function(t){return null!=this._steps[t]?e.extend({id:"step-"+t,path:"",placement:"right",title:"",content:"",next:t===this._steps.length-1?-1:t+1,prev:t-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,duration:this._options.duration,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume},this._steps[t]):void 0},n.prototype.init=function(e){var t=this;return this._force=e,this.ended()?this._debug("Tour ended, init prevented."):(this.setCurrentStep(),this._setupMouseNavigation(),this._setupKeyboardNavigation(),this._onResize(function(){return t.showStep(t._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},n.prototype.start=function(e){var t;return null==e&&(e=!1),this._inited||this.init(e),null===this._current?(t=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(t,this.showStep,0)):void 0},n.prototype.next=function(){var e;return this.ended()?this._debug("Tour ended, next prevented."):(e=this.hideStep(this._current),this._callOnPromiseDone(e,this._showNextStep))},n.prototype.prev=function(){var e;return this.ended()?this._debug("Tour ended, prev prevented."):(e=this.hideStep(this._current),this._callOnPromiseDone(e,this._showPrevStep))},n.prototype.goTo=function(e){var t;return this.ended()?this._debug("Tour ended, goTo prevented."):(t=this.hideStep(this._current),this._callOnPromiseDone(t,this.showStep,e))},n.prototype.end=function(){var n,r,o=this;return n=function(){return e(i).off("click.tour-"+o._options.name),e(i).off("keyup.tour-"+o._options.name),e(t).off("resize.tour-"+o._options.name),o.setState("end","yes"),o._inited=!1,o._force=!1,o._clearTimer(),null!=o._options.onEnd?o._options.onEnd(o):void 0},r=this.hideStep(this._current),this._callOnPromiseDone(r,n)},n.prototype.ended=function(){return!this.force&&!!this.getState("end")},n.prototype.restart=function(){return this.removeState("current_step"),this.removeState("end"),this.setCurrentStep(0),this.start()},n.prototype.pause=function(){var e;return e=this.getStep(this._current),e&&e.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,t.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=e.onPause?e.onPause(this,this._duration):void 0):void 0},n.prototype.resume=function(){var e,n=this;return e=this.getStep(this._current),e&&e.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||e.duration,this._timer=t.setTimeout(function(){return n._isLast()?n.next():n.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=e.onResume&&this._duration!==e.duration?e.onResume(this,this._duration):void 0):void 0},n.prototype.hideStep=function(t){var n,i,r,o=this;return(r=this.getStep(t))?(this._clearTimer(),i=this._makePromise(null!=r.onHide?r.onHide(this,t):void 0),n=function(){var t;return t=e(r.element),t.data("bs.popover")||t.data("popover")||(t=e("body")),t.popover("destroy"),r.reflex&&t.css("cursor","").off("click.tour-"+o._options.name),r.backdrop&&o._hideBackdrop(),null!=r.onHidden?r.onHidden(o):void 0},this._callOnPromiseDone(i,n),i):void 0},n.prototype.showStep=function(t){var n,r,o,a,s=this;return(a=this.getStep(t))?(o=t").parent().html(),i.popover({placement:t.placement,trigger:"manual",title:t.title,content:t.content,html:!0,animation:t.animation,container:t.container,template:t.template,selector:t.element}).popover("show"),a=i.data("bs.popover")?i.data("bs.popover").tip():i.data("popover").tip(),a.attr("id",t.id),this._reposition(a,t),s?this._center(a):void 0},n.prototype._reposition=function(t,n){var r,o,a,s,l,c,u;if(s=t[0].offsetWidth,o=t[0].offsetHeight,u=t.offset(),l=u.left,c=u.top,r=e(i).outerHeight()-u.top-t.outerHeight(),0>r&&(u.top=u.top+r),a=e("html").outerWidth()-u.left-t.outerWidth(),0>a&&(u.left=u.left+a),u.top<0&&(u.top=0),u.left<0&&(u.left=0),t.offset(u),"bottom"===n.placement||"top"===n.placement){if(l!==u.left)return this._replaceArrow(t,2*(u.left-l),s,"left")}else if(c!==u.top)return this._replaceArrow(t,2*(u.top-c),o,"top")},n.prototype._center=function(n){return n.css("top",e(t).outerHeight()/2-n.outerHeight()/2)},n.prototype._replaceArrow=function(e,t,n,i){return e.find(".arrow").css(i,t?50*(1-t/n)+"%":"")},n.prototype._scrollIntoView=function(n,i){var r,o,a,s,l,c=this;return n?(r=e(n),o=e(t),a=r.offset().top,l=o.height(),s=Math.max(0,a-l/2),this._debug("Scroll into view. ScrollTop: "+s+". Element offset: "+a+". Window height: "+l+"."),e("body").stop().animate({scrollTop:Math.ceil(s)},function(){return i(),c._debug("Scroll into view. Animation end element offset: "+r.offset().top+". Window height: "+o.height()+".")})):i()},n.prototype._onResize=function(n,i){return e(t).on("resize.tour-"+this._options.name,function(){return clearTimeout(i),i=setTimeout(n,100)})},n.prototype._setupMouseNavigation=function(){var t=this;return t=this,e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=next]:not(.disabled)",function(e){return e.preventDefault(),t.next()}),e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=prev]:not(.disabled)",function(e){return e.preventDefault(),t.prev()}),e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=end]",function(e){return e.preventDefault(),t.end() +}),e(i).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role=pause-resume]",function(n){var i;return n.preventDefault(),i=e(this),i.text(t._paused?i.data("pause-text"):i.data("resume-text")),t._paused?t.resume():t.pause()})},n.prototype._setupKeyboardNavigation=function(){var t=this;if(this._options.keyboard)return e(i).on("keyup.tour-"+this._options.name,function(e){if(e.which)switch(e.which){case 39:return e.preventDefault(),t._isLast()?t.next():t.end();case 37:if(e.preventDefault(),t._current>0)return t.prev();break;case 27:return e.preventDefault(),t.end()}})},n.prototype._makePromise=function(t){return t&&e.isFunction(t.then)?t:null},n.prototype._callOnPromiseDone=function(e,t,n){var i=this;return e?e.then(function(){return t.call(i,n)}):t.call(this,n)},n.prototype._showBackdrop=function(){return this.backdrop.backgroundShown?void 0:(this.backdrop=e("",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,e("body").append(this.backdrop))},n.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},n.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},n.prototype._showOverlayElement=function(t){var n,i,r;if(!this.backdrop.overlayElementShown)return this.backdrop.overlayElementShown=!0,i=e(t),n=e(""),r=i.offset(),r.top=r.top,r.left=r.left,n.width(i.innerWidth()).height(i.innerHeight()).addClass("tour-step-background").offset(r),i.addClass("tour-step-backdrop"),e("body").append(n),this.backdrop.$element=i,this.backdrop.$background=n},n.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},n.prototype._clearTimer=function(){return t.clearTimeout(this._timer),this._timer=null,this._duration=null},n}(),t.Tour=n}(jQuery,window),define("bootstrap-tour",["bootstrap"],function(e){return function(){var t;return t||e.Tour}}(this)),define("extensions/welcomeTour",["underscore","jquery","storage","classes/Extension","bootstrap-tour"],function(e,t,n,i,r){var o,a=new i("welcomeTour","Welcome tour",!1,!0);return a.onEventMgrCreated=function(e){o=e},a.onReady=function(){function i(e,n,i){var r=t(e).tooltip({html:!0,placement:i,trigger:"manual",title:n}).tooltip("show").addClass("info-tooltip");r.one("click",function(){r.tooltip("hide").removeClass("info-tooltip")}),setTimeout(function(){r.tooltip("hide").removeClass("info-tooltip")},2e4)}var a=new r({keyboard:!1,storage:{getItem:function(){},setItem:function(){},removeItem:function(){}},onEnd:function(){n.welcomeTour="done",i(".menu-panel .toggle-button *","Synchronize, publish...","right"),i(".document-panel .toggle-button *","Create, manage documents","left"),i(".extension-preview-buttons .btn-group:first","Need help with Markdown syntax?","left"),i(".layout-toggler-preview","Toggle preview","right")},template:[' ',' ',' ',' ',' ",""].join("")});a.addSteps([{element:".navbar-inner",title:"StackEdit 4 beta preview!",content:["What's new?
","","
",'- New contenteditable based editor (credit to Dabblet, Editorially...)
","- New layout with CSS3 transitions (lighter supposedly)
","- Comments/discussions support (see the new icon in the navigation bar)
","- Auto-merge and conflict detection using standard synchronization
","- Dropped real time sync support :( since you can collaborate simultaneously using standard synchronization
","Please provide your feedback here and declare issues on GitHub... Thanks!
',''].join(""),placement:"bottom",onShown:function(){o.onTweet()}}]),e.has(n,"welcomeTour")||a.start(),t(".action-welcome-tour").click(function(){a.restart()})},a}),define("text!extensions/shortcutsDefaultMapping.settings",[],function(){return"{\n 'mod+b': bindPagedownButton('bold'),\n 'mod+i': bindPagedownButton('italic'),\n 'mod+l': bindPagedownButton('link'),\n 'mod+q': bindPagedownButton('quote'),\n 'mod+k': bindPagedownButton('code'),\n 'mod+g': bindPagedownButton('image'),\n 'mod+o': bindPagedownButton('olist'),\n 'mod+u': bindPagedownButton('ulist'),\n 'mod+h': bindPagedownButton('heading'),\n 'mod+r': bindPagedownButton('hr'),\n 'mod+z': bindPagedownButton('undo'),\n 'mod+y': bindPagedownButton('redo'),\n 'mod+shift+z': bindPagedownButton('redo'),\n 'mod+m': function(evt) {\n $('.button-open-discussion').click();\n evt.preventDefault();\n },\n '= = > space': function() {\n expand('==> ', '⇒ ');\n },\n '< = = space': function() {\n expand('<== ', '⇠');\n },\n 'S t a c k E d i t': function() {\n eventMgr.onMessage(\"You are stunned!!! Aren't you?\");\n }\n}\n"}),define("text!html/shortcutsSettingsBlock.html",[],function(){return'Maps keyboard shortcuts to JavaScript functions.
\n\n\n'}),define("extensions/shortcuts",["jquery","underscore","utils","mousetrap","classes/Extension","text!extensions/shortcutsDefaultMapping.settings","text!html/shortcutsSettingsBlock.html"],function($,_,utils,mousetrap,Extension,shortcutsDefaultMapping,shortcutsSettingsBlockHTML){function bindPagedownButton(e){return function(t){pagedownEditor.uiManager.doClick(pagedownEditor.uiManager.buttons[e]),t.preventDefault()}}function expand(e,t){utils.defer(function(){require("editor").replacePreviousText(e,t)})}var shortcuts=new Extension("shortcuts","Shortcuts",!0,!0);shortcuts.settingsBlock=shortcutsSettingsBlockHTML,shortcuts.defaultConfig={mapping:shortcutsDefaultMapping};var eventMgr,pagedownEditor;return shortcuts.onEventMgrCreated=function(e){eventMgr=e,eventMgr.addListener("onPagedownConfigure",function(e){pagedownEditor=e})},shortcuts.onLoadSettings=function(){utils.setInputValue("#textarea-shortcuts-mapping",shortcuts.config.mapping)},shortcuts.onSaveSettings=function(newConfig,event){newConfig.code=utils.getInputValue("#textarea-shortcuts-mapping");try{eval("var test = "+newConfig.code)}catch(e){eventMgr.onError(e),utils.getInputTextValue("#textarea-shortcuts-mapping",event,/^$/)}},shortcuts.onInit=function(){try{var shortcutMap;eval("shortcutMap = "+shortcuts.config.mapping),_.each(shortcutMap,function(e,t){mousetrap.bind(t,e)})}catch(e){console.error(e)}},shortcuts}),define("text!html/userCustomSettingsBlock.html",[],function(){return'\n \n\n\n \n\nAllows users to implement their own extension.
\n\n\nMore info'}),define("extensions/userCustom",["jquery","underscore","utils","classes/Extension","fileSystem","settings","text!html/userCustomSettingsBlock.html"],function($,_,utils,Extension,fileSystem,settings,userCustomSettingsBlockHTML){var userCustom=new Extension("userCustom","UserCustom extension",!0);userCustom.settingsBlock=userCustomSettingsBlockHTML,userCustom.defaultConfig={code:""};var fileMgr;userCustom.onFileMgrCreated=function(e){fileMgr=e};var synchronizer;userCustom.onSynchronizerCreated=function(e){synchronizer=e};var publisher;userCustom.onPublisherCreated=function(e){publisher=e};var eventMgr;return userCustom.onEventMgrCreated=function(e){eventMgr=e},userCustom.onLoadSettings=function(){utils.setInputValue("#textarea-usercustom-code",userCustom.config.code)},userCustom.onSaveSettings=function(newConfig,event){newConfig.code=utils.getInputValue("#textarea-usercustom-code");try{eval(newConfig.code)}catch(e){eventMgr.onError(e),utils.getInputTextValue("#textarea-usercustom-code",event,/^$/)}},userCustom.onInit=function(){try{eval(userCustom.config.code)}catch(e){console.error(e)}},userCustom}),define("text!html/commentsPopoverContent.html",[],function(){return'\n \n\n\n \n\n\n\n<%= commentList %>\n\n\n\n \n \n\n\n \n\n
\n'}),define("extensions/comments",["jquery","underscore","utils","storage","crel","rangy","classes/Extension","text!html/commentsPopoverContent.html","bootstrap"],function(e,t,n,i,r,o,a,s){function l(e,t,n){t=Math.round(t);for(var i=t-21;t+22>i;)w[i]&&(t=i+22),i++;!n&&(w[t]=1);var r=-8;-1!==e.className.indexOf(" icon-split")&&(r=-12);var o=t+r;e.style.top=o+"px",e.style.right="12px"}function c(t,n){this.commentElt=t,this.$commentElt=e(t).addClass("active"),this.fileDesc=n,this.discussionIndex=t.discussionIndex}function u(e){var t=C.getPopoverElt(),n=0;t.offsetWidthi&&(t.style.top=parseInt(t.style.top)+i+"px")}function d(){C&&C.$commentElt.popover("toggle").popover("destroy")}function p(){var e=C.getDiscussion(),n=i["author.name"],r=[];return e.commentList&&(r=e.commentList.map(function(e){var i=e.author||"Anonymous";return t.template(m,{author:i,content:e.content,reply:e.author!=n})})),"conflict"==e.type&&r.unshift(t.template(m,{author:"StackEdit",content:"Multiple users have made conflicting modifications.",reply:!0})),r.join("")}var f,h=new a("comments","Comments",!1,!0),m=[" \">",'"].join(""),g=[' ',' ',' ',' '," "," “<%- title %>â€",""].join("");h.onEventMgrCreated=function(e){f=e};var v,b;h.onEditorCreated=function(e){v=e,b=v.selectionMgr};var y,x,w=[],S=r("a",{"class":"discussion icon-comment new"});c.prototype.getDiscussion=function(){return this.discussionIndex?this.fileDesc.discussionList[this.discussionIndex]:this.fileDesc.newDiscussion},c.prototype.getPopoverElt=function(){return document.querySelector(".comments-popover .popover:last-child")};var C,T,E,k,_,I,D={},N=[],L=!1,M=t.debounce(function(){function e(){var i;if(0===o.length)return t.filter(D,function(e,n){return!t.has(E.discussionList,n)}).forEach(function(e){x.removeChild(e),delete D[e.discussionIndex]}),C&&!C.discussionIndex&&(i=b.getCoordinates(C.getDiscussion().selectionEnd),l(S,i.y,!0),y.scrollTop+=parseInt(S.style.top)-y.scrollTop-3*y.offsetHeight/4,u(S)),N=t.sortBy(D,function(e){return e.selectionEnd}),_.toggleClass("some",0!==N.length),_.toggleClass("replied",L),I.toggleClass("icon-chat",0!==N.length),void 0;var a=o.shift(),s=D[a.discussionIndex];s||(s=r("a"));var c="discussion",d=!a.commentList||!n||t.last(a.commentList).author!=n;d&&(L=!0),c+="conflict"==a.type?" icon-split":" icon-comment",c+=d?" replied":" added",s.className=c,s.discussionIndex=a.discussionIndex,s.selectionEnd=a.selectionEnd,i=b.getCoordinates(a.selectionEnd),l(s,i.y),x.appendChild(s),D[a.discussionIndex]=s,C&&C.getDiscussion()===a&&(y.scrollTop+=parseInt(s.style.top)-y.scrollTop-3*y.offsetHeight/4,u(s)),k=setTimeout(e,5)}if(void 0!==E){L=!1,N=[];var n=i["author.name"];w=[];var o=t.sortBy(E.discussionList,function(e){return e.selectionEnd});clearTimeout(k),k=setTimeout(e,5)}},50);return h.onLayoutResize=M,h.onFileOpen=function(e){E=e,M()},h.onContentChanged=function(e){E===e&&M()},h.onCommentsChanged=function(e){if(E===e){if(void 0!==C){var t=C;t.discussionIndex&&(t.getPopoverElt().querySelector(".discussion-comment-list").innerHTML=p());try{T.undoToRange(t.rangyRange)}catch(n){}var i=t.getDiscussion();t.selectionRange=b.createRange(i.selectionStart,i.selectionEnd),t.rangyRange=o.createRange(),t.rangyRange.setStart(t.selectionRange.startContainer,t.selectionRange.startOffset),t.rangyRange.setEnd(t.selectionRange.endContainer,t.selectionRange.endOffset),setTimeout(function(){C===t&&T.applyToRange(t.rangyRange)},50)}M()}},h.onDiscussionCreated=function(e){E===e&&M()},h.onDiscussionRemoved=function(e,t){E===e&&(void 0!==C&&C.discussionIndex==t.discussionIndex&&d(),M())},h.onReady=function(){T=o.createCssClassApplier("comment-highlight",{normalize:!1});var a="";y=document.getElementById("wmd-input"),x=document.querySelector("#wmd-input > .editor-margin"),x.appendChild(S);var h=e(r("div",{"class":"comments-popover"}));e(document.body).append(h).on("click",function(e){C&&C.$commentElt[0]!==e.target&&d()}).popover({placement:"auto top",container:".comments-popover",html:!0,title:function(){if(!C)return!0;var e=C.getDiscussion(),n=e.selectionEnd-e.selectionStart,i=v.getValue().substr(e.selectionStart,n>20?20:n);return n>20&&(i+="..."),t.template(g,{title:i})},content:function(){var e=t.template(s,{commentList:p()});return e},selector:"#wmd-input > .editor-margin > .discussion"}),e(x).on("show.bs.popover",function(e){d();var t=new c(e.target,E);C=t;var n=t.getDiscussion();if(!n){var i=Math.min(b.selectionStart,b.selectionEnd),r=Math.max(b.selectionStart,b.selectionEnd);if(i===r){var o=b.getClosestWordOffset(i);i=o.start,r=o.end}n={selectionStart:i,selectionEnd:r,commentList:[]},E.newDiscussion=n;var a=b.getCoordinates(i);l(S,a.y,!0)}t.selectionRange=b.createRange(n.selectionStart,n.selectionEnd),y.scrollTop+=parseInt(e.target.style.top)-y.scrollTop-3*y.offsetHeight/4}).on("shown.bs.popover",function(r){var s=C,l=s.getPopoverElt();s.$authorInputElt=e(l.querySelector(".input-comment-author")).val(i["author.name"]),s.$contentInputElt=e(l.querySelector(".input-comment-content")),s.hr=l.querySelector("hr"),u(s.commentElt),l.querySelector(".scrollport").scrollTop=9999999;var c=e(l.querySelector(".action-add-comment"));e().add(s.$contentInputElt).add(s.$authorInputElt).keydown(function(e){switch(e.which){case 13:return e.preventDefault(),c.click(),void 0;case 27:return e.preventDefault(),d(),v.focus(),v.adjustCursorPosition(),void 0}}),c.click(function(e){var i=n.getInputTextValue(s.$authorInputElt),r=n.getInputTextValue(s.$contentInputElt,e);if(!e.isPropagationStopped()){var o=s.getDiscussion();s.$contentInputElt.val(""),d(),o.commentList=o.commentList||[],o.commentList.push({author:i,content:r});var a=s.fileDesc.discussionList||{};if(o.discussionIndex)s.fileDesc.discussionList=a,f.onCommentsChanged(s.fileDesc);else{var l;do l=n.randomString();while(t.has(a,l));o.discussionIndex=l,a[l]=o,s.fileDesc.discussionList=a,f.onDiscussionCreated(s.fileDesc,o)}y.focus()}});var p=e(l.querySelector(".action-remove-discussion"));r.target.discussionIndex?p.click(function(){d();var e=s.getDiscussion();delete s.fileDesc.discussionList[e.discussionIndex],s.fileDesc.discussionList=s.fileDesc.discussionList,f.onDiscussionRemoved(s.fileDesc,e),y.focus()}):p.hide(),s.rangyRange=o.createRange(),s.rangyRange.setStart(s.selectionRange.startContainer,s.selectionRange.startOffset),s.rangyRange.setEnd(s.selectionRange.endContainer,s.selectionRange.endOffset),setTimeout(function(){C===s&&T.applyToRange(s.rangyRange)},50),s.$contentInputElt.focus().val(a)}).on("hide.bs.popover",function(){C&&(C.$commentElt.removeClass("active"),a=C.$contentInputElt.val(),i["author.name"]=C.$authorInputElt.val(),T.undoToRange(C.rangyRange),C=void 0,delete E.newDiscussion)}),h.on("click",".popover",function(e){e.stopPropagation()});var m=e(S);_=e(".button-open-discussion").click(function(n){var i=m;if(C)if(C.discussionIndex){var r=-1;N.some(function(e,t){return e===C.commentElt?(r=t,!0):void 0}),i=e(N[r+1])}else i=e(t.first(N));0===i.length?(d(),v.focus(),v.adjustCursorPosition()):i.click(),n.stopPropagation()}),I=_.find("i")},h}),function(e){var t="waitForImages";e.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage"]},e.expr[":"].uncached=function(t){if(!e(t).is('img[src!=""]'))return!1;var n=new Image;return n.src=t.src,!n.complete},e.fn.waitForImages=function(n,i,r){var o=0,a=0;if(e.isPlainObject(arguments[0])&&(r=arguments[0].waitForAll,i=arguments[0].each,n=arguments[0].finished),n=n||e.noop,i=i||e.noop,r=!!r,!e.isFunction(n)||!e.isFunction(i))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var s=e(this),l=[],c=e.waitForImages.hasImageProperties||[],u=/url\(\s*(['"]?)(.*?)\1\s*\)/g;r?s.find("*").andSelf().each(function(){var t=e(this);t.is("img:uncached")&&l.push({src:t.attr("src"),element:t[0]}),e.each(c,function(e,n){var i,r=t.css(n);if(!r)return!0;for(;i=u.exec(r);)l.push({src:i[2],element:t[0]})})}):s.find("img:uncached").each(function(){l.push({src:this.src,element:this})}),o=l.length,a=0,0===o&&n.call(s[0]),e.each(l,function(r,l){var c=new Image;e(c).bind("load."+t+" error."+t,function(e){return a++,i.call(l.element,a,o,"load"==e.type),a==o?(n.call(s[0]),!1):void 0}),c.src=l.src})})}}(jQuery),define("jquery-waitforimages",function(){}),define("eventMgr",["jquery","underscore","crel","utils","logger","classes/Extension","settings","text!html/settingsExtensionsAccordion.html","extensions/yamlFrontMatterParser","extensions/markdownSectionParser","extensions/partialRendering","extensions/buttonMarkdownSyntax","extensions/googleAnalytics","extensions/twitter","extensions/dialogAbout","extensions/dialogManagePublication","extensions/dialogManageSynchronization","extensions/dialogManageSharing","extensions/dialogOpenHarddrive","extensions/documentTitle","extensions/documentSelector","extensions/documentPanel","extensions/documentManager","extensions/workingIndicator","extensions/notifications","extensions/markdownExtra","extensions/toc","extensions/mathJax","extensions/emailConverter","extensions/scrollSync","extensions/buttonSync","extensions/buttonPublish","extensions/buttonStat","extensions/buttonHtmlCode","extensions/buttonViewer","extensions/welcomeTour","extensions/shortcuts","extensions/userCustom","extensions/comments","bootstrap","jquery-waitforimages"],function(e,t,n,i,r,o,a,s){function l(e){return t.chain(p).map(function(t){return t.enabled&&t[e]}).compact().value()}function c(e){return h[e]=l(e),function(){r.log(e,arguments);var n=arguments;t.each(h[e],function(e){try{e.apply(null,n)}catch(i){console.error(t.isObject(i)?i.stack:i)}})}}function u(e){d[e]=c(e)}var d={},p=t.chain(arguments).map(function(e){return e instanceof o&&e}).compact().value(),f=a.extensionSettings||{};t.each(p,function(e){e.config=t.extend({},e.defaultConfig,f[e.extensionId]),e.enabled=window.viewerMode===!0&&e.disableInViewer===!0?!1:!e.isOptional||void 0===e.config.enabled||e.config.enabled===!0});var h={};d.addListener=function(e,t){try{h[e].push(t)}catch(n){console.error("No event listener called "+e)}},c("onInit")(),d.onLoadSettings=function(){r.log("onLoadSettings"),t.each(p,function(e){var t=!e.isOptional||void 0===e.config.enabled||e.config.enabled===!0;i.setInputChecked("#input-enable-extension-"+e.extensionId,t),"markdownExtra"==e.extensionId?i.setInputChecked("#input-settings-markdown-extra",t):"mathJax"==e.extensionId&&i.setInputChecked("#input-settings-mathjax",t);var n=e.onLoadSettings;n&&n()})},d.onSaveSettings=function(e,n){r.log("onSaveSettings"),t.each(p,function(r){var o=t.extend({},r.defaultConfig);o.enabled=i.getInputChecked("#input-enable-extension-"+r.extensionId);var a;"markdownExtra"==r.extensionId?(a=i.getInputChecked("#input-settings-markdown-extra"),a!=r.enabled&&(o.enabled=a)):"mathJax"==r.extensionId&&(a=i.getInputChecked("#input-settings-mathjax"),a!=r.enabled&&(o.enabled=a));var s=r.onSaveSettings;s&&s(o,n),e[r.extensionId]=o})},u("onMessage"),u("onError"),u("onOfflineChanged"),u("onUserActive"),u("onAsyncRunning"),u("onPeriodicRun"),u("onEditorCreated"),u("onFileMgrCreated"),u("onSynchronizerCreated"),u("onPublisherCreated"),u("onEventMgrCreated"),u("onFileCreated"),u("onFileDeleted"),u("onFileSelected"),u("onFileOpen"),u("onFileClosed"),u("onContentChanged"),u("onTitleChanged"),u("onFoldersChanged"),u("onSyncRunning"),u("onSyncSuccess"),u("onSyncImportSuccess"),u("onSyncExportSuccess"),u("onSyncRemoved"),u("onPublishRunning"),u("onPublishSuccess"),u("onNewPublishSuccess"),u("onPublishRemoved"),u("onLayoutCreated"),u("onLayoutResize"),u("onPagedownConfigure"),u("onSectionsCreated"),u("onCursorCoordinates"),u("onDiscussionCreated"),u("onDiscussionRemoved"),u("onCommentsChanged"),u("onTweet");var m,g,v=c("onPreviewFinished"),b=l("onAsyncPreview");d.onAsyncPreview=function(){function e(n){var r=n.length?n.shift():function(){setTimeout(function(){var e="";t.each(m.children,function(t){e+=t.innerHTML});var n=i.trim(e),r=n.replace(/ .*?<\/span> /g,"");v(n,r)},10)};r(function(){e(n)})}r.log("onAsyncPreview"),e(b.concat([function(e){g.waitForImages(e)}]))};var y=c("onReady");return d.onReady=function(){m=document.getElementById("preview-contents"),g=e(m);var i=function(e){var i=n("div",{"class":"btn-group"}),r=e();return t.isString(r)?i.innerHTML=r:t.isElement(r)&&i.appendChild(r),i};if(window.viewerMode===!1){var o=t.chain(p).sortBy(function(e){return e.extensionName.toLowerCase()}).reduce(function(e,n){return e+(n.settingsBlock?t.template(s,{extensionId:n.extensionId,extensionName:n.extensionName,isOptional:n.isOptional,settingsBlock:n.settingsBlock}):"")},"").value();document.querySelector(".accordion-extensions").innerHTML=o,r.log("onCreateButton");var a=l("onCreateButton"),c=document.createDocumentFragment();t.each(a,function(e){c.appendChild(i(e))}),document.querySelector(".extension-buttons").appendChild(c)}r.log("onCreatePreviewButton");var u=l("onCreatePreviewButton"),d=document.createDocumentFragment();t.each(u,function(e){d.appendChild(i(e))});var f=document.querySelector(".extension-preview-buttons");f.appendChild(d),y()},d.onEventMgrCreated(d),d}),function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var i={};for(var r in e)e.hasOwnProperty(r)&&(i[r]=t.util.clone(e[r]));return i;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var i=t.util.clone(t.languages[e]);for(var r in n)i[r]=n[r];return i},insertBefore:function(e,n,i,r){r=r||t.languages;var o=r[e],a={};for(var s in o)if(o.hasOwnProperty(s)){if(s==n)for(var l in i)i.hasOwnProperty(l)&&(a[l]=i[l]);a[s]=o[s]}return r[e]=a},DFS:function(e,n){for(var i in e)n.call(e,i,e[i]),"Object"===t.util.type(e)&&t.languages.DFS(e[i],n)}},highlightAll:function(e,n){for(var i,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),o=0;i=r[o++];)t.highlightElement(i,e===!0,n)},highlightElement:function(i,r,o){for(var a,s,l=i;l&&!e.test(l.className);)l=l.parentNode;if(l&&(a=(l.className.match(e)||[,""])[1],s=t.languages[a]),s){i.className=i.className.replace(e,"").replace(/\s+/g," ")+" language-"+a,l=i.parentNode,/pre/i.test(l.nodeName)&&(l.className=l.className.replace(e,"").replace(/\s+/g," ")+" language-"+a);var c=i.textContent;if(c){c=c.replace(/&/g,"&").replace(/e.length)break e;if(!(p instanceof i)){s.lastIndex=0;var f=s.exec(p);if(f){c&&(u=f[1].length);var h=f.index-1+u,f=f[0].slice(u),m=f.length,g=h+m,v=p.slice(0,h+1),b=p.slice(g+1),y=[d,1];v&&y.push(v);var x=new i(a,l?t.tokenize(f,l):f);y.push(x),b&&y.push(b),Array.prototype.splice.apply(r,y)}}}}return r},hooks:{all:{},add:function(e,n){var i=t.hooks.all;i[e]=i[e]||[],i[e].push(n)},run:function(e,n){var i=t.hooks.all[e];if(i&&i.length)for(var r,o=0;r=i[o++];)r(n)}}},n=t.Token=function(e,t){this.type=e,this.content=t};if(n.stringify=function(e,i,r){if("string"==typeof e)return e;if("[object Array]"==Object.prototype.toString.call(e))return e.map(function(t){return n.stringify(t,i,e)}).join("");var o={type:e.type,content:n.stringify(e.content,i,r),tag:"span",classes:["token",e.type],attributes:{},language:i,parent:r};"comment"==o.type&&(o.attributes.spellcheck="true"),t.hooks.run("wrap",o);var a="";for(var s in o.attributes)a+=s+'="'+(o.attributes[s]||"")+'"';return"<"+o.tag+' class="'+o.classes.join(" ")+'" '+a+">"+o.content+""+o.tag+">"},!self.document)return self.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,r=n.code;self.postMessage(JSON.stringify(t.tokenize(r,t.languages[i]))),self.close()},!1),void 0;var i=document.getElementsByTagName("script");i=i[i.length-1],i&&(t.filename=i.src,document.addEventListener&&!i.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll))}(),define("prism-core",function(e){return function(){var t;return t||e.Prism}}(this));var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;diff_match_patch.Diff,diff_match_patch.prototype.diff_main=function(e,t,n,i){"undefined"==typeof i&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+1e3*this.Diff_Timeout);var r=i;if(null==e||null==t)throw new Error("Null input. (diff_main)");if(e==t)return e?[[DIFF_EQUAL,e]]:[];"undefined"==typeof n&&(n=!0);var o=n,a=this.diff_commonPrefix(e,t),s=e.substring(0,a);e=e.substring(a),t=t.substring(a),a=this.diff_commonSuffix(e,t);var l=e.substring(e.length-a);e=e.substring(0,e.length-a),t=t.substring(0,t.length-a);var c=this.diff_compute_(e,t,o,r);return s&&c.unshift([DIFF_EQUAL,s]),l&&c.push([DIFF_EQUAL,l]),this.diff_cleanupMerge(c),c},diff_match_patch.prototype.diff_compute_=function(e,t,n,i){var r;if(!e)return[[DIFF_INSERT,t]];if(!t)return[[DIFF_DELETE,e]];var o=e.length>t.length?e:t,a=e.length>t.length?t:e,s=o.indexOf(a);if(-1!=s)return r=[[DIFF_INSERT,o.substring(0,s)],[DIFF_EQUAL,a],[DIFF_INSERT,o.substring(s+a.length)]],e.length>t.length&&(r[0][0]=r[2][0]=DIFF_DELETE),r;if(1==a.length)return[[DIFF_DELETE,e],[DIFF_INSERT,t]];var l=this.diff_halfMatch_(e,t);if(l){var c=l[0],u=l[1],d=l[2],p=l[3],f=l[4],h=this.diff_main(c,d,n,i),m=this.diff_main(u,p,n,i);return h.concat([[DIFF_EQUAL,f]],m)}return n&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,i):this.diff_bisect_(e,t,i)},diff_match_patch.prototype.diff_lineMode_=function(e,t,n){var i=this.diff_linesToChars_(e,t);e=i.chars1,t=i.chars2;var r=i.lineArray,o=this.diff_main(e,t,!1,n);this.diff_charsToLines_(o,r),this.diff_cleanupSemantic(o),o.push([DIFF_EQUAL,""]);for(var a=0,s=0,l=0,c="",u="";a<%= content %>',"=1&&l>=1){o.splice(a-s-l,s+l),a=a-s-l;for(var i=this.diff_main(c,u,!1,n),d=i.length-1;d>=0;d--)o.splice(a,0,i[d]);a+=i.length}l=0,s=0,c="",u=""}a++}return o.pop(),o},diff_match_patch.prototype.diff_bisect_=function(e,t,n){for(var i=e.length,r=t.length,o=Math.ceil((i+r)/2),a=o,s=2*o,l=new Array(s),c=new Array(s),u=0;s>u;u++)l[u]=-1,c[u]=-1;l[a+1]=0,c[a+1]=0;for(var d=i-r,p=0!=d%2,f=0,h=0,m=0,g=0,v=0;o>v&&!((new Date).getTime()>n);v++){for(var b=-v+f;v-h>=b;b+=2){var y,x=a+b;y=b==-v||b!=v&&l[x-1] y&&r>w&&e.charAt(y)==t.charAt(w);)y++,w++;if(l[x]=y,y>i)h+=2;else if(w>r)f+=2;else if(p){var S=a+d-b;if(S>=0&&s>S&&-1!=c[S]){var C=i-c[S];if(y>=C)return this.diff_bisectSplit_(e,t,y,w,n)}}}for(var T=-v+m;v-g>=T;T+=2){var C,S=a+T;C=T==-v||T!=v&&c[S-1] C&&r>E&&e.charAt(i-C-1)==t.charAt(r-E-1);)C++,E++;if(c[S]=C,C>i)g+=2;else if(E>r)m+=2;else if(!p){var x=a+d-T;if(x>=0&&s>x&&-1!=l[x]){var y=l[x],w=a+y-x;if(C=i-C,y>=C)return this.diff_bisectSplit_(e,t,y,w,n)}}}}return[[DIFF_DELETE,e],[DIFF_INSERT,t]]},diff_match_patch.prototype.diff_bisectSplit_=function(e,t,n,i,r){var o=e.substring(0,n),a=t.substring(0,i),s=e.substring(n),l=t.substring(i),c=this.diff_main(o,a,!1,r),u=this.diff_main(s,l,!1,r);return c.concat(u)},diff_match_patch.prototype.diff_linesToChars_=function(e,t){function n(e){for(var t="",n=0,o=-1,a=i.length;o n;)e.substring(o,r)==t.substring(o,r)?(n=r,o=n):i=r,r=Math.floor((i-n)/2+n);return r},diff_match_patch.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,i=Math.min(e.length,t.length),r=i,o=0;r>n;)e.substring(e.length-r,e.length-o)==t.substring(t.length-r,t.length-o)?(n=r,o=n):i=r,r=Math.floor((i-n)/2+n);return r},diff_match_patch.prototype.diff_commonOverlap_=function(e,t){var n=e.length,i=t.length;if(0==n||0==i)return 0;n>i?e=e.substring(n-i):i>n&&(t=t.substring(0,n));var r=Math.min(n,i);if(e==t)return r;for(var o=0,a=1;;){var s=e.substring(r-a),l=t.indexOf(s);if(-1==l)return o;a+=l,(0==l||e.substring(r-a)==t.substring(0,a))&&(o=a,a++)}},diff_match_patch.prototype.diff_halfMatch_=function(e,t){function n(e,t,n){for(var i,r,o,s,l=e.substring(n,n+Math.floor(e.length/4)),c=-1,u="";-1!=(c=t.indexOf(l,c+1));){var d=a.diff_commonPrefix(e.substring(n),t.substring(c)),p=a.diff_commonSuffix(e.substring(0,n),t.substring(0,c)); +u.length =e.length?[i,r,o,s,u]:null}if(this.Diff_Timeout<=0)return null;var i=e.length>t.length?e:t,r=e.length>t.length?t:e;if(i.length<4||2*r.length
l[4].length?s:l:l:s;var c,u,d,p;e.length>t.length?(c=o[0],u=o[1],d=o[2],p=o[3]):(d=o[0],p=o[1],c=o[2],u=o[3]);var f=o[4];return[c,u,d,p,f]},diff_match_patch.prototype.diff_cleanupSemantic=function(e){for(var t=!1,n=[],i=0,r=null,o=0,a=0,s=0,l=0,c=0;o 0?n[i-1]:-1,a=0,s=0,l=0,c=0,r=null,t=!0)),o++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),o=1;o =f?(p>=u.length/2||p>=d.length/2)&&(e.splice(o,0,[DIFF_EQUAL,d.substring(0,p)]),e[o-1][1]=u.substring(0,u.length-p),e[o+1][1]=d.substring(p),o++):(f>=u.length/2||f>=d.length/2)&&(e.splice(o,0,[DIFF_EQUAL,u.substring(0,f)]),e[o-1][0]=DIFF_INSERT,e[o-1][1]=d.substring(0,d.length-f),e[o+1][0]=DIFF_DELETE,e[o+1][1]=u.substring(f),o++),o++}o++}},diff_match_patch.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),i=t.charAt(0),r=n.match(diff_match_patch.nonAlphaNumericRegex_),o=i.match(diff_match_patch.nonAlphaNumericRegex_),a=r&&n.match(diff_match_patch.whitespaceRegex_),s=o&&i.match(diff_match_patch.whitespaceRegex_),l=a&&n.match(diff_match_patch.linebreakRegex_),c=s&&i.match(diff_match_patch.linebreakRegex_),u=l&&e.match(diff_match_patch.blanklineEndRegex_),d=c&&t.match(diff_match_patch.blanklineStartRegex_);return u||d?5:l||c?4:r&&!a&&s?3:a||s?2:r||o?1:0}for(var n=1;n =d&&(d=p,l=i,c=r,u=o)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=c,u?e[n+1][1]=u:(e.splice(n+1,1),n--))}n++}},diff_match_patch.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,diff_match_patch.whitespaceRegex_=/\s/,diff_match_patch.linebreakRegex_=/[\r\n]/,diff_match_patch.blanklineEndRegex_=/\n\r?\n$/,diff_match_patch.blanklineStartRegex_=/^\r?\n\r?\n/,diff_match_patch.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,n=[],i=0,r=null,o=0,a=!1,s=!1,l=!1,c=!1;o 0?n[i-1]:-1,l=c=!1),t=!0)),o++;t&&this.diff_cleanupMerge(e)},diff_match_patch.prototype.diff_cleanupMerge=function(e){e.push([DIFF_EQUAL,""]);for(var t,n=0,i=0,r=0,o="",a="";n 1?(0!==i&&0!==r&&(t=this.diff_commonPrefix(a,o),0!==t&&(n-i-r>0&&e[n-i-r-1][0]==DIFF_EQUAL?e[n-i-r-1][1]+=a.substring(0,t):(e.splice(0,0,[DIFF_EQUAL,a.substring(0,t)]),n++),a=a.substring(t),o=o.substring(t)),t=this.diff_commonSuffix(a,o),0!==t&&(e[n][1]=a.substring(a.length-t)+e[n][1],a=a.substring(0,a.length-t),o=o.substring(0,o.length-t))),0===i?e.splice(n-r,i+r,[DIFF_INSERT,a]):0===r?e.splice(n-i,i+r,[DIFF_DELETE,o]):e.splice(n-i-r,i+r,[DIFF_DELETE,o],[DIFF_INSERT,a]),n=n-i-r+(i?1:0)+(r?1:0)+1):0!==n&&e[n-1][0]==DIFF_EQUAL?(e[n-1][1]+=e[n][1],e.splice(n,1)):n++,r=0,i=0,o="",a=""}""===e[e.length-1][1]&&e.pop();var s=!1;for(n=1;n t));n++)o=i,a=r;return e.length!=n&&e[n][0]===DIFF_DELETE?a:a+(t-o)},diff_match_patch.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,i=//g,o=/\n/g,a=0;a ");switch(s){case DIFF_INSERT:t[a]=''+c+"";break;case DIFF_DELETE:t[a]=' '+c+"";break;case DIFF_EQUAL:t[a]=""+c+""}}return t.join("")},diff_match_patch.prototype.diff_text1=function(e){for(var t=[],n=0;nc)throw new Error("Invalid number in diff_fromDelta: "+s);var u=e.substring(r,r+=c);n[i++]="="==o[a].charAt(0)?[DIFF_EQUAL,u]:[DIFF_DELETE,u];break;default:if(o[a])throw new Error("Invalid diff operation in diff_fromDelta: "+o[a])}}if(r!=e.length)throw new Error("Delta length ("+r+") does not equal source text length ("+e.length+").");return n},diff_match_patch.prototype.match_main=function(e,t,n){if(null==e||null==t||null==n)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},diff_match_patch.prototype.match_bitap_=function(e,t,n){function i(e,i){var r=e/t.length,a=Math.abs(n-i);return o.Match_Distance?r+a/o.Match_Distance:a?1:r}if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var r=this.match_alphabet_(t),o=this,a=this.Match_Threshold,s=e.indexOf(t,n);-1!=s&&(a=Math.min(i(0,s),a),s=e.lastIndexOf(t,n+t.length),-1!=s&&(a=Math.min(i(0,s),a)));var l=1< c;)i(f,n+u)<=a?c=u:p=u,u=Math.floor((p-c)/2+c);p=u;var h=Math.max(1,n-u+1),m=Math.min(n+u,e.length)+t.length,g=Array(m+2);g[m+1]=(1< =h;v--){var b=r[e.charAt(v-1)];if(g[v]=0===f?(1|g[v+1]<<1)&b:(1|g[v+1]<<1)&b|(1|(d[v+1]|d[v])<<1)|d[v+1],g[v]&l){var y=i(f,v-1);if(a>=y){if(a=y,s=v-1,!(s>n))break;h=Math.max(1,2*n-s)}}}if(i(f+1,n)>a)break;d=g}return s},diff_match_patch.prototype.match_alphabet_=function(e){for(var t={},n=0;n 2&&(this.diff_cleanupSemantic(r),this.diff_cleanupEfficiency(r));else if(e&&"object"==typeof e&&"undefined"==typeof t&&"undefined"==typeof n)r=e,i=this.diff_text1(r);else if("string"==typeof e&&t&&"object"==typeof t&&"undefined"==typeof n)i=e,r=t;else{if("string"!=typeof e||"string"!=typeof t||!n||"object"!=typeof n)throw new Error("Unknown call format to patch_make.");i=e,r=n}if(0===r.length)return[];for(var o=[],a=new diff_match_patch.patch_obj,s=0,l=0,c=0,u=i,d=i,p=0;p =2*this.Patch_Margin&&s&&(this.patch_addContext_(a,u),o.push(a),a=new diff_match_patch.patch_obj,s=0,u=d,l=c)}f!==DIFF_INSERT&&(l+=h.length),f!==DIFF_DELETE&&(c+=h.length)}return s&&(this.patch_addContext_(a,u),o.push(a)),o},diff_match_patch.prototype.patch_deepCopy=function(e){for(var t=[],n=0;n this.Match_MaxBits?(a=this.match_main(t,l.substring(0,this.Match_MaxBits),s),-1!=a&&(c=this.match_main(t,l.substring(l.length-this.Match_MaxBits),s+l.length-this.Match_MaxBits),(-1==c||a>=c)&&(a=-1))):a=this.match_main(t,l,s),-1==a)r[o]=!1,i-=e[o].length2-e[o].length1;else{r[o]=!0,i=a-s;var u;if(u=-1==c?t.substring(a,a+l.length):t.substring(a,c+this.Match_MaxBits),l==u)t=t.substring(0,a)+this.diff_text2(e[o].diffs)+t.substring(a+l.length);else{var d=this.diff_main(l,u,!1);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(d)/l.length>this.Patch_DeleteThreshold)r[o]=!1;else{this.diff_cleanupSemanticLossless(d);for(var p,f=0,h=0;h =i;i++)n+=String.fromCharCode(i);for(var i=0;i o[0][1].length){var a=t-o[0][1].length;o[0][1]=n.substring(o[0][1].length)+o[0][1],r.start1-=a,r.start2-=a,r.length1+=a,r.length2+=a}if(r=e[e.length-1],o=r.diffs,0==o.length||o[o.length-1][0]!=DIFF_EQUAL)o.push([DIFF_EQUAL,n]),r.length1+=t,r.length2+=t;else if(t>o[o.length-1][1].length){var a=t-o[o.length-1][1].length;o[o.length-1][1]+=n.substring(0,a),r.length1+=a,r.length2+=a}return n},diff_match_patch.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,n=0;n 2*t?(s.length1+=u.length,r+=u.length,l=!1,s.diffs.push([c,u]),i.diffs.shift()):(u=u.substring(0,t-s.length1-this.Patch_Margin),s.length1+=u.length,r+=u.length,c===DIFF_EQUAL?(s.length2+=u.length,o+=u.length):l=!1,s.diffs.push([c,u]),u==i.diffs[0][1]?i.diffs.shift():i.diffs[0][1]=i.diffs[0][1].substring(u.length))}a=this.diff_text2(s.diffs),a=a.substring(a.length-this.Patch_Margin);var d=this.diff_text1(i.diffs).substring(0,this.Patch_Margin);""!==d&&(s.length1+=d.length,s.length2+=d.length,0!==s.diffs.length&&s.diffs[s.diffs.length-1][0]===DIFF_EQUAL?s.diffs[s.diffs.length-1][1]+=d:s.diffs.push([DIFF_EQUAL,d])),l||e.splice(++n,0,s)}}},diff_match_patch.prototype.patch_toText=function(e){for(var t=[],n=0;n 0)){var i=n.shift();i()}},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),n.title="browser",n.browser=!0,n.env={},n.argv=[],n.binding=function(){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(){throw new Error("process.chdir is not supported")}},{}],2:[function(e,t,n){var i=e("../pipe").Pipe,r=function(){};r.prototype.setResult=function(e){return this.result=e,this.hasResult=!0,this},r.prototype.exit=function(){return this.exiting=!0,this},r.prototype.switchTo=function(e,t){return"string"==typeof e||e instanceof i?this.nextPipe=e:(this.next=e,t&&(this.nextPipe=t)),this},r.prototype.push=function(e,t){return e.parent=this,"undefined"!=typeof t&&(e.childName=t),e.root=this.root||this,e.options=e.options||this.options,this.children?(this.children[this.children.length-1].next=e,this.children.push(e)):(this.children=[e],this.nextAfterChildren=this.next||null,this.next=e),e.next=this,this},n.Context=r},{"../pipe":15}],3:[function(e,t,n){var i=e("./context").Context,r=function(e,t){this.left=e,this.right=t,this.pipe="diff"};r.prototype=new i,n.DiffContext=r},{"./context":2}],4:[function(e,t,n){var i=e("./context").Context,r=function(e,t){this.left=e,this.delta=t,this.pipe="patch"};r.prototype=new i,n.PatchContext=r},{"./context":2}],5:[function(e,t,n){var i=e("./context").Context,r=function(e){this.delta=e,this.pipe="reverse"};r.prototype=new i,n.ReverseContext=r},{"./context":2}],6:[function(e,t){t.exports=function(e,t){var n;return"string"==typeof t&&(n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)(Z|([+\-])(\d{2}):(\d{2}))$/.exec(t))?new Date(Date.UTC(+n[1],+n[2]-1,+n[3],+n[4],+n[5],+n[6])):t}},{}],7:[function(e,t,n){var i=e("./processor").Processor,r=e("./pipe").Pipe,o=e("./contexts/diff").DiffContext,a=e("./contexts/patch").PatchContext,s=e("./contexts/reverse").ReverseContext,l=e("./filters/trivial"),c=e("./filters/nested"),u=e("./filters/arrays"),d=e("./filters/dates"),p=e("./filters/texts"),f=function(e){this.processor=new i(e),this.processor.pipe(new r("diff").append(c.collectChildrenDiffFilter,l.diffFilter,d.diffFilter,p.diffFilter,c.objectsDiffFilter,u.diffFilter).shouldHaveResult()),this.processor.pipe(new r("patch").append(c.collectChildrenPatchFilter,u.collectChildrenPatchFilter,l.patchFilter,p.patchFilter,c.patchFilter,u.patchFilter).shouldHaveResult()),this.processor.pipe(new r("reverse").append(c.collectChildrenReverseFilter,u.collectChildrenReverseFilter,l.reverseFilter,p.reverseFilter,c.reverseFilter,u.reverseFilter).shouldHaveResult())};f.prototype.options=function(){return this.processor.options.apply(this.processor,arguments)},f.prototype.diff=function(e,t){return this.processor.process(new o(e,t))},f.prototype.patch=function(e,t){return this.processor.process(new a(e,t))},f.prototype.reverse=function(e){return this.processor.process(new s(e))},f.prototype.unpatch=function(e,t){return this.patch(e,this.reverse(t))},n.DiffPatcher=f},{"./contexts/diff":3,"./contexts/patch":4,"./contexts/reverse":5,"./filters/arrays":9,"./filters/dates":10,"./filters/nested":12,"./filters/texts":13,"./filters/trivial":14,"./pipe":15,"./processor":16}],8:[function(e,t,n){(function(t){var i=e("./diffpatcher").DiffPatcher;n.DiffPatcher=i,n.create=function(e){return new i(e)},n.dateReviver=e("./date-reviver");var r;n.diff=function(){return r||(r=new i),r.diff.apply(r,arguments)},n.patch=function(){return r||(r=new i),r.patch.apply(r,arguments)},n.unpatch=function(){return r||(r=new i),r.unpatch.apply(r,arguments)},n.reverse=function(){return r||(r=new i),r.reverse.apply(r,arguments)};var o="undefined"!=typeof t&&"string"==typeof t.execPath;if(o){var a=e("./formatters/index");n.formatters=a,n.console=a.console}else n.homepage="https://github.com/benjamine/jsondiffpatch",n.version="0.1.5"}).call(this,e("/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./date-reviver":6,"./diffpatcher":7,"/home/sheila/proj/JsonDiffPatch/node_modules/gulp-browserify/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":1}],9:[function(e,t,n){var i=e("../contexts/diff").DiffContext,r=e("../contexts/patch").PatchContext,o=e("../contexts/reverse").ReverseContext,a=e("./lcs"),s=3,l="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},c="function"==typeof Array.prototype.indexOf?function(e,t){return e.indexOf(t)}:function(e,t){for(var n=e.length,i=0;n>i;i++)if(e[i]===t)return i;return-1},u=function(e){if(e.leftIsArray){for(var t,n,r,o,l=e.options&&e.options.objectHash,u=function(e,t,n,i,r){var o=e[n],a=t[i];if(o===a)return!0;if("object"!=typeof o||"object"!=typeof a)return!1;if(!l)return!1;var s,c;return"number"==typeof n?(r.hashCache1=r.hashCache1||[],s=r.hashCache1[n],"undefined"==typeof s&&(r.hashCache1[n]=s=l(o,n))):s=l(o),"undefined"==typeof s?!1:("number"==typeof i?(r.hashCache2=r.hashCache2||[],c=r.hashCache2[i],"undefined"==typeof c&&(r.hashCache2[i]=c=l(a,i))):c=l(a),"undefined"==typeof c?!1:s===c)},d={},p=0,f=0,h=e.left,m=e.right,g=h.length,v=m.length;g>p&&v>p&&u(h,m,p,p,d);)t=p,o=new i(e.left[t],e.right[t]),e.push(o,t),p++;for(;g>f+p&&v>f+p&&u(h,m,g-1-f,v-1-f,d);)n=g-1-f,r=v-1-f,o=new i(e.left[n],e.right[r]),e.push(o,r),f++;var b;if(p+f===g){if(g===v)return e.setResult(void 0).exit(),void 0;for(b=b||{_t:"a"},t=p;v-f>t;t++)b[t]=[m[t]];return e.setResult(b).exit(),void 0}if(p+f===v){for(b=b||{_t:"a"},t=p;g-f>t;t++)b["_"+t]=[h[t],0,0];return e.setResult(b).exit(),void 0}d={};var y=h.slice(p,g-f),x=m.slice(p,v-f),w=a.get(y,x,u,d),S=[];for(b=b||{_t:"a"},t=p;g-f>t;t++)c(w.indices1,t-p)<0&&(b["_"+t]=[h[t],0,0],S.push(t));var C=!0;e.options&&e.options.arrays&&e.options.arrays.detectMove===!1&&(C=!1);var T=!1;e.options&&e.options.arrays&&e.options.arrays.includeValueOnMove&&(T=!0);var E=S.length;for(t=p;v-f>t;t++){var k=c(w.indices2,t-p);if(0>k){var _=!1;if(C&&E>0)for(n=0;E>n;n++)if(u(y,x,S[n]-p,t-p,d)){b["_"+S[n]].splice(1,2,t,s),T||(b["_"+S[n]][0]=""),n=S[n],r=t,o=new i(e.left[n],e.right[r]),e.push(o,r),S.splice(n,1),_=!0;break}_||(b[t]=[m[t]])}else n=w.indices1[k]+p,r=w.indices2[k]+p,o=new i(e.left[n],e.right[r]),e.push(o,r)}e.setResult(b).exit()}};u.filterName="arrays";var d={numerically:function(e,t){return e-t},numericallyBy:function(e){return function(t,n){return t[e]-n[e]}}},p=function(e){if(e.nested&&"a"===e.delta._t){var t,n,i=e.delta,o=e.left,a=[],l=[],c=[];for(t in i)if("_t"!==t)if("_"===t[0]){if(0!==i[t][2]&&i[t][2]!==s)throw new Error("only removal or move can be applied at original array indices, invalid diff type: "+i[t][2]);a.push(parseInt(t.slice(1),10))}else 1===i[t].length?l.push({index:parseInt(t,10),value:i[t][0]}):c.push({index:parseInt(t,10),delta:i[t]});for(a=a.sort(d.numerically),t=a.length-1;t>=0;t--){n=a[t];var u=i["_"+n],p=o.splice(n,1)[0];u[2]===s&&l.push({index:u[1],value:p})}l=l.sort(d.numericallyBy("index"));var f=l.length;for(t=0;f>t;t++){var h=l[t];o.splice(h.index,0,h.value)}var m,g=c.length;if(g>0)for(t=0;g>t;t++){var v=c[t];m=new r(e.left[v.index],v.delta),e.push(m,v.index)}return e.children?(e.exit(),void 0):(e.setResult(e.left).exit(),void 0)}};p.filterName="arrays";var f=function(e){if(e&&e.children&&"a"===e.delta._t){for(var t,n=e.children.length,i=0;n>i;i++)t=e.children[i],e.left[t.childName]=t.result;e.setResult(e.left).exit()}};f.filterName="arraysCollectChildren";var h=function(e){if(!e.nested)return e.delta[2]===s&&(e.newName="_"+e.delta[1],e.setResult([e.delta[0],parseInt(e.childName.substr(1),10),s]).exit()),void 0;if("a"===e.delta._t){var t,n;for(t in e.delta)"_t"!==t&&(n=new o(e.delta[t]),e.push(n,t));e.exit()}};h.filterName="arrays";var m=function(e,t,n){var i=t;if("string"==typeof t&&"_"===t[0])i=parseInt(t.substr(1),10);else{var r="_"+t;if(l(n)&&0===n[2])i=r;else for(var o in e){var a=e[o];l(a)&&a[2]===s&&a[1].toString()===t&&(i=o.substr(1))}}return i},g=function(e){if(e&&e.children&&"a"===e.delta._t){for(var t,n=e.children.length,i={_t:"a"},r=0;n>r;r++){t=e.children[r];var o=t.newName;"undefined"==typeof o&&(o=m(e.delta,t.childName,t.result)),i[o]!==t.result&&(i[o]=t.result)}e.setResult(i).exit()}};g.filterName="arraysCollectChildren",n.diffFilter=u,n.patchFilter=p,n.collectChildrenPatchFilter=f,n.reverseFilter=h,n.collectChildrenReverseFilter=g},{"../contexts/diff":3,"../contexts/patch":4,"../contexts/reverse":5,"./lcs":11}],10:[function(e,t,n){var i=function(e){e.left instanceof Date?(e.right instanceof Date?e.left.getTime()!==e.right.getTime()?e.setResult([e.left,e.right]):e.setResult(void 0):e.setResult([e.left,e.right]),e.exit()):e.right instanceof Date&&e.setResult([e.left,e.right]).exit()};i.filterName="dates",n.diffFilter=i},{}],11:[function(e,t,n){var i=function(e,t,n,i){return e[n]===t[i]},r=function(e,t,n,i){var r,o,a=e.length,s=t.length,l=[a+1];for(r=0;a+1>r;r++)for(l[r]=[s+1],o=0;s+1>o;o++)l[r][o]=0;for(l.match=n,r=1;a+1>r;r++)for(o=1;s+1>o;o++)l[r][o]=n(e,t,r-1,o-1,i)?l[r-1][o-1]+1:Math.max(l[r-1][o],l[r][o-1]);return l},o=function(e,t,n,i,r,a){if(0===i||0===r)return{sequence:[],indices1:[],indices2:[]};if(e.match(t,n,i-1,r-1,a)){var s=o(e,t,n,i-1,r-1,a);return s.sequence.push(t[i-1]),s.indices1.push(i-1),s.indices2.push(r-1),s}return e[i][r-1]>e[i-1][r]?o(e,t,n,i,r-1,a):o(e,t,n,i-1,r,a)},a=function(e,t,n,a){a=a||{};var s=r(e,t,n||i,a),l=o(s,e,t,e.length,t.length,a);return"string"==typeof e&&"string"==typeof t&&(l.sequence=l.sequence.join("")),l};n.get=a},{}],12:[function(e,t,n){var i=e("../contexts/diff").DiffContext,r=e("../contexts/patch").PatchContext,o=e("../contexts/reverse").ReverseContext,a=function(e){if(e&&e.children){for(var t,n=e.children.length,i=e.result,r=0;n>r;r++)t=e.children[r],"undefined"!=typeof t.result&&(i=i||{},i[t.childName]=t.result);i&&e.leftIsArray&&(i._t="a"),e.setResult(i).exit()}};a.filterName="collectChildren";var s=function(e){if(!e.leftIsArray&&"object"===e.leftType){var t,n;for(t in e.left)n=new i(e.left[t],e.right[t]),e.push(n,t);for(t in e.right)"undefined"==typeof e.left[t]&&(n=new i(void 0,e.right[t]),e.push(n,t));return e.children&&0!==e.children.length?(e.exit(),void 0):(e.setResult(void 0).exit(),void 0)}};s.filterName="objects";var l=function(e){if(e.nested&&!e.delta._t){var t,n;for(t in e.delta)n=new r(e.left[t],e.delta[t]),e.push(n,t);e.exit()}};l.filterName="objects";var c=function(e){if(e&&e.children&&!e.delta._t){for(var t,n=e.children.length,i=0;n>i;i++)t=e.children[i],e.left[t.childName]!==t.result&&(e.left[t.childName]=t.result);e.setResult(e.left).exit()}};c.filterName="collectChildren";var u=function(e){if(e.nested&&!e.delta._t){var t,n;for(t in e.delta)n=new o(e.delta[t]),e.push(n,t);e.exit()}};u.filterName="objects";var d=function(e){if(e&&e.children&&!e.delta._t){for(var t,n=e.children.length,i={},r=0;n>r;r++)t=e.children[r],i[t.childName]!==t.result&&(i[t.childName]=t.result);e.setResult(i).exit()}};d.filterName="collectChildren",n.collectChildrenDiffFilter=a,n.objectsDiffFilter=s,n.patchFilter=l,n.collectChildrenPatchFilter=c,n.reverseFilter=u,n.collectChildrenReverseFilter=d},{"../contexts/diff":3,"../contexts/patch":4,"../contexts/reverse":5}],13:[function(e,t,n){var i=2,r=60,o=null,a=function(){if(!o){var t;if("undefined"!=typeof diff_match_patch)t=new diff_match_patch;else if("function"==typeof e){var n=e("../../external/diff_match_patch_uncompressed");t=new n.diff_match_patch}if(!t){var i=new Error("text diff_match_patch library not found");throw i.diff_match_patch_not_found=!0,i}o={diff:function(e,n){return t.patch_toText(t.patch_make(e,n))},patch:function(e,n){for(var i=t.patch_apply(t.patch_fromText(n),e),r=0;rt;t++){r=i[t];var d=r.slice(0,1);"@"===d?(c=u.exec(r),a=t,s=null,l=null,i[a]="@@ -"+c[3]+","+c[4]+" +"+c[1]+","+c[2]+" @@"):"+"===d?(s=t,i[t]="-"+i[t].slice(1),"+"===i[t-1].slice(0,1)&&(o=i[t],i[t]=i[t-1],i[t-1]=o)):"-"===d&&(l=t,i[t]="+"+i[t].slice(1))}return i.join("\n")},u=function(e){e.nested||e.delta[2]===i&&e.setResult([c(e.delta[0]),0,i]).exit()};u.filterName="texts",n.diffFilter=s,n.patchFilter=l,n.reverseFilter=u},{}],14:[function(e,t,n){var i="function"==typeof Array.isArray?Array.isArray:function(e){return e instanceof Array},r=function(e){if(e.left===e.right)return e.setResult(void 0).exit(),void 0;if("undefined"==typeof e.left){if("function"==typeof e.right)throw new Error("functions are not supported");return e.setResult([e.right]).exit(),void 0}if("undefined"==typeof e.right)return e.setResult([e.left,0,0]).exit(),void 0;if("function"==typeof e.left||"function"==typeof e.right)throw new Error("functions are not supported");return e.leftType=null===e.left?"null":typeof e.left,e.rightType=null===e.right?"null":typeof e.right,e.leftType!==e.rightType?(e.setResult([e.left,e.right]).exit(),void 0):"boolean"===e.leftType||"number"===e.leftType?(e.setResult([e.left,e.right]).exit(),void 0):("object"===e.leftType&&(e.leftIsArray=i(e.left)),"object"===e.rightType&&(e.rightIsArray=i(e.right)),e.leftIsArray!==e.rightIsArray?(e.setResult([e.left,e.right]).exit(),void 0):void 0)};r.filterName="trivial";var o=function(e){return"undefined"==typeof e.delta?(e.setResult(e.left).exit(),void 0):(e.nested=!i(e.delta),e.nested?void 0:1===e.delta.length?(e.setResult(e.delta[0]).exit(),void 0):2===e.delta.length?(e.setResult(e.delta[1]).exit(),void 0):3===e.delta.length&&0===e.delta[2]?(e.setResult(void 0).exit(),void 0):void 0)};o.filterName="trivial";var a=function(e){return"undefined"==typeof e.delta?(e.setResult(e.delta).exit(),void 0):(e.nested=!i(e.delta),e.nested?void 0:1===e.delta.length?(e.setResult([e.delta[0],0,0]).exit(),void 0):2===e.delta.length?(e.setResult([e.delta[1],e.delta[0]]).exit(),void 0):3===e.delta.length&&0===e.delta[2]?(e.setResult([e.delta[0]]).exit(),void 0):void 0)};a.filterName="trivial",n.diffFilter=r,n.patchFilter=o,n.reverseFilter=a},{}],15:[function(e,t,n){var i=function(e){this.name=e,this.filters=[]};i.prototype.process=function(e){if(!this.processor)throw new Error("add this pipe to a processor before using it");for(var t=this.debug,n=this.filters.length,i=e,r=0;n>r;r++){var o=this.filters[r];if(t&&this.log("filter: "+o.filterName),o(i),"object"==typeof i&&i.exiting){i.exiting=!1;break}}!i.next&&this.resultCheck&&this.resultCheck(i)},i.prototype.log=function(e){console.log("[jsondiffpatch] "+this.name+" pipe, "+e)},i.prototype.append=function(){return this.filters.push.apply(this.filters,arguments),this},i.prototype.prepend=function(){return this.filters.unshift.apply(this.filters,arguments),this},i.prototype.indexOf=function(e){if(!e)throw new Error("a filter name is required");for(var t=0;t >>0)+(t++ +"__")};n.prototype={set:function(t,n){var i=t[this.name];i&&i[0]===t?i[1]=n:e(t,this.name,{value:[t,n],writable:!0})},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){this.set(e,void 0)}},window.WeakMap=n}(),define("WeakMap",function(){}),function(e){function t(e){x.push(e),y||(y=!0,g(i))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function i(){y=!1;var e=x;x=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callback_(n,e),t=!0)}),t&&i()}function r(e){e.nodes_.forEach(function(t){var n=m.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function o(e,t){for(var n=e;n;n=n.parentNode){var i=m.get(n);if(i)for(var r=0;r 0){var r=n[i-1],o=f(r,e);if(o)return n[i-1]=o,void 0}else t(this.observer);n[i]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=m.get(e);t||m.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=m.get(e),n=0;n /g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi},Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),define("bower-libs/prism/components/prism-markup",function(){}),Prism.languages.latex={keyword:/\\(?:[^a-zA-Z]|[a-zA-Z]+)/g,lparen:/[[({]/g,rparen:/[\])}]/g,comment:/%.*/g},define("libs/prism-latex",function(){}),Prism.languages.md=function(){var e=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>\[\]'"]+|\([^\s()<>\[\]'"]*\))+(?:\([^\s()<>\[\]'"]*\)|[^\s`!()\[\]{}:'".,<>?«»“â€â€˜â€™]))/gi,t=/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b/gi,n=Prism.languages.latex,i={};i.pre={pattern:/(^|(?:^|(?:^|\n)(?![ \t]*([*+\-]|\d+\.)[ \t]).*\n)\s*?\n)(\s*(?: {4}|\t).*(?:\n|$))+/g,lookbehind:!0,inside:{}},i["pre gfm"]={pattern:/^ {0,3}`{3}.*?\n(.*?\n)*? {0,3}`{3} *$/gm,inside:{"md md-pre":/`{3}/}},i["h1 alt"]={pattern:/^(.+)[ \t]*\n=+[ \t]*$/gm,inside:{}},i["h2 alt"]={pattern:/^(.+)[ \t]*\n-+[ \t]*$/gm,inside:{}},i.hr={pattern:/^([*\-_] *){3,}$/gm},i.li={pattern:/^[ \t]*([*+\-]|\d+\.)[ \t].+$/gm,inside:{"md md-li":/^ ?([*+\-]|\d+\.)[ \t]/m,"md md-li2":/^ ?(?: {2}|\t{1})([*+\-]|\d+\.)[ \t]/m,"md md-li3":/^ ?(?: {4}|\t{2})([*+\-]|\d+\.)[ \t]/m,"md md-li4":/^ ?(?: {6}|\t{3})([*+\-]|\d+\.)[ \t]/m,"md md-li5":/^ ?(?: {8}|\t{4})([*+\-]|\d+\.)[ \t]/m,"md md-li6":/^ ?(?: {10}|\t{5})([*+\-]|\d+\.)[ \t]/m,"md md-li7":/^ ?(?: {12}|\t{6})([*+\-]|\d+\.)[ \t]/m,"md md-li8":/^ ?(?: {14}|\t{7})([*+\-]|\d+\.)[ \t]/m,"md md-li9":/^ ?(?: {16}|\t{8})([*+\-]|\d+\.)[ \t]/m,"md md-li10":/^ ?(?: {18}|\t{9})([*+\-]|\d+\.)[ \t]/m,"md md-li11":/^ ?(?: {20}|\t{10})([*+\-]|\d+\.)[ \t]/m}};for(var r=6;r>=1;r--)i["h"+r]={pattern:new RegExp("^#{"+r+"}.+$","gm"),inside:{"md md-hash":new RegExp("^#{"+r+"} ")}};i.blockquote={pattern:/^ {0,3}> *[^\n]+$/gm,inside:{"md md-gt":/^ {0,3}> */,li:i.li}},i["math block"]={pattern:/(\$\$|\\\\\[|\\\\\\\\\()[\s\S]*?(\$\$|\\\\\]|\\\\\\\\\))/g,inside:{"md md-bracket-start":/^(\$\$|\\\\\[|\\\\\\\\\()/,"md md-bracket-end":/(\$\$|\\\\\]|\\\\\\\\\))/,lf:/\n/gm,rest:n}},i["latex block"]={pattern:/\\?\\begin\{[a-z]*\*?\}[\s\S]*?\\?\\end\{[a-z]*\*?\}/g,inside:{keyword:/\\?\\(begin|end)/,lf:/\n/gm,rest:n}},i.fndef={pattern:/^ {0,3}\[\^.*?\]:[ \t]+.*$/gm,inside:{"ref-id":{pattern:/\[\^.*?\]/,inside:{"md md-bracket-start":/\[/,"md md-bracket-end":/\]/}}}},i.linkdef={pattern:/^ {0,3}\[.*?\]:[ \t]+.*$/gm,inside:{"link-id":{pattern:/\[.*?\]/,inside:{"md md-bracket-start":/\[/,"md md-bracket-end":/\]/}},url:e,linktitle:/['\"\(][^\'\"\)]*['\"\)]/}},i.p={pattern:/.+/g,inside:{"md md-toc":/^\s*\[(toc|TOC)\]\s*$/g}},i.lf=/^\n$/gm,i.img={pattern:/!\[[^\]]*\]\([^\)]+\)/g,inside:{"md md-bang":/^!/,"md md-bracket-start":/\[/,"md md-alt":/[^\[]+(?=\])/,"md md-bracket-end":/\](?=\()/,"md img-parens":{pattern:/\([^\)]+\)/,inside:{"md md-paren-start":/^\(/,"md md-title":/(['‘][^'’]*['’]|["“][^"â€]*["â€])(?=\)$)/,"md md-src":/[^\('" \t]+(?=[\)'" \t])/,"md md-paren-end":/\)$/}}}},i.link={pattern:/\[(?:(\\.)|[^\[\]])*\]\([^\(\)\s]+(\(\S*?\))??[^\(\)\s]*?(\s(['‘][^'’]*['’]|["“][^"â€]*["â€]))?\)/gm,inside:{"md md-bracket-start":{pattern:/(^|[^\\])\[/,lookbehind:!0},"md md-underlined-text":{pattern:/(?:(\\.)|[^\[\]])+(?=\])/},"md md-bracket-end":/\]\s?\(/,"md md-paren-end":/\)$/,"md md-href":/.*/}},i.fn={pattern:/\[\^(.*?)\]/g,inside:{ref:{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-ref":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},i.imgref={pattern:/!\[(.*?)\] ?\[(.*?)\]/g,inside:{"md md-bang":/^!/,"ref-end":{pattern:/\[[^\[\]]+\]$/,inside:{"md md-bracket-start":/\[/,"md md-href":/[^\[\]]+(?=]$)/,"md md-bracket-end":/\]/}},"ref-start":{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-alt":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},i.linkref={pattern:/\[(.*?)\] ?\[(.*?)\]/g,inside:{"ref-end":{pattern:/\[[^\[\]]+\]$/,inside:{"md md-bracket-start":/\[/,"md md-href":/[^\[\]]+(?=]$)/,"md md-bracket-end":/\]/}},"ref-start":{pattern:/^\[[^\[\]]+\] ?/,inside:{"md md-bracket-start":/\[/,"md md-underlined-text":/^[^\[\]]+/,"md md-bracket-end":/\]/}}}},i.email={pattern:t},i.code={pattern:/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/g,lookbehind:!0,inside:{"md md-code":/`/}},i.math={pattern:/\$.*?\$/g,inside:{"md md-bracket-start":/^\$/,"md md-bracket-end":/\$$/,rest:n}},i.strong={pattern:/([_\*])\1((?!\1{2}).)*\1{2}/g,inside:{"md md-strong":/([_\*])\1/g}},i.em={pattern:/(^|[^\\])(\*|_)(\S[^\2]*?)??[^\s\\]+?\2/g,lookbehind:!0,inside:{"md md-em md-start":/^(\*|_)/,"md md-em md-close":/(\*|_)$/}},i.strike={pattern:/(^|\n|\W)(~~)(?=\S)([^\r]*?\S)\2/gm,lookbehind:!0,inside:{"md md-s":/(~~)/,"md-strike-text":/[^~]+/}};for(var o={code:i.code,math:i.math,fn:i.fn,img:i.img,link:i.link,imgref:i.imgref,linkref:i.linkref,url:i.url,email:i.email,strong:i.strong,em:i.em,strike:i.strike,conflict:/⧸⧸/g,comment:Prism.languages.markup.comment,tag:Prism.languages.markup.tag,entity:Prism.languages.markup.entity},a=6;a>=1;a--)i["h"+a].inside.rest=o;i["h1 alt"].inside.rest=o,i["h2 alt"].inside.rest=o,i.p.inside.rest=o,i.blockquote.inside.rest=o,i.li.inside.rest=o,i.fndef.inside.rest=o,o={code:i.code,fn:i.fn,link:i.link,linkref:i.linkref,conflict:/⧸⧸/g},i.strong.inside.rest=o,i.em.inside.rest=o,i.strike.inside.rest=o;var s={code:i.code,strong:i.strong,em:i.em,strike:i.strike,conflict:/⧸⧸/g,comment:Prism.languages.markup.comment,tag:Prism.languages.markup.tag,entity:Prism.languages.markup.entity};return i.link.inside["md md-underlined-text"].inside=s,i.linkref.inside["ref-start"].inside["md md-underlined-text"].inside=s,i}(),define("libs/prism-markdown",function(){}),define("editor",["jquery","underscore","utils","settings","eventMgr","prism-core","diff_match_patch_uncompressed","jsondiffpatch","crel","rangy","MutationObservers","libs/prism-markdown"],function(e,t,n,i,r,o,a,s,l,c){function u(){this.isWatching=!1;var e;this.startWatching=function(){this.isWatching=!0,e=e||new MutationObserver(y),e.observe(_,{childList:!0,subtree:!0,characterData:!0})},this.stopWatching=function(){e.disconnect(),this.isWatching=!1},this.noWatch=function(e){this.isWatching===!0?(this.stopWatching(),e(),this.startWatching()):e()}}function d(){var e=this;this.selectionStart=0,this.selectionEnd=0,this.cursorY=0,this.findOffset=function(e){for(var t=document.createTreeWalker(_,4,null,!1),n="";t.nextNode();){if(n=t.currentNode.nodeValue||"",n.length>e)return{container:t.currentNode,offset:e};e-=n.length}return{container:t.currentNode,offset:n.length}},this.createRange=function(e,n){e=0>e?0:e,n=0>n?0:n;var i=document.createRange(),r=t.isObject(e)?e:this.findOffset(e);return i.setStart(r.container,r.offset),n&&n!=e&&(r=t.isObject(n)?n:this.findOffset(n)),i.setEnd(r.container,r.offset),i},this.setSelectionStartEnd=function(e,t,n,i){void 0===e&&(e=this.selectionStart),0>e&&(e=0),void 0===t&&(t=this.selectionEnd),0>t&&(t=0),this.selectionStart=e,this.selectionEnd=t;var o=Math.min(e,t),a=Math.max(e,t);if(n=n||this.createRange(o,a),!i){var s=c.getSelection();s.removeAllRanges(),s.addRange(n,e>t)}F.editorStart=this.selectionStart,F.editorEnd=this.selectionEnd,k.toggleClass("has-selection",this.selectionStart!==this.selectionEnd);var l=this.getCoordinates(this.selectionEnd,this.selectionEndContainer,this.selectionEndOffset);return this.cursorY!==l.y&&(this.cursorY=l.y,r.onCursorCoordinates(l.x,l.y)),n},this.saveSelectionState=function(){function t(){if(O===!1){var t,n=e.selectionStart,i=e.selectionEnd,r=c.getSelection();if(r.rangeCount>0){var o=r.getRangeAt(0),a=o.startContainer;if(16&_.compareDocumentPosition(a)){t=o;var s=a,l=t.startOffset;do{for(;a=a.previousSibling;)a.textContent&&(l+=a.textContent.length);a=s=s.parentNode}while(a&&a!=E);r.isBackwards()?(n=l+(t+"").length,i=l):(n=l,i=l+(t+"").length)}}e.setSelectionStartEnd(n,i,t,!0)}U.saveSelectionState()}var i=n.debounce(t);return function(e){e?i():t()}}(),this.getCoordinates=function(e,t,n){t||(n=this.findOffset(e),t=n.container,n=n.offset);var i=0,r=0;if("\n"==t.textContent)r=t.parentNode.offsetTop+t.parentNode.offsetHeight/2;else{var o=H[e],a={container:t,offset:n},s={container:t,offset:n};e>0&&(void 0===o||"\n"==o)?0===a.offset?a=e-1:a.offset-=1:s.offset===t.textContent.length?s=e+1:s.offset+=1;var l=this.createRange(a,s),c=l.getBoundingClientRect();r=c.top+c.height/2-E.getBoundingClientRect().top+E.scrollTop,l.detach()}return{x:i,y:r}},this.getClosestWordOffset=function(e){var t=0,n=0,i=0;return H.split(/\s/).some(function(r){return r&&(t=i,n=i+r.length,n>e)?!0:(i+=r.length+1,void 0)}),{start:t,end:n}}}function p(e){var t=j.diff_commonPrefix(H,e);t===H.length&&t--;var n=Math.min(j.diff_commonSuffix(H,e),H.length-t,e.length-t),i=e.substring(t,e.length-n),r=G.createRange(t,H.length-n);r.deleteContents(),r.insertNode(document.createTextNode(i))}function f(e,t){var n=G.selectionStart;if(n!==G.selectionEnd)return!1;var i=G.createRange(n-e.length,n);return""+i!=e?!1:(i.deleteContents(),i.insertNode(document.createTextNode(t)),n=n-e.length+t.length,G.setSelectionStartEnd(n,n),!0)}function h(e){p(e),H=e}function m(){return H}function g(){I.focus(),G.setSelectionStartEnd(),E.scrollTop=R}function v(){function e(e,n,i){B.noWatch(function(){H!=e.content&&(h(e.content),F.content=e.content,r.onContentChanged(F,e.content)),G.setSelectionStartEnd(n,i);var o=F.discussionListJSON;if(o!=e.discussionListJSON){var a=F.discussionList;F.discussionListJSON=e.discussionListJSON;var s=F.discussionList,l=$.diff(a,s),c=!1;t.each(l,function(e,n){t.isArray(e)?1===e.length?r.onDiscussionCreated(F,s[n]):r.onDiscussionRemoved(F,a[n]):c=!0}),c&&r.onCommentsChanged(F)}}),s=n,l=i,a=e,this.currentMode=void 0,o=void 0,this.onButtonStateChange(),q()}var i,o,a,s,l,c=[],u=[];this.setCommandMode=function(){this.currentMode="command"},this.setMode=function(){},this.onButtonStateChange=function(){},this.saveState=n.debounce(function(){u=[];var e=Date.now();"comment"==this.currentMode||this.currentMode!=o&&"newlines"!=o||e-i>1e3?(c.push(a),100===c.length&&c.shift()):(s=a.selectionStartBefore,l=a.selectionEndBefore),a={selectionStartBefore:s,selectionEndBefore:l,selectionStartAfter:G.selectionStart,selectionEndAfter:G.selectionEnd,content:H,discussionListJSON:F.discussionListJSON},i=e,o=this.currentMode,this.currentMode=void 0,this.onButtonStateChange()},this),this.saveSelectionState=t.debounce(function(){void 0===this.currentMode&&(s=G.selectionStart,l=G.selectionEnd)},10),this.canUndo=function(){return c.length},this.canRedo=function(){return u.length},this.undo=function(){var t=c.pop();t&&(u.push(a),e.call(this,t,a.selectionStartBefore,a.selectionEndBefore))},this.redo=function(){var t=u.pop();t&&(c.push(a),e.call(this,t,t.selectionStartAfter,t.selectionEndAfter))},this.init=function(){var e=F.content;c=[],u=[],i=0,a={selectionStartAfter:F.selectionStart,selectionEndAfter:F.selectionEnd,content:e,discussionListJSON:F.discussionListJSON},this.currentMode=void 0,o=void 0,_.textContent=e,y()}}function b(){B.isWatching===!0&&(U.currentMode=U.currentMode||"comment",U.saveState())}function y(){var e=E.textContent;if(_.lastChild===z&&"\n"==z.textContent.slice(-1)&&(e=e.slice(0,-1)),O===!1){if(e==H)return 0===_.children.length&&(_.innerHTML="",W.forEach(function(e){_.appendChild(e.elt)}),C()),void 0;U.currentMode=U.currentMode||"typing";var n=t.values(F.discussionList);F.newDiscussion&&n.push(F.newDiscussion);var i=x(H,e,n);H=e,i===!0&&(F.discussionList=F.discussionList),F.content=H,G.saveSelectionState(),r.onContentChanged(F,H),i&&r.onCommentsChanged(F),U.saveState()}else H=e,G.setSelectionStartEnd(F.editorStart,F.editorEnd),G.saveSelectionState(),r.onFileOpen(F,H),L.scrollTop=F.previewScrollTop,R=F.editorScrollTop,E.scrollTop=R,O=!1}function x(e,t,n){if(n.length){var i=j.diff_main(e,t),r=!1,o=0;return i.forEach(function(e){var t=e[0],i=e[1];if(0===t)return o+=i.length,void 0;var a=o,s=i.length;-1===t&&(a+=s,s=-s),n.forEach(function(e){e.selectionEnd>a?(e.selectionEnd+=s,e.discussionIndex&&(r=!0)):e.selectionEnd>o&&(e.selectionEnd=o,e.discussionIndex&&(r=!0)),e.selectionStart>=a?(e.selectionStart+=s,e.discussionIndex&&(r=!0)):e.selectionStart>o&&(e.selectionStart=o,e.discussionIndex&&(r=!0))}),1===t&&(o+=i.length)}),r}}function w(e){if(X=[],Q=[],V=void 0,O===!0)return Q=W,W=e,X=e,void 0;var n=W.length;t.some(W,function(t,i){var r=e[i];return i>=e.length||t.textWithFrontMatter!=r.textWithFrontMatter||t.elt.parentNode!==_||t.elt.textContent!=r.textWithFrontMatter?(n=i,!0):void 0});var i=-W.length;t.some(W.slice().reverse(),function(t,n){var r=e[e.length-n-1];return n>=e.length||t.textWithFrontMatter!=r.textWithFrontMatter||t.elt.parentNode!==_||t.elt.textContent!=r.textWithFrontMatter?(i=-n,!0):void 0}),n-i>W.length&&(i=n-W.length);var r=W.slice(0,n);X=e.slice(n,e.length+i);var o=W.slice(W.length+i,W.length);V=t.first(o),Q=W.slice(n,W.length+i),W=r.concat(X).concat(o)}function S(){var e=document.createDocumentFragment();X.forEach(function(t){T(t),e.appendChild(t.elt)}),B.noWatch(function(){if(O===!0)_.innerHTML="",_.appendChild(e);else{Q.forEach(function(e){e.elt.parentNode===_&&_.removeChild(e.elt)}),void 0!==V?_.insertBefore(e,V.elt):_.appendChild(e);for(var t=_.firstChild;t;){var n=t.nextSibling;t.generated||_.removeChild(t),t=n}}C(),G.setSelectionStartEnd()})}function C(){z=l("span",{"class":"token lf"}),z.textContent="\n",_.appendChild(z)}function T(e){var t=K(e.text);window.viewerMode||(t=o.highlight(t,o.languages.md));var n=e.textWithFrontMatter.substring(0,e.textWithFrontMatter.length-e.text.length);n.length&&(n=K(n),n=n.replace(/\n/g,'\n'),t=''+n+""+t);var i=l("span",{id:"wmd-input-section-"+e.id,"class":"wmd-input-section"});i.generated=!0,i.innerHTML=t,e.elt=i}var E,k,_,I,D,N,L,M,A={},R=0,P=function(){var e=0,n=function(){var t=Date.now();M.refreshPreview(),e=Date.now()-t};return i.lazyRendering===!0?t.debounce(n,500):function(){setTimeout(n,2e3>e?e:2e3)}}();r.addListener("onPagedownConfigure",function(e){M=e}),r.addListener("onSectionsCreated",function(e){w(e),S(),O===!0?M.refreshPreview():P()});var F,O=!0;r.addListener("onFileSelected",function(e){O=!0,F=e});var B=new u;A.watcher=B;var j=new a,$=s.create({objectHash:function(e){return JSON.stringify(e)},arrays:{detectMove:!1},textDiff:{minLength:9999999}}),G=new d;A.selectionMgr=G,e(document).on("selectionchange",".editor-content",t.bind(G.saveSelectionState,G,!0));var q=function(){var e=n.debounce(function(){var e=E.offsetHeight/2;e>130&&(e=130);var t=E.scrollTop+e,n=E.scrollTop+E.offsetHeight-e;G.cursorY n&&(E.scrollTop+=G.cursorY-n)});return function(){void 0!==E&&(G.saveSelectionState(!0),e())}}();A.adjustCursorPosition=q;var H;A.setValue=p,A.replacePreviousText=f,A.setValueNoWatch=h,A.getValue=m,A.focus=g;var U=new v;A.undoMgr=U,r.addListener("onDiscussionCreated",b),r.addListener("onDiscussionRemoved",b),r.addListener("onCommentsChanged",b);var z;A.adjustCommentOffsets=x,A.init=function(){if(E=document.getElementById("wmd-input"),k=e(E),_=E.querySelector(".editor-content"),I=e(_),D=E.querySelector(".editor-margin"),N=e(D),L=document.querySelector(".preview-container"),k.addClass(i.editorFontClass),B.startWatching(),e(E).scroll(function(){R=E.scrollTop,O===!1&&(F.editorScrollTop=R)}),e(L).scroll(function(){O===!1&&(F.previewScrollTop=L.scrollTop)}),/AppleWebKit\/([\d.]+)/.exec(navigator.userAgent)){var n=e('').appendTo("html");I.blur(function(){n[0].setSelectionRange(0,0),n.blur()})}E.focus=g,Object.defineProperty(E,"value",{get:function(){return H},set:p}),Object.defineProperty(E,"selectionStart",{get:function(){return Math.min(G.selectionStart,G.selectionEnd)},set:function(e){G.setSelectionStartEnd(e)},enumerable:!0,configurable:!0}),Object.defineProperty(E,"selectionEnd",{get:function(){return Math.max(G.selectionStart,G.selectionEnd)},set:function(e){G.setSelectionStartEnd(void 0,e)},enumerable:!0,configurable:!0});var r=!1;I.on("keydown",function(e){if(17!==e.which&&91!==e.which&&18!==e.which&&16!==e.which){G.saveSelectionState();var t=e.metaKey||e.ctrlKey;switch(t||q(),e.which){case 9:t||(o("indent",{inverse:e.shiftKey}),e.preventDefault());break;case 13:o("newline"),e.preventDefault()}13!==e.which&&(r=!1)}}).on("mouseup",t.bind(G.saveSelectionState,G,!0)).on("paste",function(){U.currentMode="paste",q()}).on("cut",function(){U.currentMode="cut",q()});var o=function(e,t){t=t||{};var n=m(),i=t.start||G.selectionStart,r=t.end||G.selectionEnd,o={selectionStart:i,selectionEnd:r,before:n.slice(0,i),after:n.slice(r),selection:n.slice(i,r)};a[e](o,t),p(o.before+o.selection+o.after),G.setSelectionStartEnd(o.selectionStart,o.selectionEnd)},a={indent:function(e,t){function n(e,t,n,i){return n=+n||0,i=i||"",e.slice(0,t)+i+e.slice(t+n)}var i=e.before.lastIndexOf("\n")+1;if(t.inverse)/\s/.test(e.before.charAt(i))&&(e.before=n(e.before,i,1),e.selectionStart--,e.selectionEnd--),e.selection=e.selection.replace(/^[ \t]/gm,"");else{if(!e.selection)return e.before+=" ",e.selectionStart++,e.selectionEnd++,void 0;e.before=n(e.before,i,0," "),e.selection=e.selection.replace(/\r?\n(?=[\s\S])/g,"\n "),e.selectionStart++,e.selectionEnd++}e.selectionEnd=e.selectionStart+e.selection.length},newline:function(e){var t=e.before.lastIndexOf("\n")+1;if(r)return e.before=e.before.substring(0,t),e.selection="",e.selectionStart=t,e.selectionEnd=t,r=!1,void 0;r=!1;var n=e.before.slice(t),i=n.match(/^ {0,3}>[ ]*|^[ \t]*(?:[*+\-]|(\d+)\.)[ \t]|^\s+/),o=(i||[""])[0];if(i&&i[1]){var a=parseInt(i[1],10);o=o.replace(/\d+/,a+1)}o.length&&(r=!0),U.currentMode="newlines",e.before+="\n"+o,e.selection="",e.selectionStart+=o.length+1,e.selectionEnd=e.selectionStart}}};var V,W=[],Q=[],X=[],K=function(){var e={"&":"&","<":"<"," ":" "};return function(t){return t.replace(/[&<\u00a0]/g,function(t){return e[t]})}}();return r.onEditorCreated(A),A}),function(e,t){function n(){i.READY||(b.determineEventTypes(),h.each(i.gestures,function(e){x.register(e)}),b.onTouch(i.DOCUMENT,p,x.detect),b.onTouch(i.DOCUMENT,f,x.detect),i.READY=!0)}var i=function(e,t){return new i.Instance(e,t||{})};i.VERSION="1.0.10",i.defaults={stop_browser_behavior:{userSelect:"none",touchAction:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},i.HAS_POINTEREVENTS=e.navigator.pointerEnabled||e.navigator.msPointerEnabled,i.HAS_TOUCHEVENTS="ontouchstart"in e,i.MOBILE_REGEX=/mobile|tablet|ip(ad|hone|od)|android|silk/i,i.NO_MOUSEEVENTS=i.HAS_TOUCHEVENTS&&e.navigator.userAgent.match(i.MOBILE_REGEX),i.EVENT_TYPES={},i.UPDATE_VELOCITY_INTERVAL=16,i.DOCUMENT=e.document;var r=i.DIRECTION_DOWN="down",o=i.DIRECTION_LEFT="left",a=i.DIRECTION_UP="up",s=i.DIRECTION_RIGHT="right",l=i.POINTER_MOUSE="mouse",c=i.POINTER_TOUCH="touch",u=i.POINTER_PEN="pen",d=i.EVENT_START="start",p=i.EVENT_MOVE="move",f=i.EVENT_END="end";i.plugins=i.plugins||{},i.gestures=i.gestures||{},i.READY=!1;var h=i.utils={extend:function(e,n,i){for(var r in n)e[r]!==t&&i||(e[r]=n[r]);return e},each:function(e,n,i){var r,o;if("forEach"in e)e.forEach(n,i);else if(e.length!==t){for(r=-1;o=e[++r];)if(n.call(i,o,r,e)===!1)return}else for(r in e)if(e.hasOwnProperty(r)&&n.call(i,e[r],r,e)===!1)return},inStr:function(e,t){return e.indexOf(t)>-1},hasParent:function(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1},getCenter:function(e){var t=[],n=[],i=[],r=[],o=Math.min,a=Math.max;return 1===e.length?{pageX:e[0].pageX,pageY:e[0].pageY,clientX:e[0].clientX,clientY:e[0].clientY}:(h.each(e,function(e){t.push(e.pageX),n.push(e.pageY),i.push(e.clientX),r.push(e.clientY)}),{pageX:(o.apply(Math,t)+a.apply(Math,t))/2,pageY:(o.apply(Math,n)+a.apply(Math,n))/2,clientX:(o.apply(Math,i)+a.apply(Math,i))/2,clientY:(o.apply(Math,r)+a.apply(Math,r))/2})},getVelocity:function(e,t,n){return{x:Math.abs(t/e)||0,y:Math.abs(n/e)||0}},getAngle:function(e,t){var n=t.clientX-e.clientX,i=t.clientY-e.clientY;return 180*Math.atan2(i,n)/Math.PI},getDirection:function(e,t){var n=Math.abs(e.clientX-t.clientX),i=Math.abs(e.clientY-t.clientY);return n>=i?e.clientX-t.clientX>0?o:s:e.clientY-t.clientY>0?a:r},getDistance:function(e,t){var n=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.sqrt(n*n+i*i)},getScale:function(e,t){return e.length>=2&&t.length>=2?this.getDistance(t[0],t[1])/this.getDistance(e[0],e[1]):1},getRotation:function(e,t){return e.length>=2&&t.length>=2?this.getAngle(t[1],t[0])-this.getAngle(e[1],e[0]):0},isVertical:function(e){return e==a||e==r},toggleDefaultBehavior:function(e,t,n){if(t&&e&&e.style){h.each(["webkit","moz","Moz","ms","o",""],function(i){h.each(t,function(t,r){i&&(r=i+r.substring(0,1).toUpperCase()+r.substring(1)),r in e.style&&(e.style[r]=!n&&t)})});var i=function(){return!1};"none"==t.userSelect&&(e.onselectstart=!n&&i),"none"==t.userDrag&&(e.ondragstart=!n&&i)}}};i.Instance=function(e,t){var r=this;return n(),this.element=e,this.enabled=!0,this.options=h.extend(h.extend({},i.defaults),t||{}),this.options.stop_browser_behavior&&h.toggleDefaultBehavior(this.element,this.options.stop_browser_behavior,!1),this.eventStartHandler=b.onTouch(e,d,function(e){r.enabled&&x.startDetect(r,e)}),this.eventHandlers=[],this},i.Instance.prototype={on:function(e,t){var n=e.split(" ");return h.each(n,function(e){this.element.addEventListener(e,t,!1),this.eventHandlers.push({gesture:e,handler:t})},this),this},off:function(e,t){var n,i,r=e.split(" ");return h.each(r,function(e){for(this.element.removeEventListener(e,t,!1),n=-1;i=this.eventHandlers[++n];)i.gesture===e&&i.handler===t&&this.eventHandlers.splice(n,1)},this),this},trigger:function(e,t){t||(t={});var n=i.DOCUMENT.createEvent("Event");n.initEvent(e,!0,!0),n.gesture=t;var r=this.element;return h.hasParent(t.target,r)&&(r=t.target),r.dispatchEvent(n),this},enable:function(e){return this.enabled=e,this},dispose:function(){var e,t;for(this.options.stop_browser_behavior&&h.toggleDefaultBehavior(this.element,this.options.stop_browser_behavior,!0),e=-1;t=this.eventHandlers[++e];)this.element.removeEventListener(t.gesture,t.handler,!1);return this.eventHandlers=[],b.unbindDom(this.element,i.EVENT_TYPES[d],this.eventStartHandler),null}};var m=null,g=!1,v=!1,b=i.event={bindDom:function(e,t,n){var i=t.split(" ");h.each(i,function(t){e.addEventListener(t,n,!1)})},unbindDom:function(e,t,n){var i=t.split(" ");h.each(i,function(t){e.removeEventListener(t,n,!1)})},onTouch:function(e,t,n){var r=this,o=function(o){var a=o.type.toLowerCase();if(!h.inStr(a,"mouse")||!v){h.inStr(a,"touch")||h.inStr(a,"pointerdown")||h.inStr(a,"mouse")&&1===o.which?g=!0:h.inStr(a,"mouse")&&!o.which&&(g=!1),(h.inStr(a,"touch")||h.inStr(a,"pointer"))&&(v=!0);var s=0;g&&(i.HAS_POINTEREVENTS&&t!=f?s=y.updatePointer(t,o):h.inStr(a,"touch")?s=o.touches.length:v||(s=h.inStr(a,"up")?0:1),s>0&&t==f?t=p:s||(t=f),(s||null===m)&&(m=o),n.call(x,r.collectEventData(e,t,r.getTouchList(m,t),o)),i.HAS_POINTEREVENTS&&t==f&&(s=y.updatePointer(t,o))),s||(m=null,g=!1,v=!1,y.reset())}};return this.bindDom(e,i.EVENT_TYPES[t],o),o},determineEventTypes:function(){var e;e=i.HAS_POINTEREVENTS?y.getEvents():i.NO_MOUSEEVENTS?["touchstart","touchmove","touchend touchcancel"]:["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],i.EVENT_TYPES[d]=e[0],i.EVENT_TYPES[p]=e[1],i.EVENT_TYPES[f]=e[2]},getTouchList:function(e){return i.HAS_POINTEREVENTS?y.getTouchList():e.touches?e.touches:(e.identifier=1,[e])},collectEventData:function(e,t,n,i){var r=c;return(h.inStr(i.type,"mouse")||y.matchType(l,i))&&(r=l),{center:h.getCenter(n),timeStamp:Date.now(),target:i.target,touches:n,eventType:t,pointerType:r,srcEvent:i,preventDefault:function(){var e=this.srcEvent;e.preventManipulation&&e.preventManipulation(),e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return x.stopDetect()}}}},y=i.PointerEvent={pointers:{},getTouchList:function(){var e=[];return h.each(this.pointers,function(t){e.push(t)}),e},updatePointer:function(e,t){return e==f?delete this.pointers[t.pointerId]:(t.identifier=t.pointerId,this.pointers[t.pointerId]=t),Object.keys(this.pointers).length},matchType:function(e,t){if(!t.pointerType)return!1;var n=t.pointerType,i={};return i[l]=n===l,i[c]=n===c,i[u]=n===u,i[e]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={} +}},x=i.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(e,t){this.current||(this.stopped=!1,this.current={inst:e,startEvent:h.extend({},t),lastEvent:!1,lastVelocityEvent:!1,velocity:!1,name:""},this.detect(t))},detect:function(e){if(this.current&&!this.stopped){e=this.extendEventData(e);var t=this.current.inst,n=t.options;return h.each(this.gestures,function(i){return this.stopped||n[i.name]===!1||t.enabled===!1||i.handler.call(i,e,t)!==!1?void 0:(this.stopDetect(),!1)},this),this.current&&(this.current.lastEvent=e),e.eventType==f&&!e.touches.length-1&&this.stopDetect(),e}},stopDetect:function(){this.previous=h.extend({},this.current),this.current=null,this.stopped=!0},getVelocityData:function(e,t,n,r){var o=this.current,a=o.lastVelocityEvent,s=o.velocity;a&&e.timeStamp-a.timeStamp>i.UPDATE_VELOCITY_INTERVAL?(s=h.getVelocity(e.timeStamp-a.timeStamp,e.center.clientX-a.center.clientX,e.center.clientY-a.center.clientY),o.lastVelocityEvent=e):o.velocity||(s=h.getVelocity(t,n,r),o.lastVelocityEvent=e),o.velocity=s,e.velocityX=s.x,e.velocityY=s.y},getInterimData:function(e){var t,n,i=this.current.lastEvent;e.eventType==f?(t=i&&i.interimAngle,n=i&&i.interimDirection):(t=i&&h.getAngle(i.center,e.center),n=i&&h.getDirection(i.center,e.center)),e.interimAngle=t,e.interimDirection=n},extendEventData:function(e){var t=this.current,n=t.startEvent;(e.touches.length!=n.touches.length||e.touches===n.touches)&&(n.touches=[],h.each(e.touches,function(e){n.touches.push(h.extend({},e))}));var i=e.timeStamp-n.timeStamp,r=e.center.clientX-n.center.clientX,o=e.center.clientY-n.center.clientY;return this.getVelocityData(e,i,r,o),this.getInterimData(e),h.extend(e,{startEvent:n,deltaTime:i,deltaX:r,deltaY:o,distance:h.getDistance(n.center,e.center),angle:h.getAngle(n.center,e.center),direction:h.getDirection(n.center,e.center),scale:h.getScale(n.touches,e.touches),rotation:h.getRotation(n.touches,e.touches)}),e},register:function(e){var n=e.defaults||{};return n[e.name]===t&&(n[e.name]=!0),h.extend(i.defaults,n,!0),e.index=e.index||1e3,this.gestures.push(e),this.gestures.sort(function(e,t){return e.index t.index?1:0}),this.gestures}};i.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,correct_for_drag_min_distance:!0,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1,drag_lock_min_distance:25},triggered:!1,handler:function(e,t){var n=x.current;if(n.name!=this.name&&this.triggered)return t.trigger(this.name+"end",e),this.triggered=!1,void 0;if(!(t.options.drag_max_touches>0&&e.touches.length>t.options.drag_max_touches))switch(e.eventType){case d:this.triggered=!1;break;case p:if(e.distance 0)){var l=Math.abs(t.options.drag_min_distance/e.distance);i.pageX+=e.deltaX*l,i.pageY+=e.deltaY*l,i.clientX+=e.deltaX*l,i.clientY+=e.deltaY*l,e=x.extendEventData(e)}(n.lastEvent.drag_locked_to_axis||t.options.drag_lock_to_axis&&t.options.drag_lock_min_distance<=e.distance)&&(e.drag_locked_to_axis=!0);var c=n.lastEvent.direction;e.drag_locked_to_axis&&c!==e.direction&&(e.direction=h.isVertical(c)?e.deltaY<0?a:r:e.deltaX<0?o:s),this.triggered||(t.trigger(this.name+"start",e),this.triggered=!0),t.trigger(this.name,e),t.trigger(this.name+e.direction,e);var u=h.isVertical(e.direction);(t.options.drag_block_vertical&&u||t.options.drag_block_horizontal&&!u)&&e.preventDefault();break;case f:this.triggered&&t.trigger(this.name+"end",e),this.triggered=!1}}},i.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:2},timer:null,handler:function(e,t){switch(e.eventType){case d:clearTimeout(this.timer),x.current.name=this.name,this.timer=setTimeout(function(){"hold"==x.current.name&&t.trigger("hold",e)},t.options.hold_timeout);break;case p:e.distance>t.options.hold_threshold&&clearTimeout(this.timer);break;case f:clearTimeout(this.timer)}}},i.gestures.Release={name:"release",index:1/0,handler:function(e,t){e.eventType==f&&t.trigger(this.name,e)}},i.gestures.Swipe={name:"swipe",index:40,defaults:{swipe_min_touches:1,swipe_max_touches:1,swipe_velocity:.7},handler:function(e,t){if(e.eventType==f){if(e.touches.length t.options.swipe_max_touches)return;(e.velocityX>t.options.swipe_velocity||e.velocityY>t.options.swipe_velocity)&&(t.trigger(this.name,e),t.trigger(this.name+e.direction,e))}}},i.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,tap_always:!0,doubletap_distance:20,doubletap_interval:300},has_moved:!1,handler:function(e,t){var n,i,r;e.eventType==d?this.has_moved=!1:e.eventType!=p||this.moved?e.eventType==f&&"touchcancel"!=e.srcEvent.type&&e.deltaTime t.options.tap_max_distance}},i.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(e,t){return t.options.prevent_mouseevents&&e.pointerType==l?(e.stopDetect(),void 0):(t.options.prevent_default&&e.preventDefault(),e.eventType==d&&t.trigger(this.name,e),void 0)}},i.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1,transform_within_instance:!1},triggered:!1,handler:function(e,t){if(x.current.name!=this.name&&this.triggered)return t.trigger(this.name+"end",e),this.triggered=!1,void 0;if(!(e.touches.length<2)){if(t.options.transform_always_block&&e.preventDefault(),t.options.transform_within_instance)for(var n=-1;e.touches[++n];)if(!h.hasParent(e.touches[n].target,t.element))return;switch(e.eventType){case d:this.triggered=!1;break;case p:var i=Math.abs(1-e.scale),r=Math.abs(e.rotation);if(i t.options.transform_min_rotation&&t.trigger("rotate",e),i>t.options.transform_min_scale&&(t.trigger("pinch",e),t.trigger("pinch"+(e.scale<1?"in":"out"),e));break;case f:this.triggered&&t.trigger(this.name+"end",e),this.triggered=!1}}}},"function"==typeof define&&define.amd?define("hammerjs",[],function(){return i}):"object"==typeof module&&module.exports?module.exports=i:e.Hammer=i}(window),define("layout",["jquery","underscore","utils","constants","settings","eventMgr","crel","mousetrap","hammerjs"],function(e,t,n,i,r,o,a,s,l){function c(){j=!0,g.$elt.addClass("layout-animate")}function u(){j=!1,g.$elt.removeClass("layout-animate")}function d(t){this.selector=t,this.elt=document.querySelector(t),this.$elt=e(this.elt)}function p(){return t.find(K,function(e){return m.width>e.screenWidth}).maxWidth}function f(){var e=b.height-60,t=(S.elt.offsetWidth-p())/2;t \n \n\n \n\n \n \n\n\n\n\n \n\n\n \n\n \n\n\n\n\n \n\n\n \n\n \n\n \n \n\n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n\n \n\n\n\n\n\n' +}),define("text!html/bodyViewer.html",[],function(){return'\n\n \n\n\n\n\n\n\n \n\n \n \n\n\n\n\n \n\n\n\n\n\n\n \n\n\n \n\n \n\n \n \n\n\n\n'}),define("text!html/settingsTemplateTooltip.html",[],function(){return'Available variables:\n\n\n \n
\n\n
\nExamples:\n- \n documentTitle: document title
\n- \n documentMarkdown: document in Markdown format
\n- \n strippedDocumentMarkdown: document without front matter
\n- \n documentHTML: document in HTML format
\n- \n frontMatter: YAML front matter object (undefined if not present)
\n- \n publishAttributes: attributes of the publish location (undefined if\n not publishing)
\n
<title><%= documentTitle %></title>\n
<div><%- documentHTML %></div>\n
<%\n
if(publishAttributes.provider.providerId == "github") print(documentMarkdown);\n
%>\n
\n
\nMore\n info\n
\n
\n\n Careful! Template is subject to malicious code. Don\'t copy/paste untrusted\n content.\n'}),define("text!html/settingsShortcutsExtensionTooltip.html",[],function(){return'You can create expanding macros like this:\n
\n
\n\'- - > space\': function() {\n
\n expand(\'--> \', \'→ \');\n
\n}\n
\n
\nMore\n info\n
\n
\n Careful! This is subject to malicious code. Don\'t copy/paste untrusted content.\n'}),define("text!html/settingsUserCustomExtensionTooltip.html",[],function(){return'Extension variable name:\nuserCustom\n
\n
\nExample:\n
\nuserCustom.onPreviewFinished = function() {\n
\n eventMgr.onMessage("Finished!");\n
\n};\n
\n
\nMore\n info\n
\n
\n Careful! This is subject to malicious code. Don\'t copy/paste untrusted content.'}),function(){function e(){}function t(e){this.buttonBar=d.getElementById("wmd-button-bar"+e),this.preview=d.getElementById("wmd-preview"+e),this.input=d.getElementById("wmd-input"+e)}function n(e,t){var n,r,o,a=this,s=[],c=0,u="none",d=function(e,t){u!=e&&(u=e,t||f()),m.isIE&&"moving"==u?o=null:r=setTimeout(p,1)},p=function(e){o=new i(t,e),r=void 0};this.setCommandMode=function(){u="command",f(),r=setTimeout(p,0)},this.canUndo=function(){return c>1},this.canRedo=function(){return s[c+1]?!0:!1},this.undo=function(){a.canUndo()&&(n?(n.restore(),n=null):(s[c]=new i(t),s[--c].restore(),e&&e())),u="none",t.input.focus(),p()},this.redo=function(){a.canRedo()&&(s[++c].restore(),e&&e()),u="none",t.input.focus(),p()};var f=function(){var r=o||new i(t);return r?"moving"==u?(n||(n=r),void 0):(n&&(s[c-1].text!=n.text&&(s[c++]=n),n=null),s[c++]=r,s[c+1]=null,e&&e(),void 0):!1},h=function(e){if(!e.ctrlKey&&!e.metaKey){var t=e.keyCode;t>=33&&40>=t||t>=63232&&63235>=t?d("moving"):8==t||46==t||127==t?d("deleting"):13==t?d("newlines"):27==t?d("escape"):(16>t||t>20)&&91!=t&&d("typing")}},g=function(){l.addEvent(t.input,"keypress",function(e){!e.ctrlKey&&!e.metaKey||e.altKey||89!=e.keyCode&&90!=e.keyCode||e.preventDefault()});var e=function(){(m.isIE||o&&o.text!=t.input.value)&&void 0==r&&(u="paste",f(),p())};l.addEvent(t.input,"keydown",h),l.addEvent(t.input,"mousedown",function(){d("moving")}),t.input.onpaste=e,t.input.ondrop=e},v=function(){g(),p(!0)};this.reinit=function(e,t,i,a){s=[],c=0,u="none",n=void 0,r=void 0,p(),o.text=e,o.start=t,o.end=i,o.scrollTop=a,o.setInputAreaSelection(),f()},this.setMode=d,v()}function i(t){var n=this,i=t.input;this.init=function(){l.isVisible(i)&&(this.setInputAreaSelectionStartEnd(),this.scrollTop=i.scrollTop,(!this.text&&i.selectionStart||0===i.selectionStart)&&(this.text=i.value))},this.setInputAreaSelection=function(){l.isVisible(i)&&(i.focus(),i.selectionStart=n.start,i.selectionEnd=n.end,i.scrollTop=n.scrollTop)},this.setInputAreaSelectionStartEnd=function(){n.start=i.selectionStart,n.end=i.selectionEnd},this.restore=function(){void 0!=n.text&&n.text!=i.value&&(i.value=n.text),this.setInputAreaSelection(),setTimeout(function(){i.scrollTop=n.scrollTop},0)},this.getChunks=function(){var t=new e;return t.before=l.fixEolChars(n.text.substring(0,n.start)),t.startTag="",t.selection=l.fixEolChars(n.text.substring(n.start,n.end)),t.endTag="",t.after=l.fixEolChars(n.text.substring(n.end)),t.scrollTop=n.scrollTop,t},this.setChunks=function(e){e.before=e.before+e.startTag,e.after=e.endTag+e.after,this.start=e.before.length,this.end=e.before.length+e.selection.length,this.text=e.before+e.selection+e.after,this.scrollTop=e.scrollTop},this.init()}function r(e,t,n){var i,r,o,a=3e3,s="manual",c=function(e,t){l.addEvent(e,"input",t),e.onpaste=t,e.ondrop=t,l.addEvent(e,"keypress",t),l.addEvent(e,"keydown",t)},u=function(){if(t.preview){var n=t.input.value;if(!n||n!=o){o=n;var i=(new Date).getTime();n=e.makeHtml(n);var a=(new Date).getTime();r=a-i,g(n)}}},d=function(){if(i&&(clearTimeout(i),i=void 0),"manual"!==s){var e=0;"delayed"===s&&(e=r),e>a&&(e=a),i=setTimeout(u,e)}};this.refresh=function(e){e?(o="",u()):d()},this.processingTime=function(){return r};var p,f=function(e){var n=t.preview,i=n.parentNode,r=n.nextSibling;i.removeChild(n),n.innerHTML=e,r?i.insertBefore(n,r):i.appendChild(n)},h=function(e){t.preview.innerHTML=e},m=function(e){if(p)return p(e);try{h(e),p=h}catch(t){p=f,p(e)}},g=function(e){t.preview&&(m(e),n())},v=function(){c(t.input,d),t.preview&&(t.preview.scrollTop=0)};v()}function o(e,t,n,r,o,a,s){function l(e){f.focus();var o="wmd-link-button"==e.id||"wmd-image-button"==e.id;if(e.textOp){n&&!o&&n.setCommandMode();var a=new i(t);if(!a)return;var s=a.getChunks(),l=function(){f.focus(),s&&a.setChunks(s),a.restore(),r.refresh()},c=e.textOp(s,l);c||l()}e.execute&&e.execute(n)}function c(e,n){var i="0px",r="-20px",o="-40px",a=e.getElementsByTagName("span")[0];n?(a.style.backgroundPosition=e.XShift+" "+i,e.onmouseover=function(){a.style.backgroundPosition=this.XShift+" "+o},e.onmouseout=function(){a.style.backgroundPosition=this.XShift+" "+i},m.isIE&&(e.onmousedown=function(){t.ieCachedRange=document.selection.createRange(),t.ieCachedScrollTop=t.input.scrollTop}),e.isHelp||(e.onclick=function(){return this.onmouseout&&this.onmouseout(),l(this),!1}),e.className=e.className.replace(/ disabled/g,"")):(a.style.backgroundPosition=e.XShift+" "+r,e.onmouseover=e.onmouseout=e.onclick=function(){},e.className+=" disabled")}function u(e){return"string"==typeof e&&(e=o[e]),function(){e.apply(o,arguments)}}function d(){var n=t.buttonBar,i=document.createElement("ul");i.id="wmd-button-row"+e,i.className="wmd-button-row",i=n.appendChild(i);var r=0,o=function(t,n,o,a){var s=document.createElement("li");s.className="wmd-button",s.style.left=r+"px",r+=25;var l=document.createElement("span");return s.id=t+e,s.appendChild(l),s.title=n,s.XShift=o,a&&(s.textOp=a),c(s,!0),i.appendChild(s),s},l=function(t){var n=document.createElement("li");n.className="wmd-spacer wmd-spacer"+t,n.id="wmd-spacer"+t+e,i.appendChild(n),r+=25};if(h.bold=o("wmd-bold-button",s("bold"),"0px",u("doBold")),h.italic=o("wmd-italic-button",s("italic"),"-20px",u("doItalic")),l(1),h.link=o("wmd-link-button",s("link"),"-40px",u(function(e,t){return this.doLinkOrImage(e,t,!1)})),h.quote=o("wmd-quote-button",s("quote"),"-60px",u("doBlockquote")),h.code=o("wmd-code-button",s("code"),"-80px",u("doCode")),h.image=o("wmd-image-button",s("image"),"-100px",u(function(e,t){return this.doLinkOrImage(e,t,!0)})),l(2),h.olist=o("wmd-olist-button",s("olist"),"-120px",u(function(e,t){this.doList(e,t,!0)})),h.ulist=o("wmd-ulist-button",s("ulist"),"-140px",u(function(e,t){this.doList(e,t,!1)})),h.heading=o("wmd-heading-button",s("heading"),"-160px",u("doHeading")),h.hr=o("wmd-hr-button",s("hr"),"-180px",u("doHorizontalRule")),l(3),h.undo=o("wmd-undo-button",s("undo"),"-200px",null),h.undo.execute=function(e){e&&e.undo()},h.redo=o("wmd-redo-button",s("redo"),"-220px",null),h.redo.execute=function(e){e&&e.redo()},a){var d=document.createElement("li"),f=document.createElement("span");d.appendChild(f),d.className="wmd-button wmd-help-button",d.id="wmd-help-button"+e,d.XShift="-240px",d.isHelp=!0,d.style.right="0px",d.title=s("help"),d.onclick=a.handler,c(d,!0),i.appendChild(d),h.help=d}p()}function p(){n&&(c(h.undo,n.canUndo()),c(h.redo,n.canRedo()))}var f=t.input,h={};d();var g="keydown";m.isOpera&&(g="keypress"),this.setUndoRedoButtonStates=p,this.buttons=h,this.doClick=l}function a(e,t){this.hooks=e,this.getString=t}function s(e){return e.replace(/^\s*(.*?)(?:\s+"(.+)")?\s*$/,function(e,t,n){return t=t.replace(/\?.*$/,function(e){return e.replace(/\+/g," ")}),t=decodeURIComponent(t),t=encodeURI(t).replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29"),t=t.replace(/\?.*$/,function(e){return e.replace(/\+/g,"%2b")}),n&&(n=n.trim?n.trim():n.replace(/^\s*/,"").replace(/\s*$/,""),n=n.replace(/"/g,"quot;").replace(/\(/g,"(").replace(/\)/g,")").replace(//g,">")),n?t+' "'+n+'"':t})}var l={},c={},u={},d=window.document,p=window.RegExp,f=window.navigator,h={lineLength:72},m={isIE:/msie/.test(f.userAgent.toLowerCase()),isIE_5or6:/msie 6/.test(f.userAgent.toLowerCase())||/msie 5/.test(f.userAgent.toLowerCase()),isOpera:/opera/.test(f.userAgent.toLowerCase())},g={bold:"Strong Ctrl/Cmd+B",boldexample:"strong text",italic:"Emphasis Ctrl/Cmd+I",italicexample:"emphasized text",link:"Hyperlink Ctrl/Cmd+L",linkdescription:"enter link description here",linkdialog:'Insert Hyperlink
http://example.com/ "optional title"
',quote:"BlockquoteCtrl/Cmd+Q",quoteexample:"Blockquote",code:"Code Sample"),e=e.replace(/(\*|_)(?=\S)(.+?)(?=\S)\1/g,"$2")}};n.setOptions(r),M=new Markdown.Editor(n,void 0,{undoManager:i.undoMgr}),M.hooks.set("insertLinkDialog",function(t){return T.insertLinkCallback=t,a.resetModalInputs(),e(".modal-insert-link").modal(),!0}),M.hooks.set("insertImageDialog",function(t){return T.insertLinkCallback=t,T.catchModal?!0:(a.resetModalInputs(),e(".modal-insert-image").modal(),!0)}),c.onPagedownConfigure(M),M.hooks.chain("onPreviewRefresh",c.onAsyncPreview),M.run(),i.undoMgr.init(),e(".wmd-button-row li").addClass("btn btn-success").css("left",0).find("span").hide();var o=e(".wmd-button-group1");e("#wmd-bold-button").append(e('')).appendTo(o),e("#wmd-italic-button").append(e('')).appendTo(o),o=e(".wmd-button-group2"),e("#wmd-link-button").append(e('')).appendTo(o),e("#wmd-quote-button").append(e('')).appendTo(o),e("#wmd-code-button").append(e('')).appendTo(o),e("#wmd-image-button").append(e('')).appendTo(o),o=e(".wmd-button-group3"),e("#wmd-olist-button").append(e('')).appendTo(o),e("#wmd-ulist-button").append(e('')).appendTo(o),e("#wmd-heading-button").append(e('')).appendTo(o),e("#wmd-hr-button").append(e('')).appendTo(o),o=e(".wmd-button-group5"),e("#wmd-undo-button").append(e('')).appendTo(o),e("#wmd-redo-button").append(e('')).appendTo(o)},T.onReady=function(){document.body.className+=" "+l.editMode,document.body.innerHTML=window.viewerMode===!0?d:u,a.init(),e(window).on("offline",T.setOffline),e(window).on("online",b),navigator.onLine===!1&&T.setOffline(),e(document).mousemove(m).keypress(m),r.init(),i.init(),S=window.setInterval(function(){a.updateCurrentTime(),v(),(g()===!0||window.viewerMode===!0)&&(c.onPeriodicRun(),y())},1e3),c.onReady()},c.addListener("onReady",function(){function n(e){if(e=e||"default",u!=e){var t="less!themes/"+e;-1!==window.baseDir.indexOf("-min")&&(t="css!themes/"+e),requirejs.undef(t),require([t]),u=e}}function r(n,i){t.each(document.querySelectorAll(n),function(t){var n=e(t);n.tooltip({html:!0,container:n.parents(".modal-content"),placement:"right",trigger:"manual",title:i}).click(function(){var t=this;m&&m[0]===t||a.defer(function(){e(document).on("click.close-tooltip",function(){m&&m.tooltip("hide"),m=void 0,e(document).off("click.close-tooltip")}),m=e(t).tooltip("show")})})})}e(".modal").on("shown.bs.modal",function(){var t=e(this);setTimeout(function(){t.find(".btn:first").focus(),t.find("button:first").focus(),t.find("input:enabled:visible:first").focus()},50)}).on("hidden.bs.modal",function(){i.focus(),n(window.theme)}).keyup(function(t){13!=t.which||e(t.target).is("textarea")||e(this).find(".modal-footer a:last").click()}),e(".action-insert-link").click(function(t){var n=a.getInputTextValue(e("#input-insert-link"),t);void 0!==n&&(T.insertLinkCallback(n),T.insertLinkCallback=void 0)}),e(".action-insert-image").click(function(t){var n=a.getInputTextValue(e("#input-insert-image"),t);void 0!==n&&(T.insertLinkCallback(n),T.insertLinkCallback=void 0)}),e(".modal-insert-link, .modal-insert-image").on("hidden.bs.modal",function(){void 0!==T.insertLinkCallback&&(T.insertLinkCallback(null),T.insertLinkCallback=void 0)}),e(".action-load-settings").click(function(){x()}),e(".action-apply-settings").click(function(e){w(e),e.isPropagationStopped()||window.location.reload()}),e(".action-add-google-drive-account").click(function(){3!==l.gdriveMultiAccount&&(l.gdriveMultiAccount++,s.settings=JSON.stringify(l),window.location.reload())});var u=window.theme;L=e("#input-settings-theme"),L.on("change",function(){n(this.value)}),e(".action-import-docs-settings").click(function(){e("#input-file-import-docs-settings").click()});var d;e("#input-file-import-docs-settings").change(function(n){var i=(n.dataTransfer||n.target).files;e(".modal-settings").modal("hide"),t.each(i,function(t){var n=new FileReader;n.onload=function(t){return function(n){try{d=JSON.parse(n.target.result);var i=parseInt(d.version.match(/^v(\d+)$/)[1],10),r=parseInt(s.version.match(/^v(\d+)$/)[1],10);i>r?c.onError("Incompatible version. Please upgrade StackEdit."):e(".modal-import-docs-settings").modal("show")}catch(o){c.onError("Wrong format: "+t.name)}e("#input-file-import-docs-settings").val("")}}(t),n.readAsText(t)})}),e(".action-import-docs-settings-confirm").click(function(){s.clear();var e=/^file\.|^folder\.|^publish\.|^settings$|^sync\.|^google\.|^author\.|^themeV3$|^version$/;t.each(d,function(t,n){e.test(n)&&(s[n]=t)}),window.location.reload()}),e(".action-export-docs-settings").click(function(){a.saveAs(JSON.stringify(s),"StackEdit local storage.json")}),e(".action-default-settings").click(function(){s.removeItem("settings"),s.removeItem("theme"),l.dropboxFullAccess||s.removeItem("dropbox.lastChangeId"),window.location.reload()}),e(".action-app-reset").click(function(){s.clear(),window.location.reload()}),e(".action-reset-input").click(function(){a.resetModalInputs()});var m;if(r(".tooltip-lazy-rendering","Disable preview rendering while typing in order to offload CPU. Refresh preview after 500 ms of inactivity."),r(".tooltip-default-content",["Thanks for supporting StackEdit by adding a backlink in your documents!Ctrl/Cmd+K",codeexample:"enter code here",image:"Image Ctrl/Cmd+G",imagedescription:"enter image description here",imagedialog:"
Insert Image
http://example.com/images/diagram.jpg \"optional title\"
",olist:"Numbered List
Need free image hosting?Ctrl/Cmd+O",ulist:"Bulleted List
Ctrl/Cmd+U",litem:"List item",heading:"Heading
/
Ctrl/Cmd+H",headingexample:"Heading",hr:"Horizontal Rule
Ctrl/Cmd+R",undo:"Undo - Ctrl/Cmd+Z",redo:"Redo - Ctrl/Cmd+Y",help:"Markdown Editing Help"},v="http://",b="http://";Markdown.Editor=function(e,i,s){s=s||{},"function"==typeof s.handler&&(s={helpButton:s}),s.strings=s.strings||{},s.helpButton&&(s.strings.help=s.strings.help||s.helpButton.title);var l=function(e){return s.strings[e]||g[e]};i=i||"";var c=this.hooks=new Markdown.HookCollection;c.addNoop("onPreviewRefresh"),c.addNoop("postBlockquoteCreation"),c.addFalse("insertImageDialog"),c.addFalse("insertLinkDialog"),this.getConverter=function(){return e};var u,p,f=this;this.run=function(){if(!u){u=new t(i);var h,m=new a(c,l),g=new r(e,u,function(){c.onPreviewRefresh()});s.undoManager?(p=s.undoManager,p.onButtonStateChange=function(){h.setUndoRedoButtonStates()},h&&h.setUndoRedoButtonStates()):/\?noundo/.test(d.location.href)||(p=new n(function(){g.refresh(),h&&h.setUndoRedoButtonStates()},u),this.textOperation=function(e){p.setCommandMode(),e(),f.refreshPreview()}),h=new o(i,u,p,g,m,s.helpButton,l),h.setUndoRedoButtonStates(),f.refreshPreview=function(){g.refresh(!0)},f.undoManager=p,f.uiManager=h}}},e.prototype.findTags=function(e,t){var n,i=this;e&&(n=l.extendRegExp(e,"","$"),this.before=this.before.replace(n,function(e){return i.startTag=i.startTag+e,""}),n=l.extendRegExp(e,"^",""),this.selection=this.selection.replace(n,function(e){return i.startTag=i.startTag+e,""})),t&&(n=l.extendRegExp(t,"","$"),this.selection=this.selection.replace(n,function(e){return i.endTag=e+i.endTag,""}),n=l.extendRegExp(t,"^",""),this.after=this.after.replace(n,function(e){return i.endTag=e+i.endTag,""}))},e.prototype.trimWhitespace=function(e){var t,n,i=this;e?t=n="":(t=function(e){return i.before+=e,""},n=function(e){return i.after=e+i.after,""}),this.selection=this.selection.replace(/^(\s*)/,t).replace(/(\s*)$/,n)},e.prototype.skipLines=function(e,t,n){void 0===e&&(e=1),void 0===t&&(t=1),e++,t++;var i,r;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+p.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+p.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+p.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+p.$1,this.before){for(i=r="";e--;)i+="\\n?",r+="\n";n&&(i="\\n*"),this.before=this.before.replace(new p(i+"$",""),r)}if(this.after){for(i=r="";t--;)i+="\\n?",r+="\n";n&&(i="\\n*"),this.after=this.after.replace(new p(i,""),r)}},l.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},l.addEvent=function(e,t,n){e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener(t,n,!1)},l.removeEvent=function(e,t,n){e.detachEvent?e.detachEvent("on"+t,n):e.removeEventListener(t,n,!1)},l.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},l.extendRegExp=function(e,t,n){(null===t||void 0===t)&&(t=""),(null===n||void 0===n)&&(n="");var i,r=e.toString();return r=r.replace(/\/([gim]*)$/,function(e,t){return i=t,""}),r=r.replace(/(^\/|\/$)/g,""),r=t+r+n,new p(r,i)},c.getTop=function(e,t){var n=e.offsetTop;if(!t)for(;e=e.offsetParent;)n+=e.offsetTop;return n},c.getHeight=function(e){return e.offsetHeight||e.scrollHeight},c.getWidth=function(e){return e.offsetWidth||e.scrollWidth},c.getPageSize=function(){var e,t,n,i;self.innerHeight&&self.scrollMaxY?(e=d.body.scrollWidth,t=self.innerHeight+self.scrollMaxY):d.body.scrollHeight>d.body.offsetHeight?(e=d.body.scrollWidth,t=d.body.scrollHeight):(e=d.body.offsetWidth,t=d.body.offsetHeight),self.innerHeight?(n=self.innerWidth,i=self.innerHeight):d.documentElement&&d.documentElement.clientHeight?(n=d.documentElement.clientWidth,i=d.documentElement.clientHeight):d.body&&(n=d.body.clientWidth,i=d.body.clientHeight);var r=Math.max(e,n),o=Math.max(t,i);return[r,o,n,i]},u.createBackground=function(){var e=d.createElement("div"),t=e.style;e.className="wmd-prompt-background",t.position="absolute",t.top="0",t.zIndex="1000",m.isIE?t.filter="alpha(opacity=50)":t.opacity="0.5";var n=c.getPageSize();return t.height=n[1]+"px",m.isIE?(t.left=d.documentElement.scrollLeft,t.width=d.documentElement.clientWidth):(t.left="0",t.width="100%"),d.body.appendChild(e),e},u.prompt=function(e,t,n){var i,r;void 0===t&&(t="");var o=function(e){var t=e.charCode||e.keyCode;27===t&&a(!0)},a=function(e){l.removeEvent(d.body,"keydown",o);var t=r.value;return e?t=null:(t=t.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(t)||(t="http://"+t)),i.parentNode.removeChild(i),n(t),!1},s=function(){i=d.createElement("div"),i.className="wmd-prompt-dialog",i.style.padding="10px;",i.style.position="fixed",i.style.width="400px",i.style.zIndex="1001";var n=d.createElement("div");n.innerHTML=e,n.style.padding="5px",i.appendChild(n);var s=d.createElement("form"),u=s.style;s.onsubmit=function(){return a(!1)},u.padding="0",u.margin="0",u.cssFloat="left",u.width="100%",u.textAlign="center",u.position="relative",i.appendChild(s),r=d.createElement("input"),r.type="text",r.value=t,u=r.style,u.display="block",u.width="80%",u.marginLeft=u.marginRight="auto",s.appendChild(r);var p=d.createElement("input");p.type="button",p.onclick=function(){return a(!1)},p.value="OK",u=p.style,u.margin="10px",u.display="inline",u.width="7em";var f=d.createElement("input");f.type="button",f.onclick=function(){return a(!0)},f.value="Cancel",u=f.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(p),s.appendChild(f),l.addEvent(d.body,"keydown",o),i.style.top="50%",i.style.left="50%",i.style.display="block",m.isIE_5or6&&(i.style.position="absolute",i.style.top=d.documentElement.scrollTop+200+"px",i.style.left="50%"),d.body.appendChild(i),i.style.marginTop=-(c.getHeight(i)/2)+"px",i.style.marginLeft=-(c.getWidth(i)/2)+"px"};setTimeout(function(){s();var e=t.length;if(void 0!==r.selectionStart)r.selectionStart=0,r.selectionEnd=e;else if(r.createTextRange){var n=r.createTextRange();n.collapse(!1),n.moveStart("character",-e),n.moveEnd("character",e),n.select()}r.focus()},0)};var y=a.prototype;y.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",y.unwrap=function(e){var t=new p("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");e.selection=e.selection.replace(t,"$1 $2")},y.wrap=function(e,t){this.unwrap(e);var n=new p("(.{1,"+t+"})( +|$\\n?)","gm"),i=this;e.selection=e.selection.replace(n,function(e,t){return new p("^"+i.prefixes,"").test(e)?e:t+"\n"}),e.selection=e.selection.replace(/\s+$/,"")},y.doBold=function(e,t){return this.doBorI(e,t,2,this.getString("boldexample"))},y.doItalic=function(e,t){return this.doBorI(e,t,1,this.getString("italicexample"))},y.doBorI=function(e,t,n,i){e.trimWhitespace(),e.selection=e.selection.replace(/\n{2,}/g,"\n");var r=/(\**$)/.exec(e.before)[0],o=/(^\**)/.exec(e.after)[0],a=Math.min(r.length,o.length);if(a>=n&&(2!=a||1!=n))e.before=e.before.replace(p("[*]{"+n+"}$",""),""),e.after=e.after.replace(p("^[*]{"+n+"}",""),"");else if(!e.selection&&o){e.after=e.after.replace(/^([*_]*)/,""),e.before=e.before.replace(/(\s?)$/,"");var s=p.$1;e.before=e.before+o+s}else{e.selection||o||(e.selection=i);var l=1>=n?"*":"**";e.before=e.before+l,e.after=l+e.after}},y.stripLinkDefs=function(e,t){return e=e.replace(/^[ ]{0,3}\[(\d+)\]:[ \t]*\n?[ \t]*(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|$)/gm,function(e,n,i,r,o){return t[n]=e.replace(/\s*$/,""),r?(t[n]=e.replace(/["(](.+?)[")]$/,""),r+o):""})},y.addLinkDef=function(e,t){var n=0,i={};e.before=this.stripLinkDefs(e.before,i),e.selection=this.stripLinkDefs(e.selection,i),e.after=this.stripLinkDefs(e.after,i);var r="",o=/(\[)((?:\[[^\]]*\]|[^\[\]])*)(\][ ]?(?:\n[ ]*)?\[)(\d+)(\])/g,a=function(e){n++,e=e.replace(/^[ ]{0,3}\[(\d+)\]:/," ["+n+"]:"),r+="\n"+e},s=function(e,t,r,l,c,u){return r=r.replace(o,s),i[c]?(a(i[c]),t+r+l+n+u):e};e.before=e.before.replace(o,s),t?a(t):e.selection=e.selection.replace(o,s);var l=n;return e.after=e.after.replace(o,s),e.after&&(e.after=e.after.replace(/\n*$/,"")),e.after||(e.selection=e.selection.replace(/\n*$/,"")),e.after+="\n\n"+r,l},y.doLinkOrImage=function(e,t,n){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\(.*?\))?/);var i;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return this.addLinkDef(e,null),void 0;var r=this,o=function(o){i.parentNode.removeChild(i),null!==o&&(e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),e.startTag=n?"![":"[",e.endTag="]("+s(o)+")",e.selection||(e.selection=n?r.getString("imagedescription"):r.getString("linkdescription"))),t()};return i=u.createBackground(),n?this.hooks.insertImageDialog(o)||u.prompt(this.getString("imagedialog"),v,o):this.hooks.insertLinkDialog(o)||u.prompt(this.getString("linkdialog"),b,o),!0}e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",this.addLinkDef(e,null)},y.doAutoindent=function(e){var t=this,n=!1;e.before=e.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"),e.selection||/^[ \t]*(?:\n|$)/.test(e.after)||(e.after=e.after.replace(/^[^\n]*/,function(t){return e.selection=t,""}),n=!0),/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(e.before)&&t.doList&&t.doList(e),/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(e.before)&&t.doBlockquote&&t.doBlockquote(e),/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&t.doCode&&t.doCode(e),n&&(e.after=e.selection+e.after,e.selection="")},y.doBlockquote=function(e){e.selection=e.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(t,n,i,r){return e.before+=n,e.after=r+e.after,i}),e.before=e.before.replace(/(>[ \t]*)$/,function(t,n){return e.selection=n+e.selection,""}),e.selection=e.selection.replace(/^(\s|>)+$/,""),e.selection=e.selection||this.getString("quoteexample");var t,n="",i="";if(e.before){for(var r=e.before.replace(/\n$/,"").split("\n"),o=!1,a=0;a0,/^>/.test(t)?(s=!0,!o&&t.length>1&&(o=!0)):s=/^[ \t]*$/.test(t)?!0:o,s?n+=t+"\n":(i+=n+t,n="\n")}/(^|\n)>/.test(n)||(i+=n,n="")}e.startTag=n,e.before=i,e.after&&(e.after=e.after.replace(/^\n?/,"\n")),e.after=e.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(t){return e.endTag=t,""});var l=function(t){var n=t?"> ":"";e.startTag&&(e.startTag=e.startTag.replace(/\n((>|\s)*)\n$/,function(e,t){return"\n"+t.replace(/^[ ]{0,3}>?[ \t]*$/gm,n)+"\n"})),e.endTag&&(e.endTag=e.endTag.replace(/^\n((>|\s)*)\n/,function(e,t){return"\n"+t.replace(/^[ ]{0,3}>?[ \t]*$/gm,n)+"\n"}))};/^(?![ ]{0,3}>)/m.test(e.selection)?(this.wrap(e,h.lineLength-2),e.selection=e.selection.replace(/^/gm,"> "),l(!0),e.skipLines()):(e.selection=e.selection.replace(/^[ ]{0,3}> ?/gm,""),this.unwrap(e),l(!1),!/^(\n|^)[ ]{0,3}>/.test(e.selection)&&e.startTag&&(e.startTag=e.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(e.selection)&&e.endTag&&(e.endTag=e.endTag.replace(/^\n{0,2}/,"\n\n"))),e.selection=this.hooks.postBlockquoteCreation(e.selection),/\n/.test(e.selection)||(e.selection=e.selection.replace(/^(> *)/,function(t,n){return e.startTag+=n,""}))},y.doCode=function(e){var t=/\S[ ]*$/.test(e.before),n=/^[ ]*\S/.test(e.after);if(!n&&!t||/\n/.test(e.selection)){e.before=e.before.replace(/[ ]{4}$/,function(t){return e.selection=t+e.selection,""});var i=1,r=1;/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&(i=0),/^\n(\t|[ ]{4,})/.test(e.after)&&(r=0),e.skipLines(i,r),e.selection?/^[ ]{0,3}\S/m.test(e.selection)?/\n/.test(e.selection)?e.selection=e.selection.replace(/^/gm," "):e.before+=" ":e.selection=e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm,""):(e.startTag=" ",e.selection=this.getString("codeexample"))}else e.trimWhitespace(),e.findTags(/`/,/`/),e.startTag||e.endTag?e.endTag&&!e.startTag?(e.before+=e.endTag,e.endTag=""):e.startTag=e.endTag="":(e.startTag=e.endTag="`",e.selection||(e.selection=this.getString("codeexample")))},y.doList=function(e,t,n){var i=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,r=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/,o="-",a=1,s=function(){var e;return n?(e=" "+a+". ",a++):e=" "+o+" ",e},l=function(e){return void 0===n&&(n=/^\s*\d/.test(e)),e=e.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(){return s()})};if(e.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null),!e.before||/\n$/.test(e.before)||/^\n/.test(e.startTag)||(e.before+=e.startTag,e.startTag=""),e.startTag){var c=/\d+[.]/.test(e.startTag);if(e.startTag="",e.selection=e.selection.replace(/\n[ ]{4}/g,"\n"),this.unwrap(e),e.skipLines(),c&&(e.after=e.after.replace(r,l)),n==c)return}var u=1;e.before=e.before.replace(i,function(e){return/^\s*([*+-])/.test(e)&&(o=p.$1),u=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.selection||(e.selection=this.getString("litem"));var d=s(),f=1;e.after=e.after.replace(r,function(e){return f=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.trimWhitespace(!0),e.skipLines(u,f,!0),e.startTag=d;var m=d.replace(/./g," ");this.wrap(e,h.lineLength-m.length),e.selection=e.selection.replace(/\n/g,"\n"+m)},y.doHeading=function(e){if(e.selection=e.selection.replace(/\s+/g," "),e.selection=e.selection.replace(/(^\s+|\s+$)/g,""),!e.selection)return e.startTag="## ",e.selection=this.getString("headingexample"),e.endTag=" ##",void 0;var t=0;e.findTags(/#+[ ]*/,/[ ]*#+/),/#+/.test(e.startTag)&&(t=p.lastMatch.length),e.startTag=e.endTag="",e.findTags(null,/\s?(-+|=+)/),/=+/.test(e.endTag)&&(t=1),/-+/.test(e.endTag)&&(t=2),e.startTag=e.endTag="",e.skipLines(1,1);var n=0==t?2:t-1;if(n>0){var i=n>=2?"-":"=",r=e.selection.length;for(r>h.lineLength&&(r=h.lineLength),e.endTag="\n";r--;)e.endTag+=i}},y.doHorizontalRule=function(e){e.startTag="----------\n",e.selection="",e.skipLines(2,1,!0)}}(),define("pagedown",function(){}),define("core",["jquery","underscore","crel","editor","layout","constants","utils","storage","settings","eventMgr","text!html/bodyIndex.html","text!html/bodyViewer.html","text!html/settingsTemplateTooltip.html","text!html/settingsShortcutsExtensionTooltip.html","text!html/settingsUserCustomExtensionTooltip.html","storage","pagedown"],function(e,t,n,i,r,o,a,s,l,c,u,d,p,f,h){function m(){E=!0,k=!0;var e=a.currentTime;e>I+1e3&&(I=e,c.onUserActive())}function g(){return a.currentTime-I>o.USER_IDLE_THRESHOLD&&(k=!1),k&&_}function v(){if(E!==!1&&_!==!1){void 0===C&&(C=a.randomString(),s.frontWindowId=C);var t=s.frontWindowId;t!=C&&(_=!1,void 0!==S&&clearInterval(S),e(".modal").modal("hide"),e(".modal-non-unique").modal("show"),window.close())}}function b(){D===!0&&(D=!1,c.onOfflineChanged(!1))}function y(){D===!0&&navigator.onLine===!0&&N+o.CHECK_ONLINE_PERIOD $2
",'NOTE: Backlinks in Stack Exchange Q/A are not welcome.'].join("")),r(".tooltip-shortcuts-extension",f),r(".tooltip-usercustom-extension",h),r(".tooltip-template",p),e("div.dropdown-menu").click(function(e){e.stopPropagation()}),e(".modal-non-unique").modal({backdrop:"static",keyboard:!1,show:!1}),t.each(document.querySelectorAll("img"),function(t){var n=e(t),i=n.data("stackeditSrc");i&&n.attr("src",window.baseDir+"/img/"+i)}),window.viewerMode===!1){var g=t.reduce(o.THEME_LIST,function(e,t,n){return e+'"},"");document.getElementById("input-settings-theme").innerHTML=g}}),T}),define("text!WELCOME.md",[],function(){return'Welcome to StackEdit! {#welcome}\n=====================\n\n\nHello, I am your first Markdown document within **StackEdit**[^stackedit]. Don\'t delete me, I can be helpful. I can be recovered anyway in the `Utils` tab of the `Settings` dialog.\n\n----------\n\n\nDocuments\n---------\n\n**StackEdit** stores your documents in your browser, which means all your documents are automatically saved locally and are accessible **offline!**\n\n> **NOTE:**\n> \n> - StackEdit is accessible offline after the application has been loaded for the first time.\n> - Your local documents are not shared between different browsers or computers.\n> - Clearing your browser\'s data may **delete all your local documents!** Make sure your documents are backed up using **Google Drive** or **Dropbox** synchronization (see [ Synchronization](#synchronization) section).\n\n#### Create a document\n\nYou can create a new document by clicking the button in the navigation bar. It will switch from the current document to the new one.\n\n#### Switch to another document\n\nYou can list all your local documents and switch from one to another by clicking the button in the navigation bar.\n\n#### Rename a document\n\nYou can rename the current document by clicking the document title in the navigation bar.\n\n#### Delete a document\n\nYou can delete the current document by clicking the button in the navigation bar.\n\n#### Save a document\n\nYou can save the current document to a file using the `Save as...` sub-menu from the menu.\n\n> **Tip:** See [ Publish a document](#publish-a-document) section for a description of the different output formats.\n\n\n----------\n\n\nSynchronization\n---------------\n\n**StackEdit** can be combined with **Google Drive** and **Dropbox** to have your documents centralized in the *Cloud*. The synchronization mechanism will take care of uploading your modifications or downloading the latest version of your documents.\n\n> **NOTE:**\n> \n> - Full access to **Google Drive** or **Dropbox** is required to be able to import any document in StackEdit.\n> - Imported documents are downloaded in your browser and are not transmitted to a server.\n> - If you experience problems exporting documents to Google Drive, check and optionally disable browser extensions, such as Disconnect.\n\n#### Import a document\n\nYou can import a document from the *Cloud* by going to the `Google Drive` or the `Dropbox` sub-menu and by clicking `Import from...`. Once imported, your document will be automatically synchronized with the **Google Drive** / **Dropbox** file.\n\n#### Export a document\n\nYou can export any document by going to the `Google Drive` or the `Dropbox` sub-menu and by clicking `Export to...`. Even if your document is already synchronized with **Google Drive** or **Dropbox**, you can export it to a another location. **StackEdit** can synchronize one document with multiple locations.\n\n> **Tip:** Using **Google Drive**, you can create collaborative documents to work in real time with other users. Just check the box `Create a real time collaborative document` in the dialog options when exporting to Google Drive.\n\n#### Synchronize a document\n\nOnce your document is linked to a **Google Drive** or a **Dropbox** file, **StackEdit** will periodically (every 3 minutes) synchronize it by downloading/uploading any modification. Any conflict will be detected, and a local copy of your document will be created as a backup if necessary.\n\nIf you just have modified your document and you want to force the synchronization, click the button in the navigation bar.\n\n> **NOTE:** The button is disabled when you have no document to synchronize.\n\n#### Manage document synchronization\n\nSince one document can be synchronized with multiple locations, you can list and manage synchronized locations by clicking `Manage synchronization` in the menu. This will open a dialog box allowing you to add or remove synchronization links that are associated to your document.\n\n> **NOTE:** If you delete the file from **Google Drive** or from **Dropbox**, the document will no longer be synchronized with that location.\n\n----------\n\n\nPublication\n-----------\n\nOnce you are happy with your document, you can publish it on different websites directly from **StackEdit**. As for now, **StackEdit** can publish on **Blogger**, **Dropbox**, **Gist**, **GitHub**, **Google Drive**, **Tumblr**, **WordPress** and on any SSH server.\n\n#### Publish a document\n\nYou can publish your document by going to the `Publish on` sub-menu and by choosing a website. In the dialog box, you can choose the publication format:\n\n- Markdown, to publish the Markdown text on a website that can interpret it (**GitHub** for instance),\n- HTML, to publish the document converted into HTML (on a blog for instance),\n- Template, to have a full control of the output.\n\n> **NOTE:** The default template is a simple webpage wrapping your document in HTML format. You can customize it in the `Services` tab of the `Settings` dialog.\n\n#### Update a publication\n\nAfter publishing, **StackEdit** will keep your document linked to that publish location so that you can update it easily. Once you have modified your document and you want to update your publication, click on the button in the navigation bar.\n\n> **NOTE:** The button is disabled when the document has not been published yet.\n\n#### Manage document publication\n\nSince one document can be published on multiple locations, you can list and manage publish locations by clicking `Manage publication` in the menu. This will open a dialog box allowing you to remove publication links that are associated to your document.\n\n> **NOTE:** In some cases, if the file has been removed from the website or the blog, the document will no longer be published on that location.\n\n----------\n\n\nMarkdown Extra\n--------------\n\n**StackEdit** supports **Markdown Extra**, which extends **Markdown** syntax with some nice features.\n\n> **Tip:** You can disable any **Markdown Extra** feature in the `Extensions` tab of the `Settings` dialog.\n\n\n### Tables\n\n**Markdown Extra** has a special syntax for tables:\n\nItem | Value\n--------- | -----\nComputer | 1600 USD\nPhone | 12 USD\nPipe | 1 USD\n\nYou can specify column alignment with one or two colons:\n\n| Item | Value | Qty |\n| :-------- | --------:| :--: |\n| Computer | 1600 USD | 5 |\n| Phone | 12 USD | 12 |\n| Pipe | 1 USD | 234 |\n\n\n### Definition Lists\n\n**Markdown Extra** has a special syntax for definition lists too:\n\nTerm 1\nTerm 2\n: Definition A\n: Definition B\n\nTerm 3\n\n: Definition C\n\n: Definition D\n\n > part of definition D\n\n\n### Fenced code blocks\n\nGitHub\'s fenced code blocks[^gfm] are also supported with **Prettify** syntax highlighting:\n\n```\n// Foo\nvar bar = 0;\n```\n\n> **Tip:** To use **Highlight.js** instead of **Prettify**, just configure the `Markdown Extra` extension in the `Settings` dialog.\n\n\n### Footnotes\n\nYou can create footnotes like this[^footnote].\n\n [^footnote]: Here is the *text* of the **footnote**.\n\n\n### SmartyPants\n\nSmartyPants converts ASCII punctuation characters into "smart" typographic punctuation HTML entities. For example:\n\n| | ASCII | HTML |\n ------------------|------------------------------------------|-------------------------------------\n| Single backticks | `\'Isn\'t this fun?\'` | ‘Isn’t this fun?’ |\n| Quotes | `"Isn\'t this fun?"` | “Isn’t this fun?” |\n| Dashes | `-- is an en-dash and --- is an em-dash` | – is an en-dash and — is an em-dash |\n\n\n### Table of contents\n\nYou can insert a table of contents using the marker `[TOC]`:\n\n[TOC]\n\n\n### Comments\n\nUsually, comments in Markdown are just standard HTML comments. \n**StackEdit** extends HTML comments in order to produce useful, highlighted comments in the preview but not in your exported documents. \n\n\n### MathJax\n \nYou can render *LaTeX* mathematical expressions using **MathJax**, as on [math.stackexchange.com][1]:\n\nThe *Gamma function* satisfying $\\Gamma(n) = (n-1)!\\quad\\forall\nn\\in\\mathbb N$ is via the Euler integral\n\n$$\n\\Gamma(z) = \\int_0^\\infty t^{z-1}e^{-t}dt\\,.\n$$\n\n> **Tip:** Make sure you include MathJax into your publications to render mathematical expression correctly. Your page/template should include something like: \n\n```\n\n```\n\n> **NOTE:** You can find more information:\n>\n> - about **Markdown** syntax [here][2],\n> - about **Markdown Extra** extension [here][3],\n> - about **LaTeX** mathematical expressions [here][4],\n> - about **Prettify** syntax highlighting [here][5],\n> - about **Highlight.js** syntax highlighting [here][6].\n\n [^stackedit]: [StackEdit](https://stackedit.io/) is a full-featured, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.\n\n [^gfm]: **GitHub Flavored Markdown** (GFM) is supported by StackEdit.\n\n\n [1]: http://math.stackexchange.com/\n [2]: http://daringfireball.net/projects/markdown/syntax "Markdown"\n [3]: https://github.com/jmcmanus/pagedown-extra "Pagedown Extra"\n [4]: http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference\n [5]: https://code.google.com/p/google-code-prettify/\n [6]: http://highlightjs.org/'}),define("fileMgr",["jquery","underscore","constants","core","utils","storage","settings","eventMgr","fileSystem","classes/FileDescriptor","text!WELCOME.md"],function(e,t,n,i,r,o,a,s,l,c,u){var d={};return d.currentFile=void 0,d.selectFile=function(r){if(r=r||d.currentFile,void 0===r){var o=t.size(l);r=0===o?d.createFile(n.WELCOME_DOCUMENT_TITLE,u):t.max(l,function(e){return e.selectTime||0})}d.currentFile!==r&&(d.currentFile=r,r.selectTime=(new Date).getTime(),s.onFileSelected(r),e(".action-edit-document").toggleClass("hide",r.fileIndex!=n.TEMPORARY_FILE_INDEX)),i.initEditor(r)},d.createFile=function(e,i,u,d,p){if(i=void 0!==i?i:a.defaultContent,!e){e=n.DEFAULT_FILE_TITLE;for(var f=2,h=function(t){return t.title==e};t.some(l,h);)e=n.DEFAULT_FILE_TITLE+f++}var m=n.TEMPORARY_FILE_INDEX;if(!p)do m="file."+r.randomString();while(t.has(l,m));d=d||{};var g=t.reduce(d,function(e,t){return r.storeAttributes(t),e+t.syncIndex+";"},";");o[m+".title"]=e,o[m+".content"]=i,o[m+".sync"]=g,o[m+".publish"]=";";var v=new c(m,e,d);return u&&(v.discussionListJSON=u),p||(r.appendIndexToArray("file.list",m),l[m]=v,s.onFileCreated(v)),v},d.deleteFile=function(e){e=e||d.currentFile,e.folder&&(e.folder.removeFile(e),s.onFoldersChanged()),r.removeIndexFromArray("file.list",e.fileIndex),delete l[e.fileIndex],d.currentFile===e&&(d.currentFile=void 0,d.selectFile()),s.onFileDeleted(e)},d.getFileFromSyncIndex=function(e){return t.find(l,function(n){return t.has(n.syncLocations,e)})},d.getFileFromPublishIndex=function(e){return t.find(l,function(n){return t.has(n.publishLocations,e)})},s.addListener("onReady",function(){function t(){o.addClass("hide"),r.removeClass("hide");var t=e.trim(o.val()),n=d.currentFile;t&&t!=n.title&&(n.title=t,s.onTitleChanged(n)),o.val(n.title),i.focus()}var i=e("#wmd-input");d.selectFile();var r=e(".file-title-navbar"),o=e(".input-file-title");e(".action-create-file").click(function(){setTimeout(function(){var e=d.createFile();d.selectFile(e),r.click()},400)}),e(".action-remove-file-confirm").click(function(){e(".modal-remove-file-confirm").modal("show")}),e(".action-remove-file").click(function(){d.deleteFile()}),r.click(function(){if(window.viewerMode!==!0){r.addClass("hide");var e=o.removeClass("hide");setTimeout(function(){e.focus().get(0).select()},10)}}),o.blur(function(){t()}).keyup(function(e){13==e.keyCode&&t(),27==e.keyCode&&(o.val(""),t())}),e(".action-open-stackedit").click(function(){window.location.href="."}),e(".action-edit-document").click(function(){var e=i.val(),t=d.currentFile.title,n=d.createFile(t,e);d.selectFile(n),window.location.href="."}),e(".action-welcome-file").click(function(){var e=d.createFile(n.WELCOME_DOCUMENT_TITLE,u);d.selectFile(e)})}),s.onFileMgrCreated(d),d}),define("classes/Provider",["underscore","utils","settings","eventMgr","fileMgr","editor","diff_match_patch_uncompressed","jsondiffpatch"],function(e,t,n,i,r,o,a,s){function l(e,t){this.providerId=e,this.providerName=t,this.isPublishEnabled=!0}l.prototype.parseDiscussionList=function(t){try{var n=JSON.parse(t);return e.each(n,function(t,n){if(t.discussionIndex!=n||!e.isNumber(t.selectionStart)||!e.isNumber(t.selectionEnd))throw"invalid";t.commentList&&t.commentList.forEach(function(t){if(t.author&&!e.isString(t.author)||!e.isString(t.content))throw"invalid"})}),n}catch(i){}},l.prototype.serializeContent=function(e,t){return t.length>2?e+"":e},l.prototype.parseContent=function(e){var t,n="{}",i=/$/.exec(e);return i&&(t=this.parseDiscussionList(i[1]))&&(e=e.substring(0,i.index),n=i[1]),{content:e,discussionList:t||{},discussionListJSON:n}};var c=new a;c.Match_Threshold=0,c.Patch_DeleteThreshold=0;var u=s.create({objectHash:function(e){return JSON.stringify(e)},textDiff:{minLength:9999999}}),d="merge"==n.conflictMode;return l.prototype.syncMerge=function(n,a,s,l,p,f){function h(e){function t(){(i[1]||r[1])&&(i[1]&&r[1]?(i[1]="⧸⧸"+i[1]+"⧸⧸",r[1]+="⧸⧸",n.push(i),n.push(r)):n.push([0,i[1]+r[1]]),i=[-1,""],r=[1,""])}var n=[],i=[-1,""],r=[1,""],o=20;return e.forEach(function(a,s){function l(){return 0===s||s===e.length-1}var c=a[0],u=a[1];if(0===c)if(l()||u.length>o){if(i[1]||r[1]){var d=/\s/.exec(u);if(d){var p=d.index,f=u.substring(0,p);u=u.substring(p),i[1]+=f,r[1]+=f}}if(u){for(var h=u.length;h&&/\S/.test(u[h-1]);)h--;var m=u.substring(h);u=u.substring(0,h),l()||u.length>o?(t(),n.push([0,u])):(i[1]+=u,r[1]+=u),i[1]+=m,r[1]+=m}}else i[1]+=u,r[1]+=u;else-1===c?i[1]+=u:1===c&&(r[1]+=u)}),i[1]==r[1]?n.push([0,r[1]]):t(),n}var m=n.content,g=n.title,v=n.discussionListJSON,b=n.discussionList,y=t.crc32(m),x=t.crc32(g),w=t.crc32(v),S=t.crc32(s),C=t.crc32(l),T=t.crc32(f),E=a.contentCRC!=y,k=a.contentCRC!=S,_=m!=s&&k,I=_&&E;a.titleCRC=a.titleCRC||x;var D,N,L=a.titleCRC!=x,M=a.titleCRC!=C,A=g!=l&&M,R=A&&L,P=a.discussionListCRC!=w,F=a.discussionListCRC!=T,O=v!=f&&F,B=O&&P,j=[],$=s,G=l,q=p,H=!1,U=!1,z=!1;if(!d&&(I||R||B)||I&&void 0===a.content||R&&void 0===a.title||B&&void 0===a.discussionList)r.createFile(g+" (backup)",m,v),i.onMessage('Conflict detected on "'+g+'". A backup has been created locally.');else{if(I){var V=a.content;D=c.diff_main(V,m),c.diff_cleanupSemantic(D),N=c.patch_make(V,D);var W=c.patch_apply(N,s);if($=W[0],!W[1].every(e.identity)){D=c.diff_main(m,$),D=h(D),$="";var Q;D.forEach(function(e){var t=e[0],n=e[1];0===t||Q?0===t&&Q&&(Q.selectionEnd=$.length,j.push(Q),Q=void 0):Q={selectionStart:$.length,type:"conflict"},$+=n}),Q&&(Q.selectionEnd=$.length,j.push(Q))}}_&&(P&&(H=!0),F?U=!0:(H=!0,q=b)),B&&(z=!0),R&&(N=c.patch_make(a.title,g),G=c.patch_apply(N,l)[0])}var X;if(_){var K=[];r.currentFile===n&&(X={selectionStart:o.selectionMgr.selectionStart,selectionEnd:o.selectionMgr.selectionEnd},K.push(X),n.newDiscussion&&K.push(n.newDiscussion)),H&&(K=K.concat(e.values(b))),O|=o.adjustCommentOffsets(m,$,K)}if(U){var J=e.values(p);o.adjustCommentOffsets(s,$,J)}if(z){var Y=JSON.parse(a.discussionList);D=u.diff(Y,b),u.patch(p,D),e.each(p,function(e,t){e||delete p[t]})}return j.length&&(O=!0,j.forEach(function(n){var i;do i=t.randomString()+t.randomString();while(e.has(q,i));n.discussionIndex=i,q[i]=n})),A&&(n.title=G,i.onTitleChanged(n),i.onMessage('"'+g+'" has been renamed to "'+G+'" on '+this.providerName+".")),(_||O)&&o.watcher.noWatch(e.bind(function(){if(_&&(r.currentFile===n&&(o.setValueNoWatch($),X&&o.selectionMgr.setSelectionStartEnd(X.selectionStart,X.selectionEnd)),n.content=$,i.onContentChanged(n,$)),O){n.discussionList=q;var t=u.diff(b,q),a=!1;e.each(t,function(t,r){e.isArray(t)?1===t.length?i.onDiscussionCreated(n,q[r]):i.onDiscussionRemoved(n,b[r]):a=!0}),a&&i.onCommentsChanged(n)}o.undoMgr.currentMode="sync",o.undoMgr.saveState(),i.onMessage('"'+l+'" has been updated from '+this.providerName+"."),j.length&&i.onMessage('"'+l+'" has conflicts that you have to review.')},this)),{contentCRC:S,titleCRC:C,discussionListCRC:T}},l}),define("classes/AsyncTask",["underscore","constants","utils","eventMgr"],function(e,t,n,i){function r(e){this.finished=!1,this.timeout=t.ASYNC_TASK_DEFAULT_TIMEOUT,this.retryCounter=0,this.runCallbacks=[],this.successCallbacks=[],this.errorCallbacks=[],this.force=e}function o(){if(c===!0)return l+u.timeout=t)return this.error(e),void 0;var i=1e3*Math.pow(2,this.retryCounter++);l=n.currentTime+i,c=!1,o()}},r.prototype.enqueue=function(){s.push(this),o()};var u,d=!1,p=!1;return i.addListener("onUserActive",function(){p=!0}),i.addListener("onPeriodicRun",o),r}),define("helpers/dropboxHelper",["jquery","underscore","constants","core","utils","storage","logger","settings","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s,l,c){function u(t){t.onRun(function(){return v===!0?(h=void 0,t.error(new Error("Operation not available in offline mode.|stopPublish")),void 0):void 0!==h?(t.chain(),void 0):(e.ajax({url:"libs/dropbox.min.js",dataType:"script",timeout:n.AJAX_TIMEOUT}).done(function(){h=new Dropbox.Client({key:s.dropboxFullAccess===!0?n.DROPBOX_APP_KEY:n.DROPBOX_RESTRICTED_APP_KEY,secret:s.dropboxFullAccess===!0?n.DROPBOX_APP_SECRET:n.DROPBOX_RESTRICTED_APP_SECRET}),h.authDriver(new Dropbox.AuthDriver.Popup({receiverUrl:n.BASE_URL+"html/dropbox-oauth-receiver.html",rememberUser:!0})),t.chain()}).fail(function(e){var n={status:e.status,responseText:e.statusText};p(n,t)}),void 0)})}function d(e){e.onRun(function(){function t(){r.redirectConfirm("You are being redirected to Dropbox authorization page.",function(){e.chain(i)},function(){e.error(new Error("Operation canceled."))})}function i(){o===!1?e.timeout=n.ASYNC_TASK_LONG_TIMEOUT:h.reset(),h.authenticate({interactive:!o},function(n,i){return i.isAuthenticated()===!0?(m=!0,e.chain(),void 0):o===!0?(o=!1,e.chain(t),void 0):(e.error(new Error("Access to Dropbox account is not authorized.")),void 0)})}if(m===!0)return e.chain(),void 0;var o=!0;e.chain(i)})}function p(e,n){var r=!0;if(e)if(a.error(e),"string"==typeof e)r=e;else{if(r="Dropbox error ("+e.status+": "+e.responseText+").",401===e.status||403===e.status)return m=!1,r="Access to Dropbox account is not authorized.",n.retry(new Error(r),1),void 0;if(400===e.status&&-1!==e.responseText.indexOf("oauth_nonce"))return t.each(t.keys(o),function(e){0===e.indexOf("dropbox-auth")&&o.removeItem(e)}),m=!1,n.retry(new Error(r),1),void 0;e.status<=0&&(h=void 0,m=!1,i.setOffline(),r="|stopPublish")}n.error(new Error(r))}function f(t){t.onRun(function(){function i(){r.redirectConfirm("You are being redirected to Dropbox Chooser page.",function(){t.chain()},function(){t.error(new Error("Operation canceled."))})}return b===!0?(t.chain(),void 0):(e.ajax({url:"https://www.dropbox.com/static/api/1/dropbox.js",dataType:"script",timeout:n.AJAX_TIMEOUT}).done(function(){b=!0,t.chain(i)}).fail(function(e){var n={status:e.status,responseText:e.statusText};p(n,t)}),void 0)})}var h,m=!1,g={},v=!1;l.addListener("onOfflineChanged",function(e){v=e}),g.upload=function(e,t,n){var i,r=new c;u(r),d(r),r.onRun(function(){h.writeFile(e,t,function(t,n){return t?(400===t.status&&(t='Could not upload document into path "'+e+'".'),p(t,r),void 0):(i=n,r.chain(),void 0)})}),r.onSuccess(function(){n(void 0,i)}),r.onError(function(e){n(e)}),r.enqueue()},g.checkChanges=function(e,t){var n=[],i=e||0,r=new c;u(r),d(r),r.onRun(function(){function e(){h.pullChanges(i,function(t,o){return t?(p(t,r),void 0):(i=o.cursor(),void 0!==o.changes&&(n=n.concat(o.changes)),o.shouldPullAgain?r.chain(e):r.chain(),void 0)})}r.chain(e)}),r.onSuccess(function(){t(void 0,n,i)}),r.onError(function(e){t(e)}),r.enqueue()},g.downloadMetadata=function(e,t){var n=[],i=new c;u(i),d(i),i.onRun(function(){function t(){if(0===e.length)return i.chain(),void 0;var r=e[0];h.stat(r,function(r,o){return o?(n.push(o),e.shift(),i.chain(t),void 0):(p(r,i),void 0)})}i.chain(t)}),i.onSuccess(function(){t(void 0,n)}),i.onError(function(e){t(e)}),i.enqueue()},g.downloadContent=function(e,n){var i=[],r=new c;u(r),d(r),r.onRun(function(){function n(){if(0===e.length)return r.chain(),void 0;var o=e[0];i.push(o);var a;return o.isFile===!0?a=o:void 0!==o.wasRemoved&&(a=o.stat),a?(h.readFile(a.path,function(i,o){return t.isString(o)?(a.content=o,e.shift(),r.chain(n),void 0):(p(i,r),void 0)}),void 0):(e.shift(),r.chain(n),void 0)}r.chain(n)}),r.onSuccess(function(){n(void 0,i)}),r.onError(function(e){n(e)}),r.enqueue()};var b=!1;return g.picker=function(e){var t=[],i=new c;i.timeout=n.ASYNC_TASK_LONG_TIMEOUT,u(i),f(i),i.onRun(function(){var e={};e.multiselect=!0,e.linkType="direct",e.success=function(e){for(var n=0;n :"\|?\*]+$/)?0!==e.indexOf("/")?"/"+e:e:(o.onError('"'+e+'" contains invalid characters.'),void 0)}function c(e){return"sync."+p+"."+encodeURIComponent(e.toLowerCase())}function u(e,n,i,r){r=r||"{}";var o={};return o.provider=f,o.path=e,o.version=n,o.contentCRC=t.crc32(i),o.discussionListCRC=t.crc32(r),o.syncIndex=c(e),h===!0&&(o.content=i,o.discussionList=r),o}function d(t){s.downloadMetadata(t,function(t,n){t||s.downloadContent(n,function(t,n){if(!t){var i=[];e.each(n,function(e){var t=f.parseContent(e.content),n=u(e.path,e.versionTag,t.content,t.discussionListJSON),r={};r[n.syncIndex]=n;var o=a.createFile(e.name,t.content,t.discussionListJSON,r);a.selectFile(o),i.push(o)}),0!==i.length&&o.onSyncImportSuccess(i,f)}})})}var p="dropbox",f=new r(p,"Dropbox");f.defaultPublishFormat="template";var h="merge"==i.conflictMode;return f.importFiles=function(){s.picker(function(t,n){if(!t&&0!==n.length){var i=[];e.each(n,function(e){var t=c(e),n=a.getFileFromSyncIndex(t);return void 0!==n?o.onError('"'+n.title+'" was already imported.'):(i.push(e),void 0)}),d(i)}})},f.exportFile=function(e,n,i,r,d){var p=t.getInputTextValue("#input-sync-export-dropbox-path",e);if(p=l(p),void 0===p)return d(!0);var h=c(p),m=a.getFileFromSyncIndex(h);if(void 0!==m){var g=m.title;return o.onError('File path is already synchronized with "'+g+'".'),d(!0)}var v=f.serializeContent(i,r);s.upload(p,v,function(e,t){if(e)return d(e);var n=u(t.path,t.versionTag,i,r);d(void 0,n)})},f.syncUp=function(e,t,n,i,r,o,a,l){if(a.contentCRC==t&&a.discussionListCRC==o)return l(void 0,!1);var c=f.serializeContent(e,r);s.upload(a.path,c,function(n,s){return n?l(n,!0):(a.version=s.versionTag,h===!0&&(a.content=e,a.discussionList=r),a.contentCRC=t,a.titleCRC=i,a.discussionListCRC=o,l(void 0,!0),void 0) +})},f.syncDown=function(i){var r=n[p+".lastChangeId"];s.checkChanges(r,function(r,l,u){if(r)return i(r);var d=[];e.each(l,function(e){var t=c(e.path),n=a.getFileFromSyncIndex(t),i=n&&n.syncLocations[t];return i?(e.fileDesc=n,e.syncAttributes=i,e.wasRemoved===!0?(d.push(e),void 0):(i.version!=e.stat.versionTag&&d.push(e),void 0)):void 0}),s.downloadContent(d,function(e,r){function a(){if(0===r.length)return n[p+".lastChangeId"]=u,i();var e=r.pop(),s=e.fileDesc,l=e.syncAttributes;if(e.wasRemoved===!0)return o.onError('"'+s.title+'" has been removed from Dropbox.'),s.removeSyncLocation(l),o.onSyncRemoved(s,l);var c=e.stat,d=f.parseContent(c.content),h=d.content,m=d.discussionListJSON,g=d.discussionList,v=f.syncMerge(s,l,h,s.title,g,m);l.version=c.versionTag,a===!0&&(l.content=h,l.discussionList=g),l.contentCRC=v.contentCRC,l.discussionListCRC=v.discussionListCRC,t.storeAttributes(l),setTimeout(a,5)}return e?(i(e),void 0):(setTimeout(a,5),void 0)})})},f.publish=function(e,t,n,i,r){var o=l(e.path);return void 0===o?r(!0):(s.upload(o,i,r),void 0)},f.newPublishAttributes=function(e){var n={};return n.path=t.getInputTextValue("#input-publish-dropbox-path",e),e.isPropagationStopped()?void 0:n},f}),define("helpers/googleHelper",["underscore","jquery","constants","core","utils","storage","logger","settings","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s,l,c){function u(t){var n={profile:!0},i=!0;e.each((o[t+".permissions"]||"").split(";"),function(e){e&&(n[e]=!0)}),this.setRefreshFlag=function(){i=!0},this.isAuthorized=function(t){return i===!1&&e.has(n,t)},this.add=function(r){n[r]=!0,o[t+".permissions"]=e.keys(n).join(";"),i=!1},this.getListWithNew=function(t){var i=e.keys(n);return e.has(n,t)||i.push(t),i};var r=o[t+".userId"];this.setUserId=function(e){r=e,o[t+".userId"]=r},this.getUserId=function(){return r}}function d(e){e.onRun(function(){return y===!0?(g=!1,e.error(new Error("Operation not available in offline mode.|stopPublish")),void 0):g===!0?(e.chain(),void 0):(window.delayedFunction=function(){gapi.load("client",function(){gapi.client.load("drive","v2",function(){g=!0,e.chain()})})},t.ajax({url:"https://apis.google.com/js/api.js?onload=runDelayedFunction",dataType:"script",timeout:n.AJAX_TIMEOUT}).fail(function(t){var n={code:t.status,message:t.statusText};h(n,e)}),void 0)})}function p(i,o,a){var s=v[a];s||(s=new u(a),v[a]=s),i.onRun(function(){function a(){t.ajax({url:"https://www.googleapis.com/oauth2/v1/tokeninfo",data:{access_token:d.access_token},timeout:n.AJAX_TIMEOUT,type:"GET"}).done(function(e){s.getUserId()&&s.getUserId()!=e.user_id?u():(s.setUserId(e.user_id),s.add(o),s.token=d,i.chain())}).fail(function(e){var t={code:e.status,message:e.statusText};h(t,i)})}function l(){if(m>5)return i.error(new Error("Unable to authenticate user "+s.getUserId()+", please sign in with Google.")),void 0;p===!1&&(i.timeout=n.ASYNC_TASK_LONG_TIMEOUT);var t=e.chain(x).pick(s.getListWithNew(o)).flatten().value();gapi.auth.authorize({client_id:n.GOOGLE_CLIENT_ID,scope:t,immediate:p,authuser:p===!1?"":m},function(e){d=gapi.auth.getToken(),gapi.auth.setToken(f),!e||e.error?g===!0&&p===!0?(p=!1,i.chain(c)):i.error(new Error("Access to Google account is not authorized.")):(p===!0&&m++,i.chain(a))})}function c(){return p===!0?(i.chain(l),void 0):(r.redirectConfirm("You are being redirected to Google authorization page.",function(){i.chain(l)},function(){i.error(new Error("Operation canceled."))}),void 0)}function u(){return p=!0,s.token&&s.isAuthorized(o)?(i.chain(),void 0):(s.getUserId()||(p=!1),i.chain(c),void 0)}var d,p,f=gapi.auth.getToken(),m=0;u()})}function f(e,t){var n=gapi.auth.getToken(),i=v[e];gapi.auth.setToken(i.token),t(),gapi.auth.setToken(n)}function h(t,n){var r;if(t)if(a.error(t),"string"==typeof t)r=t;else{if(r="Google error ("+t.code+": "+t.message+").",t.code>=500&&t.code<600)return n.retry(new Error(r)),void 0;if(401===t.code||403===t.code||"token_refresh_required"==t.code)return e.each(v,function(e){e.setRefreshFlag()}),r="Access to Google account is not authorized.",n.retry(new Error(r),1),void 0;(0===t.code||-1===t.code)&&(g=!1,e.each(v,function(e){e.setRefreshFlag()}),i.setOffline(),r="|stopPublish")}n.error(new Error(r))}function m(e){e.onRun(function(){return w===!0?(e.chain(),void 0):(t.ajax({url:"//www.google.com/jsapi",data:{key:n.GOOGLE_API_KEY},dataType:"script",timeout:n.AJAX_TIMEOUT}).done(function(){google.load("picker","1",{callback:function(){e.chain()}}),w=!0}).fail(function(t){var n={code:t.status,message:t.statusText};h(n,e)}),void 0)})}var g=!1,v={},b={},y=!1;l.addListener("onOfflineChanged",function(e){y=e});var x={profile:["https://www.googleapis.com/auth/userinfo.profile"],gdrive:["https://www.googleapis.com/auth/drive.install",s.gdriveFullAccess===!0?"https://www.googleapis.com/auth/drive":"https://www.googleapis.com/auth/drive.file"],blogger:["https://www.googleapis.com/auth/blogger"],picasa:["https://picasaweb.google.com/data/"]};b.refreshGdriveToken=function(e){var t=new c;d(t);var n=v[e];n&&n.setRefreshFlag(),p(t,"gdrive",e),t.enqueue()},b.upload=function(e,t,n,i,a,s,l,u){var m,g=new c;d(g),p(g,"gdrive",l),g.onRun(function(){var s="-------314159265358979323846",c="\r\n--"+s+"\r\n",u="\r\n--"+s+"--";a=a||"text/x-markdown";var d={title:n,mimeType:a};t&&(d.parents=[{kind:"drive#fileLink",id:t}]);var p="/upload/drive/v2/files",v="POST";e&&(p+="/"+e,v="PUT");var b={"Content-Type":'multipart/mixed; boundary="'+s+'"'},y=r.encodeBase64(i),x=[c,"Content-Type: application/json\r\n\r\n",JSON.stringify(d),c,"Content-Type: ",a,"\r\n","Content-Transfer-Encoding: base64\r\n","\r\n",y,u].join("");f(l,function(){var t=gapi.client.request({path:p,method:v,params:{uploadType:"multipart"},headers:b,body:x});t.execute(function(t){if(t&&t.id)return m=t,m.content=i,g.chain(),void 0;var n=t.error;void 0!==n&&void 0!==e&&(404===n.code?n='File ID "'+e+'" not found on Google Drive.|removePublish':412===n.code&&(o.removeItem(l+".gdrive.lastChangeId"),n='Conflict on file ID "'+e+'". Please restart the synchronization.')),h(n,g)})})}),g.onSuccess(function(){u(void 0,m)}),g.onError(function(e){u(e)}),g.enqueue()},b.rename=function(e,t,n,i){var r,o=new c;d(o),p(o,"gdrive",n),o.onRun(function(){var i={title:t};f(n,function(){var t=gapi.client.drive.files.patch({fileId:e,resource:i});t.execute(function(t){if(t&&t.id)return r=t,o.chain(),void 0;var n=t.error;void 0!==n&&void 0!==e&&404===n.code&&(n='File ID "'+e+'" not found on Google Drive.|removePublish'),h(n,o)})})}),o.onSuccess(function(){i(void 0,r)}),o.onError(function(e){i(e)}),o.enqueue()},b.checkChanges=function(e,t,n){var i=[],r=e||0,o=new c;d(o),p(o,"gdrive",t),o.onRun(function(){function e(){f(t,function(){var t;t=void 0===n?gapi.client.drive.changes.list({startChangeId:r+1}):gapi.client.drive.changes.list({pageToken:n}),t.execute(function(t){return t&&t.largestChangeId?(r=t.largestChangeId,n=t.nextPageToken,void 0!==t.items&&(i=i.concat(t.items)),void 0!==n?o.chain(e):o.chain(),void 0):(h(t.error,o),void 0)})})}var n;o.chain(e)}),o.onSuccess(function(){n(void 0,i,r)}),o.onError(function(e){n(e)}),o.enqueue()},b.downloadMetadata=function(e,i,r,o){var a=[],s=new c;d(s),o||p(s,"gdrive",i),s.onRun(function(){function r(){if(0===e.length)return s.chain(),void 0;var o=e[0],l={},c=v[i];c&&c.token&&(l.Authorization="Bearer "+c.token.access_token),t.ajax({url:"https://www.googleapis.com/drive/v2/files/"+o,headers:l,data:{key:n.GOOGLE_API_KEY},dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(t){a.push(t),e.shift(),s.chain(r)}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&(t='File ID "'+o+'" not found on Google Drive.'),h(t,s)})}s.chain(r)}),s.onSuccess(function(){r(void 0,a)}),s.onError(function(e){r(e)}),s.enqueue()},b.downloadContent=function(e,i,r,o){var a=[],s=new c;s.timeout=n.ASYNC_TASK_LONG_TIMEOUT,d(s),o||p(s,"gdrive",i),s.onRun(function(){function r(){if(0===e.length)return s.chain(),void 0;var o=e[0];a.push(o);var l;if("drive#file"==o.kind?l=o:"drive#change"==o.kind&&(l=o.file),!l)return e.shift(),s.chain(r),void 0;var c=l.downloadUrl;0===l.mimeType.indexOf("application/vnd.google-apps.drive-sdk")&&(l.isRealtime=!0,c="https://www.googleapis.com/drive/v2/files/"+l.id+"/realtime");var u={},d=v[i];d&&d.token&&(u.Authorization="Bearer "+d.token.access_token),t.ajax({url:c,headers:u,data:{key:n.GOOGLE_API_KEY},dataType:l.isRealtime?"json":"text",timeout:n.AJAX_TIMEOUT}).done(function(t){l.content=l.isRealtime?t.data.value.content.value:t,e.shift(),s.chain(r)}).fail(function(e){var t={code:e.status,message:e.statusText};h(t,s)})}s.chain(r)}),s.onSuccess(function(){r(void 0,a)}),s.onError(function(e){r(e)}),s.enqueue()},b.uploadImg=function(e,i,r,o){var a,s="google.picasa0",l=new c;d(l),p(l,"picasa",s),l.onRun(function(){var o={Slug:e};e.match(/.jpe?g$/i)?o["Content-Type"]="image/jpeg":e.match(/.png$/i)?o["Content-Type"]="image/png":e.match(/.gif$/i)&&(o["Content-Type"]="image/gif");var c=v[s];c&&c.token&&(o.Authorization="Bearer "+c.token.access_token),t.ajax({url:n.PICASA_PROXY_URL+"upload/"+r,headers:o,data:i,processData:!1,dataType:"xml",timeout:n.AJAX_TIMEOUT,type:"POST"}).done(function(e){a=e,l.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};200==t.code&&(t.message=e.responseText),h(t,l)})}),l.onSuccess(function(){o(void 0,a)}),l.onError(function(e){o(e)}),l.enqueue()};var w=!1;return b.picker=function(e,i,o){function a(){void 0!==s&&(s.setVisible(!1),t(".modal-backdrop, .picker").remove())}var s,l=[],u=new c;u.timeout=n.ASYNC_TASK_LONG_TIMEOUT,d(u),"doc"==i||"folder"==i?p(u,"gdrive",o):(o="google.picasa0",p(u,"picasa",o)),m(u),u.onRun(function(){var e=v[o],c=new google.picker.PickerBuilder;c.setAppId(n.GOOGLE_DRIVE_APP_ID);var d;"doc"==i?(d=new google.picker.DocsView(google.picker.ViewId.DOCS),d.setParent("root"),d.setIncludeFolders(!0),d.setMimeTypes(["text/x-markdown","text/plain","application/octet-stream","application/vnd.google-apps.drive-sdk."+n.GOOGLE_DRIVE_APP_ID].join(",")),c.enableFeature(google.picker.Feature.NAV_HIDDEN),c.enableFeature(google.picker.Feature.MULTISELECT_ENABLED),c.addView(d),e&&e.token&&c.setOAuthToken(e.token.access_token)):"folder"==i?(d=new google.picker.DocsView(google.picker.ViewId.FOLDERS),d.setParent("root"),d.setIncludeFolders(!0),d.setSelectFolderEnabled(!0),d.setMimeTypes("application/vnd.google-apps.folder"),c.enableFeature(google.picker.Feature.NAV_HIDDEN),c.addView(d),e&&e.token&&c.setOAuthToken(e.token.access_token)):"img"==i&&(d=new google.picker.PhotosView,d.setType("flat"),c.addView(d),d=new google.picker.PhotosView,d.setType("ofuser"),c.addView(d),c.addView(google.picker.ViewId.PHOTO_UPLOAD),e&&e.token&&c.setOAuthToken(e.token.access_token)),c.setCallback(function(e){(e.action==google.picker.Action.PICKED||e.action==google.picker.Action.CANCEL)&&(e.action==google.picker.Action.PICKED&&(l=e.docs),a(),u.chain())}),s=c.build(),t(r.createBackdrop()).click(function(){a(),u.chain()}),s.setVisible(!0)}),u.onSuccess(function(){e(void 0,l)}),u.onError(function(t){a(),e(t)}),u.enqueue()},b.uploadBlogger=function(e,i,r,o,a,s,l,u,f){var m="google.blogger0",g=new c;d(g),p(g,"blogger",m),g.onRun(function(){function c(){var e="https://www.googleapis.com/blogger/v3/blogs/"+i+"/posts/",a={kind:"blogger#post",blog:{id:i},labels:o,title:l,content:u},s="POST";void 0!==r&&(e+=r,a.id=r,s="PUT"),t.ajax({url:e,data:JSON.stringify(a),headers:f,type:s,contentType:"application/json",dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){r=e.id,g.chain(d)}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&void 0!==r&&(t="Post "+r+" not found on Blogger.|removePublish"),h(t,g)})}function d(){var e="https://www.googleapis.com/blogger/v3/blogs/"+i+"/posts/"+r;a?e+="/revert":(e+="/publish",s&&(e+="?publishDate="+s.toISOString())),t.ajax({url:e,headers:f,type:"POST",dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(){g.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&(t="Post "+r+" not found on Blogger.|removePublish"),h(t,g)})}function p(){return void 0!==i?(g.chain(c),void 0):(t.ajax({url:"https://www.googleapis.com/blogger/v3/blogs/byurl",data:{url:e},headers:f,dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){i=e.id,g.chain(c)}).fail(function(t){var n={code:t.status,message:t.statusText};404===n.code&&(n='Blog "'+e+'" not found on Blogger.|removePublish'),h(n,g)}),void 0)}var f={},b=v[m];b&&b.token&&(f.Authorization="Bearer "+b.token.access_token),g.chain(p)}),g.onSuccess(function(){f(void 0,i,r)}),g.onError(function(e){f(e)}),g.enqueue()},b.uploadBloggerPage=function(e,i,r,o,a,s,l,u){var f="google.blogger0",m=new c;d(m),p(m,"blogger",f),m.onRun(function(){function o(){var e="https://www.googleapis.com/blogger/v3/blogs/"+i+"/pages/",o={kind:"blogger#page",blog:{id:i},title:s,content:l},a="POST";void 0!==r&&(e+=r,o.id=r,a="PUT"),t.ajax({url:e,data:JSON.stringify(o),headers:c,type:a,contentType:"application/json",dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){r=e.id,m.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&void 0!==r&&(t="Page "+r+" not found on Blogger.|removePublish"),h(t,m)})}function a(){return void 0!==i?(m.chain(o),void 0):(t.ajax({url:"https://www.googleapis.com/blogger/v3/blogs/byurl",data:{url:e},headers:c,dataType:"json",timeout:n.AJAX_TIMEOUT}).done(function(e){i=e.id,m.chain(o)}).fail(function(t){var n={code:t.status,message:t.statusText};404===n.code&&(n='Blog "'+e+'" not found on Blogger.|removePublish'),h(n,m)}),void 0)}var c={},u=v[f];u&&u.token&&(c.Authorization="Bearer "+u.token.access_token),m.chain(a)}),m.onSuccess(function(){u(void 0,i,r)}),m.onError(function(e){u(e)}),m.enqueue()},window.delayedFunction=void 0,window.runDelayedFunction=function(){void 0!==window.delayedFunction&&window.delayedFunction()},b}),define("text!html/dialogExportGdrive.html",[],function(){return' \n\n'}),define("text!html/dialogAutoSyncGdrive.html",[],function(){return' \n\n\n'}),define("providers/gdriveProviderBuilder",["jquery","underscore","constants","utils","storage","logger","classes/Provider","settings","eventMgr","fileMgr","editor","helpers/googleHelper","text!html/dialogExportGdrive.html","text!html/dialogAutoSyncGdrive.html"],function(e,t,n,i,r,o,a,s,l,c,u,d,p,f){return function(o,u,h){function m(e){return"sync."+o+"."+e}function g(e,t,n,r,o){o=o||"{}";var a={};return a.provider=y,a.id=e,a.etag=t,a.contentCRC=i.crc32(n),a.titleCRC=i.crc32(r),a.discussionListCRC=i.crc32(o),a.syncIndex=m(e),x===!0&&(a.content=n,a.title=r,a.discussionList=o),a}function v(e){d.downloadMetadata(e,b,function(e,n){e||d.downloadContent(n,b,function(e,n){if(!e){var i,r=[];t.each(n,function(e){var t,n=y.parseContent(e.content);if(e.isRealtime)l.onError("Real time synchronization is not supported anymore. Please use standard synchronization.");else{var o=g(e.id,e.etag,n.content,e.title,n.discussionListJSON);t={},t[o.syncIndex]=o}i=c.createFile(e.title,n.content,n.discussionListJSON,t),r.push(i)}),void 0!==i&&(l.onSyncImportSuccess(r,y),c.selectFile(i))}})})}var b="google.gdrive"+h,y=new a(o,u);y.defaultPublishFormat="template",y.exportPreferencesInputIds=[o+"-parentid"];var x="merge"==s.conflictMode;return y.importFiles=function(){d.picker(function(e,n){if(!e&&0!==n.length){var i=[];t.each(n,function(e){var t=m(e.id),n=c.getFileFromSyncIndex(t);return void 0!==n?(l.onError('"'+n.title+'" was already imported.'),void 0):(i.push(e.id),void 0)}),v(i)}},"doc",b)},y.exportFile=function(e,t,n,r,a){var s=i.getInputTextValue("#input-sync-export-"+o+"-fileid");if(s){var u=m(s),p=c.getFileFromSyncIndex(u);if(void 0!==p)return l.onError('File ID is already synchronized with "'+p.title+'".'),a(!0),void 0}var f=i.getInputTextValue("#input-sync-export-"+o+"-parentid"),h=y.serializeContent(n,r);d.upload(s,f,t,h,void 0,void 0,b,function(e,i){if(e)return a(e),void 0;var o=g(i.id,i.etag,n,t,r);a(void 0,o)})},y.syncUp=function(e,t,n,i,r,o,a,s){if(a.contentCRC==t&&a.titleCRC==i&&a.discussionListCRC==o)return s(void 0,!1);if(a.isRealtime){var u=c.getFileFromSyncIndex(a.syncIndex);return u.removeSyncLocation(a),l.onSyncRemoved(u,a),l.onError("Real time synchronization is not supported anymore. Please use standard synchronization.")}var p=y.serializeContent(e,r);d.upload(a.id,void 0,n,p,void 0,a.etag,b,function(l,c){return l?(s(l,!0),void 0):(a.etag=c.etag,delete a.isRealtime,x===!0&&(a.content=e,a.title=n,a.discussionList=r),a.contentCRC=t,a.titleCRC=i,a.discussionListCRC=o,s(void 0,!0),void 0)})},y.syncDown=function(e){var n=parseInt(r[b+".gdrive.lastChangeId"],10);d.checkChanges(n,b,function(n,o,a){if(n)return e(n),void 0;var s=[];t.each(o,function(e){var t=m(e.fileId),n=c.getFileFromSyncIndex(t),i=n&&n.syncLocations[t];return i?(e.fileDesc=n,e.syncAttributes=i,e.deleted===!0?(s.push(e),void 0):(i.etag!=e.file.etag&&s.push(e),void 0)):void 0}),d.downloadContent(s,b,function(t,n){function o(){if(0===n.length)return r[b+".gdrive.lastChangeId"]=a,e();var t=n.pop(),s=t.fileDesc,c=t.syncAttributes;if(t.deleted===!0)return l.onError('"'+s.title+'" has been removed from '+u+"."),s.removeSyncLocation(c),l.onSyncRemoved(s,c);var d=t.file,p=y.parseContent(d.content),f=p.content,h=d.title,m=p.discussionListJSON,g=p.discussionList,v=y.syncMerge(s,c,f,h,g,m);c.etag=d.etag,o===!0&&(c.content=f,c.title=h,c.discussionList=m),c.contentCRC=v.contentCRC,c.titleCRC=v.titleCRC,c.discussionListCRC=v.discussionListCRC,i.storeAttributes(c),setTimeout(o,5)}return t?(e(t),void 0):(setTimeout(o,5),void 0)})})},y.publish=function(e,t,n,i,r){var o="markdown"!=e.format?"text/html":void 0;d.upload(e.id,void 0,e.fileName||n,i,o,void 0,b,function(t,n){return t?(r(t),void 0):(e.id=n.id,r(),void 0)})},y.newPublishAttributes=function(e){var t={};return t.id=i.getInputTextValue("#input-publish-"+o+"-fileid"),t.fileName=i.getInputTextValue("#input-publish-"+o+"-filename"),e.isPropagationStopped()?void 0:t},y.setAutosyncDialogConfig=function(){var e=y.autosyncConfig;i.setInputRadio("radio-autosync-"+o+"-mode",e.mode||"off"),i.setInputValue("#input-autosync-"+o+"-parentid",e.parentId)},y.getAutosyncDialogConfig=function(){var e={};return e.mode=i.getInputRadio("radio-autosync-"+o+"-mode"),e.parentId=i.getInputTextValue("#input-autosync-"+o+"-parentid"),e},y.autosyncFile=function(e,t,n,i,r){var o=i.parentId;d.upload(void 0,o,e,t,void 0,void 0,b,function(i,o){if(i)return r(i),void 0;var a=g(o.id,o.etag,t,e,n);r(void 0,a)})},y.isPublishEnabled=s.gdriveMultiAccount>h,l.addListener("onReady",function(){e(".submenu-sync-"+o).toggle(s.gdriveMultiAccount>h);var a=document.querySelector(".modal-upload-"+o);a&&(a.innerHTML=t.template(p,{providerId:o,providerName:u}));var y=document.querySelector(".modal-autosync-"+o);if(y&&(y.innerHTML=t.template(f,{providerId:o,providerName:u})),e(".action-export-"+o+"-choose-folder").click(function(){d.picker(function(t,n){t||0===n.length||(e(".modal-upload-"+o).modal(),i.setInputValue("#input-sync-export-"+o+"-parentid",n[0].id))},"folder",b)}),e(".action-autosync-"+o+"-choose-folder").click(function(){d.picker(function(t,n){t||0===n.length||(e(".modal-autosync-"+o).modal(),i.setInputValue("#input-autosync-"+o+"-parentid",n[0].id))},"folder",b)}),e(".action-remove-google-drive-state").click(function(){r.removeItem("gdrive.state")}),!(h>=s.gdriveMultiAccount)){var x=i.retrieveIgnoreError("gdrive.state"),w=r[b+".userId"];if(void 0!==x){if(w&&x.userId!=w)return h===s.gdriveMultiAccount-1&&(3===s.gdriveMultiAccount?(l.onError("None of your 3 Google Drive accounts is able to perform this request."),r.removeItem("gdrive.state")):e(".modal-add-google-drive-account").modal()),void 0;if(r.removeItem("gdrive.state"),"create"==x.action)d.upload(void 0,x.folderId,n.GDRIVE_DEFAULT_FILE_TITLE,s.defaultContent,void 0,void 0,b,function(e,t){if(!e){var n=g(t.id,t.etag,t.content,t.title),i={};i[n.syncIndex]=n;var r=c.createFile(t.title,t.content,void 0,i);c.selectFile(r),l.onMessage('"'+t.title+'" created successfully on '+u+".")}});else if("open"==x.action){var S=[];t.each(x.ids,function(e){var t=m(e),n=c.getFileFromSyncIndex(t);void 0!==n?n!==c.currentFile&&c.selectFile(n):S.push(e)}),v(S)}}}}),y}}),define("providers/gdriveProvider",["providers/gdriveProviderBuilder"],function(e){return e("gdrive","Google Drive",0)}),define("providers/gdrivesecProvider",["providers/gdriveProviderBuilder"],function(e){return e("gdrivesec","Google Drive (2nd account)",1)}),define("providers/gdriveterProvider",["providers/gdriveProviderBuilder"],function(e){return e("gdriveter","Google Drive (3rd account)",2)}),define("synchronizer",["jquery","underscore","utils","storage","eventMgr","fileSystem","fileMgr","classes/Provider","providers/dropboxProvider","providers/gdriveProvider","providers/gdrivesecProvider","providers/gdriveterProvider"],function(e,t,n,i,r,o,a,s){function l(e){function i(){function o(){if(0===s.length)return i();var t=s.pop();t.provider.syncUp(c,u,d,p,f,m,t,function(i,r){return r===!0&&(h=!0),i?e(i):(r&&n.storeAttributes(t),o(),void 0)})}if(0===r.length)return l(e);var a=r.pop(),s=t.values(a.syncLocations);if(0===s.length)return i();var c=a.content,u=n.crc32(c),d=a.title,p=n.crc32(d),f=a.discussionListJSON,m=n.crc32(f);o()}var r=[];h===!0?(h=!1,r=t.values(o),i()):e()}function c(e){function n(){if(0===i.length)return e();var t=i.pop();return p.hasSync(t)?(t.syncDown(function(t){return t?e(t):(n(),void 0)}),void 0):n()}var i=t.values(f);n()}function u(e){function n(){function o(){if(0===s.length)return n();var t=s.pop();t.autosyncFile(a.title,a.content,a.discussionListJSON,t.autosyncConfig,function(t,n){return t?e(t):(a.addSyncLocation(n),r.onSyncExportSuccess(a,n),o(),void 0)})}if(0===i.length)return e();var a=i.pop(),s=t.filter(f,function(e){return"all"==e.autosyncConfig.mode});o()}var i=t.filter(o,function(e){return 0===t.size(e.syncLocations)});n()}function d(i){n.resetModalInputs();var r=n.retrieveIgnoreError(i.providerId+".exportPreferences");r&&t.each(i.exportPreferencesInputIds,function(e){var i=r[e];t.isBoolean(i)?n.setInputChecked("#input-sync-export-"+e,i):n.setInputValue("#input-sync-export-"+e,i)}),e(".modal-upload-"+i.providerId).modal()}var p={},f=t.chain(arguments).map(function(e){return e instanceof s&&[e.providerId,e]}).compact().object().value();!function(){var e={};t.each(o,function(t){n.retrieveIndexArray(t.fileIndex+".sync").forEach(function(o){try{var a=JSON.parse(i[o]);a.syncIndex=o;var s=f[a.provider];if(!s)throw new Error("Invalid provider ID: "+a.provider);a.provider=s,t.syncLocations[o]=a,e[o]=a}catch(l){r.onError(l),n.removeIndexFromArray(t.fileIndex+".sync",o)}})}),Object.keys(i).forEach(function(t){var n=t.match(/sync\.\S+/);n&&!e.hasOwnProperty(n[0])&&i.removeItem(t)})}(),t.each(f,function(e){e.autosyncConfig=n.retrieveIgnoreError(e.providerId+".autosyncConfig")||{}}),p.hasSync=function(e){return t.some(o,function(n){return t.some(n.syncLocations,function(t){return void 0===e||t.provider===e})})};var h=!1,m=!1;r.addListener("onOfflineChanged",function(e){m=e});var g=!1;return p.sync=function(){function e(e){return void 0!==e?(g=!1,r.onSyncRunning(!1),!0):!1}return g===!0||m===!0?!1:(g=!0,r.onSyncRunning(!0),h=!0,u(function(t){e(t)||c(function(t){e(t)||l(function(t){e(t)||(g=!1,r.onSyncRunning(!1),r.onSyncSuccess())})})}),!0)},r.addListener("onFileCreated",function(e){0===t.size(e.syncLocations)&&t.each(f,function(t){"new"==t.autosyncConfig.mode&&t.autosyncFile(e.title,e.content,e.discussionListJSON,t.autosyncConfig,function(t,n){t||(e.addSyncLocation(n),r.onSyncExportSuccess(e,n))})})}),r.addListener("onReady",function(){t.each(f,function(o){e(".action-sync-import-"+o.providerId).click(function(e){o.importFiles(e)}),e(".action-sync-export-dialog-"+o.providerId).click(function(){d(o)}),e(".action-autosync-dialog-"+o.providerId).click(function(){n.resetModalInputs(),o.setAutosyncDialogConfig(o),e(".modal-autosync-"+o.providerId).modal()}),e(".action-sync-export-"+o.providerId).click(function(e){var n=a.currentFile;o.exportFile(e,n.title,n.content,n.discussionListJSON,function(e,t){e||(n.addSyncLocation(t),r.onSyncExportSuccess(n,t))});var s={};t.each(o.exportPreferencesInputIds,function(e){var t=document.getElementById("input-sync-export-"+e);s[e]="checkbox"==t.type?t.checked:t.value}),i[o.providerId+".exportPreferences"]=JSON.stringify(s)}),e(".action-autosync-"+o.providerId).click(function(e){var t=o.getAutosyncDialogConfig(e);void 0!==t&&(i[o.providerId+".autosyncConfig"]=JSON.stringify(t),o.autosyncConfig=t)})})}),r.onSynchronizerCreated(p),p}),define("providers/downloadProvider",["jquery","constants","eventMgr","utils","fileMgr","classes/Provider","classes/AsyncTask"],function(e,t,n,i,r,o,a){var s=new o("download");return s.sharingAttributes=["url"],s.importPublic=function(n,i){var r,o,s=new a(!0);s.onRun(function(){var i=n.url,a=i.lastIndexOf("/");return-1===a?(s.error(new Error("Invalid URL parameter.")),void 0):(r=i.substring(a+1),e.ajax({url:t.DOWNLOAD_PROXY_URL+"download?url="+i,type:"GET",dataType:"text",timeout:t.AJAX_TIMEOUT}).done(function(e){o=e,s.chain()}).fail(function(){s.error(new Error("Unable to access URL "+i))}),void 0)}),s.onSuccess(function(){i(void 0,r,o)}),s.onError(function(e){i(e)}),s.enqueue()},n.addListener("onReady",function(){e(".action-import-url").click(function(e){var t=i.getInputTextValue("#input-import-url",e);t&&s.importPublic({url:t},function(e,t,n){if(!e){var i=r.createFile(t,n);r.selectFile(i)}})})}),s}),define("helpers/githubHelper",["jquery","constants","core","utils","storage","logger","settings","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s,l){function c(n){n.onRun(function(){return m===!0?(p=!1,n.error(new Error("Operation not available in offline mode.|stopPublish")),void 0):p===!0?(n.chain(),void 0):(e.ajax({url:"libs/github.js",dataType:"script",timeout:t.AJAX_TIMEOUT}).done(function(){p=!0,n.chain()}).fail(function(e){var t={error:e.status,message:e.statusText};d(t,n)}),void 0)})}function u(n){var o,s;n.onRun(function(){function l(){i.redirectConfirm("You are being redirected to GitHub authorization page.",function(){n.chain(c)},function(){n.error(new Error("Operation canceled."))})}function c(){r.removeItem("githubCode");var e=a.githubFullAccess?"repo,gist":"public_repo,gist";o=i.popupWindow("html/github-oauth-client.html?client_id="+t.GITHUB_CLIENT_ID+"&scope="+e,"stackedit-github-oauth",960,600),o.focus(),s=setInterval(function(){if(o.closed===!0){if(clearInterval(s),o=void 0,s=void 0,h=r.githubCode,void 0===h)return n.error(new Error(p)),void 0;r.removeItem("githubCode"),n.chain(u)}},500)}function u(){e.getJSON(t.GATEKEEPER_URL+"authenticate/"+h,function(e){void 0!==e.token?(d=e.token,r.githubToken=d,f=new Github({token:d,auth:"oauth"}),n.chain()):n.error(new Error(p))})}if(void 0!==f)return n.chain(),void 0;var d=r.githubToken;if(void 0!==d)return f=new Github({token:d,auth:"oauth"}),n.chain(),void 0;var p="Failed to retrieve a token from GitHub."; +n.timeout=t.ASYNC_TASK_LONG_TIMEOUT;var h;n.chain(l)}),n.onError(function(){void 0!==s&&clearInterval(s),void 0!==o&&o.close()})}function d(e,t){var i;if(e)if(o.error(e),"string"==typeof e)i=e;else{if(i="Could not publish on GitHub.",401===e.error||403===e.error)return f=void 0,r.removeItem("githubToken"),i="Access to GitHub account is not authorized.",t.retry(new Error(i),1),void 0;e.error<=0&&(p=!1,f=void 0,n.setOffline(),i="|stopPublish")}t.error(new Error(i))}var p,f,h={},m=!1;return s.addListener("onOfflineChanged",function(e){m=e}),h.upload=function(e,t,n,i,r,o,a){var s=new l;c(s),u(s),s.onRun(function(){function a(){var e=f.getUser();e.show(void 0,function(e,n){return e?(d(e,s),void 0):(t=n.login,s.chain(l),void 0)})}function l(){var a=f.getRepo(t,e);a.write(n,i,r,o,function(e){return e?(d(e,s),void 0):(s.chain(),void 0)})}t?s.chain(l):s.chain(a)}),s.onSuccess(function(){a()}),s.onError(function(e){a(e)}),s.enqueue()},h.uploadGist=function(e,t,n,i,r,o){var a=new l;c(a),u(a),a.onRun(function(){var o=f.getGist(e),s={};s[t]={content:r};var l=o.update;void 0===e&&(l=o.create),l({description:i,"public":n,files:s},function(t,n){return t?(404===t.error&&void 0!==e&&(t="Gist "+e+" not found on GitHub.|removePublish"),d(t,a),void 0):(e=n.id,a.chain(),void 0)})}),a.onSuccess(function(){o(void 0,e)}),a.onError(function(e){o(e)}),a.enqueue()},h.downloadGist=function(e,t,n){var i=new l(!0);c(i);var r,o;i.onRun(function(){var n=new Github({}),a=n.getGist(e);a.read(function(n,a){if(n)return i.error(new Error("Error trying to access Gist "+e+".")),void 0;r=a.description;var s=a.files[t];return void 0===s?(i.error(new Error("Gist "+e+' does not contain "'+t+'".')),void 0):(o=s.content,i.chain(),void 0)})}),i.onSuccess(function(){n(void 0,r,o)}),i.onError(function(e){n(e)}),i.enqueue()},h}),define("providers/gistProvider",["utils","classes/Provider","helpers/githubHelper"],function(e,t,n){var i=new t("gist","Gist");return i.publishPreferencesInputIds=["gist-public"],i.sharingAttributes=["gistId","filename"],i.publish=function(e,t,i,r,o){n.uploadGist(e.gistId,e.filename,e.isPublic,i,r,function(t,n){return t?(o(t),void 0):(e.gistId=n,o(),void 0)})},i.newPublishAttributes=function(t){var n={};return n.gistId=e.getInputTextValue("#input-publish-gist-id"),n.filename=e.getInputTextValue("#input-publish-filename",t),n.isPublic=e.getInputChecked("#input-publish-gist-public"),t.isPropagationStopped()?void 0:n},i.importPublic=function(e,t){n.downloadGist(e.gistId,e.filename,t)},i}),define("sharing",["jquery","underscore","constants","utils","eventMgr","fileMgr","classes/AsyncTask","classes/Provider","providers/downloadProvider","providers/gistProvider"],function(e,t,n,i,r,o,a,s){var l={},c=t.chain(arguments).map(function(e){return e instanceof s&&[e.providerId,e]}).compact().object().value(),u=!1;return r.addListener("onOfflineChanged",function(e){u=e}),l.createLink=function(e,i){var r=c[e.provider.providerId];if(void 0!==e.sharingLink||void 0===r||"markdown"!=e.format)return i(),void 0;var o=[n.MAIN_URL,"viewer#!provider=",r.providerId];t.each(r.sharingAttributes,function(t){o.push("&"),o.push(t),o.push("="),o.push(encodeURIComponent(e[t]))}),e.sharingLink=o.join(""),i()},r.addListener("onReady",function(){if(window.viewerMode!==!1){var n=i.getURLParameter("provider");void 0===n&&(n="download");var r=c[n];if(void 0!==r){var a={};t.each(r.sharingAttributes,function(e){var t=i.getURLParameter(e);return t?(a[e]=t,void 0):(a=void 0,void 0)}),void 0!==a&&(e("#preview-contents, .navbar .file-title-navbar").hide(),r.importPublic(a,function(t,n,i){if(e("#preview-contents, .navbar .file-title-navbar").show(),!t){var r=o.createFile(n,i,void 0,void 0,!0);o.selectFile(r)}}))}}}),l}),define("providers/bloggerProvider",["underscore","utils","classes/Provider","helpers/googleHelper"],function(e,t,n,i){var r=new n("blogger","Blogger");return r.defaultPublishFormat="html",r.publishPreferencesInputIds=["blogger-url"],r.publish=function(t,n,r,o,a){var s=t.labelList||[];n&&void 0!==n.tags&&(s=n.tags),e.isString(s)&&(s=e.compact(s.split(/[\s,]/)));var l=n&&n.published===!1,c=n&&n.date;i.uploadBlogger(t.blogUrl,t.blogId,t.postId,s,l,c,r,o,function(e,n,i){return e?(a(e),void 0):(t.blogId=n,t.postId=i,a(),void 0)})},r.newPublishAttributes=function(e){var n={},i=t.getInputTextValue("#input-publish-blogger-url",e);return void 0!==i&&(n.blogUrl=t.checkUrl(i)),n.postId=t.getInputTextValue("#input-publish-postid"),e.isPropagationStopped()?void 0:n},r}),define("providers/bloggerPageProvider",["underscore","utils","classes/Provider","helpers/googleHelper"],function(e,t,n,i){var r=new n("bloggerpage","Blogger Page");return r.defaultPublishFormat="html",r.publishPreferencesInputIds=["blogger-url"],r.publish=function(e,t,n,r,o){var a=t&&t.published===!1,s=t&&t.date;i.uploadBloggerPage(e.blogUrl,e.blogId,e.pageId,a,s,n,r,function(t,n,i){return t?(o(t),void 0):(e.blogId=n,e.pageId=i,o(),void 0)})},r.newPublishAttributes=function(e){var n={},i=t.getInputTextValue("#input-publish-blogger-url",e);return void 0!==i&&(n.blogUrl=t.checkUrl(i)),n.pageId=t.getInputTextValue("#input-publish-pageid"),e.isPropagationStopped()?void 0:n},r}),define("providers/githubProvider",["utils","classes/Provider","settings","helpers/githubHelper"],function(e,t,n,i){var r=new t("github","GitHub");return r.publishPreferencesInputIds=["github-reponame","github-username","github-branch"],r.publish=function(e,t,r,o,a){var s=n.commitMsg;i.upload(e.repository,e.username,e.branch,e.path,o,s,a)},r.newPublishAttributes=function(t){var n={};return n.repository=e.getInputTextValue("#input-publish-github-reponame",t),n.username=e.getInputTextValue("#input-publish-github-username"),n.branch=e.getInputTextValue("#input-publish-github-branch",t),n.path=e.getInputTextValue("#input-publish-file-path",t),t.isPropagationStopped()?void 0:n},r}),define("helpers/sshHelper",["jquery","constants","core","logger","eventMgr","settings","classes/AsyncTask"],function(e,t,n,i,r,o,a){function s(e){e.onRun(function(){return u===!0?(e.error(new Error("Operation not available in offline mode.|stopPublish")),void 0):(e.chain(),void 0)})}function l(e,t){var r;e&&(i.error(e),"string"==typeof e?r="SSH error: "+e+".":(r="Could not publish on SSH server.",e.code<=0&&(n.setOffline(),r="|stopPublish"))),t.error(new Error(r))}var c={},u=!1;return r.addListener("onOfflineChanged",function(e){u=e}),c.upload=function(n,i,r,c,u,d,p,f){var h=new a;s(h),h.onRun(function(){var a=o.sshProxy+"upload",s={host:n,port:i,username:r,password:c,path:u,title:d,content:p};e.ajax({url:a,data:s,type:"POST",dataType:"json",timeout:t.AJAX_TIMEOUT}).done(function(e){return void 0===e.error?(h.chain(),void 0):(l(e.error,h),void 0)}).fail(function(e){var t={code:e.status,message:e.statusText};l(t,h)})}),h.onSuccess(function(){f()}),h.onError(function(e){f(e)}),h.enqueue()},c}),define("providers/sshProvider",["utils","classes/Provider","helpers/sshHelper"],function(e,t,n){var i=new t("ssh","SSH server");return i.publishPreferencesInputIds=["ssh-host","ssh-port","ssh-username","ssh-password"],i.publish=function(e,t,i,r,o){n.upload(e.host,e.port,e.username,e.password,e.path,i,r,o)},i.newPublishAttributes=function(t){var n={};return n.host=e.getInputTextValue("#input-publish-ssh-host",t,/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),n.port=e.getInputIntValue("#input-publish-ssh-port",void 0,0),n.username=e.getInputTextValue("#input-publish-ssh-username",t),n.password=e.getInputTextValue("#input-publish-ssh-password",t),n.path=e.getInputTextValue("#input-publish-file-path",t),t.isPropagationStopped()?void 0:n},i}),define("helpers/tumblrHelper",["jquery","constants","core","utils","storage","logger","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s){function l(e){e.onRun(function(){return f===!0?(e.error(new Error("Operation not available in offline mode.|stopPublish")),void 0):(e.chain(),void 0)})}function c(n){var o,a;n.onRun(function(){function s(){e.getJSON(t.TUMBLR_PROXY_URL+"request_token",function(e){void 0!==e.oauth_token?(h=e,n.chain(l)):n.error(new Error(f))})}function l(){i.redirectConfirm("You are being redirected to Tumblr authorization page.",function(){n.chain(c)},function(){n.error(new Error("Operation canceled."))})}function c(){r.removeItem("tumblrVerifier"),o=i.popupWindow("html/tumblr-oauth-client.html?oauth_token="+h.oauth_token,"stackedit-tumblr-oauth",800,600),o.focus(),a=setInterval(function(){if(o.closed===!0){if(clearInterval(a),o=void 0,a=void 0,h.oauth_verifier=r.tumblrVerifier,void 0===h.oauth_verifier)return n.error(new Error(f)),void 0;r.removeItem("tumblrVerifier"),n.chain(u)}},500)}function u(){e.getJSON(t.TUMBLR_PROXY_URL+"access_token",h,function(e){void 0!==e.access_token&&void 0!==e.access_token_secret?(r.tumblrOauthParams=JSON.stringify(e),d=e,n.chain()):n.error(new Error(f))})}if(void 0!==d)return n.chain(),void 0;var p=r.tumblrOauthParams;if(void 0!==p)return d=JSON.parse(p),n.chain(),void 0;var f="Failed to retrieve a token from Tumblr.";n.timeout=t.ASYNC_TASK_LONG_TIMEOUT;var h;n.chain(s)}),n.onError(function(){void 0!==a&&clearInterval(a),void 0!==o&&o.close()})}function u(e,t){var i;if(e)if(o.error(e),"string"==typeof e)i=e;else{if(i="Could not publish on Tumblr.",401===e.code||403===e.code)return d=void 0,r.removeItem("tumblrOauthParams"),i="Access to Tumblr account is not authorized.",t.retry(new Error(i),1),void 0;e.code<=0&&(n.setOffline(),i="|stopPublish")}t.error(new Error(i))}var d,p={},f=!1;return a.addListener("onOfflineChanged",function(e){f=e}),p.upload=function(n,i,r,o,a,p,f,h,m){var g=new s;l(g),c(g),g.onRun(function(){var s=e.extend({blog_hostname:n,post_id:i,tags:r,format:o,state:a,date:p,title:f,content:h},d);e.ajax({url:t.TUMBLR_PROXY_URL+"post",data:s,type:"POST",dataType:"json",timeout:t.AJAX_TIMEOUT}).done(function(e){i=e.id,g.chain()}).fail(function(e){var t={code:e.status,message:e.statusText};404===t.code&&void 0!==i&&(t="Post "+i+" not found on Tumblr.|removePublish"),u(t,g)})}),g.onSuccess(function(){m(void 0,i)}),g.onError(function(e){m(e)}),g.enqueue()},p}),define("providers/tumblrProvider",["underscore","settings","utils","classes/Provider","helpers/tumblrHelper"],function(e,t,n,i,r){var o=new i("tumblr","Tumblr");return o.publishPreferencesInputIds=["tumblr-hostname"],o.publish=function(n,i,o,a,s){var l=n.tags||[];i&&void 0!==i.tags&&(l=i.tags),e.isString(l)&&(l=e.compact(l.split(/[\s,]/)));var c=function(){if("html"==n.format)return"html";if("template"==n.format){var e=n.customTmpl||t.template;if(-1!==e.indexOf("documentHTML"))return"html"}return"markdown"}(),u=i&&i.published===!1?"draft":"published",d=i&&i.date;r.upload(n.blogHostname,n.postId,l.join(","),c,u,d,o,a,function(e,t){return e?(s(e),void 0):(n.postId=t,s(),void 0)})},o.newPublishAttributes=function(e){var t={};return t.blogHostname=n.getInputTextValue("#input-publish-tumblr-hostname",e,/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),t.postId=n.getInputTextValue("#input-publish-postid"),e.isPropagationStopped()?void 0:t},o}),define("helpers/wordpressHelper",["jquery","constants","core","utils","storage","logger","eventMgr","classes/AsyncTask"],function(e,t,n,i,r,o,a,s){function l(e){e.onRun(function(){return f===!0?(e.error(new Error("Operation not available in offline mode.|stopPublish")),void 0):(e.chain(),void 0)})}function c(n){var o,a;n.onRun(function(){function s(){i.redirectConfirm("You are being redirected to WordPress authorization page.",function(){n.chain(l)},function(){n.error(new Error("Operation canceled."))})}function l(){r.removeItem("wordpressCode"),o=i.popupWindow("html/wordpress-oauth-client.html?client_id="+t.WORDPRESS_CLIENT_ID,"stackedit-wordpress-oauth",960,600),o.focus(),a=setInterval(function(){if(o.closed===!0){if(clearInterval(a),o=void 0,a=void 0,p=r.wordpressCode,void 0===p)return n.error(new Error(u)),void 0;r.removeItem("wordpressCode"),n.chain(c)}},500)}function c(){e.getJSON(t.WORDPRESS_PROXY_URL+"authenticate/"+p,function(e){void 0!==e.token?(d=e.token,r.wordpressToken=d,n.chain()):n.error(new Error(u))})}if(d=r.wordpressToken,void 0!==d)return n.chain(),void 0;var u="Failed to retrieve a token from Wordpress.";n.timeout=t.ASYNC_TASK_LONG_TIMEOUT;var p;n.chain(s)}),n.onError(function(){void 0!==a&&clearInterval(a),void 0!==o&&o.close()})}function u(e,t){var i;if(e)if(o.error(e),"string"==typeof e)i=e;else{if(i="Could not publish on WordPress.",400===e.code&&"invalid_token"==e.message||401===e.code||403===e.code)return r.removeItem("wordpressToken"),i="Access to WordPress account is not authorized.",t.retry(new Error(i),1),void 0;e.code<=0&&(n.setOffline(),i="|stopPublish")}t.error(new Error(i))}var d,p={},f=!1;return a.addListener("onOfflineChanged",function(e){f=e}),p.upload=function(n,i,r,o,a,p,f,h){var m=new s;l(m),c(m),m.onRun(function(){var s=t.WORDPRESS_PROXY_URL+"post",l={token:d,site:n,postId:i,tags:r,status:o,date:a,title:p,content:f};e.ajax({url:s,data:l,type:"POST",dataType:"json",timeout:t.AJAX_TIMEOUT}).done(function(e){if(e.body.ID)return i=e.body.ID,m.chain(),void 0;var t={code:e.code,message:e.body.error};404===t.code&&("unknown_blog"==t.message?t='Site "'+n+'" not found on WordPress.|removePublish':"unknown_post"==t.message&&(t="Post "+i+" not found on WordPress.|removePublish")),u(t,m)}).fail(function(e){var t={code:e.status,message:e.statusText};u(t,m)})}),m.onSuccess(function(){h(void 0,i)}),m.onError(function(e){h(e)}),m.enqueue()},p}),define("providers/wordpressProvider",["underscore","utils","classes/Provider","helpers/wordpressHelper"],function(e,t,n,i){var r=new n("wordpress","WordPress");return r.defaultPublishFormat="html",r.publishPreferencesInputIds=["wordpress-site"],r.publish=function(t,n,r,o,a){var s=t.tags||[];n&&void 0!==n.tags&&(s=n.tags);var l=n&&n.published===!1?"draft":"publish",c=n&&n.date;e.isString(s)&&(s=e.compact(s.split(/[\s,]/))),i.upload(t.site,t.postId,s.join(","),l,c,r,o,function(e,n){return e?(a(e),void 0):(t.postId=n,a(),void 0)})},r.newPublishAttributes=function(e){var n={};return n.site=t.getInputTextValue("#input-publish-wordpress-site",e,/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),n.postId=t.getInputTextValue("#input-publish-postid"),e.isPropagationStopped()?void 0:n},r}),define("publisher",["jquery","underscore","constants","utils","storage","settings","eventMgr","fileSystem","fileMgr","sharing","classes/Provider","classes/AsyncTask","providers/bloggerProvider","providers/bloggerPageProvider","providers/dropboxProvider","providers/gistProvider","providers/githubProvider","providers/gdriveProvider","providers/gdrivesecProvider","providers/gdriveterProvider","providers/sshProvider","providers/tumblrProvider","providers/wordpressProvider"],function(e,t,n,i,r,o,a,s,l,c,u,d){function p(e,t,n){return void 0===t.format&&(t.format=i.getInputRadio("radio-publish-format"),"template"==t.format&&i.getInputChecked("#checkbox-publish-custom-template")&&(t.customTmpl=i.getInputValue("#textarea-publish-custom-template"))),"markdown"==t.format?e.content:"html"==t.format?n.withoutComments:v.applyTemplate(e,t,n)}function f(e,t){if(0===S.length)return e(t),void 0;var n=S.pop(),i=p(y,n,x),r=(y.frontMatter||{}).title||y.title;n.provider.publish(n,y.frontMatter,r,i,function(i){if(void 0!==i){var r=i.toString();if(-1!==r.indexOf("|removePublish")&&(y.removePublishLocation(n),a.onPublishRemoved(y,n)),-1!==r.indexOf("|stopPublish"))return e(i),void 0}f(e,t||i)})}function h(e,n){var o;do o="publish."+i.randomString();while(t.has(r,o));n.publishIndex=o,e.addPublishLocation(n),a.onNewPublishSuccess(e,n)}function m(n){var r=n.defaultPublishFormat||"markdown";E=n,e(".publish-provider-name").text(n.providerName),e('.modal-publish [class*=" modal-publish-"]').hide().filter(".modal-publish-"+n.providerId).show(),i.resetModalInputs(),i.setInputRadio("radio-publish-format",r),i.setInputChecked("#checkbox-publish-custom-template",!1),i.setInputValue("#textarea-publish-custom-template",o.template);var a=i.retrieveIgnoreError(n.providerId+".publishPreferences");a&&(t.each(n.publishPreferencesInputIds,function(e){var n=a[e];t.isBoolean(n)?i.setInputChecked("#input-publish-"+e,n):i.setInputValue("#input-publish-"+e,n)}),i.setInputRadio("radio-publish-format",a.format),i.setInputChecked("#checkbox-publish-custom-template",void 0!==a.customTmpl),i.setInputValue("#textarea-publish-custom-template",a.customTmpl||o.template)),e(".modal-publish").modal()}function g(e){var n=E,i=n.newPublishAttributes(e);if(void 0!==i){var o=l.currentFile,a=p(o,i,w),s=o.frontMatter&&o.frontMatter.title||o.title;n.publish(i,o.frontMatter,s,a,function(e){void 0===e&&(i.provider=n,c.createLink(i,function(){h(o,i)}))});var u={};t.each(n.publishPreferencesInputIds,function(e){var t=document.getElementById("input-publish-"+e);u[e]="checkbox"==t.type?t.checked:t.value}),u.format=i.format,u.customTmpl=i.customTmpl,r[n.providerId+".publishPreferences"]=JSON.stringify(u)}}var v={},b=t.chain(arguments).map(function(e){return e instanceof u&&e.isPublishEnabled===!0&&[e.providerId,e]}).compact().object().value();!function(){var e={};t.each(s,function(t){i.retrieveIndexArray(t.fileIndex+".publish").forEach(function(n){try{var o=JSON.parse(r[n]);o.publishIndex=n;var s=b[o.provider];if(!s)throw new Error("Invalid provider ID: "+o.provider);o.provider=s,t.publishLocations[n]=o,e[n]=o}catch(l){a.onError(l),i.removeIndexFromArray(t.fileIndex+".publish",n)}})}),Object.keys(r).forEach(function(t){var n=t.match(/publish\.\S+/);n&&!e.hasOwnProperty(n[0])&&r.removeItem(t)})}(),v.applyTemplate=function(e,n,i){try{var r=n&&n.customTmpl||o.template;return t.template(r,{documentTitle:e.title,documentMarkdown:e.content,strippedDocumentMarkdown:e.content.substring(e.frontMatter?e.frontMatter._frontMatter.length:0),documentHTML:i.withoutComments,documentHTMLWithComments:i.withComments,frontMatter:e.frontMatter,publishAttributes:n})}catch(s){return a.onError(s),s.message}};var y,x,w,S=[];a.addListener("onPreviewFinished",function(e,t){w={withComments:e,withoutComments:t}});var C=!1;a.addListener("onOfflineChanged",function(e){C=e});var T=!1;v.publish=function(){T!==!0&&C!==!0&&(T=!0,a.onPublishRunning(!0),y=l.currentFile,x=w,S=t.values(y.publishLocations),f(function(e){T=!1,a.onPublishRunning(!1),void 0===e&&a.onPublishSuccess(y)}))};var E,k=[" \n",' ',' <%= provider.providerName %>'," "," "].join("");return a.addListener("onReady",function(){if(window.viewerMode===!1){var r=document.querySelector(".menu-panel .publish-on-provider-list"),s=t.reduce(b,function(e,n){return e+t.template(k,{provider:n})},"");r.innerHTML=s,t.each(b,function(t){e(r.querySelector(".action-init-publish-"+t.providerId)).click(function(){m(t)}),e(".action-publish-"+t.providerId).click(function(){m(t)})})}e(".action-process-publish").click(g);var c=e(".publish-custom-template-collapse").collapse({toggle:!1}),u=e("#textarea-publish-custom-template"),p=t.debounce(function(){c.collapse("template"==i.getInputRadio("radio-publish-format")?"show":"hide")},100);e("#checkbox-publish-custom-template").change(function(){u.prop("disabled",!this.checked)}),e("input:radio[name=radio-publish-format]").change(function(){p()}),e(".modal-publish").on("hidden.bs.modal",function(){c.collapse("hide")}),e(".action-download-md").click(function(){var e=l.currentFile.content,t=l.currentFile.title;i.saveAs(e,t+".md")}),e(".action-download-html").click(function(){var e=l.currentFile.title;i.saveAs(w.withoutComments,e+".html")}),e(".action-download-template").click(function(){var e=l.currentFile,t=v.applyTemplate(e,void 0,w);i.saveAs(t,e.title+(-1===o.template.indexOf("documentHTML")?".md":".html"))}),e(".action-download-pdf").click(function(){var e,t=l.currentFile,r=v.applyTemplate(t,{customTmpl:o.pdfTemplate},w),s=new d;s.onRun(function(){if(C===!0)return a.onError("Operation not available in offline mode."),s.chain(),void 0;var t=new XMLHttpRequest;t.open("POST",n.HTMLTOPDF_URL,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.setRequestHeader("page-size",o.pdfPageSize),t.responseType="blob",t.onreadystatechange=function(){4==this.readyState&&(200==this.status?e=this.response:a.onError("Error when trying to generate PDF: "+this.status),s.chain())},t.send(r)}),s.onSuccess(function(){void 0!==e&&i.saveAs(e,l.currentFile.title+".pdf")}),s.enqueue()})}),a.onPublisherCreated(v),v}),define("providers/gplusProvider",["jquery","underscore","utils","storage","classes/Provider","eventMgr","helpers/googleHelper"],function(e,t,n,i,r,o,a){function s(e,n){var i;return t.find(e.thumbnails,function(e){var t=!1;return e.url.replace(/^(.*[\/=]s)\d.*?(\/[^\/]+)?$/,function(e,r,o){i=r+n+(o||""),t=!0}),t}),i}function l(){return c.thumbnails?(n.resetModalInputs(),e(".modal-import-image img").prop("src",s(c,128)),n.setInputValue("#input-import-image-title",c.name),f&&n.setInputValue("#input-import-image-size",f.size),e(".modal-import-image").modal(),void 0):(o.onError("Image "+c.name+" is not accessible."),u(!0),void 0)}var c,u,d="gplus",p=new r(d,"Google+"),f=n.retrieveIgnoreError(d+".importImagePreferences");return p.importImage=function(e){u=e,a.picker(function(t,n){return t||0===n.length?(e(t),void 0):(c=n[0],l(),void 0)},"img")},p.uploadImage=function(t,n,i){u=i,a.uploadImg(t,n,"default",function(n,r){return n||!r?(i(n),void 0):(c={name:t,thumbnails:[]},e(r).find("thumbnail").each(function(){c.thumbnails.push({url:e(this).attr("url")})}),l(),void 0)})},o.addListener("onReady",function(){e(".action-import-image").click(function(){var e=n.getInputIntValue("#input-import-image-size",void 0,0)||0,t=n.getInputTextValue("#input-import-image-title"),r=s(c,e);t&&(r+=' "'+t+'"'),u(void 0,r),f={},e&&(f.size=e),i[d+".importImagePreferences"]=JSON.stringify(f)})}),p}),define("mediaImporter",["jquery","underscore","constants","classes/Provider","core","eventMgr","providers/gplusProvider"],function(e,t,n,i,r,o){var a={},s=t.chain(arguments).map(function(e){return e instanceof i&&[e.providerId,e]}).compact().object().value();return o.addListener("onReady",function(){function i(i){var o=(i.dataTransfer||i.target).files,a=t.first(o);if(a.name.match(/.(jpe?g|png|gif)$/i)){i.stopPropagation(),i.preventDefault();var l=new FileReader;l.onload=function(t){return function(n){var i=new Uint8Array(n.target.result);s.gplus.uploadImage(t.name,i,function(t,n){if(!t){r.catchModal=!0,e("#wmd-image-button").click(),r.catchModal=!1;var i=r.insertLinkCallback;r.insertLinkCallback=void 0,i(n||null)}})}}(a);var c=a.slice(0,n.IMPORT_IMG_MAX_CONTENT_SIZE);l.readAsArrayBuffer(c)}}function o(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"}t.each(s,function(t){e(".action-import-image-"+t.providerId).click(function(){var e=r.insertLinkCallback;r.insertLinkCallback=void 0,t.importImage(function(t,n){return t?(e(null),void 0):(e(n||null),void 0)})})}),e("#wmd-input").each(function(){this.addEventListener("dragover",o,!1),this.addEventListener("drop",i,!1)})}),a}),define("css/css",[],function(){if("undefined"==typeof window)return{load:function(e,t,n){n()}};var e=document.getElementsByTagName("head")[0],t=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)/)||0,n=!1,i=!0;t[1]||t[7]?n=parseInt(t[1])<6||parseInt(t[7])<=9:t[2]?i=!1:t[4]&&(n=parseInt(t[4])<18);var r={};r.pluginBuilder="./css-builder";var o,a,s,l=function(){o=document.createElement("style"),e.appendChild(o),a=o.styleSheet||o.sheet},c=0,u=[],d=function(e){c++,32==c&&(l(),c=0),a.addImport(e),o.onload=p},p=function(){s();var e=u.shift();e&&(s=e[1],d(e[0]))},f=function(e,t){if(a&&a.addImport||l(),a&&a.addImport)s?u.push([e,t]):(d(e),s=t);else{o.textContent='@import "'+e+'";';var n=setInterval(function(){try{o.sheet.cssRules,clearInterval(n),t()}catch(e){}},10)}},h=function(t,n){var r=document.createElement("link");if(r.type="text/css",r.rel="stylesheet",i)r.onload=function(){r.onload=function(){},setTimeout(n,7)};else var o=setInterval(function(){for(var e=0;eo;++o)if(n=e.attributes[o],r=n.name,"class"!=r){if(i=t.attributes.getNamedItem(r),n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function p(e,t){for(var n,i=0,r=e.attributes.length;r>i;++i)if(n=e.attributes[i].name,(!t||!k.arrayContains(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}function f(e,t){for(var n in t)if(t.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0}function h(e){var t;return e&&1==e.nodeType&&((t=e.parentNode)&&9==t.nodeType&&"on"==t.designMode||D(e)&&!D(e.parentNode))}function m(e){return(D(e)||1!=e.nodeType&&D(e.parentNode))&&!h(e)}function g(e){return e&&1==e.nodeType&&!N.test(E(e,"display"))}function v(e){if(0==e.data.length)return!0;if(L.test(e.data))return!1;var t=E(e.parentNode,"whiteSpace");switch(t){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(e.data))return!1}return g(e.previousSibling)||g(e.nextSibling)}function b(e,t){return k.isCharacterDataNode(e)?0==t?!!e.previousSibling:t==e.length?!!e.nextSibling:!0:t>0&&t a;++a)"*"==i[a]?this.applyToAnyTagName=!0:this.tagNames.push(i[a].toLowerCase());else this.tagNames=[this.elementTagName]}function T(e,t,n){return new C(e,t,n)}e.requireModules(["WrappedSelection","WrappedRange"]);var E,k=e.dom,_="span",I=function(){function e(e,t,n){return t&&n?" ":""}return function(t,n){t.className&&(t.className=t.className.replace(new RegExp("(?:^|\\s)"+n+"(?:\\s|$)"),e))}}();"undefined"!=typeof window.getComputedStyle?E=function(e,t){return k.getWindow(e).getComputedStyle(e,null)[t]}:"undefined"!=typeof document.documentElement.currentStyle?E=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found");var D;!function(){var e=document.createElement("div");D="boolean"==typeof e.isContentEditable?function(e){return e&&1==e.nodeType&&e.isContentEditable}:function(e){return e&&1==e.nodeType&&"false"!=e.contentEditable?"true"==e.contentEditable||D(e.parentNode):!1}}();var N=/^inline(-block|-table)?$/i,L=/[^\r\n\t\f \u200B]/,M=w(!1),A=w(!0);S.prototype={doMerge:function(){for(var e,t,n,i=[],r=0,o=this.textNodes.length;o>r;++r)e=this.textNodes[r],t=e.parentNode,i[r]=e.data,r&&(t.removeChild(e),t.hasChildNodes()||t.parentNode.removeChild(t));return this.firstTextNode.data=n=i.join(""),n},getLength:function(){for(var e=this.textNodes.length,t=0;e--;)t+=this.textNodes[e].length;return t},toString:function(){for(var e=[],t=0,n=this.textNodes.length;n>t;++t)e[t]="'"+this.textNodes[t].data+"'";return"[Merge("+e.join(",")+")]"}};var R=["elementTagName","ignoreWhiteSpace","applyToEditableOnly"],P={"class":"className"};C.prototype={elementTagName:_,elementProperties:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,hasClass:function(e){return 1==e.nodeType&&k.arrayContains(this.tagNames,e.tagName.toLowerCase())&&i(e,this.cssClass)},getSelfOrAncestorWithClass:function(e){for(;e;){if(this.hasClass(e,this.cssClass))return e;e=e.parentNode}return null},isModifiable:function(e){return!this.applyToEditableOnly||m(e)},isIgnorableWhiteSpaceNode:function(e){return this.ignoreWhiteSpace&&e&&3==e.nodeType&&v(e)},postApply:function(e,t,n){for(var i,r,o,a=e[0],s=e[e.length-1],l=[],c=a,u=s,d=0,p=s.length,f=0,h=e.length;h>f;++f)r=e[f],o=M(r,!n),o?(i||(i=new S(o),l.push(i)),i.textNodes.push(r),r===a&&(c=i.firstTextNode,d=c.length),r===s&&(u=i.firstTextNode,p=i.getLength())):i=null;var m=A(s,!n);if(m&&(i||(i=new S(s),l.push(i)),i.textNodes.push(m)),l.length){for(f=0,h=l.length;h>f;++f)l[f].doMerge();t.setStart(c,d),t.setEnd(u,p)}},createContainer:function(t){var n=t.createElement(this.elementTagName);return e.util.extend(n,this.elementProperties),r(n,this.cssClass),n},applyToTextNode:function(e){var t=e.parentNode;if(1==t.childNodes.length&&k.arrayContains(this.tagNames,t.tagName.toLowerCase()))r(t,this.cssClass);else{var n=this.createContainer(k.getDocument(e));e.parentNode.insertBefore(n,e),n.appendChild(e)}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&a(e)==this.elementSortedClassName&&f(e,this.elementProperties)&&!p(e,this.attrExceptions)&&this.isModifiable(e)},undoToTextNode:function(e,t,n){if(!t.containsNode(n)){var i=t.cloneRange();i.selectNode(n),i.isPointInRange(t.endContainer,t.endOffset)&&(y(n,t.endContainer,t.endOffset,[t]),t.setEndAfter(n)),i.isPointInRange(t.startContainer,t.startOffset)&&(n=y(n,t.startContainer,t.startOffset,[t]))}this.isRemovable(n)?l(n):I(n,this.cssClass)},applyToRange:function(e){e.splitBoundaries();var t=u(e);if(t.length){for(var n,i=0,r=t.length;r>i;++i)n=t[i],this.isIgnorableWhiteSpaceNode(n)||this.getSelfOrAncestorWithClass(n)||!this.isModifiable(n)||this.applyToTextNode(n); +e.setStart(t[0],0),n=t[t.length-1],e.setEnd(n,n.length),this.normalize&&this.postApply(t,e,!1)}},applyToSelection:function(t){t=t||window;var n,i=e.getSelection(t),r=i.getAllRanges();i.removeAllRanges();for(var o=r.length;o--;)n=r[o],this.applyToRange(n),i.addRange(n)},undoToRange:function(e){e.splitBoundaries();var t,n,i=u(e),r=i[i.length-1];if(i.length){for(var o=0,a=i.length;a>o;++o)t=i[o],n=this.getSelfOrAncestorWithClass(t),n&&this.isModifiable(t)&&this.undoToTextNode(t,e,n),e.setStart(i[0],0),e.setEnd(r,r.length);this.normalize&&this.postApply(i,e,!0)}},undoToSelection:function(t){t=t||window;var n,i=e.getSelection(t),r=i.getAllRanges();i.removeAllRanges();for(var o=0,a=r.length;a>o;++o)n=r[o],this.undoToRange(n),i.addRange(n)},getTextSelectedByRange:function(e,t){var n=t.cloneRange();n.selectNodeContents(e);var i=n.intersection(t),r=i?i.toString():"";return n.detach(),r},isAppliedToRange:function(e){if(e.collapsed)return!!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);for(var t,n=e.getNodes([3]),i=0;t=n[i++];)if(!this.isIgnorableWhiteSpaceNode(t)&&c(e,t)&&this.isModifiable(t)&&!this.getSelfOrAncestorWithClass(t))return!1;return!0},isAppliedToSelection:function(t){t=t||window;for(var n=e.getSelection(t),i=n.getAllRanges(),r=i.length;r--;)if(!this.isAppliedToRange(i[r]))return!1;return!0},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},detach:function(){}},C.util={hasClass:i,addClass:r,removeClass:I,hasSameClasses:s,replaceWithOwnChildren:l,elementsHaveSameNonClassAttributes:d,elementHasNonClassAttributes:p,splitNodeAt:y,isEditableElement:D,isEditingHost:h,isEditable:m},e.CssClassApplier=C,e.createCssClassApplier=T}),define("rangy-cssclassapplier",function(){}),requirejs.config({waitSeconds:0,packages:[{name:"css",location:"bower-libs/require-css",main:"css"},{name:"less",location:"bower-libs/require-less",main:"less"}],paths:{jquery:"bower-libs/jquery/jquery",underscore:"bower-libs/underscore/underscore",crel:"bower-libs/crel/crel",jgrowl:"bower-libs/jgrowl/jquery.jgrowl",mousetrap:"bower-libs/mousetrap/mousetrap","mousetrap-record":"bower-libs/mousetrap/plugins/record/mousetrap-record",toMarkdown:"bower-libs/to-markdown/src/to-markdown",text:"bower-libs/requirejs-text/text",mathjax:"../libs/MathJax/MathJax.js?config=TeX-AMS_HTML",bootstrap:"bower-libs/bootstrap/dist/js/bootstrap",requirejs:"bower-libs/requirejs/require","google-code-prettify":"bower-libs/google-code-prettify/src/prettify",highlightjs:"libs/highlight/highlight.pack","jquery-waitforimages":"bower-libs/waitForImages/src/jquery.waitforimages","jquery-ui":"bower-libs/jquery-ui/ui/jquery-ui","jquery-ui-core":"bower-libs/jquery-ui/ui/jquery.ui.core","jquery-ui-widget":"bower-libs/jquery-ui/ui/jquery.ui.widget","jquery-ui-mouse":"bower-libs/jquery-ui/ui/jquery.ui.mouse","jquery-ui-draggable":"bower-libs/jquery-ui/ui/jquery.ui.draggable","jquery-ui-effect":"bower-libs/jquery-ui/ui/jquery.ui.effect","jquery-ui-effect-slide":"bower-libs/jquery-ui/ui/jquery.ui.effect-slide",FileSaver:"bower-libs/FileSaver/FileSaver",stacktrace:"bower-libs/stacktrace/stacktrace","requirejs-text":"bower-libs/requirejs-text/text","bootstrap-tour":"bower-libs/bootstrap-tour/build/js/bootstrap-tour",css_browser_selector:"bower-libs/css_browser_selector/css_browser_selector","pagedown-extra":"bower-libs/pagedown-extra/Markdown.Extra",pagedown:"libs/Markdown.Editor","require-css":"bower-libs/require-css/css",xregexp:"bower-libs/xregexp/xregexp-all",yaml:"bower-libs/yaml.js","yaml.js":"bower-libs/yaml.js","yaml-js":"bower-libs/yaml.js/bin/yaml",css:"bower-libs/require-css/css","css-builder":"bower-libs/require-css/css-builder",normalize:"bower-libs/require-css/normalize",prism:"bower-libs/prism/prism","prism-core":"bower-libs/prism/components/prism-core",MutationObservers:"bower-libs/MutationObservers/MutationObserver",WeakMap:"bower-libs/WeakMap/weakmap",rangy:"bower-libs/rangy/rangy-core","rangy-cssclassapplier":"bower-libs/rangy/rangy-cssclassapplier",diff_match_patch:"bower-libs/google-diff-match-patch-js/diff_match_patch",diff_match_patch_uncompressed:"bower-libs/google-diff-match-patch-js/diff_match_patch_uncompressed",jsondiffpatch:"bower-libs/jsondiffpatch/build/bundle",hammerjs:"bower-libs/hammerjs/hammer"},shim:{underscore:{exports:"_"},mathjax:["libs/mathjax_init"],jgrowl:{deps:["jquery"],exports:"jQuery.jGrowl"},diff_match_patch_uncompressed:{exports:"diff_match_patch"},jsondiffpatch:["diff_match_patch_uncompressed"],rangy:{exports:"rangy"},"rangy-cssclassapplier":["rangy"],mousetrap:{exports:"Mousetrap"},"yaml-js":{exports:"YAML"},"prism-core":{exports:"Prism"},"bower-libs/prism/components/prism-markup":["prism-core"],"libs/prism-latex":["prism-core"],"libs/prism-markdown":["bower-libs/prism/components/prism-markup","libs/prism-latex"],"bootstrap-record":["mousetrap"],toMarkdown:{deps:["jquery"],exports:"toMarkdown"},stacktrace:{exports:"printStackTrace"},FileSaver:{exports:"saveAs"},MutationObservers:["WeakMap"],highlightjs:{exports:"hljs"},"bootstrap-tour":{deps:["bootstrap"],exports:"Tour"},bootstrap:["jquery"],"jquery-waitforimages":["jquery"],pagedown:["libs/Markdown.Converter"],"pagedown-extra":["libs/Markdown.Converter"]}});try{var test="seLocalStorageCheck";localStorage.setItem(test,test),localStorage.removeItem(test);var obj={};Object.defineProperty(obj,"prop",{get:function(){},set:function(){}})}catch(e){throw alert("Your browser is not supported, sorry!"),e}window.viewerMode=/(^| )viewer($| )/.test(document.body.className),window.theme=localStorage.themeV3||"default";var themeModule="less!themes/"+window.theme;-1!==window.baseDir.indexOf("-min")&&(themeModule="css!themes/"+window.theme),require(["jquery","rangy","core","eventMgr","synchronizer","publisher","mediaImporter","css","rangy-cssclassapplier",themeModule],function(e,t,n,i){window.noStart||e(function(){t.init(),n.onReady(),window.applicationCache&&window.applicationCache.addEventListener("updateready",function(){window.applicationCache.status===window.applicationCache.UPDATEREADY&&(window.applicationCache.swapCache(),i.onMessage("New version available!\nJust refresh the page to upgrade."))},!1)})}),define("main",function(){}); \ No newline at end of file diff --git a/public/res-min/themes/base.css b/public/res-min/themes/base.css index 92312eec..814bc120 100644 --- a/public/res-min/themes/base.css +++ b/public/res-min/themes/base.css @@ -894,7 +894,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic} .nginx .hljs-built_in{font-weight:normal} .coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:0.5} -@font-face{font-family:'fontello';src:url('../font/fontello.eot');src:url('../font/fontello.eot#iefix') format('embedded-opentype'),url('../font/fontello.woff') format('woff'),url('../font/fontello.ttf') format('truetype'),url('../font/fontello.svg#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} +@font-face{font-family:'fontello';src:url('../font/fontello.eot?24620533');src:url('../font/fontello.eot?24620533#iefix') format('embedded-opentype'),url('../font/fontello.woff?24620533') format('woff'),url('../font/fontello.ttf?24620533') format('truetype'),url('../font/fontello.svg?24620533#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} .icon-glass:before{content:'\e801'} .icon-archive:before{content:'\e859'} .icon-search:before{content:'\e803'} @@ -1213,7 +1213,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .icon-chat:before{content:'\e83e'} .icon-folder-open:before{content:'\e81e'} .icon-up-circled:before{content:'\e893'} -@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} +@font-face{font-family:'fontello';src:url('../font/fontello.svg#fontello') format('svg'),url('../font/fontello.woff') format('woff');font-weight:normal;font-style:normal}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} a code{color:inherit} h1{font-size:2.6em} h2{font-size:2.15em} diff --git a/public/res-min/themes/default.css b/public/res-min/themes/default.css index 68e0f119..70e8b10f 100644 --- a/public/res-min/themes/default.css +++ b/public/res-min/themes/default.css @@ -909,7 +909,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic} .nginx .hljs-built_in{font-weight:normal} .coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:0.5} -@font-face{font-family:'fontello';src:url('../font/fontello.eot');src:url('../font/fontello.eot#iefix') format('embedded-opentype'),url('../font/fontello.woff') format('woff'),url('../font/fontello.ttf') format('truetype'),url('../font/fontello.svg#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} +@font-face{font-family:'fontello';src:url('../font/fontello.eot?24620533');src:url('../font/fontello.eot?24620533#iefix') format('embedded-opentype'),url('../font/fontello.woff?24620533') format('woff'),url('../font/fontello.ttf?24620533') format('truetype'),url('../font/fontello.svg?24620533#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} .icon-glass:before{content:'\e801'} .icon-archive:before{content:'\e859'} .icon-search:before{content:'\e803'} @@ -1228,7 +1228,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .icon-chat:before{content:'\e83e'} .icon-folder-open:before{content:'\e81e'} .icon-up-circled:before{content:'\e893'} -@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} +@font-face{font-family:'fontello';src:url('../font/fontello.svg#fontello') format('svg'),url('../font/fontello.woff') format('woff');font-weight:normal;font-style:normal}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} a code{color:inherit} h1{font-size:2.6em} h2{font-size:2.15em} @@ -1498,6 +1498,7 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .sharing-tweet{float:left;margin:5px 10px 0 0} .popover{max-width:350px;padding:15px}.popover .popover-title{font-weight:500;font-size:24px;padding:10px 15px} .popover .disabled{display:none} +.popover .popover-navigation{margin-top:-40px} .comments-popover .popover{max-width:230px;padding:10px 20px 0}.comments-popover .popover .popover-title{padding:5px 0 15px;border-bottom:1px solid rgba(102,128,153,0.1);line-height:1.1;overflow:hidden}.comments-popover .popover .popover-title .action-remove-discussion{font-size:16px;line-height:22px} .comments-popover .popover .popover-content{margin:0;padding:0}.comments-popover .popover .popover-content .scrollport{overflow:auto;max-height:230px;padding:10px 20px 0;margin:0 -20px} .comments-popover .popover .popover-content .btn{padding:6px 11px} @@ -1509,9 +1510,9 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .comments-popover .popover .popover-content .new-comment-block .icon-comment{color:rgba(102,128,153,0.35)} .comments-popover .popover .popover-content .input-comment-author{border:none;background:none;-webkit-box-shadow:none;box-shadow:none;font-weight:bold;height:28px;padding:0 0 5px;width:140px;display:inline-block} .comments-popover .popover .popover-content hr{margin:0 0 10px} -.comments-popover .comments-popover .popover.top .arrow,.comments-popover .comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .comments-popover .popover.top .arrow:after,.comments-popover .comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} -.comments-popover .comments-popover .popover.top .arrow:after{bottom:2px} -.comments-popover .comments-popover .popover.bottom .arrow:after{top:2px} +.comments-popover .popover.top .arrow,.comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .popover.top .arrow:after,.comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} +.comments-popover .popover.top .arrow:after{bottom:2px} +.comments-popover .popover.bottom .arrow:after{top:2px} div.jGrowl{z-index:1040;font-size:inherit}div.jGrowl.bottom-right{right:30px} div.jGrowl div.jGrowl-notification,div.jGrowl div.jGrowl-closer{background-color:rgba(115,128,140,0.9);width:260px;margin:20px 0;padding:15px 20px;-ms-filter:none;filter:none;border-radius:5px} div.jGrowl div.jGrowl-notification{min-height:80px} diff --git a/public/res-min/themes/gray.css b/public/res-min/themes/gray.css index b5344d0d..d586716e 100644 --- a/public/res-min/themes/gray.css +++ b/public/res-min/themes/gray.css @@ -909,7 +909,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic} .nginx .hljs-built_in{font-weight:normal} .coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:0.5} -@font-face{font-family:'fontello';src:url('../font/fontello.eot');src:url('../font/fontello.eot#iefix') format('embedded-opentype'),url('../font/fontello.woff') format('woff'),url('../font/fontello.ttf') format('truetype'),url('../font/fontello.svg#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} +@font-face{font-family:'fontello';src:url('../font/fontello.eot?24620533');src:url('../font/fontello.eot?24620533#iefix') format('embedded-opentype'),url('../font/fontello.woff?24620533') format('woff'),url('../font/fontello.ttf?24620533') format('truetype'),url('../font/fontello.svg?24620533#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} .icon-glass:before{content:'\e801'} .icon-archive:before{content:'\e859'} .icon-search:before{content:'\e803'} @@ -1228,7 +1228,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .icon-chat:before{content:'\e83e'} .icon-folder-open:before{content:'\e81e'} .icon-up-circled:before{content:'\e893'} -@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} +@font-face{font-family:'fontello';src:url('../font/fontello.svg#fontello') format('svg'),url('../font/fontello.woff') format('woff');font-weight:normal;font-style:normal}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} a code{color:inherit} h1{font-size:2.6em} h2{font-size:2.15em} @@ -1498,6 +1498,7 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .sharing-tweet{float:left;margin:5px 10px 0 0} .popover{max-width:350px;padding:15px}.popover .popover-title{font-weight:500;font-size:24px;padding:10px 15px} .popover .disabled{display:none} +.popover .popover-navigation{margin-top:-40px} .comments-popover .popover{max-width:230px;padding:10px 20px 0}.comments-popover .popover .popover-title{padding:5px 0 15px;border-bottom:1px solid rgba(128,128,128,0.1);line-height:1.1;overflow:hidden}.comments-popover .popover .popover-title .action-remove-discussion{font-size:16px;line-height:22px} .comments-popover .popover .popover-content{margin:0;padding:0}.comments-popover .popover .popover-content .scrollport{overflow:auto;max-height:230px;padding:10px 20px 0;margin:0 -20px} .comments-popover .popover .popover-content .btn{padding:6px 11px} @@ -1509,9 +1510,9 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .comments-popover .popover .popover-content .new-comment-block .icon-comment{color:rgba(128,128,128,0.35)} .comments-popover .popover .popover-content .input-comment-author{border:none;background:none;-webkit-box-shadow:none;box-shadow:none;font-weight:bold;height:28px;padding:0 0 5px;width:140px;display:inline-block} .comments-popover .popover .popover-content hr{margin:0 0 10px} -.comments-popover .comments-popover .popover.top .arrow,.comments-popover .comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .comments-popover .popover.top .arrow:after,.comments-popover .comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} -.comments-popover .comments-popover .popover.top .arrow:after{bottom:2px} -.comments-popover .comments-popover .popover.bottom .arrow:after{top:2px} +.comments-popover .popover.top .arrow,.comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .popover.top .arrow:after,.comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} +.comments-popover .popover.top .arrow:after{bottom:2px} +.comments-popover .popover.bottom .arrow:after{top:2px} div.jGrowl{z-index:1040;font-size:inherit}div.jGrowl.bottom-right{right:30px} div.jGrowl div.jGrowl-notification,div.jGrowl div.jGrowl-closer{background-color:rgba(128,128,128,0.9);width:260px;margin:20px 0;padding:15px 20px;-ms-filter:none;filter:none;border-radius:5px} div.jGrowl div.jGrowl-notification{min-height:80px} diff --git a/public/res-min/themes/night.css b/public/res-min/themes/night.css index c1efa545..0438bb7b 100644 --- a/public/res-min/themes/night.css +++ b/public/res-min/themes/night.css @@ -909,7 +909,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic} .nginx .hljs-built_in{font-weight:normal} .coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:0.5} -@font-face{font-family:'fontello';src:url('../font/fontello.eot');src:url('../font/fontello.eot#iefix') format('embedded-opentype'),url('../font/fontello.woff') format('woff'),url('../font/fontello.ttf') format('truetype'),url('../font/fontello.svg#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} +@font-face{font-family:'fontello';src:url('../font/fontello.eot?24620533');src:url('../font/fontello.eot?24620533#iefix') format('embedded-opentype'),url('../font/fontello.woff?24620533') format('woff'),url('../font/fontello.ttf?24620533') format('truetype'),url('../font/fontello.svg?24620533#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} .icon-glass:before{content:'\e801'} .icon-archive:before{content:'\e859'} .icon-search:before{content:'\e803'} @@ -1228,7 +1228,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .icon-chat:before{content:'\e83e'} .icon-folder-open:before{content:'\e81e'} .icon-up-circled:before{content:'\e893'} -@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} +@font-face{font-family:'fontello';src:url('../font/fontello.svg#fontello') format('svg'),url('../font/fontello.woff') format('woff');font-weight:normal;font-style:normal}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} a code{color:inherit} h1{font-size:2.6em} h2{font-size:2.15em} @@ -1498,6 +1498,7 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .sharing-tweet{float:left;margin:5px 10px 0 0} .popover{max-width:350px;padding:15px}.popover .popover-title{font-weight:500;font-size:24px;padding:10px 15px} .popover .disabled{display:none} +.popover .popover-navigation{margin-top:-40px} .comments-popover .popover{max-width:230px;padding:10px 20px 0}.comments-popover .popover .popover-title{padding:5px 0 15px;border-bottom:1px solid rgba(255,255,255,0.1);line-height:1.1;overflow:hidden}.comments-popover .popover .popover-title .action-remove-discussion{font-size:16px;line-height:22px} .comments-popover .popover .popover-content{margin:0;padding:0}.comments-popover .popover .popover-content .scrollport{overflow:auto;max-height:230px;padding:10px 20px 0;margin:0 -20px} .comments-popover .popover .popover-content .btn{padding:6px 11px} @@ -1509,9 +1510,9 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .comments-popover .popover .popover-content .new-comment-block .icon-comment{color:rgba(159,159,159,0.35)} .comments-popover .popover .popover-content .input-comment-author{border:none;background:none;-webkit-box-shadow:none;box-shadow:none;font-weight:bold;height:28px;padding:0 0 5px;width:140px;display:inline-block} .comments-popover .popover .popover-content hr{margin:0 0 10px} -.comments-popover .comments-popover .popover.top .arrow,.comments-popover .comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .comments-popover .popover.top .arrow:after,.comments-popover .comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} -.comments-popover .comments-popover .popover.top .arrow:after{bottom:2px} -.comments-popover .comments-popover .popover.bottom .arrow:after{top:2px} +.comments-popover .popover.top .arrow,.comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .popover.top .arrow:after,.comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} +.comments-popover .popover.top .arrow:after{bottom:2px} +.comments-popover .popover.bottom .arrow:after{top:2px} div.jGrowl{z-index:1040;font-size:inherit}div.jGrowl.bottom-right{right:30px} div.jGrowl div.jGrowl-notification,div.jGrowl div.jGrowl-closer{background-color:rgba(68,68,68,0.9);width:260px;margin:20px 0;padding:15px 20px;-ms-filter:none;filter:none;border-radius:5px} div.jGrowl div.jGrowl-notification{min-height:80px} diff --git a/public/res-min/themes/school.css b/public/res-min/themes/school.css index 902bb2d7..c3060b7c 100644 --- a/public/res-min/themes/school.css +++ b/public/res-min/themes/school.css @@ -909,7 +909,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic} .nginx .hljs-built_in{font-weight:normal} .coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .javascript,.xml .vbscript,.xml .css,.xml .hljs-cdata{opacity:0.5} -@font-face{font-family:'fontello';src:url('../font/fontello.eot');src:url('../font/fontello.eot#iefix') format('embedded-opentype'),url('../font/fontello.woff') format('woff'),url('../font/fontello.ttf') format('truetype'),url('../font/fontello.svg#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} +@font-face{font-family:'fontello';src:url('../font/fontello.eot?24620533');src:url('../font/fontello.eot?24620533#iefix') format('embedded-opentype'),url('../font/fontello.woff?24620533') format('woff'),url('../font/fontello.ttf?24620533') format('truetype'),url('../font/fontello.svg?24620533#fontello') format('svg');font-weight:normal;font-style:normal}[class^="icon-"]:before,[class*=" icon-"]:before{font-family:"fontello";font-style:normal;font-weight:normal;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em;} .icon-glass:before{content:'\e801'} .icon-archive:before{content:'\e859'} .icon-search:before{content:'\e803'} @@ -1228,7 +1228,7 @@ li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} .icon-chat:before{content:'\e83e'} .icon-folder-open:before{content:'\e81e'} .icon-up-circled:before{content:'\e893'} -@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} +@font-face{font-family:'fontello';src:url('../font/fontello.svg#fontello') format('svg'),url('../font/fontello.woff') format('woff');font-weight:normal;font-style:normal}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:300;src:local('Source Sans Pro Light'),local('SourceSansPro-Light'),url("../font/SourceSansPro-Light-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:400;src:local('Source Sans Pro'),local('SourceSansPro'),url("../font/SourceSansPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:normal;font-weight:700;src:local('Source Sans Pro Bold'),local('SourceSansPro-Bold'),url("../font/SourceSansPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:300;src:local('Source Sans Pro Light Italic'),local('SourceSansProLight-Italic'),url("../font/SourceSansPro-LightItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:400;src:local('Source Sans Pro Italic'),local('SourceSansPro-Italic'),url("../font/SourceSansPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Source Sans Pro';font-style:italic;font-weight:700;src:local('Source Sans Pro Bold Italic'),local('SourceSansPro-BoldItalic'),url("../font/SourceSansPro-BoldItalic-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:400;src:local('Source Code Pro'),local('SourceCodePro-Regular'),url("../font/SourceCodePro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Source Code Pro';font-style:normal;font-weight:700;src:local('Source Code Pro Bold'),local('SourceCodePro-Bold'),url("../font/SourceCodePro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:400;src:local('Inconsolata'),url("../font/Inconsolata-Regular-webfont.woff") format('woff')}@font-face{font-family:'Inconsolata';font-style:normal;font-weight:700;src:local('Inconsolata Bold'),local('Inconsolata-Bold'),url("../font/Inconsolata-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:400;src:local('Anonymous Pro'),local('AnonymousPro'),url("../font/AnonymousPro-Regular-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:normal;font-weight:700;src:local('Anonymous Pro Bold'),local('AnonymousPro-Bold'),url("../font/AnonymousPro-Bold-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:400;src:local('Anonymous Pro Italic'),local('AnonymousPro-Italic'),url("../font/AnonymousPro-Italic-webfont.woff") format('woff')}@font-face{font-family:'Anonymous Pro';font-style:italic;font-weight:700;src:local('Anonymous Pro Bold Italic'),local('AnonymousPro-BoldItalic'),url("../font/AnonymousPro-BoldItalic-webfont.woff") format('woff')}.container{margin-bottom:180px} a code{color:inherit} h1{font-size:2.6em} h2{font-size:2.15em} @@ -1498,6 +1498,7 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .sharing-tweet{float:left;margin:5px 10px 0 0} .popover{max-width:350px;padding:15px}.popover .popover-title{font-weight:500;font-size:24px;padding:10px 15px} .popover .disabled{display:none} +.popover .popover-navigation{margin-top:-40px} .comments-popover .popover{max-width:230px;padding:10px 20px 0}.comments-popover .popover .popover-title{padding:5px 0 15px;border-bottom:1px solid rgba(143,134,104,0.1);line-height:1.1;overflow:hidden}.comments-popover .popover .popover-title .action-remove-discussion{font-size:16px;line-height:22px} .comments-popover .popover .popover-content{margin:0;padding:0}.comments-popover .popover .popover-content .scrollport{overflow:auto;max-height:230px;padding:10px 20px 0;margin:0 -20px} .comments-popover .popover .popover-content .btn{padding:6px 11px} @@ -1509,9 +1510,9 @@ input[type="file"]{line-height:inherit;height:inherit;border:none !important} .comments-popover .popover .popover-content .new-comment-block .icon-comment{color:rgba(92,130,164,0.35)} .comments-popover .popover .popover-content .input-comment-author{border:none;background:none;-webkit-box-shadow:none;box-shadow:none;font-weight:bold;height:28px;padding:0 0 5px;width:140px;display:inline-block} .comments-popover .popover .popover-content hr{margin:0 0 10px} -.comments-popover .comments-popover .popover.top .arrow,.comments-popover .comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .comments-popover .popover.top .arrow:after,.comments-popover .comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} -.comments-popover .comments-popover .popover.top .arrow:after{bottom:2px} -.comments-popover .comments-popover .popover.bottom .arrow:after{top:2px} +.comments-popover .popover.top .arrow,.comments-popover .popover.bottom .arrow{margin-right:1px;border-right-width:0}.comments-popover .popover.top .arrow:after,.comments-popover .popover.bottom .arrow:after{margin-left:-11px;border-right-width:0} +.comments-popover .popover.top .arrow:after{bottom:2px} +.comments-popover .popover.bottom .arrow:after{top:2px} div.jGrowl{z-index:1040;font-size:inherit}div.jGrowl.bottom-right{right:30px} div.jGrowl div.jGrowl-notification,div.jGrowl div.jGrowl-closer{background-color:rgba(121,121,121,0.9);width:260px;margin:20px 0;padding:15px 20px;-ms-filter:none;filter:none;border-radius:5px} div.jGrowl div.jGrowl-notification{min-height:80px} diff --git a/public/res/editor.js b/public/res/editor.js index 0c224236..47a61617 100644 --- a/public/res/editor.js +++ b/public/res/editor.js @@ -112,7 +112,7 @@ define([ this.selectionEnd = 0; this.cursorY = 0; this.findOffset = function(offset) { - var walker = document.createTreeWalker(contentElt, 4); + var walker = document.createTreeWalker(contentElt, 4, null, false); var text = ''; while(walker.nextNode()) { text = walker.currentNode.nodeValue || ''; @@ -141,13 +141,42 @@ define([ range.setEnd(offset.container, offset.offset); return range; }; + var updateCursorCoordinates = utils.debounce(_.bind(function() { + $inputElt.toggleClass('has-selection', this.selectionStart !== this.selectionEnd); + var coordinates = this.getCoordinates(this.selectionEnd, this.selectionEndContainer, this.selectionEndOffset); + if(this.cursorY !== coordinates.y) { + this.cursorY = coordinates.y; + eventMgr.onCursorCoordinates(coordinates.x, coordinates.y); + } + if(this.adjustScroll) { + var adjust = inputElt.offsetHeight / 2; + if(adjust > 130) { + adjust = 130; + } + var cursorMinY = inputElt.scrollTop + adjust; + var cursorMaxY = inputElt.scrollTop + inputElt.offsetHeight - adjust; + if(selectionMgr.cursorY < cursorMinY) { + inputElt.scrollTop += selectionMgr.cursorY - cursorMinY; + } + else if(selectionMgr.cursorY > cursorMaxY) { + inputElt.scrollTop += selectionMgr.cursorY - cursorMaxY; + } + this.adjustScroll = false; + } + }, this)); this.setSelectionStartEnd = function(start, end, range, skipSelectionUpdate) { if(start === undefined) { start = this.selectionStart; } + if(start < 0) { + start = 0; + } if(end === undefined) { end = this.selectionEnd; } + if(end < 0) { + end = 0; + } this.selectionStart = start; this.selectionEnd = end; var min = Math.min(start, end); @@ -160,17 +189,15 @@ define([ } fileDesc.editorStart = this.selectionStart; fileDesc.editorEnd = this.selectionEnd; - // Update cursor coordinates - $inputElt.toggleClass('has-selection', this.selectionStart !== this.selectionEnd); - var coordinates = this.getCoordinates(this.selectionEnd, this.selectionEndContainer, this.selectionEndOffset); - if(this.cursorY !== coordinates.y) { - this.cursorY = coordinates.y; - eventMgr.onCursorCoordinates(coordinates.x, coordinates.y); - } + updateCursorCoordinates(); return range; }; this.saveSelectionState = (function() { - function save() { + var timeoutId; + function save(adjustScroll) { + clearTimeout(timeoutId); + timeoutId = undefined; + self.adjustScroll = adjustScroll; if(fileChanged === false) { var selectionStart = self.selectionStart; var selectionEnd = self.selectionEnd; @@ -206,9 +233,15 @@ define([ } undoMgr.saveSelectionState(); } - var debouncedSave = utils.debounce(save); - return function(debounced) { - debounced ? debouncedSave() : save(); + return function(debounced, adjustScroll) { + adjustScroll = _.isBoolean(adjustScroll) ? adjustScroll : false; + if(debounced) { + clearTimeout(timeoutId); + timeoutId = _.delay(save, 5, adjustScroll); + } + else { + save(adjustScroll); + } }; })(); this.getCoordinates = function(inputOffset, container, offset) { @@ -282,29 +315,12 @@ define([ editor.selectionMgr = selectionMgr; $(document).on('selectionchange', '.editor-content', _.bind(selectionMgr.saveSelectionState, selectionMgr, true)); - var adjustCursorPosition = (function() { - var adjust = utils.debounce(function() { - var adjust = inputElt.offsetHeight / 2; - if(adjust > 130) { - adjust = 130; - } - var cursorMinY = inputElt.scrollTop + adjust; - var cursorMaxY = inputElt.scrollTop + inputElt.offsetHeight - adjust; - if(selectionMgr.cursorY < cursorMinY) { - inputElt.scrollTop += selectionMgr.cursorY - cursorMinY; - } - else if(selectionMgr.cursorY > cursorMaxY) { - inputElt.scrollTop += selectionMgr.cursorY - cursorMaxY; - } - }); - return function() { - if(inputElt === undefined) { - return; - } - selectionMgr.saveSelectionState(true); - adjust(); - }; - })(); + function adjustCursorPosition() { + if(inputElt === undefined) { + return; + } + selectionMgr.saveSelectionState(true, true); + } editor.adjustCursorPosition = adjustCursorPosition; var textContent; diff --git a/public/res/extensions/welcomeTour.js b/public/res/extensions/welcomeTour.js index bc492f6a..86372b38 100644 --- a/public/res/extensions/welcomeTour.js +++ b/public/res/extensions/welcomeTour.js @@ -41,8 +41,8 @@ define([ }, onEnd: function() { storage.welcomeTour = 'done'; - infoTooltip('.menu-panel .toggle-button *', 'Synchronize, publish and more...', 'right'); - infoTooltip('.document-panel .toggle-button *', 'Create and manage documents', 'left'); + infoTooltip('.menu-panel .toggle-button *', 'Synchronize, publish...', 'right'); + infoTooltip('.document-panel .toggle-button *', 'Create, manage documents', 'left'); infoTooltip('.extension-preview-buttons .btn-group:first', 'Need help with Markdown syntax?', 'left'); infoTooltip('.layout-toggler-preview', 'Toggle preview', 'right'); }, diff --git a/public/res/libs/Markdown.Editor.js b/public/res/libs/Markdown.Editor.js index bd6ec51b..742d94e7 100644 --- a/public/res/libs/Markdown.Editor.js +++ b/public/res/libs/Markdown.Editor.js @@ -737,12 +737,13 @@ return; } - if (inputArea.selectionStart !== undefined && !uaSniffed.isOpera) { + //if (inputArea.selectionStart !== undefined && !uaSniffed.isOpera) { inputArea.focus(); inputArea.selectionStart = stateObj.start; inputArea.selectionEnd = stateObj.end; inputArea.scrollTop = stateObj.scrollTop; + /* } else if (doc.selection) { @@ -754,14 +755,16 @@ range.moveStart("character", stateObj.start); range.select(); } + */ }; this.setInputAreaSelectionStartEnd = function () { - if (!panels.ieCachedRange && (inputArea.selectionStart || inputArea.selectionStart === 0)) { + //if (!panels.ieCachedRange && (inputArea.selectionStart || inputArea.selectionStart === 0)) { stateObj.start = inputArea.selectionStart; stateObj.end = inputArea.selectionEnd; + /* } else if (doc.selection) { @@ -802,6 +805,7 @@ this.setInputAreaSelection(); } + */ }; // Restore this state into the input area. @@ -1401,9 +1405,11 @@ if (!noCleanup) { fixupInputArea(); + /* if(!linkOrImage) { inputBox.dispatchEvent(new Event('keydown')); } + */ } } diff --git a/public/res/styles/base.less b/public/res/styles/base.less index 0d8c43eb..d6be3ae1 100644 --- a/public/res/styles/base.less +++ b/public/res/styles/base.less @@ -19,6 +19,14 @@ @p-margin: 1.1em; @headings-font-family: inherit; +@font-face { + font-family: 'fontello'; + src: url('../font/fontello.svg#fontello') format('svg'), + url('../font/fontello.woff') format('woff'); + font-weight: normal; + font-style: normal; +} + @font-face { font-family: 'Source Sans Pro'; font-style: normal;