diff --git a/public/cache.manifest b/public/cache.manifest index 8eb56c89..f27a0fac 100644 --- a/public/cache.manifest +++ b/public/cache.manifest @@ -1,5 +1,5 @@ CACHE MANIFEST -#Date Mon Apr 21 2014 18:45:42 +#Date Mon Apr 21 2014 18:50:39 CACHE: res/worker.js diff --git a/public/res-min/main.js b/public/res-min/main.js index ca65e609..2087dde5 100644 --- a/public/res-min/main.js +++ b/public/res-min/main.js @@ -649,7 +649,7 @@ if(0===t.usedFootnotes.length)return e;e+='\n\n
\n
\n\n \n
\n
\n \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 E[e.which]?E[e.which]:T[e.which]?T[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||E.hasOwnProperty(e)&&(S[E[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)E[111+R]="f"+R;for(R=0;9>=R;++R)E[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
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\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=['
  • " 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='",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,E,T=['','','','','
    <%= _.size(folderDesc.fileList) %>
    ','
    ',"<%= folderDesc.name %>
    ",'
    ','
    <%= fileListHtml %>
    '].join(""),k=['
  • ','','','','
    <%= fileDesc.composeTitle() %>
    ','
  • '].join(""),_=['','
    <%= _.size(folderDesc.fileList) %>
    ','
    ',"<%= folderDesc.name %>
    "].join(""),I=['
  • ','
    <%= fileDesc.composeTitle() %>
  • '].join(""),D=[],N=[],L=t.debounce(function(){if(g!==!1){p(),C.text(t.size(l)),E.text(t.size(s)+1),S=t.filter(l,function(e){return void 0===e.folder});var n=['','','
    ',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(T,{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")),E=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('
    ').css({animation:u,"-webkit-animation":u}))}var d=n("style",{type:"text/css"});document.head.appendChild(d),d.innerHTML=a},a}),function(e){var t=function(){return!1===e.support.boxModel&&e.support.objectAll&&$support.leadingWhitespace}();e.jGrowl=function(t,n){0==e("#jGrowl").size()&&e('
    ').addClass(n&&n.position?n.position:e.jGrowl.defaults.position).appendTo("body"),e("#jGrowl").jGrowl(t,n)},e.fn.jGrowl=function(t,n){if(e.isFunction(this.each)){var i=arguments;return this.each(function(){void 0==e(this).data("jGrowl.instance")&&(e(this).data("jGrowl.instance",e.extend(new e.fn.jGrowl,{notifications:[],element:null,interval:null})),e(this).data("jGrowl.instance").startup(this)),e.isFunction(e(this).data("jGrowl.instance")[t])?e(this).data("jGrowl.instance")[t].apply(e(this).data("jGrowl.instance"),e.makeArray(i).slice(1)):e(this).data("jGrowl.instance").create(t,n)})}},e.extend(e.fn.jGrowl.prototype,{defaults:{pool:0,header:"",group:"",sticky:!1,position:"top-right",glue:"after",theme:"default",themeState:"highlight",corners:"10px",check:250,life:3e3,closeDuration:"normal",openDuration:"normal",easing:"swing",closer:!0,closeTemplate:"×",closerTemplate:"
    [ close all ]
    ",log:function(){},beforeOpen:function(){},afterOpen:function(){},open:function(){},beforeClose:function(){},close:function(){},animateOpen:{opacity:"show"},animateClose:{opacity:"hide"}},notifications:[],element:null,interval:null,create:function(t,n){var n=e.extend({},this.defaults,n);"undefined"!=typeof n.speed&&(n.openDuration=n.speed,n.closeDuration=n.speed),this.notifications.push({message:t,options:n}),n.log.apply(this.element,[this.element,t,n])},render:function(t){var n=this,i=t.message,r=t.options;r.themeState=""==r.themeState?"":"ui-state-"+r.themeState;var t=e('
    '+r.closeTemplate+'
    '+r.header+'
    '+i+"
    ").data("jGrowl",r).addClass(r.theme).children("div.jGrowl-close").bind("click.jGrowl",function(){e(this).parent().trigger("jGrowl.beforeClose")}).parent();e(t).bind("mouseover.jGrowl",function(){e("div.jGrowl-notification",n.element).data("jGrowl.pause",!0)}).bind("mouseout.jGrowl",function(){e("div.jGrowl-notification",n.element).data("jGrowl.pause",!1)}).bind("jGrowl.beforeOpen",function(){0!=r.beforeOpen.apply(t,[t,i,r,n.element])&&e(this).trigger("jGrowl.open")}).bind("jGrowl.open",function(){0!=r.open.apply(t,[t,i,r,n.element])&&("after"==r.glue?e("div.jGrowl-notification:last",n.element).after(t):e("div.jGrowl-notification:first",n.element).before(t),e(this).animate(r.animateOpen,r.openDuration,r.easing,function(){e.support.opacity===!1&&this.style.removeAttribute("filter"),null!=e(this).data("jGrowl")&&(e(this).data("jGrowl").created=new Date),e(this).trigger("jGrowl.afterOpen")}))}).bind("jGrowl.afterOpen",function(){r.afterOpen.apply(t,[t,i,r,n.element])}).bind("jGrowl.beforeClose",function(){0!=r.beforeClose.apply(t,[t,i,r,n.element])&&e(this).trigger("jGrowl.close")}).bind("jGrowl.close",function(){e(this).data("jGrowl.pause",!0),e(this).animate(r.animateClose,r.closeDuration,r.easing,function(){e.isFunction(r.close)?r.close.apply(t,[t,i,r,n.element])!==!1&&e(this).remove():e(this).remove()})}).trigger("jGrowl.beforeOpen"),""!=r.corners&&void 0!=e.fn.corner&&e(t).corner(r.corners),e("div.jGrowl-notification:parent",n.element).size()>1&&0==e("div.jGrowl-closer",n.element).size()&&0!=this.defaults.closer&&e(this.defaults.closerTemplate).addClass("jGrowl-closer "+this.defaults.themeState+" ui-corner-all").addClass(this.defaults.theme).appendTo(n.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){e(this).siblings().trigger("jGrowl.beforeClose"),e.isFunction(n.defaults.closer)&&n.defaults.closer.apply(e(this).parent()[0],[e(this).parent()[0]])})},update:function(){e(this.element).find("div.jGrowl-notification:parent").each(function(){void 0!=e(this).data("jGrowl")&&void 0!=e(this).data("jGrowl").created&&e(this).data("jGrowl").created.getTime()+parseInt(e(this).data("jGrowl").life)<(new Date).getTime()&&1!=e(this).data("jGrowl").sticky&&(void 0==e(this).data("jGrowl.pause")||1!=e(this).data("jGrowl.pause"))&&e(this).trigger("jGrowl.beforeClose")}),this.notifications.length>0&&(0==this.defaults.pool||e(this.element).find("div.jGrowl-notification:parent").size()
    '),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
    \n \n
    \n ms\n
    \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,"
    "),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
    \n \n
    \n \n \n
    \n
    \n
    \n \n
    \n \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \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'+r.join("")+"
    \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";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,en&&(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
    \n \n
    \n ms\n
    \n
    \n
    \n \n
    \n \n
    \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'

    Adds a "Document statistics" button over the preview.

    \n
    \n
    \n RegExp \n
    \n
    \n RegExp \n
    \n
    \n RegExp \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'

    Adds a "HTML code" button over the preview.

    \n
    \n
    \n \n
    \n \n
    \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='

    Adds 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(''}),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:"

    ",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 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 \n
    \n \n
    \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'

    Allows users to implement their own extension.

    \n
    \n
    \n \n
    \n \n
    \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
    <%= commentList %>
    \n
    \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=["
    \">",'
    <%= author %>
    ','
    <%= content %>
    ',"
    "].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,E,T,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(T.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||!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!==T){L=!1,N=[];var n=i["author.name"];w=[];var o=t.sortBy(T.discussionList,function(e){return e.selectionEnd});clearTimeout(k),k=setTimeout(e,5)}},50);return h.onLayoutResize=M,h.onFileOpen=function(e){T=e,M()},h.onContentChanged=function(e){T===e&&M()},h.onCommentsChanged=function(e){if(T===e){if(void 0!==C){var t=C;t.discussionIndex&&(t.getPopoverElt().querySelector(".discussion-comment-list").innerHTML=p());try{E.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&&E.applyToRange(t.rangyRange)},50)}M()}},h.onDiscussionCreated=function(e){T===e&&M()},h.onDiscussionRemoved=function(e,t){T===e&&(void 0!==C&&C.discussionIndex==t.discussionIndex&&d(),M())},h.onReady=function(){E=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,T);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:[]},T.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&&E.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(),E.undoToRange(C.rangyRange),C=void 0,delete T.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+""},!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=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 E=-v+m;v-g>=E;E+=2){var C,S=a+E;C=E==-v||E!=v&&c[S-1]C&&r>T&&e.charAt(i-C-1)==t.charAt(r-T-1);)C++,T++;if(c[S]=C,C>i)g+=2;else if(T>r)m+=2;else if(!p){var x=a+d-E;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;on;)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.length0)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 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... 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 \n
    \n \n
    \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'

    Allows users to implement their own extension.

    \n
    \n
    \n \n
    \n \n
    \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
    <%= commentList %>
    \n
    \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=["
    \">",'
    <%= author %>
    ','
    <%= content %>
    ',"
    "].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,E,T,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(T.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||!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!==T){L=!1,N=[];var n=i["author.name"];w=[];var o=t.sortBy(T.discussionList,function(e){return e.selectionEnd});clearTimeout(k),k=setTimeout(e,5)}},50);return h.onLayoutResize=M,h.onFileOpen=function(e){T=e,M()},h.onContentChanged=function(e){T===e&&M()},h.onCommentsChanged=function(e){if(T===e){if(void 0!==C){var t=C;t.discussionIndex&&(t.getPopoverElt().querySelector(".discussion-comment-list").innerHTML=p());try{E.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&&E.applyToRange(t.rangyRange)},50)}M()}},h.onDiscussionCreated=function(e){T===e&&M()},h.onDiscussionRemoved=function(e,t){T===e&&(void 0!==C&&C.discussionIndex==t.discussionIndex&&d(),M())},h.onReady=function(){E=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,T);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:[]},T.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&&E.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(),E.undoToRange(C.rangyRange),C=void 0,delete T.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+""},!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=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 E=-v+m;v-g>=E;E+=2){var C,S=a+E;C=E==-v||E!=v&&c[S-1]C&&r>T&&e.charAt(i-C-1)==t.charAt(r-T-1);)C++,T++;if(c[S]=C,C>i)g+=2;else if(T>r)m+=2;else if(!p){var x=a+d-E;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;on;)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.lengthl[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;o0?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;o0?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="";n1?(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;nt));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;nthis.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;n2&&(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;nthis.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;io[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;n2*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;n0)){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 E=!1;e.options&&e.options.arrays&&e.options.arrays.includeValueOnMove&&(E=!0);var T=S.length;for(t=p;v-f>t;t++){var k=c(w.indices2,t-p);if(0>k){var _=!1;if(C&&T>0)for(n=0;T>n;n++)if(u(y,x,S[n]-p,t-p,d)){b["_"+S[n]].splice(1,2,t,s),E||(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;r0){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!=T);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-T.getBoundingClientRect().top+T.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:void(i+=r.length+1)}),{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(),T.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=T.textContent;if(_.lastChild===z&&"\n"==z.textContent.slice(-1)&&(e=e.slice(0,-1)),e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n"),O===!1){if(e==H)return void(0===_.children.length&&(_.innerHTML="",W.forEach(function(e){_.appendChild(e.elt)}),C()));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,F.content=H,G.setSelectionStartEnd(F.editorStart,F.editorEnd),G.saveSelectionState(),r.onFileOpen(F,H),L.scrollTop=F.previewScrollTop,R=F.editorScrollTop,T.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){E(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 E(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 T,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=T.offsetHeight/2;e>130&&(e=130);var t=T.scrollTop+e,n=T.scrollTop+T.offsetHeight-e;G.cursorYn&&(T.scrollTop+=G.cursorY-n)});return function(){void 0!==T&&(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(T=document.getElementById("wmd-input"),k=e(T),_=T.querySelector(".editor-content"),I=e(_),D=T.querySelector(".editor-margin"),N=e(D),L=document.querySelector(".preview-container"),k.addClass(i.editorFontClass),B.startWatching(),e(T).scroll(function(){R=T.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()})}T.focus=g,Object.defineProperty(T,"value",{get:function(){return H},set:p}),Object.defineProperty(T,"selectionStart",{get:function(){return Math.min(G.selectionStart,G.selectionEnd)},set:function(e){G.setSelectionStartEnd(e)},enumerable:!0,configurable:!0}),Object.defineProperty(T,"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++,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),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.indext.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.distance0)){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.lengtht.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.deltaTimet.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(it.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(){$=!0,v.$elt.addClass("layout-animate")}function u(){$=!1,v.$elt.removeClass("layout-animate")}function d(t){this.selector=t,this.elt=document.querySelector(t),this.$elt=e(this.elt)}function p(e){e&&e.target!==v.elt&&e.target!==b.elt&&e.target!==E.elt||(G.forEach(function(e){e()}),u(),0!==G.length&&h(),G=[])}function f(){return t.find(J,function(e){return g.width>e.screenWidth}).maxWidth}function h(){var e=y.height-60,t=(C.elt.offsetWidth-f())/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' diff --git a/public/res/extensions/welcomeTour.js b/public/res/extensions/welcomeTour.js index 7b0539a4..2c15f1fa 100644 --- a/public/res/extensions/welcomeTour.js +++ b/public/res/extensions/welcomeTour.js @@ -71,7 +71,7 @@ define([ '
  • 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!

    ', + '

    Please provide your feedback here... Thanks!

    ', '', ].join(""), placement: 'bottom',