0||t.addedLineCount>0)&&this.render()}return i?this._rightIniting=!1:this._leftIniting=!1,n}},t}(),t}),define("orion/regex",[],function(){function e(e){return e.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")}function t(e){var t=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(e);return t?{pattern:t[1],flags:t[2]}:null}return{escape:e,parse:t}}),define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(e,t,i){function n(e,t){this._lastLineIndex=-1,this._text=[""],this._lineOffsets=[0],this.setText(e),this.setLineDelimiter(t)}return n.prototype={destroy:function(){},find:function(e){this._text.length>1&&(this._text=[this._text.join("")]);var i=e.string,n=e.regex,o=i,r="",s=e.caseInsensitive;if(o)if(n){var a=t.parse(o);a&&(o=a.pattern,r=a.flags)}else o=i.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),s&&(o=o.replace(/[iI\u0130\u0131]/g,"[Iiİı]"));var l,d=null;if(o){var h=e.reverse,c=e.wrap,u=e.wholeWord,p=e.start||0,f=e.end,g=null!==f&&void 0!==f;-1===r.indexOf("g")&&(r+="g"),-1===r.indexOf("m")&&(r+="m"),s&&-1===r.indexOf("i")&&(r+="i"),u&&(o="\\b"+o+"\\b");var _,m,v=this._text[0],y=0;if(g){var x=f>p?p:f,b=f>p?f:p;v=v.substring(x,b),y=x}var C=new RegExp(o,r);h?l=function(){var e=null;for(C.lastIndex=0;;){if(m=C.lastIndex,_=C.exec(v),m===C.lastIndex)return null;if(!_)break;if(_.index+y=0&&i>e))return null;var n=this._lineOffsets[e];if(i>e+1){var o=this.getText(n,this._lineOffsets[e+1]);if(t)return o;for(var r,s=o.length;10===(r=o.charCodeAt(s-1))||13===r;)s--;return o.substring(0,s)}return this.getText(n)},getLineAtOffset:function(e){var t=this.getCharCount();if(!(e>=0&&t>=e))return-1;var i=this.getLineCount();if(e===t)return i-1;var n,o,r=this._lastLineIndex;if(r>=0&&i>r&&(n=this._lineOffsets[r],o=i>r+1?this._lineOffsets[r+1]:t,e>=n&&o>e))return r;for(var s=i,a=-1;s-a>1;)if(r=Math.floor((s+a)/2),n=this._lineOffsets[r],o=i>r+1?this._lineOffsets[r+1]:t,n>=e)s=r;else{if(o>e){s=r;break}a=r}return this._lastLineIndex=s,s},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(e,t){var i=this.getLineCount();if(!(e>=0&&i>e))return-1;if(i>e+1){var n=this._lineOffsets[e+1];if(t)return n;for(var o,r=this.getText(Math.max(this._lineOffsets[e],n-2),n),s=r.length;10===(o=r.charCodeAt(s-1))||13===o;)s--;return n-(r.length-s)}return this.getCharCount()},getLineStart:function(e){return e>=0&&e=e));)n+=i,o++;for(var r=n,s=o;o=t));)n+=i,o++;var a=n,l=o;if(s>=this._text.length||l>=this._text.length||s>l)return"";if(s===l)return this._text[s].substring(e-r,t-a);var d=this._text[s].substring(e-r),h=this._text[l].substring(0,t-a);return d+this._text.slice(s+1,l).join("")+h},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},setLineDelimiter:function(e,t){if("auto"===e&&(e=void 0,this.getLineCount()>1&&(e=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0)))),this._lineDelimiter=e?e:i.platformDelimiter,t){var n=this.getLineCount();if(n>1){for(var o=new Array(n),r=0;n>r;r++)o[r]=this.getLine(r);this.setText(o.join(this._lineDelimiter))}}},setText:function(e,t,i){if(void 0===e&&(e=""),void 0===t&&(t=0),void 0===i&&(i=this.getCharCount()),t!==i||""!==e){for(var n=this.getLineAtOffset(t),o=this.getLineAtOffset(i),r=t,s=i-t,a=o-n,l=e.length,d=0,h=this.getLineCount(),c=0,u=0,p=0,f=[];;){if(-1!==c&&p>=c&&(c=e.indexOf("\r",p)),-1!==u&&p>=u&&(u=e.indexOf("\n",p)),-1===u&&-1===c)break;p=-1!==c&&-1!==u?c+1===u?u+1:(u>c?c:u)+1:-1!==c?c+1:u+1,f.push(t+p),d++}var g={type:"Changing",text:e,start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};if(this.onChanging(g),0===f.length){var _,m=this.getLineStart(n);_=h>o+1?this.getLineStart(o+1):this.getCharCount(),t!==m&&(e=this.getText(m,t)+e,t=m),i!==_&&(e+=this.getText(i,_),i=_)}for(var v=l-s,y=n+a+1;h>y;y++)this._lineOffsets[y]+=v;var x,b=5e4,C=b;if(f.length=t));)L+=T,k++;for(var D=L,A=k;k=i));)L+=T,k++;var S=L,E=k,O=this._text[A],N=this._text[E],M=O.substring(0,t-D),I=N.substring(i-S),B=[A,E-A+1];M&&B.push(M),e&&B.push(e),I&&B.push(I),Array.prototype.splice.apply(this._text,B),0===this._text.length&&(this._text=[""]);var R={type:"Changed",start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};this.onChanged(R)}}},e.EventTarget.addMixin(n.prototype),{TextModel:n}}),define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(e,t){function i(e){e&&(this._view=e,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function n(e){i.call(this,e)}return i.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(e){for(var t=[],i=this._keyBindings,n=0;nn){var c=o(n);t=s+c*l,r(t)}else r(a),h.stop()}var t,i="number"==typeof this.options.duration?this.options.duration:350,n="number"==typeof this.options.rate?this.options.rate:20,o=this.options.easing||this.defaultEasing,r=this.options.onAnimate||function(){},s=this.options.curve[0],a=this.options.curve[1],l=a-s,d=-1,h=this;this.interval=this.options.window.setInterval(e,n)},e.prototype.stop=function(){this.options.window.clearInterval(this.interval);var e=this.options.onEnd||function(){};e()},e.prototype.defaultEasing=function(e){return Math.sin(e*(Math.PI/2))},e}();return{contains:i,getNodeStyle:n,addEventListener:e,removeEventListener:t,Animation:o}}),define("orion/editor/textView",["i18n!orion/editor/nls/messages","orion/editor/textModel","orion/editor/keyModes","orion/editor/eventTarget","orion/editor/textTheme","orion/editor/util","orion/util","orion/metrics"],function(e,t,i,n,o,r,s,a){function l(e){return e.defaultView||e.parentWindow}function d(e){return new Array(e)}function h(e,t,i){if(i){t.className="";for(var n=t.attributes,o=n.length;o-->0;)(!s.isIE||s.isIE>=9||s.isIE<9&&n[o].specified)&&t.removeAttribute(n[o].name)}if(e){e.styleClass&&(t.className=e.styleClass);var r=e.style;if(r)for(var a in r)r.hasOwnProperty(a)&&(t.style[a]=r[a]);var l=e.attributes;if(l)for(var d in l)l.hasOwnProperty(d)&&t.setAttribute(d,l[d])}}function c(e){return e instanceof Array?e.slice(0):e}function u(e,t){if(!e)return t;if(!t)return e;for(var i in t)t.hasOwnProperty(i)&&(e.hasOwnProperty(i)||(e[i]=t[i]));return e}function p(e,t){if(e===t)return!0;if(e&&!t||!e&&t)return!1;if(e&&e.constructor===String||t&&t.constructor===String)return!1;if(e instanceof Array||t instanceof Array){if(!(e instanceof Array&&t instanceof Array))return!1;if(e.length!==t.length)return!1;for(var i=0;ir;){-1!==n&&r>=n&&(n=e.indexOf("\r",r)),-1!==o&&r>=o&&(o=e.indexOf("\n",r));var a,l=r;if(-1===o&&-1===n){t(e.substring(r));break}-1!==n&&-1!==o?n+1===o?(a=n,r=o+1):(a=o>n?n:o,r=(o>n?n:o)+1):-1!==n?(a=n,r=n+1):(a=o,r=o+1),t(e.substring(l,a)),i?i():r===s&&t("")}}function g(e){var t,i,n,o,r=l(e.ownerDocument);if(r.getComputedStyle){var s=r.getComputedStyle(e,null);t=s.getPropertyValue("border-left-width"),i=s.getPropertyValue("border-top-width"),n=s.getPropertyValue("border-right-width"),o=s.getPropertyValue("border-bottom-width")}else e.currentStyle&&(t=e.currentStyle.borderLeftWidth,i=e.currentStyle.borderTopWidth,n=e.currentStyle.borderRightWidth,o=e.currentStyle.borderBottomWidth);return{left:parseInt(t,10)||0,top:parseInt(i,10)||0,right:parseInt(n,10)||0,bottom:parseInt(o,10)||0}}function _(e){var t,i,n,o,r=l(e.ownerDocument);if(r.getComputedStyle){var s=r.getComputedStyle(e,null);t=s.getPropertyValue("padding-left"),i=s.getPropertyValue("padding-top"),n=s.getPropertyValue("padding-right"),o=s.getPropertyValue("padding-bottom")}else e.currentStyle&&(t=e.currentStyle.paddingLeft,i=e.currentStyle.paddingTop,n=e.currentStyle.paddingRight,o=e.currentStyle.paddingBottom);return{left:parseInt(t,10)||0,top:parseInt(i,10)||0,right:parseInt(n,10)||0,bottom:parseInt(o,10)||0}}function m(e){var t=e._trim;if(!t){t=_(e);var i=g(e);t.left+=i.left,t.top+=i.top,t.right+=i.right,t.bottom+=i.bottom,e._trim=t}return t}function v(e,t,i,n){function o(t){if(t.animationName===a){var i=t.target;"function"==typeof i.__DOMReady&&l(e).setTimeout(function(){i.__DOMReady()},0)}}function r(e,t){for(var i=["","-webkit-","-moz-","-ms-","-o-"],n="",o="body ."+e+" {\n",r=0;ri;i++){var n=e._createSelectionDiv();t.appendChild(n),this._divs.push(n)}}function b(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom}function C(e,t,i){this.view=e,this.lineIndex=t,this._lineDiv=i}function w(e){this._init(e||{})}var T=r.addEventListener,L=r.removeEventListener,k=r.Animation;return y.compare=function(e,t){if(e.length!==t.length)return!1;for(var i=0;i=0;i--)if(e[i]._editing)return e[i];return e[e.length-1]}for(i=0;i=i.end||i._editing||e[n]._editing?(t.push(i),i=e[n]):i.end=Math.max(i.end,e[n].end);return t.push(i),t},y.prototype={clone:function(){var e=new y(this.start,this.end,this.caret);return e._columnX=this._columnX,e._editing=this._editing,e._docX=this._docX,e},contains:function(e){return this.start<=e&ðis.end){var t=this.start;this.start=this.end,this.end=t,this.caret=!this.caret}},setCaret:function(e){this.start=e,this.end=e,this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},getAnchor:function(){return this.caret?this.end:this.start},getOrientedSelection:function(){return{start:this.getAnchor(),end:this.getCaret()}},toString:function(){return"start="+this.start+" end="+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===this.end},equals:function(e){return this.caret===e.caret&&this.start===e.start&&this.end===e.end&&this._editing===e._editing}},x.prototype={destroy:function(){this._divs&&(this._divs.forEach(function(e){e.parentNode.removeChild(e)}),this._divs=null)},setPrimary:function(e){this.primary=e},update:function(){var e,t=this._view,i=this.primary,n=t._hasFocus,o=t._cursorVisible,r=!this.primary&&this._selection&&this._selection.isEmpty();e=r?"textviewSelectionCaret":n?"textviewSelection":"textviewSelectionUnfocused",this._divs[0].style.visibility=r&&o&&n||!r?"visible":"hidden",this._divs[0].style.zIndex=o&&r?"2":"0",this._divs.forEach(function(t){t.className=e,s.isWebkit<537.36&&i&&(t.style.background=n?"transparent":"")})},setSelection:function(e){this._selection=e,this.update();var t=this._view,i=t._model,n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end),r=t._getLineNext();if(r){var s,a,l,d,h=t._getLinePrevious();nh.lineIndex?(s=h,l=i.getLineStart(h.lineIndex)):(s=t._getLineNode(n),l=e.start),oh.lineIndex?(a=h,d=i.getLineStart(h.lineIndex)):(a=t._getLineNode(o),d=e.end),this._setDOMSelection(s,l,a,d,e.caret)}},_setDOMSelection:function(e,t,i,n,o){if(this._setDOMFullSelection(e,t,i,n),this.primary){var r=this._view,a=e._line.getNodeOffset(t),l=i._line.getNodeOffset(n);if(a.node&&l.node){var d,h=r._getWindow(),c=r._parent.ownerDocument;if(h.getSelection){var u=h.getSelection();if(d=c.createRange(),d.setStart(a.node,a.offset),d.setEnd(l.node,l.offset),!r._hasFocus||u.anchorNode===a.node&&u.anchorOffset===a.offset&&u.focusNode===l.node&&u.focusOffset===l.offset&&u.anchorNode===l.node&&u.anchorOffset===l.offset&&u.focusNode===a.node&&u.focusOffset===a.offset||(r._anchorNode=a.node,r._anchorOffset=a.offset,r._focusNode=l.node,r._focusOffset=l.offset,r._ignoreSelect=!1,u.rangeCount>0&&u.removeAllRanges(),u.addRange(d),r._ignoreSelect=!0),r._cursorDiv){d=c.createRange(),o?(d.setStart(a.node,a.offset),d.setEnd(a.node,a.offset)):(d.setStart(l.node,l.offset),d.setEnd(l.node,l.offset));var p=d.getClientRects()[0],f=r._cursorDiv.parentNode,g=f.getBoundingClientRect();p&&g&&(r._cursorDiv.style.top=p.top-g.top+f.scrollTop+"px",r._cursorDiv.style.left=p.left-g.left+f.scrollLeft+"px")}}else if(c.selection){if(!r._hasFocus)return;var _=c.body,m=s.createElement(c,"div");_.appendChild(m),_.removeChild(m),d=_.createTextRange(),d.moveToElementText(a.node.parentNode),d.moveStart("character",a.offset);var v=_.createTextRange();v.moveToElementText(l.node.parentNode),v.moveStart("character",l.offset),d.setEndPoint("EndToStart",v),r._ignoreSelect=!1,d.select(),r._ignoreSelect=!0}}}},_setDOMFullSelection:function(e,t,i,n){this._divs.forEach(function(e){e.style.width=e.style.height="0px"});var o=this._view;if(o._fullSelection&&!(s.isIOS||e===i&&t===n&&this.primary)){var r=o._getViewPadding(),a=o._clientDiv.getBoundingClientRect(),l=o._viewDiv.getBoundingClientRect(),d=l.left+r.left,h=a.right,c=l.top+r.top,u=a.bottom,p=0,f=0;if(o._clipDiv){var g=o._clipDiv.getBoundingClientRect();p=g.left-o._clipDiv.scrollLeft,f=g.top}else{var _=o._rootDiv.getBoundingClientRect();p=_.left,f=_.top}o._ignoreDOMSelection=!0;var m,v,y=new C(o,e.lineIndex,e),x=y.getBoundingClientRect(t,!1),b=x.left;e===i&&t===n?(m=y,v=x):(m=new C(o,i.lineIndex,i),v=m.getBoundingClientRect(n,!1));var w=v.left;o._ignoreDOMSelection=!1;var T=this._divs[0],L=Math.min(h,Math.max(d,b)),k=Math.min(u,Math.max(c,x.top)),D=h,A=Math.min(u,Math.max(c,x.bottom));if(T.style.left=L-p+"px",T.style.top=k-f+"px",T.style.width=Math.max(0,D-L)+"px",T.style.height=Math.max(0,A-k)+"px",e.lineIndex===i.lineIndex)D=Math.min(w,h),T.style.width=Math.max(this.primary?0:1,D-L)+"px";else{var S=d,E=Math.min(u,Math.max(c,v.top)),O=Math.min(h,Math.max(d,w)),N=Math.min(u,Math.max(c,v.bottom)),M=this._divs[2];if(M.style.left=S-p+"px",M.style.top=E-f+"px",M.style.width=Math.max(0,O-S)+"px",M.style.height=Math.max(0,N-E)+"px",Math.abs(e.lineIndex-i.lineIndex)>1){var I=this._divs[1];I.style.left=d-p+"px",I.style.top=A-f+"px",I.style.width=Math.max(0,h-d)+"px",I.style.height=Math.max(0,E-A)+"px"}}}}},b.prototype={toString:function(){return"{l="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}},C.prototype={create:function(e,t){if(!this._lineDiv){var i=this._lineDiv=this._createLine(e,t,this.lineIndex);return i._line=this,i}},_createLine:function(e,t,i){var n=this.view,o=n._model,r=o.getLine(i),a=o.getLineStart(i),l={type:"LineStyle",textView:n,lineIndex:i,lineText:r,lineStart:a};n.onLineStyle(l);var d=e.ownerDocument,c=t||s.createElement(d,"div");if(t&&p(t.viewStyle,l.style)||(h(l.style,c,t),t&&(t._trim=null),c.viewStyle=l.style,c.setAttribute("role","presentation")),c.lineIndex=i,t&&c.viewLineText===r&&p(l.ranges,c.viewRanges))return c;c.viewRanges=l.ranges,c.viewLineText=r;var u=[],f={tabOffset:0,ranges:u};this._createRanges(l.ranges,r,0,r.length,a,f);var g=" ";!n._fullSelection&&s.isIE<9&&(g="");var _={text:g,style:n._metrics.largestFontStyle,ignoreChars:1};0!==u.length&&u[u.length-1].style&&"div"===u[u.length-1].style.tagName?u.splice(u.length-1,0,_):u.push(_);var m,v,y,x,b,C,w,T,L=0,k=0;if(s.isFirefox&&r.length>2e3){t&&(c.innerHTML="",t.lineWidth=void 0);var D=d.createDocumentFragment();for(T=0;T=S&&(O-=A);var N=y.firstChild.data,M=N?N.length:0;if(k+M>O)break;k+=M}w=y.nextSibling,c.removeChild(y),y=w}}m=this._createSpan(c,b,v,_.ignoreChars),y?c.insertBefore(m,y):c.appendChild(m),t&&(t.lineWidth=void 0)}if(t)for(var I=m?m.nextSibling:null;I;)w=I.nextSibling,t.removeChild(I),I=w}return c.parentNode||e.appendChild(c),c},_createRanges:function(e,t,i,n,o,r){if(!(i>n)){if(e)for(var s=0;sn)break;var d=Math.min(o+n,a.end)-o;if(d>=l){if(l=Math.max(i,l),d=Math.min(n,d),l>i&&this._createRange(t,i,l,null,r),!a.style||!a.style.unmergeable)for(;s+1i&&this._createRange(t,i,n,null,r)}},_createRange:function(e,t,i,n,o){if(!(t>i)){var r,s=this.view._customTabSize;if(s&&8!==s)for(var a=e.indexOf(" ",t);-1!==a&&i>a;){a>t&&(r={text:e.substring(t,a),style:n},o.ranges.push(r),o.tabOffset+=r.text.length);var l=s-o.tabOffset%s;if(l>0){for(var d=" ",h=1;l>h;h++)d+=" ";r={text:d,style:n,ignoreChars:l-1},o.ranges.push(r),o.tabOffset+=r.text.length}if(t=a+1,t===i)return;a=e.indexOf(" ",t)}i>=t&&(r={text:e.substring(t,i),style:n},o.ranges.push(r),o.tabOffset+=r.text.length)}},_createSpan:function(e,t,i,n){var o=this.view,r="span";i&&i.tagName&&(r=i.tagName.toLowerCase());var a="a"===r;a&&(this.hasLink=!0),a&&!o._linksVisible&&(r="span");var l=e.ownerDocument,d=s.createElement(e.ownerDocument,r);if(d.appendChild(l.createTextNode(i&&i.text?i.text:t)),i&&i.html?(d.innerHTML=i.html,d.ignore=!0):i&&i.node&&(d.appendChild(i.node),d.ignore=!0),h(i,d),"a"===r){var c=o._getWindow();T(d,"click",function(e){return o._handleLinkClick(e?e:c.event)},!1)}return d.viewStyle=i,n&&(d.ignoreChars=n),d},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(e,t){var i=this._ensureCreated(),n=this.view;if(void 0===e)return this._getLineBoundingClientRect(i,!0);var o=n._model,r=i.ownerDocument,a=this.lineIndex,d=null;if(ee){var c,u=e-h;if(1===o.length)d=new b(t.getBoundingClientRect());else if(n._isRangeRects)c=r.createRange(),c.setStart(o,u),c.setEnd(o,u+1),d=new b(c.getBoundingClientRect());else if(s.isIE){c=r.body.createTextRange(),c.moveToElementText(t),c.collapse();var p=0===u&&8===s.isIE;p&&(u=1),c.moveEnd("character",u+1),c.moveStart("character",u),d=new b(c.getBoundingClientRect()),p&&(d.left=t.getClientRects()[0].left)}else{var f=o.data;t.removeChild(o),t.appendChild(r.createTextNode(f.substring(0,u)));var g=s.createElement(r,"span");if(g.appendChild(r.createTextNode(f.substring(u,u+1))),t.appendChild(g),t.appendChild(r.createTextNode(f.substring(u+1))),d=new b(g.getBoundingClientRect()),t.innerHTML="",t.appendChild(o),!this._createdDiv){var _=n._getSelections()[0];(h<=_.start&&_.starts.right&&(s.right=a.right),a.bottom>s.bottom&&(s.bottom=a.bottom))}}return!0}),void 0!==e?i[e]:i},_getLineBoundingClientRect:function(e,t){var i=new b(e.getBoundingClientRect());if(this.view._wrapMode);else{i.right=i.left;for(var n=e.lastChild;n&&n.ignoreChars===n.firstChild.length;)n=n.previousSibling;if(n){var o=n.getBoundingClientRect();i.right=o.right+m(e).right}}if(t){var r=m(e);i.left=i.left+r.left,i.right=i.right-r.right}return i},getLineCount:function(){return this.view._wrapMode?this.getClientRects().length:1},getLineIndex:function(e){if(!this.view._wrapMode)return 0;for(var t=this.getClientRects(),i=this.getBoundingClientRect(e),n=i.top+(i.bottom-i.top)/2,o=0;os||n+r>=a?(t=o,i=s-n,e.ignoreChars&&r>0&&i===r&&(i+=e.ignoreChars),!1):(n+=r,!0)}),{node:t,offset:i}},getText:function(e){var t="",i=0;return this.forEach(function(n){var o;if(n.ignoreChars){o=n.lastChild;for(var r=0,s=[],a=-1;o;){var l=o.data;if(l)for(var d=l.length-1;d>=0;d--){var h=l.substring(d,d+1);r1;){var N=Math.floor((E+O)/2);y=O+1,x=N===T-1&&i.ignoreChars?w.length:N+1,b=0===y&&8===s.isIE,o._isRangeRects?(v.setStart(w,y),v.setEnd(w,x)):(b&&(y=1),v.moveToElementText(i),v.move("character",y),v.moveEnd("character",x-y)),C=v.getClientRects();for(var M=!1,I=0;I=c&&_>e&&(!o._wrapMode||t>=u&&m>=t)){M=!0;break}M?E=N:O=N}n+=E,y=E,x=E===T-1&&i.ignoreChars?w.length:Math.min(E+1,w.length),o._isRangeRects?(v.setStart(w,y),v.setEnd(w,x)):(v.moveToElementText(i),v.move("character",y),v.moveEnd("character",x-y)),C=v.getClientRects();var B=!1;C.length>0&&(h=C[0],c=(b?S:h.left)*D-f.left,_=h.right*D-f.left,B=e>c+(_-c)/2);var R=n-d,F=r.getLine(a),P=F.charCodeAt(R);P>=55296&&56319>=P&&B?R=56320&&57343>=P&&(n+=1)):P>=56320&&57343>=P&&!B&&R>0&&(P=F.charCodeAt(R-1),P>=55296&&56319>=P&&(n-=1)),B&&n++}else{for(var W=[],V=0;T>V;V++)W.push(""),W.push(V===T-1?w.data.substring(V):w.data.substring(V,V+1)),W.push("");i.innerHTML=W.join("");for(var H=i.firstChild;H;){if(h=H.getBoundingClientRect(),c=h.left-f.left,_=h.right-f.left,e>=c&&_>e){e>c+(_-c)/2&&n++;break}n++,H=H.nextSibling}if(!g._createdDiv){i.innerHTML="",i.appendChild(w);var U=o._getSelections()[0];(n<=U.start&&U.startu.right&&(e=u.right-1)}else 0>e&&(e=0),e>f.right-f.left&&(e=f.right-f.left);var m,v;if(this._lastHitChild&&this._lastHitChild.parentNode){if(m=this._lastHitOffset,v=this._lastHitChild,u=n(v),!u)for(var y=m,x=m+this._nodeLength(v),b=v.previousSibling,C=v.nextSibling;b||C;){if(b){if(y-=this._nodeLength(b),u=n(b)){v=b,m=y;break}b=b.previousSibling}if(C){if(u=n(C)){v=C,m=x;break}x+=this._nodeLength(C),C=C.nextSibling}}}else m=d,this.forEach(function(e){return v=e,(u=n(v))?!1:(m+=this._nodeLength(v),!0)});return v&&u&&(this._lastHitChild=v,this._lastHitOffset=m,m=i(v,m,u)),Math.min(h,Math.max(d,m))},getNextOffset:function(e,t){if("line"===t.unit){var i=this.view,n=i._model,o=n.getLineAtOffset(e);return t.count>0?(t.count--,n.getLineEnd(o)):(t.count++,n.getLineStart(o))}return"wordend"===t.unit||"wordWS"===t.unit||"wordendWS"===t.unit?this._getNextOffset_W3C(e,t):s.isIE?this._getNextOffset_IE(e,t):this._getNextOffset_W3C(e,t)},_getNextOffset_W3C:function(e,t){function i(e){return e>=33&&47>=e||e>=58&&64>=e||e>=91&&94>=e||96===e||e>=123&&126>=e}function n(e){return 32===e||9===e}var o,r=this.view,s=r._model,a=s.getLineAtOffset(e),l=s.getLine(a),d=s.getLineStart(a),h=s.getLineEnd(a),c=l.length,u=e-d,p=t.count<0?-1:1;if("word"===t.unit||"wordend"===t.unit||"wordWS"===t.unit||"wordendWS"===t.unit)for(var f,g,_,m;0!==t.count;){if(t.count>0){if(u===c)return h;for(o=l.charCodeAt(u),f=i(o),g=!f&&!n(o),u++;c>u;){if(o=l.charCodeAt(u),"wordWS"!==t.unit&&"wordendWS"!==t.unit){if(_=i(o),"wordend"===t.unit){if(!_&&f)break}else if(_&&!f)break;m=!_&&!n(o)}else m=!n(o);if("wordend"===t.unit||"wordendWS"===t.unit){if(!m&&g)break}else if(m&&!g)break;g=m,f=_,u++}}else{if(0===u)return d;for(u--,o=l.charCodeAt(u),f=i(o),g=!f&&!n(o);u>0;){if(o=l.charCodeAt(u-1),"wordWS"!==t.unit&&"wordendWS"!==t.unit){if(_=i(o),"wordend"===t.unit){if(_&&!f)break}else if(!_&&f)break;m=!_&&!n(o)}else m=!n(o);if("wordend"===t.unit||"wordendWS"===t.unit){if(m&&!g)break}else if(!m&&g)break;g=m,f=_,u--}}t.count-=p}else for(;0!==t.count&&u+p>=0&&c>=u+p;)u+=p,o=l.charCodeAt(u),o>=56320&&57343>=o&&u>0&&(o=l.charCodeAt(u-1),o>=55296&&56319>=o&&(u+=p)),t.count-=p;return d+u},_getNextOffset_IE:function(e,t){var i,n,o,r=this._ensureCreated(),s=this.view,a=s._model,l=this.lineIndex,d=0,h=a.getLineStart(l),c=a.getLine(l),u=a.getLineStart(l),p=r.ownerDocument,f=t.count<0?-1:1;if(e===a.getLineEnd(l)){for(o=r.lastChild;o&&o.ignoreChars===o.firstChild.length;)o=o.previousSibling;if(!o)return h;i=p.body.createTextRange(),i.moveToElementText(o),n=i.text.length,i.moveEnd(t.unit,f),d=e+i.text.length-n}else if(e===h&&t.count<0)d=h;else for(o=r.firstChild;o;){var g=this._nodeLength(o);if(h+g>e){if(i=p.body.createTextRange(),e===h&&t.count<0){for(var _=o.previousSibling;_&&(!_.firstChild||!_.firstChild.length);)_=_.previousSibling;i.moveToElementText(_?_:o.previousSibling)}else i.moveToElementText(o),i.collapse(),i.moveEnd("character",e-h);n=i.text.length,i.moveEnd(t.unit,f),d=e+i.text.length-n;break}h=g+h,o=o.nextSibling}var m=d-u,v=c.charCodeAt(m);return v>=56320&&57343>=v&&m>0&&(v=c.charCodeAt(m-1),v>=55296&&56319>=v&&(m+=f)),d=m+u,t.count-=f,d},updateLinks:function(){var e=this._ensureCreated();if(this.hasLink){var t=this;this.forEach(function(i){var n=i.viewStyle;return n&&n.tagName&&"a"===n.tagName.toLowerCase()&&e.replaceChild(t._createSpan(e,i.firstChild.data,n),i),!0})}},destroy:function(){var e=this._createdDiv;e&&(e.parentNode.removeChild(e),this._createdDiv=null)}},w.prototype={addKeyMode:function(e,t){var i=this._keyModes;void 0!==t?i.splice(t,0,e):i.push(e),e._modeAdded&&e._modeAdded()},addRuler:function(e,t){var i=this._rulers;if(void 0!==t){var n,o;for(n=0,o=0;no;n++)e.getLocation()===i[n].getLocation()&&o++;i.splice(o,0,e),t=o}else i.push(e);this._createRuler(e,t),e.setView(this),this._update()},computeSize:function(){var e=0,t=0,i=this._model,n=this._clientDiv;if(!n)return{width:e,height:t};var o=n.style.width;s.isWebkit&&(n.style.width="0x7fffffffpx");for(var r=i.getLineCount(),a=0;r>a;a++){var l=this._getLine(a),d=l.getBoundingClientRect();e=Math.max(e,d.right-d.left),t+=d.bottom-d.top,l.destroy()}s.isWebkit&&(n.style.width=o);var h=this._getViewPadding();return e+=h.right+h.left+this._metrics.scrollWidth,t+=h.bottom+h.top+this._metrics.scrollWidth,{width:e,height:t}},convert:function(e,t,i){if(!this._clientDiv)return e;var n=this._getScroll(),o=this._getViewPadding(),r=this._viewDiv.getBoundingClientRect();return"document"===t&&(void 0!==e.x&&(e.x+=-n.x+r.left+o.left),void 0!==e.y&&(e.y+=-n.y+r.top+o.top)),"document"===i&&(void 0!==e.x&&(e.x+=n.x-r.left-o.left),void 0!==e.y&&(e.y+=n.y-r.top-o.top)),e},copy:function(){return this._clientDiv?this._doCopy():!1},cut:function(){return this._clientDiv?this._doCut():!1},destroy:function(){for(var e=0;ei)return!1;var n=this._getLine(i),o=this.getOffsetAtLocation(e,t),r=n.getBoundingClientRect(o);return n.destroy(),e>r.right?!1:!0},getLinePixel:function(e){return this._clientDiv?this._getLinePixel(e):0},getLocationAtOffset:function(e){if(!this._clientDiv)return{x:0,y:0};var t=this._model;e=Math.min(Math.max(0,e),t.getCharCount());var i=t.getLineAtOffset(e),n=this._getLine(i),o=n.getBoundingClientRect(e);n.destroy();var r=o.left,s=this._getLinePixel(i)+o.top;return{x:r,y:s}},getNextOffset:function(e,t){var i=new y(e,e,!1);return this._doMove(t,i),i.getCaret()},getOptions:function(){var e;if(0===arguments.length)e=this._defaultOptions();else if(1===arguments.length){var t=arguments[0];if("string"==typeof t)return c(this["_"+t]);e=t}else{e={};for(var i in arguments)arguments.hasOwnProperty(i)&&(e[arguments[i]]=void 0)}for(var n in e)e.hasOwnProperty(n)&&(e[n]=c(this["_"+n]));return e},getModel:function(){return this._model},getOffsetAtLocation:function(e,t){if(!this._clientDiv)return 0;var i=this._getLineIndex(t),n=this._getLine(i),o=n.getOffset(e,t-this._getLinePixel(i));return n.destroy(),o},getLineAtOffset:function(e){return this.getModel().getLineAtOffset(e)},getLineStart:function(e){return this.getModel().getLineStart(e)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){return this._getSelection()},getSelections:function(){return this._getSelections()},getSelectionText:function(e){var t=[],i=this,n=this._getSelections();return n.forEach(function(e){e.isEmpty()||t.push(i._getBaseText(e.start,e.end))}),t.join(void 0!==e?e:this._model.getLineDelimiter())},getText:function(e,t){var i=this._model;return i.getText(e,t)},getTopIndex:function(e){return this._clientDiv?this._getTopIndex(e):0},getTopPixel:function(){return this._clientDiv?this._getScroll().y:0},invokeAction:function(e,t,i){if(this._clientDiv){var n=this._actions[e];if(n){if(n.actionDescription&&n.actionDescription.id&&a.logEvent("editor","action",n.actionDescription.id),!t&&n.handler&&n.handler(i))return!0;if(n.defaultHandler)return"boolean"==typeof n.defaultHandler(i)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(e){return this.dispatchEvent(e)},onDragStart:function(e){return this.dispatchEvent(e)},onDrag:function(e){return this.dispatchEvent(e)},onDragEnd:function(e){return this.dispatchEvent(e)},onDragEnter:function(e){return this.dispatchEvent(e)
-},onDragOver:function(e){return this.dispatchEvent(e)},onDragLeave:function(e){return this.dispatchEvent(e)},onDrop:function(e){return this.dispatchEvent(e)},onDestroy:function(e){return this.dispatchEvent(e)},onSaving:function(e){return this.dispatchEvent(e)},onInputChanged:function(e){return this.dispatchEvent(e)},onLineStyle:function(e){return this.dispatchEvent(e)},onKeyDown:function(e){return this.dispatchEvent(e)},onKeyPress:function(e){return this.dispatchEvent(e)},onKeyUp:function(e){return this.dispatchEvent(e)},onModelChanged:function(e){return this.dispatchEvent(e)},onModelChanging:function(e){return this.dispatchEvent(e)},onModify:function(e){return this.dispatchEvent(e)},onMouseDown:function(e){return this.dispatchEvent(e)},onMouseUp:function(e){return this.dispatchEvent(e)},onMouseMove:function(e){return this.dispatchEvent(e)},onMouseOver:function(e){return this.dispatchEvent(e)},onMouseOut:function(e){return this.dispatchEvent(e)},onTouchStart:function(e){return this.dispatchEvent(e)},onTouchMove:function(e){return this.dispatchEvent(e)},onTouchEnd:function(e){return this.dispatchEvent(e)},onOptions:function(e){return this.dispatchEvent(e)},onSelection:function(e){return this.dispatchEvent(e)},onScroll:function(e){return this.dispatchEvent(e)},onVerify:function(e){return this.dispatchEvent(e)},onFocus:function(e){return this.dispatchEvent(e)},onBlur:function(e){return this.dispatchEvent(e)},paste:function(){return this._clientDiv?this._doPaste():!1},redraw:function(){if(!(this._redrawCount>0)){var e=this._model.getLineCount();this.redrawRulers(0,e),this.redrawLines(0,e)}},redrawRulers:function(e,t){if(!(this._redrawCount>0))for(var i=this.getRulers(),n=0;n0)&&(void 0===e&&(e=0),void 0===t&&(t=this._model.getLineCount()),e!==t)){var n=this._clientDiv;if(n){if(i){var o=this._getRulerParent(i);for(n=o.firstChild;n&&n._ruler!==i;)n=n.nextSibling}i?n.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(e,t);var r=-1;if(i||-1===this._imeOffset||(r=this._model.getLineAtOffset(this._imeOffset)),!i||"page"===i.getOverview())for(var s=n.firstChild;s;){var a=s.lineIndex;a>=e&&t>a&&a!==r&&(s.lineChanged=!0),s=s.nextSibling}i||this._wrapMode||e<=this._maxLineIndex&&this._maxLineIndex0)){var i=this._model;void 0===e&&(e=0),void 0===t&&(t=i.getCharCount());var n=i.getLineAtOffset(e),o=i.getLineAtOffset(Math.max(e,t-1))+1;this.redrawLines(n,o)}},removeKeyMode:function(e){for(var t=this._keyModes,i=0;it;if(o){var r=e;e=t,t=r}var s=this._model.getCharCount();e=Math.max(0,Math.min(e,s)),t=Math.max(0,Math.min(t,s));var a=new y(e,t,o);this._setSelection(a,void 0===i||i,!0,n)},setSelections:function(e,t,i){var n=this._rangesToSelections(e);this._setSelection(n,void 0===t||t,!0,i)},setText:function(e,t,i,n,o){var r,a="string"==typeof e,l=void 0===t&&void 0===i&&a;a?(void 0===t&&(t=0),void 0===i&&(i=this._model.getCharCount()),r={text:e,selection:[new y(t,i,!1)]}):(r=e,r.selection=this._rangesToSelections(r.selection)),r._code=!0,l&&(this._variableLineHeight=!1),this._modifyContent(r,!l,void 0===n||n,o),l&&s.isFirefox<13&&this._fixCaret()},setTopIndex:function(e,t){this._clientDiv&&this._scrollViewAnimated(0,this._getLinePixel(Math.max(0,e))-this._getScroll().y,t)},setTopPixel:function(e,t){this._clientDiv&&this._scrollViewAnimated(0,Math.max(0,e)-this._getScroll().y,t)},showSelection:function(e,t){return this._showCaret(e?!1:!0,t,e)},update:function(e,t){this._clientDiv&&((e||this._metrics.invalid)&&this._updateStyle(),void 0===t||t?this._update():this._queueUpdate())},_handleRootMouseDown:function(e){if(this._cancelCheckSelection(),!this._ignoreEvent(e)){s.isFirefox<13&&1===e.which&&(this._clientDiv.contentEditable=!1,(this._overlayDiv||this._clientDiv).draggable=!0,this._ignoreBlur=!0);var t=this._overlayDiv||this._clientDiv;s.isIE<9&&(t=this._viewDiv);for(var i=e.target?e.target:e.srcElement;i;){if(t===i)return;if(i.className&&-1!==i.className.indexOf("textViewFind"))return;i=i.parentNode}if(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!this._isW3CEvents){var n=this,o=this._getWindow();o.setTimeout(function(){n._clientDiv.focus()},0)}}},_handleRootMouseUp:function(e){this._ignoreEvent(e)||(s.isFirefox<13&&1===e.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1),s.isFirefox&&1===e.which&&(this._fixCaret(),this._ignoreBlur=!1))},_handleBlur:function(){if(this._cancelCheckSelection(),!this._ignoreBlur){if(this._commitIME(),this._hasFocus=!1,s.isIE<9&&!this._getSelections()[0].isEmpty()){var e=this._rootDiv,t=s.createElement(e.ownerDocument,"div");e.appendChild(t),e.removeChild(t)}if(this._cursorDiv&&(this._cursorDiv.style.display="none"),this._domSelection){this._domSelection.forEach(function(e){e.update()});var i,n=this._getWindow(),o=this._parent.ownerDocument;if(n.getSelection){var r=n.getSelection();for(i=r.anchorNode;i;){if(i===this._clientDiv){r.rangeCount>0&&r.removeAllRanges();break}i=i.parentNode}}else if(o.selection){for(this._ignoreSelect=!1,i=o.selection.createRange().parentElement();i;){if(i===this._clientDiv){o.selection.empty();break}i=i.parentNode}this._ignoreSelect=!0}}this._ignoreFocus||this.onBlur({type:"Blur"})}},_handleCompositionStart:function(e){if(!this._ignoreEvent(e)){if(this._imeTimeout){var t=this._getWindow();t.clearTimeout(this._imeTimeout),this._imeTimeout=null}this._imeText&&(this._commitIME(this._imeText),this._imeText=null),this._startIME(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)}},_handleCompositionUpdate:function(e){this._ignoreEvent(e)||(this._imeText=e.data)},_handleCompositionEnd:function(e){if(!this._ignoreEvent(e)){this._imeText=e.data;var t=this._getWindow();this._imeTimeout=t.setTimeout(function(){this._commitIME(this._imeText),this._imeText=this._imeTimeout=null}.bind(this),0)}},_handleContextMenu:function(e){if(!this._ignoreEvent(e)){s.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var t=!1;if(this.isListening("ContextMenu")){var i=this._createMouseEvent("ContextMenu",e);i.screenX=e.screenX,i.screenY=e.screenY,this.onContextMenu(i),t=i.defaultPrevented}else s.isMac&&s.isFirefox&&0===e.button&&(t=!0);return t?(e.preventDefault&&e.preventDefault(),!1):(this._contextMenuOpen=!0,void(s.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))))}},_handleCopy:function(e){return this._cancelCheckSelection(),this._ignoreEvent(e)||this._ignoreCopy?void 0:this._doCopy(e)?(e.preventDefault&&e.preventDefault(),!1):void 0},_handleCut:function(e){return this._cancelCheckSelection(),this._ignoreEvent(e)?void 0:this._doCut(e)?(e.preventDefault&&e.preventDefault(),!1):void 0},_handleDataModified:function(e){this._ignoreEvent(e)||this._startIME()},_handleDblclick:function(e){if(!this._ignoreEvent(e)){var t=e.timeStamp?e.timeStamp:(new Date).getTime();this._lastMouseTime=t,2!==this._clickCount&&(this._clickCount=2,this._handleMouse(e))}},_handleDragStart:function(e){if(!this._ignoreEvent(e)){if(s.isFirefox<13){var t=this,i=this._getWindow();i.setTimeout(function(){t._clientDiv.contentEditable=!0,t._clientDiv.draggable=!1,t._ignoreBlur=!1},0)}return this.isListening("DragStart")&&-1!==this._dragOffset?(this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",e)),this._dragOffset=-1,void 0):(e.preventDefault&&e.preventDefault(),!1)}},_handleDrag:function(e){this._ignoreEvent(e)||this.isListening("Drag")&&this.onDrag(this._createMouseEvent("Drag",e))},_handleDragEnd:function(e){this._ignoreEvent(e)||(this._dropTarget=!1,this._dragOffset=-1,this.isListening("DragEnd")&&this.onDragEnd(this._createMouseEvent("DragEnd",e)),s.isFirefox<13&&(this._fixCaret(),"none"!==e.dataTransfer.dropEffect||e.dataTransfer.mozUserCancelled||this._fixCaret()))},_handleDragEnter:function(e){if(!this._ignoreEvent(e)){var t=!0;return this._dropTarget=!0,this.isListening("DragEnter")&&(t=!1,this.onDragEnter(this._createMouseEvent("DragEnter",e))),s.isWebkit||t?(e.preventDefault&&e.preventDefault(),!1):void 0}},_handleDragOver:function(e){if(!this._ignoreEvent(e)){var t=!0;return this.isListening("DragOver")&&(t=!1,this.onDragOver(this._createMouseEvent("DragOver",e))),s.isWebkit||t?(t&&(e.dataTransfer.dropEffect="none"),e.preventDefault&&e.preventDefault(),!1):void 0}},_handleDragLeave:function(e){this._ignoreEvent(e)||(this._dropTarget=!1,this.isListening("DragLeave")&&this.onDragLeave(this._createMouseEvent("DragLeave",e)))},_handleDrop:function(e){return this._ignoreEvent(e)?void 0:(this._dropTarget=!1,this.isListening("Drop")&&this.onDrop(this._createMouseEvent("Drop",e)),e.preventDefault&&e.preventDefault(),!1)},_handleFocus:function(){this._hasFocus=!0,s.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection(),this._cursorDiv&&(this._cursorDiv.style.display="block"),this._domSelection&&this._domSelection.forEach(function(e){e.update()}),this._ignoreFocus||this.onFocus({type:"Focus"})},_handleKeyDown:function(e){if(this._cancelCheckSelection(),!this._ignoreEvent(e)){if(this.isListening("KeyDown")){var t=this._createKeyEvent("KeyDown",e);if(this.onKeyDown(t),t.defaultPrevented)return s.isFirefox&&(this._keyDownPrevented=!0),void e.preventDefault()}var i=!1;switch(e.keyCode){case 16:case 17:case 18:case 91:i=!0;break;default:this._setLinksVisible(!1)}if(229===e.keyCode){if(this._readonly)return e.preventDefault&&e.preventDefault(),!1;var n=!0;s.isSafari&&s.isMac&&e.ctrlKey&&(n=!1,e.keyCode=129),n&&this._startIME()}else i||this._commitIME();return(s.isMac||s.isLinux)&&s.isFirefox<4||s.isOpera<12.16?(this._keyDownEvent=e,!0):this._doAction(e)?(e.preventDefault?(e.preventDefault(),e.stopPropagation()):(e.cancelBubble=!0,e.returnValue=!1,e.keyCode=0),!1):void 0}},_handleKeyPress:function(e){if(!this._ignoreEvent(e)){if(this._keyDownPrevented)return e.preventDefault&&(e.preventDefault(),e.stopPropagation()),void(this._keyDownPrevented=void 0);if(s.isMac&&s.isWebkit&&(63232<=e.keyCode&&e.keyCode<=63487||13===e.keyCode||8===e.keyCode))return e.preventDefault&&e.preventDefault(),!1;if(((s.isMac||s.isLinux)&&s.isFirefox<4||s.isOpera<12.16)&&this._doAction(this._keyDownEvent))return e.preventDefault&&e.preventDefault(),!1;var t=s.isMac?e.metaKey:e.ctrlKey;if(void 0!==e.charCode&&t)switch(e.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")){var i=this._createKeyEvent("KeyPress",e);if(this.onKeyPress(i),i.defaultPrevented)return void e.preventDefault()}if(this._doAction(e))return e.preventDefault?(e.preventDefault(),e.stopPropagation()):(e.cancelBubble=!0,e.returnValue=!1,e.keyCode=0),!1;var n=!1;if(s.isMac?(e.ctrlKey||e.metaKey)&&(n=!0):s.isFirefox?(e.ctrlKey||e.altKey)&&(n=!0):e.ctrlKey^e.altKey&&(n=!0),!n){var o=s.isOpera?e.which:void 0!==e.charCode?e.charCode:e.keyCode;if(o>31)return this._doContent(String.fromCharCode(o)),e.preventDefault&&e.preventDefault(),!1}}},_handleDocKeyUp:function(e){var t=s.isMac?e.metaKey:e.ctrlKey;t||this._setLinksVisible(!1)},_handleKeyUp:function(e){if(!this._ignoreEvent(e)){if(this.isListening("KeyUp")){var t=this._createKeyEvent("KeyUp",e);if(this.onKeyUp(t),t.defaultPrevented)return void e.preventDefault()}this._handleDocKeyUp(e),13===e.keyCode&&this._commitIME()}},_handleLinkClick:function(e){var t=s.isMac?e.metaKey:e.ctrlKey;return t?void 0:(e.preventDefault&&e.preventDefault(),!1)},_handleMouse:function(e){var t=this._getWindow(),i=!0,n=t;if((s.isIE||s.isFirefox&&!this._overlayDiv)&&(n=this._clientDiv),this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var o=this;t.setTimeout(function(){o.focus(),o._ignoreFocus=!1},0)}var r=e.shiftKey,a=e.altKey,l=s.isMac?e.metaKey:e.ctrlKey;if(this._blockSelection=this._doubleClickSelection=null,1===this._clickCount){var d=(!s.isOpera||s.isOpera>=12.16)&&this._hasFocus&&this.isListening("DragStart");i=this._setSelectionTo(e.clientX,e.clientY,!0,r,l,d),i&&this._setGrab(n)}else this._isW3CEvents&&this._setGrab(n),this._setSelectionTo(e.clientX,e.clientY,!0,r,l,!1),this._doubleClickSelection=y.editing(this._getSelections());return a&&(this._blockSelection=y.editing(this._getSelections())),i},_handleMouseDown:function(e){if(!this._ignoreEvent(e)){if(this._linksVisible){var t=e.target||e.srcElement;if("A"===t.tagName)return;this._setLinksVisible(!1)}this._commitIME();var i=e.which;i||(4===e.button&&(i=2),2===e.button&&(i=3),1===e.button&&(i=1));var n=2!==i&&e.timeStamp?e.timeStamp:(new Date).getTime(),o=n-this._lastMouseTime,r=Math.abs(this._lastMouseX-e.clientX),a=Math.abs(this._lastMouseY-e.clientY),l=this._lastMouseButton===i;if(this._lastMouseX=e.clientX,this._lastMouseY=e.clientY,this._lastMouseTime=n,this._lastMouseButton=i,1===i&&(this._isMouseDown=!0,l&&o<=this._clickTime&&r<=this._clickDist&&a<=this._clickDist?this._clickCount++:this._clickCount=1),this.isListening("MouseDown")){var d=this._createMouseEvent("MouseDown",e);if(this.onMouseDown(d),d.defaultPrevented)return void e.preventDefault()}1===i&&this._handleMouse(e)&&(s.isIE>=9||s.isOpera||s.isChrome||s.isSafari||s.isFirefox&&!this._overlayDiv)&&(this._hasFocus||this.focus(),e.preventDefault()),s.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}},_handleMouseOver:function(e){this._ignoreEvent(e)||this._animation||this.isListening("MouseOver")&&this.onMouseOver(this._createMouseEvent("MouseOver",e))},_handleMouseOut:function(e){this._ignoreEvent(e)||this._animation||this.isListening("MouseOut")&&this.onMouseOut(this._createMouseEvent("MouseOut",e))},_handleMouseMove:function(e){if(!this._animation){var t=this._isClientDiv(e);if(this.isListening("MouseMove")&&(t||this._isMouseDown)){var i=this._createMouseEvent("MouseMove",e);if(this.onMouseMove(i),i.defaultPrevented)return void e.preventDefault()}if(!this._dropTarget){var n=this._linksVisible||this._lastMouseMoveX!==e.clientX||this._lastMouseMoveY!==e.clientY;if(this._lastMouseMoveX=e.clientX,this._lastMouseMoveY=e.clientY,this._setLinksVisible(n&&!this._isMouseDown&&e.altKey&&(s.isMac?e.metaKey:e.ctrlKey)),this._checkOverlayScroll(),!this._isW3CEvents){if(0===e.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===e.button&&0!==(1&this._clickCount)&&t)return this._clickCount=2,this._handleMouse(e,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){var o=e.clientX,r=e.clientY,a=this._getViewPadding(),l=this._viewDiv.getBoundingClientRect(),d=this._getClientWidth(),h=this._getClientHeight(),c=l.left+a.left,u=l.top+a.top,p=l.left+a.left+d,f=l.top+a.top+h;u>r?this._doAutoScroll("up",o,r-u):r>f?this._doAutoScroll("down",o,r-f):c>o&&!this._wrapMode?this._doAutoScroll("left",o-c,r):o>p&&!this._wrapMode?this._doAutoScroll("right",o-p,r):(this._endAutoScroll(),this._setSelectionTo(o,r,!1,!0))}}}},_isClientDiv:function(e){for(var t=this._overlayDiv||this._clientDiv,i=e.target?e.target:e.srcElement;i;){if(t===i)return!0;i=i.parentNode}return!1},_createKeyEvent:function(e,t){return{type:e,event:t,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(e,t){var i=this.convert({x:t.clientX,y:t.clientY},"page","document");return{type:e,event:t,clickCount:this._clickCount,x:i.x,y:i.y,preventDefault:function(){this.defaultPrevented=!0}}},_createTouchEvent:function(e,t){var i=t.touches.length?this.convert({x:t.touches[0].clientX,y:t.touches[0].clientY},"page","document"):{};return{type:e,event:t,touchCount:t.touches.length,x:i.x,y:i.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(e){var t=e.which?0===e.button:1===e.button;if(this.isListening("MouseUp")&&(this._isClientDiv(e)||t&&this._isMouseDown)){var i=this._createMouseEvent("MouseUp",e);if(this.onMouseUp(i),i.defaultPrevented)return e.preventDefault(),void(this._isMouseDown=!1)}if(!this._linksVisible){if(t&&this._isMouseDown){var n=this._getSelections(),o=y.editing(n);n.forEach(function(e){e._editing=!1}),-1!==this._dragOffset&&(o.extend(this._dragOffset),o.collapse(),n=o,this._dragOffset=-1),this._setSelection(n,!1),this._isMouseDown=!1,this._endAutoScroll(),this._isW3CEvents&&this._setGrab(null)}t&&this._isMouseDown&&s.isFirefox&&(this._updateDOMSelection(),e.preventDefault())}},_handleMouseWheel:function(e){if(!this._noScroll){var t=this._getLineHeight(),i=0,n=0;if(s.isIE||s.isOpera)n=-e.wheelDelta/40*t;else if(s.isFirefox){var o=256;if("wheel"===e.type)e.deltaMode?(i=Math.max(-o,Math.min(o,e.deltaX))*t,n=Math.max(-o,Math.min(o,e.deltaY))*t):(i=e.deltaX,n=e.deltaY);else{var r;r=s.isMac?3*e.detail:Math.max(-o,Math.min(o,e.detail))*t,e.axis===e.HORIZONTAL_AXIS?i=r:n=r}}else if(s.isMac){var a,l,d=e.timeStamp-this._wheelTimeStamp;this._wheelTimeStamp=e.timeStamp,a=e.wheelDeltaX%120!==0?1:40>d?40/(40-d):40,l=e.wheelDeltaY%120!==0?1:40>d?40/(40-d):40,i=Math.ceil(-e.wheelDeltaX/a),i>-1&&0>i&&(i=-1),i>0&&1>i&&(i=1),n=Math.ceil(-e.wheelDeltaY/l),n>-1&&0>n&&(n=-1),n>0&&1>n&&(n=1)}else{i=-e.wheelDeltaX;var h=8;n=-e.wheelDeltaY/120*h*t}if(s.isSafari||s.isChrome&&s.isMac){for(var c=e.target;c&&void 0===c.lineIndex;)c=c.parentNode;this._mouseWheelLine=c}var u=this._getScroll();this._scrollView(i,n);var p=this._getScroll();return u.x!==p.x||u.y!==p.y?(e.preventDefault&&e.preventDefault(),!1):void 0}},_handlePaste:function(e){if(this._cancelCheckSelection(),!this._ignoreEvent(e)&&!this._ignorePaste&&this._doPaste(e)){if(s.isIE){var t=this;this._ignoreFocus=!0;var i=this._getWindow();i.setTimeout(function(){t._updateDOMSelection(),t._ignoreFocus=!1},0)}return e.preventDefault&&e.preventDefault(),!1}},_handleResize:function(){var e=this._rootDiv.clientWidth,t=this._rootDiv.clientHeight;if(this._rootWidth!==e||this._rootHeight!==t){this._rootWidth!==e&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=e,this._rootHeight=t;var i=s.isIE<9,n=this._calculateMetrics();p(n,this._metrics)||(this._metrics.invalid&&!n.invalid?this._updateStyle(!1,n):(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=n),i=!0),i?this._queueUpdate():this._update(),this.dispatchEvent({type:"Resize"})}},_handleRulerEvent:function(e){for(var t=e.target?e.target:e.srcElement,i=t.lineIndex,n=t;n&&!n._ruler;)void 0===i&&void 0!==n.lineIndex&&(i=n.lineIndex),n=n.parentNode;var o=n?n._ruler:null;if(void 0===i&&o&&"document"===o.getOverview()){var r,s,a=this._getClientHeight(),l=this._model.getLineCount(),d=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect(),c=this._getLineHeight(),u=c*l,p=a+d.top+d.bottom-2*this._metrics.scrollWidth;p>u?(r=c,s=d.top):(r=p/l,s=this._metrics.scrollWidth),i=Math.floor((e.clientY-h.top-s)/r),i>=0&&l>i||(i=void 0)}if(o)switch(e.type){case"click":o.onClick&&o.onClick(i,e);break;case"dblclick":o.onDblClick&&o.onDblClick(i,e);break;case"mousemove":o.onMouseMove&&o.onMouseMove(i,e);break;case"mouseover":o.onMouseOver&&o.onMouseOver(i,e);break;case"mouseout":if(o.onMouseOut){for(var f=e.relatedTarget;f&&f!==this._rootDiv;){if(f===n)return;f=f.parentNode}o.onMouseOut(i,e)}}},_handleScroll:function(){this._lastScrollTime=(new Date).getTime();var e=this._getScroll(!1),t=this._hScroll,i=this._vScroll;if(t!==e.x||i!==e.y){this._hScroll=e.x,this._vScroll=e.y,this._commitIME(),this._update(i===e.y);var n={type:"Scroll",oldValue:{x:t,y:i},newValue:e};this.onScroll(n)}},_handleSelectStart:function(e){var t=this._contextMenuOpen;return this._contextMenuOpen=!1,t?void(this._checkSelectionChange=!0):this._ignoreSelect?(e&&e.preventDefault&&e.preventDefault(),!1):void 0},_getModelOffset:function(e,t){if(e){var i;return i="DIV"===e.tagName?e:e.parentNode.parentNode,i._line?i._line.getModelOffset(e,t):0}},_updateSelectionFromDOM:function(){if(!(s.isIOS||s.isAndroid||this._checkSelectionChange))return!1;var e=this._getWindow(),t=e.getSelection(),i=this._getModelOffset(t.anchorNode,t.anchorOffset),n=this._getModelOffset(t.focusNode,t.focusOffset),o=this._getSelections()[0];if(void 0===i||void 0===n||o.start===i&&o.end===n)return!1;if(this._checkSelectionChange){var r=this._getLineNext(),a=this._getLinePrevious();if(t.anchorNode===r.firstChild.firstChild&&0===t.anchorOffset&&t.focusNode===a.firstChild.firstChild&&0===t.focusOffset)return!1;(t.anchorNode===r.firstChild.firstChild&&0===t.anchorOffset&&t.focusNode===a.lastChild.firstChild||t.anchorNode===this._clientDiv&&t.focusNode===this._clientDiv)&&(i=0,n=this.getModel().getCharCount())}return this._setSelection(new y(i,n),!1,!1),this._checkSelectionChange=!1,!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){if(this._selPollTimer){var e=this._getWindow();e.clearTimeout(this._selPollTimer),this._selPollTimer=null}},_pollSelectionChange:function(e){var t=this,i=this._getWindow();this._cancelPollSelectionChange(),this._selPollTimer=i.setTimeout(function(){if(t._selPollTimer=null,t._clientDiv){var i=t._updateSelectionFromDOM();!i&&e&&t._pollSelectionChange(e)}},100)},_handleSelectionChange:function(){-1===this._imeOffset&&(s.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(e){if(!this._ignoreEvent(e)&&-1===this._imeOffset){var t=this._getWindow().getSelection();if(t.anchorNode!==this._anchorNode||t.focusNode!==this._focusNode||t.anchorOffset!==this._anchorOffset||t.focusOffset!==this._focusOffset){for(var i=t.anchorNode;i&&void 0===i.lineIndex;)i=i.parentNode;if(i){var n=this._model,o=i.lineIndex,r=n.getLine(o),s=r,a=0,l=n.getLineStart(o);if(t.rangeCount>0){t.getRangeAt(0).deleteContents();var d=i.ownerDocument.createTextNode(e.data);t.getRangeAt(0).insertNode(d);var h=this._getDOMText(i,d);s=h.text,a=h.offset,d.parentNode.removeChild(d)}i.lineRemoved=!0;for(var c=0;r.charCodeAt(c)===s.charCodeAt(c)&&a>c;)c++;for(var u=r.length-1,p=s.length-r.length;r.charCodeAt(u)===s.charCodeAt(u+p)&&u+p>=a+e.data.length;)u--;u++;var f=s.substring(c,u+p);c+=l,u+=l;var g=this._getSelections(),_=g[0].start-c,m=g[0].end-u;g[0].start=c,g[0].end=u;for(var v=1;v=0;i--)if(t=n[i],"function"==typeof t.match){var o=t.match(e);if(void 0!==o)return this.invokeAction(o)}return!1},_doMove:function(e,t){var i=this._model,n=t.getCaret(),o=i.getLineAtOffset(n);for(e.count||(e.count=1);0!==e.count;){var r=i.getLineStart(o);if(e.count<0&&n===r){if(!(o>0))break;"character"===e.unit&&e.count++,o--,t.extend(i.getLineEnd(o))}else if(e.count>0&&n===i.getLineEnd(o)){if(!(o+10&&(r=Math.min(r+e.count-1,t.getLineCount()-1)),o=t.getLineEnd(r);n.extend(o)}e.select||n.collapse()}),this._setSelection(n,!0,!0,e.ctrl?function(){}:null),!0},_doEnter:function(e){if(this._singleMode)return!0;var t=this._model,i=this._getSelections();return this._doContent(t.getLineDelimiter()),e&&e.noCursor&&(i.forEach(function(e){e.end=e.start}),this._setSelection(i,!0)),!0},_doEscape:function(){var e=this._getSelections();return e.length>1&&this._setSelection(e[0],!0),!0},_doHome:function(e){var t=this._model,i=this,n=this._getSelections();return n.forEach(function(n){if(e.ctrl)n.extend(0);else{var o=n.getCaret(),r=t.getLineAtOffset(o);if(i._wrapMode){var s=i._getLine(r),a=s.getLineIndex(o);o=s.getLineStart(a),s.destroy()}else o=t.getLineStart(r);n.extend(o)}e.select||n.collapse()}),this._setSelection(n,!0,!0,e.ctrl?function(){}:null),!0},_doLineDown:function(e){var t=this._model,i=this,n=this._getSelections();return n.forEach(function(n){var o,r=n.getCaret(),a=t.getLineAtOffset(r),l=i._getLine(a),d=n._columnX,h=1,c=!1;if(-1===d||e.wholeLine||e.select&&s.isIE){var u=e.wholeLine?t.getLineEnd(a+1):r;d=n._columnX=l.getBoundingClientRect(u).left}if((o=l.getLineIndex(r))0?a=Math.min(a+e.count,p):a++}var f=!1;c?(e.select||s.isMac||s.isLinux)&&(n.extend(t.getCharCount()),f=!0):(l.lineIndex!==a&&(l.destroy(),l=i._getLine(a)),n.extend(l.getOffset(d,h)),f=!0),f&&(e.select||n.collapse()),l.destroy()}),i._setSelection(n,!0,!0,null,0,!1,!0),!0},_doLineUp:function(e){var t=this._model,i=this,n=this._getSelections();return n.forEach(function(n){var o,r,a=n.getCaret(),l=t.getLineAtOffset(a),d=i._getLine(l),h=n._columnX,c=!1;if(-1===h||e.wholeLine||e.select&&s.isIE){var u=e.wholeLine?t.getLineStart(l-1):a;h=n._columnX=d.getBoundingClientRect(u).left}(o=d.getLineIndex(a))>0?r=d.getClientRects(o-1).top+1:(c=0===l,c||(e.count&&e.count>0?l=Math.max(l-e.count,0):l--,r=i._getLineHeight(l)-1));var p=!1;c?(e.select||s.isMac||s.isLinux)&&(n.extend(0),p=!0):(d.lineIndex!==l&&(d.destroy(),d=i._getLine(l)),n.extend(d.getOffset(h,r)),p=!0),p&&(e.select||n.collapse()),d.destroy()}),i._setSelection(n,!0,!0,null,0,!1,!0),!0},_doNoop:function(){return!0},_doPageDown:function(e){var t,i,n,o=this,r=this._model,a=this._getSelections(),l=r.getLineCount(),d=this._getScroll(),h=this._getClientHeight(),c=this._getLineHeight(),u=Math.floor(h/c);
-return a.forEach(function(a){var p=a.getCaret(),f=r.getLineAtOffset(p);if(o._lineHeight){t=a._columnX;var g=o._getBoundsAtOffset(p);(-1===t||e.select&&s.isIE)&&(t=a._columnX=g.left);var _=o._getLineIndex(g.top+h);i=o._getLine(_);var m=o._getLinePixel(_),v=g.top+h-m;p=i.getOffset(t,v);var y=i.getBoundingClientRect(p);i.destroy(),a.extend(p),e.select||a.collapse(),n=void 0!==n?Math.min(n,y.top+m-g.top):y.top+m-g.top}else if(l-1>f){var x=Math.min(l-f-1,u);x=Math.max(1,x),t=a._columnX,(-1===t||e.select&&s.isIE)&&(i=o._getLine(f),t=a._columnX=i.getBoundingClientRect(p).left,i.destroy()),i=o._getLine(f+x),a.extend(i.getOffset(t,0)),i.destroy(),e.select||a.collapse();var b=l*c,C=d.y+x*c;C+h>b&&(C=b-h),n=void 0!==n?Math.min(n,C-d.y):C-d.y}}),this._setSelection(a,!0,!0,function(){},n,!1,!0),!0},_doPageUp:function(e){var t,i,n,o=this,r=this._model,a=this._getSelections(),l=this._getScroll(),d=this._getClientHeight(),h=this._getLineHeight(),c=Math.floor(d/h);return a.forEach(function(a){var u=a.getCaret(),p=r.getLineAtOffset(u);if(o._lineHeight){t=a._columnX;var f=o._getBoundsAtOffset(u);(-1===t||e.select&&s.isIE)&&(t=a._columnX=f.left);var g=o._getLineIndex(f.bottom-d);i=o._getLine(g);var _=o._getLinePixel(g),m=f.bottom-d-_;u=i.getOffset(t,m);var v=i.getBoundingClientRect(u);i.destroy(),a.extend(u),e.select||a.collapse(),n=void 0!==n?Math.max(n,v.top+_-f.top):v.top+_-f.top}else if(p>0){var y=Math.max(1,Math.min(p,c));t=a._columnX,(-1===t||e.select&&s.isIE)&&(i=o._getLine(p),t=a._columnX=i.getBoundingClientRect(u).left,i.destroy()),i=o._getLine(p-y),a.extend(i.getOffset(t,o._getLineHeight(p-y)-1)),i.destroy(),e.select||a.collapse();var x=Math.max(0,l.y-y*h);n=void 0!==n?Math.max(n,x-l.y):x-l.y}}),this._setSelection(a,!0,!0,function(){},n,!1,!0),!0},_doPaste:function(e){var t=this,i=this._getClipboardText(e,function(e){if(e.length){if(s.isLinux&&2===t._lastMouseButton){var i=(new Date).getTime()-t._lastMouseTime;i<=t._clickTime&&t._setSelectionTo(t._lastMouseX,t._lastMouseY,!0)}var n=t._getSelections(),o=t._singleMode?"":t._model.getLineDelimiter();t._doContent(n.length>1&&n.length===e.length?e:e.join(o))}});return null!==i},_doScroll:function(e){var t,i=e.type,n=this._model,o=n.getLineCount(),r=this._getClientHeight(),s=this._getLineHeight(),a=this._lineHeight?this._scrollHeight:o*s,l=this._getScroll().y;switch(i){case"textStart":t=0;break;case"textEnd":t=a-r;break;case"pageDown":t=l+r;break;case"pageUp":t=l-r;break;case"lineDown":t=l+s;break;case"lineUp":t=l-s;break;case"centerLine":var d=this._getSelections()[0],h=n.getLineAtOffset(d.start),c=n.getLineAtOffset(d.end),u=(c-h+1)*s;t=h*s-r/2+u/2}return void 0!==t&&(t=Math.min(Math.max(0,t),a-r),this._scrollViewAnimated(0,t-l,function(){})),!0},_doSelectAll:function(){var e=this._model;return this._setSelection(new y(0,e.getCharCount()),!1),!0},_doTab:function(){if(this._tabMode&&!this._readonly){var e=" ",t=this._getSelections();if(this._expandTab){e=[];var i=this._model,n=this._tabSize;t.forEach(function(t){var o=t.getCaret(),r=i.getLineAtOffset(o),s=i.getLineStart(r),a=n-(o-s)%n;e.push(d(a+1).join(" "))})}return this._modifyContent({text:e,selection:t,_ignoreDOMSelection:!0},!0)}},_doShiftTab:function(){return this._tabMode&&!this._readonly?!0:void 0},_doOverwriteMode:function(){return this._readonly?void 0:(this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0)},_doTabMode:function(){return this._tabMode=!this._tabMode,!0},_doWrapMode:function(){return this.setOptions({wrapMode:!this.getOptions("wrapMode")}),!0},_autoScroll:function(){var e,t,i=this._model,n=this._getSelections(),o=y.editing(n,"down"===this._autoScrollDir),r=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),a=o.getCaret(),l=i.getLineCount(),d=i.getLineAtOffset(a);if("up"===this._autoScrollDir||"down"===this._autoScrollDir){var h=this._autoScrollY/this._getLineHeight();h=0>h?Math.floor(h):Math.ceil(h),e=d,e=Math.max(0,Math.min(l-1,e+h))}else("left"===this._autoScrollDir||"right"===this._autoScrollDir)&&(e=this._getLineIndex(r.y),t=this._getLine(d),r.x+=t.getBoundingClientRect(a,!1).left,t.destroy());this._blockSelection?n=this._getBlockSelections(n,e,r):0===e&&(s.isMac||s.isLinux)?o.extend(0):e===l-1&&(s.isMac||s.isLinux)?o.extend(i.getCharCount()):(t=this._getLine(e),o.extend(t.getOffset(r.x,r.y-this._getLinePixel(e))),t.destroy()),this._setSelection(n,!0)},_autoScrollTimer:function(){this._autoScroll();var e=this,t=this._getWindow();this._autoScrollTimerID=t.setTimeout(function(){e._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(e){if(this._lineHeight&&!this._calculateLHTimer){var t=this._model.getLineCount(),i=0;if(e){for(var n=0,o=100,r=(new Date).getTime(),s=0;t>i&&(this._lineHeight[i]||(n++,s||(s=i),this._lineHeight[i]=this._calculateLineHeight(i)),i++,!((new Date).getTime()-r>o)););this.redrawRulers(0,t),this._queueUpdate()}var a=this._getWindow();if(i!==t){var l=this;return void(this._calculateLHTimer=a.setTimeout(function(){l._calculateLHTimer=null,l._calculateLineHeightTimer(!0)},0))}this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(e){var t=this._getLine(e),i=t.getBoundingClientRect();return t.destroy(),Math.max(1,i.bottom-i.top)},_calculateMetrics:function(){var e=this._clientDiv,t=e.ownerDocument,i=" ",n=s.createElement(t,"div");n.style.lineHeight="normal";var o=this._model,r=o.getLine(0),a={type:"LineStyle",textView:this,0:0,lineText:r,lineStart:0};this.onLineStyle(a),h(a.style,n),n.style.position="fixed",n.style.left="-1000px";var l=s.createElement(t,"span");l.appendChild(t.createTextNode(i)),n.appendChild(l);var c=s.createElement(t,"span");c.style.fontStyle="italic",c.appendChild(t.createTextNode(i)),n.appendChild(c);var u=s.createElement(t,"span");u.style.fontWeight="bold",u.appendChild(t.createTextNode(i)),n.appendChild(u);var p=s.createElement(t,"span");p.style.fontWeight="bold",p.style.fontStyle="italic",p.appendChild(t.createTextNode(i)),n.appendChild(p),e.appendChild(n);var f=n.getBoundingClientRect(),g=l.getBoundingClientRect(),v=c.getBoundingClientRect(),y=u.getBoundingClientRect(),x=p.getBoundingClientRect(),b=g.bottom-g.top,C=v.bottom-v.top,w=y.bottom-y.top,T=x.bottom-x.top,L=0,k=f.bottom-f.top<=0,D=Math.max(1,f.bottom-f.top);C>b&&(L=1),w>C&&(L=2),T>w&&(L=3);var A;0!==L&&(A={style:{}},0!==(1&L)&&(A.style.fontStyle="italic"),0!==(2&L)&&(A.style.fontWeight="bold"));var S=m(n);e.removeChild(n);var E=_(this._viewDiv),O=s.createElement(t,"div");O.style.position="fixed",O.style.left="-1000px",O.style.paddingLeft=E.left+"px",O.style.paddingTop=E.top+"px",O.style.paddingRight=E.right+"px",O.style.paddingBottom=E.bottom+"px",O.style.width="100px",O.style.height="100px";var N=s.createElement(t,"div");N.style.width="100%",N.style.height="100%",O.appendChild(N),e.appendChild(O);var M=O.getBoundingClientRect(),I=N.getBoundingClientRect(),B=0;if(!this._singleMode&&!this._noScroll){O.style.overflow="hidden",N.style.height="200px";var R=O.clientWidth;O.style.overflow="scroll";var F=O.clientWidth;B=R-F}e.removeChild(O),E={left:I.left-M.left,top:I.top-M.top,right:M.right-I.right,bottom:M.bottom-I.bottom};var P=0,W=0,V=0;return k||(O=s.createElement(t,"div"),O.style.position="fixed",O.style.left="-1000px",e.appendChild(O),O.innerHTML=d(2).join("a"),M=O.getBoundingClientRect(),V=Math.ceil(M.right-M.left),(this._wrapOffset||this._marginOffset)&&(O.innerHTML=d(this._wrapOffset+1+(s.isWebkit?0:1)).join(" "),M=O.getBoundingClientRect(),P=Math.ceil(M.right-M.left),O.innerHTML=d(this._marginOffset+1).join(" "),I=O.getBoundingClientRect(),W=Math.ceil(I.right-I.left)),e.removeChild(O)),{lineHeight:D,largestFontStyle:A,lineTrim:S,viewPadding:E,scrollWidth:B,wrapWidth:P,marginWidth:W,charWidth:V,invalid:k}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(e){var t=this._getSelections();return t.forEach(function(t){"next"===e?t.start=t.end:t.end=t.start}),this._setSelection(t,!0),!0},_commitIME:function(e){if(-1!==this._imeOffset){var t=this._model,i=t.getLineAtOffset(this._imeOffset),n=t.getLineStart(i),o=this._getLineNode(i);if(!e){this._scrollDiv.focus(),this._clientDiv.focus();var r=this._getDOMText(o).text,a=t.getLine(i),l=this._imeOffset-n,d=l+r.length-a.length;l!==d&&(e=r.substring(l,d))}this._imeOffset=-1,e&&(this._doContent(e)||s.isWebkit||(o.lineRemoved=!0,this._queueUpdate()))}},_createActions:function(){this.addKeyMode(new i.DefaultKeyMode(this));var t=this;this._actions={noop:{defaultHandler:function(){return t._doNoop()}},lineUp:{defaultHandler:function(e){return t._doLineUp(u(e,{select:!1}))},actionDescription:{name:e.lineUp}},lineDown:{defaultHandler:function(e){return t._doLineDown(u(e,{select:!1}))},actionDescription:{name:e.lineDown}},lineStart:{defaultHandler:function(e){return t._doHome(u(e,{select:!1,ctrl:!1}))},actionDescription:{name:e.lineStart}},lineEnd:{defaultHandler:function(e){return t._doEnd(u(e,{select:!1,ctrl:!1}))},actionDescription:{name:e.lineEnd}},charPrevious:{defaultHandler:function(e){return t._doCursorPrevious(u(e,{select:!1,unit:"character"}))},actionDescription:{name:e.charPrevious}},charNext:{defaultHandler:function(e){return t._doCursorNext(u(e,{select:!1,unit:"character"}))},actionDescription:{name:e.charNext}},pageUp:{defaultHandler:function(e){return t._doPageUp(u(e,{select:!1}))},actionDescription:{name:e.pageUp}},pageDown:{defaultHandler:function(e){return t._doPageDown(u(e,{select:!1}))},actionDescription:{name:e.pageDown}},scrollPageUp:{defaultHandler:function(e){return t._doScroll(u(e,{type:"pageUp"}))},actionDescription:{name:e.scrollPageUp}},scrollPageDown:{defaultHandler:function(e){return t._doScroll(u(e,{type:"pageDown"}))},actionDescription:{name:e.scrollPageDown}},scrollLineUp:{defaultHandler:function(e){return t._doScroll(u(e,{type:"lineUp"}))},actionDescription:{name:e.scrollLineUp}},scrollLineDown:{defaultHandler:function(e){return t._doScroll(u(e,{type:"lineDown"}))},actionDescription:{name:e.scrollLineDown}},wordPrevious:{defaultHandler:function(e){return t._doCursorPrevious(u(e,{select:!1,unit:"word"}))},actionDescription:{name:e.wordPrevious}},wordNext:{defaultHandler:function(e){return t._doCursorNext(u(e,{select:!1,unit:"word"}))},actionDescription:{name:e.wordNext}},textStart:{defaultHandler:function(e){return t._doHome(u(e,{select:!1,ctrl:!0}))},actionDescription:{name:e.textStart}},textEnd:{defaultHandler:function(e){return t._doEnd(u(e,{select:!1,ctrl:!0}))},actionDescription:{name:e.textEnd}},scrollTextStart:{defaultHandler:function(e){return t._doScroll(u(e,{type:"textStart"}))},actionDescription:{name:e.scrollTextStart}},scrollTextEnd:{defaultHandler:function(e){return t._doScroll(u(e,{type:"textEnd"}))},actionDescription:{name:e.scrollTextEnd}},centerLine:{defaultHandler:function(e){return t._doScroll(u(e,{type:"centerLine"}))},actionDescription:{name:e.centerLine}},selectLineUp:{defaultHandler:function(e){return t._doLineUp(u(e,{select:!0}))},actionDescription:{name:e.selectLineUp}},selectLineDown:{defaultHandler:function(e){return t._doLineDown(u(e,{select:!0}))},actionDescription:{name:e.selectLineDown}},selectWholeLineUp:{defaultHandler:function(e){return t._doLineUp(u(e,{select:!0,wholeLine:!0}))},actionDescription:{name:e.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(e){return t._doLineDown(u(e,{select:!0,wholeLine:!0}))},actionDescription:{name:e.selectWholeLineDown}},selectLineStart:{defaultHandler:function(e){return t._doHome(u(e,{select:!0,ctrl:!1}))},actionDescription:{name:e.selectLineStart}},selectLineEnd:{defaultHandler:function(e){return t._doEnd(u(e,{select:!0,ctrl:!1}))},actionDescription:{name:e.selectLineEnd}},selectCharPrevious:{defaultHandler:function(e){return t._doCursorPrevious(u(e,{select:!0,unit:"character"}))},actionDescription:{name:e.selectCharPrevious}},selectCharNext:{defaultHandler:function(e){return t._doCursorNext(u(e,{select:!0,unit:"character"}))},actionDescription:{name:e.selectCharNext}},selectPageUp:{defaultHandler:function(e){return t._doPageUp(u(e,{select:!0}))},actionDescription:{name:e.selectPageUp}},selectPageDown:{defaultHandler:function(e){return t._doPageDown(u(e,{select:!0}))},actionDescription:{name:e.selectPageDown}},selectWordPrevious:{defaultHandler:function(e){return t._doCursorPrevious(u(e,{select:!0,unit:"word"}))},actionDescription:{name:e.selectWordPrevious}},selectWordNext:{defaultHandler:function(e){return t._doCursorNext(u(e,{select:!0,unit:"word"}))},actionDescription:{name:e.selectWordNext}},selectTextStart:{defaultHandler:function(e){return t._doHome(u(e,{select:!0,ctrl:!0}))},actionDescription:{name:e.selectTextStart}},selectTextEnd:{defaultHandler:function(e){return t._doEnd(u(e,{select:!0,ctrl:!0}))},actionDescription:{name:e.selectTextEnd}},deletePrevious:{defaultHandler:function(e){return t._doBackspace(u(e,{unit:"character"}))},actionDescription:{name:e.deletePrevious}},deleteNext:{defaultHandler:function(e){return t._doDelete(u(e,{unit:"character"}))},actionDescription:{name:e.deleteNext}},deleteWordPrevious:{defaultHandler:function(e){return t._doBackspace(u(e,{unit:"word"}))},actionDescription:{name:e.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(e){return t._doDelete(u(e,{unit:"word"}))},actionDescription:{name:e.deleteWordNext}},deleteLineStart:{defaultHandler:function(e){return t._doBackspace(u(e,{unit:"line"}))},actionDescription:{name:e.deleteLineStart}},deleteLineEnd:{defaultHandler:function(e){return t._doDelete(u(e,{unit:"line"}))},actionDescription:{name:e.deleteLineEnd}},tab:{defaultHandler:function(e){return t._doTab(u(e,{}))},actionDescription:{name:e.tab}},shiftTab:{defaultHandler:function(e){return t._doShiftTab(u(e,{}))},actionDescription:{name:e.shiftTab}},enter:{defaultHandler:function(e){return t._doEnter(u(e,{}))},actionDescription:{name:e.enter}},enterNoCursor:{defaultHandler:function(e){return t._doEnter(u(e,{noCursor:!0}))},actionDescription:{name:e.enterNoCursor}},escape:{defaultHandler:function(e){return t._doEscape(u(e,{}))},actionDescription:{name:e.escape}},selectAll:{defaultHandler:function(e){return t._doSelectAll(u(e,{}))},actionDescription:{name:e.selectAll}},copy:{defaultHandler:function(e){return t._doCopy(u(e,{}))},actionDescription:{name:e.copy}},cut:{defaultHandler:function(e){return t._doCut(u(e,{}))},actionDescription:{name:e.cut}},paste:{defaultHandler:function(e){return t._doPaste(u(e,{}))},actionDescription:{name:e.paste}},uppercase:{defaultHandler:function(e){return t._doCase(u(e,{type:"upper"}))},actionDescription:{name:e.uppercase}},lowercase:{defaultHandler:function(e){return t._doCase(u(e,{type:"lower"}))},actionDescription:{name:e.lowercase}},capitalize:{defaultHandler:function(e){return t._doCase(u(e,{unit:"word",type:"capitalize"}))},actionDescription:{name:e.capitalize}},reversecase:{defaultHandler:function(e){return t._doCase(u(e,{type:"reverse"}))},actionDescription:{name:e.reversecase}},toggleOverwriteMode:{defaultHandler:function(e){return t._doOverwriteMode(u(e,{}))},actionDescription:{name:e.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(e){return t._doTabMode(u(e,{}))},actionDescription:{name:e.toggleTabMode}},toggleWrapMode:{defaultHandler:function(e){return t._doWrapMode(u(e,{}))},actionDescription:{name:e.toggleWrapMode}}}},_createRulerParent:function(e,t){var i=s.createElement(e,"div");return i.className=t,i.tabIndex=-1,i.style.overflow="hidden",i.style.MozUserSelect="none",i.style.WebkitUserSelect="none",i.style.position="absolute",i.style.top="0px",i.style.bottom="0px",i.style.cursor="default",i.style.display="none",i.setAttribute("aria-hidden","true"),this._rootDiv.appendChild(i),i},_createRuler:function(e,t){if(this._clientDiv){var i=this._getRulerParent(e);if(i){(i!==this._marginDiv||this._marginOffset)&&(i.style.display="block"),i.rulerWidth=void 0;var n=s.createElement(i.ownerDocument,"div");if(n._ruler=e,e.node=n,n.rulerChanged=!0,n.style.position="relative",n.style.cssFloat="left",n.style.styleFloat="left",n.style.outline="none",void 0===t||0>t||t>=i.children.length)i.appendChild(n);else{for(var o=i.firstChild;o&&t-->0;)o=o.nextSibling;i.insertBefore(n,o)}}}},_createSelectionDiv:function(){var e=s.createElement(this._parent.ownerDocument,"div");return e.className="textviewSelection",e.style.position="absolute",e.style.borderWidth="0px",e.style.margin="0px",e.style.padding="0px",e.style.outline="none",e.style.width="0px",e.style.height="0px",e.style.zIndex="0",e},_createView:function(){function e(){x._rootDiv&&(x.update(!0),x._metrics.invalid&&x._getWindow().setTimeout(function(){e()},100))}if(!this._clientDiv){for(var t=this._parent;t.hasChildNodes();)t.removeChild(t.lastChild);var i=t.ownerDocument,n=s.createElement(i,"div");this._rootDiv=n,n.tabIndex=-1,n.style.position="relative",n.style.overflow="hidden",n.style.width="100%",n.style.height="100%",n.style.overflow="hidden",n.style.WebkitTextSizeAdjust="100%",n.setAttribute("role","application"),t.appendChild(n);var o=this._createRulerParent(i,"textviewLeftRuler");this._leftDiv=o;var r=s.createElement(i,"div");r.className="textviewScroll",this._viewDiv=r,r.tabIndex=-1,r.style.position="absolute",r.style.top="0px",r.style.bottom="0px",r.style.borderWidth="0px",r.style.margin="0px",r.style.outline="none",r.style.background="transparent",n.appendChild(r);var a=this._createRulerParent(i,"textviewRightRuler");this._rightDiv=a,"rtl"==document.dir?a.style.left="0px":a.style.right="0px";var l=this._createRulerParent(i,"textviewInnerRightRuler");this._innerRightDiv=l,l.style.zIndex="1";var d=s.createElement(i,"div");this._scrollDiv=d,d.style.margin="0px",d.style.borderWidth="0px",d.style.padding="0px",r.appendChild(d);var h=this._marginDiv=this._createRulerParent(i,"textviewMarginRuler");if(h.style.zIndex="4",!s.isIE&&!s.isIOS){var c=s.createElement(i,"div");this._clipDiv=c,c.style.position="absolute",c.style.overflow="hidden",c.style.margin="0px",c.style.borderWidth="0px",c.style.padding="0px",c.style.background="transparent",n.appendChild(c);var u=s.createElement(i,"div");this._clipScrollDiv=u,u.style.position="absolute",u.style.height="1px",u.style.top="-1000px",u.style.background="transparent",c.appendChild(u)}var p=s.createElement(i,"div");if(p.className="textviewContent",this._clientDiv=p,p.tabIndex=0,p.style.position="absolute",p.style.borderWidth="0px",p.style.margin="0px",p.style.padding="0px",p.style.outline="none",p.style.zIndex="1",p.style.WebkitUserSelect="text",p.setAttribute("spellcheck","false"),(s.isIOS||s.isAndroid)&&(p.style.WebkitTapHighlightColor="transparent"),(this._clipDiv||n).appendChild(p),this._setFullSelection(this._fullSelection,!0),s.isIOS||s.isAndroid){var f=s.createElement(i,"div");this._vScrollDiv=f,f.style.position="absolute",f.style.borderWidth="1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.width="8px",f.style.display="none",n.appendChild(f);var g=s.createElement(i,"div");this._hScrollDiv=g,g.style.position="absolute",g.style.borderWidth="1px",g.style.borderColor="white",g.style.borderStyle="solid",g.style.borderRadius="4px",g.style.backgroundColor="black",g.style.opacity="0.5",g.style.margin="0px",g.style.padding="0px",g.style.outline="none",g.style.zIndex="3",g.style.height="8px",g.style.display="none",n.appendChild(g)}if(s.isFirefox&&!p.setCapture){var _=s.createElement(i,"div");this._overlayDiv=_,_.style.position=p.style.position,_.style.borderWidth=p.style.borderWidth,_.style.margin=p.style.margin,_.style.padding=p.style.padding,_.style.cursor="text",_.style.zIndex="2",(this._clipDiv||n).appendChild(_)}p.contentEditable="true",p.setAttribute("role","textbox"),p.setAttribute("aria-multiline","true"),this._setWrapMode(this._wrapMode,!0),this._setReadOnly(this._readonly),this._setThemeClass(this._themeClass,!0),this._setTabSize(this._tabSize,!0),this._setMarginOffset(this._marginOffset,!0),this._hookEvents();for(var m=this._rulers,y=0;ythis._getLineHeight()){var i=t.getBoundingClientRect(),n=this._clientDiv.getBoundingClientRect();i.bottom>n.bottom&&(t=this._getLinePrevious(t)||t)}return t.lineIndex},_getBlockSelections:function(e,t,i){var n=this._model;e=e.filter(function(e){return!e._editing});var o,r=n.getLineAtOffset(this._blockSelection.getAnchor());t>r?o=t:(o=r,r=t);for(var s=r;o>=s;s++){var a=this._getLine(s),l=a.getOffset(i.x,1),d=a.getOffset(this._blockSelection._docX,1);if(a.destroy(),l!==d||l!==n.getLineEnd(s)){var h=d>l,c=new y(h?l:d,h?d:l,h);c._editing=!0,e.push(c)}}return e},_getBoundsAtOffset:function(e){var t=this._model,i=this._getLine(t.getLineAtOffset(e)),n=i.getBoundingClientRect(e),o=this._getLinePixel(i.lineIndex);return n.top+=o,n.bottom+=o,i.destroy(),n},_getClientHeight:function(){var e=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-e.top-e.bottom)},_getInnerRightWidth:function(){var e=this._innerRightDiv.rulerWidth;if(void 0===e){var t=this._innerRightDiv.getBoundingClientRect();this._innerRightDiv.rulerWidth=e=t.right-t.left}return e},_getClientWidth:function(){var e=this._getViewPadding(),t=this._getInnerRightWidth();return Math.max(0,this._viewDiv.clientWidth-e.left-e.right-t)},_getClipboardText:function(e,t){function i(e){var i=[];return f(e,function(e){i.push(e)},null),t&&t(i),i}var n=this._getWindow(),o=n.clipboardData;if(!o&&e&&(o=e.clipboardData),o)return i(o.getData(s.isIE?"Text":"text/plain"));if(s.isFirefox){this._ignoreFocus=!0;var r=this._clipboardDiv,a=this._rootDiv.ownerDocument;r||(r=s.createElement(a,"div"),this._clipboardDiv=r,r.style.position="fixed",r.style.whiteSpace="pre",r.style.left="-1000px",this._rootDiv.appendChild(r)),r.innerHTML="",r.firstChild.focus();var l=this,d=function(){var e=l._getTextFromElement(r);return r.innerHTML="",i(e)},h=!1;if(this._ignorePaste=!0,!s.isLinux||2!==this._lastMouseButton)try{h=a.execCommand("paste",!1,null)}catch(c){h=r.childNodes.length>1||r.firstChild&&r.firstChild.childNodes.length>0}return this._ignorePaste=!1,h?(this.focus(),this._ignoreFocus=!1,d()):e?(n.setTimeout(function(){l.focus(),d(),l._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"")}return""},_getDOMText:function(e,t){return e._line.getText(t)},_getTextFromElement:function(e){var t=e.ownerDocument,i=t.defaultView;if(!i.getSelection)return e.innerText||e.textContent;var n=t.createRange();n.selectNode(e);var o,r=i.getSelection(),s=[];for(o=0;oi)for(t=i;e>t;t++)n+=this._getLineHeight(t);else for(t=i-1;t>=e;t--)n-=this._getLineHeight(t);return n}var o=this._getLineHeight();return o*e},_getLineIndex:function(e,t){var i,n=0,o=this._model.getLineCount();if(this._lineHeight){n=this._getTopIndex();var r=-this._topIndexY+this._getScroll().y;if(e!==r)if(r>e)for(;r>e&&n>0;)e+=this._getLineHeight(--n);else for(i=this._getLineHeight(n);e-i>=r&&o-1>n;)e-=i,i=this._getLineHeight(++n)}else i=this._getLineHeight(),n=Math.floor(e/i);return t&&(0===o||0>n||n>o-1)?-1:Math.max(0,Math.min(o-1,n))},_getRulerParent:function(e){switch(e.getLocation()){case"left":return this._leftDiv;case"right":return this._rightDiv;case"innerRight":return this._innerRightDiv;case"margin":return this._marginDiv}return null},_getScroll:function(e){(void 0===e||e)&&this._cancelAnimation();var t=this._viewDiv;return{x:t.scrollLeft,y:t.scrollTop}},_getSelection:function(){return(Array.isArray(this._selection)?this._selection[0]:this._selection).clone()},_getSelections:function(){return(Array.isArray(this._selection)?this._selection:[this._selection]).map(function(e){return e.clone()})},_getTopIndex:function(e){var t=this._topChild;if(e&&this._getClientHeight()>this._getLineHeight()){var i=t.getBoundingClientRect(),n=this._getViewPadding(),o=this._viewDiv.getBoundingClientRect();i.top26?"wheel":s.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(t){return e._handleMouseWheel(t?t:l.event)}}),this._clipDiv&&t.push({target:this._clipDiv,type:s.isFirefox>26?"wheel":s.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(t){return e._handleMouseWheel(t?t:l.event)
-}}),s.isFirefox&&(!s.isWindows||s.isFirefox>=15)){var h=l.MutationObserver||l.MozMutationObserver;h?(this._mutationObserver=new h(function(t){e._handleDataModified(t)}),this._mutationObserver.observe(i,{subtree:!0,characterData:!0})):t.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(t){return e._handleDataModified(t?t:l.event)}})}(s.isFirefox&&(!s.isWindows||s.isFirefox>=15)||s.isIE||s.isWebkit)&&(t.push({target:this._clientDiv,type:"compositionstart",handler:function(t){return e._handleCompositionStart(t?t:l.event)}}),t.push({target:this._clientDiv,type:"compositionend",handler:function(t){return e._handleCompositionEnd(t?t:l.event)}}),t.push({target:this._clientDiv,type:"compositionupdate",handler:function(t){return e._handleCompositionUpdate(t?t:l.event)}})),this._overlayDiv&&(t.push({target:this._overlayDiv,type:"mousedown",handler:function(t){return e._handleMouseDown(t?t:l.event)}}),t.push({target:this._overlayDiv,type:"mouseover",handler:function(t){return e._handleMouseOver(t?t:l.event)}}),t.push({target:this._overlayDiv,type:"mouseout",handler:function(t){return e._handleMouseOut(t?t:l.event)}}),t.push({target:this._overlayDiv,type:"contextmenu",handler:function(t){return e._handleContextMenu(t?t:l.event)}})),this._isW3CEvents||t.push({target:this._clientDiv,type:"dblclick",handler:function(t){return e._handleDblclick(t?t:l.event)}})}this._hookRulerEvents(this._leftDiv,t),this._hookRulerEvents(this._rightDiv,t),this._hookRulerEvents(this._innerRightDiv,t),this._hookRulerEvents(this._marginDiv,t);for(var c=0;c26?"wheel":s.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(e){return i._handleMouseWheel(e?e:n.event)}}),t.push({target:e,type:"click",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"dblclick",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"mousemove",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"mouseover",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"mouseout",handler:function(e){i._handleRulerEvent(e?e:n.event)}})}},_getWindow:function(){return l(this._parent.ownerDocument)},_ignoreEvent:function(e){for(var t=e.target;t&&t!==this._clientDiv;){if(t.ignore)return!0;t=t.parentNode}return!1},_init:function(e){var i=e.parent;if("string"==typeof i&&(i=(e.document||document).getElementById(i)),!i)throw new Error("no parent");e.parent=i,e.model=e.model||new t.TextModel;var n=this._defaultOptions();for(var o in n)if(n.hasOwnProperty(o)){var r;r=void 0!==e[o]?e[o]:n[o].value,this["_"+o]=r}this._keyModes=[],this._rulers=[],this._selection=[new y(0,0,!1)],this._linksVisible=!1,this._redrawCount=0,this._maxLineWidth=0,this._maxLineIndex=-1,this._ignoreSelect=!0,this._ignoreFocus=!1,this._hasFocus=!1,this._dragOffset=-1,this._isRangeRects=(!s.isIE||s.isIE>=9)&&"function"==typeof i.ownerDocument.createRange().getBoundingClientRect,this._isW3CEvents=i.addEventListener,this._autoScrollX=null,this._autoScrollY=null,this._autoScrollTimerID=null,this._AUTO_SCROLL_RATE=50,this._grabControl=null,this._moseMoveClosure=null,this._mouseUpClosure=null,this._lastMouseX=0,this._lastMouseY=0,this._lastMouseTime=0,this._clickCount=0,this._clickTime=250,this._clickDist=5,this._isMouseDown=!1,this._doubleClickSelection=null,this._hScroll=0,this._vScroll=0,this._imeOffset=-1,this._createActions(),this._createView()},_checkOverlayScroll:function(){if(s.isMac&&s.isWebkit&&!this._metrics.invalid&&0===this._metrics.scrollWidth){var e=this._viewDiv,t=this._isOverOverlayScroll();e.style.pointerEvents=t.vertical||t.horizontal?"":"none"}},_isOverOverlayScroll:function(){var e=(new Date).getTime()-this._lastScrollTime<200;if(!e)return{};var t=this._viewDiv.getBoundingClientRect(),i=this._lastMouseMoveX,n=this._lastMouseMoveY,o=15;return{vertical:t.top<=n&&n1&&this.setRedraw(!1);var s=this._compoundChange;s?y.compare(this._getSelections(),s.owner.selection)||(this._endUndo(),e.selection.length>1&&this._startUndo()):e.selection.length>1&&this._startUndo();var a=this._model;try{e._ignoreDOMSelection&&(this._ignoreDOMSelection=!0);var l=0,d=0;e.selection.forEach(function(i){i.start+=l,i.end+=l;var n=Array.isArray(e.text)?e.text[d]:e.text;a.setText(n,i.start,i.end),l+=i.start-i.end+n.length,i.setCaret(t?i.start+n.length:i.start),d++})}finally{e._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}return this._setSelection(e.selection,i,!0,n),s=this._compoundChange,s&&(s.owner.selection=e.selection),e.selection.length>1&&this.setRedraw(!0),this.onModify({type:"Modify"}),!0},_onModelChanged:function(e){e.type="ModelChanged",this.onModelChanged(e),e.type="Changed";var t=e.start,i=e.addedCharCount,n=e.removedCharCount,o=e.addedLineCount,r=e.removedLineCount,s=this._getSelections();s.forEach(function(e){e.end>t&&(e.end>t&&e.start=l&&l+r>=c&&(l!==c||h.modelChangedEvent||h.lineRemoved?(h.lineRemoved=!0,h.lineChanged=!1,h.modelChangedEvent=null):(h.modelChangedEvent=e,h.lineChanged=!0)),c>l+r&&(h.lineIndex=c+o-r,h._line.lineIndex=h.lineIndex),h=this._getLineNext(h)}if(this._lineHeight){var u=[l,r].concat(d(o));Array.prototype.splice.apply(this._lineHeight,u)}this._wrapMode||l<=this._maxLineIndex&&this._maxLineIndex<=l+r&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0),this._update()},_onModelChanging:function(e){e.type="ModelChanging",this.onModelChanging(e),e.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var e=this,t=this._getWindow();this._updateTimer=t.setTimeout(function(){e._updateTimer=null,e._update()},0)}},_rangesToSelections:function(e){var t=[],i=this._model.getCharCount();return e.forEach(function(e){var n;if(e instanceof y)n=e.clone();else{var o=e.start,r=e.end,s=o>r;if(s){var a=o;o=r,r=a}o=Math.max(0,Math.min(o,i)),r=Math.max(0,Math.min(r,i)),n=new y(o,r,s)}t.push(n)}),t},_resetLineHeight:function(e,t){if(this._wrapMode||this._variableLineHeight){if(void 0!==e&&void 0!==t)for(var i=e;t>i;i++)this._lineHeight[i]=void 0;else this._lineHeight=d(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var e=this._clientDiv;if(e)for(var t=e.firstChild;t;)t.lineWidth=void 0,t=t.nextSibling},_reset:function(){this._maxLineIndex=-1,this._maxLineWidth=0,this._topChild=null,this._bottomChild=null,this._topIndexY=0,this._variableLineHeight=!1,this._resetLineHeight(),this._setSelection(new y(0,0,!1),!1,!1),this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var e=this._clientDiv;if(e){for(var t=e.firstChild;t;)t.lineRemoved=!0,t=t.nextSibling;s.isFirefox<13&&this._fixCaret()}},_scrollViewAnimated:function(e,t,i){var n=this._getWindow();if(i&&this._scrollAnimation){var o=this;this._animation=new k({window:n,duration:this._scrollAnimation,curve:[t,0],onAnimate:function(e){var i=t-Math.floor(e);o._scrollView(0,i),t-=i},onEnd:function(){o._animation=null,o._scrollView(e,t),i&&n.setTimeout(i,0)}}),this._animation.play()}else this._scrollView(e,t),i&&n.setTimeout(i,0)},_scrollView:function(e,t){this._ensureCaretVisible=!1;var i=this._viewDiv;e&&(i.scrollLeft+=e),t&&(i.scrollTop+=t)},_setClipboardText:function(e,t){var i,n=this._getWindow(),o=n.clipboardData;if(!o&&t&&(o=t.clipboardData),o){i=[],f(e,function(e){i.push(e)},function(){i.push(s.platformDelimiter)});var r=o.setData(s.isIE?"Text":"text/plain",i.join(""));if(r||t&&(s.isFirefox>21||s.isWebkit))return!0;if(!t)return!1}var a=this._parent.ownerDocument,l=s.createElement(a,"pre");l.style.position="fixed",l.style.left="-1000px",f(e,function(e){l.appendChild(a.createTextNode(e))},function(){l.appendChild(s.createElement(a,"br"))}),l.appendChild(a.createTextNode(" ")),this._clientDiv.appendChild(l);var d=a.createRange();d.setStart(l.firstChild,0),d.setEndBefore(l.lastChild);var h=n.getSelection();h.rangeCount>0&&h.removeAllRanges(),h.addRange(d);var c=this,u=function(){l&&l.parentNode===c._clientDiv&&c._clientDiv.removeChild(l),c._updateDOMSelection()},p=!1;this._ignoreCopy=!0;try{p=a.execCommand("copy",!1,null)}catch(g){}return this._ignoreCopy=!1,!p&&t?(n.setTimeout(u,0),!1):(u(),!0)},_setGrab:function(e){e!==this._grabControl&&(e?(e.setCapture&&e.setCapture(),this._grabControl=e):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null))},_setLinksVisible:function(e){if(this._linksVisible!==e){this._linksVisible=e,s.isIE&&e&&(this._hadFocus=this._hasFocus);var t=this._clientDiv;t.contentEditable=!e,this._hadFocus&&!e&&t.focus(),this._overlayDiv&&(this._overlayDiv.style.zIndex=e?"-1":"1");for(var i=this._getLineNext();i;)i._line.updateLinks(),i=this._getLineNext(i);this._updateDOMSelection()}},_setSelection:function(e,t,i,n,o,r,s){if(e){void 0===i&&(i=!0);var a,l=this._getSelections();if(a=Array.isArray(e)?e:r?l.concat([e]):[e],this._selection=y.merge(a),s||a.forEach(function(e){e._columnX=-1}),t!==!1&&this._showCaret(!1,n,t,o),i&&this._updateDOMSelection(),!y.compare(l,a)){var d={type:"Selection",oldValue:y.convert(l),newValue:y.convert(a)};this.onSelection(d)}}},_setSelectionTo:function(e,t,i,n,o,r){var s=this._model,a=this._getSelections(),l=this.convert({x:e,y:t},"page","document"),d=this._getLineIndex(l.y),h=this._getLine(d),c=h.getOffset(l.x,l.y-this._getLinePixel(d));if(r&&!n&&y.contains(a,c))return this._dragOffset=c,h.destroy(),!1;if(this._blockSelection)a=this._getBlockSelections(a,d,l);else{var u;if(i?n?(u=a[a.length-1],u._editing=!0):(u=new y(0,0),u._editing=!0,o?a.push(u):a=[u],u._docX=l.x):u=y.editing(a),1===this._clickCount)u.extend(c),n||u.collapse();else{var p,f,g=0===(1&this._clickCount);if(g)this._doubleClickSelection?c>=this._doubleClickSelection.start?(p=this._doubleClickSelection.start,f=h.getNextOffset(c,{unit:"wordend",count:1})):(p=h.getNextOffset(c,{unit:"word",count:-1}),f=this._doubleClickSelection.end):(p=h.getNextOffset(c,{unit:"word",count:-1}),f=h.getNextOffset(p,{unit:"wordend",count:1}));else if(this._doubleClickSelection){var _=s.getLineAtOffset(this._doubleClickSelection.start);d>=_?(p=s.getLineStart(_),f=s.getLineEnd(d)):(p=s.getLineStart(d),f=s.getLineEnd(_))}else p=s.getLineStart(d),f=s.getLineEnd(d);u.setCaret(p),u.extend(f)}}return this._setSelection(a,!0,!0,null,!1),h.destroy(),!0},_setFullSelection:function(e,t){this._fullSelection=e,s.isWebkit<537.36&&(this._fullSelection=e=!0),this._domSelection||(this._domSelection=[],this._cursorVisible=!0),t||this._updateDOMSelection()},_setBlockCursor:function(e){this._blockCursorVisible=e,this._updateBlockCursorVisible()},_setOverwriteMode:function(e){this._overwriteMode=e,this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var e=this._viewDiv,t=s.createElement(e.ownerDocument,"div");t.className="textviewBlockCursor",this._cursorDiv=t,t.tabIndex=-1,t.style.zIndex="2",t.style.color="transparent",t.style.position="absolute",t.style.pointerEvents="none",t.innerHTML=" ",e.appendChild(t),this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(e,t){this._marginOffset=e,this._marginDiv.style.display=e?"block":"none",t||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(e,t){this._wrapOffset=e,t||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(e){this._readonly=e,this._clientDiv.setAttribute("aria-readonly",e?"true":"false")},_setSingleMode:function(e,t){this._singleMode=e,this._updateOverflow(),this._updateStyle(t)},_setNoScroll:function(e,t){this._noScroll=e,this._updateOverflow(),this._updateStyle(t)},_setTabSize:function(e,t){this._tabSize=e,this._customTabSize=void 0;var i=this._clientDiv;s.isOpera?i&&(i.style.OTabSize=this._tabSize+""):s.isWebkit>=537.1?i&&(i.style.tabSize=this._tabSize+""):s.isFirefox>=4?i&&(i.style.MozTabSize=this._tabSize+""):8!==this._tabSize&&(this._customTabSize=this._tabSize),t||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(e){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged),this._theme=e,this._theme&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged),this._setThemeClass(this._themeClass)},_setThemeClass:function(e,t){this._themeClass=e;var i="textview",n=this._theme.getThemeClass();n&&(i+=" "+n),this._themeClass&&n!==this._themeClass&&(i+=" "+this._themeClass),this._rootDiv.className=i,this._updateStyle(t)},_setUndoStack:function(e){this._undoStack=e},_setWrapMode:function(e,t){this._wrapMode=e&&this._wrappable;var i=this._clientDiv;this._wrapMode?(i.style.whiteSpace="pre-wrap",i.style.wordWrap="break-word"):(i.style.whiteSpace="pre",i.style.wordWrap="normal"),this._updateOverflow(),t||(this.redraw(),this._resetLineWidth()),this._resetLineHeight()},_showCaret:function(e,t,i,n){if(this._clientDiv&&!(this._redrawCount>0||this._ignoreDOMSelection||-1!==this._imeOffset)){var o=this._model,r=this._getSelections(),s=y.editing(r,"down"===this._autoScrollDir),a=this._getScroll(),l=s.getCaret(),d=s.start,h=s.end,c=o.getLineAtOffset(d),u=o.getLineAtOffset(h),p=Math.max(Math.max(d,o.getLineStart(u)),h-1),f=this._getClientWidth(),g=this._getClientHeight(),_=f/4,m=this._getBoundsAtOffset(l===d?d:p),v=m.left,x=m.right,b=m.top,C=m.bottom,w=0,T="object"==typeof i;!e&&!T||s.isEmpty()||(m=this._getBoundsAtOffset(l===h?d:p),w=(m.bottom>C?m.bottom:C)-(m.topa.x+f&&(L=Math.max(x-a.x-f,_));var k=0;ba.y+g&&(k=C-a.y-g),n&&(n>0?k>0&&(k=Math.max(k,n)):0>k&&(k=Math.min(k,n)));var D=T&&"always"===i.scrollPolicy;if(0!==L||0!==k||D){if(T){var A=k>0;0===k&&(k=b-a.y);var S=i.viewAnchor,E=i.selectionAnchor,O=Math.min(Math.max(0,i.viewAnchorOffset||0));k+=Math.floor("top"===S?A?(1-O)*g:-O*g:"bottom"===S?A?O*g:-(1-O)*g:"center"===S?A?g/2+O*g:g/2-(1-O)*g:A?O*g:-O*g),c!==u&&("top"===E&&l!==d?k+=Math.floor(-w):"bottom"===E&&l!==h?k+=Math.floor(w):"center"===E&&(k+=Math.floor(w/2)))}else 0!==k&&"number"==typeof i&&(0>i&&(i=0),i>1&&(i=1),k+=Math.floor(k>0?i*g:-i*g));return this._scrollViewAnimated(L,k,t),g!==this._getClientHeight()||f!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0}return t&&t(),!1}},_startIME:function(){if(-1===this._imeOffset){for(var e=!1,t=this._getSelections(),i=0;i0)&&!this._ignoreDOMSelection&&-1===this._imeOffset&&this._clientDiv){var e,t=this._getSelections(),i=this._domSelection;if(i.lengtht.length&&i.splice(t.length).forEach(function(e){e.destroy()});for(e=0;e1?this._cursorTimer||(this._cursorTimer=n.setInterval(function(){o._cursorVisible=!o._cursorVisible,o._domSelection.forEach(function(e){e.update()})},500)):this._cursorTimer&&(n.clearInterval(this._cursorTimer),this._cursorTimer=null)}},_update:function(e){if(!(this._redrawCount>0)){if(this._updateTimer){var t=this._getWindow();t.clearTimeout(this._updateTimer),this._updateTimer=null,e=!1}var i=this._clientDiv,n=this._viewDiv;if(i){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var o=this._model,r=this._getScroll(!1),a=this._getViewPadding(),l=o.getLineCount(),d=this._getLineHeight(),h=!1,c=!1,u=!1,p=this._metrics.scrollWidth;this._wrapMode&&(i.style.width=(this._metrics.wrapWidth||this._getClientWidth())+"px");var f,g,_,m,v,y,x,b,w,T,L,k=0,D=0;if(this._lineHeight){for(;l>D&&(L=this._getLineHeight(D),!(k+L>r.y));)k+=L,D++;f=D,g=Math.max(0,f-1),m=_=r.y-k,f>0&&(_+=this._getLineHeight(f-1))}else{var A=Math.max(0,r.y)/d;f=Math.floor(A),g=Math.max(0,f-1),_=Math.round((A-g)*d),m=Math.round((A-f)*d),T=l*d}this._topIndexY=m;var S=this._rootDiv,E=S.clientWidth,O=S.clientHeight;if(e){for(v=0,this._leftDiv&&(y=this._leftDiv.getBoundingClientRect(),v=y.right-y.left),x=this._getClientWidth(),b=this._getClientHeight(),w=x,this._wrapMode?this._metrics.wrapWidth&&(w=this._metrics.wrapWidth):w=Math.max(this._maxLineWidth,w);l>D;)L=this._getLineHeight(D,!1),k+=L,D++;T=k}else{b=this._getClientHeight();for(var N,M,I=Math.floor((b+m)/d),B=Math.min(f+I,l-1),R=Math.min(B+1,l-1),F=i.firstChild;F;){N=F.lineIndex;var P=F.nextSibling;N>=g&&R>=N&&!F.lineRemoved&&-1!==F.lineIndex||(this._mouseWheelLine===F?(F.style.display="none",F.lineIndex=-1):i.removeChild(F)),F=P}F=this._getLineNext();var W=n.ownerDocument,V=W.createDocumentFragment();for(N=g;R>=N;N++)!F||F.lineIndex>N?new C(this,N).create(V,null):(V.firstChild&&(i.insertBefore(V,F),V=W.createDocumentFragment()),F&&F.lineChanged&&(F=new C(this,N).create(V,F),F.lineChanged=!1),F=this._getLineNext(F));V.firstChild&&i.insertBefore(V,F),s.isWebkit&&!this._wrapMode&&(i.style.width="0x7fffffffpx");var H;F=this._getLineNext();for(var U=b+_,j=!1;F;){if(M=F.lineWidth,void 0===M){H=F._line.getBoundingClientRect(),M=F.lineWidth=Math.ceil(H.right-H.left);var K=H.bottom-H.top;this._lineHeight?this._lineHeight[F.lineIndex]=K:0!==d&&0!==K&&Math.ceil(d)!==Math.ceil(K)&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[F.lineIndex]=K)}this._lineHeight&&!j&&(U-=this._lineHeight[F.lineIndex],0>U&&(B=F.lineIndex,j=!0)),this._wrapMode||(M>=this._maxLineWidth&&(this._maxLineWidth=M,this._maxLineIndex=F.lineIndex),this._checkMaxLineIndex===F.lineIndex&&(this._checkMaxLineIndex=-1)),F.lineIndex===f&&(this._topChild=F),F.lineIndex===B&&(this._bottomChild=F),F=this._getLineNext(F)}if(-1!==this._checkMaxLineIndex&&(N=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,N>=0&&l>N)){var $=new C(this,N);H=$.getBoundingClientRect(),M=H.right-H.left,M>=this._maxLineWidth&&(this._maxLineWidth=M,this._maxLineIndex=N),$.destroy()}for(;l>D;)L=this._getLineHeight(D,B>=D),k+=L,D++;T=k,this._updateRuler(this._leftDiv,f,R,O),this._updateRuler(this._rightDiv,f,R,O),this._updateRuler(this._innerRightDiv,f,R,O),this._updateRuler(this._marginDiv,f,R,O),v=0,this._leftDiv&&(y=this._leftDiv.getBoundingClientRect(),v=y.right-y.left);var z=0;if(this._rightDiv){var G=this._rightDiv.getBoundingClientRect();z=G.right-G.left}n.style.left=v+"px",n.style.right=z+"px";var Y=this._scrollDiv;if(Y.style.height=T+(s.isWebkit?0:a.bottom)+"px",x=this._getClientWidth(),!this._singleMode&&!this._wrapMode&&!this._noScroll){var X=b,q=b,Q="scroll"===n.style.overflowX;Q?X+=p:q-=p;var J=x,Z=x,et="scroll"===n.style.overflowY;et?J+=p:Z-=p,b=X,x=J,T>b&&(u=!0,x=Z),this._maxLineWidth>x&&(c=!0,b=q,T>b&&(u=!0,x=Z)),Q!==c&&(n.style.overflowX=c?"scroll":"hidden"),et!==u&&(n.style.overflowY=u?"scroll":"hidden"),h=Q!==c||et!==u}var tt=x;this._wrapMode?this._metrics.wrapWidth&&(tt=this._metrics.wrapWidth):tt=Math.max(this._maxLineWidth+this._getInnerRightWidth(),tt),w=tt,(!s.isIE||s.isIE>=9)&&this._maxLineWidth>x&&(tt+=a.right+a.left),Y.style.width=tt+"px",this._clipScrollDiv&&(this._clipScrollDiv.style.width=tt+"px"),r=this._getScroll(!1);var it=this._innerRightDiv;it&&(it.style.right=z+("scroll"===n.style.overflowY?this._metrics.scrollWidth:0)+"px",it.style.bottom=("scroll"===n.style.overflowX?p:0)+"px")}if(this._scrollHeight=T,this._vScrollDiv){var nt=b-8,ot=Math.max(15,Math.ceil(Math.min(1,nt/(T+a.top+a.bottom))*nt));this._vScrollDiv.style.left=v+x-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,r.y*nt/T))+"px",this._vScrollDiv.style.height=ot+"px"}if(!this._wrapMode&&this._hScrollDiv){var rt=x-8,st=Math.max(15,Math.ceil(Math.min(1,rt/(this._maxLineWidth+a.left+a.right))*rt));this._hScrollDiv.style.left=v+Math.floor(Math.max(0,Math.floor(r.x*rt/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=b-9+"px",this._hScrollDiv.style.width=st+"px"}var at,lt,dt=r.x,ht=this._clipDiv,ct=this._overlayDiv,ut=this._marginDiv;if(ut&&(ut.style.left=-dt+v+this._metrics.marginWidth+a.left+"px",ut.style.bottom=("scroll"===n.style.overflowX?p:0)+"px"),ht){ht.scrollLeft=dt,ht.scrollTop=0,at=v+a.left,lt=a.top;var pt=x,ft=b,gt=0,_t=-_;0===r.x&&(at-=a.left,pt+=a.left,gt=a.left),r.x+x===w&&(pt+=a.right),0===r.y&&(lt-=a.top,ft+=a.top,_t+=a.top),r.y+b===T&&(ft+=a.bottom),ht.style.left=at+"px",ht.style.top=lt+"px",ht.style.right=E-pt-at+"px",ht.style.bottom=O-ft-lt+"px",i.style.left=gt+"px",i.style.top=_t+"px",i.style.width=w+"px",i.style.height=b+_+"px",ct&&(ct.style.left=i.style.left,ct.style.top=i.style.top,ct.style.width=i.style.width,ct.style.height=i.style.height)}else{at=dt,lt=_;var mt=dt+x,vt=_+b;0===at&&(at-=a.left),0===lt&&(lt-=a.top),mt===w&&(mt+=a.right),r.y+b===T&&(vt+=a.bottom),i.style.clip="rect("+lt+"px,"+mt+"px,"+vt+"px,"+at+"px)","rtl"==document.dir?i.style.right=-dt+v+a.left+"px":i.style.left=-dt+v+a.left+"px",i.style.width=(this._wrapMode||s.isWebkit?w:x+dt)+"px",e||(i.style.top=-_+a.top+"px",i.style.height=b+_+"px"),ct&&(ct.style.clip=i.style.clip,ct.style.left=i.style.left,ct.style.width=i.style.width,e||(ct.style.top=i.style.top,ct.style.height=i.style.height))}if(this._updateDOMSelection(),h){var yt=this._ensureCaretVisible;this._ensureCaretVisible=!1,yt&&this._showCaret(),this._queueUpdate()}}}},_updateOverflow:function(){var e=this._viewDiv;this._noScroll?e.style.overflow="hidden":this._wrapMode?(e.style.overflowX="hidden",e.style.overflowY="scroll"):e.style.overflow="hidden"},_updateRuler:function(e,t,i,n){if(e)for(var o=this._parent.ownerDocument,r=this._getLineHeight(),a=this._getViewPadding(),l=e.firstChild;l;){var d=l._ruler,c=d.getOverview();if(l.rulerChanged&&(h(d.getRulerStyle(),l),e.rulerWidth=void 0),"fixed"!==c){var u=r;"page"===c&&(u+=this._topIndexY),l.style.top=-u+"px",l.style.height=n+u+"px";var p,f=l.firstChild;f?(p=f,f=f.nextSibling):(p=s.createElement(o,"div"),p.style.visibility="hidden",l.appendChild(p));var g,_;l.rulerChanged&&p&&(g=-1,_=d.getWidestAnnotation(),_&&(h(_.style,p),_.html&&(p.innerHTML=_.html)),p.lineIndex=g,p.style.height=r+a.top+"px");var m,v,y;if("page"===c){for(y=d.getAnnotations(t,i+1);f;){g=f.lineIndex;var x=f.nextSibling;g>=t&&i>=g&&!f.lineChanged||l.removeChild(f),f=x}for(f=l.firstChild.nextSibling,v=o.createDocumentFragment(),g=t;i>=g;g++)!f||f.lineIndex>g?(m=s.createElement(o,"div"),_=y[g],_&&(h(_.style,m),_.html&&(m.innerHTML=_.html),m.annotation=_),m.lineIndex=g,m.style.height=this._getLineHeight(g)+"px",v.appendChild(m)):(v.firstChild&&(l.insertBefore(v,f),v=o.createDocumentFragment()),f&&(f=f.nextSibling));v.firstChild&&l.insertBefore(v,f)}else{var b,C,w=this._getClientHeight(),T=this._model.getLineCount(),L=r*T,k=w+a.top+a.bottom-2*this._metrics.scrollWidth;if(k>L?(b=r,C=a.top):(b=k/T,C=this._metrics.scrollWidth),l.rulerChanged){for(var D=l.childNodes.length;D>1;)l.removeChild(l.lastChild),D--;y=d.getAnnotations(0,T),v=o.createDocumentFragment();for(var A in y)g=A>>>0,0>g||(m=s.createElement(o,"div"),_=y[A],h(_.style,m),m.style.position="absolute",m.style.top=C+r+Math.floor(g*b)+"px",_.html&&(m.innerHTML=_.html),m.annotation=_,m.lineIndex=g,v.appendChild(m));l.appendChild(v)}else if(l._oldTrackHeight!==k)for(m=l.firstChild?l.firstChild.nextSibling:null;m;)m.style.top=this._metrics.scrollWidth+r+Math.floor(m.lineIndex*b)+"px",m=m.nextSibling;l._oldTrackHeight=k}l.rulerChanged=!1,l=l.nextSibling}else l.rulerChanged=!1,l=l.nextSibling}},_updateStyleSheet:function(){var e="";if(s.isWebkit&&this._metrics.scrollWidth>0&&(e+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}"),e){var t=this._clientDiv.ownerDocument,i=t.getElementById("_textviewStyle");if(i)i.removeChild(i.firstChild),i.appendChild(t.createTextNode(e));else{i=s.createElement(t,"style"),i.id="_textviewStyle";var n=t.getElementsByTagName("head")[0]||t.documentElement;i.appendChild(t.createTextNode(e)),n.insertBefore(i,n.firstChild)}}},_updateStyle:function(e,t){if(!e&&s.isIE&&(this._rootDiv.style.lineHeight="normal"),t=this._metrics=t||this._calculateMetrics(),this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._rootDiv.style.lineHeight=s.isIE?t.lineHeight-(t.lineTrim.top+t.lineTrim.bottom)+"px":"normal",this._updateStyleSheet(),s.isMac&&s.isWebkit){var i=this._viewDiv;t.invalid||0!==t.scrollWidth?(i.style.pointerEvents="",i.style.zIndex=""):(i.style.pointerEvents="none",i.style.zIndex="2")}e||(this.redraw(),this._resetLineWidth())}},n.EventTarget.addMixin(w.prototype),{TextView:w}}),define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(e,t){function i(e){this._model=e,this._projections=[];var t=this;this._listener={onChanged:function(e){t._onChanged(e)},onChanging:function(e){t._onChanging(e)}},e.addEventListener("postChanged",this._listener.onChanged),e.addEventListener("preChanging",this._listener.onChanging)}return i.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(t){if(t){var i=this._model,n=this._projections;t._lineIndex=i.getLineAtOffset(t.start),t._lineCount=i.getLineAtOffset(t.end)-t._lineIndex;var o=t.text;o||(o=""),t._model="string"==typeof o?new e.TextModel(o,i.getLineDelimiter()):o;var r=this.mapOffset(t.start,!0),s=t.end-t.start,a=t._lineCount,l=t._model.getCharCount(),d=t._model.getLineCount()-1,h={type:"Changing",text:t._model.getText(),start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};this.onChanging(h);var c=this._binarySearch(n,t.start);n.splice(c,0,t);var u={type:"Changed",start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};this.onChanged(u)}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(e,t){var i,n,o=this._projections,r=0;if(t){for(i=0;ie));i++){if(n.end>e)return-1;r+=n._model.getCharCount()-(n.end-n.start)}return e+r}for(i=0;ie-r));i++){var s=n._model.getCharCount();if(n.start+s>e-r)return-1;r+=s-(n.end-n.start)}return e-r},removeProjection:function(e){this._removeProjection(e)},_removeProjection:function(e,t){var i,n=0;for(i=0;i1;)i=Math.floor((n+o)/2),t<=e[i].start?n=i:o=i;return n},getCharCount:function(){for(var e=this._model.getCharCount(),t=this._projections,i=0;ie)return null;var i,n,o,r=this._model,s=this._projections,a=0,l=[],d=0;for(i=0;i=e-a));i++){if(n=o._model.getLineCount()-1,o._lineIndex+n>=e-a){var h=e-(o._lineIndex+a);if(n>h)return o._model.getLine(h,t);l.push(o._model.getLine(n))}d=o.end,a+=n-o._lineCount}for(d=Math.max(d,r.getLineStart(e-a));ie-a));i++){if(l.push(r.getText(d,o.start)),n=o._model.getLineCount()-1,o._lineIndex+n>e-a)return l.push(o._model.getLine(0,t)),l.join("");l.push(o._model.getText()),d=o.end,a+=n-o._lineCount}var c=r.getLineEnd(e-a,t);return c>d&&l.push(r.getText(d,c)),l.join("")},getLineAtOffset:function(e){for(var t=this._model,i=this._projections,n=0,o=0,r=0;re-n)break;var a=s._model.getCharCount();if(s.start+a>e-n){var l=e-(s.start+n);o+=s._model.getLineAtOffset(l),n+=l;break}o+=s._model.getLineCount()-1-s._lineCount,n+=a-(s.end-s.start)}return t.getLineAtOffset(e-n)+o},getLineCount:function(){for(var e=this._model,t=this._projections,i=e.getLineCount(),n=0;ne)return-1;for(var i=this._model,n=this._projections,o=0,r=0,s=0;se-o)break;var l=a._model.getLineCount()-1;if(a._lineIndex+l>e-o){var d=e-(a._lineIndex+o);return a._model.getLineEnd(d,t)+a.start+r}r+=a._model.getCharCount()-(a.end-a.start),o+=l-a._lineCount}return i.getLineEnd(e-o,t)+r},getLineStart:function(e){if(0>e)return-1;for(var t=this._model,i=this._projections,n=0,o=0,r=0;r=e-n)break;var a=s._model.getLineCount()-1;if(s._lineIndex+a>=e-n){var l=e-(s._lineIndex+n);return s._model.getLineStart(l)+s.start+o}o+=s._model.getCharCount()-(s.end-s.start),n+=a-s._lineCount}return t.getLineStart(e-n)+o},getText:function(e,t){void 0===e&&(e=0);var i,n,o,r=this._model,s=this._projections,a=0,l=[];for(i=0;ie-a));i++){if(o=n._model.getCharCount(),n.start+o>e-a){if(void 0!==t&&n.start+o>t-a)return n._model.getText(e-(n.start+a),t-(n.start+a));l.push(n._model.getText(e-(n.start+a))),e=n.end+a+o-(n.end-n.start)}a+=o-(n.end-n.start)}var d=e-a;if(void 0!==t){for(;it-a));i++){if(l.push(r.getText(d,n.start)),o=n._model.getCharCount(),n.start+o>t-a)return l.push(n._model.getText(0,t-(n.start+a))),l.join("");l.push(n._model.getText()),d=n.end,a+=o-(n.end-n.start)}l.push(r.getText(d,t-a))}else{for(;in));e++);var s=e;for(e=0;e=o));e++);var a=e,l=this._model,d=i.baseText.length-(o-n);for(e=a;ee));a++){if(l.end>e)return-1;s+=l._model.getCharCount()-(l.end-l.start)}return e+s}var i=!!this._change,n=this._change||{},o=e.start,r=o+e.removedCharCount;if(n.baseStart=o,n.baseEnd=r,n.baseText=e.text,n.addedLineCount=e.addedLineCount,!i){this._change=n,n.text=e.text;var s,a,l,d=this._projections;n.start=t(o),-1===n.start&&(n.text=this._model.getText(l.start,o)+n.text,n.addedLineCount+=this._model.getLineAtOffset(o)-this._model.getLineAtOffset(l.start),n.start=l.start+s),n.end=t(r),-1===n.end&&(n.text+=this._model.getText(r,l.end),n.addedLineCount+=this._model.getLineAtOffset(l.end)-this._model.getLineAtOffset(r),n.end=l.start+s)}n.addedCharCount=n.text.length,n.removedCharCount=n.end-n.start,n.removedLineCount=this.getLineAtOffset(n.end)-this.getLineAtOffset(n.start);var h={type:"Changing",text:n.text,start:n.start,removedCharCount:n.removedCharCount,addedCharCount:n.addedCharCount,removedLineCount:n.removedLineCount,addedLineCount:n.addedLineCount};this.onChanging(h)},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},setLineDelimiter:function(e){this._model.setLineDelimiter(e)},setText:function(e,t,i){function n(e){for(r=0,o=0;re-o));r++){var t=s._model.getCharCount();if(s.start+t>e-o)return-1;o+=t-(s.end-s.start)}return e-o}this._change={text:e||"",start:t||0,end:void 0===i?this.getCharCount():i};var o,r,s,a,l,d=this._projections,h=n(this._change.start);-1===h&&(a={projection:s,start:this._change.start-(s.start+o)},h=s.end);var c=n(this._change.end);-1===c&&(l={projection:s,end:this._change.end-(s.start+o)},c=s.start),a&&l&&a.projection===l.projection?s._model.setText(this._change.text,a.start,l.end):(this._model.setText(this._change.text,h,c),a&&(s=a.projection,s._model.setText("",a.start)),l&&(s=l.projection,s._model.setText("",0,l.end),s.start=s.end,s._lineCount=0)),this._change=void 0}},t.EventTarget.addMixin(i.prototype),{ProjectionTextModel:i}}),define("orion/editor/tooltip",["i18n!orion/editor/nls/messages","orion/editor/textView","orion/editor/projectionTextModel","orion/Deferred","orion/editor/util","orion/webui/littlelib","orion/util"],function(e,t,i,n,o,r,s){function a(e,t){this._view=e,this._editor=t;var i=e.getOptions("parent");this._create(i?i.ownerDocument:document)}return a.getTooltip=function(e,t){return e._tooltip||(e._tooltip=new a(e,t)),e._tooltip},a.prototype={_create:function(e){if(!this._tooltipDiv){var t=this._tooltipDiv=s.createElement(e,"div");t.tabIndex=0,t.className="textviewTooltip",t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),this._tooltipDiv.style.visibility="hidden",this._tipShowing=!1,e.body.appendChild(t);var i=this;o.addEventListener(e,"mousedown",this._mouseDownHandler=function(e){i.isVisible()&&(o.contains(t,e.target||e.srcElement)||i._locked||i.hide())},!0),o.addEventListener(e,"scroll",this._scrollHandler=function(e){i.isVisible()&&(o.contains(t,e.target||e.srcElement)||(i._topPixel!==i._view.getTopPixel()||i._leftPixel!==i._view.getHorizontalPixel())&&i.hide())},!0),o.addEventListener(e,"mousemove",this._mouseMoveHandler=function(e){i._prevX&&i._prevX===e.clientX&&i._prevY&&i._prevY===e.clientY||(i._prevX=e.clientX,i._prevY=e.clientY,!i.isVisible()||i._locked||i._hasFocus()||i._isInRect(i._outerArea,e.clientX,e.clientY)||i.hide())},!0),o.addEventListener(t,"focus",function(){i._locked||i._tooltipDiv.classList.add("textViewTooltipOnFocus")},!1),o.addEventListener(t,"blur",function(){i._tooltipDiv.classList.remove("textViewTooltipOnFocus")},!1),o.addEventListener(t,"mouseenter",function(){i._locked||i._tooltipDiv.classList.add("textViewTooltipOnHover")},!1),o.addEventListener(t,"mouseleave",function(){i._hasFocus()||i._tooltipDiv.classList.remove("textViewTooltipOnHover")},!1),o.addEventListener(t,"keydown",function(e){27===e.keyCode&&(i._locked||i.hide())},!1),this._view.addEventListener("Destroy",function(){i.destroy()})}},destroy:function(){if(this._tooltipDiv){this.hide();var e=this._tooltipDiv.parentNode;e&&e.removeChild(this._tooltipDiv);var t=this._tooltipDiv.ownerDocument;o.removeEventListener(t,"mousedown",this._mouseDownHandler,!0),o.removeEventListener(t,"scroll",this._scrollHandler,!0),o.removeEventListener(t,"mousemove",this._mouseMoveHandler,!0),this._tooltipDiv=null}},show:function(e,t,i){this._locked=t,this._giveFocus=i,this._topPixel=this._view.getTopPixel(),this._leftPixel=this._view.getHorizontalPixel(),this._processInfo(e.getTooltipInfo())},update:function(e,t){e&&(t?this._showContents(null,e.getTooltipInfo(),!0):this._processInfo(e.getTooltipInfo(),!0))},onHover:function(e,t,i){e&&(this._isInRect(this._anchorArea,t,i)||this._isInRect(this._tooltipArea,t,i)||this._locked||this._hasFocus()||this._processInfo(e.getTooltipInfo()))},hide:function(e){e&&(this._locked=void 0),!this._locked&&this.isVisible()&&(this.hover&&this.hover.clearQuickFixes(),this._hasFocus()&&this._view.focus(),this._tooltipContents&&(this._tooltipDiv.removeChild(this._tooltipContents),this._tooltipContents=null),this._tooltipDiv.classList.remove("textviewTooltipCodeProjection"),this._tooltipDiv.classList.remove("textviewTooltipOnHover"),this._tooltipDiv.classList.remove("textviewTooltipOnFocus"),this._tooltipDiv.style.visibility="hidden",this._tipShowing=!1,this._tooltipDiv.style.left="",this._tooltipDiv.style.right="",this._tooltipDiv.style.top="",this._tooltipDiv.style.bottom="",this._tooltipDiv.style.width="auto",this._tooltipDiv.style.maxWidth="",this._tooltipDiv.style.height="auto",this._tooltipDiv.style.maxHeight="",this._tooltipDiv.style.overflowX="",this._tooltipDiv.style.overflowY="",this._giveFocus=void 0,this._anchorArea=void 0,this._tooltipArea=void 0,this._outerArea=void 0,this._hoverPromises&&this._hoverPromises.forEach(function(e){e.resolved||e.cancel()}),this._hoverPromises=void 0,this._tipRect=void 0)},isVisible:function(){return this._tipShowing},_processInfo:function(e,t){if(this._tooltipDiv){var i;if(t&&this._tooltipContents?(this._tooltipContents.innerHTML="",i=this._tooltipContents):i=s.createElement(this._tooltipDiv.ownerDocument,"div"),e){if(e.contents&&this._renderImmediateInfo(i,e.contents,e.context))return this._showContents(i,e,t),!0;if(this.hover&&e.context&&(this._hoverPromises=this.hover.computeHoverInfo(e.context),this._hoverPromises)){var o=this,r=this._hoverPromises.slice(0);return r.forEach(function(r){n.when(r,function(n){if(o._hoverPromises){var s=o._hoverPromises.indexOf(r);s>=0&&o._hoverPromises.splice(s,1)}n&&o._renderPluginContent(i,n)&&(n.offsetStart&&(e.context.offsetStart=n.offsetStart),n.offsetEnd&&(e.context.offsetEnd=n.offsetEnd),n.allowFullWidth&&(e.allowFullWidth=n.allowFullWidth),o._showContents(i,e,t))},function(e){console&&e&&"Cancel"!==e.name&&(console.log("Error computing hover tooltip"),console.log(e&&e.stack))})}),!0}}}},_showContents:function(e,t,i){i?this._tooltipArea&&t.tooltipArea&&(this._tooltipArea.left!==t.tooltipArea.left||this._tooltipArea.top!==t.tooltipArea.top||this._tooltipArea.width!==t.tooltipArea.width||this._tooltipArea.height!==t.tooltipArea.height)&&(this._anchorArea=null,this._tooltipArea=null,this._outerArea=null):this.hide(),e&&(this._tooltipContents&&this._tooltipDiv.removeChild(this._tooltipContents),this._tooltipContents=e,this._tooltipDiv.appendChild(e)),this._anchorArea||(this._anchorArea=this._computeAnchorArea(t)),this._tooltipArea||(this._tooltipArea=this._computeTooltipArea(t,this._anchorArea,this._tooltipDiv)),this._outerArea||(this._outerArea=this._computeOuterArea(this._anchorArea,this._tooltipArea)),this._tooltipDiv.style.visibility="visible",this._tipShowing=!0,this._giveFocus&&(this._setInitialFocus(this._tooltipDiv),this._giveFocus=void 0)},_computeAnchorArea:function(e){if(e.anchorArea&&e.anchorArea.top&&e.anchorArea.left&&e.anchorArea.height&&e.anchorArea.width)return e.anchorArea;if(e.context){if(e.context.offsetStart&&e.context.offsetEnd){var t=this.mapOffset(e.context.offsetStart,!1),i=this.mapOffset(e.context.offsetEnd,!1);return this._computeRectangleFromOffset(t,i)}if(e.context.offset>=0){var n=this.mapOffset(e.context.offset,!1),o=this._view.getNextOffset(n,{unit:"wordend",count:0}),r=this._view.getNextOffset(o,{unit:"word",count:-1});return this._computeRectangleFromOffset(r,o)}}return{top:0,left:0,height:0,width:0}},_computeTooltipArea:function(e,t,i){var n=i.ownerDocument.documentElement,o=16;if(e.tooltipArea&&e.tooltipArea.top&&e.tooltipArea.left&&e.tooltipArea.height&&e.tooltipArea.width)return i.style.overflowY="auto",i.style.resize="none",i.style.top=e.tooltipArea.top+"px",i.style.left=e.tooltipArea.left+"px",i.style.height=e.tooltipArea.height-o+"px",i.style.width=e.tooltipArea.width-o+"px",e.tooltipArea;var r=i.getBoundingClientRect(),s={width:r.width,height:r.height},a=i.getElementsByTagName("img")[0];a&&!a.complete&&0===a.width&&(s.width+=30);var l=e.position?e.position:"below",d=(this._view._rootDiv?this._view._rootDiv:n).getBoundingClientRect(),h=d.left,c=d.top,u=d.width,p=d.height,f=u,g=p;e.allowFullWidth?s.width>u&&(s.width=u):(f=Math.min(u/2,600),g=Math.min(p/2,400),s.width=Math.min(s.width,f),s.height=Math.min(s.height,g)),i.style.width=s.width-o+"px",s.height=Math.min(i.getBoundingClientRect().height,g),25+o>s.height&&s.width>f-o&&(s.height=40+o);var _=p-(t.top+t.height-c),m=t.top-c,v=u-(t.left+t.width-h);"above"===l&&s.height>m&&s.height<=_?l="below":"below"===l&&s.height>_&&s.height<=m&&(l="above");var y=e.tooltipOffsetX?e.tooltipOffsetX:0,x=e.tooltipOffsetY?e.tooltipOffsetY:0;switch(l){case"left":s.top=s.height+x>_+t.height?p+c-s.height:t.top+x,s.top=Math.max(s.top,c),s.left=Math.max(t.left-s.width+y,h);break;case"right":s.top=s.height+x>_+t.height?p+c-s.height:t.top+x,s.top=Math.max(s.top,c),s.left=Math.max(t.left+t.width+y,h);break;case"above":s.left=s.width+y>v+t.width?u+h-s.width:t.left+y,s.left=Math.max(s.left,h),s.top=Math.max(t.top-s.height+x,c);break;case"below":s.left=s.width+y>v+t.width?u+h-s.width:t.left+y,s.left=Math.max(s.left,h),s.top=Math.max(t.top+t.height+x,c)}return s.maxWidth=Math.min(u+h-s.left,u),s.maxHeight=Math.min(p+c-s.top,p),i.style.maxWidth=s.maxWidth-o+"px",i.style.maxHeight=s.maxHeight-o+"px",i.style.width=s.width-o+"px",i.style.height=s.height-o+"px",i.style.left=s.left+"px",i.style.top=s.top+"px",s},_computeOuterArea:function(e,t){var i=Math.min(e.left,t.left),n=Math.min(e.top,t.top),o=e.left+e.width,r=t.left+t.width,s=Math.max(o,r),a=e.top+e.height,l=t.top+t.height,d=Math.max(a,l);return{left:i,top:n,width:s-i,height:d-n}},_hasFocus:function(){var e=this._tooltipDiv;return e?o.contains(e,e.ownerDocument.activeElement):!1},_isNode:function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},_setInitialFocus:function(e){var t=r.$("button",e);if(t)return void t.focus();var i=r.$("a",e);if(i){i.focus();var n=this;return void i.addEventListener("click",function(){n.hide()})}var o=r.firstTabbable(e);o&&o.focus()},_isInRect:function(e,t,i){if(!e)return!1;var n=t>=e.left&&t<=e.left+e.width,o=i>=e.top&&i<=e.top+e.height;return n&&o},mapOffset:function(e){var t=this._view,i=t.getModel();return i.getBaseModel&&(e=i.mapOffset(e,!0)),e},_computeRectangleFromOffset:function(e,t){var i=this._view,n=i.getLineAtOffset(e),o=i.getLineAtOffset(t);n!==o&&(t=i.getModel().getLineEnd(n));var r=i.getLineHeight(n),s=i.getLocationAtOffset(e),a=i.getLocationAtOffset(t),l={x:s.x,y:s.y,width:a.x-s.x,height:r};return l=this._view.convert(l,"document","page"),{left:l.x,top:l.y,width:l.width,height:l.height}},_renderPluginContent:function(e,t){var i=this._tooltipDiv.ownerDocument;if("string"!=typeof t&&"undefined"==typeof t.content)return!1;var n=s.createElement(i,"div");if(t.title){var o=s.createElement(i,"div");this.hover.renderMarkDown?o.innerHTML=this.hover.renderMarkDown(t.title):o.textContent=t.title,o.classList.add("hoverTooltipTitle"),n.appendChild(o)}var r=s.createElement(i,"div");if("string"==typeof t)r.appendChild(i.createTextNode(t));else switch(t.type){case"delegatedUI":case"html":if(t.content){var a=i.createElement("iframe");a.id="HtmlHover",a.name="HTML Hover",a.type="text/html",a.sandbox="allow-scripts allow-same-origin allow-forms",a.style.border="none",a.style.width="100%",a.style.height="100%",this._tooltipDiv.style.paddingBottom="5px",a.srcdoc=t.content,t.width&&(a.style.width=t.width),t.height&&(a.style.height=t.height),n.style.height="100%",e.style.height="100%",n.appendChild(a)}break;case"markdown":this.hover.renderMarkDown&&(r.innerHTML=this.hover.renderMarkDown(t.content));break;default:r.appendChild(i.createTextNode(t.content))}return n.appendChild(r),e.appendChild(n),!0},_renderImmediateInfo:function(e,n,o){if(n instanceof Array&&(n=this._getAnnotationContents(n,o),!n))return!1;if("string"==typeof n)return e.textContent=n,!0;if(this._isNode(n))return e.appendChild(n),!0;if(n instanceof i.ProjectionTextModel){var r=this._view,s=r.getOptions();s.wrapMode=!1,s.parent=e;var a="tooltipTheme",l=s.themeClass;l?(l=l.replace(a,""),l&&(l=" "+l),l=a+l):l=a,s.themeClass=l;var d=this._contentsView=new t.TextView(s),h={onLineStyle:function(e){r.onLineStyle(e)}};d.addEventListener("LineStyle",h.onLineStyle),d.setModel(n),this._tooltipDiv.appendChild(e),this._tooltipDiv.classList.add("textviewTooltipCodeProjection");var c=d.computeSize();return e.style.width=c.width+8+"px",e.style.height=c.height+8+"px",d.resize(),this._tooltipDiv.removeChild(e),!0}return!1},_getAnnotationContents:function(t,n){function r(e,t,i){var r=e.title,l=s.createElement(p,"div");if(l.className="tooltipRow",e.html){var d=s.createElement(p,"div");d.className="tooltipImage",d.innerHTML=e.html,d.lastChild&&o.addEventListener(d.lastChild,"click",function(){var t=e.start,i=e.end;g.getBaseModel&&(t=g.mapOffset(t,!0),i=g.mapOffset(i,!0)),f.setSelection(t,i,1/3,function(){a.hide()})},!1),l.appendChild(d)}if(!r){var h=_.getLineStart(_.getLineAtOffset(e.start)),c=_.getLineEnd(_.getLineAtOffset(e.end),!0);r=_.getText(h,c)}if("function"==typeof r&&(r=e.title()),"string"==typeof r){var u=s.createElement(p,"span");u.className="tooltipTitle",u.appendChild(p.createTextNode(r)),r=u}return l.appendChild(r),i&&a.hover.renderQuickFixes(e,t,l),n&&(n.offsetStart=e.start,n.offsetEnd=e.end),l}var a=this,l=a.hover?!0:!1;l&&n&&n.source&&n.source.indexOf("ruler")>=0&&t.length>1&&(l=!1);for(var d,h=[],c=0;c0&&m.addProjection({start:0,end:v}),m}var x;if(t.length>0&&this._editor&&(x=this._editor.getAnnotationModel().getAnnotations()),1===t.length){if(u=r(t[0],x,l),u&&u.firstChild){var b=u.firstChild.className;b&&(b+=" "),b+="single",u.firstChild.className=b}return u}var C=s.createElement(p,"div"),w=s.createElement(p,"multi_anno");w.appendChild(p.createTextNode(e.multipleAnnotations)),C.appendChild(w);for(var T=0;Ti;i++){var o=arguments[i];for(var r in o)t.call(o,r)&&(e[r]=o[r])}return e}return{clone:function(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var i=Object.create(Object.getPrototypeOf(t));return e(i,t),i},mixin:e,toArray:function(e){return Array.isArray(e)?e:[e]}}}),define("orion/editor/editor",["i18n!orion/editor/nls/messages","orion/editor/eventTarget","orion/editor/tooltip","orion/editor/annotations","orion/objects","orion/util"],function(e,t,i,n,o,r){function s(e){e=e||{},this._domNode=e.domNode,this._model=e.model,this._undoStack=e.undoStack,this._statusReporter=e.statusReporter,this._title=null;var t=this;this._listener={onChanged:function(e){t.onChanged(e)}},this._model&&this._model.addEventListener("Changed",this._listener.onChanged),this.checkDirty()}function a(e){e=e||{},s.call(this,e),this._textViewFactory=e.textViewFactory,this._undoStackFactory=e.undoStackFactory,this._textDNDFactory=e.textDNDFactory,this._annotationFactory=e.annotationFactory,this._zoomRulerFactory=e.zoomRulerFactory,this._foldingRulerFactory=e.foldingRulerFactory,this._lineNumberRulerFactory=e.lineNumberRulerFactory,this._contentAssistFactory=e.contentAssistFactory,this._keyBindingFactory=e.keyBindingFactory,this._hoverFactory=e.hoverFactory,this._syntaxHighlighter=e.syntaxHighlighter,this._annotationStyler=null,this._annotationModel=null,this._annotationRuler=null,this._lineNumberRuler=null,this._overviewRuler=null,this._zoomRuler=null,this._foldingRuler=null,this._contentAssist=null}var l=n.AnnotationType,d="orion.annotation.highlightError";return s.prototype={destroy:function(){this.uninstall(),this._statusReporter=this._domNode=null,this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(e,t){return this.getModel().getText(e,t)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},install:function(){this.installed=!0},isDirty:function(){return this._undoStack?!this._undoStack.isClean():this._dirty},markClean:function(){this.getUndoStack().markClean(),this.setDirty(!1)},onDirtyChanged:function(e){return this.dispatchEvent(e)},onInputChanged:function(e){return this.dispatchEvent(e)},onChanged:function(){this.checkDirty()},reportStatus:function(e,t,i){this._statusReporter&&this._statusReporter(e,t,i)},resize:function(){},setDirty:function(e){this._dirty!==e&&(this._dirty=e,this.onDirtyChanged({type:"DirtyChanged"}))},_setModelText:function(e){this._model&&this._model.setText(e)},setInput:function(e,t,i,n){this._title=e,n||(t?this.reportStatus(t,"error"):null!==i&&void 0!==i&&("string"==typeof i&&this._setModelText(i),this._undoStack&&this._undoStack.reset())),this.checkDirty(),this.onInputChanged({type:"InputChanged",title:e,message:t,contents:i,contentsSaved:n})},setText:function(e,t,i){this.getModel().setText(e,t,i)},uninstall:function(){this.installed=!1}},t.EventTarget.addMixin(s.prototype),a.prototype=new s,o.mixin(a.prototype,{destroy:function(){s.prototype.destroy.call(this),this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=this._hoverFactory=this._zoomRulerFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getTooltip:function(){return i.Tooltip.getTooltip(this._textView,this)},getZoomRuler:function(){return this._zoomRuler},getModel:function(){if(!this._textView)return null;var e=this._textView.getModel();return e.getBaseModel&&(e=e.getBaseModel()),e},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(e,t){if((this._annotationRulerVisible!==e||t)&&(this._annotationRulerVisible=e,this._annotationRuler)){var i=this._textView;e?i.addRuler(this._annotationRuler,0):i.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(e,t){if((this._foldingRulerVisible!==e||t)&&(this._foldingRulerVisible=e,this._foldingRuler)){var i=this._textView;i.getModel().getBaseModel&&(e?i.addRuler(this._foldingRuler):i.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(e,t){if((this._lineNumberRulerVisible!==e||t)&&(this._lineNumberRulerVisible=e,this._lineNumberRuler)){var i=this._textView;e?i.addRuler(this._lineNumberRuler,this._annotationRulerVisible?1:0):i.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(e,t){if((this._overviewRulerVisible!==e||t)&&(this._overviewRulerVisible=e,this._overviewRuler)){var i=this._textView;e?i.addRuler(this._overviewRuler):i.removeRuler(this._overviewRuler)}},setZoomRulerVisible:function(e,t){if((this._zoomRulerVisible!==e||t)&&(this._zoomRulerVisible=e,this._zoomRuler)){var i=this._textView;e?i.addRuler(this._zoomRuler):i.removeRuler(this._zoomRuler)}},mapOffset:function(e,t){var i=this._textView,n=i.getModel();return n.getBaseModel&&(e=n.mapOffset(e,t)),e},getLineAtOffset:function(e){return this.getModel().getLineAtOffset(this.mapOffset(e))},getLineStart:function(e){return this.getModel().getLineStart(e)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelectionText:function(e){var t=this._textView;return t.getSelectionText(e)},getSelection:function(){var e=this._textView,t=e.getSelection(),i=e.getModel();return i.getBaseModel&&(t.start=i.mapOffset(t.start),t.end=i.mapOffset(t.end)),t},getSelections:function(){var e=this._textView,t=e.getModel(),i=e.getSelections();return i.forEach(function(e){t.getBaseModel&&(e.start=t.mapOffset(e.start),e.end=t.mapOffset(e.end))}),i},getStyleAccessor:function(){var e=null;if(this._syntaxHighlighter){var t=this._syntaxHighlighter.getStyler();t&&t.getStyleAccessor&&(e=t.getStyleAccessor())}return e},_expandOffset:function(e){var t=this._textView.getModel(),i=this._annotationModel;if(i&&t.getBaseModel)for(var n=i.getAnnotations(e,e+1);n.hasNext();){var o=n.next();o.type===l.ANNOTATION_FOLDING&&o.expand&&o.expand()}},setCaretOffset:function(e,t,i){var n=this._textView,o=n.getModel();o.getBaseModel&&(this._expandOffset(e),e=o.mapOffset(e,!0)),n.setCaretOffset(e,t,i)},setText:function(e,t,i,n,o){var r=this._textView,s=r.getModel();s.getBaseModel&&(void 0!==t&&(this._expandOffset(t),t=s.mapOffset(t,!0)),void 0!==i&&(this._expandOffset(i),i=s.mapOffset(i,!0))),r.setText(e,t,i,n,o)},setSelection:function(e,t,i,n){var o=this._textView,r=o.getModel();r.getBaseModel&&(this._expandOffset(e),this._expandOffset(t),e=r.mapOffset(e,!0),t=r.mapOffset(t,!0)),o.setSelection(e,t,i,n)},setSelections:function(e,t,i){var n=this,o=this._textView,r=o.getModel();e.forEach(function(e){var t=e.start,i=e.end;r.getBaseModel&&(n._expandOffset(t),n._expandOffset(i),t=r.mapOffset(t,!0),i=r.mapOffset(i,!0)),e.start=t,e.end=i}),o.setSelections(e,t,i)},moveSelection:function(e,t,i,n){t=t||e;var o=this._textView;this.setSelection(e,t,1/3,function(){(void 0===n||n)&&o.focus(),i&&i()})},_getTooltipInfo:function(e,t){var i=this._textView,n=this.getAnnotationModel();if(!n)return null;var o=this._annotationStyler;if(!o)return null;if(!i.isValidTextPosition(e,t))return null;var r=i.getOffsetAtLocation(e,t);if(-1===r)return null;r=this.mapOffset(r);for(var s=o.getAnnotationsByType(n,r,r+1),a=[],l=0;l>0,f=s.getLineStart(p),g=s.getLineEnd(p);s.getBaseModel&&(f=s.mapOffset(f),g=s.mapOffset(g));var _=l.ANNOTATION_CURRENT_LINE,m=l.createAnnotation(_,f,g);c.push(m)}this._currentLineAnnotations=c,o.replaceAnnotations(h,c)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){if(this._textView=this._textViewFactory(),this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this._textView.setOptions({undoStack:this._undoStack}),this.checkDirty()),this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack)),this._contentAssistFactory){var e=this._contentAssistFactory.createContentAssistMode(this);this._contentAssist=e.getContentAssist()}var t=i.Tooltip.getTooltip(this._textView,this);this._hoverFactory&&(this._hover=this._hoverFactory.createHover(this),t.hover=this._hover);var n=this,o=this._textView,r=this;if(this._listener={onModelChanged:function(){r.checkDirty()},onMouseOver:function(e){r._listener.onMouseMove(e)},onMouseDown:function(){r._listener.mouseDown=!0},onMouseUp:function(){r._listener.mouseDown=!1},onMouseMove:function(e){t&&!r._listener.mouseDown&&(e.event.clientX!==r._listener.lastMouseX||e.event.clientY!==r._listener.lastMouseY)&&(r._listener.lastMouseX=e.event.clientX,r._listener.lastMouseY=e.event.clientY,r._hoverTimeout&&(window.clearTimeout(r._hoverTimeout),r._hoverTimeout=null),r._hoverTimeout=window.setTimeout(function(){r._hoverTimeout=null,r._listener&&t.onHover({y:e.y,x:e.x,getTooltipInfo:function(){return r._getTooltipInfo(this.x,this.y)}},e.x,e.y)},175))},onMouseOut:function(){r._hoverTimeout&&(window.clearTimeout(r._hoverTimeout),r._hoverTimeout=null)},onSelection:function(e){t&&t.hide(),r._updateCursorStatus(),r._highlightCurrentLine(e.newValue,e.oldValue)}},o.addEventListener("ModelChanged",this._listener.onModelChanged),o.addEventListener("Selection",this._listener.onSelection),o.addEventListener("MouseOver",this._listener.onMouseOver),o.addEventListener("MouseOut",this._listener.onMouseOut),o.addEventListener("MouseDown",this._listener.onMouseDown),o.addEventListener("MouseUp",this._listener.onMouseUp),o.addEventListener("MouseMove",this._listener.onMouseMove),this._keyBindingFactory){var a;a="function"==typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(n,this._undoStack,this._contentAssist),a&&(this._textActions=a.textActions,this._linkedMode=a.linkedMode,this._sourceCodeActions=a.sourceCodeActions)}var h=function(e){if(void 0!==e&&-1!==e){for(var t=this.getView(),i=t.getModel(),o=this.getAnnotationModel(),r=n.mapOffset(i.getLineStart(e)),s=n.mapOffset(i.getLineEnd(e)),a=o.getAnnotations(r,s),d=null;a.hasNext();){var h=a.next();if(h.type===l.ANNOTATION_BOOKMARK){d=h;break}}d?o.removeAnnotation(d):(d=l.createAnnotation(l.ANNOTATION_BOOKMARK,r,s,n.getText(r,s)),o.addAnnotation(d))}};if(this._annotationFactory){var c=o.getModel();if(c.getBaseModel&&(c=c.getBaseModel()),this._annotationModel=this._annotationFactory.createAnnotationModel(c),this._annotationModel){var u=this._annotationStyler=this._annotationFactory.createAnnotationStyler(o,this._annotationModel);u&&(u.addAnnotationType(l.ANNOTATION_CURRENT_SEARCH),u.addAnnotationType(l.ANNOTATION_MATCHING_SEARCH),u.addAnnotationType(l.ANNOTATION_ERROR),u.addAnnotationType(l.ANNOTATION_WARNING),u.addAnnotationType(l.ANNOTATION_MATCHING_BRACKET),u.addAnnotationType(l.ANNOTATION_CURRENT_BRACKET),u.addAnnotationType(l.ANNOTATION_CURRENT_LINE),u.addAnnotationType(l.ANNOTATION_READ_OCCURRENCE),u.addAnnotationType(l.ANNOTATION_WRITE_OCCURRENCE),u.addAnnotationType(l.ANNOTATION_SELECTED_LINKED_GROUP),u.addAnnotationType(l.ANNOTATION_CURRENT_LINKED_GROUP),u.addAnnotationType(l.ANNOTATION_LINKED_GROUP),u.addAnnotationType(d))}var p=this._annotationFactory.createAnnotationRulers(this._annotationModel),f=this._annotationRuler=p.annotationRuler;f&&(f.onDblClick=h,f.setMultiAnnotationOverlay({html:""}),f.addAnnotationType(l.ANNOTATION_ERROR),f.addAnnotationType(l.ANNOTATION_WARNING),f.addAnnotationType(l.ANNOTATION_TASK),f.addAnnotationType(l.ANNOTATION_BOOKMARK),f.addAnnotationType(l.ANNOTATION_DIFF_ADDED),f.addAnnotationType(l.ANNOTATION_DIFF_DELETED),f.addAnnotationType(l.ANNOTATION_DIFF_MODIFIED)),this.setAnnotationRulerVisible(this._annotationRulerVisible||void 0===this._annotationRulerVisible,!0),f=this._overviewRuler=p.overviewRuler,f&&(f.addAnnotationType(l.ANNOTATION_CURRENT_SEARCH),f.addAnnotationType(l.ANNOTATION_MATCHING_SEARCH),f.addAnnotationType(l.ANNOTATION_READ_OCCURRENCE),f.addAnnotationType(l.ANNOTATION_WRITE_OCCURRENCE),f.addAnnotationType(l.ANNOTATION_CURRENT_BLAME),f.addAnnotationType(l.ANNOTATION_ERROR),f.addAnnotationType(l.ANNOTATION_WARNING),f.addAnnotationType(l.ANNOTATION_TASK),f.addAnnotationType(l.ANNOTATION_BOOKMARK),f.addAnnotationType(l.ANNOTATION_MATCHING_BRACKET),f.addAnnotationType(l.ANNOTATION_CURRENT_BRACKET),f.addAnnotationType(l.ANNOTATION_CURRENT_LINE),f.addAnnotationType(l.ANNOTATION_DIFF_ADDED),f.addAnnotationType(l.ANNOTATION_DIFF_DELETED),f.addAnnotationType(l.ANNOTATION_DIFF_MODIFIED)),this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._zoomRulerFactory&&(this._zoomRuler=this._zoomRulerFactory.createZoomRuler(this._annotationModel),this.setZoomRulerVisible(this._zoomRulerVisible,!0)),this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_BLAME),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_DIFF_ADDED),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_DIFF_MODIFIED),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_DIFF_DELETED),this._lineNumberRuler.onDblClick=h,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||void 0===this._lineNumberRulerVisible,!0)),this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(l.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));var g={type:"TextViewInstalled",textView:o};this.dispatchEvent(g),s.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var e=this._textView;if(e){e.destroy(),this._annotationModel&&this._annotationModel.setTextModel(null),this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._zoomRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotations=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._zoomRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0;var t={type:"TextViewUninstalled",textView:e};this.dispatchEvent(t),s.prototype.uninstall.call(this)}},_updateCursorStatus:function(){for(var t=this.getKeyModes(),i=0;i1)o=r.formatMessage(e.multiSelections,a.length);else{var l=a[0].getCaret(),d=s.getLineAtOffset(l),h=s.getLineStart(d),c=l-h;o=localStorage.languageTools?r.formatMessage(e.lineColumnOffset,d+1,c+1,l):r.formatMessage(e.lineColumn,d+1,c+1)}this.reportStatus(o)},showAnnotations:function(e,t,i,n){var o=this._annotationModel;if(o){for(var r,s=[],a=[],d=o.getTextModel(),h=o.getAnnotations();h.hasNext();)r=h.next(),-1!==t.indexOf(r.type)&&r.creatorID===this&&s.push(r);
-if(e)for(var c=0;c',s.blame=e,s})},showDiffAnnotations:function(e){this.showAnnotations(e,[l.ANNOTATION_DIFF_ADDED,l.ANNOTATION_DIFF_MODIFIED,l.ANNOTATION_DIFF_DELETED],null,function(e){return"added"===e.type?l.ANNOTATION_DIFF_ADDED:"modified"===e.type?l.ANNOTATION_DIFF_MODIFIED:l.ANNOTATION_DIFF_DELETED})},showSelection:function(e,t,i,n,o){if("number"==typeof e)return"number"!=typeof t&&(t=e),this.moveSelection(e,t),!0;if("number"==typeof i){var r=this.getModel(),s=r.getLineStart(i-1);return"number"==typeof n&&(s+=n),"number"!=typeof o&&(o=0),this.moveSelection(s,s+o),!0}return!1},_setModelText:function(e){this._textView&&(this._textView.setText(e),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelections()))},setInput:function(e,t,i,n,o){s.prototype.setInput.call(this,e,t,i,n),!this._textView||n||o||this._textView.focus()},onGotoLine:function(e,t,i,n){if(this._textView){var o=this.getModel();e=Math.max(0,Math.min(e,o.getLineCount()-1));var r=o.getLineStart(e),s=0;if(void 0===i&&(i=0),"string"==typeof t){var a=o.getLine(e).indexOf(t);-1!==a&&(s=a,i=s+t.length)}else{s=t;var l=o.getLineEnd(e)-r;s=Math.min(s,l),i=Math.min(i,l)}this.moveSelection(r+s,r+i,n)}}}),{BaseEditor:s,Editor:a}}),define("orion/editor/find",["i18n!orion/editor/nls/messages","orion/keyBinding","orion/editor/keyModes","orion/editor/annotations","orion/regex","orion/objects","orion/util"],function(e,t,i,n,o,r,s){function a(e){var t=e.getTextView();i.KeyMode.call(this,t),this.editor=e,this._active=!1,this._success=!0,this._ignoreSelection=!1,this._prefix="",t.setAction("incrementalFindCancel",function(){return this.setActive(!1),!0}.bind(this)),t.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));var n=this;this._listener={onVerify:function(e){var t=n.editor,i=t.getModel(),r=t.mapOffset(e.start),s=t.mapOffset(e.end),a=i.getText(r,s),l=n._prefix,d=l.match(new RegExp("^"+o.escape(a),"i"));d&&d.length>0&&(l=n._prefix+=e.text,n._success=!0,n._status(),n.find(n._forward,!0),e.text=null)},onSelection:function(){n._ignoreSelection||n.setActive(!1)}}}function l(e,t,i){if(e){this._editor=e,this._undoStack=t,this._showAll=!0,this._visible=!1,this._caseInsensitive=!0,this._wrap=!0,this._wholeWord=!1,this._incremental=!0,this._regex=!1,this._findAfterReplace=!0,this._hideAfterFind=!1,this._reverse=!1,this._start=void 0,this._end=void 0,this._timer=void 0,this._lastString="";var n=this;this._listeners={onEditorFocus:function(e){n._removeCurrentAnnotation(e)}},this.setOptions(i)}}var d={};return a.prototype=new i.KeyMode,r.mixin(a.prototype,{createKeyBindings:function(){var e=t.KeyBinding,i=[];return i.push({actionID:"incrementalFindBackspace",keyBinding:new e(8)}),i.push({actionID:"incrementalFindCancel",keyBinding:new e(13)}),i.push({actionID:"incrementalFindCancel",keyBinding:new e(27)}),i.push({actionID:"incrementalFindReverse",keyBinding:new e(38)}),i.push({actionID:"incrementalFind",keyBinding:new e(40)}),i.push({actionID:"incrementalFindReverse",keyBinding:new e("k",!0,!0)}),i.push({actionID:"incrementalFind",keyBinding:new e("k",!0)}),i},find:function(e,t){if(this._forward=e,!this.isActive())return this.setActive(!0),!1;var i=this._prefix;if(0===i.length)return!1;var n,o=this.editor,r=o.getModel();n=e?this._success?t?this._start:o.getCaretOffset()+1:0:this._success?t?this._start:o.getCaretOffset():r.getCharCount()-1;var s=o.getModel().find({string:i,start:n,reverse:!e,caseInsensitive:i.toLowerCase()===i}).next();return s?(t||(this._start=n),this._success=!0,this._ignoreSelection=!0,o.moveSelection(e?s.start:s.end,e?s.end:s.start),this._ignoreSelection=!1):this._success=!1,this._status(),!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(e){if(this._active!==e){this._active=e,this._prefix="",this._success=!0;var t=this.editor,i=t.getTextView();this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(i.addEventListener("Verify",this._listener.onVerify),i.addEventListener("Selection",this._listener.onSelection),i.addKeyMode(this)):(i.removeEventListener("Verify",this._listener.onVerify),i.removeEventListener("Selection",this._listener.onSelection),i.removeKeyMode(this)),this._status()}},_backspace:function(){var e=this._prefix;return e=this._prefix=e.substring(0,e.length-1),0===e.length?(this._success=!0,this._ignoreSelection=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(!this.isActive())return void this.editor.reportStatus("");var t;t=this._forward?this._success?e.incrementalFindStr:e.incrementalFindStrNotFound:this._success?e.incrementalFindReverseStr:e.incrementalFindReverseStrNotFound,t=s.formatMessage(t,this._prefix),this.editor.reportStatus(t,this._success?"":"error")}}),d.IncrementalFind=a,l.prototype={find:function(e,t,i){this.setOptions({reverse:!e});var n,o=this.getFindString();t&&(o=t.findString||o,n=t.count);var r=this.getOptions();this.setOptions(t);var s=i?this._startOffset:this.getStartOffset(),a=this._doFind(o,s,n);return a&&(i||(this._startOffset=a.start)),this.setOptions(r),this._hideAfterFind&&this.hide(),a},getStartOffset:function(){return void 0!==this._start?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var e=this._editor.getSelection(),t=this._editor.getText(e.start,e.end);return this._regex&&(t=o.escape(t)),t||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},hide:function(){this._visible=!1,this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(this._savedOptions=null)),this._removeAllAnnotations();var e=this._editor.getTextView();e&&(e.removeEventListener("Focus",this._listeners.onEditorFocus),e.focus())},_processReplaceString:function(e){var t=e;if(this._regex){t="";for(var i=!1,n=this._editor.getModel().getLineDelimiter(),o=0;o0&&(r.endUndo(),n.setRedraw(!0)),a>0?i.reportStatus(s.formatMessage(e.replacedMatches,l)):i.reportStatus(e.nothingReplaced,"error"),r._replacingAll=!1},100)}},setOptions:function(e){if(e){if((e.showAll===!0||e.showAll===!1)&&this._showAll!==e.showAll&&(this._showAll=e.showAll,this.isVisible()))if(this._showAll)this._markAllOccurrences();else{var t=this._editor.getAnnotationModel();t&&t.removeAnnotations(n.AnnotationType.ANNOTATION_MATCHING_SEARCH)}(e.caseInsensitive===!0||e.caseInsensitive===!1)&&(this._caseInsensitive=e.caseInsensitive),(e.wrap===!0||e.wrap===!1)&&(this._wrap=e.wrap),(e.wholeWord===!0||e.wholeWord===!1)&&(this._wholeWord=e.wholeWord),(e.incremental===!0||e.incremental===!1)&&(this._incremental=e.incremental),(e.regex===!0||e.regex===!1)&&(this._regex=e.regex),(e.findAfterReplace===!0||e.findAfterReplace===!1)&&(this._findAfterReplace=e.findAfterReplace),(e.hideAfterFind===!0||e.hideAfterFind===!1)&&(this._hideAfterFind=e.hideAfterFind),(e.reverse===!0||e.reverse===!1)&&(this._reverse=e.reverse),e.hasOwnProperty("findCallback")&&(this._findCallback=e.findCallback),e.hasOwnProperty("start")&&(this._start=e.start),e.hasOwnProperty("end")&&(this._end=e.end)}},show:function(e){this._visible=!0,e&&(this._savedOptions||(this._savedOptions=[]),this._savedOptions.push(this.getOptions()),this.setOptions(e)),this._startOffset=this._editor.getSelection().start,this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var t=this;window.setTimeout(function(){t._incremental&&t.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(e,t,i){return this._editor.getModel().find({string:e,start:t,end:this._end,reverse:this._reverse,wrap:i?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(t,i,o,r){o=o||1;var s=this._editor;if(!t)return this._removeAllAnnotations(),null;this._lastString=t;var a,l;if(this._regex)try{l=this._find(t,i,r)}catch(d){return void s.reportStatus(d.message,"error")}else l=this._find(t,i,r);for(var h=0;o>h&&l.hasNext();h++)a=l.next();if(!this._replacingAll){if(a?this._editor.reportStatus(""):this._editor.reportStatus(e.notFound,"error"),this.isVisible()){var c=n.AnnotationType.ANNOTATION_CURRENT_SEARCH,u=s.getAnnotationModel();if(u&&(u.removeAnnotations(c),a&&u.addAnnotation(n.AnnotationType.createAnnotation(c,a.start,a.end))),this._showAll){this._timer&&window.clearTimeout(this._timer);var p=this;this._timer=window.setTimeout(function(){p._markAllOccurrences(),p._timer=null},500)}}this._findCallback?this._findCallback(a):a&&s.moveSelection(a.start,a.end,null,!1)}return a},_doReplace:function(e,t,i,n){var o=this._editor;this._regex&&(n=o.getText(e,t).replace(new RegExp(i,this._caseInsensitive?"i":""),n)),o.setText(n,e,t),o.setSelection(e,e+n.length,!0)},_markAllOccurrences:function(){var e=this._editor.getAnnotationModel();if(e){for(var t,i=n.AnnotationType.ANNOTATION_MATCHING_SEARCH,o=e.getAnnotations(),r=[];o.hasNext();){var s=o.next();s.type===i&&r.push(s)}if(this.isVisible()){var a=this.getFindString();for(o=this._editor.getModel().find({string:a,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}),t=[];o.hasNext();){var l=o.next();t.push(n.AnnotationType.createAnnotation(i,l.start,l.end))}}e.replaceAnnotations(r,t)}},_removeAllAnnotations:function(){var e=this._editor.getAnnotationModel();e&&(e.removeAnnotations(n.AnnotationType.ANNOTATION_CURRENT_SEARCH),e.removeAnnotations(n.AnnotationType.ANNOTATION_MATCHING_SEARCH))},_removeCurrentAnnotation:function(){var e=this._editor.getAnnotationModel();e&&e.removeAnnotations(n.AnnotationType.ANNOTATION_CURRENT_SEARCH)}},d.Find=l,d}),define("orion/editor/findUI",["i18n!orion/editor/nls/messages","orion/editor/find","orion/objects","orion/editor/util","orion/util"],function(e,t,i,n,o){function r(e,i,n){t.Find.call(this,e,i,n)}return r.prototype=new t.Find,i.mixin(r.prototype,{getFindString:function(){var e=this._findInput;return e?e.value:t.Find.prototype.getFindString.call(this)},getReplaceString:function(){var e=this._replaceInput;return e?e.value:t.Find.prototype.getReplaceString(this)},hide:function(){var e=this.isVisible();t.Find.prototype.hide.call(this),e&&(this._rootDiv.className="textViewFind")},show:function(e){t.Find.prototype.show.call(this,e);var i=e.findString,n=e.replaceString,o=this._findInput;if(o||(this._create(),o=this._findInput),i&&(o.value=i),n){var r=this._replaceInput;r.value=n}var s=this;window.setTimeout(function(){s._rootDiv.className="textViewFind show",o.select(),o.focus()},0)},_create:function(){var e=this,t=this._editor.getTextView(),i=t.getOptions("parent"),r=i.ownerDocument,s=o.createElement(r,"div");s.className="textViewFind",n.addEventListener(s,"keydown",function(t){e._handleKeyDown(t)}),this._rootDiv=s,this._createContents(r,s),t._rootDiv.insertBefore(s,t._rootDiv.firstChild)},_createContents:function(t,i){var r=this,s=o.createElement(t,"input");s.className="textViewFindInput",this._findInput=s,s.type="text",s.placeholder=e.findWith,n.addEventListener(s,"input",function(e){return r._handleInput(e)}),i.appendChild(s);var a=o.createElement(t,"span");r._createButton(t,a,e.next,function(){r.find(!0)}),r._createButton(t,a,e.previous,function(){r.find(!1)}),i.appendChild(a);var l=r._editor.getTextView().getOptions("readonly");if(!l){var d=o.createElement(t,"input");d.className="textViewReplaceInput",this._replaceInput=d,d.type="text",d.placeholder=e.replaceWith,i.appendChild(d),a=o.createElement(t,"span"),r._createButton(t,a,e.replace,function(){r.replace()}),r._createButton(t,a,e.replaceAll,function(){r.replaceAll()}),i.appendChild(a)}a=o.createElement(t,"span"),r._createButton(t,a,e.regex,function(e){r._toggle("regex",e.target)},this._regex,e.regexTooltip),r._createButton(t,a,e.caseInsensitive,function(e){r._toggle("caseInsensitive",e.target)},this._caseInsensitive,e.caseInsensitiveTooltip),r._createButton(t,a,e.wholeWord,function(e){r._toggle("wholeWord",e.target)},this._wholeWord,e.wholeWordTooltip),i.appendChild(a);var h=r._createButton(t,i,"",function(){r.hide()});h.className="textViewFindCloseButton",h.title=e.closeTooltip},_createButton:function(e,t,i,o,r,s){var a=e.createElement("button");return a.type="button",this._checked(r,a),s&&(a.title=s),n.addEventListener(a,"click",function(e){o.call(this,e)},!1),i&&a.appendChild(e.createTextNode(i)),t.appendChild(a),a},_toggle:function(e,t){var i={};i[e]=!this["_"+e],this.setOptions(i),this._checked(i[e],t)},_checked:function(e,t){t.className="textViewFindButton",e&&(t.className+=" checked")},_handleInput:function(){return this._incremental&&this.find(!0,null,!0),!0},_handleKeyDown:function(e){var t,i=(o.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&!e.shiftKey;return i&&70===e.keyCode&&(t=!0),((o.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&75===e.keyCode||13===e.keyCode)&&(this.find(13===e.keyCode?this._reverse?e.shiftKey:!e.shiftKey:!e.shiftKey),t=!0),i&&82===e.keyCode&&(this.replace(),t=!0),27===e.keyCode&&(this.hide(),t=!0),t?(e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,!1):!0}}),{FindUI:r}}),define("orion/editor/actions",["i18n!orion/editor/nls/messages","orion/keyBinding","orion/editor/annotations","orion/editor/tooltip","orion/editor/find","orion/editor/findUI","orion/util"],function(e,t,i,n,o,r,s){function a(e,t,i,n){function o(e,t,i){s.setText(e,t,i),r+=t-i+e.length}var r=0,s=e.editor,a=s.getSelections();!n&&(t||a.length>1)&&e.startUndo(),a.forEach(function(e){e.start+=r,e.end+=r,i(e,o)}),s.setSelections(a),!n&&(t||a.length>1)&&e.endUndo()}function l(e,t,i){this.editor=e,this.undoStack=t,this._incrementalFind=new o.IncrementalFind(e),this._find=i?i:new r.FindUI(e,t),this._lastEditLocation=null,this.init()}function d(e,t,i,n){this.editor=e,this.undoStack=t,this.contentAssist=i,this.linkedMode=n,this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",this.contentAssistProposalApplied.bind(this)),this.init()}var h=i.AnnotationType,c={};return l.prototype={init:function(){var i=this.editor.getTextView();this._lastEditListener={onModelChanged:function(e){this.editor.isDirty()&&(this._lastEditLocation=e.start+e.addedCharCount)}.bind(this)},i.addEventListener("ModelChanged",this._lastEditListener.onModelChanged),i.setAction("undo",function(e){if(this.undoStack){var t=1;for(e&&e.count&&(t=e.count);t>0;)this.undoStack.undo(),--t;return!0}return!1}.bind(this),{name:e.undo}),i.setAction("redo",function(e){if(this.undoStack){var t=1;for(e&&e.count&&(t=e.count);t>0;)this.undoStack.redo(),--t;return!0}return!1}.bind(this),{name:e.redo}),i.setKeyBinding(new t.KeyBinding("f",!0),"find"),i.setAction("find",function(){if(this._find){var e=this.editor.getSelection();return this._find.show({findString:this.editor.getText(e.start,e.end)}),!0}return!1}.bind(this),{name:e.find}),i.setKeyBinding(new t.KeyBinding("k",!0),"findNext"),i.setAction("findNext",function(e){return this._find?(this._find.find(!0,e),!0):!1}.bind(this),{name:e.findNext}),i.setKeyBinding(new t.KeyBinding("k",!0,!0),"findPrevious"),i.setAction("findPrevious",function(e){return this._find?(this._find.find(!1,e),!0):!1}.bind(this),{name:e.findPrevious}),i.setKeyBinding(new t.KeyBinding("j",!0),"incrementalFind"),i.setAction("incrementalFind",function(){return this._incrementalFind&&this._incrementalFind.find(!0),!0}.bind(this),{name:e.incrementalFind}),i.setKeyBinding(new t.KeyBinding("j",!0,!0),"incrementalFindReverse"),i.setAction("incrementalFindReverse",function(){return this._incrementalFind&&this._incrementalFind.find(!1),!0}.bind(this),{name:e.incrementalFindReverse}),i.setAction("tab",function(){return this.indentLines()}.bind(this)),i.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:e.unindentLines}),i.setKeyBinding(new t.KeyBinding(38,!1,!1,!0),"moveLinesUp"),i.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:e.moveLinesUp}),i.setKeyBinding(new t.KeyBinding(40,!1,!1,!0),"moveLinesDown"),i.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:e.moveLinesDown}),i.setKeyBinding(new t.KeyBinding(38,!0,!1,!0),"copyLinesUp"),i.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:e.copyLinesUp}),i.setKeyBinding(new t.KeyBinding(40,!0,!1,!0),"copyLinesDown"),i.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:e.copyLinesDown}),i.setKeyBinding(new t.KeyBinding("d",!0,!1,!1),"deleteLines"),i.setAction("deleteLines",function(e){return this.deleteLines(e)}.bind(this),{name:e.deleteLines}),i.setKeyBinding(new t.KeyBinding("l",!s.isMac,!1,!1,s.isMac),"gotoLine"),i.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:e.gotoLine}),i.setKeyBinding(new t.KeyBinding(190,!0),"nextAnnotation"),i.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:e.nextAnnotation}),i.setKeyBinding(new t.KeyBinding(188,!0),"previousAnnotation"),i.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:e.prevAnnotation}),i.setKeyBinding(new t.KeyBinding("e",!0,!1,!0,!1),"expand"),i.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:e.expand}),i.setKeyBinding(new t.KeyBinding("c",!0,!1,!0,!1),"collapse"),i.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:e.collapse}),i.setKeyBinding(new t.KeyBinding("e",!0,!0,!0,!1),"expandAll"),i.setAction("expandAll",function(){return this.expandAnnotations(!0)}.bind(this),{name:e.expandAll}),i.setKeyBinding(new t.KeyBinding("c",!0,!0,!0,!1),"collapseAll"),i.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:e.collapseAll}),i.setKeyBinding(new t.KeyBinding("q",!s.isMac,!1,!1,s.isMac),"lastEdit"),i.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:e.lastEdit})},copyLinesDown:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!1,function(e,t){var n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineStart(n),s=i.getLineEnd(o,!0),a=i.getLineCount(),l="",d=i.getText(r,s);o===a-1&&(d=(l=i.getLineDelimiter())+d);var h=s;t(d,h,h),e.start=h+l.length,e.end=h+d.length}),!0},copyLinesUp:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!1,function(e,t){var n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineStart(n),s=i.getLineEnd(o,!0),a=i.getLineCount(),l="",d=i.getText(r,s);o===a-1&&(d+=l=i.getLineDelimiter());var h=r;t(d,h,h),e.start=h,e.end=h+d.length-l.length}),!0},deleteLines:function(e){var t=this.editor,i=t.getTextView();if(i.getOptions("readonly"))return!1;var n=1;e&&e.count&&(n=e.count);var o=t.getModel();return a(this,!1,function(e,t){var i,r=o.getLineAtOffset(e.start),s=o.getLineStart(r);i=e.start!==e.end||1===n?o.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(r+n-1,o.getLineCount()-1);var a=o.getLineEnd(i,!0);t("",s,a),e.start=e.end=s}),!0},expandAnnotation:function(e){var t=this.editor,n=t.getAnnotationModel();if(!n)return!0;var o=t.getModel(),r=t.getCaretOffset(),s=o.getLineAtOffset(r),a=o.getLineStart(s),l=o.getLineEnd(s,!0);o.getBaseModel&&(a=o.mapOffset(a),l=o.mapOffset(l),o=o.getBaseModel());for(var d,h=n.getAnnotations(a,l);!d&&h.hasNext();){var c=h.next();c.type===i.AnnotationType.ANNOTATION_FOLDING&&(d=c)}return d&&e!==d.expanded&&(e?d.expand():(t.setCaretOffset(d.start),d.collapse())),!0},expandAnnotations:function(e){var t=this.editor,n=t.getTextView(),o=t.getAnnotationModel();if(!o)return!0;var r,s=o.getAnnotations();for(n.setRedraw(!1);s.hasNext();)r=s.next(),r.type===i.AnnotationType.ANNOTATION_FOLDING&&e!==r.expanded&&(e?r.expand():r.collapse());return n.setRedraw(!0),!0},indentLines:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;if(t.getOptions("tabMode")){var i=e.getModel(),n=0,o=e.getSelections();return o.length>1&&this.startUndo(),o.some(function(r){r.start+=n,r.end+=n;var s=i.getLineAtOffset(r.start),a=i.getLineAtOffset(r.end>r.start?r.end-1:r.end);if(!(s!==a||o.length>1))return!0;var l=[];l.push("");for(var d=s;a>=d;d++)l.push(i.getLine(d,!0));var h=i.getLineStart(s),c=i.getLineEnd(a,!0),u=t.getOptions("tabSize","expandTab"),p=u.expandTab?new Array(u.tabSize+1).join(" "):" ",f=l.join(p);e.setText(f,h,c);var g=h===r.start?r.start:r.start+p.length,_=r.end+(a-s+1)*p.length;return n+=h-c+f.length,r.start=g,r.end=_,!1})?!1:(e.setSelections(o),o.length>1&&this.endUndo(),!0)}},gotoLastEdit:function(){return"number"==typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation),!0},gotoLine:function(){var t=this.editor,i=t.getModel(),n=i.getLineAtOffset(t.getCaretOffset());return n=prompt(e.gotoLinePrompty,n+1),n&&(n=parseInt(n,10),t.onGotoLine(n-1,0)),!0},moveLinesDown:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!0,function(e,t){var n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineCount();if(o!==r-1){var s,a=i.getLineStart(n),l=i.getLineEnd(o,!0),d=i.getLineEnd(o+1,!0)-(l-a),h=0;if(o!==r-2)s=i.getText(a,l);else{var c=i.getLineEnd(o);s=i.getText(c,l)+i.getText(a,c),h+=l-c}t("",a,l),t(s,d,d),e.start=d+h,e.end=d+h+s.length}}),!0},moveLinesUp:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!0,function(e,t){var n=i.getLineAtOffset(e.start);if(0!==n){var o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineCount(),s=i.getLineStart(n-1),a=i.getLineStart(n),l=i.getLineEnd(o,!0),d=i.getText(a,l),h=0;if(o===r-1){var c=i.getLineEnd(n-1),u=i.getLineEnd(n-1,!0);d+=i.getText(c,u),a=c,h=u-c}t("",a,l),t(d,s,s),e.start=s,e.end=s+d.length-h}}),!0},nextAnnotation:function(e){function t(e){return!!e.lineStyle||e.type===h.ANNOTATION_MATCHING_BRACKET||e.type===h.ANNOTATION_CURRENT_BRACKET||!r.isAnnotationTypeVisible(e.type)}var i=this.editor,o=i.getAnnotationModel();if(!o)return!0;var r=i.getOverviewRuler()||i.getAnnotationStyler();if(!r)return!0;for(var s=i.getModel(),a=i.getCaretOffset(),l=o.getAnnotations(e?a:0,e?s.getCharCount():a),d=null;l.hasNext();){var c=l.next();if(e){if(c.start<=a)continue}else if(c.start>=a)continue;if(!t(c)&&(d=c,e))break}if(d){var u=[d];for(l=o.getAnnotations(d.start,d.start);l.hasNext();)c=l.next(),c===d||t(c)||u.push(c);var p=i.getTextView(),f=n.Tooltip.getTooltip(p,i);if(!f)return i.moveSelection(d.start),!0;i.moveSelection(d.start,d.start,function(){setTimeout(function(){var e=i.getTextView(),t=d.start,n=e.getLocationAtOffset(t);f.show({x:n.x,y:n.y,getTooltipInfo:function(){return i._getTooltipInfo(this.x,this.y)}},!1,!1)},0)})}return!0},unindentLines:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;if(t.getOptions("tabMode")){var i=e.getModel();return a(this,!1,function(e,n){for(var o=i.getLineAtOffset(e.start),r=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),s=t.getOptions("tabSize"),a=new Array(s+1).join(" "),l=[],d=0,h=0,c=o;r>=c;c++){var u=i.getLine(c,!0);if(i.getLineStart(c)!==i.getLineEnd(c))if(0===u.indexOf(" "))u=u.substring(1),d++;else{if(0!==u.indexOf(a))return!0;u=u.substring(s),d+=s}c===o&&(h=d),l.push(u)}var p=i.getLineStart(o),f=i.getLineEnd(r,!0),g=i.getLineStart(r),_=l.join("");n(_,p,f);var m=p===e.start?e.start:e.start-h,v=Math.max(m,e.end-d+(e.end===g+1&&e.start!==e.end?1:0));e.start=m,e.end=v}),!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}},c.TextActions=l,d.prototype={init:function(){var i=this.editor.getTextView();i.setAction("lineStart",function(){return this.lineStart()}.bind(this)),i.setAction("enter",function(){return this.autoIndent()}.bind(this)),i.setKeyBinding(new t.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces"),i.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:e.trimTrailingWhitespaces}),i.setKeyBinding(new t.KeyBinding(191,!0),"toggleLineComment"),i.setAction("toggleLineComment",function(){return this.toggleLineComment()}.bind(this),{name:e.toggleLineComment}),i.setKeyBinding(new t.KeyBinding(191,!0,!s.isMac,!1,s.isMac),"addBlockComment"),i.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:e.addBlockComment}),i.setKeyBinding(new t.KeyBinding(220,!0,!s.isMac,!1,s.isMac),"removeBlockComment"),i.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:e.removeBlockComment}),i.setKeyBinding(new t.KeyBinding("[",!1,!1,!1,!1,"keypress"),"autoPairSquareBracket"),i.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this)),i.setKeyBinding(new t.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket"),i.setAction("skipClosingSquareBracket",function(){return this.handleClosingBracket("]")}.bind(this)),i.setKeyBinding(new t.KeyBinding("<",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket"),i.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("<",">")}.bind(this)),i.setKeyBinding(new t.KeyBinding(">",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket"),i.setAction("skipClosingAngleBracket",function(){return this.handleClosingBracket(">")}.bind(this)),i.setKeyBinding(new t.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses"),i.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this)),i.setKeyBinding(new t.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis"),i.setAction("skipClosingParenthesis",function(){return this.handleClosingBracket(")")}.bind(this)),i.setKeyBinding(new t.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces"),i.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this)),i.setKeyBinding(new t.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace"),i.setAction("skipClosingBrace",function(){return this.handleClosingBracket("}")}.bind(this)),i.setKeyBinding(new t.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation"),i.setAction("autoPairSingleQuotation",function(){return this.autoPairQuotations("'")}.bind(this)),i.setKeyBinding(new t.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation"),i.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this)),i.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){function e(e,t){if(e.start===e.end){for(var i,o=n.getLineAtOffset(e.start),a=n.getLine(o,!1),u=n.getLineStart(o),p=0,f=e.start-u;f>p&&(32===(i=a.charCodeAt(p))||9===i);)p++;var g,_,m=a.substring(0,p),v=a.substring(0,f),y=a.substring(f);if(c.smartIndentation&&123===a.charCodeAt(_=v.trimRight().length-1)){var x=f-_-1,b=y.length-y.trimLeft().length;return g=125===a.charCodeAt(f+b)?s+m+r+s+m:s+m+r,t(g,e.start-x,e.end+b),e.start=e.end=e.start+s.length+m.length+r.length-x,!0}if(c.autoCompleteComments&&!h.test(v)&&(l.test(v)||d.test(v))){var C,w=l.exec(v);if(w)return g=s+m+" * ",g+=h.test(y)?y.substring(0,y.length-2).trim():y.trim(),n.getLineCount()!==o+1&&d.test(n.getLine(o+1))||(g+=s+m+" */"),t(g,e.start,e.end+y.length),e.start=e.end=e.start+s.length+m.length+3,!0;if(w=d.exec(v))for(var T=o-1;T>=0;T--){var L=n.getLine(T,!1);if(l.test(L))return h.test(y)||47===a.charCodeAt(f)?(g=s+m+"*"+y,C=e.start+s.length+m.length+1):(g=s+m+"* "+y,C=e.start+s.length+m.length+2),t(g,e.start,e.end+y.length),e.start=e.end=C,!0;if(!d.test(L))return!1}return!1}if(h.test(v)&&32===m.charCodeAt(m.length-1))return g=s+m.substring(0,m.length-1),t(g,e.start,e.end),e.start=e.end=e.start+g.length,!0;
-if(p>0){for(p=f;p]"),r=i.getModel();return a(this,!1,function(i,n){var s,a=i.start===r.getCharCount()?"":r.getText(i.start,i.start+1).trim();i.start===i.end&&o.test(a)?(s=e+t,n(s,i.start,i.start),i.start=i.end=i.start+1):i.start!==i.end?(s=e+r.getText(i.start,i.end)+t,n(s,i.start,i.end),i.start+=1,i.end+=1):(n(e,i.start,i.end),i.start=i.end=i.start+e.length)}),!0},autoPairQuotations:function(e){if(!this.autoPairQuotation)return!1;var t=this.editor,i=t.getTextView();if(i.getOptions("readonly"))return!1;var n=new RegExp("^\"$|^'$"),o=new RegExp("\\w"),r=new RegExp("^$|[)}\\]>]"),s=t.getModel();return a(this,!1,function(t,i){function a(){i(e,t.start,t.end),t.start=t.end=t.start+e.length}var l=0===t.start?"":s.getText(t.start-1,t.start).trim(),d=t.start===s.getCharCount()?"":s.getText(t.start,t.start+1).trim();if(t.start!==t.end){var h=s.getText(t.start,t.end);n.test(h)?a():(i(e+h+e,t.start,t.end),t.start+=1,t.end+=1)}else d===e?t.start=t.end=t.start+1:l===e||n.test(d)||o.test(l)||!r.test(d)?a():(i(e+e,t.start,t.end),t.start=t.end=t.start+e.length)}),!0},contentAssistProposalApplied:function(e){function t(){return"number"==typeof i.escapePosition?i.escapePosition:e.data.start+i.proposal.length}var i=e.data.proposal;if(i.positions&&i.positions.length>0&&this.linkedMode){for(var n=[],o=0;o0&&this.linkedMode)this.linkedMode.enterLinkedMode({groups:i.groups,escapePosition:t()});else if("number"==typeof i.escapePosition){var r=this.editor.getTextView();r.setCaretOffset(i.escapePosition)}return!0},deletePrevious:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!1,function(e,t){if(e.start===e.end){var n=0===e.start?"":i.getText(e.start-1,e.start),o=e.start===i.getCharCount()?"":i.getText(e.start,e.start+1);("("===n&&")"===o||"["===n&&"]"===o||"{"===n&&"}"===o||"<"===n&&">"===o||'"'===n&&'"'===o||"'"===n&&"'"===o)&&t("",e.start,e.start+1)}},!0),!1},_findEnclosingComment:function(e,t,i,n,o){var r,s,a,l,d,h,c,u=e.getLineAtOffset(t),p=e.getLineAtOffset(i);for(r=u;r>=0&&(s=e.getLine(r),a=r===u?t-e.getLineStart(u):s.length,l=s.lastIndexOf(n,a),d=s.lastIndexOf(o,a),!(d>l));r--)if(-1!==l){h=e.getLineStart(r)+l;break}for(r=p;rl));r++)if(-1!==d){c=e.getLineStart(r)+d;break}return{commentStart:h,commentEnd:c}},lineStart:function(){var e=this.editor,t=e.getModel();return a(this,!1,function(e){var i,n=e.getCaret(),o=t.getLineAtOffset(n),r=t.getLineStart(o),s=t.getLine(o);for(i=0;ie.start?e.end-1:e.end);o=n?n.getLineCommentDelimiter(i.getLineStart(r)):"//";for(var a,l=!0,d=[],h=r;s>=h;h++){var c=i.getLine(h,!0);if(a=c.indexOf(o),d.push(a),l&&-1!==a){if(0!==a){var u;for(u=0;a>u;u++){var p=c.charCodeAt(u);if(32!==p&&9!==p)break}l=u===a}}else l=!1}var f,g,_,m=o.length,v=i.getLineStart(r);if(l){for(_=d.length-1;_>=0;_--)a=d[_]+i.getLineStart(r+_),t("",a,a+m);var y=i.getLineStart(s);f=v===e.start?e.start:e.start-m,g=e.end-m*(s-r+1)+(e.end===y+1?m:0)}else{for(_=d.length-1;_>=0;_--)a=i.getLineStart(r+_),t(o,a,a);f=v===e.start?e.start:e.start+m,g=e.end+m*(s-r+1)}e.start=f,e.end=g}),t.setRedraw(!0),!0},trimTrailingWhitespaces:function(){var e=this.editor,t=e.getModel(),i=e.getSelections();e.getTextView().setRedraw(!1),this.startUndo();for(var n=/(\s+$)/,o=t.getLineCount(),r=0;o>r;r++){var s=t.getLine(r),a=n.exec(s);if(a){var l=t.getLineStart(r),d=a[0].length,h=l+a.index;t.setText("",h,h+d),i.forEach(function(e){e.start>h&&(e.start=Math.max(h,e.start-d)),e.start!==e.end&&e.end>h&&(e.end=Math.max(h,e.end-d))})}}this.endUndo(),e.setSelections(i,!1),e.getTextView().setRedraw(!0)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},handleClosingBracket:function(e){var t=this.editor,i=t.getTextView();if(i.getOptions("readonly"))return!1;var n=t.getModel(),o=t.getSelections();if(1===o.length&&o[0].start===o[0].end){var r=o[0].start===n.getCharCount()?"":n.getText(o[0].start,o[0].start+1);if(r===e)return o[0].start=o[0].end=o[0].start+1,t.setSelections(o),!0;var s=n.getLineAtOffset(o[0].start),a=n.getLine(s,!0);if(a.match(/^\s*$/)&&i.getOptions("tabMode")){var l=i.getOptions("tabSize"),d=new Array(l+1).join(" "),h=n.getLineStart(s),c=n.getLineEnd(s);if(h!==c){if(0===a.indexOf(" "))return a=a.substring(1),n.setText(a,h,c),t.setSelection(o[0].start-1,o[0].end-1),!1;if(0===a.indexOf(d))return a=a.substring(l),n.setText(a,h,c),t.setSelection(o[0].start-l,o[0].end-l),!1}}}return!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},setAutoPairParentheses:function(e){this.autoPairParentheses=e},setAutoPairBraces:function(e){this.autoPairBraces=e},setAutoPairSquareBrackets:function(e){this.autoPairSquareBrackets=e},setAutoPairAngleBrackets:function(e){this.autoPairAngleBrackets=e},setAutoPairQuotations:function(e){this.autoPairQuotation=e},setAutoCompleteComments:function(e){this.autoCompleteComments=e},setSmartIndentation:function(e){this.smartIndentation=e}},c.SourceCodeActions=d,String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,"")}),String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")}),c}),define("orion/editor/undoStack",[],function(){function e(e,t,i,n,o){this.model=e,this.offset=t,this.text=i,this.previousText=n,this.type=o}function t(e){this.owner=e,this.changes=[]}function i(e,t){this.size=void 0!==t?t:100,this.reset();var i=this;if(this._listener={onChanging:function(e){i._onChanging(e)},onDestroy:function(e){i._onDestroy(e)}},e.getModel){var n=e.getModel();n.getBaseModel&&(n=n.getBaseModel()),this.model=n,this.setView(e)}else this.shared=!0,this.model=e;this.model.addEventListener("Changing",this._listener.onChanging)}return e.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(e,t){return this._doUndoRedo(this.offset,this.previousText,this.text,e,t),!0},redo:function(e,t){return this._doUndoRedo(this.offset,this.text,this.previousText,e,t),!0},merge:function(e,t,i,n,o){if(n===this.type){if(1===n&&e===this.offset+this.text.length)return this.text+=t,!0;if(-1===n&&o===this.offset)return this.offset=e,this.previousText=i+this.previousText,!0;if(-1===n&&e===this.offset)return this.previousText=this.previousText+i,!0}return!1},_doUndoRedo:function(e,t,i,n,o){if(this.model.setText(t,e,e+i.length),o&&n){var r=n.getModel();r!==this.model&&(e=r.mapOffset(e,!0)),n.setSelection(e,e+t.length)}}},t.prototype={getRedoChanges:function(){for(var e=[],t=0;t=0;t--)e=e.concat(this.changes[t].getUndoChanges());return e},add:function(e){this.changes.push(e)},end:function(e){e&&(this.endSelection=e.getSelections());var t=this.owner;t&&t.end&&t.end()},undo:function(e,t){this.changes.length>1&&e&&e.setRedraw(!1);for(var i=this.changes.length-1;i>=0;i--)this.changes[i].undo(e,!1);t&&e&&e.setSelections(this.startSelection),this.changes.length>1&&e&&e.setRedraw(!0);var n=this.owner;return n&&n.undo&&n.undo(),this.changes.length>0},redo:function(e,t){this.changes.length>1&&e&&e.setRedraw(!1);for(var i=0;i1,e&&e.setRedraw(!0);var n=this.owner;return n&&n.redo&&n.redo(),this.changes.length>0},merge:function(e,t,i,n,o,r){var s=this.changes.length;return s>0&&this===r?this.changes[s-1].merge(e,t,i,n,o):!1},start:function(e){e&&(this.startSelection=e.getSelections());var t=this.owner;t&&t.start&&t.start()}},i.prototype={destroy:function(){this._onDestroy()},add:function(e){if(this.compoundChange)this.compoundChange.add(e);else{var t=this.stack.length;this.stack.splice(this.index,t-this.index,e),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--)}},markClean:function(){this._commitUndo(),this.cleanChange=this.stack[this.index-1],this.cleanChange&&(this.cleanChange.type=2)},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return this.index>0},canRedo:function(){return this.stack.length-this.index>0},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view),this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var e=[],t=this.index;t=0;t--)e=e.concat(this.stack[t].getUndoChanges());return e},undo:function(){this._commitUndo();var e,t=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;e=this.stack[--this.index]}while(!(t=e.undo(this.view,!0)));return this._ignoreUndo=!1,t},redo:function(){this._commitUndo();var e,t=!1;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;e=this.stack[this.index++]}while(!(t=e.redo(this.view,!0)));return this._ignoreUndo=!1,t},reset:function(){this.index=0,this.cleanChange=void 0,this.stack=[],this._ignoreUndo=!1,this._compoundChange=void 0},setView:function(e){this.view!==e&&(this.view&&e.removeEventListener("Destroy",this._listener.onDestroy),this.view=e,this.view&&e.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(e){this._commitUndo();var i=new t(e);return this.add(i),this.compoundChange=i,this.compoundChange.start(this.view),this.compoundChange},_commitUndo:function(){this.endCompoundChange()},_onDestroy:function(e){e&&this.shared||this.model.removeEventListener("Changing",this._listener.onChanging),this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_trackUnsavedChanges:function(e){if(this._unsavedChanges){var t=this._unsavedChanges.length,i=e.addedCharCount,n=e.removedCharCount,o=e.start,r=e.start+n,s=0;if(0===i?s=-1:0===n&&(s=1),t>0&&s===this._previousChangeType){var a=this._unsavedChanges[t-1];if(0===n&&o===a.end+a.text.length)return void(a.text+=e.text);if(0===e.addedCharCount&&r===a.start)return void(a.start=o)}this._previousChangeType=s,this._unsavedChanges.push({start:o,end:r,text:e.text})}},_onChanging:function(t){if(this._trackUnsavedChanges(t),!this._ignoreUndo){var i=t.text,n=t.start,o=t.addedCharCount,r=t.removedCharCount,s=n+r,a=0;0===o&&1===r?a=-1:1===o&&0===r&&(a=1);var l=this.stack.length,d=this.model.getText(n,s);if(l>0&&this.index===l){var h=this.stack[l-1];if(h.merge(n,i,d,a,s,this.compoundChange))return}this.add(new e(this.model,n,i,d,a))}}},{UndoStack:i}}),define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/textView","orion/editor/annotations","orion/editor/tooltip","orion/objects","orion/editor/util","orion/util"],function(e,t,i,n,o,r,s){function a(e,t,i){this._location=e||"left",this._overview=t||"page",this._rulerStyle=i,this._view=null}function l(e,t,i,n){a.call(this,t,i,n);var o=this;this._listener={onTextModelChanged:function(e){o._onTextModelChanged(e)},onAnnotationModelChanged:function(e){o._onAnnotationModelChanged(e)}},this.setAnnotationModel(e)}function d(e,t,i,n,o){l.call(this,e,t,"page",i),this._oddStyle=n||{style:{backgroundColor:"white"}},this._evenStyle=o||{style:{backgroundColor:"white"}},this._numOfDigits=0,this._firstLine=1}function h(e,t,i){l.call(this,e,t,"page",i)}function c(e,t,i){l.call(this,e,t,"document",i)}function u(e,t,i){h.call(this,e,t,i)}a.prototype={getLocation:function(){return this._location},getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},setView:function(e){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged),this._view=e,this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)}},l.prototype=o.mixin(new a,{getAnnotations:function(e,t){var i=this._annotationModel;if(!i)return[];var n=this._view.getModel(),o=n.getLineStart(e),r=n.getLineEnd(t-1),s=n;n.getBaseModel&&(s=n.getBaseModel(),o=n.mapOffset(o),r=n.mapOffset(r));for(var a=[],l=this.getAnnotationsByType(i,o,r),d=0;d=p;p++){var f=p;if(n!==s){var g=s.getLineStart(p);if(g=n.mapOffset(g,!0),-1===g)continue;f=n.getLineAtOffset(g)}if(f>=e&&t>f){var _=this._mergeAnnotation(a[f],h,p-c,u-c+1);_&&(a[f]=_)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var m in a)a[m]._multiple&&(a[m].html=a[m].html+this._multiAnnotationOverlay.html);return a},getAnnotationModel:function(){return this._annotationModel},getWidestAnnotation:function(){return null},setAnnotationModel:function(e){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged),this._annotationModel=e,this._annotationModel&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(e){this._multiAnnotation=e},setMultiAnnotationOverlay:function(e){this._multiAnnotationOverlay=e},onClick:function(e){if(void 0!==e){var t,i,o,r=this._view,s=r.getModel(),a=s.getLineStart(e),l=s.getLineEnd(e,!0),d=r.getSelection().start,h=r.getSelection().end,c=this._annotationModel;if(c){s.getBaseModel&&(a=s.mapOffset(a),l=s.mapOffset(l),d=s.mapOffset(d),h=s.mapOffset(h));var u=this;t=this._findNextAnnotation(c,a,l,d,h,function(e){return u.isAnnotationTypeVisible(e)}),i=t?t.start:a,o=t?t.end:a,s.getBaseModel&&(i=s.mapOffset(i,!0),o=s.mapOffset(o,!0)),t&&void 0!==t.groupId&&(this._currentClickGroup=this._currentClickGroup===t.groupId?null:t.groupId,this._setCurrentGroup(e))}this._view.setSelection(o,i,1/3,function(){});var p=n.Tooltip.getTooltip(this._view);p&&(t&&"left"===this.getLocation()?p.show({getTooltipInfo:function(){return u._getTooltipInfo([t])}},!1,!1):p.hide())}},onDblClick:function(){},onMouseMove:function(e,t){var i=n.Tooltip.getTooltip(this._view);if(i&&(!i.isVisible()||this._tooltipLineIndex!==e)&&(this._tooltipLineIndex=e,t.clientX!==this._lastMouseX||t.clientY!==this._lastMouseY)){this._lastMouseX=t.clientX,this._lastMouseY=t.clientY,this._hoverTimeout&&(window.clearTimeout(this._hoverTimeout),this._hoverTimeout=null);var o=t.target?t.target:t.srcElement,r=o.getBoundingClientRect();this._curElementBounds=Object.create(null),this._curElementBounds.top=r.top,this._curElementBounds.left=r.left,this._curElementBounds.height=r.height,this._curElementBounds.width=r.width,o===this.node&&(this._curElementBounds.top=t.clientY,this._curElementBounds.height=1);var s=this;s._hoverTimeout=window.setTimeout(function(){s._hoverTimeout=null,i.onHover({getTooltipInfo:function(){var e=s._getAnnotationsAtLineIndex(s._tooltipLineIndex),i=s._getTooltipContents(s._tooltipLineIndex,e);return s._getTooltipInfo(i,t.clientY,{source:"ruler",rulerLocation:s.getLocation()})}},t.clientX,t.clientY)},175)}},onMouseOver:function(e,t){this.onMouseMove(e,t),this._currentClickGroup||this._setCurrentGroup(e)},onMouseOut:function(){this._currentClickGroup||this._setCurrentGroup(-1),this._hoverTimeout&&(window.clearTimeout(this._hoverTimeout),this._hoverTimeout=null)},_findNextAnnotation:function(e,t,i,n,o,r){var s,a=null,l=t;if(n>=0&&o>=0&&n>=t&&i>n){l=n;for(var d=e.getAnnotations(n,o);!s&&d.hasNext();){var h=d.next();(!r||r(h.type))&&h.start===n&&h.end===o&&(s=h)}}for(var c,u=e.getAnnotations(l,i);u.hasNext();)if(h=u.next(),!r||r(h.type)){if(a||(a=h),!s){a=h;break}if(c&&(s.start!==h.start||s.end!==h.end)){c=!1,a=h;break}s&&s===h&&(c=!0)}return c&&(a=null),a},_getAnnotationsAtLineIndex:function(e){if(void 0!==e){var t,i=this._view,n=this._annotationModel,o=[];if(!i)return[];if(t=i.getModel(),n&&t){var r=t.getLineStart(e),s=t.getLineEnd(e);t.getBaseModel&&(r=t.mapOffset(r),s=t.mapOffset(s)),o=this.getAnnotationsByType(n,r,s)}return o}},_getTooltipInfo:function(e,t,i){if(!e)return null;var n=Object.create(null);n.top=this._curElementBounds.top,n.left=this._curElementBounds.left,n.height=this._curElementBounds.height,n.width=this._curElementBounds.width,"string"==typeof e&&t&&(n.top=t,n.height=1);var o=this.getLocation(),r=this.getRulerStyle(),s="left"===o?"right":"left",a=0,l=0;if(this._view){var d=this._view._clientDiv.getBoundingClientRect();a=d.left-(n.left+n.width)}else a=n.width;l=n.height,"left"===s&&(a=-25,1===n.height&&(a+=2)),r.styleClass.indexOf("folding")>=0&&(l-=14);var h={contents:e,position:s,tooltipOffsetX:a,tooltipOffsetY:l,anchorArea:n,context:i};return h},_getTooltipContents:function(e,t){return t},_getOnClickTooltipInfo:function(e){var t=this._view,i=Object.create(null);i.top=this._curElementBounds.top,i.left=this._curElementBounds.left,i.height=this._curElementBounds.height,i.width=this._curElementBounds.width;var n=this.getLocation(),o="left"===n?"right":"left",r={contents:[e],position:o,anchorArea:i};if(t){var s=t._clientDiv.getBoundingClientRect();r.offsetX=s.left-(i.left+i.width)}else r.offsetX=i.width;return r.offsetY=i.height,"left"===r.position&&(r.offsetX=20),r},_onAnnotationModelChanged:function(e){function t(e){for(var t=0;t=l&&void 0!==t.groupId){o=t;break}if(s&&o&&s.groupId===o.groupId)return}if(this._currentGroupAnnotation=null,s&&n.removeAnnotations(s.groupType),o&&-1!==e){this._currentGroupAnnotation=o,i=n.getAnnotations();for(var d=[];i.hasNext();)t=i.next(),delete t.groupAnnotation,t.groupId===o.groupId&&(t=t.createGroupAnnotation(),d.push(t));n.replaceAnnotations(null,d)}}}),i.AnnotationTypeList.addMixin(l.prototype),d.prototype=new l,d.prototype.getAnnotations=function(e,t){for(var i=l.prototype.getAnnotations.call(this,e,t),n=this._view.getModel(),o=e;t>o;o++){var r=o-this._firstLine&1?this._oddStyle:this._evenStyle,s=o;if(n.getBaseModel){var a=n.getLineStart(s);s=n.getBaseModel().getLineAtOffset(n.mapOffset(a))}i[o]||(i[o]={}),i[o].html=this._firstLine+s+"",i[o].style||(i[o].style=r)}return i},d.prototype.getWidestAnnotation=function(){var e=this._view.getModel().getLineCount();return this.getAnnotations(e-1,e)[e-1]},d.prototype.setFirstLine=function(e){this._firstLine=void 0!==e?e:1},d.prototype._onTextModelChanged=function(e){var t=e.start,i=this._view.getModel(),n=i.getBaseModel?i.getBaseModel().getLineCount():i.getLineCount(),o=(this._firstLine+n-1+"").length;if(this._numOfDigits!==o){this._numOfDigits=o;var r=i.getLineAtOffset(t);this._view.redrawLines(r,i.getLineCount(),this)}},h.prototype=new l,c.prototype=new l,c.prototype.getRulerStyle=function(){var e={style:{lineHeight:"1px",fontSize:"1px"}};return e=this._mergeStyle(e,this._rulerStyle)},c.prototype._getTooltipContents=function(t,i){if(i&&0===i.length){var n=this._view.getModel(),o=t;if(n.getBaseModel){var r=n.getLineStart(o);o=n.getBaseModel().getLineAtOffset(n.mapOffset(r))}return s.formatMessage(e.line,o+1)}return l.prototype._getTooltipContents.call(this,t,i)},c.prototype._mergeAnnotation=function(e,t,i,n){if(0!==i)return void 0;var o=e;if(!o){var r=3*n;o={html:" ",style:{style:{height:r+"px"}}},o.style=this._mergeStyle(o.style,t.overviewStyle)}return o},u.prototype=new h,u.prototype.onClick=function(e){if(void 0!==e){var t=this._annotationModel;if(t){var i=this._view,o=i.getModel(),r=o.getLineStart(e),s=o.getLineEnd(e,!0);o.getBaseModel&&(r=o.mapOffset(r),s=o.mapOffset(s),o=o.getBaseModel());for(var a,l=t.getAnnotations(r,s);!a&&l.hasNext();){var d=l.next();this.isAnnotationTypeVisible(d.type)&&o.getLineAtOffset(d.start)===o.getLineAtOffset(r)&&(a=d)}if(a){var h=n.Tooltip.getTooltip(this._view);h&&h.hide(),a.expanded?a.collapse():a.expand()}}}},u.prototype._getTooltipContents=function(e,t){if(t&&t.length>0){var i=this._view,n=i.getModel(),o=n.getLineStart(e);n.getBaseModel&&(o=n.mapOffset(o),n=n.getBaseModel());for(var r=n.getLineAtOffset(o),s=0;s=e.end?s-=e.end-e.start:s>=e.start&&(s=e.start)}),i.setText(r,s,s),i.setSelection(s,s+r.length),this._dropText=null,this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange(),this._dragSelection=null}},_onDragEnter:function(e){this._onDragOver(e)},_onDragOver:function(t){var i=t.event.dataTransfer.types,n=!this._view.getOptions("readonly");if(n&&i&&(n=i.contains?i.contains("text/plain")||i.contains("Text"):-1!==i.indexOf("text/plain")||-1!==i.indexOf("Text")),n){if(!e.isFirefox){var o=e.isMac?t.event.altKey:t.event.ctrlKey;this._dropEffect=t.event.dataTransfer.dropEffect=o?"copy":"move"}}else t.event.dataTransfer.dropEffect="none"},_onDrop:function(t){var i=this._view,n=t.event.dataTransfer.getData("Text");if(n){e.isFirefox||(t.event.dataTransfer.dropEffect=this._dropEffect);
-var o=i.getOffsetAtLocation(t.x,t.y);this._dragSelection?(this._dropOffset=o,this._dropText=n):(i.setText(n,o,o),i.setSelection(o,o+n.length))}}},{TextDND:t}}),define("orion/editor/linkedMode",["i18n!orion/editor/nls/messages","orion/keyBinding","orion/editor/keyModes","orion/editor/annotations","orion/objects","orion/util"],function(e,t,i,n,o){function r(e){this._data=e}function s(e,t,n){var o=e.getTextView();i.KeyMode.call(this,o),this.editor=e,this.undoStack=t,this.contentAssist=n,this.linkedModeModel=null,o.setAction("linkedModeEnter",function(){return this.exitLinkedMode(!0),!0}.bind(this)),o.setAction("linkedModeCancel",function(){return this.exitLinkedMode(!1),!0}.bind(this)),o.setAction("linkedModeNextGroup",function(){var e=this.linkedModeModel;return this.selectLinkedGroup((e.selectedGroupIndex+1)%e.groups.length),!0}.bind(this)),o.setAction("linkedModePreviousGroup",function(){var e=this.linkedModeModel;return this.selectLinkedGroup(e.selectedGroupIndex>0?e.selectedGroupIndex-1:e.groups.length-1),!0}.bind(this)),this.linkedModeListener={onActivating:function(){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(e){if(!this.ignoreVerify){for(var t,i,n=this.editor.mapOffset(e.start),o=this.linkedModeModel;o&&(t=this._getPositionChanged(o,n,n+e.removedCharCount),i=t.position,void 0===i||i.model!==o);)this.exitLinkedMode(!1),o=this.linkedModeModel;if(o){for(var r,s,a=0,l=e.addedCharCount-e.removedCharCount,d=t.positions,h=0;h=0;g--)d=u[g],d.model===s&&d.group===i.group&&n.setText(e.text,d.oldOffset+p,d.oldOffset+f,!1);this.ignoreVerify=!1,e.text=null,this._updateAnnotations(u)}}}.bind(this)}}var a={};return r.prototype={chop:function(e,t){return t.substring(e.length)},computeProposals:function(e,t,i){var n=i.prefix,o=[],r=this._data.style?this._data.style:null;r=r?r:"emphasis";for(var s=this._data.values,a=0;a=0;r--)if(!o[r].escape){var s=o[r].position;if(s.offset<=t&&i<=s.offset+s.length){n=o[r];break}}return{position:n,positions:o}},_updateAnnotations:function(e){var t=this.editor.getAnnotationModel();if(t){for(var i,o=[],r=[],s=t.getAnnotations();s.hasNext();)switch(i=s.next(),i.type){case n.AnnotationType.ANNOTATION_LINKED_GROUP:case n.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case n.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:o.push(i)}var a=this.linkedModeModel;if(a){e=e||this._getSortedPositions(a);for(var l=0;l0?(localStorage.setItem(this._prefix+this._offsetStorageLabel,this._offset),this._closed=!1):this._closed=!0,e!==this._closed&&(localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null),i.logEvent("preferenceChange","splitterClosed",this._prefix,this._closed?0:1))},_mouseDown:function(e){return e.target===this._thumb?(n.stop(e),this._thumbDown()):void(this._tracking||(this._down(e),this._tracking=this._mouseMove.bind(this),window.addEventListener("mousemove",this._tracking),n.setFramesEnabled(!1),n.stop(e)))},_mouseMove:function(e){this._tracking&&(this._move(e.clientX,e.clientY),this._resize())},_mouseUp:function(e){this._tracking&&(n.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this._up(),n.stop(e))},_touchStart:function(e){var t=e.touches;if(1===t.length){if(n.stop(e),e.target===this._thumb)return this._thumbDown();this._down(e),this._touching=!0}},_touchMove:function(e){if(this._touching){var t=e.touches;if(1===t.length){var i=t[0];this._move(i.clientX,i.clientY)}}},_touchEnd:function(e){var t=e.touches;0===t.length&&(this._touching=!1,this._up())}},o.prototype.constructor=o,{Splitter:o,ORIENTATION_HORIZONTAL:r,ORIENTATION_VERTICAL:s}}),define("text!orion/compare/sideBySideTemplate.html",[],function(){return'\r\n'}),define("orion/compare/compareUIFactory",["orion/webui/littlelib","orion/webui/splitter","text!orion/compare/sideBySideTemplate.html"],function(e,t,i){var n=n||{};return n.TwoWayCompareUIFactory=function(){function n(e){this._parentDivID=e.parentDivID,this._commandSpanId=e.commandSpanId,this._showTitle=e.showTitle,this._leftTitle=e.leftTitle,this._rightTitle=e.rightTitle,this._showLineStatus=e.showLineStatus}return n.prototype={_init:function(){var t=this._parentDivID+"_";this._topWidgetDiv=e.node("topWidget_id"),this._topWidgetDiv.id=t+"topWidget_id",this._leftEditorParentDiv=e.node("left_editor_id"),this._leftEditorParentDiv.id=t+"left_editor_id",this._rightEditorParentDiv=e.node("right_editor_id"),this._rightEditorParentDiv.id=t+"right_editor_id",this._rightEditorWrapperDiv=e.node("right_editor_wrapper_id"),this._rightEditorWrapperDiv.id=t+"right_editor_wrapper_id",this._leftActionDiv=e.node("left_action_id"),this._leftActionDiv.id=t+"left_action_id",this._rightActionDiv=e.node("right_action_id"),this._rightActionDiv.id=t+"right_action_id",this._leftTitleDiv=e.node("left_title_id"),this._leftTitleDiv.id=t+"left_title_id",this._rightTitleDiv=e.node("right_title_id"),this._rightTitleDiv.id=t+"right_title_id",this._leftStatusDiv=e.node("left_status_id"),this._leftStatusDiv.id=t+"left_status_id",this._rightStatusDiv=e.node("right_status_id"),this._rightStatusDiv.id=t+"right_status_id",this._diffCanvasDiv=e.node("diff_canvas_id"),this._diffCanvasDiv.id=t+"diff_canvas_id",this._splitterId=t+"orion_splitter",this._showTitle||this.disableTitle(),this._showLineStatus||this.disableLineStatus()},_createSplitter:function(){var i=e.$(".split",this._topWidgetDiv);i.id=this._splitterId;var n=e.$(".leftPanelLayout",this._topWidgetDiv),o=e.$(".rightPanelLayout",this._topWidgetDiv);i&&n&&o&&(this._splitter=new t.Splitter({node:i,sidePanel:n,mainPanel:o,proportional:!0}))},buildUI:function(){e.node(this._parentDivID).innerHTML=i,this._init(),this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(t){var i=e.$(".leftPanelLayout",this._topWidgetDiv);return i===t},getEditorParentDiv:function(e){return e?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(e){return e?this._leftTitleDiv:this._rightTitleDiv},getActionDivId:function(e){return e?this._leftActionDiv.id:this._rightActionDiv.id},getStatusDiv:function(e){return e?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},getDiffCanvasDiv:function(){return this._diffCanvasDiv},disableTitle:function(){this._leftEditorParentDiv.style.top="0px",this._rightEditorWrapperDiv.style.top="0px",this._leftTitleDiv.style.height="0px",this._rightTitleDiv.style.height="0px"},disableLineStatus:function(){this._leftEditorParentDiv.style.marginBottom="0px",this._rightEditorWrapperDiv.style.marginBottom="0px",this._leftStatusDiv.style.height="0px",this._rightStatusDiv.style.height="0px"}},n}(),n});var JsDiff=function(){function e(e){return{newPos:e.newPos,components:e.components.slice(0)}}function t(e){for(var t=[],i=0;i/g,">"),t=t.replace(/"/g,""")}var n=function(e){this.ignoreWhitespace=e};n.prototype={diff:function(t,i,n){if(this.ignoreWhitespace=n,i===t)return[{value:i}];if(!i)return[{value:t,removed:!0}];if(!t)return[{value:i,added:!0}];i=this.tokenize(i),t=this.tokenize(t);var o=i.length,r=t.length,s=o+r,a=[{newPos:-1,components:[]}],l=this.extractCommon(a[0],i,t,0);if(a[0].newPos+1>=o&&l+1>=r)return a[0].components;for(var d=1;s>=d;d++)for(var h=-1*d;d>=h;h+=2){var c,u=a[h-1],p=a[h+1];l=(p?p.newPos:0)-h,u&&(a[h-1]=void 0);var f=u&&u.newPos+1=0&&r>l;if(f||g){!f||g&&u.newPos=o&&l+1>=r)return c.components;a[h]=c}else a[h]=void 0}},pushComponent:function(e,t,i,n,o){var r=e[e.length-1];r&&r.added===n&&r.removed===o?e[e.length-1]={value:this.join(r.value,t),helperValue:this.join(r.helperValue,i),added:n,removed:o}:e.push({value:t,helperValue:i,added:n,removed:o})},extractCommon:function(e,t,i,n){for(var o=t.length,r=i.length,s=e.newPos,a=s-n;o>s+1&&r>a+1&&this.equals(t[s+1],i[a+1]);)s++,a++,this.pushComponent(e.components,t[s],i[a],void 0,void 0);return e.newPos=s,a},equals:function(e,t){var i=/\S/;return!this.ignoreWhitespace||i.test(e)||i.test(t)?this._equals(e,t):!0},join:function(e,t){return e+t},tokenize:function(e){return e}};var o=new n;o._equals=function(e,t){return e===t};var r=new n(!1);r.tokenize=function(e){return t(e.split(/(\s+|\b)/))},r._equals=function(e,t){return e===t};var s=new n(!0);s.tokenize=function(e){return t(e.split(/([{}:;,]|\s+)/))},s._equals=function(e,t){return e===t};var a=new n;return a.tokenize=function(e){var t=e.split(/^/m);return t&&t.length>0&&!t[t.length-1]&&t.pop(),t},a._equals=function(e,t){if(this.ignoreWhitespace){var i=e.replace(/^\s+|\s+$|\s+(?=\s)/g,""),n=t.replace(/^\s+|\s+$|\s+(?=\s)/g,"");return i===n}return e===t},{diffChars:function(e,t,i){return o.diff(e,t,i)},diffWords:function(e,t,i){return r.diff(e,t,i)},diffLines:function(e,t,i){return a.diff(e,t,i)},diffCss:function(e,t){return s.diff(e,t)},createPatch:function(e,t,i,n,o){var r=[];r.push("Index: "+e),r.push("==================================================================="),r.push("--- "+e+" "+n),r.push("+++ "+e+" "+o);var s=a.diff(t,i);s.push({value:"",lines:[]});for(var l=0,d=0,h=[],c=1,u=1,p=0;p1&&!/\n$/.test(s[s.length-2].value)&&r.push("\\ No newline at end of file\n"),r.join("\n")},convertChangesToXML:function(e){for(var t=[],n=0;n"):o.removed&&t.push(""),t.push(i(o.value)),o.added?t.push(""):o.removed&&t.push("")}return t.join("")}}}();"undefined"!=typeof module&&(module.exports=JsDiff),"function"==typeof define&&define.amd&&define("jsdiff/diff",[],function(){return JsDiff}),define("orion/compare/jsdiffAdapter",["jsdiff/diff"],function(e){var t=t||{};return t.JSDiffAdapter=function(){function t(e){this._ignoreWhitespace=e}return t.prototype={_specialLine:function(e,t,i){return t.value===e&&i!==e},adapt:function(t,i,n){n||(n="\n");for(var o=t.split(n),r=i.split(n),s=""===o[o.length-1],a=""===r[r.length-1],l=e.diffLines(t,i,this._ignoreWhitespace),d=[],h=[],c=0,u=0,p=-1,f=0,g=!0,_=n,m=0;m1&&""===y[y.length-1]&&x--,x>1&&!g&&""===y[0]&&(x--,b++),v.lines=y,v.added||v.removed)if(v.added){-1===p&&(p=h.length+1),c+=x;for(var C=b;x+b>C;C++)h.push(v.lines[C])}else u+=x;else this._specialLine(n,v,_)||((c||u)&&(d.push([c,u,p]),c=0,u=0,p=-1,f+=u),d.push([x,x,0]),f+=x);g=!1,y.length>1&&""===y[y.length-1]&&(g=!0),_=v.value?v.value[v.value.length-1]:n}if((c||u)&&(d.push([c,u,p]),f+=u),f1){var w=d[d.length-1];0===w[2]?(w[0]+=1,w[1]+=1):-1===w[2]?d.push([1,1,0]):s===a?d.push([1,1,0]):(a&&(w[0]+=1),s&&(w[1]+=1))}return{mapper:d,changContents:{array:h,index:0}}},adaptCharDiff:function(t,i,n){for(var o=n?e.diffWords(t,i,this._ignoreWhitespace):e.diffChars(t,i,this._ignoreWhitespace),r=[],s=0,a=0,l=0,d=0,h=0;h0||d>0)&&(r.push([a,a+l,s,s+d]),a+=l,s+=d,l=0,d=0),a+=c.value.length,s+=c.helperValue?c.helperValue.length:c.value.length)}return(l>0||d>0)&&r.push([a,a+l,s,s+d]),r}},t}(),t}),define("orion/treeModelIterator",[],function(){var e={};return e.TreeModelIterator=function(){function e(e,t){this.firstLevelChildren=e,this.reset(),this._init(t)}return e.prototype={_init:function(e){e&&(this.isExpanded=e.isExpanded,this.isExpandable=e.isExpandable,this.forceExpandFunc=e.forceExpandFunc,this.getChildrenFunc=e.getChildrenFunc)},topLevel:function(e){return e.parent?e.parent===this.root:!0},_getChildren:function(e){return"function"==typeof this.getChildrenFunc?this.getChildrenFunc(e):e?e.children:null},_expanded:function(e){if(!e)return!0;var t=this._getChildren(e),i=t&&t.length>0;return this.isExpanded&&i&&(i=this.isExpanded(e)),i},_expandable:function(e){return e?this.isExpandable?this.isExpandable(e):!1:!0},_diveIn:function(e){if(this._expanded(e)){var t=this._getChildren(e);return this.setCursor(t[0]),this.cursor()}return null},_drillToLast:function(e){if(this._expanded(e)){var t=this._getChildren(e);return this._drillToLast(t[t.length-1])}return e},_forward:function(e){if(!this._cursor)return null;var t=this._diveIn(this._cursor);if(!t){if(e&&this._expandable(this._cursor)&&this.forceExpandFunc){var i=this;return this.forceExpandFunc(this._cursor,"first",function(e){e&&i.setCursor(e)})}t=this._findSibling(this._cursor,!0),t&&this.setCursor(t)}return t},_backward:function(e){if(!this._cursor)return null;var t=this._findSibling(this._cursor,!1);if(t&&t!==this._cursor.parent&&(t=this._drillToLast(t)),e&&t&&this._expandable(t)&&this.forceExpandFunc&&t!==this._cursor.parent){var i=this;return this.forceExpandFunc(t,"last",function(e){e&&i.setCursor(e)})}return t&&this.setCursor(t),t},_findSibling:function(e,t){for(var i=this.topLevel(e),n=this._getChildren(e.parent),o=i?this.firstLevelChildren:n,r=0;r0&&(this.root=this.firstLevelChildren[0].parent)},scan:function(e,t){var i=this.cursor(),n=this._scan(!0,e,t);return n||(n=this._scan(!1,e,t)),this.setCursor(i),n},iterate:function(e,t){return e?this._forward(t):this._backward(t)},iterateOnTop:function(e,t){var i=this._findSibling(this._getTopLevelParent(this.cursor()),e);
-i?this.setCursor(i):t&&this.firstLevelChildren.length>0&&this.setCursor(e?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(e){return this._cursor&&this._inParentChain(this._cursor,e)?(this.setCursor(e),this._cursor):null},reset:function(){this._cursor=null,this._prevCursor=null,this.root=null,this.firstLevelChildren.length>0&&(this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent)},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}},e}(),e}),define("orion/compare/diffTreeNavigator",["i18n!orion/compare/nls/messages","orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(e,t,i,n,o){var r={},s={};return r.DiffTreeNavigator=function(){function r(e,t,i,n,o,r){this._root={type:"root",children:[]},this._initialized=!1,this.initAll(e,t,i,n,o,r)}s.ANNO_DIFF_ADDED_BLOCK="orion.annotation.diff.addedBlock",s.ANNO_DIFF_CURRENT_ADDED_BLOCK="orion.annotation.diff.currentAddedBlock",s.ANNO_DIFF_DELETED_BLOCK="orion.annotation.diff.deletedBlock",s.ANNO_DIFF_CURRENT_DELETED_BLOCK="orion.annotation.diff.currentDeletedBlock",s.ANNO_DIFF_BLOCK_TOPONLY="orion.annotation.diff.blockTop",s.ANNO_DIFF_CURRENT_BLOCK_TOPONLY="orion.annotation.diff.currentBlockTop",s.ANNO_DIFF_BLOCK_CONFLICT="orion.annotation.diff.blockConflict",s.ANNO_DIFF_CURRENT_BLOCK_CONFLICT="orion.annotation.diff.currentBlockConflict",s.ANNO_DIFF_ADDED_WORD="orion.annotation.diff.addedWord",s.ANNO_DIFF_CURRENT_ADDED_WORD="orion.annotation.diff.currentAddedWord",s.ANNO_DIFF_DELETED_WORD="orion.annotation.diff.deletedWord",s.ANNO_DIFF_CURRENT_DELETED_WORD="orion.annotation.diff.currentDeletedWord",s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT="orion.annotation.diff.emptyDeletedWordLeft",s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT="orion.annotation.diff.emptyDeletedWordRight",s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT="orion.annotation.diff.emptyAddedWordLeft",s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT="orion.annotation.diff.emptyAddedWordRight",n.AnnotationType.registerType(s.ANNO_DIFF_ADDED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_ADDED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_DELETED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_DELETED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_BLOCK_TOPONLY,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_BLOCK_TOPONLY,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}}),n.AnnotationType.registerType(s.ANNO_DIFF_BLOCK_CONFLICT,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_BLOCK_CONFLICT,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}}),n.AnnotationType.registerType(s.ANNO_DIFF_ADDED_WORD,{title:e["word added"],html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_ADDED_WORD,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_DELETED_WORD,{title:e["word deleted"],html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_DELETED_WORD,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});var a=5e3;return r.prototype={initAll:function(e,t,i,n,o,r,s){this._charOrWordDiff=e?e:"word",t&&(this._initialized=!0),this.editorWrapper=[{editor:t,diffFeeder:n},{editor:i,diffFeeder:o}],this._curveRuler=s,this._overviewRuler=r,this._overviewRuler&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(e){if(e)for(var t=0;t0&&this.iterator.iterate(e),this.updateCurrentAnnotation(!0)}return t},gotoChangeUsingIndex:function(e){var t=0,i=0;if(e>=0)for(;it+n-1)){var o=e-t;return this.gotoBlock(i,o)}t+=n,i++}},gotoBlock:function(e,t){this.iterator&&((0>e||e>=this._root.children.length||0===this._root.children.length)&&(e=0),this.iterator.setCursor(void 0!==t&&t>=0&&this._root.children[e].children&&t=r.start&&t<=r.end){var s=o;if(o.children&&o.children.length>0)for(var a=0;a=d.start&&t<=d.end){s=l;break}}return s}}return null}},gotoChange:function(e,t){for(var i=0;ie&&(e=0);var t=this.getFeeder().getDiffBlocks();return t&&0!==t.length?(e>t.length-1&&(e=0),t[e][1]):-1},replaceDiffAnnotations:function(e,t,i,n){if(t&&i){var o=e.getAnnotationModel();if(o){for(var r=o.getAnnotations(),s=[];n&&r.hasNext();){var a=r.next();a.type===i&&s.push(a)}o.replaceAnnotations(s,t)}}},updateCurrentAnnotation:function(e,t){if(this.replaceAllAnnotations(!0,0,"block",!1,[]),this.replaceAllAnnotations(!0,1,"block",!1,[]),this.replaceAllAnnotations(!0,0,"word",!1,[]),this.replaceAllAnnotations(!0,1,"word",!1,[]),this.iterator){var i=this.iterator.cursor();if(i){var o,r,s={start:i.oldA.start,end:i.oldA.end},a={start:i.newA.start,end:i.newA.end};"word"===i.type?(o=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(s,this.editorWrapper[0].editor.getTextView().getModel()),r=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(a,this.editorWrapper[1].editor.getTextView().getModel())):(o=this.editorWrapper[0].diffFeeder.getCurrentBlockAnnoType(i.index),r=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(i.index)),o&&this.replaceDiffAnnotations(this.editorWrapper[0].editor,[new(n.AnnotationType.getType(o.current))(s.start,s.end)],o,!0),r&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new(n.AnnotationType.getType(r.current))(a.start,a.end)],r,!0),e?(this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(i.oldA.start,i.oldA.end,!0),this.editorWrapper[1].editor.setSelection(i.newA.start,i.newA.end,!0),this.autoSelecting=!1):t&&(this.autoSelecting=!0,t!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(i.oldA.start,i.oldA.end,!0),t!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(i.newA.start,i.newA.end,!0),this.autoSelecting=!1)}}},generatePairBlockAnnotations:function(e,t){var i=this.generateBlockDiffAnnotations(0,t),n=this.generateBlockDiffAnnotations(1,t);return{parent:e,index:t,type:"block",oldA:i,newA:n}},generatePairWordAnnotations:function(e,t,i){var n=this.editorWrapper[0].diffFeeder.getTextOnBlock(t),o=this.editorWrapper[1].diffFeeder.getTextOnBlock(t),r=null,s=0,l=0;if(!(n&&o&&n.text&&o.text&&n.text.length<=a&&o.text.length<=a))return null;r=i.adaptCharDiff(n.text,o.text,"word"===this._charOrWordDiff),l=o.start,s=n.start;var d=[],h=[];this.generateWordDiffAnnotations(0,d,s,r,2,3),this.generateWordDiffAnnotations(1,h,l,r,0,1);for(var c=[],u=0;u0?t-o:0)},_positionDiffBlock:function(){var e=this.getCurrentBlockIndex();0>e&&(e=0);var t=this.getFeeder().getDiffBlocks();if(0!==t.length){if(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),t[e][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor){var n=i.lookUpLineIndex(this.getMapper(),0,t[e][1]);this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),n)}this._updateOverviewRuler(),this._updateCurveRuler()}},matchPositionFromOverview:function(e){if(this._initialized){var t;t=0>e?0:i.getAnnotationIndex(this.getFeeder().getDiffBlocks(),e),this.gotoBlock(t)}},gotoDiff:function(e,t){this.gotoChange(e,t)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,!0),this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0),this._positionDiffBlock()},nextChange:function(){var e=this.iterateOnChange(!0);return this._positionDiffBlock(),e},prevChange:function(){this.iterateOnChange(!1),this._positionDiffBlock()}},r}(),r.DiffBlockFeeder=function(){function e(){}return e.prototype={_isAddedSide:function(){return 0===this._mapperColumnIndex},getWordAnnoTypes:function(e){e.push(this._isAddedSide()?{type:"word",current:s.ANNO_DIFF_CURRENT_ADDED_WORD,normal:s.ANNO_DIFF_ADDED_WORD,list:[]}:{type:"word",current:s.ANNO_DIFF_CURRENT_DELETED_WORD,normal:s.ANNO_DIFF_DELETED_WORD,list:[]}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT})},getCurrentWordAnnoType:function(e,t){return e.start===e.end&&t?this._isAddedSide()?{current:this._repositionEmptyWord(e,t),normal:s.ANNO_DIFF_ADDED_WORD}:{current:this._repositionEmptyWord(e,t),normal:s.ANNO_DIFF_DELETED_WORD}:this._isAddedSide()?{current:s.ANNO_DIFF_CURRENT_ADDED_WORD,normal:s.ANNO_DIFF_ADDED_WORD}:{current:s.ANNO_DIFF_CURRENT_DELETED_WORD,normal:s.ANNO_DIFF_DELETED_WORD}},_repositionEmptyWord:function(e,t){var i=t.getLineAtOffset(e.start),n=t.getLineStart(i),o=t.getLineEnd(i);return n!==o?e.start===o?(e.start--,this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT:s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT):(e.end++,this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT:s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT):i>0&&(i--,n=t.getLineStart(i),o=t.getLineEnd(i),n!==o)?(e.start=o-1,e.end=o,this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT:s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT):this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT:s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(e){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;var t=this._diffBlocks[e][1];return-1===t?0:this._mapper[t][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},getLineNumber:function(e){return e},getCharRange:function(e){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var t=this._diffBlocks[e][1],i=this._diffBlocks[e][0],n=i+this._mapper[t][this._mapperColumnIndex]-1,o=this._textModel.getLineStart(i);if(i>n)return{start:o,end:o};var r=this._textModel.getLineEnd(n,!0);return{start:o,end:r}},getTextOnBlock:function(e){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var t=this._diffBlocks[e][1];0===this._mapper[t][0]||0===this._mapper[t][1]||0===this._mapper[t][2];var i=this.getCharRange(e);return{start:i.start,text:this._textModel.getText(i.start,i.end)}},isMapperEmpty:function(){return 0===this._mapper.length}},e}(),r.TwoWayDiffBlockFeeder=function(){function e(e,t,i,n){this._mapperColumnIndex=i,this._reverseAnnotation=n,this.init(e,t)}return e.prototype=new r.DiffBlockFeeder,e.prototype._isAddedSide=function(){return this._reverseAnnotation?0!==this._mapperColumnIndex:0===this._mapperColumnIndex},e.prototype.init=function(e,t){if(this._textModel=e,this._diffBlocks=void 0,t){this._mapper=t,this._diffBlocks=[];for(var i=0,n=0;n=this._gapBlocks[t][0]&&e0){if(e.length<1||e.length>2)return;this._syntaxHighlighters=[{highlighter:this.options.highlighters[0],target:e[0]}],2===e.length&&2===this.options.highlighters.length&&this._syntaxHighlighters.push({highlighter:this.options.highlighters[1],target:e[1]})}},_highlightSyntax:function(){if(this._syntaxHighlighters){var e=[];this._syntaxHighlighters.forEach(function(t){e.push(t.highlighter.highlight(t.target.fileName,t.target.contentType,t.target.editor))}.bind(this)),t.all(e,function(e){return{_error:e}}).then(function(){this._diffNavigator.renderAnnotations(this.isWhitespaceIgnored()),this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1),this.dispatchEvent({type:"contentLoaded"}),this.options.toggler&&this.options.toggler.dispatchEvent({type:"contentLoaded"})}.bind(this))}else window.setTimeout(function(){this._diffNavigator.renderAnnotations(this.isWhitespaceIgnored()),this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1),this.dispatchEvent({type:"contentLoaded"}),this.options.toggler&&this.options.toggler.dispatchEvent({type:"contentLoaded"})}.bind(this),50)},isWhitespaceIgnored:function(){return this.getWidget().options.ignoreWhitespace},ignoreWhitespace:function(e){var t=this.getWidget().options;if(t.ignoreWhitespace=e,t.diffProvider&&t.diffContent){var i=e?"true":"false";t.diffProvider._diffProvider.getDiffContent(t.resource,{ignoreWS:i}).then(function(e){t.diffContent=t.hasConflicts?e.split("diff --git")[1]:e,this.getWidget().refresh(!0,!0)}.bind(this),function(){})}else this.getWidget().refresh(!0,!0)},setOptions:function(e,t){if(t&&this._clearOptions(),this.options||(this.options={}),e&&Object.keys(e).forEach(function(t){this.options[t]=e[t]}.bind(this)),e.newFileOnRight){var i=this.options.newFile;this.options.newFile=this.options.oldFile,this.options.oldFile=i}},getOptions:function(){return this.options},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},initDiffNav:function(){this._diffNavigator.gotoBlock(0,0)},nextDiff:function(){this._diffNavigator.nextDiff()},prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){return this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},getWidget:function(){return this},startup:function(){this.initEditors(),this.refresh(!0)},initEditors:function(){},initImageMode:function(){}},e}(),f.TwoWayCompareView=function(){function i(e){f.CompareView.call(this,e),this.setOptions(e,!0),this._diffNavigator=new p.DiffTreeNavigator("word"),this.type="twoWay",this._uiFactory=this.options.uiFactory,this._uiFactory||(this._uiFactory=new h.TwoWayCompareUIFactory({parentDivID:this.options.parentDivId,showTitle:this.options.showTitle?this.options.showTitle:!1,showLineStatus:this.options.showLineStatus?this.options.showLineStatus:!1}),this._uiFactory.buildUI()),this._viewLoadedCounter=0,this.options.commandProvider&&this.options.commandProvider.initCommands(this),this._curveRuler=new r.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv())}return i.prototype=Object.create(f.CompareView.prototype),i.prototype.initEditors=function(t){this.options.preCreate&&this.options.preCreate(),this._editors=[],this._editors.push(this._createEditor(t,this._uiFactory.getEditorParentDiv(!1),this._uiFactory.getStatusDiv(!1),this.options.oldFile)),this._editors.push(this._createEditor(t,this._uiFactory.getEditorParentDiv(!0),this._uiFactory.getStatusDiv(!0),this.options.newFile,!0)),this._overviewRuler=new r.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(e){this._diffNavigator.matchPositionFromOverview(e)}.bind(this)),this.options.postCreate&&this.options.postCreate(),window.onbeforeunload=function(){return this.isDirty()?e["There are unsaved changes."]:void 0}.bind(this)},i.prototype.disableAnnoBookMark=function(){this._disableAnnoBookMark(this._editors)},i.prototype.initImageMode=function(){this._editors&&(this._editors.forEach(function(e){e.destroy()}),this._editors=null),this._uiFactory.getEditorParentDiv(!0).classList.add("compareEditorParentImageMode"),this._uiFactory.getEditorParentDiv().classList.add("compareEditorParentImageMode"),this._uiFactory.disableTitle(),this._uiFactory.disableLineStatus(),this._imageMode=!0},i.prototype.getImageMode=function(){return this._imageMode},i.prototype.getEditors=function(){return this._editors},i.prototype.gotoDiff=function(e,t,i){var n=i?this._editors[1].getTextView():this._editors[0].getTextView(),o=n.getModel().getLineStart(e)+t;this._diffNavigator.gotoDiff(o,n)},i.prototype.copyToLeft=function(){this._curveRuler.copyTo(!0)},i.prototype.copyToRight=function(){this._curveRuler.copyTo(!1)},i.prototype.resizeEditors=function(){this._editors.forEach(function(e){e.getTextView().resize()})},i.prototype.getSplitter=function(){return this._uiFactory.getSplitter()},i.prototype._createEditor=function(t,i,n,o,r){var l="undefined"==typeof o.readonly?!0:o.readonly,h=function(){var e=new d.TextView({parent:i,readonly:l,tabSize:4});this._viewLoadedCounter++,2===this._viewLoadedCounter&&this._diffNavigator.matchPositionFromOverview(-1),this.onLoad&&this.onLoad();var t=this.getSplitter();return t&&t.addResizeListener(function(t){if(t){var i=!1;i=this._uiFactory.isLeftPane(t)?r:!r,i&&e.resize()}}.bind(this)),e}.bind(this),c=o.keyBindingFactory;c||(c=new a.KeyBindingsFactory);var u=null;if(n){var p="",f="";u=function(t,i){n&&(f=i?e["ERROR: "]+t:t,n.textContent=p+f)}}var g=new s.Editor({textViewFactory:h,undoStackFactory:new a.UndoFactory,annotationFactory:new a.AnnotationFactory,keyBindingFactory:c,statusReporter:u,domNode:i});g.installTextView(),g.setInput(null,null,o.Content?o.Content:t),g.setOverviewRulerVisible(!1);var _=g.getTextView();return _.addEventListener("Selection",function(e){var t=Array.isArray(e.newValue)?e.newValue:[e.newValue];t.length>1||!t[0].isEmpty()||!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&this._diffNavigator.gotoDiff(t[0].getCaret(),_)}.bind(this)),_.getModel().addEventListener("Changed",function(e){this._curveRuler.onChanged(e,!r)||(this.options.mapper=null)}.bind(this)),r?_.addEventListener("Scroll",function(){this._curveRuler&&(this._curveRuler.matchPositionFrom(!0),this._curveRuler.render()),this.onScroll&&this.onScroll()}.bind(this)):_.addEventListener("Scroll",function(){this._curveRuler&&this._curveRuler.render()}.bind(this)),g},i.prototype.isDirty=function(){return this._editors?this._editors.some(function(e){return e.isDirty()}):!1},i.prototype._destroy=function(){this._editors&&(this._diffNavigator.destroy(),this._editors.forEach(function(e){e.destroy()}),this._uiFactory.destroy())},i.prototype.destroy=function(){this._destroyed=!0,this._destroy()},i.prototype.addRulers=function(){if(this._editors&&!this._hasRuler){var e=new r.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),t=new r.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._editors[1].getTextView().addRuler(e),this._editors[0].getTextView().addRuler(t),this._editors[0].getTextView().addRuler(this._overviewRuler),this._hasRuler=!0}},i.prototype.refresh=function(e,i,n){if(!this._destroyed){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var o=this;return this._loadImageFile(this.options.newFile.URL,this._uiFactory.getEditorParentDiv(!0)).then(function(e){return o._loadImageFile(o.options.oldFile.URL,o._uiFactory.getEditorParentDiv()).then(function(i){return(new t).resolve(e>i?e:i)})})}var r=this._generateMapper(i,this.options.oldFile.Content,this.options.newFile.Content,this.options.diffContent,this.options.hasConflicts,!this.options.toggler),s=this.options.oldFile.Content,a=this.options.newFile.Content;"string"!=typeof a&&(a=r.output);var l=new p.TwoWayDiffBlockFeeder(this._editors[0].getTextView().getModel(),r.mapper,1,this.options.newFileOnRight),d=new p.TwoWayDiffBlockFeeder(this._editors[1].getTextView().getModel(),r.mapper,0,this.options.newFileOnRight);this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editors[0],this._editors[1],l,d,this._overviewRuler,this._curveRuler),this._curveRuler.init(r.mapper,this._editors[1],this._editors[0],this._diffNavigator),e&&("number"==typeof n?1===n?this._editors[1].setInput(this.options.newFile.Name,null,a):this._editors[0].setInput(this.options.oldFile.Name,null,s):(this._editors[1].setInput(this.options.newFile.Name,null,a),this._editors[0].setInput(this.options.oldFile.Name,null,s))),this._initSyntaxHighlighter([{fileName:this.options.newFile.Name,contentType:this.options.newFile.Type,editor:this._editors[1]},{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editors[0]}]),this._highlightSyntax(),this.options.commandProvider&&this.options.commandProvider.renderCommands(this),this.addRulers(),2===this._viewLoadedCounter&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1),this.refreshTitle(0),this.refreshTitle(1);var h=this._editors[1].getTextView().getModel().getLineCount()*this._editors[1].getTextView().getLineHeight()+5,c=this._editors[0].getTextView().getModel().getLineCount()*this._editors[0].getTextView().getLineHeight()+5;return h>c?h:c}},i.prototype.refreshTitle=function(e,t){var i,o=this.options.newFile.Name,r=this.options.oldFile.Name,s="/",a=" ... ",l=o.split(s),d=r.split(s),h=[],c=[],u=!1;for(i=0;i1||!t[0].isEmpty()||!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&this._diffNavigator.gotoDiff(t[0].getCaret(),this._textView)}.bind(this))},i.prototype.disableAnnoBookMark=function(){this._disableAnnoBookMark([this._editor])},i.prototype.initImageMode=function(){this._editor&&(this._editor.destroy(),this._editor=null),n.node(this._editorDiv).classList.add("compareEditorParentImageMode"),this._imageMode=!0},i.prototype.getImageMode=function(){return this._imageMode},i.prototype._initDiffPosition=function(e){var t=e.getModel();if(t&&t.getAnnotations){var i=t.getAnnotations();if(i.length>0){var n=i[0][0],o=e.getLineHeight(),r=e.getClientArea(),s=Math.floor(r.height/o/3);e.setTopIndex(n-s>0?n-s:0)}}},i.prototype.refresh=function(i,o){if(!this._destroyed){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var r=this;return this._loadImageFile(this.options.newFile.URL,n.node(this._editorDiv),!0).then(function(e){return r._loadImageFile(r.options.oldFile.URL,n.node(r._editorDiv)).then(function(i){return(new t).resolve(e+i+20)})})}var s=this._generateMapper(o,this.options.oldFile.Content,this.options.newFile.Content,this.options.diffContent,this.options.hasConflicts,!this.options.toggler);if(s.submoduleChanged)switch(s.submoduleChanged){case"removed":this._textView.getModel().setText(e["Removed Submodule Message"]);break;case"added":this._textView.getModel().setText(e["Added Submodule Message"])}else{this._mapper=s.mapper,this._textView.getModel().setText(this.options.oldFile.Content);var a=new p.inlineDiffBlockFeeder(s.mapper,1),l=new p.inlineDiffBlockFeeder(s.mapper,0);c.mergeDiffBlocks(this._textView.getModel(),l.getDiffBlocks(),s.mapper,s.diffArray.array,s.diffArray.index,this._diffParser._lineDelimiter),a.setModel(this._textView.getModel()),l.setModel(this._textView.getModel()),this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editor,this._editor,a,l,this._overviewRuler),this._initSyntaxHighlighter([{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editor}]),this._highlightSyntax(),this.options.commandProvider&&this.options.commandProvider.renderCommands(this),this.removeRulers(),this.addRulers();var d=this._textView.getTopIndex();this._textView.redrawLines(d,d+1,this._overviewRuler),this._textView.redrawLines(d,d+1,this._rulerOrigin),this._textView.redrawLines(d,d+1,this._rulerNew),this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)}return this._textView.getLineHeight()*this._textView.getModel().getLineCount()+5}},i.prototype.setConflicting=function(e){this._conflcit=e},i.prototype.gotoDiff=function(e){this._diffNavigator.gotoChangeUsingIndex(e)},i.prototype.gotoLine=function(e,t,i,n){"number"!=typeof t&&(t=0);var o=c.convertMergedLineNumber(this._mapper,e),r=function(){n(o)}.bind(this);this._editor.onGotoLine(o,t,i,r)},i.prototype.getMainEditor=function(){return this._editor?this._editor:null},i.prototype.getLineNumber=function(e,t,i){if(t){var n=this._diffNavigator.getFeeder(i?!1:!0);return n?n.getLineNumber(e):e}var o=c.convertMergedLineNumber(this._mapper,e,i);return o},i}(),f.toggleableCompareView=function(){function e(e,t){i.attach(this),t&&(t.toggler=this),this._widget="inline"===e?new f.InlineCompareView(t):new f.TwoWayCompareView(t)}return e.prototype={startup:function(){this._widget.startup()},initImageMode:function(){this._imageMode=!0,this._widget.initImageMode()},_toggle:function(e){this._widget.destroy(),n.empty(n.node(e.parentDivId)),this._widget="inline"===this._widget.type?new f.TwoWayCompareView(e):new f.InlineCompareView(e),this._imageMode?this._widget.initImageMode():this._widget.initEditors(),this._widget.refresh(!0),e.onInputChanged&&"twoWay"===this._widget.type&&e.onInputChanged()},toggle:function(){var e=this._widget.options;if(!this._imageMode){var t=this._widget.getCurrentDiffPos();e.blockNumber=t.block,e.changeNumber=t.change}this._toggle(e)},isDirty:function(){return this._widget.isDirty()},destroy:function(){return this._widget.destroy()},getWidget:function(){return this._widget}},e}(),f}),define("orion/compare/compareCommands",["i18n!orion/compare/nls/messages","orion/commands","orion/Deferred","orion/keyBinding","orion/webui/littlelib","orion/EventTarget"],function(e,t,i,n,o,r){var s={};return s.CompareCommandFactory=function(){function s(e){r.attach(this),this.setOptions(e,!0)}return s.prototype={setOptions:function(e,t){t&&(this.options={}),this.options||(this.options={}),e&&Object.keys(e).forEach(function(t){this.options[t]=e[t]}.bind(this))},getOptions:function(){return this.options},initCommands:function(o){var r=this.options.commandSpanId,s=this.options.toggleCommandSpanId,a=this.options.commandService;if(a&&(r||s)){var l=new t.Command({name:e.CpCurChangeRightToLeft,tooltip:e.CpCurChangeRightToLeft,imageClass:"core-sprite-leftarrow",id:"orion.compare.copyToLeft",groupId:"orion.compareGroup",visibleWhen:function(){return"twoWay"===o.type&&!o.getImageMode()&&o.options.newFile&&!o.options.newFile.readonly}.bind(this),callback:function(e){e.items.copyToLeft()}}),d=new t.Command({name:e.CpCurChangeLeftToRight,tooltip:e.CpCurChangeLeftToRight,imageClass:"core-sprite-rightarrow",id:"orion.compare.copyToRight",groupId:"orion.compareGroup",visibleWhen:function(){return"twoWay"===o.type&&!o.getImageMode()&&o.options.oldFile&&!o.options.oldFile.readonly}.bind(this),callback:function(e){e.items.copyToRight()}}),h=new t.Command({tooltip:e.IgnoreWhitespaceTooltip,name:e.IgnoreWhitespace,imageClass:"core-sprite-whitespace",id:"orion.compare.ignoreWhitespace",groupId:"orion.compareGroup",type:"toggle",visibleWhen:function(t){var i=t.isWhitespaceIgnored();return h.checked=i,h.name=i?e.UseWhitespace:e.IgnoreWhitespace,h.tooltip=i?e.UseWhitespaceTooltip:e.IgnoreWhitespaceTooltip,!0},preCallback:function(t){var n=t.handler.getWidget();if("function"==typeof n.options.onSave&&n.isDirty()){var o=window.confirm(e.confirmUnsavedChanges);return o?n.options.onSave(o):(new i).resolve()}return(new i).resolve(!0)},callback:function(e){e.items.ignoreWhitespace(h.checked),this.dispatchEvent({type:"compareConfigChanged",name:"ignoreWhiteSpace",value:h.checked})}.bind(this)}),c=new t.Command({tooltip:e["Switch to unified diff"],name:e.Unified,imageClass:"compare-sprite-inline-2way",id:"orion.compare.toggleInline2Way",groupId:"orion.compareGroup",type:"switch",visibleWhen:function(t){if(!t.options.toggler)return!1;var i="twoWay"===t.options.toggler.getWidget().type;return c.checked=!i,c.name=i?e.Unified:e["Side by side"],c.tooltip=i?e["Switch to unified diff"]:e["Switch to side by side diff"],!0},preCallback:function(t){var n=t.handler.getWidget();if("function"==typeof n.options.onSave&&n.isDirty()){var o=window.confirm(e.confirmUnsavedChanges);return o?n.options.onSave(o):(new i).resolve()}return(new i).resolve(!0)},callback:function(e){this.dispatchEvent({type:"compareConfigChanged",name:"mode",value:"twoWay"===e.items.options.toggler.getWidget().type?"inline":"twoWay"}),e.items.options.toggler.toggle()}.bind(this)}),u=new t.Command({name:e["Next diff block"],tooltip:e["Next diff block"],imageClass:"core-sprite-move-down",id:"orion.compare.nextDiff",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.nextDiff()}}),p=new t.Command({name:e["Previous diff block"],tooltip:e["Previous diff block"],imageClass:"core-sprite-move-up",id:"orion.compare.prevDiff",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.prevDiff()}}),f=new t.Command({name:e["Next diff change"],tooltip:e["Next diff change"],imageClass:"core-sprite-move-down",id:"orion.compare.nextChange",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.nextChange()}}),g=new t.Command({name:e["Previous diff change"],tooltip:e["Previous diff change"],imageClass:"core-sprite-move-up",id:"orion.compare.prevChange",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.prevChange(e)}});a.addCommand(l),a.addCommand(d),a.addCommand(h),a.addCommand(c),a.addCommand(u),a.addCommand(p),a.addCommand(f),a.addCommand(g),s?a.registerCommandContribution(s,"orion.compare.toggleInline2Way",108):r&&a.registerCommandContribution(r,"orion.compare.toggleInline2Way",108),r&&(a.registerCommandContribution(r,"orion.compare.copyToLeft",110,null,!1,new n.KeyBinding(37,!0,!1,!0)),a.registerCommandContribution(r,"orion.compare.copyToRight",111,null,!1,new n.KeyBinding(39,!0,!1,!0)),a.registerCommandContribution(r,"orion.compare.nextDiff",112,null,!1,new n.KeyBinding(40,!0)),a.registerCommandContribution(r,"orion.compare.prevDiff",113,null,!1,new n.KeyBinding(38,!0)),o.options.wordLevelNav?(a.registerCommandContribution(r,"orion.compare.nextChange",114,null,!1,new n.KeyBinding(40,!0,!0)),a.registerCommandContribution(r,"orion.compare.prevChange",115,null,!1,new n.KeyBinding(38,!0,!0))):(a.registerCommandContribution(r,"orion.compare.nextChange",114,null,!0,new n.KeyBinding(40,!0,!0)),a.registerCommandContribution(r,"orion.compare.prevChange",115,null,!0,new n.KeyBinding(38,!0,!0))),a.registerCommandContribution(r,"orion.compare.ignoreWhitespace",109))}},renderCommands:function(e){var t=this.options.commandSpanId,i=this.options.toggleCommandSpanId,n=this.options.commandService;n&&(t||i)&&(i&&(o.empty(o.node(i)),n.renderCommands(i,i,e,e,"tool",null)),t&&(o.empty(o.node(t)),this.options.gridRenderer&&this.options.gridRenderer.navGridHolder?(this.options.gridRenderer.navGridHolder.splice(0,this.options.gridRenderer.navGridHolder.length),this.options.gridRenderer.additionalCmdRender?this.options.gridRenderer.before?(this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder),n.renderCommands(t,t,e,e,"tool",null,this.options.gridRenderer.navGridHolder)):(n.renderCommands(t,t,e,e,"tool",null,this.options.gridRenderer.navGridHolder),this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder)):n.renderCommands(t,t,e,e,"tool",null,this.options.gridRenderer.navGridHolder)):n.renderCommands(t,t,e,e,"tool",null)))}},s}(),s}),define("compare/builder/compare",["orion/commandRegistry","orion/staticDataSource","orion/contentTypes","orion/Deferred","orion/webui/littlelib","orion/compare/compareView","orion/compare/compareCommands"],function(e,t,i,n,o,r,s){function a(e){return u.getFilenameContentType(e)}function l(e){var t=new n,i=new XMLHttpRequest;return i.open("GET",e,!0),i.onreadystatechange=function(){if(4===i.readyState){var e="undefined"!=typeof i.response?i.response:i.responseText,n="string"==typeof e?e:null,o=i.status;o>=200&&400>o?t.resolve(n):t.reject(n)}},i.send(),t}function d(e){if(!e)return e;var t=o.node(e);if(t){if("ul"!==t.nodeName.toLowerCase()){var i=document.createElement("ul");return i.id=e+"__compareCmdUL",i.classList.add("layoutLeft"),i.classList.add("commandList"),t.appendChild(i),i.id}t.classList.add("commandList")}return e}function h(e,i,n,o,l){var h=e;if(!h.highlighters&&h.oldFile&&h.oldFile.Name&&h.newFile&&h.newFile.Name&&(h.highlighters=[new t.SyntaxHighlighter,new t.SyntaxHighlighter]),h.oldFile&&h.oldFile.Name&&(h.oldFile.Type=a(h.oldFile.Name)),h.newFile&&h.newFile.Name&&(h.newFile.Type=a(h.newFile.Name)),i||l){var u=new s.CompareCommandFactory({commandService:c,commandSpanId:d(i),toggleCommandSpanId:d(l)});h.commandProvider=u}var p="inline"===n?"inline":"twoWay";this.compareView=o?new r.toggleableCompareView(p,h):"inline"===p?new r.inlineCompareView(h):new r.TwoWayCompareView(h),this.compareView.startup()}var c=new e.CommandRegistry({}),u=new i.ContentTypeRegistry(t.ContentTypes);return h.prototype={getCompareView:function(){return this.compareView},setFileNames:function(e,t){var i=this.getCompareView().getWidget().options;i.newFile&&e&&(i.newFile.Name=e,i.newFile.Type=a(e)),i.oldFile&&t&&(i.oldFile.Name=t,i.oldFile.Type=a(t))},refresh:function(){var e=this.getCompareView().getWidget().options;if(e.oldFile.URL&&e.newFile.URL){var t=[];t.push(l(e.oldFile.URL)),t.push(l(e.newFile.URL)),n.all(t,function(e){return{_error:e}}).then(function(e){this.getCompareView().getWidget().options.oldFile.Content=e[0],this.getCompareView().getWidget().options.newFile.Content=e[1],this.getCompareView().getWidget().refresh(!0)}.bind(this))}else this.getCompareView().getWidget().refresh(!0)}},h}),define(["compare/builder/compare"],function(e){return e});
\ No newline at end of file
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.eot b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.eot
similarity index 100%
rename from plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.eot
rename to plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.eot
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.svg b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.svg
similarity index 100%
rename from plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.svg
rename to plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.svg
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.ttf b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.ttf
similarity index 100%
rename from plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.ttf
rename to plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.ttf
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.woff b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.woff
similarity index 100%
rename from plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/OrionIconFont-Regular.woff
rename to plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/OrionIconFont-Regular.woff
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/built-compare-amd.min.js b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/built-compare-amd.min.js
new file mode 100644
index 00000000000..658a2c7ef95
--- /dev/null
+++ b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/built-compare-amd.min.js
@@ -0,0 +1,18 @@
+!function(){"use strict";function e(e,t,i,n,o,r){t[e]&&(i.push(e),(t[e]===!0||1===t[e])&&n.push(o+e+"/"+r))}function t(e,t,i,n,o){var r=n+t+"/"+o;require._fileExists(e.toUrl(r+".js"))&&i.push(r)}function i(e,t,n){var o;for(o in t)!t.hasOwnProperty(o)||e.hasOwnProperty(o)&&!n?"object"==typeof t[o]&&(!e[o]&&t[o]&&(e[o]={}),i(e[o],t[o],n)):e[o]=t[o]}var n=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(o){var r=o.config?o.config():{};return r=r||{},{version:"2.0.4",load:function(o,s,a,l){l=l||{},l.locale&&(r.locale=l.locale);var d,c,h,u=n.exec(o),p=u[1],f=u[4],g=u[5],_=f.split("-"),m=[],v={},y="";if(u[5]?(p=u[1],d=p+g):(d=o,g=u[4],f=r.locale,f||(f=r.locale="undefined"==typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),_=f.split("-")),l.isBuild){for(m.push(d),t(s,"root",m,p,g),c=0;c<_.length;c++)h=_[c],y+=(y?"-":"")+h,t(s,y,m,p,g);if(l.locales){var x,b;for(x=0;x-1&&o[e];e--)r=o[e],n=t[r],(n===!0||1===n)&&(n=s(p+r+"/"+g)),i(v,n);a(v)})})}}})}(),define("orion/nls/messages",{root:!0}),define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell","Get Plugins":"Get Plug-ins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Edit",EditorRelatedLinkProj:"Show Project",sidebar:"Sidebar","Filter bindings":"Filter bindings",BindingPrompt:"Enter the new binding",NoBinding:"---",orionClientLabel:"Orion client repository","Orion Editor":"Text Editor","Orion Image Viewer":"Image Viewer","Orion Markdown Editor":"Markdown Editor","Orion Markdown Viewer":"Markdown Viewer","Orion JSON Editor":"JSON Editor","View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.",ShowAllKeyBindings:"Show a list of all the keybindings on this page","Show Keys":"Show Keys",HideShowBannerFooter:"Hide or show the page banner","Toggle banner and footer":"Toggle banner",ChooseFileOpenEditor:"Choose a file by name and open an editor on it",FindFile:"Open File...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item",NoSearchAvailableErr:"Can't search: no search service is available",Related:"Related",Options:"Options","LOG: ":"LOG: ",View:"View",SplashTitle:"Setting up Workspace",SplashTitleSettings:"Loading Settings",SplashTitleGit:"Loading Git Repositories",LoadingPage:"Loading Page",LoadingPlugins:"Loading Plugins",LoadingResources:"Loading Resources",plugin_started:'"${0}" started',"plugin_lazy activation":'"${0}" lazily activated',plugin_starting:'"${0}" starting',"no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ",Operations:"Operations","Operations running":"Operations running",SomeOpWarning:"Some operations finished with warning",SomeOpErr:"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Recent searches":"Recent searches","Regular expression":"Regular expression","Search options":"Search options","Global search":"Global search","Orion Home":"Home","Close notification":"Close notification",OpPressSpaceMsg:"Operations - Press spacebar to show current operations","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site","Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plug-in","Generate a sample plugin for integrating with Orion.":"Generate a sample plug-in for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",outlineTimeout:"Outline service timed out. Try reloading the page and opening the outline again.",UnknownError:"An unknown error occurred.",Filter:"Filter (* = any string, ? = any character)",TemplateExplorerLabel:"Templates",OpenTemplateExplorer:"Open Template Explorer",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu","Wrote: ${0}":"Wrote: ${0}",GenerateHTML:"Generate HTML file",GenerateHTMLTooltip:"Write an HTML file generated from the current Markdown editor content","alt text":"alt text",blockquote:"blockquote",code:"code","code (block)":"code (block)","code (span)":"code (span)",emphasis:"emphasis","fenced code (${0})":"fenced code (${0})","header (${0})":"header (${0})","horizontal rule":"horizontal rule",label:"label","link (auto)":"link (auto)","link (image)":"link (image)","link (inline)":"link (inline)","link label":"link label","link label (optional)":"link label (optional)","link (ref)":"link (ref)","list item (bullet)":"list item (bullet)","list item (numbered)":"list item (numbered)","strikethrough (${0})":"strikethrough (${0})",strong:"strong","table (${0})":"table (${0})",text:"text","title (optional)":"title (optional)",url:"url",workedProgress:"${0} (${1}/${2})",TogglePaneOrientationTooltip:"Toggle split pane orientation",WarningDuplicateLinkId:"Duplicate link ID: ${0} (link IDs are not case-sensitive)",WarningHeaderTooDeep:"Header level cannot exceed 6",WarningLinkHasNoText:"Link has no text",WarningLinkHasNoURL:"Link has no URL",WarningOrderedListItem:"Ordered list item within unordered list",WarningOrderedListShouldStartAt1:"The first item in an ordered list should have index 1",WarningUndefinedLinkId:"Undefined link ID: ${0}",WarningUnorderedListItem:"Unordered list item within ordered list",PageTitleFormat:"${0} - ${1}",KeyCTRL:"Ctrl",KeySHIFT:"Shift",KeyALT:"Alt",KeyBKSPC:"Backspace",KeyDEL:"Del",KeyEND:"End",KeyENTER:"Enter",KeyESCAPE:"Esc",KeyHOME:"Home",KeyINSERT:"Ins",KeyPAGEDOWN:"Page Down",KeyPAGEUP:"Page Up",KeySPACE:"Space",KeyTAB:"Tab","a year":"a year",years:"${0} years","a month":"a month",months:"${0} months","a day":"a day",days:"${0} days","an hour":"an hour",hours:"${0} hours","a minute":"a minute",minutes:"${0} minutes",timeAgo:"${0} ago",justNow:"just now",fixAll:"Fix all"}),define("orion/util",[],function(){function e(e){var t=arguments;return e.replace(/\$\{([^\}]+)\}/g,function(e,i){return t[(i<<0)+1]})}function t(e,t){return e.createElementNS?e.createElementNS(x,t):e.createElement(t)}function i(e,t){t.addEventListener("keydown",function(t){9!==t.keyCode||t.shiftKey||(t.preventDefault(),e.focus())}),e.addEventListener("keydown",function(e){9===e.keyCode&&e.shiftKey&&(e.preventDefault(),t.focus())})}var n=navigator.userAgent,o=-1!==n.indexOf("MSIE")||-1!==n.indexOf("Trident")?document.documentMode:void 0,r=parseFloat(n.split("Firefox/")[1]||n.split("Minefield/")[1])||void 0,s=-1!==n.indexOf("Opera")?parseFloat(n.split("Version/")[1]):void 0,a=parseFloat(n.split("Chrome/")[1])||void 0,l=-1!==n.indexOf("Safari")&&!a,d=parseFloat(n.split("WebKit/")[1])||void 0,c=-1!==n.indexOf("Android"),h=-1!==n.indexOf("iPad"),u=-1!==n.indexOf("iPhone"),p=h||u,f=-1!==n.indexOf("Electron"),g=-1!==navigator.platform.indexOf("Mac"),_=-1!==navigator.platform.indexOf("Win"),m=-1!==navigator.platform.indexOf("Linux"),v="undefined"!=typeof document&&"ontouchstart"in document.createElement("input"),y=_?"\r\n":"\n",x="http://www.w3.org/1999/xhtml";return{formatMessage:e,createElement:t,confineDialogTab:i,isIE:o,isFirefox:r,isOpera:s,isChrome:a,isSafari:l,isWebkit:d,isAndroid:c,isIPad:h,isIPhone:u,isIOS:p,isElectron:f,isMac:g,isWindows:_,isLinux:m,isTouch:v,platformDelimiter:y}}),define("orion/webui/littlelib",["orion/util"],function(e){function t(e,t){return t||(t=document),t.querySelector(e)}function i(e,t){return t||(t=document),t.querySelectorAll(e)}function n(e,t){return Array.prototype.slice.call(i(e,t))}function o(e){var t=e;return"string"==typeof e&&(t=document.getElementById(e)),t}function r(e,t){if(!e||!t)return!1;if(e===t)return!0;var i=e.compareDocumentPosition(t);return Boolean(16&i)}function s(e){var t=e.getBoundingClientRect(),i=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),n=Math.max(document.documentElement.scrollTop,document.body.scrollTop);return{left:t.left+i,top:t.top+n,width:t.width,height:t.height}}function a(e){for(;e.hasChildNodes();){var t=e.firstChild;e.removeChild(t)}}function l(t){var i=t.tabIndex;if(0===i&&e.isIE){var n={a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0};n[t.nodeName.toLowerCase()]||t.attributes.tabIndex||(i=-1)}return i}function d(e){if(l(e)>=0)return e;if(e.hasChildNodes())for(var t=0;t=0)return e;if(e.hasChildNodes())for(var t=e.childNodes.length-1;t>=0;t--){var i=c(e.childNodes[t]);if(i)return i}return null}function h(e,t){if(3===e.nodeType){var i=w.exec(e.nodeValue);i&&i.length>1&&t(e,i)}if(e.hasChildNodes())for(var n=0;n2&&-1!==r.indexOf("px",r.length-2)){r=r.slice(0,-2);var s=parseInt(r,10);return s!==s?0:s}}return 0}function p(e,t){h(e,function(e,i){var n=t[i[1]]||i[1];e.parentNode.replaceChild(document.createTextNode(n),e)})}function f(e,t){h(e,function(e,i){var n=t[i[1]];if(n){var o=document.createRange(),r=i.index;o.setStart(e,r),o.setEnd(e,r+i[0].length),o.deleteContents(),o.insertNode(n)}})}function g(t,i){function n(e){C.forEach(function(t){var i=!1,n=t.excludeNodes.some(function(t){return document.body.contains(t)?(i=!0,t.contains(e.target)):!1});if(i&&!n)try{t.dismiss(e)}catch(o){"undefined"!=typeof console&&console&&console.error(o&&o.message)}}),C=C.filter(function(e){return e.excludeNodes.some(function(e){return document.body.contains(e)})})}null===C&&(C=[],document.addEventListener("click",n,!0),e.isIOS&&document.addEventListener("touchend",function(e){function t(){e.target.removeEventListener("click",t)}0===e.touches.length&&e.target.addEventListener("click",t)},!1)),C.push({excludeNodes:t,dismiss:i})}function _(e){C=C.filter(function(t){return e!==t.dismiss})}function m(e){for(var t=e.parentNode,i=document.documentElement;t&&t!==i;){var n=window.getComputedStyle(t,null);if(!n)break;var o=n.getPropertyValue("overflow-y");if("auto"===o||"scroll"===o)break;t=t.parentNode}return t}function v(e){window.document.all&&(e.keyCode=0),e.preventDefault&&(e.preventDefault(),e.stopPropagation())}function y(e){for(var t=document.getElementsByTagName("iframe"),i=0;i1?i.children:i.firstChild}var w=/\$\{([^\}]+)\}/,C=null,T={BKSPC:8,TAB:9,ENTER:13,SHIFT:16,CONTROL:17,ALT:18,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46,COMMAND:991},L=Object.create(null);return Object.keys(T).forEach(function(e){L[T[e]]=e}),{$:t,$$:i,$$array:n,node:o,contains:r,bounds:s,empty:a,firstTabbable:d,lastTabbable:c,pixelValueOf:u,stop:v,processTextNodes:p,processDOMNodes:f,addAutoDismiss:g,setFramesEnabled:y,getOffsetParent:m,removeAutoDismiss:_,keyName:x,KEY:T,createNodes:b}}),define("orion/commandsProxy",["orion/util","orion/webui/littlelib"],function(e,t){function i(t,i){function n(t){if(e.isMac){if(t.metaKey&&!t.altKey)return t.shiftKey||t.ctrlKey||65!==t.keyCode&&67!==t.keyCode&&86!==t.keyCode&&88!==t.keyCode&&90!==t.keyCode?!1:!0;if(t.ctrlKey)return!1}else{if(t.ctrlKey&&!t.altKey)return t.shiftKey||65!==t.keyCode&&67!==t.keyCode&&86!==t.keyCode&&88!==t.keyCode&&90!==t.keyCode?!1:!0;if(t.altKey&&!t.ctrlKey)return!1;if(t.ctrlKey&&t.altKey)return!1}if(t["char"])return t["char"].length>0;if(t.charCode||t.keyCode){var i=t.charCode||t.keyCode;switch(i){case 8:case 9:case 13:case 46:return!0;default:return i>=32&&112>i||i>123}}return!1}if(t=t||window.event,n(t)){if("true"===t.target.contentEditable)return;var o=t.target.nodeName.toLowerCase();if("input"===o){var r=t.target.type.toLowerCase();switch(r){case"text":case"password":case"search":case"color":case"date":case"datetime":case"datetime-local":case"email":case"month":case"number":case"range":case"tel":case"time":case"url":case"week":return}}else if("textarea"===o)return}i(t)}function n(){this._init()}return n.prototype={destroy:function(){this._listener&&(document.removeEventListener("keydown",this._listener),this._listener=null)},setProxy:function(e){this.proxy=e},setKeyBindings:function(e){this.bindings=e},_init:function(){var e=this;document.addEventListener("keydown",this._listener=function(n){return i(n,function(i){var n=e.proxy,o=e.bindings;if(o&&n)for(var r=0;r0){e.setFramesEnabled(!1),this._boundAutoDismiss&&e.removeAutoDismiss(this._boundAutoDismiss),this._boundAutoDismiss=this._autoDismiss.bind(this);var o=e.$$array(".dropdownSubMenu",this._dropdownNode);e.addAutoDismiss([this._triggerNode].concat(o),this._boundAutoDismiss),this._triggerNode.classList.add("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.add(this._selectionClass),this._dropdownNode.classList.add("dropdownMenuOpen"),this._isVisible=!0,this._positionDropdown(t),this._focusDropdownNode(),i=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)}}return i},_focusDropdownNode:function(){this._dropdownNode.focus()},_autoDismiss:function(e){if(this.close(!1)&&this._dropdownNode.contains(e.target))for(var t=this._parentDropdown;t;)t.close(!1),t=t._parentDropdown},_positionDropdown:function(){if(this._dropdownNode.style.left="",this._dropdownNode.style.top="",this._positioningNode)return void(this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px");var t=e.bounds(this._dropdownNode),i=e.bounds(document.body);if(t.left+t.width>i.left+i.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-t.width+"px";else{var n=e.bounds(this._boundingNode(this._triggerNode)),o=e.bounds(this._triggerNode);this._dropdownNode.style.left=o.left-n.left-t.width+o.width+"px"}var r=t.top+t.height-(i.top+i.height);r>0&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-r)+"px")},_boundingNode:function(e){var t=window.getComputedStyle(e,null);if(null===t)return e;var i=t.getPropertyValue("position");return"absolute"!==i&&e.parentNode&&e!==document.body?this._boundingNode(e.parentNode):e},close:function(t){var i=!1;return this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),e.setFramesEnabled(!0),t&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=null),this._boundAutoDismiss&&(e.removeAutoDismiss(this._boundAutoDismiss),this._boundAutoDismiss=null),i=!0),i},getItems:function(){var t=e.$$array("li:not(.dropdownSeparator) > .dropdownMenuItem",this._dropdownNode,!0),i=[],n=this;return t.forEach(function(e){e.parentNode.parentNode===n._dropdownNode&&i.push(e)}),i.forEach(function(t){t._hasDropdownMouseover||(t.addEventListener("mouseover",function(i){t.dropdown?t.dropdown.open(i):(n._closeSelectedSubmenu(),e.stop(i)),n._selectItem(t)}),t._hasDropdownMouseover=!0)}),i},empty:function(){var t=e.$$array("li",this._dropdownNode),i=this;t.forEach(function(e){e.parentNode===i._dropdownNode&&e.parentNode.removeChild(e)})},_dropdownKeyDown:function(t){if(t.keyCode===e.KEY.UP||t.keyCode===e.KEY.DOWN||t.keyCode===e.KEY.RIGHT||t.keyCode===e.KEY.ENTER||t.keyCode===e.KEY.LEFT){var i=this.getItems();if(i.length&&i.length>0){if(this._selectedItem){var n=i.indexOf(this._selectedItem);0>n&&(n=i.indexOf(this._selectedItem.parentNode)),n>=0&&(t.keyCode===e.KEY.UP&&n>0?(n--,this._selectItem(i[n])):t.keyCode===e.KEY.DOWN&&n/im,l=/]*>\s*([\s\S]+)\s*<\/body>/im,d="undefined"!=typeof location&&location.href,c=d&&location.protocol&&location.protocol.replace(/\:/,""),h=d&&location.hostname,u=d&&(location.port||void 0),p={},f=e.config&&e.config()||{};return t={version:"2.0.12",strip:function(e){if(e){e=e.replace(a,"");var t=e.match(l);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:f.createXhr||function(){var e,t,i;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;3>t;t+=1){i=s[t];try{e=new ActiveXObject(i)}catch(n){}if(e){s=[i];break}}return e},parseName:function(e){var t,i,n,o=!1,r=e.indexOf("."),s=0===e.indexOf("./")||0===e.indexOf("../");return-1!==r&&(!s||r>1)?(t=e.substring(0,r),i=e.substring(r+1,e.length)):t=e,n=i||t,r=n.indexOf("!"),-1!==r&&(o="strip"===n.substring(r+1),n=n.substring(0,r),i?i=n:t=n),{moduleName:t,ext:i,strip:o}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,i,n,o){var r,s,a,l=t.xdRegExp.exec(e);return l?(r=l[2],s=l[3],s=s.split(":"),a=s[1],s=s[0],!(r&&r!==i||s&&s.toLowerCase()!==n.toLowerCase()||(a||s)&&a!==o)):!0},finishLoad:function(e,i,n,o){n=i?t.strip(n):n,f.isBuild&&(p[e]=n),o(n)},load:function(e,i,n,o){if(o&&o.isBuild&&!o.inlineText)return void n();f.isBuild=o&&o.isBuild;var r=t.parseName(e),s=r.moduleName+(r.ext?"."+r.ext:""),a=i.toUrl(s),l=f.useXhr||t.useXhr;return 0===a.indexOf("empty:")?void n():void(!d||l(a,c,h,u)?t.get(a,function(i){t.finishLoad(e,r.strip,i,n)},function(e){n.error&&n.error(e)}):i([s],function(e){t.finishLoad(r.moduleName+"."+r.ext,r.strip,e,n)}))},write:function(e,i,n){if(p.hasOwnProperty(i)){var o=t.jsEscape(p[i]);n.asModule(e+"!"+i,"define(function () { return '"+o+"';});\n")}},writeFile:function(e,i,n,o,r){var s=t.parseName(i),a=s.ext?"."+s.ext:"",l=s.moduleName+a,d=n.toUrl(s.moduleName+a)+".js";t.load(l,n,function(){var i=function(e){return o(d,e)};i.asModule=function(e,t){return o.asModule(e,d,t)},t.write(e,l,i,r)},r)}},"node"===f.env||!f.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]?(i=require.nodeRequire("fs"),t.get=function(e,t,n){try{var o=i.readFileSync(e,"utf8");0===o.indexOf("")&&(o=o.substring(1)),t(o)}catch(r){n&&n(r)}}):"xhr"===f.env||!f.env&&t.createXhr()?t.get=function(e,i,n,o){var r,s=t.createXhr();if(s.open("GET",e,!0),o)for(r in o)o.hasOwnProperty(r)&&s.setRequestHeader(r.toLowerCase(),o[r]);f.onXhr&&f.onXhr(s,e),s.onreadystatechange=function(){var t,o;4===s.readyState&&(t=s.status||0,t>399&&600>t?(o=new Error(e+" HTTP status: "+t),o.xhr=s,n&&n(o)):i(s.responseText),f.onXhrComplete&&f.onXhrComplete(s,e))},s.send(null)}:"rhino"===f.env||!f.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?t.get=function(e,t){var i,n,o="utf-8",r=new java.io.File(e),s=java.lang.System.getProperty("line.separator"),a=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(r),o)),l="";try{for(i=new java.lang.StringBuffer,n=a.readLine(),n&&n.length()&&65279===n.charAt(0)&&(n=n.substring(1)),null!==n&&i.append(n);null!==(n=a.readLine());)i.append(s),i.append(n);l=String(i.toString())}finally{a.close()}t(l)}:("xpconnect"===f.env||!f.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(n=Components.classes,o=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),r="@mozilla.org/windows-registry-key;1"in n,t.get=function(e,t){var i,s,a,l={};r&&(e=e.replace(/\//g,"\\")),a=new FileUtils.File(e);try{i=n["@mozilla.org/network/file-input-stream;1"].createInstance(o.nsIFileInputStream),i.init(a,1,0,!1),s=n["@mozilla.org/intl/converter-input-stream;1"].createInstance(o.nsIConverterInputStream),s.init(i,"utf-8",i.available(),o.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),s.readString(i.available(),l),s.close(),i.close(),t(l.value)}catch(d){throw new Error((a&&a.path||"")+": "+d)}}),t}),define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return''}),define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return''}),define("text!orion/webui/checkedmenuitem.html",[],function(){return''}),define("orion/webui/tooltip",["orion/webui/littlelib"],function(e){function t(e){this._init(e)}return t.prototype={_init:function(t){if(this._node=e.node(t.node),!this._node)throw"no dom node for tooltip found";this._position=t.position||["right","above","below","left"],this._text=t.text,this._hideDelay=void 0===t.hideDelay?200:t.hideDelay,this._tailSize=t.tailSize||10,this._trigger=t.trigger||"mouseover",this._afterShowing=t.afterShowing,this._afterHiding=t.afterHiding;var i=this;if("click"===this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(t){t.target===i._node&&(i.show(),e.stop(t))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===t.showDelay?500:t.showDelay;var n=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(t){e.contains(i._node,t.target)&&(i.show(),e.stop(t))},!1),this._leaveHandler=function(t){e.contains(i._node,t.target)&&i.hide()};for(var o=0;op){if(!i)return!1;r=p-a.height-1}if(s+a.width>u){if(!i)return!1;s=u-a.width-1}if(c>s){if(!i)return!1;s=c+4}if(h>r){if(!i)return!1;r=h+4}return this._tail&&this._tail.previousPosition!==t&&(this._tip.removeChild(this._tail),this._tail=null),this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+t),"above"===t||"left"===t?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),this._tail.previousPosition=t),this._tip.style.top=r+"px",this._tip.style.left=s+"px",!0},contentContainer:function(){return this._makeTipNode(),this._tipInner},isShowing:function(){return this._tip&&this._tip.classList.contains("tooltipShowing")},show:function(){this.isShowing()||(this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),this._showDelay?this._timeout=window.setTimeout(this._showImmediately.bind(this),this._showDelay):this._showImmediately())},_showImmediately:function(){for(var e=!1,t=0;!e&&t"+n.name),n.callback.call(n,i)}.bind(this),!1),s.addEventListener("keydown",function(e){(e.keyCode===t.KEY.ENTER||e.keyCode===t.KEY.SPACE)&&(l.logEvent("command","invoke",this.id+">"+n.name),n.callback.call(n,i))}.bind(this),!1)}else r._generateMenuSeparator(e)}.bind(this))},getChoices:function(e,t,i){return this.choiceCallback?this.choiceCallback.call(t,e,i):null},makeChoiceCallback:function(e,t){return function(i){e.callback&&e.callback.call(e,t,i)}},hasImage:function(){return this.imageClass||this.image!==w}},b.prototype.constructor=b,{Command:b,CommandInvocation:x,createDropdownMenu:g,createCheckedMenuItem:_,createQuickfixItem:m,createCommandItem:v,createCommandMenuItem:y,executeBinding:c,setKeyBindingProvider:d,localKeyBindings:T,getKeyBindings:u,processKey:p,NO_IMAGE:w,_testMethodProcessKey:h}}),define("orion/keyBinding",["orion/util"],function(e){function t(e,t,i,n,o,r){this.type=r||"keydown",this.keyCode="string"==typeof e&&"keydown"===this.type?e.toUpperCase().charCodeAt(0):e,this.mod1=void 0!==t&&null!==t?t:!1,this.mod2=void 0!==i&&null!==i?i:!1,this.mod3=void 0!==n&&null!==n?n:!1,this.mod4=void 0!==o&&null!==o?o:!1}function i(e){this.keys=e}return t.prototype={getKeys:function(){return[this]},match:function(t,i){if(void 0!==i){if(0!==i)return!1}else if(t instanceof Array){if(t.length>1)return!1;t=t[0]}if(t.type!==this.type)return!1;if(this.keyCode===t.keyCode||this.keyCode===String.fromCharCode(e.isOpera?t.which:void 0!==t.charCode?t.charCode:t.keyCode)){var n=e.isMac?t.metaKey:t.ctrlKey;return this.mod1!==n?!1:"keydown"===this.type&&this.mod2!==t.shiftKey?!1:this.mod3!==t.altKey?!1:e.isMac&&this.mod4!==t.ctrlKey?!1:!0}return!1},equals:function(e){return e?this.keyCode!==e.keyCode?!1:this.mod1!==e.mod1?!1:this.mod2!==e.mod2?!1:this.mod3!==e.mod3?!1:this.mod4!==e.mod4?!1:this.type!==e.type?!1:!0:!1}},i.prototype={getKeys:function(){return this.keys.slice(0)},match:function(e,t){var i=this.keys;if(void 0!==t)return t>i.length?!1:i[t].match(e)?t===i.length-1?!0:t+1:!1;if(e instanceof Array||(e=[e]),e.length>i.length)return!1;var n;for(n=0;n":".";break;case 191:l=i.mod2?"?":"/";break;case 192:l=i.mod2?"~":"`";break;case 219:l=i.mod2?"{":"[";break;case 220:l=i.mod2?"|":"\\";break;case 221:l=i.mod2?"}":"]";break;case 222:l=i.mod2?'"':"'"}return l?n+l:i.keyCode>=112&&i.keyCode<=123?n+"F"+(i.keyCode-111):n+String.fromCharCode(i.keyCode)}function o(e){for(var t="",i=e.getKeys(),o=0;o0)if(e.createTextRange){var o=e.createTextRange();o.collapse(!0),o.moveStart("character",0),o.moveEnd("character",n),o.select()}else e.setSelectionRange?e.setSelectionRange(0,n):void 0!==e.selectionStart&&(e.selectionStart=0,e.selectionEnd=n);else e.select()}},0)}function s(e){var t=-1!==window.navigator.platform.indexOf("Mac");return t&&e.metaKey||!t&&e.ctrlKey}function a(e,t){t&&s(t)?window.open(e):window.location=e}function l(e,i){var n=document.createElement("button");return n.className="orionButton commandButton commandMargins",n.addEventListener("click",function(e){i(),t.stop(e)},!1),e&&n.appendChild(document.createTextNode(e)),n}function d(){}function c(e,t){if(!e||!e.tagName)return!1;switch(e.tagName.toLowerCase()){case"button":case"fieldset":case"form":case"input":case"keygen":case"label":case"legend":case"meter":case"optgroup":case"output":case"progress":case"select":case"textarea":return!0}return e.parentNode===t?!1:e.parentNode&&c(e.parentNode,t)}function h(e,t,i){var n=i?0:1;return e.substring(0,e.length-encodeURIComponent(t).length-n)}function u(e){var t=new Date,i=new Date(e),n=t.getTime()-i.getTime(),o=Math.floor(n/1e3/60/60/24/365);n-=1e3*o*60*60*24*365;var r=Math.floor(n/1e3/60/60/24/30);n-=1e3*r*60*60*24*30;var s=Math.floor(n/1e3/60/60/24);n-=1e3*s*60*60*24;var a=Math.floor(n/1e3/60/60);n-=1e3*a*60*60;var l=Math.floor(n/1e3/60);n-=1e3*l*60;var d=Math.floor(n/1e3);return{year:o,month:r,day:s,hour:a,minute:l,second:d}}function p(t,n,o){return t>0?1===t?e[n]:i.formatMessage(e[o],t):""}function f(e){var t=u(e),i=p(t.year,"a year","years"),n=p(t.month,"a month","months"),o=p(t.day,"a day","days"),r=p(t.hour,"an hour","hours"),s=p(t.minute,"a minute","minutes"),a="";return i?a=t.year>0?i:i+n:n?a=t.month>0?n:n+o:o?a=t.day>0?o:o+r:r?a=t.hour>0?r:r+s:s&&(a=s),a}function g(t){var n=f(t);return n?i.formatMessage(e.timeAgo,n):e.justNow}var _=-1!==navigator.platform.indexOf("Mac"),m=Object.create(null);return m[t.KEY.DOWN]="↓",m[t.KEY.UP]="↑",m[t.KEY.RIGHT]="→",m[t.KEY.LEFT]="←",_&&(m[t.KEY.BKSPC]="⌫",m[t.KEY.DEL]="⌦",m[t.KEY.END]="⇲",m[t.KEY.ENTER]="⏎",m[t.KEY.ESCAPE]="⎋",m[t.KEY.HOME]="⇱",m[t.KEY.PAGEDOWN]="⇟",m[t.KEY.PAGEUP]="⇞",m[t.KEY.SPACE]="␣",m[t.KEY.TAB]="⇥"),{getUserKeyString:o,getUserText:r,openInNewWindow:s,followLink:a,createButton:l,createDropdownButton:d,isFormElement:c,path2FolderName:h,timeElapsed:f,displayableTimeElapsed:g}}),define("text!orion/webui/submenutriggerbutton.html",[],function(){return''}),function(e,t){"function"==typeof define&&define.amd?define("orion/Deferred",t):"object"==typeof exports?module.exports=t():(e.orion=e.orion||{},e.orion.Deferred=t())}(this,function(){function e(){for(var e;e=r.shift();)e();s=!1}function t(e){r.push(e),s||(s=!0,a())}function i(e){return function(t){e(t)}}function n(e,t,n){try{var o=e(t),r=o&&("object"==typeof o||"function"==typeof o)&&o.then;if("function"==typeof r)if(o===n.promise)n.reject(new TypeError);else{var s=o.cancel;"function"==typeof s?n._parentCancel=s.bind(o):delete n._parentCancel,r.call(o,i(n.resolve),i(n.reject),i(n.progress))}else n.resolve(o)}catch(a){n.reject(a)}}function o(){function e(){for(var e;e=d.shift();){var t=e.deferred,i="fulfilled"===l?"resolve":"reject",o=e[i];"function"==typeof o?n(o,a,t):t[i](a)}}function i(i){delete c._parentCancel,l="rejected",a=i,d.length&&t(e)}function r(n){function s(e){return function(t){l&&"assumed"!==l||e(t)}}delete c._parentCancel;try{var h=n&&("object"==typeof n||"function"==typeof n)&&n.then;if("function"==typeof h)if(n===c)i(new TypeError);else{l="assumed";var u=n&&n.cancel;if("function"!=typeof u){var p=new o;n=p.promise;try{h(p.resolve,p.reject,p.progress)}catch(f){p.reject(f)}u=n.cancel,h=n.then}a=n,h.call(n,s(r),s(i)),c._parentCancel=u.bind(n)}else l="fulfilled",a=n,d.length&&t(e)}catch(g){s(i)(g)}}function s(){var e=c._parentCancel;if(e)delete c._parentCancel,e();else if(!l){var t=new Error("Cancel");t.name="Cancel",i(t)}}var a,l,d=[],c=this;this.resolve=function(e){return l||r(e),c},this.reject=function(e){return l||i(e),c},this.progress=function(e){return l||d.forEach(function(t){if(t.progress)try{t.progress(e)}catch(i){}}),c.promise},this.cancel=function(){return c._parentCancel?setTimeout(s,0):s(),c},this.then=function(i,n,r){var s=new o;return s._parentCancel=c.promise.cancel,d.push({resolve:i,reject:n,progress:r,deferred:s}),("fulfilled"===l||"rejected"===l)&&t(e),s.promise},this.promise={then:c.then,cancel:c.cancel}}var r=[],s=!1,a=function(){if("undefined"!=typeof process&&"function"==typeof process.nextTick){var t=process.nextTick;return function(){t(e)}}if("function"==typeof MutationObserver){var i=document.createElement("div"),n=new MutationObserver(e);return n.observe(i,{attributes:!0}),function(){i.setAttribute("class","_tick")}}return function(){setTimeout(e,0)}}();return o.all=function(e,t){function i(e,t){a||(s[e]=t,0===--r&&l.resolve(s))}function n(e,n){if(!a){if(t)try{return void i(e,t(n))}catch(o){n=o}l.reject(n)}}var r=e.length,s=[],a=!1,l=new o;return l.then(void 0,function(){a=!0,e.forEach(function(e){e.cancel&&e.cancel()})}),0===r?l.resolve(s):e.forEach(function(e,t){e.then(i.bind(void 0,t),n.bind(void 0,t))}),l.promise},o.when=function(e,t,i,n){var r,s;return e&&"function"==typeof e.then?r=e:(s=new o,s.resolve(e),r=s.promise),r.then(t,i,n)},o}),define("orion/commandRegistry",["orion/commands","orion/keyBinding","orion/explorers/navigationUtils","orion/i18nUtil","orion/PageUtil","orion/uiUtils","orion/webui/littlelib","orion/webui/dropdown","orion/webui/tooltip","text!orion/webui/submenutriggerbutton.html","orion/metrics","orion/Deferred","orion/EventTarget"],function(e,t,i,n,o,r,s,a,l,d,c,h,u){function p(e){this._commandList={},this._contributionsByScopeId={},this._activeBindings={},this._urlBindings={},this._pendingBindings={},this._parameterCollector=null,this._init(e||{})}function f(e,t){this.token=e,this.parameterName=t}function g(e,t,i){this.event=e,this.handler=t,this.capture=i||!1}function _(e,t,i,n,o,r,s){this.name=e,this.type=t,this.label=i,this.value=n,this.lines=o||1,this.validator=s,this.eventListeners=Array.isArray(r)?r:r?[r]:[]}function m(e,t,i){this._storeParameters(e),this._hasOptionalParameters=t&&t.hasOptionalParameters,this._options=t,this.optionsRequested=!1,this.getParameters=i,this.clientCollect=t&&t.clientCollect,this.getParameterElement=t&&t.getParameterElement,this.getSubmitName=t&&t.getSubmitName,this.getCancelName=t&&t.getCancelName,this.message=t&&t.message}return p.prototype={_init:function(t){this._selectionService=t.selection;var i=this;e.setKeyBindingProvider(function(){return i._activeBindings}),u.attach(p.prototype),this.addEventListener("bindingChanged",function(e){this._handleBindingChanges(e)}.bind(this)),this.addEventListener=function(e,t){this._bindingOverrides&&"bindingChanged"===e&&this._updateBindingOverrides(t),p.prototype.addEventListener.call(this,e,t)}},processURL:function(e){for(var t in this._urlBindings)if(this._urlBindings[t]&&this._urlBindings[t].urlBinding&&this._urlBindings[t].command){var i=this._urlBindings[t].urlBinding.match(e);if(i){var n=this._urlBindings[t],o=n.command,r=n.invocation;if(r&&r.parameters&&o.callback){r.parameters.setValue(i.parameterName,i.parameterValue);var s=this;return void window.setTimeout(function(){s._invoke(r)},0)}}}},findCommand:function(e){return this._commandList[e]},runCommand:function(t,i,n,o,r,s){var a=this;if(i){var l=this._commandList[t],d=l&&(l.visibleWhen?l.visibleWhen(i):!0);if(d&&l.callback){var c=new e.CommandInvocation(n,i,r,l,a);return c.domParent=s,a._invoke(c,o)}}else{var h=this._urlBindings[t];if(h&&h.command&&h.command.callback)return a._invoke(h.invocation,o)}},getSelectionService:function(){return this._selectionService},setParameterCollector:function(e){this._parameterCollector=e},openParameterCollector:function(e,t,i){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(e,t,i))},confirm:function(e,t,i,n,o,r){var s=!1;if(!this._parameterCollector||o)s=window.confirm(t),r(s);else{var a=this,d=function(){r(s)},c=function(){a._parameterCollector.close()},h=function(e,o){var r=document.createElement("span");r.classList.add("parameterPrompt"),r.textContent=t,e.appendChild(r);var a=document.createElement("button");a.addEventListener("click",function(){s=!0,d(),c()},!1),o.appendChild(a),a.appendChild(document.createTextNode(i)),a.className="dismissButton";var l=document.createElement("button");return l.addEventListener("click",function(){s=!1,c()},!1),o.appendChild(l),l.appendChild(document.createTextNode(n)),l.className="dismissButton",a};this._parameterCollector.close();var u=this._parameterCollector.open(e,h,function(){});if(!u){var p=new l.Tooltip({node:e,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),f=p.contentContainer();f.classList.add("parameterPopup");var g=window.document.activeElement;c=function(){g&&g.focus(),p.destroy()};var _=document.createElement("div");_.classList.add("parameterMessage"),f.appendChild(_);var m=document.createElement("div");f.appendChild(m),m.classList.add("layoutRight"),m.classList.add("parametersDismiss");var v=h(_,m);p.show(),v&&window.setTimeout(function(){v.focus(),v.select&&v.select()},0)}}},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(e,t){return this._collectAndInvoke(e.makeCopy(t),!1)},_collectAndInvoke:function(e,t,i){if(e){if(!(this._parameterCollector&&e.parameters&&e.parameters.hasParameters()&&(t||e.parameters.shouldCollectParameters())))return c.logEvent("command","invoke",e.command.id),e.command.callback.call(e.handler||window,e);var n=!1;if(e.parameters.updateParameters(e),e.parameters.shouldCollectParameters()&&(n=this._parameterCollector.collectParameters(e,i),!n)){var o=new l.Tooltip({node:e.domNode||e.domParent,afterHiding:function(){this.destroy(),e.domParent&&e.domParent.classList.remove("parameterPopupOpen")},trigger:"click",position:["below","right","above","left"]}),r=o.contentContainer();r.classList.add("parameterPopup");var s=window.document.activeElement,a=this._parameterCollector.getFillFunction(e,function(){s&&s.focus(),o.destroy(),e.domParent&&e.domParent.classList.remove("parameterPopupOpen")},i)(r);o.show(),e.domParent&&e.domParent.classList.add("parameterPopupOpen"),a&&window.setTimeout(function(){a.focus(),a.select&&a.select()},0),n=!0}if(!n)return c.logEvent("command","invoke",e.command.id),e.command.callback.call(e.handler||window,e)}else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(e,t){this._collectAndInvoke(e,!0,t)},showKeyBindings:function(t){function i(t){return function(){e.executeBinding(t)}}var n,o={},r=[];for(var s in this._activeBindings)n=this._activeBindings[s],n&&n.keyBinding&&n.command&&(n.command.name||n.command.tooltip)&&r.push(n);r.sort(function(e,t){var i=e.command.name||e.command.tooltip,n=t.command.name||t.command.tooltip;return i.localeCompare(n)});for(var a=0;a0&&(t.createHeader(l),o[l].forEach(function(e){t.createItem(e.keyBinding,e.command.name||e.command.tooltip,e.command.id,i(e))}))},_handleBindingChanges:function(t){var i=this.findCommand(t.id);if(i){var n=this._activeBindings[t.id];n?n.keyBinding=t.newBinding:this._addBinding(i,"key",t.newBinding)}if(this._renderedCommands&&this._renderedCommands[t.id])for(var o=this._renderedCommands[t.id],s=Object.keys(o),a=0;a=0;t--){var i=this._bindingOverrides[t];if(i.id===e)return i.newBinding}return null},addCommand:function(e){this._commandList[e.id]=e;var t=this._pendingBindings[e.id];if(t){var i=this;t.forEach(function(t){i._addBinding(e,t.type,t.binding,t.bindingOnly)}),delete this._pendingBindings[e.id]}},addCommandGroup:function(e,t,i,n,o,r,s,a,l,d,c){this._contributionsByScopeId[e]||(this._contributionsByScopeId[e]={});var h=this._contributionsByScopeId[e];o&&(h=this._createEntryForPath(h,o)),h[t]?(n&&(h[t].title=n),i&&(h[t].position=i),s&&(h[t].imageClass=s),a&&(h[t].tooltip=a),l&&(h[t].selectionClass=l),c&&(h[t].extraClass=c),d===!0?h[t].pretendDefaultActionId=!0:h[t].defaultActionId=d,h[t].emptyGroupMessage=r):(h[t]={title:n,position:i,emptyGroupMessage:r,imageClass:s,tooltip:a,selectionClass:l,defaultActionId:d===!0?null:d,pretendDefaultActionId:d===!0,children:{},extraClasses:c},h.sortedContributions=null)},_createEntryForPath:function(e,t){if(t){var i=t.split("/");i.forEach(function(t){t.length>1&&(e[t]||(e[t]={position:0,children:{}},e.sortedContributions=null),e=e[t].children)})}return e},registerSelectionService:function(e,t){this._contributionsByScopeId[e]||(this._contributionsByScopeId[e]={}),this._contributionsByScopeId[e].localSelectionService=t},setServiceRegistry:function(e){this._serviceRegistry=e,this._prefService=e.getService("orion.core.preference"),this._prefService&&(this._getBindingOverrides().then(function(e){this._bindingOverrides=e,this._updateBindingOverrides()}.bind(this)),this._prefService.addEventListener("changed",function(e){"/KeyBindings"===e.namespace&&this._getBindingOverrides().then(function(e){if(e.length>this._bindingOverrides.length)for(var t=this._bindingOverrides.length;t1){if(!n[e])return;n=n[e].children}})}delete n[t],n.sortedContributions=null}},_addBinding:function(e,t,i,n){if(!e.id)throw new Error("No command id: "+e);"key"===t?this._activeBindings[e.id]={command:e,keyBinding:i,bindingOnly:n}:"url"===t&&(this._urlBindings[e.id]={command:e,urlBinding:i,bindingOnly:n})},_addPendingBinding:function(e,t,i,n){this._pendingBindings[e]=this._pendingBindings[e]||[],this._pendingBindings[e].push({type:t,binding:i,bindingOnly:n})},_checkForTrailingSeparator:function(e,t,i){var n;if(("tool"===t||"button"===t)&&(n=e.childNodes.length>0?e.childNodes[e.childNodes.length-1]:null,n&&n.classList.contains("commandSeparator")))return i?(e.removeChild(n),!1):!0;if("menu"===t){var o=s.$$array("li > *",e);if(o.length>0&&o[o.length-1].classList.contains("dropdownSeparator"))return n=o[o.length-1],i?(n.parentNode.parentNode.removeChild(n.parentNode),!1):!0}return!1},renderCommands:function(e,t,i,n,o,r,a){if("string"!=typeof e)throw"a scope id for rendering must be specified";if(t=s.node(t),!t)throw"no parent";var l=this._contributionsByScopeId[e];if(!i&&l){var d=l.localSelectionService||this._selectionService,c=this;return void(d&&d.getSelections(function(i){c.renderCommands(e,t,i,n,o,r)}))}l&&(this._render(e,l,t,i,n,o||"button",r,a),this._checkForTrailingSeparator(t,o,!0))},destroy:function(e){if(e=s.node(e),!e)throw"no parent";for(;e.hasChildNodes();){var t=e.firstChild;t.commandTooltip&&t.commandTooltip.destroy(),t.emptyGroupTooltip&&t.emptyGroupTooltip.destroy(),this.destroy(t),e.removeChild(t)}},_render:function(t,n,o,s,a,d,c,h){var u=n.sortedContributions;if(!u){u=[];var p=!1;for(var f in n)if(Object.prototype.hasOwnProperty.call(n,f)){var g=n[f];g&&"number"==typeof g.position&&(g.id=f,u.push(g),p=!0)}p&&(u.sort(function(e,t){return e.position-t.position}),n.sortedContributions=u)}var _=0,m=this;u.forEach(function(n){function u(e){e&&e.parentNode&&e.parentNode.removeChild(e)}var p,f;if(n.imageClass||(n.imageClass=null),n.children&&Object.getOwnPropertyNames(n.children).length>0){var g,v=n.children;if("tool"===d||"button"===d)if(n.title){var y;if(n.defaultActionId){n.pretendDefaultActionId=n.defaultActionId===!0;var x=m._commandList[n.defaultActionId];x&&(x.visibleWhen?x.visibleWhen(s):!0)?(y=new e.CommandInvocation(a,s,c,x,m),y.domParent=o):n.pretendDefaultActionId=!0}g=m._createDropdownMenu(o,n.title,null,null,n.imageClass,n.tooltip,n.selectionClass,null,y,n.pretendDefaultActionId,n.extraClasses),h&&i.generateNavGrid(h,g.menuButton),g&&(m._render(t,n.children,g.menu,s,a,"menu",c,h),m._checkForTrailingSeparator(g.menu,"menu",!0),0===g.menu.childNodes.length?n.emptyGroupMessage?g.menuButton.emptyGroupTooltip||(g.menuButton.emptyGroupTooltip=new l.Tooltip({node:g.menuButton,text:n.emptyGroupMessage,trigger:"click",position:["below","right","above","left"]})):(h&&i.removeNavGrid(h,g.menuButton),u(g.menu),u(g.menuButton),u(g.destroyButton)):g.menuButton.style.visibility="visible")}else{var b;if(o.childNodes.length>0&&!m._checkForTrailingSeparator(o,d)&&(b=m.generateSeparatorImage(o)),m._render(t,v,o,s,a,d,c,h),o.childNodes.length>0){var w=o.childNodes[o.childNodes.length-1];w!==b&&(b=m.generateSeparatorImage(o))}}else if(n.title){var C=m._createDropdownMenu(o,n.title,!0,null,null,n.imageClass);C&&(m._render(t,v,C.menu,s,a,"menu",c,h),m._checkForTrailingSeparator(C.menu,"menu",!0),0===C.menu.childNodes.length&&C.destroyButton&&o.removeChild(C.destroyButton))}else o.childNodes.length>0&&m._generateMenuSeparator(o),m._render(t,v,o,s,a,d,c,h),o.childNodes.length>0&&m._generateMenuSeparator(o)}else{var T=m._commandList[n.id],L=T?!0:!1,k=null,D=null;if(T){f=new e.CommandInvocation(n.handler||a,s,c,T,m),f.domParent=o;var A=!1;try{A=L&&(T.visibleWhen?T.visibleWhen(s,f):!0)}catch(S){throw console.log(S),S}m._activeBindings[T.id]&&m._activeBindings[T.id].keyBinding&&(k=m._activeBindings[T.id],k.invocation=A?f:null,k.bindingOnly&&(L=!1)),m._urlBindings[T.id]&&m._urlBindings[T.id].urlBinding&&(D=m._urlBindings[T.id],D.invocation=A?f:null,D.bindingOnly&&(L=!1)),L=L&&A}if(L)if(T.choiceCallback){var E,O;"tool"===d||"button"===d?(E=o,O=!1,"ul"===o.nodeName.toLowerCase()&&(E=document.createElement("li"),o.appendChild(E))):(E=o,O=!0);var N=function(e){T.populateChoicesMenu(e,s,a,c,m)};m._createDropdownMenu(E,T.name,O,N.bind(T),T.imageClass,T.tooltip||T.title,T.selectionClass,T.positioningNode)}else{f.handler=f.handler||this,f.domParent=o;var M,I=function(){m._invoke(f)};if("menu"===d){var B=null;k&&k.keyBinding&&(B=r.getUserKeyString(k.keyBinding)),M=e.createCommandMenuItem(o,T,f,null,I,B),f.onClick=I,m._registerRenderedCommand(T.id,t,f)}else if("quickfix"===d){p=d+T.id+_;var R=document.createElement("div");o.appendChild(R),o.classList.add("quickFixList"),M=e.createQuickfixItem(R,T,f,I,m._prefService)}else p=d+T.id+_,M=e.createCommandItem(o,T,f,p,null,"tool"===d,I);i.generateNavGrid(h,M),f.domNode=M,_++}}})},_createDropdownMenu:function(t,i,n,o,r,c,h,u,p,f,g){if(t=s.node(t),!t||!s.contains(document.body,t))return null;var _,m,v,y,x=t;if(n){var b=document.createRange();b.selectNode(t);var w=b.createContextualFragment(d);s.processTextNodes(w,{ButtonText:i}),t.appendChild(w),y=t.lastChild,m=y.lastChild,_=m.previousSibling,_.dropdown=new a.Dropdown({dropdown:m,populate:o,parentDropdown:t.dropdown}),m.dropdown=_.dropdown}else{"ul"===t.nodeName.toLowerCase()&&(x=document.createElement("li"),t.appendChild(x),y=x);var C=null;r&&(C="dropdownButtonWithIcon",c=c||i),c=r?c||i:c;var T=e.createDropdownMenu(x,i,o,C,r,!1,h,u,p||f,g);if(v=T.dropdownArrow,_=T.menuButton,v){p&&(p.domNode=T.menuButton);var L=this;_.onclick=function(e){var t=s.bounds(v);(e.clientX>=t.left||f===!0)&&T.dropdown?T.dropdown.toggle(e):L._invoke(p)},T.dropdown&&(_.onkeydown=function(e){s.KEY.DOWN===e.keyCode&&(T.dropdown.toggle(e),s.stop(e))})}m=T.menu;var k,D=p&&p.command&&(p.command.tooltip||p.command.name);k=D?p.command.tooltip||p.command.name:c,k&&(_.commandTooltip=new l.Tooltip({node:_,text:k,position:["above","below","right","left"]}))}return{menuButton:_,menu:m,dropdown:_.dropdown,destroyButton:y,dropdownArrow:v}},_generateMenuSeparator:function(e){if(!this._checkForTrailingSeparator(e,"menu")){var t=document.createElement("li");t.classList.add("dropdownSeparator");var i=document.createElement("span");i.classList.add("dropdownSeparator"),t.appendChild(i),e.appendChild(t)}},generateSeparatorImage:function(e){var t;return"ul"===e.nodeName.toLowerCase()?(t=document.createElement("li"),e.appendChild(t)):(t=document.createElement("span"),e.appendChild(t)),t.classList.add("core-sprite-sep"),t.classList.add("imageSprite"),t.classList.add("commandSeparator"),t}},p.prototype.constructor=p,f.prototype={match:function(e){var t=o.matchResourceParameters(e);return"undefined"!=typeof t[this.token]?(this.parameterValue=t[this.token],this):null}},f.prototype.constructor=f,g.prototype.constructor=g,_.prototype={optionsRequested:function(){return this.optionsRequested}},_.prototype.constructor=_,m.prototype={_storeParameters:function(e){if(this.parameterTable=null,e){var t=this.parameterTable={};e.forEach(function(e){t[e.name]=e})}},updateParameters:function(e){"function"==typeof this.getParameters&&this._storeParameters(this.getParameters(e))},hasParameters:function(){return null!==this.parameterTable},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(e){return this.parameterTable[e]},valueFor:function(e){var t=this.parameterTable[e];return t?t.value:null},setValue:function(e,t){var i=this.parameterTable[e];i&&(i.value=t)},forEach:function(e){for(var t in this.parameterTable)this.parameterTable[t].type&&this.parameterTable[t].name&&e(this.parameterTable[t])},validate:function(e,t){var i=this.parameterTable[e];return i&&i.validator?i.validator(t):!0},makeCopy:function(){var e=[];this.forEach(function(t){var i=new _(t.name,t.type,t.label,t.value,t.lines,t.eventListeners,t.validator);e.push(i)});var t=new m(e,this._options,this.getParameters);return t.clientCollect=this.clientCollect,t.message=this.message,t},hasOptionalParameters:function(){return this._hasOptionalParameters}},m.prototype.constructor=m,{CommandRegistry:p,URLBinding:f,ParametersDescription:m,CommandParameter:_,CommandEventListener:g}}),define("orion/editor/nls/messages",{root:!0}),define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",diffAdded:"Diff Added Lines",diffDeleted:"Diff Deleted Lines",diffModified:"Diff Modified Lines",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up",pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down",selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word",deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",escape:"Escape",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point",setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",findReplace:"Find/Replace",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All",collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode: Enter or ESC to exit",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",noProposals:"No proposals found",computingProposals:"Computing content assist proposals...",lineColumn:"Line ${0} : Column ${1}",lineColumnOffset:"Line ${0} : Column ${1} : Offset ${2}",multiSelections:"${0} selection regions",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right",viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward",vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character",viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",next:"Next",previous:"Previous",replace:"Replace",replaceAll:"Replace All",findWith:"Find With",replaceWith:"Replace With",caseInsensitive:"Aa",regex:"/.*/",wholeWord:"\\b",caseInsensitiveTooltip:"Toggle Case Insensitive",regexTooltip:"Toggle Regular Expression",wholeWordTooltip:"Toggle Whole Word",closeTooltip:"Close",replacingAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",nothingReplaced:"Nothing replaced",notFound:"Not found"}),define("orion/editor/eventTarget",[],function(){function e(){}return e.addMixin=function(t){var i=e.prototype;for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},e.prototype={addEventListener:function(e,t,i){this._eventTypes||(this._eventTypes={});var n=this._eventTypes[e];n||(n=this._eventTypes[e]={level:0,listeners:[]});var o=n.listeners;o.push({listener:t,useCapture:i})},dispatchEvent:function(e){var t=e.type;this._dispatchEvent("pre"+t,e),this._dispatchEvent(t,e),this._dispatchEvent("post"+t,e)},_dispatchEvent:function(e,t){var i=this._eventTypes?this._eventTypes[e]:null;if(i){var n=i.listeners;try{if(i.level++,n)for(var o=0,r=n.length;r>o;o++)if(n[o]){var s=n[o].listener;"function"==typeof s?s.call(this,t):s.handleEvent&&"function"==typeof s.handleEvent&&s.handleEvent(t)}}finally{if(i.level--,i.compact&&0===i.level){for(var a=n.length-1;a>=0;a--)n[a]||n.splice(a,1);0===n.length&&delete this._eventTypes[e],i.compact=!1}}}},isListening:function(e){return this._eventTypes?void 0!==this._eventTypes[e]:!1},removeEventListener:function(e,t,i){if(this._eventTypes){var n=this._eventTypes[e];if(n){for(var o=n.listeners,r=0,s=o.length;s>r;r++){var a=o[r];if(a&&a.listener===t&&a.useCapture===i){0!==n.level?(o[r]=null,n.compact=!0):o.splice(r,1);break}}0===o.length&&delete this._eventTypes[e]}}}},{EventTarget:e}}),define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(e,t){function i(){}function n(e,t,i){this.start=e,this.end=t,this._projectionModel=i,this.html=this._expandedHTML,this.style=this._expandedStyle,this.expanded=!0}function o(t,n){var o=t.lastIndexOf("."),r=t.substring(o+1),s={title:e[r],style:{styleClass:"annotation "+r},html:"",overviewStyle:{styleClass:"annotationOverview "+r}};n?s.lineStyle={styleClass:"annotationLine "+r}:s.rangeStyle={styleClass:"annotationRange "+r},i.registerType(t,s)}function r(){}function s(e,t,i,n,o){var r;for(void 0===n&&(n=-1),void 0===o&&(o=e.length);o-n>1;)if(r=Math.floor((o+n)/2),t<=e[r].start)o=r;else{if(i&&t",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"",_collapsedStyle:{styleClass:"annotation collapsed"},_collapse:function(){return this.expanded?(this.expanded=!1,this.html=this._collapsedHTML,this.style=this._collapsedStyle,this._annotationModel&&this._annotationModel.modifyAnnotation(this),!0):!1},_expand:function(){return this.expanded?!1:(this.expanded=!0,this.html=this._expandedHTML,this.style=this._expandedStyle,this._annotationModel&&this._annotationModel.modifyAnnotation(this),!0)},_collapseImpl:function(e){if(this._collapse()){e&&this._forEachOverlaping(function(e){e.expanded||(e._expandImpl(!1),e._recollapse=!0)});var t=this._projectionModel,i=t.getBaseModel();this._projection={annotation:this,start:i.getLineStart(i.getLineAtOffset(this.start)+1),end:i.getLineEnd(i.getLineAtOffset(this.end),!0)},t.addProjection(this._projection)}},_expandImpl:function(e){this._expand()&&(this._projectionModel._removeProjection(this._projection,!this._annotationModel),e&&this._forEachOverlaping(function(e){e._recollapse&&(e._collapseImpl(!1),e._recollapse=!1)}))},_forEachOverlaping:function(e){if(this._annotationModel)for(var t=this._annotationModel.getAnnotations(this.start,this.end);t.hasNext();){var n=t.next();n!==this&&n.type===i.ANNOTATION_FOLDING&&e.call(this,n)}},collapse:function(){this._recollapse=!1,this._collapseImpl(!0)},expand:function(){this._recollapse=!1,this._expandImpl(!0)}},i.ANNOTATION_ERROR="orion.annotation.error",i.ANNOTATION_WARNING="orion.annotation.warning",i.ANNOTATION_TASK="orion.annotation.task",i.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint",i.ANNOTATION_BOOKMARK="orion.annotation.bookmark",i.ANNOTATION_FOLDING="orion.annotation.folding",i.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket",i.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket",i.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine",i.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch",i.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch",i.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence",i.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence",i.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup",i.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup",i.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup",i.ANNOTATION_BLAME="orion.annotation.blame",i.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame",i.ANNOTATION_DIFF_ADDED="orion.annotation.diffAdded",i.ANNOTATION_DIFF_DELETED="orion.annotation.diffDeleted",i.ANNOTATION_DIFF_MODIFIED="orion.annotation.diffModified";var d={};return i.registerType=function(e,t){var i=t;return"function"!=typeof i&&(i=function(e,t,i){this.start=e,this.end=t,void 0!==i&&(this.title=i)},i.prototype=t),i.prototype.type=e,d[e]=i,e},i.createAnnotation=function(e,t,i,n){return new(this.getType(e))(t,i,n)},i.getType=function(e){return d[e]},o(i.ANNOTATION_ERROR),o(i.ANNOTATION_WARNING),o(i.ANNOTATION_TASK),o(i.ANNOTATION_BREAKPOINT),o(i.ANNOTATION_BOOKMARK),o(i.ANNOTATION_CURRENT_BRACKET),o(i.ANNOTATION_MATCHING_BRACKET),o(i.ANNOTATION_CURRENT_SEARCH),o(i.ANNOTATION_MATCHING_SEARCH),o(i.ANNOTATION_READ_OCCURRENCE),o(i.ANNOTATION_WRITE_OCCURRENCE),o(i.ANNOTATION_SELECTED_LINKED_GROUP),o(i.ANNOTATION_CURRENT_LINKED_GROUP),o(i.ANNOTATION_LINKED_GROUP),o(i.ANNOTATION_CURRENT_LINE,!0),o(i.ANNOTATION_BLAME,!0),o(i.ANNOTATION_CURRENT_BLAME,!0),o(i.ANNOTATION_DIFF_ADDED),o(i.ANNOTATION_DIFF_DELETED),o(i.ANNOTATION_DIFF_MODIFIED),i.registerType(i.ANNOTATION_FOLDING,n),r.addMixin=function(e){var t=r.prototype;for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},r.prototype={addAnnotationType:function(e,t){this._annotationTypes||(this._annotationTypes=[]);var i=t-1;void 0!=t&&i>=0&&ii.start?e=t)break}return null},i=n(),{next:function(){var e=i;return e&&(i=n()),e},hasNext:function(){return null!==i}}},modifyAnnotation:function(e){if(e){var t=this._getAnnotationIndex(e);if(!(0>t)){var i={type:"Changed",added:[],removed:[],changed:[e]};this.onChanged(i)}}},onChanged:function(e){return this.dispatchEvent(e)},removeAnnotations:function(e){var t,i,n=this._annotations;if(e)for(t=[],i=n.length-1;i>=0;i--){var o=n[i];o.type===e&&(n.splice(i,1),t.splice(0,0,o),o._annotationModel=null)}else t=n,n=[];var r={type:"Changed",removed:t,added:[],changed:[]};this.onChanged(r)},removeAnnotation:function(e){if(e){var t=this._getAnnotationIndex(e);if(!(0>t)){e._annotationModel=null;var i={type:"Changed",removed:this._annotations.splice(t,1),added:[],changed:[]};this.onChanged(i)}}},replaceAnnotations:function(e,t){var i,n,o,r=this._annotations,a=[];if(e)for(i=e.length-1;i>=0;i--)o=e[i],n=this._getAnnotationIndex(o),0>n||(o._annotationModel=null,r.splice(n,1),a.splice(0,0,o));for(t||(t=[]),i=0;i=0&&s=r?(c._oldStart=c.start,c._oldEnd=c.end,c.start+=d,c.end+=d,l.changed.push(c)):c.end<=t||(c.start0||l.removed.length>0||l.changed.length>0)&&this.onChanged(l)}}},t.EventTarget.addMixin(a.prototype),l.prototype={destroy:function(){var e=this._view;e&&(e.removeEventListener("Destroy",this._listener.onDestroy),e.removeEventListener("LineStyle",this._listener.onLineStyle),this.view=null);var t=this._annotationModel;t&&(t.removeEventListener("Changed",this._listener.onChanged),t=null)},_mergeStyle:function(e,t){if(t){e||(e={}),e.styleClass&&t.styleClass&&e.styleClass!==t.styleClass?e.styleClass+=" "+t.styleClass:e.styleClass=t.styleClass;var i;if(t.tagName&&(e.tagName||(e.tagName=t.tagName)),t.style){e.style||(e.style={});for(i in t.style)e.style[i]||(e.style[i]=t.style[i])}if(t.attributes){e.attributes||(e.attributes={});for(i in t.attributes)e.attributes[i]||(e.attributes[i]=t.attributes[i])}}return e},_mergeStyleRanges:function(e,t){e||(e=[]);for(var i,n=s(e,t.start,!0);n=o.end)){i=this._mergeStyle({},o.style),i=this._mergeStyle(i,t.style);var r=[];r.push(n,1),t.starto.start&&r.push({start:o.start,end:t.start,style:o.style}),r.push({start:Math.max(o.start,t.start),end:Math.min(o.end,t.end),style:i}),t.endo.end?{start:o.end,end:t.end,style:t.style}:null,Array.prototype.splice.apply(e,r)}}return t&&(i=this._mergeStyle({},t.style),e.splice(n,0,{start:t.start,end:t.end,style:i})),e},_onAnnotationModelChanged:function(e){function t(e,t){r.getBaseModel&&(e=r.mapOffset(e,!0),t=r.mapOffset(t,!0)),-1!==e&&-1!==t&&n.redrawRange(e,t)}function i(e,i){for(var n=0;n=5e4)var c=(new Date).getTime();if(this._rootBlock=this._stylerAdapter.createBlock(d,this,s,null),c){var h=(new Date).getTime()-c;h>10&&i.logTiming("editor","styler compute blocks (ms/50000 chars)",5e4*h/l,o.getContentType())}if(n){var u=[];n.removeAnnotations(e.AnnotationType.ANNOTATION_FOLDING),this._computeFolding(this._rootBlock.getBlocks(),t.getModel(),u),this._detectTasks&&(n.removeAnnotations(e.AnnotationType.ANNOTATION_TASK),this._computeTasks(this._rootBlock,s,u)),n.replaceAnnotations([],u)}t.redrawLines()}var d=function(e,t,i,n,o){var r;for(void 0===n&&(n=-1),void 0===o&&(o=e.length);o-n>1;)if(r=Math.floor((o+n)/2),t<=e[r].start)o=r;else{if(i&&tt.result.index?1:e.pattern.pattern.index0;){var h=d[0];if(d.splice(0,1),rt.result.index?1:e.pattern.pattern.index0;){var c=l[0];if(l.splice(0,1),c.result.indext.start?1:0});for(var g=0;g=r);u++){var p=c[u].start,f=c[u].end;if(p>l){var g=e.getLineAtOffset(l),_=e.getLineStart(g);this._stylerAdapter.parse(n.substring(_-o,p-o),_,l-_,i,a),a.forEach(function(e){e.style&&(0===e.style.indexOf(t.beginName)?s.push(e.start+1):0===e.style.indexOf(t.endName)&&s.push(-(e.start+1)))}),a=[]}l=f}return r>l&&(g=e.getLineAtOffset(l),_=e.getLineStart(g),this._stylerAdapter.parse(n.substring(_-o,r-o),_,l-_,i,a),a.forEach(function(e){e.style&&(0===e.style.indexOf(t.beginName)?s.push(e.start+1):0===e.style.indexOf(t.endName)&&s.push(-(e.start+1)))})),s},_findMatchingBracket:function(e,t,i){var n=e.getLineAtOffset(i),o=e.getLineEnd(n),r=e.getText(i,o),s=this._stylerAdapter.getBracketMatch(t,r);if(!s)return-1;for(var a=e.getLine(n),l=e.getLineStart(n),d=this._findBrackets(e,s,t,a,l,o),c=0;c=0?1:-1;if(d[c]*h-1===i){var u=1;if(s.atStart){for(c++;c=0?1:-1,u+=h,0===u)return d[c]*h-1;n+=1;for(var p=e.getLineCount();p>n;){a=e.getLine(n),l=e.getLineStart(n),o=e.getLineEnd(n),d=this._findBrackets(e,s,t,a,l,o);for(var f=0;f=0?1:-1,u+=h,0===u)return d[f]*h-1;n++}}else{for(c--;c>=0;c--)if(h=d[c]>=0?1:-1,u+=h,0===u)return d[c]*h-1;for(n-=1;n>=0;){a=e.getLine(n),l=e.getLineStart(n),o=e.getLineEnd(n),d=this._findBrackets(e,s,t,a,l,o);for(var g=d.length-1;g>=0;g--)if(h=d[g]>=0?1:-1,u+=h,0===u)return d[g]*h-1;n--}}break}}return-1},_getLineStyle:function(e){if(this._highlightCaretLine){var t=this._view,i=t.getModel(),n=t.getSelections(),o=!1;if(!n.some(function(t){return t.start===t.end?(o=o||i.getLineAtOffset(t.start)===e,!1):!0})&&o)return this._caretLineStyle}return null},_getStyles:function(e,t,i,n,o){for(var r=n+i.length,s=[],a=n+o,l=e.getBlocks(),c=d(l,a,!0),h=c;h=r);h++){var u=l[h].start,p=l[h].end;if(u>a){var f=t.getLineAtOffset(a),g=t.getLineStart(f);this._stylerAdapter.parse(i.substring(g-n,u-n),g,a-g,e,s)}var _=Math.max(a,u);if(_===u){var m=this._stylerAdapter.getBlockStartStyle(l[h],i.substring(_-n),_,s);m&&(_+=m.length)}var v=Math.min(r,p),y=[];if(v===p){var x=i.substring(v-a-(l[h].end-l[h].contentEnd)),b=this._stylerAdapter.getBlockEndStyle(l[h],x,v,y);b&&(v-=b.length)}f=t.getLineAtOffset(_),g=t.getLineStart(f);var w=this._getStyles(l[h],t,i.substring(g-n,v-n),g,_-g),C=this._stylerAdapter.getBlockContentStyleName(l[h]);if(C){var T=_;w.forEach(function(e){e.start-T&&s.push({start:T,end:e.start,style:C}),e.mergeable&&(e.style+=","+C),s.push(e),T=e.end}),v-T&&s.push({start:T,end:v,style:C})}else s=s.concat(w);s=s.concat(y),a=p}return r>a&&(f=t.getLineAtOffset(a),g=t.getLineStart(f),this._stylerAdapter.parse(i.substring(g-n,r-n),g,a-g,e,s)),s},_isRenderingWhitespace:function(){return this._whitespacesVisible},_onDestroy:function(){this.destroy()},_onLineStyle:function(e){e.textView===this._view&&(e.style=this._getLineStyle(e.lineIndex));var t=e.lineStart,i=e.textView.getModel();if(i.getBaseModel){t=i.mapOffset(t);var n=i.getBaseModel()}e.ranges=this._getStyles(this._rootBlock,n||i,e.lineText,t,0);for(var o=e.ranges.length-1;o>=0;o--){var r=e.ranges[o];if(r.style){if(r.style={styleClass:r.style.replace(/\./g," ")},n){var s=r.end-r.start;r.start=i.mapOffset(r.start,!0),r.end=r.start+s}}else e.ranges.splice(o,1)}this._isRenderingWhitespace()&&(this._spliceStyles(this._spacePattern,e.ranges,e.lineText,e.lineStart),this._spliceStyles(this._tabPattern,e.ranges,e.lineText,e.lineStart))},_onModelChanged:function(t){for(var i,n,o,r,s,a,l,c=t.start,h=t.removedCharCount,u=t.addedCharCount,p=u-h,f=this._view.getModel(),g=f.getBaseModel?f.getBaseModel():f,_=c+h,m=g.getCharCount(),v=g.getLineStart(g.getLineAtOffset(c)),y=this._findBlock(this._rootBlock,c);;){if(o=y.parent,!i&&o){if(0>p&&y.end-c<=-p){y=o;continue}if(s=g.getText(y.start,Math.min(m,y.end+p+1)),!this._stylerAdapter.verifyBlock(g,s,y,p)){y=o;continue}}n=y.getBlocks();var x=n.length,b=d(n,v,!0),w=d(n,_,!1,b-1,x);if(i=!1,b&&n.length&&n[b-1].end===c){s=g.getText(n[b-1].start,Math.min(m,c+1));var C=this.computeBlocks(g,s,y,n[b-1].start,null,null,null);C.length&&C[0].end!==n[b-1].end&&(b--,i=!0)}x>b&&n[b].start<=v&&(vc&&(l+=p)):b===x&&x>0&&y.end-p===n[x-1].end?(l=n[--b].start,l>c&&(l+=p)):l=Math.max(v,y.contentStart),a=x>w?n[w].end:y.contentEnd,a>=c&&(a+=p),a=Math.min(a,m-1),s=g.getText(l,a+1);var T=this.computeBlocks(g,s,y,l,null,null,null);if(x>w){if(T.length&&T[T.length-1].end===a&&T[T.length-1].typeId===n[w].typeId)break;if(T.length&&this._stylerAdapter.blockSpansBeyondEnd(T[T.length-1])){w++;for(var L=T[T.length-1].getBlocks(),k=(L.length?L[L.length-1]:T[T.length-1]).typeId;x>w;){if(n[w].typeId===k){var D=n[w].end+p;D=Math.min(D,m-1),s=g.getText(l,D+1);var A=this.computeBlocks(g,s,y,l,null,null,null);if(A.length&&A[A.length-1].end===D){a=D,T=A;break}}w++}if(x>w)break}}else if(!T.length||T[T.length-1].end<=y.contentEnd+p)break;if(!o){a=m,w=x,s=g.getText(l,a),T=this.computeBlocks(g,s,y,l,null,null,null);break}y=o,r=!0}this._rootBlock.adjustBounds(c,p),w=Math.min(w+1,x);var S;if(r||(r=w-b!==T.length),!r)for(var E=0;Ec&&($-=p),G>c&&(G-=p),c>=$&&G>c&&_>=$&&G>_){var z=g.getLineAtOffset(H.start),Y=g.getLineAtOffset(H.end);z!==Y?H.expanded||H.expand():F.push(H)}}else F.push(H),H.expand()}else H.type===e.AnnotationType.ANNOTATION_TASK&&y.start<=H.start&&H.end<=y.end&&F.push(H)}j&&U.getBlocks().forEach(function(e){this._updateFolding(e,g,f,W,P,l,a)}.bind(this)),this._detectTasks&&this._computeTasks(y,g,P,l,a),this._annotationProviders.forEach(function(e){var t=[],i=[];e(this._annotationModel,g,y,l,a,t,i),F=F.concat(t),P=P.concat(i)}.bind(this)),this._annotationModel.replaceAnnotations(F,P)}},_onMouseDown:function(e){if(2===e.clickCount){var t=this._view.getModel(),i=this._view.getOffsetAtLocation(e.x,e.y);if(i>0){var n=i-1,o=t;t.getBaseModel&&(n=t.mapOffset(n),o=t.getBaseModel());var r=this._findBlock(this._rootBlock,n),s=this._findMatchingBracket(o,r,n);if(-1!==s){e.preventDefault();var a=s;t.getBaseModel&&(a=t.mapOffset(a,!0)),i>a&&(i--,a++),this._view.setSelection(a,i)}}}},_onSelection:function(t){function i(e){var t={};return e.some(function(e){return e.isEmpty()?(t[l.getLineAtOffset(e.start).toString()]=!0,!1):!0})?{}:t}function n(e,t){for(var i in e)t[i]||(o=i>>0,a.redrawLines(o,o+1))}var o,r=Array.isArray(t.oldValue)?t.oldValue:[t.oldValue],s=Array.isArray(t.newValue)?t.newValue:[t.newValue],a=this._view,l=a.getModel();if(this._highlightCaretLine){var d=i(r),c=i(s);n(d,c),n(c,d)}if(this._annotationModel){var h,u,p=this._bracketAnnotations;if(1===s.length&&s[0].isEmpty()&&(u=s[0].getCaret())>0){var f=u-1;l.getBaseModel&&(f=l.mapOffset(f),l=l.getBaseModel());var g=this._findBlock(this._rootBlock,f),_=this._findMatchingBracket(l,g,f);-1!==_&&(h=[e.AnnotationType.createAnnotation(e.AnnotationType.ANNOTATION_MATCHING_BRACKET,_,_+1),e.AnnotationType.createAnnotation(e.AnnotationType.ANNOTATION_CURRENT_BRACKET,f,f+1)])}this._bracketAnnotations=h,this._annotationModel.replaceAnnotations(p,h)}},_spliceStyles:function(e,t,i,o){var r=e.regex;r.lastIndex=0;for(var s=0,a=r.exec(i);a;){for(var l=o+a.index;s|<|&|(\\|\\|))+",name:"punctuation.operator"},doc_block:{begin:"/\\*\\*",end:"\\*/",name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"meta.documentation.annotation"},{match:"<[^\\s>]*>",name:"meta.documentation.tag"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}}),define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["class","const","debugger","delete","enum","export","extends","function","implements","import","in","instanceof","interface","let","new","package","private","protected","public","static","super","typeof","var","void","with"],i=["break","case","catch","continue","default","do","else","finally","for","if","return","switch","throw","try","while","yield"],n=["this"],o=["false","null","true","undefined"],r=[];return r.push.apply(r,e.grammars),r.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{include:"#string_multiline_singleQuote"},{include:"#string_multiline_doubleQuote"},{include:"#templateLiteral"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"#regex"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"#jsFunctionDef"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{include:"#keywordsOperator"},{include:"#keywordsControl"},{include:"#languageConstant"},{include:"#languageVariable"}],repository:{jsFunctionDef:{begin:"(function)(\\s+[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*)?\\s*\\(",end:"\\)",captures:{1:{name:"keyword.operator.js"},2:{name:"entity.name.function.js"}},patterns:[{include:"orion.c-like#comment_singleLine"},{include:"orion.c-like#comment_block"},{match:"[^\\s,]+",name:"variable.parameter.js"}]},keywordsControl:{match:"\\b(?:"+i.join("|")+")\\b",name:"keyword.control.js"},keywordsOperator:{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.js"},languageConstant:{match:"\\b(?:"+o.join("|")+")\\b",name:"constant.language.js"},languageVariable:{match:"\\b(?:"+n.join("|")+")\\b",name:"variable.language.js"},string_multiline_singleQuote:{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},string_multiline_doubleQuote:{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"},regex:{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},templateLiteral:{begin:"`",end:"`",name:"string.quoted.backtick.js",patterns:[{begin:"\\$\\{",end:"\\}",name:"string.interpolated.js",patterns:[{include:"#string_multiline_singleQuote"},{include:"#string_multiline_doubleQuote"},{include:"#templateLiteral"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"#regex"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"#jsFunctionDef"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{include:"#keywordsOperator"},{include:"#keywordsControl"},{include:"#languageConstant"},{include:"#languageVariable"}]}]}}}),{id:r[r.length-1].id,grammars:r,keywords:t.concat(i).concat(n).concat(o)}}),define("orion/editor/stylers/application_vnd.coffeescript/syntax",["orion/editor/stylers/lib/syntax","orion/editor/stylers/application_javascript/syntax"],function(e,t){var i=["break","case","catch","continue","default","do","else","finally","for","if","loop","return","switch","then","throw","try","unless","until","when","while","yield"],n=["and","arguments","by","class","const","debugger","delete","enum","eval","export","extends","function","implements","import","instanceof","interface","in","isnt","is","let","native","new","not","no","off","of","on","or","package","private","protected","public","static","super","typeof","var","void","with","yes","__bind","__extends","__hasProp","__indexOf","__slice"],o=["false","null","true","undefined"],r=["this"],s=[];return s.push.apply(s,e.grammars),s.push.apply(s,t.grammars),s.push({id:"orion.coffeescript",contentTypes:["application/vnd.coffeescript"],patterns:[{include:"#comment_block"},{include:"#embedded_js"},{include:"#string_singleline"},{include:"#string_multiline"},{include:"#heregex"},{include:"#regex"},{include:"orion.lib#string_singleQuote"},{include:"#comment_singleLine"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{include:"#reserved_words"},{include:"#keyword_control"},{include:"#keyword_operator"},{include:"#language_variable"},{include:"#constant"},{include:"#punctuation"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"}],repository:{comment_block:{begin:{match:"###(?!#)",literal:"###"},end:{match:"###",literal:"###"},name:"comment.block.coffeescript"},comment_singleLine:{match:{match:"#[^$]*",literal:"#"},name:"comment.line.coffeescript"},constant:{match:"\\b(?:"+o.join("|")+")\\b",name:"constant.language.coffeescript"},embedded_js:{begin:"`",end:"`",patterns:[{include:"orion.js"}]},heregex:{begin:"\\/{3}",end:"\\/{3}(?:[gim]{0,3})",name:"string.heregexp.coffeescript",patterns:[{match:"\\s#[^$]*",name:"comment.block.coffeescript"}]},keyword_control:{match:"\\b(?:"+i.join("|")+")\\b",name:"keyword.control.coffeescript"},keyword_operator:{match:"\\b(?:"+n.join("|")+")\\b",name:"keyword.operator.coffeescript"},language_variable:{match:"\\b(?:"+r.join("|")+")\\b",name:"variable.language.coffeescript"},punctuation:{match:"[-=]?>|<|[-+*\\/%<>&|^!?=]?=|>>>=?|([-+*/%:])\\1|([&|<>])\\2=?|\\?\\.?|\\.{2,3}|%|@",name:"punctuation.operator.coffeescript"},regex:{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.coffeescript"},string_singleline:{match:'"(?:\\\\.|[^"])*"',name:"string.quoted.double.coffeescript",patterns:[{begin:"#{",end:"}",name:"string.interpolated.coffeescript",patterns:[{include:"#comment_block"},{include:"#embedded_js"},{include:"#comment_singleLine"},{include:"#heregex"},{include:"#regex"},{include:"orion.lib#string_singleQuote"},{include:"orion.lib#number_decimal"},{include:"#reserved_words"},{include:"#keyword_control"},{include:"#keyword_operator"},{include:"#language_variable"},{include:"#constant"},{include:"#punctuation"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"}]}]},string_multiline:{begin:'("("")?)',end:"\\1",name:"string.quoted.multiline.coffeescript",patterns:[{begin:"#{",end:"}",name:"string.interpolated.coffeescript",patterns:[{include:"#comment_block"},{include:"#embedded_js"},{include:"#comment_singleLine"},{include:"#heregex"},{include:"#regex"},{include:"orion.lib#string_singleQuote"},{include:"orion.lib#number_decimal"},{include:"#reserved_words"},{include:"#keyword_control"},{include:"#keyword_operator"},{include:"#language_variable"},{include:"#constant"},{include:"#punctuation"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"}]}]}}}),{id:s[s.length-1].id,grammars:s,keywords:i.concat(o)}}),define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["abstract","boolean","byte","char","class","double","extends","final","float","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","short","static","synchronized","throws","transient","void","volatile"],i=["break","case","catch","continue","default","do","else","finally","for","if","return","switch","throw","try","while"],n=["false","null","true"],o=["this","super"],r=[];return r.push.apply(r,e.grammars),r.push({id:"orion.java",contentTypes:["text/x-java-source"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.java"},{match:"\\b(?:"+i.join("|")+")\\b",name:"keyword.control.java"},{match:"\\b(?:"+n.join("|")+")\\b",name:"constant.language.java"},{match:"\\b(?:"+o.join("|")+")\\b",name:"variable.language.java"}]}),{id:r[r.length-1].id,grammars:r,keywords:t.concat(i).concat(n).concat(o)}
+}),define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["alignment-adjust","alignment-baseline","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","animation","appearance","azimuth","backface-visibility","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","background","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-bottom","border-collapse","border-color","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-image","border-left-color","border-left-style","border-left-width","border-left","border-radius","border-right-color","border-right-style","border-right-width","border-right","border-spacing","border-style","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-top","border-width","border","bottom","box-align","box-decoration-break","box-direction","box-flex-group","box-flex","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color-profile","color","column-count","column-fill","column-gap","column-rule-color","column-rule-style","column-rule-width","column-rule","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue-after","cue-before","cue","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit-position","fit","flex-align","flex-flow","flex-inline-pack","flex-order","flex-pack","float-offset","float","font-family","font-size-adjust","font-size","font-stretch","font-style","font-variant","font-weight","font","grid-columns","grid-rows","hanging-punctuation","height","hyphenate-after","hyphenate-before","hyphenate-character","hyphenate-lines","hyphenate-resource","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","left","letter-spacing","line-height","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","line-stacking","list-style-image","list-style-position","list-style-type","list-style","margin-bottom","margin-left","margin-right","margin-top","margin","mark-after","mark-before","mark","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","orphans","outline-color","outline-offset","outline-style","outline-width","outline","overflow-style","overflow-x","overflow-y","overflow","padding-bottom","padding-left","padding-right","padding-top","padding","page-break-after","page-break-before","page-break-inside","page-policy","page","pause-after","pause-before","pause","perspective-origin","perspective","phonemes","pitch-range","pitch","play-during","position","presentation-level","punctuation-trim","quotes","rendering-intent","resize","rest-after","rest-before","rest","richness","right","rotation-point","rotation","ruby-align","ruby-overhang","ruby-position","ruby-span","size","speak-header","speak-numeral","speak-punctuation","speak","speech-rate","stress","string-set","table-layout","target-name","target-new","target-position","target","text-align-last","text-align","text-decoration","text-emphasis","text-height","text-indent","text-justify","text-outline","text-shadow","text-transform","text-wrap","top","transform-origin","transform-style","transform","transition-delay","transition-duration","transition-property","transition-timing-function","transition","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch-range","voice-pitch","voice-rate","voice-stress","voice-volume","volume","white-space-collapse","white-space","widows","width","word-break","word-spacing","word-wrap","z-index"],i=["AliceBlue","AntiqueWhite","Aquamarine","Aqua","Azure","Beige","Bisque","Black","BlanchedAlmond","BlueViolet","Blue","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGrey","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Grey","GreenYellow","Green","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","LavenderBlush","Lavender","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","LimeGreen","Lime","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","OliveDrab","Olive","OrangeRed","Orange","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RebeccaPurple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","WhiteSmoke","White","YellowGreen","Yellow"],n=["charset","document","font-face","import","keyframes","media","namespace","page","supports"],o=[];return o.push.apply(o,e.grammars),o.push({id:"orion.css",contentTypes:["text/css"],patterns:[{include:"#string_single_multiline"},{include:"#string_double_multiline"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{include:"#numeric_value"},{include:"#color"},{include:"#keyword"},{include:"#directive"}],repository:{color:{match:"(?i)\\b(?:"+i.join("|")+")\\b",name:"constant.other.color.css"},directive:{match:"(^|\\s)(@("+n.join("|")+"))\\b",captures:{2:{name:"keyword.other.directive.css"}}},keyword:{match:"(?:-webkit-|-moz-|-ms-|-o-|\\b)(?:"+t.join("|")+")\\b",name:"support.type.propertyName.css"},number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"},numeric_value:{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},string_double_multiline:{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},string_single_multiline:{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"}}}),{id:o[o.length-1].id,grammars:o,keywords:t}}),define("orion/editor/stylers/application_xml/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=[];return t.push.apply(t,e.grammars),t.push({id:"orion.xml",contentTypes:["application/xml","application/xhtml+xml"],patterns:[{include:"#comment"},{include:"#doctype"},{include:"#xmlDeclaration"},{include:"#tag"},{include:"#ampersandEscape"}],repository:{ampersandEscape:{match:"<|>|&",name:"constant.character"},comment:{begin:{match:"",literal:"-->"},name:"comment.block.xml",patterns:[{match:"(\\b)(TODO)(\\b)(((?!-->).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}]},doctype:{begin:"",name:"meta.tag.doctype.xml",captures:{0:{name:"meta.tag.doctype.xml"}},patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},tag:{begin:"?[A-Za-z:_][A-Za-z0-9:_\\-.]*",end:"/?>",captures:{0:{name:"meta.tag.xml"}},patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},xmlDeclaration:{begin:"<\\?xml",end:"\\?>",captures:{0:{name:"meta.tag.declaration.xml"}},patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}],name:"meta.tag.declaration.xml"}}}),{id:t[t.length-1].id,grammars:t,keywords:[]}}),define("orion/editor/stylers/text_html/syntax",["orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_css/syntax","orion/editor/stylers/application_xml/syntax"],function(e,t,i){var n=["accept-charset","accept","accesskey","action","align","alt","async","autocomplete","autoplay","autosave","bgcolor","border","buffered","challenge","charset","checked","cite","class","codebase","code","color","colspan","cols","contenteditable","content","contextmenu","controls","coords","data-[A-Za-z_:][\\w.:-]*","data","datetime","default","defer","dirname","dir","disabled","download","draggable","dropzone","enctype","formaction","form","for","headers","height","hidden","high","hreflang","href","http-equiv","icon","id","ismap","itemprop","keytype","kind","label","language","lang","list","loop","low","manifest","maxlength","max","media","method","min","multiple","name","novalidate","open","optimum","pattern","ping","placeholder","poster","preload","pubdate","radiogroup","readonly","rel","required","reversed","rowspan","rows","sandbox","scoped","scope","seamless","selected","shape","sizes","size","span","spellcheck","srcdoc","srclang","srcset","src","start","step","style","summary","tabindex","target","title","type","usemap","value","width","wrap"],o=["activedescendant","atomic","autocomplete","busy","checked","controls","describedby","disabled","dropeffect","expanded","flowto","grabbed","haspopup","hidden","invalid","labelledby","label","level","live","multiline","multiselectable","orientation","owns","posinset","pressed","readonly","relevant","required","selected","setsize","sort","valuemax","valuemin","valuenow","valuetext"],r=[];return r.push.apply(r,e.grammars),r.push.apply(r,t.grammars),r.push.apply(r,i.grammars),r.push({id:"orion.html",contentTypes:["text/html"],patterns:[{begin:"(?i)()",captures:{1:{name:"meta.tag.html"},3:{name:"meta.tag.html"}},contentName:"source.css.embedded.html",patterns:[{include:"orion.css"}]},{begin:"(?i)",captures:{0:{name:"meta.tag.html"}},contentName:"source.js.embedded.html",patterns:[{include:"orion.js"}]},{begin:"?[A-Za-z0-9]+",end:"/?>",captures:{0:{name:"meta.tag.html"}},patterns:[{include:"orion.xml#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"#attribute"}]},{include:"orion.xml#comment"},{include:"orion.xml#doctype"},{include:"orion.xml#ampersandEscape"}],repository:{attribute:{match:"\\b(?:"+n.join("|")+"|role|aria-("+o.join("|")+"))\\b",name:"meta.tag.attribute.html"}}}),{id:r[r.length-1].id,grammars:r,keywords:[],attributes:n}}),define("orion/editor/stylers/application_x-jsp/syntax",["orion/editor/stylers/lib/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_html/syntax"],function(e,t,i){var n=["autoFlush","buffer","contentType","errorPage","extends","import","info","isErrorPage","isThreadSafe","language","pageEncoding","session"],o=[];return o.push.apply(o,e.grammars),o.push.apply(o,t.grammars),o.push.apply(o,i.grammars),o.push({id:"orion.jsp",contentTypes:["application/x-jsp"],patterns:[{include:"orion.html"},{include:"#jspComment"},{include:"#jspJavaFragment"},{include:"#jspDirectiveInclude"},{include:"#jspDirectivePage"},{include:"#jspDirectiveTaglib"}],repository:{jspComment:{begin:{match:"<%--",literal:"<%--"},end:{match:"--%>",literal:"<%--"},name:"comment.block.jsp",patterns:[{match:"(\\b)(TODO)(\\b)(((?!--%>).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}]},jspDirectiveInclude:{begin:"<%@\\s+include(?:\\s|$)",end:"%>",captures:{0:{name:"entity.name.directive.include.jsp"}},patterns:[{match:"\\bfile\\b",name:"entity.other.attribute-name.jsp"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},jspDirectivePage:{begin:"<%@\\s+page(?:\\s|$)",end:"%>",captures:{0:{name:"entity.name.directive.page.jsp"}},patterns:[{match:"\\b(?:"+n.join("|")+")\\b",name:"entity.other.attribute-name.jsp"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},jspDirectiveTaglib:{begin:"<%@\\s+taglib(?:\\s|$)",end:"%>",captures:{0:{name:"entity.name.directive.taglib.jsp"}},patterns:[{match:"\\b(?:uri|prefix)\\b",name:"entity.other.attribute-name.jsp"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},jspJavaFragment:{begin:"<%(?:=|!)?(?:\\s|$)",end:"%>",captures:{0:{name:"entity.name.declaration.java"}},contentName:"source.java.embedded.jsp",patterns:[{include:"orion.java"}]}}}),{id:o[o.length-1].id,grammars:o,keywords:[]}}),define("orion/editor/stylers/application_xquery/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["zero-digit","xquery","window","where","when","version","variable","validate","unordered","union","typeswitch","type","tumbling","try","treat","to","then","text","switch","strip","strict","start","stable","some","sliding","self","schema-element","schema-attribute","schema","satisfies","return","processing-instruction","previous","preserve","preceding-sibling","preceding","percent","per-mille","pattern-separator","parent","ordering","order","or","option","only","of","node","no-preserve","no-inherit","next","ne","NaN","namespace-node","namespace","module","mod","minus-sign","lt","let","least","le","lax","item","is","intersect","instance","inherit","infinity","in","import","if","idiv","gt","grouping-separator","group","greatest","ge","function","for","following-sibling","following","external","except","every","eq","end","encoding","empty-sequence","empty","else","element","document-node","div","digit","descending","descendant-or-self","descendant","default","declare","decimal-separator","decimal-format","count","copy-namespaces","context","construction","comment","collation","child","catch","castable","cast","case","by","boundary-space","base-uri","attribute","at","ascending","as","and","ancestor-or-self","ancestor","allowing"],i=[];return i.push.apply(i,e.grammars),i.push({id:"orion.xquery",contentTypes:["application/xquery"],patterns:[{include:"#comment"},{include:"#variable"},{include:"#multiLineDoubleQuote"},{include:"#multiLineSingleQuote"},{include:"orion.xml#tag"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.js"}],repository:{comment:{begin:{match:"\\(:",literal:"(:"},end:{match:":\\)",literal:":)"},name:"comment.block.xquery",patterns:[{match:"(\\b)(TODO)(\\b)(((?!:\\)).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},variable:{match:"\\$[a-zA-z0-9_]+",name:"variable.other.xquery"},multiLineDoubleQuote:{begin:'"',end:'"',name:"string.quoted.double"},multiLineSingleQuote:{begin:"'",end:"'",name:"string.quoted.single"}}}),{id:i[i.length-1].id,grammars:i,keywords:t}}),define("orion/editor/stylers/application_sql/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["ADD","ALTER\\s+TABLE","AND","ASC","BETWEEN","COMMIT","CREATE\\s+(TABLE|DATABASE)","CREATE\\s+(UNIQUE\\s+)?INDEX","DELETE\\s+FROM","DESC","DROP(\\s+(INDEX|TABLE|DATABASE))?","FROM","GROUP\\s+BY","HAVING","INSERT\\s+INTO","IN","LIKE","MODIFY","ON","ORDER\\s+BY","OR","PRIMARY\\s+KEY","ROLLBACK","SELECT(\\s+(COUNT|DISTINCT|SUM))?","SET","TO","TRUNCATE\\s+TABLE","UPDATE","USE","VALUES","WHERE"],i=[];return i.push.apply(i,e.grammars),i.push({id:"orion.sql",contentTypes:["application/sql"],patterns:[{include:"orion.lib#string_singleQuote"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#number_decimal"},{match:"(?i)\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.sql"},{match:"<>|>=?|<=?|=",name:"punctuation.operator.sql"}]}),{id:i[i.length-1].id,grammars:i,keywords:t}}),define("orion/editor/stylers/text_x-scss/syntax",["orion/editor/stylers/text_css/syntax","orion/editor/stylers/lib/syntax"],function(e,t){var i=["default","global","optional"],n=["false","null","true"],o=["at-root","content","debug","each","else","error","extend","for","function","if","include","mixin","return","warn","while"],r=[];return r.push.apply(r,e.grammars),r.push.apply(r,t.grammars),r.push({id:"orion.scss",contentTypes:["text/x-scss"],patterns:[{include:"orion.css#string_single_multiline"},{include:"orion.css#string_double_multiline"},{include:"orion.c-like#comment_block"},{include:"#eachin"},{include:"#forto"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"#variable"},{include:"#placeholder"},{include:"#flag"},{include:"#directive"},{include:"orion.css#directive"},{include:"#constant"},{include:"#interpolated"},{include:"#operator"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.css#number_hex"},{include:"orion.css#numeric_value"},{include:"orion.css#color"},{include:"orion.css#keyword"}],repository:{constant:{match:"\\b(?:"+n.join("|")+")\\b",name:"constant.language.scss"},directive:{match:"(^|\\s)(@("+o.join("|")+"))\\b",captures:{2:{name:"keyword.other.directive.scss"}}},eachin:{begin:"@each\\s",end:"\\sin\\b",captures:{0:{name:"keyword.other.directive.scss"}},patterns:[{include:"#variable"}]},flag:{match:"(^|\\s)(!("+i.join("|")+"))\\b",captures:{2:{name:"keyword.other.flag.scss"}}},forto:{begin:"@for\\s",end:"(^|\\s)(t(o|hrough))(\\s|$)",beginCaptures:{0:{name:"keyword.other.directive.scss"}},endCaptures:{2:{name:"keyword.other.directive.scss"}},patterns:[{include:"#variable"},{include:"orion.lib#number_decimal"},{match:"(^|\\s)(from)(\\s|$)",name:"keyword.other.directive.scss"}]},interpolated:{match:"#\\{[^}]*\\}",name:"string.interpolated.scss"},operator:{match:"\\+|\\*|\\/|%|==?|!=|&|<=?|=?>|!",name:"punctuation.operator.scss"},placeholder:{match:"%[\\w-]+",name:"variable.other.placeholder.sas"},variable:{match:"\\$[\\w-]+(\\.{3})?",name:"variable.other.scss"}}}),{id:r[r.length-1].id,grammars:r,keywords:o.concat(i)}}),define("orion/editor/stylers/text_x-less/syntax",["orion/editor/stylers/text_css/syntax","orion/editor/stylers/lib/syntax"],function(e,t){var i=["important"],n=["true"],o=["arguments"],r=["all","and","not","when"],s=["css","inline","less","multiple","once","optional","reference"],a=[];return a.push.apply(a,e.grammars),a.push.apply(a,t.grammars),a.push({id:"orion.less",contentTypes:["text/x-less"],patterns:[{include:"orion.css#string_single_multiline"},{include:"orion.css#string_double_multiline"},{include:"orion.c-like#comment_block"},{include:"#string_doubleQuote"},{include:"#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"#importDirective"},{include:"orion.css#directive"},{include:"#directive"},{include:"#variable"},{include:"#interpolated"},{include:"#constant"},{include:"#flag"},{include:"#operator"},{include:"#keyword"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.css#number_hex"},{include:"orion.css#numeric_value"},{include:"orion.css#color"},{include:"orion.css#keyword"}],repository:{constant:{match:"\\b(?:"+n.join("|")+")\\b",name:"constant.language.less"},directive:{match:"(^|\\s)(@("+o.join("|")+"))\\b",captures:{2:{name:"keyword.other.directive.less"}}},flag:{match:"(^|\\s)(!("+i.join("|")+"))\\b",captures:{2:{name:"keyword.other.flag.less"}}},importDirective:{begin:"(@import)\\s*\\(",end:"\\)",beginCaptures:{1:{name:"keyword.other.directive.less"}},patterns:[{match:"\\b(?:"+s.join("|")+")\\b",name:"keyword.operator.less"}]},interpolated:{match:"@\\{[^}]*\\}",name:"string.interpolated.less"},keyword:{match:"\\b(?:"+r.join("|")+")\\b",name:"keyword.operator.less"},operator:{match:"\\+_?|\\*|\\/|=|>=?|<=?|&",name:"punctuation.operator.less"},string_doubleQuote:{match:'~?"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"~?'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},variable:{match:"@[\\w-]+(\\.{3})?",name:"variable.other.less"}}}),{id:a[a.length-1].id,grammars:a,keywords:o.concat(i).concat(s).concat(r)}}),define("orion/editor/stylers/text_jsx/syntax",["orion/editor/stylers/lib/syntax","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/application_xml/syntax"],function(e,t,i){var n=[];return n.push.apply(n,e.grammars),n.push.apply(n,t.grammars),n.push.apply(n,i.grammars),n.push({id:"orion.jsx",contentTypes:["text/jsx"],patterns:[{begin:"?[A-Za-z0-9]+",end:"/?>",captures:{0:{name:"meta.tag.jsx"}},patterns:[{include:"#jsExpression"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.c-like#comment_block"}]},{include:"orion.xml#ampersandEscape"},{include:"orion.js"}],repository:{jsExpression:{begin:"\\{",end:"\\}",contentName:"source.js.embedded.jsx",patterns:[{include:"orion.js"}]}}}),{id:n[n.length-1].id,grammars:n,keywords:[]}}),define("orion/editor/stylers/application_json/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["false","true"],i=[];return i.push.apply(i,e.grammars),i.push({id:"orion.json",contentTypes:["application/json"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.json"}]}),{id:i[i.length-1].id,grammars:i,keywords:t}}),define("orion/editor/stylers/text_x-csrc/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["auto","break","case","char","const","continue","default","double","do","else","enum","extern","float","for","goto","if","inline","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","_Bool","_Complex","_Imaginary"],i=["define","elif","else","endif","error","ifdef","ifndef","if","include","line","pragma","undef"],n=[];return n.push.apply(n,e.grammars),n.push({id:"orion.c",contentTypes:["text/x-csrc","text/x-c"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"#directive"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.c"}],repository:{directive:{match:"#\\s*(?:"+i.join("|")+")\\b[^$]*",name:"meta.preprocessor.c"}}}),{id:n[n.length-1].id,grammars:n,keywords:t.concat(i)}}),define("orion/editor/stylers/text_x-csharp/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["abstract","as","base","bool","break","byte","by","case","catch","char","checked","class","const","continue","decimal","default","delegate","descending","double","do","else","enum","event","explicit","extern","false","finally","fixed","float","foreach","for","from","goto","group","if","implicit","int","interface","internal","into","in","is","lock","long","namespace","new","null","object","operator","orderby","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","select","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","var","virtual","volatile","void","while","where","yield"],i=["define","elif","else","endif","endregion","error","if","line","pragma checksum","pragma warning","pragma","region","undef","warning"],n=[];return n.push.apply(n,e.grammars),n.push({id:"orion.csharp",contentTypes:["text/x-csharp"],patterns:[{match:"^\\s*#(?:"+i.join("|")+")\\b[^$]*",name:"meta.preprocessor.csharp"},{include:"#string_verbatim"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"#doc_line"},{include:"orion.c-like#comment_singleLine"},{include:"#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.csharp"}],repository:{doc_block:{begin:"/\\*\\*",end:"\\*/",name:"comment.block.documentation.csharp",patterns:[{match:"<[^\\s>]*>",name:"meta.documentation.tag"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},doc_line:{match:"// /.*",name:"comment.line.documentation.csharp",patterns:[{match:"<[^\\s>]*>",name:"meta.documentation.tag"},{include:"orion.lib#todo_comment_singleLine"}]},string_verbatim:{begin:'@"',end:'^(?:""|[^"])*"(?!")',name:"string.quoted.verbatim.csharp"}}}),{id:n[n.length-1].id,grammars:n,keywords:t}}),define("orion/editor/stylers/text_x-cshtml/syntax",["orion/editor/stylers/application_xml/syntax","orion/editor/stylers/text_html/syntax","orion/editor/stylers/text_x-csharp/syntax"],function(e,t,i){var n=[];return n.push.apply(n,e.grammars),n.push.apply(n,t.grammars),n.push.apply(n,i.grammars),n.push({id:"orion.cshtml",contentTypes:["text/x-cshtml"],patterns:[{include:"#comment"},{include:"#codeBlock"},{include:"#expression"},{include:"#reference"},{include:"orion.html"}],repository:{comment:{begin:{match:"@\\*",literal:"@*"},end:{match:"\\*@",literal:"*@"},name:"comment.block.cshtml"},codeBlock:{begin:"(^\\s*)(@)(?=([^{]*){)",end:"}",captures:{2:{name:"entity.name.declaration.csharp"}},contentName:"source.csharp.embedded.cshtml",patterns:[{include:"orion.xml#tag"},{include:"#reference"},{include:"orion.csharp"}]},expression:{match:"^\\s*@[^{]*$",name:"source.csharp.embedded.cshtml",patterns:[{include:"#reference"},{include:"orion.csharp"}]},reference:{match:"@",name:"entity.name.declaration.csharp"}}}),{id:n[n.length-1].id,grammars:n,keywords:[]}}),define("orion/editor/stylers/text_x-c__src/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["alignas","alignof","asm","and_eq","and","auto","bitand","bitor","bool","break","case","catch","char16_t","char32_t","char","class","compl","constexpr","const_cast","const","continue","decltype","default","delete","double","do","dynamic_cast","else","enum","explicit","export","extern","false","float","for","friend","goto","if","inline","int","long","mutable","namespace","new","noexcept","not_eq","not","nullptr","operator","or_eq","or","private","protected","public","register","reinterpret_cast","return","short","signed","sizeof","static_assert","static_cast","static","struct","switch","template","this","thread_local","throw","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","while","xor_eq","xor","_Bool","_Complex","_Imaginary"],i=["define","elif","else","endif","error","ifdef","ifndef","if","include","line","pragma","undef"],n=[];return n.push.apply(n,e.grammars),n.push({id:"orion.cpp",contentTypes:["text/x-c++src","text/x-c++"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"#directive"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.cpp"}],repository:{directive:{match:"#\\s*(?:"+i.join("|")+")\\b[^$]*",name:"meta.preprocessor.cpp"}}}),{id:n[n.length-1].id,grammars:n,keywords:t}}),define("orion/editor/stylers/text_x-dockerfile/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["add","cmd","copy","entrypoint","env","expose","from","maintainer","onbuild","run","user","volume","workdir"],i="orion.dockerfile",n=[];return n.push.apply(n,e.grammars),n.push({id:i,contentTypes:["text/x-dockerfile"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"#numberSignComment"},{match:"\\b-?[0-9]+(\\.[0-9]+)?\\b",name:"constant.numeric.dockerfile"},{match:"(?i)^\\s*(?:"+t.join("|")+")\\b",name:"keyword.operator.dockerfile"}],repository:{numberSignComment:{begin:{match:"^\\s*#",literal:"#"},end:{match:"$",literal:""},name:"comment.line.number-sign.dockerfile",patterns:[{include:"orion.lib#todo_comment_singleLine"}]}}}),{id:i,grammars:n,keywords:t}}),define("orion/editor/stylers/text_x-erlang/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["xor","when","try","rem","receive","query","orelse","or","of","not","let","if","fun","end","div","cond","catch","case","bxor","bsr","bsl","bor","bnot","begin","band","andalso","and","after"],i=["vsn","undef","type","spec","record","on_load","opaque","module","include_lib","include","import","ifndef","ifdef","file","export_type","export","endif","else","define","callback","compile","behaviour"],n=[];return n.push.apply(n,e.grammars),n.push({id:"orion.erlang",contentTypes:["text/x-erlang"],patterns:[{include:"#comment"},{include:"#stringSingleLine"},{include:"#stringMultiLine"},{include:"#method"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.erlang"},{match:"^\\s*-(?:"+i.join("|")+")\\b",name:"keyword.operator.erlang"}],repository:{comment:{match:{match:"%.*",literal:"%"},name:"comment.line.erlang",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},method:{match:"(^|\\s)[a-zA-Z0-9_.]+(?=\\(|\\s\\()",name:"entity.name.function.erlang"},stringMultiLine:{begin:'"(?:\\\\.|[^\\\\"])*$',end:'^(?:\\\\.|[^\\\\"])*"',name:"string.quoted.double.erlang"},stringSingleLine:{match:'"(?:\\\\.|[^\\\\"])*"',name:"string.quoted.double.erlang"}}}),{id:n[n.length-1].id,grammars:n,keywords:t}
+}),define("orion/editor/stylers/text_x-ruby/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["alias_method","alias","attr_accessor","attr_reader","attr_writer","attr","BEGIN","class","defined?","def","END","extend","gem","include","initialize","in","load","lambda","module_function","module","new","not","public","prepend","private","protected","require_relative","require","undef","__ENCODING__","__END__","__FILE__","__LINE__"],i=["and","begin","break","case","catch","do","else","elsif","end","ensure","fail","for","if","loop","next","or","raise","redo","rescue","retry","return","then","throw","unless","until","when","while","yield"],n=["false","nil","true"],o=["self","super"],r=[];return r.push.apply(r,e.grammars),r.push({id:"orion.ruby",contentTypes:["text/x-ruby"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"#symbol_quoted_single"},{include:"#symbol_quoted_double"},{include:"#symbol"},{include:"#classRef"},{match:"/(?![\\s])(?:\\\\.|[^/])+/(?:[ioxmuesn]\\b)?",name:"string.regexp.ruby"},{match:{match:"#.*",literal:"#"},name:"comment.line.number-sign.ruby",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},{begin:{match:"^=begin\\b",literal:"\n=begin "},end:{match:"^=end\\b",literal:"\n=end "},name:"comment.block.ruby",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{include:"#variable"},{match:"\\b0[bB][01]+\\b",name:"constant.numeric.binary.ruby"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.ruby"},{match:"\\b(?:"+i.join("|")+")\\b",name:"keyword.control.ruby"},{match:"\\b(?:"+n.join("|")+")\\b",name:"constant.language.ruby"},{match:"\\b(?:"+o.join("|")+")\\b",name:"variable.language.ruby"}],repository:{classRef:{match:"\\w+::\\w+"},symbol:{match:":\\w+",name:"entity.name.symbol.ruby"},symbol_quoted_single:{match:":'[^']*'",name:"entity.name.symbol.quoted.single.ruby"},symbol_quoted_double:{match:':"[^"]*"',name:"entity.name.symbol.quoted.double.ruby"},variable:{match:"@\\w+",name:"entity.name.variable.ruby"}}}),{id:r[r.length-1].id,grammars:r,keywords:t.concat(i).concat(n).concat(o)}}),define("orion/editor/stylers/text_x-haml/syntax",["orion/editor/stylers/lib/syntax","orion/editor/stylers/text_x-ruby/syntax"],function(e,t){var i=[];return i.push.apply(i,e.grammars),i.push.apply(i,t.grammars),i.push({id:"orion.haml",contentTypes:["text/x-haml"],patterns:[{include:"#inlineRuby"},{include:"#interpolatedRuby"},{include:"#tagWithRubySymbols"},{include:"#tagWithHTMLAttributes"},{include:"#doctype"},{include:"#tag"},{include:"#htmlComment"}],repository:{doctype:{match:"^!!!.*$",name:"meta.tag.doctype.haml"},htmlComment:{match:{match:"/[^[].*$",literal:"/"},name:"comment.line.html.haml"},inlineRuby:{begin:"(?:^|[^\\\\])(?:=|-|~|&==?|!==?)",end:"(?:^|[^,])$",contentName:"source.ruby.embedded.haml",patterns:[{include:"orion.ruby"}]},interpolatedRuby:{begin:"#{",end:"}",contentName:"source.ruby.embedded.haml",patterns:[{include:"orion.ruby"}]},tag:{match:"^\\s*%[^\\b]+?\\b",name:"meta.tag.haml"},tagWithHTMLAttributes:{begin:"(^\\s*)(%[^\\s(]+?)\\(",end:"\\)\\s*$",beginCaptures:{2:{name:"meta.tag.haml"}},patterns:[{match:"[^\\s=]+(?==)",name:"entity.name.attribute.html.haml"},{include:"orion.ruby#variable"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},tagWithRubySymbols:{begin:"(^\\s*)(%[^\\b]+?)\\b{",end:"}\\s*$",beginCaptures:{2:{name:"meta.tag.haml"}},patterns:[{include:"orion.ruby#symbol"},{include:"orion.ruby#variable"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]}}}),{id:i[i.length-1].id,grammars:i,keywords:[]}}),define("orion/editor/stylers/text_x-jade/syntax",["orion/editor/stylers/lib/syntax","orion/editor/stylers/application_javascript/syntax"],function(e,t){var i=["&attributes","block","case","default","doctype","each","else","extends","for","if","include","mixin","unless","when","while"],n=[];return n.push.apply(n,e.grammars),n.push.apply(n,t.grammars),n.push({id:"orion.jade",contentTypes:["text/x-jade"],patterns:[{include:"#comment_singleLine"},{include:"#code"},{include:"#control"},{include:"#caseBranch"},{include:"#mixinWithParameters"},{include:"#mixinRefWithArguments"},{include:"#tagWithAttributes"},{include:"#interpolatedJS"},{include:"#interpolatedTag"},{include:"#mixin"},{include:"#mixinRef"},{include:"#doctype"},{include:"#filter"},{include:"#case"},{include:"#andAttributes"},{include:"#otherKeywords"},{include:"#tag"}],repository:{andAttributes:{match:"&attributes\\b",name:"keyword.operator.jade"},"case":{match:"(^\\s*)(case)\\b",captures:{2:{name:"keyword.control.jade"}}},caseBranch:{begin:"(^\\s*)(when|default)\\s*",end:":|$",contentName:"source.js.embedded.jade",patterns:[{include:"orion.js"}],beginCaptures:{2:{name:"keyword.control.jade"}}},code:{match:"(^\\s*- |= |!= ).*$",name:"source.js.embedded.jade",patterns:[{include:"orion.js"}]},comment_singleLine:{match:{match:"^\\s*//.*",literal:"//"},name:"comment.line.double-slash.jade",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},control:{begin:"(^\\s*)(if|else( if)?|each|for|unless|while)\\b",end:"$",beginCaptures:{2:{name:"keyword.control.jade"}},contentName:"source.js.embedded.jade",patterns:[{include:"orion.js"}]},doctype:{match:"(^\\s*)(doctype.+$)",captures:{2:{name:"meta.tag.doctype.jade"}}},filter:{match:"(^\\s*)(:\\w+)",captures:{2:{name:"entity.other.filter.jade"}}},interpolatedJS:{begin:"(#{)",end:"(})",captures:{1:{name:"string.interpolated.js.jade"}},contentName:"source.js.embedded.jade",patterns:[{include:"orion.js"}]},interpolatedTag:{begin:"(#\\[)",end:"(\\])",captures:{1:{name:"string.interpolated.tag.jade"}},patterns:[{begin:"(\\.|\\w+)\\s*\\(",end:"(\\))(/)?",beginCaptures:{1:{name:"meta.tag.jade"}},endCaptures:{2:{name:"meta.tag.jade"}},contentName:"source.js.embedded.jade",patterns:[{include:"orion.js"}]}]},mixin:{match:"(^\\s*)(mixin)(\\s+)(\\w+)",captures:{2:{name:"keyword.operator.jade"},4:{name:"entity.name.mixin.jade"}}},mixinRef:{match:"(^\\s*)(\\+\\w+)",captures:{2:{name:"entity.name.mixin.jade"}}},mixinRefWithArguments:{begin:"(^\\s*)(\\+\\w+)\\s*\\(",end:"\\)|$",captures:{2:{name:"entity.name.mixin.jade"}},patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.lib#number_decimal"}]},mixinWithParameters:{begin:"(^\\s*)(mixin)(\\s+)(\\w+)\\s*\\(",end:"\\)|$",beginCaptures:{2:{name:"keyword.operator.jade"},4:{name:"entity.name.mixin.jade"}},patterns:[{match:"[^\\s,]+",name:"variable.parameter.jade"}]},otherKeywords:{match:"(^\\s*)(block|extends|include)\\b",captures:{2:{name:"keyword.operator.jade"}}},tag:{match:"(^\\s*)(\\w+|(?=\\.)|(?=#))(#\\w*|\\.\\w*)*(/?)",captures:{2:{name:"meta.tag.jade"},4:{name:"meta.tag.jade"}}},tagWithAttributes:{begin:"(^\\s*)(\\w+|(?=\\.)|(?=#))(#\\w*|\\.\\w*)*\\s*\\(",end:"(\\))(/)?",beginCaptures:{2:{name:"meta.tag.jade"}},endCaptures:{2:{name:"meta.tag.jade"}},contentName:"source.js.embedded.jade",patterns:[{include:"orion.js"}]}}}),{id:n[n.length-1].id,grammars:n,keywords:i}}),define("orion/editor/stylers/text_x-lua/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["and","break","do","else","elseif","end","false","for","function","if","in","local","nil","not","or","repeat","return","then","true","until","while"],i=["assert","arg","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall"],n=["_G","LUA_INIT","LUA_PATH","LUA_CPATH","_VERSION"],o=[];return o.push.apply(o,e.grammars),o.push({id:"orion.lua",contentTypes:["text/x-luasrc","text/x-lua"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"#comment_block_dash_dash"},{include:"#comment_singleLine_dash_dash"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{include:"#base_functions"},{include:"#base_variables"},{include:"#reserved_underscore_capital"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.lua"}],repository:{comment_block_dash_dash:{begin:{match:"--\\[\\[",literal:"--[["},end:{match:"\\]\\]",literal:"]]"},name:"comment.block.dash-dash.lua",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\]\\]).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},comment_singleLine_dash_dash:{begin:{match:"--",literal:"--"},end:{match:"$",literal:""},name:"comment.line.dash-dash.lua",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},base_functions:{match:"\\b(?:"+i.join("|")+")\\b",name:"support.function.lua"},base_variables:{match:"\\b(?:"+n.join("|")+")\\b",name:"support.variable.lua"},reserved_underscore_capital:{match:"\\b_[A-Z]*\\b",name:"constant.other.userdefined.lua"}}}),{id:o[o.length-1].id,grammars:o,keywords:t}}),define("orion/editor/stylers/text_x-php/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["abstract","and","array","as","callable","class","clone","const","declare","echo","empty","eval","extends","final","function","global","implements","include","include_once","insteadof","interface","instanceof","isset","list","namespace","new","or","parent","print","private","protected","public","require","require_once","static","trait","unset","use","var","xor","__halt_compiler","__CLASS__","__DIR__","__FILE__","__FUNCTION__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__"],i=["break","case","catch","continue","default","die","do","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","exit","finally","for","foreach","goto","if","return","switch","throw","try","while","yield"],n=["false","FALSE","null","NULL","true","TRUE"],o=["self"],r=[];return r.push.apply(r,e.grammars),r.push({id:"orion.php-core",patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{match:{match:"#.*",literal:"#"},name:"comment.line.number-sign.php",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},{begin:"<<<(\\w+)$",end:"^\\1;$",name:"string.unquoted.heredoc.php"},{begin:"<<<'(\\w+)'$",end:"^\\1;$",name:"string.unquoted.heredoc.nowdoc.php"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{match:"\\b0[bB][01]+\\b",name:"constant.numeric.binary.php"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.php"},{match:"\\b(?:"+i.join("|")+")\\b",name:"keyword.control.php"},{match:"\\b(?:"+n.join("|")+")\\b",name:"constant.language.php"},{match:"\\b(?:"+o.join("|")+")\\b",name:"variable.language.php"}]}),r.push({id:"orion.php",contentTypes:["text/x-php"],patterns:[{begin:"(?i)<(\\?|%(?!php))(?:=|php)?(?:\\s|$)",end:"[\\1]>",captures:{0:{name:"entity.name.declaration.php"}},contentName:"source.php.embedded",patterns:[{include:"orion.php-core"}]},{include:"orion.html"}]}),{id:r[r.length-1].id,grammars:r,keywords:t.concat(i).concat(n).concat(o)}}),define("orion/editor/stylers/text_x-python/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["and","as","assert","break","class","continue","def","del","exec","elif","else","except","Ellipsis","False","finally","for","from","global","if","import","in","is","lambda","not","None","NotImplemented","or","pass","print","raise","return","try","True","while","with","yield"],i=[];return i.push.apply(i,e.grammars),i.push({id:"orion.python",contentTypes:["text/x-python"],patterns:[{begin:"(['\"])\\1\\1",end:"\\1\\1\\1",name:"string.quoted.triple.python"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{begin:{match:"#",literal:"#"},end:{match:"$",literal:""},name:"comment.line.number-sign.python",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.python"}],repository:{number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)[lL]?\\b",name:"constant.numeric.number.python"}}}),{id:i[i.length-1].id,grammars:i,keywords:t}}),define("orion/editor/stylers/text_x-go/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["break","case","const","continue","default","defer","else","fallthrough","false","for","func","goto","go","if","import","nil","package","range","return","select","switch","true","type","var"],i=[];return i.push.apply(i,e.grammars),i.push({id:"orion.go",contentTypes:["text/x-go"],patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{begin:"`",end:"`",name:"string.quoted.raw.go"},{include:"orion.c-like#comment_singleLine"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.go"},{match:"\\b(?:len|cap|new|make|append|close|copy|delete|complex|real|imag|panic|recover)\\b",name:"support.function.go"},{match:"\\b(?:bool|chan|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|float64|complex64|complex128|byte|map|rune|uint|interface|int|uintptr|string|struct|error)\\b",name:"support.function.type"}]}),{id:i[i.length-1].id,grammars:i,keywords:t}}),define("orion/editor/stylers/text_x-objective-c/syntax",["orion/editor/stylers/text_x-csrc/syntax"],function(e){var t=["atomic","BOOL","bycopy","byref","Class","id","IMP","inout","in","nil","nonatomic","NO","NULL","oneway","out","Protocol","retain","SEL","self","super","YES"],i=["@catch","@class","@dynamic","@end","@finally","@implementation","@interface","@private","@property","@protected","@protocol","@public","@selector","@synthesize","@throw","@try"],n=["import"],o=[];return o.push.apply(o,e.grammars),o.push({id:"orion.objectiveC",contentTypes:["text/x-objective-c"],patterns:[{include:"#objectiveCString"},{include:"orion.c"},{include:"#objectiveCDirective"},{include:"#objectiveCKeyword"}],repository:{objectiveCDirective:{match:"#\\s*(?:"+n.join("|")+")\\b[^$]*",name:"meta.preprocessor.objective-c"},objectiveCKeyword:{match:"(\\b(?:"+t.join("|")+")|(?:"+i.join("|")+"))\\b",name:"keyword.operator.objective-c"},objectiveCString:{match:'@"(?:\\\\.|[^"])*"?',name:"string.quoted.double.objective-c"}}}),{id:o[o.length-1].id,grammars:o,keywords:e.keywords.concat(t).concat(n).concat(i)}}),define("orion/editor/stylers/text_x-properties/syntax",[],function(){var e=[];return e.push({id:"orion.properties",contentTypes:["text/x-properties"],patterns:[{match:"^\\s*#[^$]*",name:"comment.line.properties"},{begin:"(^[^=]*)(=)",end:".*[^\\\\]$",beginCaptures:{1:{name:"entity.name.properties"},2:{name:"punctuation.operator.properties"}},endCaptures:{0:{name:"string.unquoted.properties"}},contentName:"string.unquoted.properties"}]}),{id:e[e.length-1].id,grammars:e,keywords:[]}}),define("orion/editor/stylers/text_x-smarty/syntax",["orion/editor/stylers/lib/syntax","orion/editor/stylers/text_html/syntax","orion/editor/stylers/text_x-php/syntax"],function(e,t,i){var n=["false","no","off","on","true","yes"],o="{",r="}",s=[];return s.push.apply(s,e.grammars),s.push.apply(s,t.grammars),s.push.apply(s,i.grammars),s.push({id:"orion.smarty",contentTypes:["text/x-smarty"],patterns:[{include:"orion.html"},{include:"#smartyCommentBlock"},{include:"#literalBlock"},{include:"#phpBlock"},{include:"#smartyBlock"}],repository:{literalBlock:{begin:"({)literal(})",end:"({)/literal(})",captures:{1:"punctuation.brace.begin.smarty",2:"punctuation.brace.end.smarty"}},phpBlock:{begin:"({)php(})",end:"({)/php(})",captures:{1:"punctuation.brace.begin.smarty",2:"punctuation.brace.end.smarty"},contentName:"source.php.embedded.smarty",patterns:[{include:"orion.php-core"}]},smartyBlock:{begin:"("+o+")",end:"("+r+")",captures:{1:"punctuation.brace.begin.smarty",2:"punctuation.brace.end.smarty"},patterns:[{include:"orion.lib#string_singleQuote"},{include:"#smartyString_doubleQuote"},{include:"#smartyVariable"},{include:"#smartyConfigVariable"},{include:"#smartyConstant"},{include:"orion.lib#number_decimal"}]},smartyCommentBlock:{begin:{match:o+"\\*",literal:o+"*"},end:{match:"\\*"+r,literal:"*"+r},name:"comment.block.smarty"},smartyConfigVariable:{match:"#\\w+#",name:"variable.other.config.smarty"},smartyConstant:{match:"\\b(?:"+n.join("|")+")\\b",name:"constant.language.smarty"},smartyEscapedVariable:{match:"`\\$[^`]+`",name:"variable.other.escaped.smarty"},smartyString_doubleQuote:{begin:'"',end:'"',name:"string.quoted.double.smarty",patterns:[{include:"#smartyEscapedVariable"},{include:"#smartyVariable"},{include:"#smartyConfigVariable"}]},smartyVariable:{match:"\\$(?:smarty\\.(?:config|server)\\.)?\\w+",name:"variable.other.smarty"}}}),{id:s[s.length-1].id,grammars:s,keywords:[]}}),define("orion/editor/stylers/text_x-swift/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["associativity","as","class","convenience","deinit","didSet","dynamicType","dynamic","enum","extension","final","func","get","import","infix","init","inout","internal","in","is","lazy","left","let","mutating","none","nonmutating","operator","optional","override","postfix","precedence","prefix","private","protocol","Protocol","public","required","right","Self","set","static","struct","subscript","typealias","Type","unowned","var","weak","willSet","@objc"],i=["break","case","continue","default","do","else","fallthrough","for","if","return","switch","where","while"],n=["false","nil","true"],o=["self","super"],r=["__COLUMN__","__FILE__","__FUNCTION__","__LINE__"],s=[];return s.push.apply(s,e.grammars),s.push({id:"orion.swift",contentTypes:["text/x-swift"],patterns:[{include:"#string_doubleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"#number_binary"},{include:"#number_hex"},{include:"#number_octal"},{include:"#number_decimal"},{include:"#keywords_operator"},{include:"#keywords_control"},{include:"#constants"},{include:"#languageVars1"},{include:"#languageVars2"}],repository:{comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block.swift",patterns:[{include:"#comment_block"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task.swift"},4:{name:"comment.block.swift"}}}]},constants:{match:"(^|[^\\w`])("+n.join("|")+")\\b",captures:{2:{name:"constant.language.swift"}}},keywords_operator:{match:"(^|[^\\w`])("+t.join("|")+")\\b",captures:{2:{name:"keyword.operator.swift"}}},keywords_control:{match:"(^|[^\\w`])("+i.join("|")+")\\b",captures:{2:{name:"keyword.control.swift"}}},languageVars1:{match:"(^|[^\\w`])("+o.join("|")+")\\b",captures:{2:{name:"variable.language.swift"}}},languageVars2:{match:"(^|[^\\w`])("+r.join("|")+")(?:$|[^\\w])",captures:{2:{name:"variable.language.swift"}}},number_binary:{match:"\\b0b[01]+\\b",name:"constant.numeric.binary.swift"},number_decimal:{match:"\\b-?(?:\\.\\d[\\d_]*|\\d[\\d_]*\\.?[\\d_]*)(?:[eE][+-]?\\d[\\d_]*)?\\b",name:"constant.numeric.decimal.swift"},number_hex:{match:"\\b0[xX](?:\\.[0-9A-Fa-f][0-9A-Fa-f_]*|[0-9A-Fa-f][0-9A-Fa-f_]*\\.?[0-9A-Fa-f_]*)(?:[pP][+-]?\\d[\\d_]*)?\\b",name:"constant.numeric.hex.swift"},number_octal:{match:"\\b0o[01234567][01234567_]*\\b",name:"constant.numeric.octal.swift"},segment:{begin:"\\(",end:"\\)",patterns:[{include:"#segment"},{include:"#comment_block"},{include:"#number_binary"},{include:"#number_hex"},{include:"#number_octal"},{include:"#number_decimal"},{include:"#keywords_operator"},{include:"#keywords_control"},{include:"#constants"},{include:"#languageVars1"},{include:"#languageVars2"}]},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double.swift",patterns:[{begin:"\\\\\\(",end:"\\)",name:"string.interpolated.swift",patterns:[{include:"#segment"},{include:"#comment_block"},{include:"#number_binary"},{include:"#number_hex"},{include:"#number_octal"},{include:"#number_decimal"},{include:"#keywords_operator"},{include:"#keywords_control"},{include:"#constants"},{include:"#languageVars1"},{include:"#languageVars2"}]}]}}}),{id:s[s.length-1].id,grammars:s,keywords:t.concat(i).concat(n).concat(o).concat(r)}}),define("orion/editor/stylers/text_x-typescript/syntax",["orion/editor/stylers/application_javascript/syntax"],function(e){var t=["constructor","declare","module"],i=["any","boolean","number","string"],n=[];return n.push.apply(n,e.grammars),n.push({id:"orion.typescript",contentTypes:["text/x-typescript"],patterns:[{include:"orion.js"},{include:"#keywords"},{include:"#types"}],repository:{keywords:{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.typescript"},types:{match:"\\b(?:"+i.join("|")+")\\b",name:"storage.type.typescript"}}}),{id:n[n.length-1].id,grammars:n,keywords:t.concat(i)}}),define("orion/editor/stylers/text_x-vb/syntax",["orion/editor/stylers/lib/syntax"],function(e){var t=["AddHandler","AddressOf","Aggregate","Alias","AndAlso","And","Ansi","Assembly","Async","As","Auto","Await","Binary","Boolean","ByRef","Byte","ByVal","Call","Case","Catch","CBool","CByte","CChar","CDate","CDbl","CDec","Char","CInt","Class","CLng","CObj","Compare","Const","CShort","CSng","CStr","CType","Custom","Date","Decimal","Declare","Default","Delegate","Dim","DirectCast","Distinct","Double","Do","Each","ElseIf","Else","EndIf","End","Enum","Equals","Erase","Error","Event","Exit","Explicit","False","Finally","For","Friend","From","Function","GetType","Get","GoSub","GoTo","Group By","Group Join","Handles","If","Implements","Imports","Inherits","Integer","Interface","Into","In","IsFalse","IsTrue","Is","Iterator","Join","Key","Let","Lib","Like","Long","Loop","Me","Mid","Module","Mod","MustInherit","MustOverride","MyBase","MyClass","Namespace","New","Next","Nothing","NotInheritable","NotOverridable","Not","Object","Off","On","Optional","Option","Order By","OrElse","Or","Overloads","Overridable","Overrides","ParamArray","Preserve","Private","Property","Protected","Public","RaiseEvent","ReadOnly","ReDim","REM","RemoveHandler","Resume","Return","Select","Set","Shadows","Shared","Short","Single","Skip While","Skip","Static","Step","Stop","Strict","String","Structure","Sub","SyncLock","Take While","Take","Text","Then","Throw","To","True","Try","TypeOf","Unicode","Until","Variant","Wend","When","Where","While","WithEvents","With","WriteOnly","Xor","Yield"],i=["Const","ElseIf","Else","End","ExternalSource","If","Region"],n=[];return n.push.apply(n,e.grammars),n.push({id:"orion.vb",contentTypes:["text/x-vb"],patterns:[{match:"^\\s*#(?:"+i.join("|")+")\\b[^$]*",name:"meta.preprocessor.vb"},{include:"orion.lib#string_doubleQuote"},{include:"#doc"},{include:"#comment"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#operator"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{match:"\\b(?:"+t.join("|")+")\\b",name:"keyword.operator.vb"}],repository:{comment:{begin:{match:"'",literal:"'"},end:{match:"$",literal:""},name:"comment.line.vb",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},doc:{match:{match:"'''.*",literal:"'''"},name:"comment.line.documentation.vb",patterns:[{match:"<[^\\s>]*>",name:"meta.documentation.tag"},{include:"orion.lib#todo_comment_singleLine"}]},number_hex:{match:"&[hH][0-9A-Fa-f]+\\b",name:"constant.numeric.hex.vb"}}}),{id:n[n.length-1].id,grammars:n,keywords:t}}),define("orion/editor/stylers/text_x-vbhtml/syntax",["orion/editor/stylers/application_xml/syntax","orion/editor/stylers/text_html/syntax","orion/editor/stylers/text_x-vb/syntax"],function(e,t,i){var n=[];return n.push.apply(n,e.grammars),n.push.apply(n,t.grammars),n.push.apply(n,i.grammars),n.push({id:"orion.vbhtml",contentTypes:["text/x-vbhtml"],patterns:[{include:"#vbhtmlComment"},{include:"#codeBlock"},{include:"#expression"},{include:"#reference"},{include:"orion.html"}],repository:{vbhtmlComment:{begin:{match:"@\\*",literal:"@*"},end:{match:"\\*@",literal:"*@"},name:"comment.block.vbhtml"},codeBlock:{begin:"(?i)^\\s*@code",end:"(?i)end code",captures:{0:{name:"entity.name.declaration.vb"}},contentName:"source.vb.embedded.vbhtml",patterns:[{include:"orion.xml#tag"},{include:"#reference"},{include:"orion.vb"}]},expression:{match:"(?i)^\\s*@(?!code)[^$]*",name:"source.vb.embedded.vbhtml",patterns:[{include:"#reference"},{include:"orion.vb"}]},reference:{match:"@",name:"entity.name.declaration.vb"}}}),{id:n[n.length-1].id,grammars:n,keywords:[]}}),define("orion/editor/stylers/application_x-ejs/syntax",["orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/application_xml/syntax"],function(e,t){var i=[];return i.push.apply(i,e.grammars),i.push.apply(i,t.grammars),i.push({id:"orion.ejs",contentTypes:["application/x-ejs"],patterns:[{include:"orion.xml#comment"},{include:"orion.xml#doctype"},{begin:"<%=?(?:\\s|$)",end:"%>",captures:{0:{name:"entity.name.declaration.js"}},contentName:"source.js.embedded.ejs",patterns:[{include:"orion.js"}]},{include:"orion.xml#tag"},{include:"orion.xml#ampersandEscape"}]}),{id:i[i.length-1].id,grammars:i,keywords:[]}}),define("orion/editor/stylers/text_x-yaml/syntax",[],function(){var e=["false","null","true"],t=["!!bool","!!float","!!int","!!map","!!null","!!omap","!!seq","!!str"],i="orion.yaml",n={id:i,contentTypes:["text/x-yaml"],patterns:[{include:"#numberSignComment"},{match:"^%(?:YAML|TAG)\\s.*",name:"meta.directive.yaml"},{begin:"^.*?:(?:[\\t ]|$)",end:"$",contentName:"string.unquoted.yaml",beginCaptures:{0:{name:"entity.name.key.yaml"}},patterns:[{include:"#numberSignComment"},{match:"^\\s*[&*]\\s*$",name:"entity.name.tag.yaml"},{match:"(?i)^\\s*(?:"+e.join("|")+")\\s*$",name:"keyword.operator.yaml"},{match:"(?i)^\\s*(?:"+t.join("|")+")\\b",name:"keyword.operator.yaml"},{match:"(?i)^\\s*(?:-?[0-9]*(?:\\.[0-9]+)?(?:e[-+][1-9][0-9]*)?)\\s*$",name:"constant.numeric.yaml"},{match:"(?i)^\\s*(?:-?[1-9][0-9]*|0|-?\\.inf|\\.nan)\\s*$",name:"constant.numeric.yaml"}]},{match:"---|\\.\\.\\.",name:"meta.separator.yaml"}],repository:{numberSignComment:{begin:{match:"(?:^|\\s)#",literal:"#"},end:{match:"$",literal:""},name:"comment.line.number-sign.yaml",patterns:[{include:"orion.lib#todo_comment_singleLine"}]}}};return{id:i,grammars:[n],keywords:t.concat(e)}}),define("orion/staticDataSource",["orion/Deferred","orion/editor/textStyler","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/application_vnd.coffeescript/syntax","orion/editor/stylers/application_x-jsp/syntax","orion/editor/stylers/application_xquery/syntax","orion/editor/stylers/application_sql/syntax","orion/editor/stylers/text_css/syntax","orion/editor/stylers/text_x-scss/syntax","orion/editor/stylers/text_x-less/syntax","orion/editor/stylers/text_html/syntax","orion/editor/stylers/text_jsx/syntax","orion/editor/stylers/application_json/syntax","orion/editor/stylers/text_x-csrc/syntax","orion/editor/stylers/text_x-csharp/syntax","orion/editor/stylers/text_x-cshtml/syntax","orion/editor/stylers/text_x-c__src/syntax","orion/editor/stylers/text_x-dockerfile/syntax","orion/editor/stylers/text_x-erlang/syntax","orion/editor/stylers/text_x-haml/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_x-jade/syntax","orion/editor/stylers/text_x-lua/syntax","orion/editor/stylers/text_x-php/syntax","orion/editor/stylers/text_x-python/syntax","orion/editor/stylers/text_x-ruby/syntax","orion/editor/stylers/text_x-go/syntax","orion/editor/stylers/text_x-objective-c/syntax","orion/editor/stylers/text_x-properties/syntax","orion/editor/stylers/text_x-smarty/syntax","orion/editor/stylers/text_x-swift/syntax","orion/editor/stylers/text_x-typescript/syntax","orion/editor/stylers/text_x-vb/syntax","orion/editor/stylers/text_x-vbhtml/syntax","orion/editor/stylers/application_x-ejs/syntax","orion/editor/stylers/application_xml/syntax","orion/editor/stylers/text_x-yaml/syntax"],function(e,t,i,n,o,r,s,a,l,d,c,h,u,p,f,g,_,m,v,y,x,b,w,C,T,L,k,D,A,S,E,O,N,M,I,B,R){function F(){this.styler=null}var P=[{id:"text/plain",name:"Text",extension:["txt"],imageClass:"file-sprite-text modelDecorationSprite"},{id:"application/javascript","extends":"text/plain",name:"JavaScript",extension:["js"],imageClass:"file-sprite-javascript modelDecorationSprite"},{id:"application/vnd.coffeescript","extends":"text/plain",name:"CoffeeScript",extension:["coffee"]},{id:"text/jsx","extends":"text/plain",name:"JSX",extension:["jsx"]},{id:"text/html","extends":"text/plain",name:"HTML",extension:["html","htm"],imageClass:"file-sprite-html modelDecorationSprite"},{id:"text/css","extends":"text/plain",name:"CSS",extension:["css"],imageClass:"file-sprite-css modelDecorationSprite"},{id:"text/x-scss","extends":"text/plain",name:"SCSS",extension:["scss","sass"]},{id:"text/x-less","extends":"text/plain",name:"Less",extension:["less"]},{id:"application/json","extends":"text/plain",name:"JSON",extension:["json"],imageClass:"file-sprite-text modelDecorationSprite"},{id:"application/sql","extends":"text/plain",name:"SQL",extension:["sql"]},{id:"application/xml","extends":"text/plain",name:"XML",extension:["xml"],imageClass:"file-sprite-xml modelDecorationSprite"},{id:"application/x-ejs","extends":"text/plain",name:"Embedded Javascript",extension:["ejs"],imageClass:"file-sprite-javascript modelDecorationSprite"},{id:"text/x-java-source","extends":"text/plain",name:"Java",extension:["java"]},{id:"application/x-jsp","extends":"text/plain",name:"Java Server Page",extension:["jsp"]},{id:"text/x-jade","extends":"text/plain",name:"Jade",extension:["jade"]},{id:"text/x-python","extends":"text/plain",name:"Python",extension:["py","rpy","pyw","cpy","SConstruct","Sconstruct","sconstruct","SConscript","gyp","gypi"]},{id:"text/x-ruby","extends":"text/plain",name:"Ruby",extension:["rb","rbx","rjs","Rakefile","rake","cgi","fcgi","gemspec","irbrc","capfile","ru","prawn","Gemfile","Guardfile","Vagrantfile","Appraisals","Rantfile"]},{id:"text/x-go",name:"Go",extension:["go"],"extends":"text/plain"},{id:"text/x-launch","extends":"application/json",name:"Launch file",extension:["launch"]},{id:"text/x-objective-c","extends":"text/plain",name:"Objective-C",extension:["m","mm","h"]},{id:"text/x-php","extends":"text/plain",name:"PHP",extension:["php","php3","php4","php5","phpt","phtml","aw","ctp"]},{id:"text/x-properties","extends":"text/plain",name:"Properties",extension:["properties"]},{id:"text/x-smarty","extends":"text/plain",name:"Smarty",extension:["tpl"]},{id:"text/x-swift","extends":"text/plain",name:"Swift",extension:["swift"]},{id:"text/x-typescript","extends":"text/plain",name:"Typescript",extension:["ts"]},{id:"text/x-markdown","extends":"text/plain",name:"Markdown",extension:["md"]},{id:"text/x-yaml","extends":"text/plain",name:"YAML",extension:["yaml","yml"]},{id:"text/conf","extends":"text/plain",name:"Conf",extension:["conf"]},{id:"text/sh","extends":"text/plain",name:"sh",extension:["sh"]},{id:"application/browser-renderable",name:"browser-renderable"},{id:"application/pdf","extends":"application/browser-renderable",name:"PDF",extension:["pdf"]},{id:"application/octet-stream",name:"octet-stream",extension:["exe","bin","doc","ppt"]},{id:"application/zip","extends":"application/octet-stream",name:"ZIP",extension:["war","jar","zip","rar","gz","tar"]},{id:"text/x-arduino","extends":"text/x-csrc",name:"Arduino",extension:["ino","pde"]},{id:"text/x-csrc","extends":"text/plain",name:"C",extension:["c","h"]},{id:"text/x-csharp","extends":"text/plain",name:"C#",extension:["cs"]},{id:"text/x-cshtml","extends":"text/plain",name:"cshtml",extension:["cshtml"]},{id:"text/x-c++src","extends":"text/plain",name:"C++",extension:["cpp","hpp"]},{id:"text/x-dockerfile","extends":"text/plain",name:"dockerfile",filename:["dockerfile"]},{id:"text/x-erlang","extends":"text/plain",name:"Erlang",extension:["erl","hrl"]},{id:"text/x-haml","extends":"text/plain",name:"Haml",extension:["haml"]},{id:"text/x-lua","extends":"text/plain",name:"Lua",extension:["lua"]},{id:"application/xquery","extends":"text/plain",name:"XQuery",extension:["xq","xqy","xquery"]},{id:"text/x-vb","extends":"text/plain",name:"VB.NET",extension:["vb"]},{id:"text/x-vbhtml","extends":"text/plain",name:"vbhtml",extension:["vbhtml"]},{id:"image/gif",name:"GIF",extension:["gif"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/jpeg",name:"JPG",extension:["jpg","jpeg","jpe"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/ico",name:"ICO",extension:["ico"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/png",name:"PNG",extension:["png"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/tiff",name:"TIFF",extension:["tif","tiff"],imageClass:"file-sprite-image modelDecorationSprite"},{id:"image/svg",name:"SVG",extension:["svg"],imageClass:"file-sprite-image modelDecorationSprite"}];
+return F.prototype={setup:function(e,t,i){return this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null),this._highlight(e,t,i)},highlight:function(e,t,i){var n=i.getTextView(),o=i.getAnnotationModel();return this._highlight(t,n,o)},_highlight:function(F,P,W){this.styler&&(this.styler.destroy(),this.styler=null);var V=null;if(F)switch(F.id){case"application/javascript":V=new t.createPatternBasedAdapter(i.grammars,"orion.js",F.id);break;case"application/vnd.coffeescript":V=new t.createPatternBasedAdapter(n.grammars,"orion.coffeescript",F.id);break;case"application/x-ejs":V=new t.createPatternBasedAdapter(I.grammars,"orion.ejs",F.id);break;case"text/css":V=new t.createPatternBasedAdapter(a.grammars,"orion.css",F.id);break;case"text/x-scss":V=new t.createPatternBasedAdapter(l.grammars,"orion.scss",F.id);break;case"text/x-less":V=new t.createPatternBasedAdapter(d.grammars,"orion.less",F.id);break;case"text/html":V=new t.createPatternBasedAdapter(c.grammars,"orion.html",F.id);break;case"text/jsx":V=new t.createPatternBasedAdapter(h.grammars,"orion.jsx",F.id);break;case"text/x-java-source":V=new t.createPatternBasedAdapter(x.grammars,"orion.java",F.id);break;case"application/x-jsp":V=new t.createPatternBasedAdapter(o.grammars,"orion.jsp",F.id);break;case"application/json":case"text/x-launch":V=new t.createPatternBasedAdapter(u.grammars,"orion.json",F.id);break;case"application/sql":V=new t.createPatternBasedAdapter(s.grammars,"orion.sql",F.id);break;case"text/x-jade":V=new t.createPatternBasedAdapter(b.grammars,"orion.jade",F.id);break;case"text/x-python":V=new t.createPatternBasedAdapter(T.grammars,"orion.python",F.id);break;case"text/x-ruby":V=new t.createPatternBasedAdapter(L.grammars,"orion.ruby",F.id);break;case"text/x-go":V=new t.createPatternBasedAdapter(k.grammars,"orion.go",F.id);break;case"text/x-objective-c":V=new t.createPatternBasedAdapter(D.grammars,"orion.objectiveC",F.id);break;case"text/x-php":V=new t.createPatternBasedAdapter(C.grammars,"orion.php",F.id);break;case"text/x-properties":V=new t.createPatternBasedAdapter(A.grammars,"orion.properties",F.id);break;case"text/x-smarty":V=new t.createPatternBasedAdapter(S.grammars,"orion.smarty",F.id);break;case"text/x-swift":V=new t.createPatternBasedAdapter(E.grammars,"orion.swift",F.id);break;case"text/x-typescript":V=new t.createPatternBasedAdapter(O.grammars,"orion.typescript",F.id);break;case"application/xml":case"application/xhtml+xml":V=new t.createPatternBasedAdapter(B.grammars,"orion.xml",F.id);break;case"text/x-yaml":V=new t.createPatternBasedAdapter(R.grammars,"orion.yaml",F.id);break;case"text/x-arduino":case"text/x-csrc":case"text/x-c":V=new t.createPatternBasedAdapter(p.grammars,"orion.c",F.id);break;case"text/x-csharp":V=new t.createPatternBasedAdapter(f.grammars,"orion.csharp",F.id);break;case"text/x-cshtml":V=new t.createPatternBasedAdapter(g.grammars,"orion.cshtml",F.id);break;case"text/x-c++src":V=new t.createPatternBasedAdapter(_.grammars,"orion.cpp",F.id);break;case"text/x-dockerfile":V=new t.createPatternBasedAdapter(m.grammars,"orion.dockerfile",F.id);break;case"text/x-erlang":V=new t.createPatternBasedAdapter(v.grammars,"orion.erlang",F.id);break;case"text/x-haml":V=new t.createPatternBasedAdapter(y.grammars,"orion.haml",F.id);break;case"text/x-lua":V=new t.createPatternBasedAdapter(w.grammars,"orion.lua",F.id);break;case"application/xquery":V=new t.createPatternBasedAdapter(r.grammars,"orion.xquery",F.id);break;case"text/x-vb":V=new t.createPatternBasedAdapter(N.grammars,"orion.vb",F.id);break;case"text/x-vbhtml":V=new t.createPatternBasedAdapter(M.grammars,"orion.vbhtml",F.id)}return V&&(this.styler=new t.TextStyler(P,W,V)),(new e).resolve()},getStyler:function(){return this.styler}},{ContentTypes:P,SyntaxHighlighter:F}}),define("orion/serviceTracker",[],function(){function e(e,n){function o(e){var t=e.getProperty("service.id"),i=this.addingService(e);i&&(d[t]=e,c[t]=i)}function r(e){var t=e.getProperty("service.id"),i=c[t];delete d[t],delete c[t],this.removedService(e,i)}function s(e){return-1!==e.getProperty("objectClass").indexOf(n)}this.serviceRegistry=e;var a,l,d={},c={},h=t;this.close=function(){if(h!==i)throw new Error("Already closed");h=t,e.removeEventListener("registered",a),e.removeEventListener("unregistering",l),a=null,l=null;var n=this;this.getServiceReferences().forEach(function(e){r.call(n,e)}),"function"==typeof this.onClose&&this.onClose()},this.getServiceReferences=function(){var e=Object.keys(d);return e.length?e.map(function(e){return d[e]}):null},this.open=function(d){if("undefined"==typeof d&&(d=!0),h!==t)throw new Error("Already open");h=i;var c=this;a=function(e){return s(e.serviceReference)&&(o.call(c,e.serviceReference),"function"==typeof c.onServiceAdded)?c.onServiceAdded(e.serviceReference,c.serviceRegistry.getService(e.serviceReference)):void 0},l=function(e){s(e.serviceReference)&&r.call(c,e.serviceReference)},e.addEventListener("registered",a),e.addEventListener("unregistering",l),d&&e.getServiceReferences(n).forEach(function(t){return o.call(c,t),"function"==typeof c.onServiceAdded?c.onServiceAdded(t,e.getService(t)):void 0}),"function"==typeof this.onOpen&&this.onOpen()}}var t=0,i=1;return e.prototype={addingService:function(e){return this.serviceRegistry.getService(e)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}},e}),define("orion/contentTypes",["orion/serviceTracker"],function(e){function t(e,t){return-1!==e.indexOf(t)}function i(e){switch(e&&e.id){case"image/jpeg":case"image/png":case"image/gif":case"image/ico":case"image/tiff":case"image/svg":return!0}return!1}function n(e){return e?"application/octet-stream"===e.id||"application/octet-stream"===e["extends"]:!1}function o(e,i){if("string"!=typeof e)return null;var n,o=null,r=e.indexOf(".");r++;for(var s=e.substring(r).toLowerCase(),a=0;a=0){o=n;break}t(n.extension,s)&&(o=n)}if(!o)for(r=s.indexOf(".");!o&&r>=0;){for(r++,s=s.substring(r),a=0;as;s++){this._addFileModeProperties(this._diffContents[s],o);var a=this._parseHunkRange(s);a&&this._hunkRanges.push(a)}if(0===this._hunkRanges.length)return o.outPutFile=e,o;this._DEBUG&&(console.log("***Diff contents: \n"),this._diffContents.forEach(function(e){console.log(e)}),console.log("***Hunk ranges: \n"),console.log(JSON.stringify(this._hunkRanges)));for(var l=0;l0){console.log(" **Diff content on change/add: \n");for(var t=0;th;h++)if(0!==this._diffContents[h].length){var u=this._diffContents[h][0];if("\\"!==u||i!==this._diffContents[h].substring(0,this._diffContents[h].length-1)&&i!==this._diffContents[h]){switch(u){case"-":case"+":case" ":break;default:continue}if(t!==u){switch("+"===u&&(d=h),"-"===u&&(c=h),t){case" ":a=this._hunkRanges[e][1]+r,l=this._hunkRanges[e][3]+s;break;case"-":this._createMinusBlock(a,l,this._hunkRanges[e][1]+r-a,c);break;case"+":this._createPlusBlock(a,l,this._hunkRanges[e][3]+s-l,d)}t=u}switch(u){case"-":r++;break;case"+":s++;break;case" ":r++,s++}}else"-"===t?this._oNewLineAtEnd=!1:" "===t?(this._nNewLineAtEnd=!1,this._oNewLineAtEnd=!1):this._nNewLineAtEnd=!1,h>n&&"\r"===this._diffContents[h-1][this._diffContents[h-1].length-1]&&(this._diffContents[h-1]=this._diffContents[h-1].substring(0,this._diffContents[h-1].length-1))}switch(t){case"-":this._createMinusBlock(a,l,this._hunkRanges[e][1]+r-a,c);break;case"+":this._createPlusBlock(a,l,this._hunkRanges[e][3]+s-l,d)}},_detectConflictes:function(e,t){if(0>e)return!1;for(var i=e+t,n=e;i>n;n++){var o=this._diffContents[n];if(o.indexOf("<<<<<")>-1||o.indexOf(">>>>>")>-1)return!0}return!1},_buildMap:function(e){for(var t,i=this._oBlocks.length,n=this._oFileContents.length,o=0,r=1,s=0;i>s;s++)t=this._oBlocks[s][0]-r,t>0&&(this._deltaMap.push([t,t,0]),o+=t),this._deltaMap.push(e&&this._detectConflictes(this._nBlocks[s][2],this._nBlocks[s][1])?[this._nBlocks[s][1],this._oBlocks[s][1],this._nBlocks[s][2]+1,1]:[this._nBlocks[s][1],this._oBlocks[s][1],this._nBlocks[s][2]+1]),o+=this._oBlocks[s][1],r=this._oBlocks[s][0]+this._oBlocks[s][1];if(n-r>0&&(this._deltaMap.push([n-r+1,n-r+1,0]),o+=n-r+1),n>o){t=n-o;var a=this._deltaMap[this._deltaMap.length-1];0===a[2]?(a[0]+=t,a[1]+=t):-1===a[2]?this._deltaMap.push([t,t,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([t,t,0]):(this._nNewLineAtEnd&&(a[0]+=t),this._oNewLineAtEnd&&(a[1]+=t))}},_buildNewFile:function(){var e,t,i=1,n=!1,o=this._deltaMap.length;for(e=0;o>e;e++){if(n=!1,0===this._deltaMap[e][2]){for(t=0;t0)for(t=0;t=0?i:1)}else t.push(1)},_parseHunkRange:function(e){var t=this._diffContents[e],i=/^@@\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/,n=/^@@\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/,o=i.exec(t),r=null;return o&&5===o.length?(r=[e],this._converHRangeBody(o[1],r),this._converHRangeBody(o[2],r),this._converHRangeBody(o[3],r),this._converHRangeBody(o[4],r)):(o=n.exec(t),o&&5===o.length&&(r=[e],this._converHRangeBody(o[3],r),this._converHRangeBody(o[4],r),this._converHRangeBody(o[1],r),this._converHRangeBody(o[2],r))),r}},e}(),e}),define("orion/URITemplate",[],function(){function e(e){this._text=e}function t(e){return e.replace("%25","%")}function i(e,i){if("U"===i)return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===i)return encodeURI(e).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(h,t);if("U+R-,"===i)return encodeURI(e).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw new Error("Unknown allowed character set: "+i)}function n(e,t,n){for(var o=[],r=0;r=n&&n+r>i)return{mapperIndex:o,startFrom:n};if(o===e.length-1)break;n+=e[o][t]}return{mapperIndex:e.length-1,startFrom:n}},t.compareUtils.lookUpLineIndex=function(e,t,i){if(0===i)return 0;for(var n=0,o=0;i>o;o++)n+=e[o][t];return n},t.compareUtils.updateMapper=function(e,i,n,o,r){if(o!==r&&(o>0||r>0)){var s=t.compareUtils.lookUpMapper(e,i,n);if(s.mapperIndex<0)return;if(o>0)for(var a=o,l=n-s.startFrom,d=s.mapperIndex;d=a){e[d][i]-=a;break}e[d][i]-=c,a-=c,l=0}r>0&&(e[s.mapperIndex][i]+=r)}},t.compareUtils.overlapMapper=function(e,t,i,n,o){var r=i+e[t]-1;return i>r&&(r=i),n>o&&(o=n),n>r||i>o?!1:!0},t.compareUtils.findFirstDiff=function(e,i,n,o){for(var r=0,s=null,a=0;ao)&&(!t.compareUtils.overlapMapper(e[a],i,r,n,o)||(s={mapperIndex:a,startFrom:r},0===e[a][2]));a++)r+=e[a][i];return s},t.compareUtils.matchMapper=function(e,i,n,o){if(0===e.length)return n;var r=n+Math.round((o-n)/3),s=t.compareUtils.findFirstDiff(e,i,n,o),a=0===e[s.mapperIndex][i]?s.startFrom:s.startFrom+e[s.mapperIndex][i]-1,l=t.compareUtils.lookUpLineIndex(e,1-i,s.mapperIndex),d=s.startFrom-n;if(0===e[s.mapperIndex][2])return l-d;if(r>=s.startFrom&&a>=r)return l-Math.round((o-n)/3);if(rt?!1:e[t][3]?1===e[t][3]:!1},t.compareUtils.mergeDiffBlocks=function(e,t,i,n,o,r){for(var s=0;s0){for(var c="",h=0;h=p){var f=e.getLineEnd(p-1),g=e.getLineEnd(p-1,!0);f===g?(e.setText(r,f,f),a=p):a=p-1}var _=e.getLineStart(a);e.setText(c,_,_)}}},t.compareUtils.convertMergedLineNumber=function(e,i,n){var o=t.compareUtils.lookUpMapper(e,n?1:0,i),r=i;if(n||0===e[o.mapperIndex][2]||(r+=e[o.mapperIndex][1]),o.mapperIndex<0)return r;for(var s=0;s0)for(var r=n-1;r>-1;r--)t=""===o?"":"/",o=o+t+i[r].Name;return t=""===o?"":"/",o=o+t+e.Name},t.compareUtils}),define("orion/compare/compareRulers",["orion/compare/compareUtils"],function(e){var t=t||{};return t.CompareRuler=function(){function e(e,t,i){this._location=e||"left",this._overview=t||"page",this._rulerStyle=i,this._editor=null;var n=this;this._listener={onModelChanged:function(e){n._onModelChanged(e)}}}return e.prototype={setView:function(e){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged),this._editor=e,this._onModelChanged&&this._editor&&this._editor.addEventListener("ModelChanged",this._listener.onModelChanged)},getLocation:function(){return this._location},getOverview:function(){return this._overview},getAnnotationModel:function(){return null},addAnnotationType:function(){},isAnnotationTypeVisible:function(){return!1},removeAnnotationType:function(){},setAnnotationModel:function(){},getAnnotations:function(e,t){for(var i=[],n=e;t>n;n++){var o=this.getStyle(n);o&&(i[n]={html:this.getHTML(n),style:o})}return i},getWidestAnnotation:function(){return{html:this.getHTML(-1),style:this.getStyle(-1)}},getRulerStyle:function(){return this.getStyle(void 0)}},e}(),t.LineNumberCompareRuler=function(){function e(e,i,n,o,r,s){t.CompareRuler.call(this,n,"page",o),this._diffNavigator=e,this._oddStyle=r||{style:{backgroundColor:"white"}},this._evenStyle=s||{style:{backgroundColor:"white"}},this._numOfDigits=0,this._mapperColumnIndex=i}return e.prototype=new t.CompareRuler,e.prototype.getStyle=function(e){return void 0===e?this._rulerStyle:this._evenStyle},e.prototype.getHTML=function(e){var t=this._editor.getModel(),i=this._diffNavigator.getFeeder(0===this._mapperColumnIndex);if(!i)return"";if(-1===e)return t.getLineCount();if(i.getLineNumber){var n=i.getLineNumber(e);return-1===n?"":n+1}return e+1},e.prototype._onModelChanged=function(e){var t=e.start,i=this._editor.getModel(),n=i.getLineCount(),o=(n+"").length;if(this._numOfDigits!==o){this._numOfDigits=o;var r=i.getLineAtOffset(t);this._editor.redrawLines(r,n,this)}},e}(),t.CompareOverviewRuler=function(){function i(e,i,n,o){this._diffNavigator=n,this._onClick=o,t.CompareRuler.call(this,e,"document",i)}return i.prototype=new t.CompareRuler,i.prototype.getStyle=function(t){var i,n;if(void 0===t)i=this._rulerStyle||{},n=i.style||(i.style={}),n.lineHeight="1px",n.fontSize="1px",n.width="14px";else{if(i=-1!==t?{styleClass:"annotationOverview breakpoint"}||{}:{},n=i.style||(i.style={}),n.cursor="pointer",n.width="8px",n.left="2px",!(t>=0))return null;var o;if(!this._diffNavigator||!this._diffNavigator.getFeeder())return null;o=this._diffNavigator.getFeeder().getDiffBlocks();var r=e.getAnnotationIndex(o,t);if(-1===r)return null;var s,a=e.getAnnotationMapperIndex(o,r);s=this._diffNavigator.getMapper();var l=e.isMapperConflict(s,a);l&&(n.border="1px #FF0000 solid"),r===this._diffNavigator.getCurrentBlockIndex()&&(n.backgroundColor=l?"red":"blue");var d=this._diffNavigator.getFeeder().getDiffBlockH(r),c=this._diffNavigator.getFeeder().getOverviewLineCount();if(0>d)return null;var h=this._editor.getClientArea(),u=Math.floor(h.height*d/c);2>u&&(u=2),n.height=u+"px"}return i},i.prototype.setDiffNavigator=function(e){this._diffNavigator=e},i.prototype.getHTML=function(){return" "},i.prototype.onClick=function(e){void 0!==e&&this._onClick(e,this)},i.prototype._onModelChanged=function(){var e=this._editor.getModel(),t=e.getLineCount();t>0&&this._editor.redrawLines(0,1,this)},i}(),t.CompareCurveRuler=function(){function t(e){this._canvasDiv=e,this._mapper=void 0}return t.prototype={init:function(e,t,i,n){this._leftIniting=!0,this._rightIniting=!0,this._rightIniting=!0,this._mapper=e,this._leftEditor=t,this._rightEditor=i,this._leftTextView=t.getTextView(),this._rightTextView=i.getTextView(),this._diffNavigator=n,this.render()},matchPositionFrom:function(t){var i=t?this._leftTextView:this._rightTextView,n=t?this._rightTextView:this._leftTextView,o=i.getTopIndex(),r=i.getBottomIndex(),s=e.matchMapper(this._mapper,t?0:1,o,r);n.setTopIndex(s)},copyTo:function(e){if(this._diffNavigator.iterator){var t=this._diffNavigator.iterator.cursor();if(t){var i;if(i="word"===t.type?!t.copied&&!t.parent.copied:!t.copied,!i)return;var n=e?this._rightTextView.getText(t.oldA.start,t.oldA.end):this._leftTextView.getText(t.newA.start,t.newA.end),o=e?t.newA:t.oldA,r=e?this._leftTextView:this._rightTextView;r.setText(n,o.start,o.end),t.copied=!0}}},render:function(){if(this._mapper){var t=this._canvasDiv.getContext("2d");t.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height),t.strokeStyle="#AAAAAA",t.lineWidth=1,t.beginPath();var i=this._leftTextView.getTopIndex(),n=this._leftTextView.getBottomIndex(),o=this._rightTextView.getTopIndex(),r=this._rightTextView.getBottomIndex();this._leftLineH=this._leftTextView.getLineHeight(),this._rightLineH=this._rightTextView.getLineHeight();for(var s=0,a=0,l=!1,d=0;d0||t.addedLineCount>0)&&this.render()}return i?this._rightIniting=!1:this._leftIniting=!1,n}},t}(),t}),define("orion/regex",[],function(){function e(e){return e.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")}function t(e){var t=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(e);return t?{pattern:t[1],flags:t[2]}:null}return{escape:e,parse:t}}),define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(e,t,i){function n(e,t){this._lastLineIndex=-1,this._text=[""],this._lineOffsets=[0],this.setText(e),this.setLineDelimiter(t)}return n.prototype={destroy:function(){},find:function(e){this._text.length>1&&(this._text=[this._text.join("")]);var i=e.string,n=e.regex,o=i,r="",s=e.caseInsensitive;if(o)if(n){var a=t.parse(o);a&&(o=a.pattern,r=a.flags)}else o=i.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),s&&(o=o.replace(/[iI\u0130\u0131]/g,"[Iiİı]"));var l,d=null;if(o){var c=e.reverse,h=e.wrap,u=e.wholeWord,p=e.start||0,f=e.end,g=null!==f&&void 0!==f;-1===r.indexOf("g")&&(r+="g"),-1===r.indexOf("m")&&(r+="m"),s&&-1===r.indexOf("i")&&(r+="i"),u&&(o="\\b"+o+"\\b");var _,m,v=this._text[0],y=0;if(g){var x=f>p?p:f,b=f>p?f:p;v=v.substring(x,b),y=x}var w=new RegExp(o,r);c?l=function(){var e=null;for(w.lastIndex=0;;){if(m=w.lastIndex,_=w.exec(v),m===w.lastIndex)return null;if(!_)break;if(_.index+y=0&&i>e))return null;var n=this._lineOffsets[e];if(i>e+1){var o=this.getText(n,this._lineOffsets[e+1]);if(t)return o;for(var r,s=o.length;10===(r=o.charCodeAt(s-1))||13===r;)s--;return o.substring(0,s)}return this.getText(n)},getLineAtOffset:function(e){var t=this.getCharCount();if(!(e>=0&&t>=e))return-1;
+var i=this.getLineCount();if(e===t)return i-1;var n,o,r=this._lastLineIndex;if(r>=0&&i>r&&(n=this._lineOffsets[r],o=i>r+1?this._lineOffsets[r+1]:t,e>=n&&o>e))return r;for(var s=i,a=-1;s-a>1;)if(r=Math.floor((s+a)/2),n=this._lineOffsets[r],o=i>r+1?this._lineOffsets[r+1]:t,n>=e)s=r;else{if(o>e){s=r;break}a=r}return this._lastLineIndex=s,s},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(e,t){var i=this.getLineCount();if(!(e>=0&&i>e))return-1;if(i>e+1){var n=this._lineOffsets[e+1];if(t)return n;for(var o,r=this.getText(Math.max(this._lineOffsets[e],n-2),n),s=r.length;10===(o=r.charCodeAt(s-1))||13===o;)s--;return n-(r.length-s)}return this.getCharCount()},getLineStart:function(e){return e>=0&&e=e));)n+=i,o++;for(var r=n,s=o;o=t));)n+=i,o++;var a=n,l=o;if(s>=this._text.length||l>=this._text.length||s>l)return"";if(s===l)return this._text[s].substring(e-r,t-a);var d=this._text[s].substring(e-r),c=this._text[l].substring(0,t-a);return d+this._text.slice(s+1,l).join("")+c},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},setLineDelimiter:function(e,t){if("auto"===e&&(e=void 0,this.getLineCount()>1&&(e=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0)))),this._lineDelimiter=e?e:i.platformDelimiter,t){var n=this.getLineCount();if(n>1){for(var o=new Array(n),r=0;n>r;r++)o[r]=this.getLine(r);this.setText(o.join(this._lineDelimiter))}}},setText:function(e,t,i){if(void 0===e&&(e=""),void 0===t&&(t=0),void 0===i&&(i=this.getCharCount()),t!==i||""!==e){for(var n=this.getLineAtOffset(t),o=this.getLineAtOffset(i),r=t,s=i-t,a=o-n,l=e.length,d=0,c=this.getLineCount(),h=0,u=0,p=0,f=[];;){if(-1!==h&&p>=h&&(h=e.indexOf("\r",p)),-1!==u&&p>=u&&(u=e.indexOf("\n",p)),-1===u&&-1===h)break;p=-1!==h&&-1!==u?h+1===u?u+1:(u>h?h:u)+1:-1!==h?h+1:u+1,f.push(t+p),d++}var g={type:"Changing",text:e,start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};if(this.onChanging(g),0===f.length){var _,m=this.getLineStart(n);_=c>o+1?this.getLineStart(o+1):this.getCharCount(),t!==m&&(e=this.getText(m,t)+e,t=m),i!==_&&(e+=this.getText(i,_),i=_)}for(var v=l-s,y=n+a+1;c>y;y++)this._lineOffsets[y]+=v;var x,b=5e4,w=b;if(f.length=t));)L+=T,k++;for(var D=L,A=k;k=i));)L+=T,k++;var S=L,E=k,O=this._text[A],N=this._text[E],M=O.substring(0,t-D),I=N.substring(i-S),B=[A,E-A+1];M&&B.push(M),e&&B.push(e),I&&B.push(I),Array.prototype.splice.apply(this._text,B),0===this._text.length&&(this._text=[""]);var R={type:"Changed",start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};this.onChanged(R)}}},e.EventTarget.addMixin(n.prototype),{TextModel:n}}),define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(e,t){function i(e){e&&(this._view=e,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function n(e){i.call(this,e)}return i.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(e){for(var t=[],i=this._keyBindings,n=0;nn){var h=o(n);t=s+h*l,r(t)}else r(a),c.stop()}var t,i="number"==typeof this.options.duration?this.options.duration:350,n="number"==typeof this.options.rate?this.options.rate:20,o=this.options.easing||this.defaultEasing,r=this.options.onAnimate||function(){},s=this.options.curve[0],a=this.options.curve[1],l=a-s,d=-1,c=this;this.interval=this.options.window.setInterval(e,n)},e.prototype.stop=function(){this.options.window.clearInterval(this.interval);var e=this.options.onEnd||function(){};e()},e.prototype.defaultEasing=function(e){return Math.sin(e*(Math.PI/2))},e}();return{contains:i,getNodeStyle:n,addEventListener:e,removeEventListener:t,Animation:o}}),define("orion/bidiUtils",["orion/util"],function(e){function t(){var e;window.dojoConfig&&(e=window.dojoConfig.locale),e||(e=navigator.languages?navigator.languages[0]:navigator.language||navigator.userLanguage);var t=e&&-1!="ar iw he".indexOf(e.substring(0,2));if(t){var i=document.getElementsByTagName("html")[0];i&&i.setAttribute("dir","rtl")}}function i(){var e=localStorage.getItem(c);return e&&"true"==e?!0:!1}function n(){var e=localStorage.getItem(h);return!e||"rtl"!=e&&"ltr"!=e&&"auto"!=e?"ltr":e}function o(t){return g=n(),i()?"auto"==g&&e.isIE?s(t):g:""}function r(e){if(i()&&e.trim()){g=n();var t="auto"==g?s(e):g;return("ltr"==t?u:f)+e+p}return e}function s(e){var t=/[A-Za-z\u05d0-\u065f\u066a-\u06ef\u06fa-\u07ff\ufb1d-\ufdff\ufe70-\ufefc]/.exec(e);return t?t[0]<="z"?"ltr":"rtl":"ltr"}function a(e){if(!e._hasBidiEventListeners){e._hasBidiEventListeners=!0;for(var t=["keyup","cut","paste"],i=0;i0;)(!s.isIE||s.isIE>=9||s.isIE<9&&n[o].specified)&&t.removeAttribute(n[o].name)}if(e){e.styleClass&&(t.className=e.styleClass);var r=e.style;if(r)for(var a in r)r.hasOwnProperty(a)&&(t.style[a]=r[a]);var l=e.attributes;if(l)for(var d in l)l.hasOwnProperty(d)&&t.setAttribute(d,l[d])}}function u(e){return e instanceof Array?e.slice(0):e}function p(e,t){if(!e)return t;if(!t)return e;for(var i in t)t.hasOwnProperty(i)&&(e.hasOwnProperty(i)||(e[i]=t[i]));return e}function f(e,t){if(e===t)return!0;if(e&&!t||!e&&t)return!1;if(e&&e.constructor===String||t&&t.constructor===String)return!1;if(e instanceof Array||t instanceof Array){if(!(e instanceof Array&&t instanceof Array))return!1;if(e.length!==t.length)return!1;for(var i=0;ir;){-1!==n&&r>=n&&(n=e.indexOf("\r",r)),-1!==o&&r>=o&&(o=e.indexOf("\n",r));var a,l=r;if(-1===o&&-1===n){t(e.substring(r));break}-1!==n&&-1!==o?n+1===o?(a=n,r=o+1):(a=o>n?n:o,r=(o>n?n:o)+1):-1!==n?(a=n,r=n+1):(a=o,r=o+1),t(e.substring(l,a)),i?i():r===s&&t("")}}function _(e){var t,i,n,o,r=d(e.ownerDocument);if(r.getComputedStyle){var s=r.getComputedStyle(e,null);t=s.getPropertyValue("border-left-width"),i=s.getPropertyValue("border-top-width"),n=s.getPropertyValue("border-right-width"),o=s.getPropertyValue("border-bottom-width")}else e.currentStyle&&(t=e.currentStyle.borderLeftWidth,i=e.currentStyle.borderTopWidth,n=e.currentStyle.borderRightWidth,o=e.currentStyle.borderBottomWidth);return{left:parseInt(t,10)||0,top:parseInt(i,10)||0,right:parseInt(n,10)||0,bottom:parseInt(o,10)||0}}function m(e){var t,i,n,o,r=d(e.ownerDocument);if(r.getComputedStyle){var s=r.getComputedStyle(e,null);t=s.getPropertyValue("padding-left"),i=s.getPropertyValue("padding-top"),n=s.getPropertyValue("padding-right"),o=s.getPropertyValue("padding-bottom")}else e.currentStyle&&(t=e.currentStyle.paddingLeft,i=e.currentStyle.paddingTop,n=e.currentStyle.paddingRight,o=e.currentStyle.paddingBottom);return{left:parseInt(t,10)||0,top:parseInt(i,10)||0,right:parseInt(n,10)||0,bottom:parseInt(o,10)||0}}function v(e){var t=e._trim;if(!t){t=m(e);var i=_(e);t.left+=i.left,t.top+=i.top,t.right+=i.right,t.bottom+=i.bottom,e._trim=t}return t}function y(e,t,i,n){function o(t){if(t.animationName===a){var i=t.target;"function"==typeof i.__DOMReady&&d(e).setTimeout(function(){i.__DOMReady()},0)}}function r(e,t){for(var i=["","-webkit-","-moz-","-ms-","-o-"],n="",o="body ."+e+" {\n",r=0;ri;i++){var n=e._createSelectionDiv();t.appendChild(n),this._divs.push(n)}}function w(e){this.left=e.left,this.top=e.top,this.right=e.right,this.bottom=e.bottom}function C(e,t,i){this.view=e,this.lineIndex=t,this._lineDiv=i}function T(e){this._init(e||{})}var L=r.addEventListener,k=r.removeEventListener,D=r.Animation;return x.compare=function(e,t){if(e.length!==t.length)return!1;for(var i=0;i=0;i--)if(e[i]._editing)return e[i];return e[e.length-1]}for(i=0;i=i.end||i._editing||e[n]._editing?(t.push(i),i=e[n]):i.end=Math.max(i.end,e[n].end);return t.push(i),t},x.prototype={clone:function(){var e=new x(this.start,this.end,this.caret);return e._columnX=this._columnX,e._editing=this._editing,e._docX=this._docX,e},contains:function(e){return this.start<=e&ðis.end){var t=this.start;this.start=this.end,this.end=t,this.caret=!this.caret}},setCaret:function(e){this.start=e,this.end=e,this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},getAnchor:function(){return this.caret?this.end:this.start},getOrientedSelection:function(){return{start:this.getAnchor(),end:this.getCaret()}},toString:function(){return"start="+this.start+" end="+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===this.end},equals:function(e){return this.caret===e.caret&&this.start===e.start&&this.end===e.end&&this._editing===e._editing}},b.prototype={destroy:function(){this._divs&&(this._divs.forEach(function(e){e.parentNode.removeChild(e)}),this._divs=null)},setPrimary:function(e){this.primary=e},update:function(){var e,t=this._view,i=this.primary,n=t._hasFocus,o=t._cursorVisible,r=!this.primary&&this._selection&&this._selection.isEmpty();e=r?"textviewSelectionCaret":n?"textviewSelection":"textviewSelectionUnfocused",this._divs[0].style.visibility=r&&o&&n||!r?"visible":"hidden",this._divs[0].style.zIndex=o&&r?"2":"0",this._divs.forEach(function(t){t.className=e,s.isWebkit<537.36&&i&&(t.style.background=n?"transparent":"")})},setSelection:function(e){this._selection=e,this.update();var t=this._view,i=t._model,n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end),r=t._getLineNext();if(r){var s,a,l,d,c=t._getLinePrevious();nc.lineIndex?(s=c,l=i.getLineStart(c.lineIndex)):(s=t._getLineNode(n),l=e.start),oc.lineIndex?(a=c,d=i.getLineStart(c.lineIndex)):(a=t._getLineNode(o),d=e.end),this._setDOMSelection(s,l,a,d,e.caret)}},_setDOMSelection:function(e,t,i,n,o){if(this._setDOMFullSelection(e,t,i,n),this.primary){var r=this._view,a=e._line.getNodeOffset(t),l=i._line.getNodeOffset(n);if(a.node&&l.node){var d,c=r._getWindow(),h=r._parent.ownerDocument;if(c.getSelection){var u=c.getSelection();if(d=h.createRange(),d.setStart(a.node,a.offset),d.setEnd(l.node,l.offset),!r._hasFocus||u.anchorNode===a.node&&u.anchorOffset===a.offset&&u.focusNode===l.node&&u.focusOffset===l.offset&&u.anchorNode===l.node&&u.anchorOffset===l.offset&&u.focusNode===a.node&&u.focusOffset===a.offset||(r._anchorNode=a.node,r._anchorOffset=a.offset,r._focusNode=l.node,r._focusOffset=l.offset,r._ignoreSelect=!1,u.rangeCount>0&&u.removeAllRanges(),u.addRange(d),r._ignoreSelect=!0),r._cursorDiv){d=h.createRange(),o?(d.setStart(a.node,a.offset),d.setEnd(a.node,a.offset)):(d.setStart(l.node,l.offset),d.setEnd(l.node,l.offset));var p=d.getClientRects()[0],f=r._cursorDiv.parentNode,g=f.getBoundingClientRect();p&&g&&(r._cursorDiv.style.top=p.top-g.top+f.scrollTop+"px",r._cursorDiv.style.left=p.left-g.left+f.scrollLeft+"px")}}else if(h.selection){if(!r._hasFocus)return;var _=h.body,m=s.createElement(h,"div");_.appendChild(m),_.removeChild(m),d=_.createTextRange(),d.moveToElementText(a.node.parentNode),d.moveStart("character",a.offset);var v=_.createTextRange();v.moveToElementText(l.node.parentNode),v.moveStart("character",l.offset),d.setEndPoint("EndToStart",v),r._ignoreSelect=!1,d.select(),r._ignoreSelect=!0}}}},_setDOMFullSelection:function(e,t,i,n){this._divs.forEach(function(e){e.style.width=e.style.height="0px"});var o=this._view;if(o._fullSelection&&!(s.isIOS||e===i&&t===n&&this.primary)){var r=o._getViewPadding(),a=o._clientDiv.getBoundingClientRect(),l=o._viewDiv.getBoundingClientRect(),d=l.left+r.left,c=a.right,h=l.top+r.top,u=a.bottom,p=0,f=0;if(o._clipDiv){var g=o._clipDiv.getBoundingClientRect();p=g.left-o._clipDiv.scrollLeft,f=g.top}else{var _=o._rootDiv.getBoundingClientRect();p=_.left,f=_.top}o._ignoreDOMSelection=!0;var m,v,y=new C(o,e.lineIndex,e),x=y.getBoundingClientRect(t,!1),b=x.left;e===i&&t===n?(m=y,v=x):(m=new C(o,i.lineIndex,i),v=m.getBoundingClientRect(n,!1));var w=v.left;o._ignoreDOMSelection=!1;var T=this._divs[0],L=Math.min(c,Math.max(d,b)),k=Math.min(u,Math.max(h,x.top)),D=c,A=Math.min(u,Math.max(h,x.bottom));if(T.style.left=L-p+"px",T.style.top=k-f+"px",T.style.width=Math.max(0,D-L)+"px",T.style.height=Math.max(0,A-k)+"px",e.lineIndex===i.lineIndex)D=Math.min(w,c),T.style.width=Math.max(this.primary?0:1,D-L)+"px";else{var S=d,E=Math.min(u,Math.max(h,v.top)),O=Math.min(c,Math.max(d,w)),N=Math.min(u,Math.max(h,v.bottom)),M=this._divs[2];if(M.style.left=S-p+"px",M.style.top=E-f+"px",M.style.width=Math.max(0,O-S)+"px",M.style.height=Math.max(0,N-E)+"px",Math.abs(e.lineIndex-i.lineIndex)>1){var I=this._divs[1];I.style.left=d-p+"px",I.style.top=A-f+"px",I.style.width=Math.max(0,c-d)+"px",I.style.height=Math.max(0,E-A)+"px"}}}}},w.prototype={toString:function(){return"{l="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}},C.prototype={create:function(e,t){if(!this._lineDiv){var i=this._lineDiv=this._createLine(e,t,this.lineIndex);return i._line=this,i}},_createLine:function(e,t,i){var n=this.view,o=n._model,r=o.getLine(i),a=o.getLineStart(i),l={type:"LineStyle",textView:n,lineIndex:i,lineText:r,lineStart:a};n.onLineStyle(l);var d=e.ownerDocument,c=t||s.createElement(d,"div");if(t&&f(t.viewStyle,l.style)||(h(l.style,c,t),t&&(t._trim=null),c.viewStyle=l.style),c.lineIndex=i,t&&c.viewLineText===r&&f(l.ranges,c.viewRanges))return c;c.viewRanges=l.ranges,c.viewLineText=r;var u=[],p={tabOffset:0,ranges:u};this._createRanges(l.ranges,r,0,r.length,a,p);var g=" ";!n._fullSelection&&s.isIE<9&&(g="");var _={text:g,style:n._metrics.largestFontStyle,ignoreChars:1};0!==u.length&&u[u.length-1].style&&"div"===u[u.length-1].style.tagName?u.splice(u.length-1,0,_):u.push(_);var m,v,y,x,b,w,C,T,L=0,k=0;if(s.isFirefox&&r.length>2e3){t&&(c.innerHTML="",t.lineWidth=void 0);var D=d.createDocumentFragment();for(T=0;T=S&&(O-=A);var N=y.firstChild.data,M=N?N.length:0;if(k+M>O)break;k+=M}C=y.nextSibling,c.removeChild(y),y=C}}m=this._createSpan(c,b,v,_.ignoreChars),y?c.insertBefore(m,y):c.appendChild(m),t&&(t.lineWidth=void 0)}if(t)for(var I=m?m.nextSibling:null;I;)C=I.nextSibling,t.removeChild(I),I=C}return c.parentNode||e.appendChild(c),c},_createRanges:function(e,t,i,n,o,r){if(!(i>n)){if(e)for(var s=0;sn)break;var d=Math.min(o+n,a.end)-o;if(d>=l){if(l=Math.max(i,l),d=Math.min(n,d),l>i&&this._createRange(t,i,l,null,r),!a.style||!a.style.unmergeable)for(;s+1i&&this._createRange(t,i,n,null,r)}},_createRange:function(e,t,i,n,o){if(!(t>i)){var r,s=this.view._customTabSize,l={tagName:"span",bidi:!0,style:{unicodeBidi:"embed",direction:"ltr"}},d={text:"",style:l};if(s&&8!==s)for(var c=e.indexOf(" ",t);-1!==c&&i>c;){c>t&&(r={text:e.substring(t,c),style:n},o.ranges.push(r),a.isBidiEnabled&&o.ranges.push(d),o.tabOffset+=r.text.length);var h=s-o.tabOffset%s;if(h>0){for(var u=" ",p=1;h>p;p++)u+=" ";r={text:u,style:n,ignoreChars:h-1},o.ranges.push(r),a.isBidiEnabled&&o.ranges.push(d),o.tabOffset+=r.text.length}if(t=c+1,t===i)return;c=e.indexOf(" ",t)}i>=t&&(r={text:e.substring(t,i),style:n},o.ranges.push(r),a.isBidiEnabled&&o.ranges.push(d),o.tabOffset+=r.text.length)}},_createSpan:function(e,t,i,n){var o=this.view,r="span";i&&i.tagName&&(r=i.tagName.toLowerCase());var a="a"===r;a&&(this.hasLink=!0),a&&!o._linksVisible&&(r="span");var l=e.ownerDocument,d=s.createElement(e.ownerDocument,r);if(d.appendChild(l.createTextNode(i&&i.text?i.text:t)),i&&i.html?(d.innerHTML=i.html,d.ignore=!0):i&&i.node?(d.appendChild(i.node),d.ignore=!0):i&&i.bidi&&(d.ignore=!0),h(i,d),"a"===r){var c=o._getWindow();L(d,"click",function(e){return o._handleLinkClick(e?e:c.event)},!1)}return d.viewStyle=i,n&&(d.ignoreChars=n),d},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(e,t){var i=this._ensureCreated(),n=this.view;if(void 0===e)return this._getLineBoundingClientRect(i,!0);var o=n._model,r=i.ownerDocument,a=this.lineIndex,l=null;if(ee){var h,u=e-c;if(1===o.length)l=new w(t.getBoundingClientRect());else if(n._isRangeRects)h=r.createRange(),h.setStart(o,u),h.setEnd(o,u+1),l=new w(h.getBoundingClientRect());else if(s.isIE){h=r.body.createTextRange(),h.moveToElementText(t),h.collapse();var p=0===u&&8===s.isIE;p&&(u=1),h.moveEnd("character",u+1),h.moveStart("character",u),l=new w(h.getBoundingClientRect()),p&&(l.left=t.getClientRects()[0].left)}else{var f=o.data;t.removeChild(o),t.appendChild(r.createTextNode(f.substring(0,u)));var g=s.createElement(r,"span");if(g.appendChild(r.createTextNode(f.substring(u,u+1))),t.appendChild(g),t.appendChild(r.createTextNode(f.substring(u+1))),l=new w(g.getBoundingClientRect()),t.innerHTML="",t.appendChild(o),!this._createdDiv){var _=n._getSelections()[0];
+(c<=_.start&&_.starts.right&&(s.right=a.right),a.bottom>s.bottom&&(s.bottom=a.bottom))}}return!0}),void 0!==e?i[e]:i},_getLineBoundingClientRect:function(e,t){var i=new w(e.getBoundingClientRect());if(this.view._wrapMode);else{i.right=i.left;for(var n=e.lastChild;n&&n.ignoreChars===n.firstChild.length;)n=n.previousSibling;if(n){var o=n.getBoundingClientRect();i.right=o.right+v(e).right}}if(t){var r=v(e);i.left=i.left+r.left,i.right=i.right-r.right}return i},getLineCount:function(){return this.view._wrapMode?this.getClientRects().length:1},getLineIndex:function(e){if(!this.view._wrapMode)return 0;for(var t=this.getClientRects(),i=this.getBoundingClientRect(e),n=i.top+(i.bottom-i.top)/2,o=0;os||n+r>=a?(t=o,i=s-n,e.ignoreChars&&r>0&&i===r&&(i+=e.ignoreChars),!1):(n+=r,!0)}),{node:t,offset:i}},getText:function(e){var t="",i=0;return this.forEach(function(n){var o;if(n.ignoreChars){o=n.lastChild;for(var r=0,s=[],a=-1;o;){var l=o.data;if(l)for(var d=l.length-1;d>=0;d--){var c=l.substring(d,d+1);r1;){var N=Math.floor((E+O)/2);y=O+1,x=N===T-1&&i.ignoreChars?C.length:N+1,b=0===y&&8===s.isIE,o._isRangeRects?(v.setStart(C,y),v.setEnd(C,x)):(b&&(y=1),v.moveToElementText(i),v.move("character",y),v.moveEnd("character",x-y)),w=v.getClientRects();for(var M=!1,I=0;I=h&&_>e&&(!o._wrapMode||t>=u&&m>=t)){M=!0;break}M?E=N:O=N}n+=E,y=E,x=E===T-1&&i.ignoreChars?C.length:Math.min(E+1,C.length),o._isRangeRects?(v.setStart(C,y),v.setEnd(C,x)):(v.moveToElementText(i),v.move("character",y),v.moveEnd("character",x-y)),w=v.getClientRects();var B=!1;w.length>0&&(c=w[0],h=(b?S:c.left)*D-f.left,_=c.right*D-f.left,B=e>h+(_-h)/2);var R=n-l,F=r.getLine(a),P=F.charCodeAt(R);P>=55296&&56319>=P&&B?R=56320&&57343>=P&&(n+=1)):P>=56320&&57343>=P&&!B&&R>0&&(P=F.charCodeAt(R-1),P>=55296&&56319>=P&&(n-=1)),B&&n++}else{for(var W=[],V=0;T>V;V++)W.push(""),W.push(V===T-1?C.data.substring(V):C.data.substring(V,V+1)),W.push("");i.innerHTML=W.join("");for(var j=i.firstChild;j;){if(c=j.getBoundingClientRect(),h=c.left-f.left,_=c.right-f.left,e>=h&&_>e){e>h+(_-h)/2&&n++;break}n++,j=j.nextSibling}if(!g._createdDiv){i.innerHTML="",i.appendChild(C);var U=o._getSelections()[0];(n<=U.start&&U.startu.right&&(e=u.right-1)}else 0>e&&(e=0),e>f.right-f.left&&(e=f.right-f.left);var m,v;if(this._lastHitChild&&this._lastHitChild.parentNode){if(m=this._lastHitOffset,v=this._lastHitChild,u=n(v),!u)for(var y=m,x=m+this._nodeLength(v),b=v.previousSibling,w=v.nextSibling;b||w;){if(b){if(y-=this._nodeLength(b),u=n(b)){v=b,m=y;break}b=b.previousSibling}if(w){if(u=n(w)){v=w,m=x;break}x+=this._nodeLength(w),w=w.nextSibling}}}else m=l,this.forEach(function(e){return v=e,(u=n(v))?!1:(m+=this._nodeLength(v),!0)});return v&&u&&(this._lastHitChild=v,this._lastHitOffset=m,m=i(v,m,u)),Math.min(c,Math.max(l,m))},getNextOffset:function(e,t){if("line"===t.unit){var i=this.view,n=i._model,o=n.getLineAtOffset(e);return t.count>0?(t.count--,n.getLineEnd(o)):(t.count++,n.getLineStart(o))}return"wordend"===t.unit||"wordWS"===t.unit||"wordendWS"===t.unit?this._getNextOffset_W3C(e,t):s.isIE?this._getNextOffset_IE(e,t):this._getNextOffset_W3C(e,t)},_getNextOffset_W3C:function(e,t){function i(e){return e>=33&&47>=e||e>=58&&64>=e||e>=91&&94>=e||96===e||e>=123&&126>=e}function n(e){return 32===e||9===e}var o,r=this.view,s=r._model,a=s.getLineAtOffset(e),l=s.getLine(a),d=s.getLineStart(a),c=s.getLineEnd(a),h=l.length,u=e-d,p=t.count<0?-1:1;if("word"===t.unit||"wordend"===t.unit||"wordWS"===t.unit||"wordendWS"===t.unit)for(var f,g,_,m;0!==t.count;){if(t.count>0){if(u===h)return c;for(o=l.charCodeAt(u),f=i(o),g=!f&&!n(o),u++;h>u;){if(o=l.charCodeAt(u),"wordWS"!==t.unit&&"wordendWS"!==t.unit){if(_=i(o),"wordend"===t.unit){if(!_&&f)break}else if(_&&!f)break;m=!_&&!n(o)}else m=!n(o);if("wordend"===t.unit||"wordendWS"===t.unit){if(!m&&g)break}else if(m&&!g)break;g=m,f=_,u++}}else{if(0===u)return d;for(u--,o=l.charCodeAt(u),f=i(o),g=!f&&!n(o);u>0;){if(o=l.charCodeAt(u-1),"wordWS"!==t.unit&&"wordendWS"!==t.unit){if(_=i(o),"wordend"===t.unit){if(_&&!f)break}else if(!_&&f)break;m=!_&&!n(o)}else m=!n(o);if("wordend"===t.unit||"wordendWS"===t.unit){if(m&&!g)break}else if(!m&&g)break;g=m,f=_,u--}}t.count-=p}else for(;0!==t.count&&u+p>=0&&h>=u+p;)u+=p,o=l.charCodeAt(u),o>=56320&&57343>=o&&u>0&&(o=l.charCodeAt(u-1),o>=55296&&56319>=o&&(u+=p)),t.count-=p;return d+u},_getNextOffset_IE:function(e,t){var i,n,o,r=this._ensureCreated(),s=this.view,a=s._model,l=this.lineIndex,d=0,c=a.getLineStart(l),h=a.getLine(l),u=a.getLineStart(l),p=r.ownerDocument,f=t.count<0?-1:1;if(e===a.getLineEnd(l)){for(o=r.lastChild;o&&o.ignoreChars===o.firstChild.length;)o=o.previousSibling;if(!o)return c;i=p.body.createTextRange(),i.moveToElementText(o),n=i.text.length,i.moveEnd(t.unit,f),d=e+i.text.length-n}else if(e===c&&t.count<0)d=c;else for(o=r.firstChild;o;){var g=this._nodeLength(o);if(c+g>e){if(i=p.body.createTextRange(),e===c&&t.count<0){for(var _=o.previousSibling;_&&(!_.firstChild||!_.firstChild.length);)_=_.previousSibling;i.moveToElementText(_?_:o.previousSibling)}else i.moveToElementText(o),i.collapse(),i.moveEnd("character",e-c);n=i.text.length,i.moveEnd(t.unit,f),d=e+i.text.length-n;break}c=g+c,o=o.nextSibling}var m=d-u,v=h.charCodeAt(m);return v>=56320&&57343>=v&&m>0&&(v=h.charCodeAt(m-1),v>=55296&&56319>=v&&(m+=f)),d=m+u,t.count-=f,d},updateLinks:function(){var e=this._ensureCreated();if(this.hasLink){var t=this;this.forEach(function(i){var n=i.viewStyle;return n&&n.tagName&&"a"===n.tagName.toLowerCase()&&e.replaceChild(t._createSpan(e,i.firstChild.data,n),i),!0})}},destroy:function(){var e=this._createdDiv;e&&(e.parentNode.removeChild(e),this._createdDiv=null)}},T.prototype={addKeyMode:function(e,t){var i=this._keyModes;void 0!==t?i.splice(t,0,e):i.push(e),e._modeAdded&&e._modeAdded()},addRuler:function(e,t){var i=this._rulers;if(void 0!==t){var n,o;for(n=0,o=0;no;n++)e.getLocation()===i[n].getLocation()&&o++;i.splice(o,0,e),t=o}else i.push(e);this._createRuler(e,t),e.setView(this),this._update()},computeSize:function(){var e=0,t=0,i=this._model,n=this._clientDiv;if(!n)return{width:e,height:t};var o=n.style.width;s.isWebkit&&(n.style.width="0x7fffffffpx");for(var r=i.getLineCount(),a=0;r>a;a++){var l=this._getLine(a),d=l.getBoundingClientRect();e=Math.max(e,d.right-d.left),t+=d.bottom-d.top,l.destroy()}s.isWebkit&&(n.style.width=o);var c=this._getViewPadding();return e+=c.right+c.left+this._metrics.scrollWidth,t+=c.bottom+c.top+this._metrics.scrollWidth,{width:e,height:t}},convert:function(e,t,i){if(!this._clientDiv)return e;var n=this._getScroll(),o=this._getViewPadding(),r=this._viewDiv.getBoundingClientRect();return"document"===t&&(void 0!==e.x&&(e.x+=-n.x+r.left+o.left),void 0!==e.y&&(e.y+=-n.y+r.top+o.top)),"document"===i&&(void 0!==e.x&&(e.x+=n.x-r.left-o.left),void 0!==e.y&&(e.y+=n.y-r.top-o.top)),e},copy:function(){return this._clientDiv?this._doCopy():!1},cut:function(){return this._clientDiv?this._doCut():!1},destroy:function(){for(var e=0;ei)return!1;var n=this._getLine(i),o=this.getOffsetAtLocation(e,t),r=n.getBoundingClientRect(o);return n.destroy(),e>r.right?!1:!0},getLinePixel:function(e){return this._clientDiv?this._getLinePixel(e):0},getLocationAtOffset:function(e){if(!this._clientDiv)return{x:0,y:0};var t=this._model;e=Math.min(Math.max(0,e),t.getCharCount());var i=t.getLineAtOffset(e),n=this._getLine(i),o=n.getBoundingClientRect(e);n.destroy();var r=o.left,s=this._getLinePixel(i)+o.top;return{x:r,y:s}},getNextOffset:function(e,t){var i=new x(e,e,!1);return this._doMove(t,i),i.getCaret()},getOptions:function(){var e;if(0===arguments.length)e=this._defaultOptions();else if(1===arguments.length){var t=arguments[0];if("string"==typeof t)return u(this["_"+t]);e=t}else{e={};for(var i in arguments)arguments.hasOwnProperty(i)&&(e[arguments[i]]=void 0)}for(var n in e)e.hasOwnProperty(n)&&(e[n]=u(this["_"+n]));return e},getModel:function(){return this._model},getOffsetAtLocation:function(e,t){if(!this._clientDiv)return 0;var i=this._getLineIndex(t),n=this._getLine(i),o=n.getOffset(e,t-this._getLinePixel(i));return n.destroy(),o},getLineAtOffset:function(e){return this.getModel().getLineAtOffset(e)},getLineStart:function(e){return this.getModel().getLineStart(e)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){return this._getSelection()},getSelections:function(){return this._getSelections()},getSelectionText:function(e){var t=[],i=this,n=this._getSelections();return n.forEach(function(e){e.isEmpty()||t.push(i._getBaseText(e.start,e.end))}),t.join(void 0!==e?e:this._model.getLineDelimiter())},getText:function(e,t){var i=this._model;return i.getText(e,t)},getTopIndex:function(e){return this._clientDiv?this._getTopIndex(e):0},getTopPixel:function(){return this._clientDiv?this._getScroll().y:0},invokeAction:function(e,t,i){if(this._clientDiv){var n=this._actions[e];if(n){if(n.actionDescription&&n.actionDescription.id&&l.logEvent("editor","action",n.actionDescription.id),!t&&n.handler&&n.handler(i))return!0;if(n.defaultHandler)return"boolean"==typeof n.defaultHandler(i)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(e){return this.dispatchEvent(e)},onDragStart:function(e){return this.dispatchEvent(e)},onDrag:function(e){return this.dispatchEvent(e)},onDragEnd:function(e){return this.dispatchEvent(e)},onDragEnter:function(e){return this.dispatchEvent(e)},onDragOver:function(e){return this.dispatchEvent(e)},onDragLeave:function(e){return this.dispatchEvent(e)},onDrop:function(e){return this.dispatchEvent(e)},onDestroy:function(e){return this.dispatchEvent(e)},onSaving:function(e){return this.dispatchEvent(e)},onInputChanged:function(e){return this.dispatchEvent(e)},onLineStyle:function(e){return this.dispatchEvent(e)},onKeyDown:function(e){return this.dispatchEvent(e)},onKeyPress:function(e){return this.dispatchEvent(e)},onKeyUp:function(e){return this.dispatchEvent(e)},onModelChanged:function(e){return this.dispatchEvent(e)},onModelChanging:function(e){return this.dispatchEvent(e)},onModify:function(e){return this.dispatchEvent(e)},onMouseDown:function(e){return this.dispatchEvent(e)},onMouseUp:function(e){return this.dispatchEvent(e)},onMouseMove:function(e){return this.dispatchEvent(e)},onMouseOver:function(e){return this.dispatchEvent(e)},onMouseOut:function(e){return this.dispatchEvent(e)},onTouchStart:function(e){return this.dispatchEvent(e)},onTouchMove:function(e){return this.dispatchEvent(e)},onTouchEnd:function(e){return this.dispatchEvent(e)},onOptions:function(e){return this.dispatchEvent(e)},onSelection:function(e){return this.dispatchEvent(e)},onScroll:function(e){return this.dispatchEvent(e)},onVerify:function(e){return this.dispatchEvent(e)},onFocus:function(e){return this.dispatchEvent(e)},onBlur:function(e){return this.dispatchEvent(e)},paste:function(){return this._clientDiv?this._doPaste():!1},redraw:function(){if(!(this._redrawCount>0)){var e=this._model.getLineCount();this.redrawRulers(0,e),this.redrawLines(0,e)}},redrawRulers:function(e,t){if(!(this._redrawCount>0))for(var i=this.getRulers(),n=0;n0)&&(void 0===e&&(e=0),void 0===t&&(t=this._model.getLineCount()),e!==t)){var n=this._clientDiv;if(n){if(i){var o=this._getRulerParent(i);for(n=o.firstChild;n&&n._ruler!==i;)n=n.nextSibling}i?n.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(e,t);var r=-1;if(i||-1===this._imeOffset||(r=this._model.getLineAtOffset(this._imeOffset)),!i||"page"===i.getOverview())for(var s=n.firstChild;s;){var a=s.lineIndex;a>=e&&t>a&&a!==r&&(s.lineChanged=!0),s=s.nextSibling}i||this._wrapMode||e<=this._maxLineIndex&&this._maxLineIndex0)){var i=this._model;void 0===e&&(e=0),void 0===t&&(t=i.getCharCount());var n=i.getLineAtOffset(e),o=i.getLineAtOffset(Math.max(e,t-1))+1;this.redrawLines(n,o)}},removeKeyMode:function(e){for(var t=this._keyModes,i=0;it;if(o){var r=e;e=t,t=r}var s=this._model.getCharCount();e=Math.max(0,Math.min(e,s)),t=Math.max(0,Math.min(t,s));var a=new x(e,t,o);this._setSelection(a,void 0===i||i,!0,n)},setSelections:function(e,t,i){var n=this._rangesToSelections(e);this._setSelection(n,void 0===t||t,!0,i)},setText:function(e,t,i,n,o){var r,a="string"==typeof e,l=void 0===t&&void 0===i&&a;a?(void 0===t&&(t=0),void 0===i&&(i=this._model.getCharCount()),r={text:e,selection:[new x(t,i,!1)]}):(r=e,r.selection=this._rangesToSelections(r.selection)),r._code=!0,l&&(this._variableLineHeight=!1),this._modifyContent(r,!l,void 0===n||n,o),l&&s.isFirefox<13&&this._fixCaret()},setTopIndex:function(e,t){this._clientDiv&&this._scrollViewAnimated(0,this._getLinePixel(Math.max(0,e))-this._getScroll().y,t)},setTopPixel:function(e,t){this._clientDiv&&this._scrollViewAnimated(0,Math.max(0,e)-this._getScroll().y,t)},showSelection:function(e,t){return this._showCaret(e?!1:!0,t,e)},update:function(e,t){this._clientDiv&&((e||this._metrics.invalid)&&this._updateStyle(),void 0===t||t?this._update():this._queueUpdate())},_handleRootMouseDown:function(e){if(this._cancelCheckSelection(),!this._ignoreEvent(e)){s.isFirefox<13&&1===e.which&&(this._clientDiv.contentEditable=!1,(this._overlayDiv||this._clientDiv).draggable=!0,this._ignoreBlur=!0);var t=this._overlayDiv||this._clientDiv;s.isIE<9&&(t=this._viewDiv);for(var i=e.target?e.target:e.srcElement;i;){if(t===i)return;if(i.className&&-1!==i.className.indexOf("textViewFind"))return;i=i.parentNode}if(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!this._isW3CEvents){var n=this,o=this._getWindow();o.setTimeout(function(){n._clientDiv.focus()},0)}}},_handleRootMouseUp:function(e){this._ignoreEvent(e)||(s.isFirefox<13&&1===e.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1),s.isFirefox&&1===e.which&&(this._fixCaret(),this._ignoreBlur=!1))},_handleBlur:function(){if(this._cancelCheckSelection(),!this._ignoreBlur){if(this._commitIME(),this._hasFocus=!1,s.isIE<9&&!this._getSelections()[0].isEmpty()){var e=this._rootDiv,t=s.createElement(e.ownerDocument,"div");e.appendChild(t),e.removeChild(t)}if(this._cursorDiv&&(this._cursorDiv.style.display="none"),this._domSelection){this._domSelection.forEach(function(e){e.update()});var i,n=this._getWindow(),o=this._parent.ownerDocument;if(n.getSelection){var r=n.getSelection();for(i=r.anchorNode;i;){if(i===this._clientDiv){r.rangeCount>0&&r.removeAllRanges();break}i=i.parentNode}}else if(o.selection){for(this._ignoreSelect=!1,i=o.selection.createRange().parentElement();i;){if(i===this._clientDiv){o.selection.empty();break}i=i.parentNode}this._ignoreSelect=!0}}this._ignoreFocus||this.onBlur({type:"Blur"})}},_handleCompositionStart:function(e){if(!this._ignoreEvent(e)){if(this._imeTimeout){var t=this._getWindow();t.clearTimeout(this._imeTimeout),this._imeTimeout=null}this._imeText&&(this._commitIME(this._imeText),this._imeText=null),this._startIME(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)}},_handleCompositionUpdate:function(e){this._ignoreEvent(e)||(this._imeText=e.data)},_handleCompositionEnd:function(e){if(!this._ignoreEvent(e)){this._imeText=e.data;var t=this._getWindow();this._imeTimeout=t.setTimeout(function(){this._commitIME(this._imeText),this._imeText=this._imeTimeout=null}.bind(this),0)}},_handleContextMenu:function(e){if(!this._ignoreEvent(e)){s.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var t=!1;if(this.isListening("ContextMenu")){var i=this._createMouseEvent("ContextMenu",e);i.screenX=e.screenX,i.screenY=e.screenY,this.onContextMenu(i),t=i.defaultPrevented}else s.isMac&&s.isFirefox&&0===e.button&&(t=!0);return t?(e.preventDefault&&e.preventDefault(),!1):(this._contextMenuOpen=!0,void(s.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))))}},_handleCopy:function(e){return this._cancelCheckSelection(),this._ignoreEvent(e)||this._ignoreCopy?void 0:this._doCopy(e)?(e.preventDefault&&e.preventDefault(),!1):void 0},_handleCut:function(e){return this._cancelCheckSelection(),this._ignoreEvent(e)?void 0:this._doCut(e)?(e.preventDefault&&e.preventDefault(),!1):void 0},_handleDataModified:function(e){this._ignoreEvent(e)||this._startIME()},_handleDblclick:function(e){if(!this._ignoreEvent(e)){var t=e.timeStamp?e.timeStamp:(new Date).getTime();this._lastMouseTime=t,2!==this._clickCount&&(this._clickCount=2,this._handleMouse(e))}},_handleDragStart:function(e){if(!this._ignoreEvent(e)){if(s.isFirefox<13){var t=this,i=this._getWindow();i.setTimeout(function(){t._clientDiv.contentEditable=!0,t._clientDiv.draggable=!1,t._ignoreBlur=!1},0)}return this.isListening("DragStart")&&-1!==this._dragOffset?(this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",e)),this._dragOffset=-1,void 0):(e.preventDefault&&e.preventDefault(),!1)}},_handleDrag:function(e){this._ignoreEvent(e)||this.isListening("Drag")&&this.onDrag(this._createMouseEvent("Drag",e))},_handleDragEnd:function(e){this._ignoreEvent(e)||(this._dropTarget=!1,this._dragOffset=-1,this.isListening("DragEnd")&&this.onDragEnd(this._createMouseEvent("DragEnd",e)),s.isFirefox<13&&(this._fixCaret(),"none"!==e.dataTransfer.dropEffect||e.dataTransfer.mozUserCancelled||this._fixCaret()))},_handleDragEnter:function(e){if(!this._ignoreEvent(e)){var t=!0;return this._dropTarget=!0,this.isListening("DragEnter")&&(t=!1,this.onDragEnter(this._createMouseEvent("DragEnter",e))),s.isWebkit||t?(e.preventDefault&&e.preventDefault(),!1):void 0}},_handleDragOver:function(e){if(!this._ignoreEvent(e)){var t=!0;return this.isListening("DragOver")&&(t=!1,this.onDragOver(this._createMouseEvent("DragOver",e))),s.isWebkit||t?(t&&(e.dataTransfer.dropEffect="none"),e.preventDefault&&e.preventDefault(),!1):void 0}},_handleDragLeave:function(e){this._ignoreEvent(e)||(this._dropTarget=!1,this.isListening("DragLeave")&&this.onDragLeave(this._createMouseEvent("DragLeave",e)))},_handleDrop:function(e){return this._ignoreEvent(e)?void 0:(this._dropTarget=!1,this.isListening("Drop")&&this.onDrop(this._createMouseEvent("Drop",e)),e.preventDefault&&e.preventDefault(),!1)},_handleFocus:function(){this._hasFocus=!0,s.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection(),this._cursorDiv&&(this._cursorDiv.style.display="block"),this._domSelection&&this._domSelection.forEach(function(e){e.update()}),this._ignoreFocus||this.onFocus({type:"Focus"})},_handleKeyDown:function(e){if(this._cancelCheckSelection(),!this._ignoreEvent(e)){if(this.isListening("KeyDown")){var t=this._createKeyEvent("KeyDown",e);if(this.onKeyDown(t),t.defaultPrevented)return s.isFirefox&&(this._keyDownPrevented=!0),void e.preventDefault()}var i=!1;switch(e.keyCode){case 16:case 17:case 18:case 91:i=!0;break;default:this._setLinksVisible(!1)}if(229===e.keyCode){if(this._readonly)return e.preventDefault&&e.preventDefault(),!1;var n=!0;s.isSafari&&s.isMac&&e.ctrlKey&&(n=!1,e.keyCode=129),n&&this._startIME()}else i||this._commitIME();return(s.isMac||s.isLinux)&&s.isFirefox<4||s.isOpera<12.16?(this._keyDownEvent=e,!0):this._doAction(e)?(e.preventDefault?(e.preventDefault(),e.stopPropagation()):(e.cancelBubble=!0,e.returnValue=!1,e.keyCode=0),!1):void 0}},_handleKeyPress:function(e){if(!this._ignoreEvent(e)){if(this._keyDownPrevented)return e.preventDefault&&(e.preventDefault(),e.stopPropagation()),void(this._keyDownPrevented=void 0);if(s.isMac&&s.isWebkit&&(63232<=e.keyCode&&e.keyCode<=63487||13===e.keyCode||8===e.keyCode))return e.preventDefault&&e.preventDefault(),!1;if(((s.isMac||s.isLinux)&&s.isFirefox<4||s.isOpera<12.16)&&this._doAction(this._keyDownEvent))return e.preventDefault&&e.preventDefault(),!1;var t=s.isMac?e.metaKey:e.ctrlKey;if(void 0!==e.charCode&&t)switch(e.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")){var i=this._createKeyEvent("KeyPress",e);if(this.onKeyPress(i),i.defaultPrevented)return void e.preventDefault()}if(this._doAction(e))return e.preventDefault?(e.preventDefault(),e.stopPropagation()):(e.cancelBubble=!0,e.returnValue=!1,e.keyCode=0),!1;var n=!1;if(s.isMac?(e.ctrlKey||e.metaKey)&&(n=!0):s.isFirefox?(e.ctrlKey||e.altKey)&&(n=!0):e.ctrlKey^e.altKey&&(n=!0),!n){var o=s.isOpera?e.which:void 0!==e.charCode?e.charCode:e.keyCode;if(o>31)return this._doContent(String.fromCharCode(o)),e.preventDefault&&e.preventDefault(),!1}}},_handleDocKeyUp:function(e){var t=s.isMac?e.metaKey:e.ctrlKey;t||this._setLinksVisible(!1)},_handleKeyUp:function(e){if(!this._ignoreEvent(e)){if(this.isListening("KeyUp")){var t=this._createKeyEvent("KeyUp",e);if(this.onKeyUp(t),t.defaultPrevented)return void e.preventDefault()}this._handleDocKeyUp(e),13===e.keyCode&&this._commitIME()}},_handleLinkClick:function(e){var t=s.isMac?e.metaKey:e.ctrlKey;return t?void 0:(e.preventDefault&&e.preventDefault(),!1)},_handleMouse:function(e){var t=this._getWindow(),i=!0,n=t;if((s.isIE||s.isFirefox&&!this._overlayDiv)&&(n=this._clientDiv),this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var o=this;t.setTimeout(function(){o.focus(),o._ignoreFocus=!1},0)}var r=e.shiftKey,a=e.altKey,l=s.isMac?e.metaKey:e.ctrlKey;if(this._blockSelection=this._doubleClickSelection=null,1===this._clickCount){var d=(!s.isOpera||s.isOpera>=12.16)&&this._hasFocus&&this.isListening("DragStart");i=this._setSelectionTo(e.clientX,e.clientY,!0,r,l,d),i&&this._setGrab(n)}else this._isW3CEvents&&this._setGrab(n),this._setSelectionTo(e.clientX,e.clientY,!0,r,l,!1),this._doubleClickSelection=x.editing(this._getSelections());return a&&(this._blockSelection=x.editing(this._getSelections())),i},_handleMouseDown:function(e){if(!this._ignoreEvent(e)){if(this._linksVisible){var t=e.target||e.srcElement;if("A"===t.tagName)return;this._setLinksVisible(!1)}this._commitIME();var i=e.which;i||(4===e.button&&(i=2),2===e.button&&(i=3),1===e.button&&(i=1));var n=2!==i&&e.timeStamp?e.timeStamp:(new Date).getTime(),o=n-this._lastMouseTime,r=Math.abs(this._lastMouseX-e.clientX),a=Math.abs(this._lastMouseY-e.clientY),l=this._lastMouseButton===i;if(this._lastMouseX=e.clientX,this._lastMouseY=e.clientY,this._lastMouseTime=n,this._lastMouseButton=i,1===i&&(this._isMouseDown=!0,l&&o<=this._clickTime&&r<=this._clickDist&&a<=this._clickDist?this._clickCount++:this._clickCount=1),this.isListening("MouseDown")){var d=this._createMouseEvent("MouseDown",e);if(this.onMouseDown(d),d.defaultPrevented)return void e.preventDefault()}1===i&&this._handleMouse(e)&&(s.isIE>=9||s.isOpera||s.isChrome||s.isSafari||s.isFirefox&&!this._overlayDiv)&&(this._hasFocus||this.focus(),e.preventDefault()),s.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}},_handleMouseOver:function(e){this._ignoreEvent(e)||this._animation||this.isListening("MouseOver")&&this.onMouseOver(this._createMouseEvent("MouseOver",e))},_handleMouseOut:function(e){this._ignoreEvent(e)||this._animation||this.isListening("MouseOut")&&this.onMouseOut(this._createMouseEvent("MouseOut",e))},_handleMouseMove:function(e){if(!this._animation){var t=this._isClientDiv(e);if(this.isListening("MouseMove")&&(t||this._isMouseDown)){var i=this._createMouseEvent("MouseMove",e);if(this.onMouseMove(i),i.defaultPrevented)return void e.preventDefault()}if(!this._dropTarget){var n=this._linksVisible||this._lastMouseMoveX!==e.clientX||this._lastMouseMoveY!==e.clientY;if(this._lastMouseMoveX=e.clientX,this._lastMouseMoveY=e.clientY,this._setLinksVisible(n&&!this._isMouseDown&&e.altKey&&(s.isMac?e.metaKey:e.ctrlKey)),this._checkOverlayScroll(),!this._isW3CEvents){if(0===e.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===e.button&&0!==(1&this._clickCount)&&t)return this._clickCount=2,this._handleMouse(e,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){var o=e.clientX,r=e.clientY,a=this._getViewPadding(),l=this._viewDiv.getBoundingClientRect(),d=this._getClientWidth(),c=this._getClientHeight(),h=l.left+a.left,u=l.top+a.top,p=l.left+a.left+d,f=l.top+a.top+c;u>r?this._doAutoScroll("up",o,r-u):r>f?this._doAutoScroll("down",o,r-f):h>o&&!this._wrapMode?this._doAutoScroll("left",o-h,r):o>p&&!this._wrapMode?this._doAutoScroll("right",o-p,r):(this._endAutoScroll(),this._setSelectionTo(o,r,!1,!0))}}}},_isClientDiv:function(e){for(var t=this._overlayDiv||this._clientDiv,i=e.target?e.target:e.srcElement;i;){if(t===i)return!0;i=i.parentNode}return!1},_createKeyEvent:function(e,t){return{type:e,event:t,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(e,t){var i=this.convert({x:t.clientX,y:t.clientY},"page","document");
+return{type:e,event:t,clickCount:this._clickCount,x:i.x,y:i.y,preventDefault:function(){this.defaultPrevented=!0}}},_createTouchEvent:function(e,t){var i=t.touches.length?this.convert({x:t.touches[0].clientX,y:t.touches[0].clientY},"page","document"):{};return{type:e,event:t,touchCount:t.touches.length,x:i.x,y:i.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(e){var t=e.which?0===e.button:1===e.button;if(this.isListening("MouseUp")&&(this._isClientDiv(e)||t&&this._isMouseDown)){var i=this._createMouseEvent("MouseUp",e);if(this.onMouseUp(i),i.defaultPrevented)return e.preventDefault(),void(this._isMouseDown=!1)}if(!this._linksVisible){if(t&&this._isMouseDown){var n=this._getSelections(),o=x.editing(n);n.forEach(function(e){e._editing=!1}),-1!==this._dragOffset&&(o.extend(this._dragOffset),o.collapse(),n=o,this._dragOffset=-1),this._setSelection(n,!1),this._isMouseDown=!1,this._endAutoScroll(),this._isW3CEvents&&this._setGrab(null)}t&&this._isMouseDown&&s.isFirefox&&(this._updateDOMSelection(),e.preventDefault())}},_handleMouseWheel:function(e){if(!this._noScroll){var t=this._getLineHeight(),i=0,n=0;if(s.isIE||s.isOpera)n=-e.wheelDelta/40*t;else if(s.isFirefox){var o=256;if("wheel"===e.type)e.deltaMode?(i=Math.max(-o,Math.min(o,e.deltaX))*t,n=Math.max(-o,Math.min(o,e.deltaY))*t):(i=e.deltaX,n=e.deltaY);else{var r;r=s.isMac?3*e.detail:Math.max(-o,Math.min(o,e.detail))*t,e.axis===e.HORIZONTAL_AXIS?i=r:n=r}}else if(s.isMac){var a,l,d=e.timeStamp-this._wheelTimeStamp;this._wheelTimeStamp=e.timeStamp,a=e.wheelDeltaX%120!==0?1:40>d?40/(40-d):40,l=e.wheelDeltaY%120!==0?1:40>d?40/(40-d):40,i=Math.ceil(-e.wheelDeltaX/a),i>-1&&0>i&&(i=-1),i>0&&1>i&&(i=1),n=Math.ceil(-e.wheelDeltaY/l),n>-1&&0>n&&(n=-1),n>0&&1>n&&(n=1)}else{i=-e.wheelDeltaX;var c=8;n=-e.wheelDeltaY/120*c*t}if(s.isSafari||s.isChrome&&s.isMac){for(var h=e.target;h&&void 0===h.lineIndex;)h=h.parentNode;this._mouseWheelLine=h}var u=this._getScroll();this._scrollView(i,n);var p=this._getScroll();return u.x!==p.x||u.y!==p.y?(e.preventDefault&&e.preventDefault(),!1):void 0}},_handlePaste:function(e){if(this._cancelCheckSelection(),!this._ignoreEvent(e)&&!this._ignorePaste&&this._doPaste(e)){if(s.isIE){var t=this;this._ignoreFocus=!0;var i=this._getWindow();i.setTimeout(function(){t._updateDOMSelection(),t._ignoreFocus=!1},0)}return e.preventDefault&&e.preventDefault(),!1}},_handleResize:function(){var e=this._rootDiv.clientWidth,t=this._rootDiv.clientHeight;if(this._rootWidth!==e||this._rootHeight!==t){this._rootWidth!==e&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=e,this._rootHeight=t;var i=s.isIE<9,n=this._calculateMetrics();f(n,this._metrics)||(this._metrics.invalid&&!n.invalid?this._updateStyle(!1,n):(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=n),i=!0),i?this._queueUpdate():this._update(),this.dispatchEvent({type:"Resize"})}},_handleRulerEvent:function(e){for(var t=e.target?e.target:e.srcElement,i=t.lineIndex,n=t;n&&!n._ruler;)void 0===i&&void 0!==n.lineIndex&&(i=n.lineIndex),n=n.parentNode;var o=n?n._ruler:null;if(void 0===i&&o&&"document"===o.getOverview()){var r,s,a=this._getClientHeight(),l=this._model.getLineCount(),d=this._getViewPadding(),c=this._viewDiv.getBoundingClientRect(),h=this._getLineHeight(),u=h*l,p=a+d.top+d.bottom-2*this._metrics.scrollWidth;p>u?(r=h,s=d.top):(r=p/l,s=this._metrics.scrollWidth),i=Math.floor((e.clientY-c.top-s)/r),i>=0&&l>i||(i=void 0)}if(o)switch(e.type){case"click":o.onClick&&o.onClick(i,e);break;case"dblclick":o.onDblClick&&o.onDblClick(i,e);break;case"mousemove":o.onMouseMove&&o.onMouseMove(i,e);break;case"mouseover":o.onMouseOver&&o.onMouseOver(i,e);break;case"mouseout":if(o.onMouseOut){for(var f=e.relatedTarget;f&&f!==this._rootDiv;){if(f===n)return;f=f.parentNode}o.onMouseOut(i,e)}}},_handleScroll:function(){this._lastScrollTime=(new Date).getTime();var e=this._getScroll(!1),t=this._hScroll,i=this._vScroll;if(t!==e.x||i!==e.y){this._hScroll=e.x,this._vScroll=e.y,this._commitIME(),this._update(i===e.y);var n={type:"Scroll",oldValue:{x:t,y:i},newValue:e};this.onScroll(n)}},_handleSelectStart:function(e){var t=this._contextMenuOpen;return this._contextMenuOpen=!1,t?void(this._checkSelectionChange=!0):this._ignoreSelect?(e&&e.preventDefault&&e.preventDefault(),!1):void 0},_getModelOffset:function(e,t){if(e){var i;return i="DIV"===e.tagName?e:e.parentNode.parentNode,i._line?i._line.getModelOffset(e,t):0}},_updateSelectionFromDOM:function(){if(!(s.isIOS||s.isAndroid||this._checkSelectionChange))return!1;var e=this._getWindow(),t=e.getSelection(),i=this._getModelOffset(t.anchorNode,t.anchorOffset),n=this._getModelOffset(t.focusNode,t.focusOffset),o=this._getSelections()[0];if(void 0===i||void 0===n||o.start===i&&o.end===n)return!1;if(this._checkSelectionChange){var r=this._getLineNext(),a=this._getLinePrevious();if(t.anchorNode===r.firstChild.firstChild&&0===t.anchorOffset&&t.focusNode===a.firstChild.firstChild&&0===t.focusOffset)return!1;(t.anchorNode===r.firstChild.firstChild&&0===t.anchorOffset&&t.focusNode===a.lastChild.firstChild||t.anchorNode===this._clientDiv&&t.focusNode===this._clientDiv)&&(i=0,n=this.getModel().getCharCount())}return this._setSelection(new x(i,n),!1,!1),this._checkSelectionChange=!1,!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){if(this._selPollTimer){var e=this._getWindow();e.clearTimeout(this._selPollTimer),this._selPollTimer=null}},_pollSelectionChange:function(e){var t=this,i=this._getWindow();this._cancelPollSelectionChange(),this._selPollTimer=i.setTimeout(function(){if(t._selPollTimer=null,t._clientDiv){var i=t._updateSelectionFromDOM();!i&&e&&t._pollSelectionChange(e)}},100)},_handleSelectionChange:function(){-1===this._imeOffset&&(s.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(e){if(!this._ignoreEvent(e)&&-1===this._imeOffset){var t=this._getWindow().getSelection();if(t.anchorNode!==this._anchorNode||t.focusNode!==this._focusNode||t.anchorOffset!==this._anchorOffset||t.focusOffset!==this._focusOffset){for(var i=t.anchorNode;i&&void 0===i.lineIndex;)i=i.parentNode;if(i){var n=this._model,o=i.lineIndex,r=n.getLine(o),s=r,a=0,l=n.getLineStart(o);if(t.rangeCount>0){t.getRangeAt(0).deleteContents();var d=i.ownerDocument.createTextNode(e.data);t.getRangeAt(0).insertNode(d);var c=this._getDOMText(i,d);s=c.text,a=c.offset,d.parentNode.removeChild(d)}i.lineRemoved=!0;for(var h=0;r.charCodeAt(h)===s.charCodeAt(h)&&a>h;)h++;for(var u=r.length-1,p=s.length-r.length;r.charCodeAt(u)===s.charCodeAt(u+p)&&u+p>=a+e.data.length;)u--;u++;var f=s.substring(h,u+p);h+=l,u+=l;var g=this._getSelections(),_=g[0].start-h,m=g[0].end-u;g[0].start=h,g[0].end=u;for(var v=1;v=0;i--)if(t=n[i],"function"==typeof t.match){var o=t.match(e);if(void 0!==o)return this.invokeAction(o)}return!1},_doMove:function(e,t){var i=this._model,n=t.getCaret(),o=i.getLineAtOffset(n);for(e.count||(e.count=1);0!==e.count;){var r=i.getLineStart(o);if(e.count<0&&n===r){if(!(o>0))break;"character"===e.unit&&e.count++,o--,t.extend(i.getLineEnd(o))}else if(e.count>0&&n===i.getLineEnd(o)){if(!(o+10&&(r=Math.min(r+e.count-1,t.getLineCount()-1)),o=t.getLineEnd(r);n.extend(o)}e.select||n.collapse()}),this._setSelection(n,!0,!0,e.ctrl?function(){}:null),!0},_doEnter:function(e){if(this._singleMode)return!0;var t=this._model,i=this._getSelections();return this._doContent(t.getLineDelimiter()),e&&e.noCursor&&(i.forEach(function(e){e.end=e.start}),this._setSelection(i,!0)),!0},_doEscape:function(){var e=this._getSelections();return e.length>1&&this._setSelection(e[0],!0),!0},_doHome:function(e){var t=this._model,i=this,n=this._getSelections();return n.forEach(function(n){if(e.ctrl)n.extend(0);else{var o=n.getCaret(),r=t.getLineAtOffset(o);if(i._wrapMode){var s=i._getLine(r),a=s.getLineIndex(o);o=s.getLineStart(a),s.destroy()}else o=t.getLineStart(r);n.extend(o)}e.select||n.collapse()}),this._setSelection(n,!0,!0,e.ctrl?function(){}:null),!0},_doLineDown:function(e){var t=this._model,i=this,n=this._getSelections();return n.forEach(function(n){var o,r=n.getCaret(),a=t.getLineAtOffset(r),l=i._getLine(a),d=n._columnX,c=1,h=!1;if(-1===d||e.wholeLine||e.select&&s.isIE){var u=e.wholeLine?t.getLineEnd(a+1):r;d=n._columnX=l.getBoundingClientRect(u).left}if((o=l.getLineIndex(r))0?a=Math.min(a+e.count,p):a++}var f=!1;h?(e.select||s.isMac||s.isLinux)&&(n.extend(t.getCharCount()),f=!0):(l.lineIndex!==a&&(l.destroy(),l=i._getLine(a)),n.extend(l.getOffset(d,c)),f=!0),f&&(e.select||n.collapse()),l.destroy()}),i._setSelection(n,!0,!0,null,0,!1,!0),!0},_doLineUp:function(e){var t=this._model,i=this,n=this._getSelections();return n.forEach(function(n){var o,r,a=n.getCaret(),l=t.getLineAtOffset(a),d=i._getLine(l),c=n._columnX,h=!1;if(-1===c||e.wholeLine||e.select&&s.isIE){var u=e.wholeLine?t.getLineStart(l-1):a;c=n._columnX=d.getBoundingClientRect(u).left}(o=d.getLineIndex(a))>0?r=d.getClientRects(o-1).top+1:(h=0===l,h||(e.count&&e.count>0?l=Math.max(l-e.count,0):l--,r=i._getLineHeight(l)-1));var p=!1;h?(e.select||s.isMac||s.isLinux)&&(n.extend(0),p=!0):(d.lineIndex!==l&&(d.destroy(),d=i._getLine(l)),n.extend(d.getOffset(c,r)),p=!0),p&&(e.select||n.collapse()),d.destroy()}),i._setSelection(n,!0,!0,null,0,!1,!0),!0},_doNoop:function(){return!0},_doPageDown:function(e){var t,i,n,o=this,r=this._model,a=this._getSelections(),l=r.getLineCount(),d=this._getScroll(),c=this._getClientHeight(),h=this._getLineHeight(),u=Math.floor(c/h);return a.forEach(function(a){var p=a.getCaret(),f=r.getLineAtOffset(p);if(o._lineHeight){t=a._columnX;var g=o._getBoundsAtOffset(p);(-1===t||e.select&&s.isIE)&&(t=a._columnX=g.left);var _=o._getLineIndex(g.top+c);i=o._getLine(_);var m=o._getLinePixel(_),v=g.top+c-m;p=i.getOffset(t,v);var y=i.getBoundingClientRect(p);i.destroy(),a.extend(p),e.select||a.collapse(),n=void 0!==n?Math.min(n,y.top+m-g.top):y.top+m-g.top}else if(l-1>f){var x=Math.min(l-f-1,u);x=Math.max(1,x),t=a._columnX,(-1===t||e.select&&s.isIE)&&(i=o._getLine(f),t=a._columnX=i.getBoundingClientRect(p).left,i.destroy()),i=o._getLine(f+x),a.extend(i.getOffset(t,0)),i.destroy(),e.select||a.collapse();var b=l*h,w=d.y+x*h;w+c>b&&(w=b-c),n=void 0!==n?Math.min(n,w-d.y):w-d.y}}),this._setSelection(a,!0,!0,function(){},n,!1,!0),!0},_doPageUp:function(e){var t,i,n,o=this,r=this._model,a=this._getSelections(),l=this._getScroll(),d=this._getClientHeight(),c=this._getLineHeight(),h=Math.floor(d/c);return a.forEach(function(a){var u=a.getCaret(),p=r.getLineAtOffset(u);if(o._lineHeight){t=a._columnX;var f=o._getBoundsAtOffset(u);(-1===t||e.select&&s.isIE)&&(t=a._columnX=f.left);var g=o._getLineIndex(f.bottom-d);i=o._getLine(g);var _=o._getLinePixel(g),m=f.bottom-d-_;u=i.getOffset(t,m);var v=i.getBoundingClientRect(u);i.destroy(),a.extend(u),e.select||a.collapse(),n=void 0!==n?Math.max(n,v.top+_-f.top):v.top+_-f.top}else if(p>0){var y=Math.max(1,Math.min(p,h));t=a._columnX,(-1===t||e.select&&s.isIE)&&(i=o._getLine(p),t=a._columnX=i.getBoundingClientRect(u).left,i.destroy()),i=o._getLine(p-y),a.extend(i.getOffset(t,o._getLineHeight(p-y)-1)),i.destroy(),e.select||a.collapse();var x=Math.max(0,l.y-y*c);n=void 0!==n?Math.max(n,x-l.y):x-l.y}}),this._setSelection(a,!0,!0,function(){},n,!1,!0),!0},_doPaste:function(e){var t=this,i=this._getClipboardText(e,function(e){if(e.length){if(s.isLinux&&2===t._lastMouseButton){var i=(new Date).getTime()-t._lastMouseTime;i<=t._clickTime&&t._setSelectionTo(t._lastMouseX,t._lastMouseY,!0)}var n=t._getSelections(),o=t._singleMode?"":t._model.getLineDelimiter();t._doContent(n.length>1&&n.length===e.length?e:e.join(o))}});return null!==i},_doScroll:function(e){var t,i=e.type,n=this._model,o=n.getLineCount(),r=this._getClientHeight(),s=this._getLineHeight(),a=this._lineHeight?this._scrollHeight:o*s,l=this._getScroll().y;switch(i){case"textStart":t=0;break;case"textEnd":t=a-r;break;case"pageDown":t=l+r;break;case"pageUp":t=l-r;break;case"lineDown":t=l+s;break;case"lineUp":t=l-s;break;case"centerLine":var d=this._getSelections()[0],c=n.getLineAtOffset(d.start),h=n.getLineAtOffset(d.end),u=(h-c+1)*s;t=c*s-r/2+u/2}return void 0!==t&&(t=Math.min(Math.max(0,t),a-r),this._scrollViewAnimated(0,t-l,function(){})),!0},_doSelectAll:function(){var e=this._model;return this._setSelection(new x(0,e.getCharCount()),!1),!0},_doTab:function(){if(this._tabMode&&!this._readonly){var e=" ",t=this._getSelections();if(this._expandTab){e=[];var i=this._model,n=this._tabSize;t.forEach(function(t){var o=t.getCaret(),r=i.getLineAtOffset(o),s=i.getLineStart(r),a=n-(o-s)%n;e.push(c(a+1).join(" "))})}return this._modifyContent({text:e,selection:t,_ignoreDOMSelection:!0},!0)}},_doShiftTab:function(){return this._tabMode&&!this._readonly?!0:void 0},_doOverwriteMode:function(){return this._readonly?void 0:(this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0)},_doTabMode:function(){return this.setOptions({tabMode:!this.getOptions("tabMode")}),!0},_doWrapMode:function(){return this.setOptions({wrapMode:!this.getOptions("wrapMode")}),!0},_autoScroll:function(){var e,t,i=this._model,n=this._getSelections(),o=x.editing(n,"down"===this._autoScrollDir),r=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),a=o.getCaret(),l=i.getLineCount(),d=i.getLineAtOffset(a);if("up"===this._autoScrollDir||"down"===this._autoScrollDir){var c=this._autoScrollY/this._getLineHeight();c=0>c?Math.floor(c):Math.ceil(c),e=d,e=Math.max(0,Math.min(l-1,e+c))}else("left"===this._autoScrollDir||"right"===this._autoScrollDir)&&(e=this._getLineIndex(r.y),t=this._getLine(d),r.x+=t.getBoundingClientRect(a,!1).left,t.destroy());this._blockSelection?n=this._getBlockSelections(n,e,r):0===e&&(s.isMac||s.isLinux)?o.extend(0):e===l-1&&(s.isMac||s.isLinux)?o.extend(i.getCharCount()):(t=this._getLine(e),o.extend(t.getOffset(r.x,r.y-this._getLinePixel(e))),t.destroy()),this._setSelection(n,!0)},_autoScrollTimer:function(){this._autoScroll();var e=this,t=this._getWindow();this._autoScrollTimerID=t.setTimeout(function(){e._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(e){if(this._lineHeight&&!this._calculateLHTimer){var t=this._model.getLineCount(),i=0;if(e){for(var n=0,o=100,r=(new Date).getTime(),s=0;t>i&&(this._lineHeight[i]||(n++,s||(s=i),this._lineHeight[i]=this._calculateLineHeight(i)),i++,!((new Date).getTime()-r>o)););this.redrawRulers(0,t),this._queueUpdate()}var a=this._getWindow();if(i!==t){var l=this;return void(this._calculateLHTimer=a.setTimeout(function(){l._calculateLHTimer=null,l._calculateLineHeightTimer(!0)},0))}this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(e){var t=this._getLine(e),i=t.getBoundingClientRect();return t.destroy(),Math.max(1,i.bottom-i.top)},_calculateMetrics:function(){var e=this._clientDiv,t=e.ownerDocument,i=" ",n=s.createElement(t,"div");n.style.lineHeight="normal";var o=this._model,r=o.getLine(0),a={type:"LineStyle",textView:this,0:0,lineText:r,lineStart:0};this.onLineStyle(a),h(a.style,n),n.style.position="fixed",n.style.left="-1000px";var l=s.createElement(t,"span");l.appendChild(t.createTextNode(i)),n.appendChild(l);var d=s.createElement(t,"span");d.style.fontStyle="italic",d.appendChild(t.createTextNode(i)),n.appendChild(d);var u=s.createElement(t,"span");u.style.fontWeight="bold",u.appendChild(t.createTextNode(i)),n.appendChild(u);var p=s.createElement(t,"span");p.style.fontWeight="bold",p.style.fontStyle="italic",p.appendChild(t.createTextNode(i)),n.appendChild(p),e.appendChild(n);var f=n.getBoundingClientRect(),g=l.getBoundingClientRect(),_=d.getBoundingClientRect(),y=u.getBoundingClientRect(),x=p.getBoundingClientRect(),b=g.bottom-g.top,w=_.bottom-_.top,C=y.bottom-y.top,T=x.bottom-x.top,L=0,k=f.bottom-f.top<=0,D=Math.max(1,f.bottom-f.top);w>b&&(L=1),C>w&&(L=2),T>C&&(L=3);var A;0!==L&&(A={style:{}},0!==(1&L)&&(A.style.fontStyle="italic"),0!==(2&L)&&(A.style.fontWeight="bold"));var S=v(n);e.removeChild(n);var E=m(this._viewDiv),O=s.createElement(t,"div");O.style.position="fixed",O.style.left="-1000px",O.style.paddingLeft=E.left+"px",O.style.paddingTop=E.top+"px",O.style.paddingRight=E.right+"px",O.style.paddingBottom=E.bottom+"px",O.style.width="100px",O.style.height="100px";var N=s.createElement(t,"div");N.style.width="100%",N.style.height="100%",O.appendChild(N),e.appendChild(O);var M=O.getBoundingClientRect(),I=N.getBoundingClientRect(),B=0;if(!this._singleMode&&!this._noScroll){O.style.overflow="hidden",N.style.height="200px";var R=O.clientWidth;O.style.overflow="scroll";var F=O.clientWidth;B=R-F}e.removeChild(O),E={left:I.left-M.left,top:I.top-M.top,right:M.right-I.right,bottom:M.bottom-I.bottom};var P=0,W=0,V=0;return k||(O=s.createElement(t,"div"),O.style.position="fixed",O.style.left="-1000px",e.appendChild(O),O.innerHTML=c(2).join("a"),M=O.getBoundingClientRect(),V=Math.ceil(M.right-M.left),(this._wrapOffset||this._marginOffset)&&(O.innerHTML=c(this._wrapOffset+1+(s.isWebkit?0:1)).join(" "),M=O.getBoundingClientRect(),P=Math.ceil(M.right-M.left),O.innerHTML=c(this._marginOffset+1).join(" "),I=O.getBoundingClientRect(),W=Math.ceil(I.right-I.left)),e.removeChild(O)),{lineHeight:D,largestFontStyle:A,lineTrim:S,viewPadding:E,scrollWidth:B,wrapWidth:P,marginWidth:W,charWidth:V,invalid:k}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(e){var t=this._getSelections();return t.forEach(function(t){"next"===e?t.start=t.end:t.end=t.start}),this._setSelection(t,!0),!0},_commitIME:function(e){if(-1!==this._imeOffset){var t=this._model,i=t.getLineAtOffset(this._imeOffset),n=t.getLineStart(i),o=this._getLineNode(i);if(!e){this._scrollDiv.focus(),this._clientDiv.focus();var r=this._getDOMText(o).text,a=t.getLine(i),l=this._imeOffset-n,d=l+r.length-a.length;l!==d&&(e=r.substring(l,d))}this._imeOffset=-1,e&&(this._doContent(e)||s.isWebkit||(o.lineRemoved=!0,this._queueUpdate()))}},_createActions:function(){this.addKeyMode(new i.DefaultKeyMode(this));var t=this;this._actions={noop:{defaultHandler:function(){return t._doNoop()}},lineUp:{defaultHandler:function(e){return t._doLineUp(p(e,{select:!1}))},actionDescription:{name:e.lineUp}},lineDown:{defaultHandler:function(e){return t._doLineDown(p(e,{select:!1}))},actionDescription:{name:e.lineDown}},lineStart:{defaultHandler:function(e){return t._doHome(p(e,{select:!1,ctrl:!1}))},actionDescription:{name:e.lineStart}},lineEnd:{defaultHandler:function(e){return t._doEnd(p(e,{select:!1,ctrl:!1}))},actionDescription:{name:e.lineEnd}},charPrevious:{defaultHandler:function(e){return t._doCursorPrevious(p(e,{select:!1,unit:"character"}))},actionDescription:{name:e.charPrevious}},charNext:{defaultHandler:function(e){return t._doCursorNext(p(e,{select:!1,unit:"character"}))},actionDescription:{name:e.charNext}},pageUp:{defaultHandler:function(e){return t._doPageUp(p(e,{select:!1}))},actionDescription:{name:e.pageUp}},pageDown:{defaultHandler:function(e){return t._doPageDown(p(e,{select:!1}))},actionDescription:{name:e.pageDown}},scrollPageUp:{defaultHandler:function(e){return t._doScroll(p(e,{type:"pageUp"}))},actionDescription:{name:e.scrollPageUp}},scrollPageDown:{defaultHandler:function(e){return t._doScroll(p(e,{type:"pageDown"}))},actionDescription:{name:e.scrollPageDown}},scrollLineUp:{defaultHandler:function(e){return t._doScroll(p(e,{type:"lineUp"}))},actionDescription:{name:e.scrollLineUp}},scrollLineDown:{defaultHandler:function(e){return t._doScroll(p(e,{type:"lineDown"}))},actionDescription:{name:e.scrollLineDown}},wordPrevious:{defaultHandler:function(e){return t._doCursorPrevious(p(e,{select:!1,unit:"word"}))},actionDescription:{name:e.wordPrevious}},wordNext:{defaultHandler:function(e){return t._doCursorNext(p(e,{select:!1,unit:"word"}))},actionDescription:{name:e.wordNext}},textStart:{defaultHandler:function(e){return t._doHome(p(e,{select:!1,ctrl:!0}))},actionDescription:{name:e.textStart}},textEnd:{defaultHandler:function(e){return t._doEnd(p(e,{select:!1,ctrl:!0}))},actionDescription:{name:e.textEnd}},scrollTextStart:{defaultHandler:function(e){return t._doScroll(p(e,{type:"textStart"}))},actionDescription:{name:e.scrollTextStart}},scrollTextEnd:{defaultHandler:function(e){return t._doScroll(p(e,{type:"textEnd"}))},actionDescription:{name:e.scrollTextEnd}},centerLine:{defaultHandler:function(e){return t._doScroll(p(e,{type:"centerLine"}))},actionDescription:{name:e.centerLine}},selectLineUp:{defaultHandler:function(e){return t._doLineUp(p(e,{select:!0}))},actionDescription:{name:e.selectLineUp}},selectLineDown:{defaultHandler:function(e){return t._doLineDown(p(e,{select:!0}))},actionDescription:{name:e.selectLineDown}},selectWholeLineUp:{defaultHandler:function(e){return t._doLineUp(p(e,{select:!0,wholeLine:!0}))},actionDescription:{name:e.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(e){return t._doLineDown(p(e,{select:!0,wholeLine:!0}))},actionDescription:{name:e.selectWholeLineDown}},selectLineStart:{defaultHandler:function(e){return t._doHome(p(e,{select:!0,ctrl:!1}))},actionDescription:{name:e.selectLineStart}},selectLineEnd:{defaultHandler:function(e){return t._doEnd(p(e,{select:!0,ctrl:!1}))},actionDescription:{name:e.selectLineEnd}},selectCharPrevious:{defaultHandler:function(e){return t._doCursorPrevious(p(e,{select:!0,unit:"character"}))},actionDescription:{name:e.selectCharPrevious}},selectCharNext:{defaultHandler:function(e){return t._doCursorNext(p(e,{select:!0,unit:"character"}))},actionDescription:{name:e.selectCharNext}},selectPageUp:{defaultHandler:function(e){return t._doPageUp(p(e,{select:!0}))},actionDescription:{name:e.selectPageUp}},selectPageDown:{defaultHandler:function(e){return t._doPageDown(p(e,{select:!0}))},actionDescription:{name:e.selectPageDown}},selectWordPrevious:{defaultHandler:function(e){return t._doCursorPrevious(p(e,{select:!0,unit:"word"}))},actionDescription:{name:e.selectWordPrevious}},selectWordNext:{defaultHandler:function(e){return t._doCursorNext(p(e,{select:!0,unit:"word"}))},actionDescription:{name:e.selectWordNext}},selectTextStart:{defaultHandler:function(e){return t._doHome(p(e,{select:!0,ctrl:!0}))},actionDescription:{name:e.selectTextStart}},selectTextEnd:{defaultHandler:function(e){return t._doEnd(p(e,{select:!0,ctrl:!0}))},actionDescription:{name:e.selectTextEnd}},deletePrevious:{defaultHandler:function(e){return t._doBackspace(p(e,{unit:"character"}))},actionDescription:{name:e.deletePrevious}},deleteNext:{defaultHandler:function(e){return t._doDelete(p(e,{unit:"character"}))},actionDescription:{name:e.deleteNext}},deleteWordPrevious:{defaultHandler:function(e){return t._doBackspace(p(e,{unit:"word"}))},actionDescription:{name:e.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(e){return t._doDelete(p(e,{unit:"word"}))},actionDescription:{name:e.deleteWordNext}},deleteLineStart:{defaultHandler:function(e){return t._doBackspace(p(e,{unit:"line"}))},actionDescription:{name:e.deleteLineStart}},deleteLineEnd:{defaultHandler:function(e){return t._doDelete(p(e,{unit:"line"}))},actionDescription:{name:e.deleteLineEnd}},tab:{defaultHandler:function(e){return t._doTab(p(e,{}))},actionDescription:{name:e.tab}},shiftTab:{defaultHandler:function(e){return t._doShiftTab(p(e,{}))},actionDescription:{name:e.shiftTab}},enter:{defaultHandler:function(e){return t._doEnter(p(e,{}))},actionDescription:{name:e.enter}},enterNoCursor:{defaultHandler:function(e){return t._doEnter(p(e,{noCursor:!0}))},actionDescription:{name:e.enterNoCursor}},escape:{defaultHandler:function(e){return t._doEscape(p(e,{}))},actionDescription:{name:e.escape}},selectAll:{defaultHandler:function(e){return t._doSelectAll(p(e,{}))},actionDescription:{name:e.selectAll}},copy:{defaultHandler:function(e){return t._doCopy(p(e,{}))},actionDescription:{name:e.copy}},cut:{defaultHandler:function(e){return t._doCut(p(e,{}))},actionDescription:{name:e.cut}},paste:{defaultHandler:function(e){return t._doPaste(p(e,{}))},actionDescription:{name:e.paste}},uppercase:{defaultHandler:function(e){return t._doCase(p(e,{type:"upper"}))},actionDescription:{name:e.uppercase}},lowercase:{defaultHandler:function(e){return t._doCase(p(e,{type:"lower"}))},actionDescription:{name:e.lowercase}},capitalize:{defaultHandler:function(e){return t._doCase(p(e,{unit:"word",type:"capitalize"}))},actionDescription:{name:e.capitalize}},reversecase:{defaultHandler:function(e){return t._doCase(p(e,{type:"reverse"}))},actionDescription:{name:e.reversecase}},toggleOverwriteMode:{defaultHandler:function(e){return t._doOverwriteMode(p(e,{}))},actionDescription:{name:e.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(e){return t._doTabMode(p(e,{}))},actionDescription:{name:e.toggleTabMode}},toggleWrapMode:{defaultHandler:function(e){return t._doWrapMode(p(e,{}))},actionDescription:{name:e.toggleWrapMode}}}},_createRulerParent:function(e,t){var i=s.createElement(e,"div");return i.className=t,i.tabIndex=-1,i.style.overflow="hidden",i.style.MozUserSelect="none",i.style.WebkitUserSelect="none",i.style.position="absolute",i.style.top="0px",i.style.bottom="0px",i.style.cursor="default",i.style.display="none",i.setAttribute("aria-hidden","true"),this._rootDiv.appendChild(i),i},_createRuler:function(e,t){if(this._clientDiv){var i=this._getRulerParent(e);if(i){(i!==this._marginDiv||this._marginOffset)&&(i.style.display="block"),i.rulerWidth=void 0;var n=s.createElement(i.ownerDocument,"div");if(n._ruler=e,e.node=n,n.rulerChanged=!0,n.style.position="relative",n.style.cssFloat="left",n.style.styleFloat="left",n.style.outline="none",void 0===t||0>t||t>=i.children.length)i.appendChild(n);else{for(var o=i.firstChild;o&&t-->0;)o=o.nextSibling;i.insertBefore(n,o)}}}},_createSelectionDiv:function(){var e=s.createElement(this._parent.ownerDocument,"div");return e.className="textviewSelection",e.style.position="absolute",e.style.borderWidth="0px",e.style.margin="0px",e.style.padding="0px",e.style.outline="none",e.style.width="0px",e.style.height="0px",e.style.zIndex="0",e},_createView:function(){function e(){b._rootDiv&&(b.update(!0),b._metrics.invalid&&b._getWindow().setTimeout(function(){e()},100))}if(!this._clientDiv){for(var t=this._parent;t.hasChildNodes();)t.removeChild(t.lastChild);var i=t.ownerDocument,n=s.createElement(i,"div");this._rootDiv=n,n.tabIndex=-1,n.style.position="relative",n.style.overflow="hidden",n.style.width="100%",n.style.height="100%",n.style.overflow="hidden",n.style.WebkitTextSizeAdjust="100%",n.setAttribute("role","application"),t.appendChild(n);var o=this._createRulerParent(i,"textviewLeftRuler");this._leftDiv=o;var r=s.createElement(i,"div");r.className="textviewScroll",this._viewDiv=r,r.tabIndex=-1,r.style.position="absolute",r.style.top="0px",r.style.bottom="0px",r.style.borderWidth="0px",r.style.margin="0px",r.style.outline="none",r.style.background="transparent",n.appendChild(r);
+var l=this._createRulerParent(i,"textviewRightRuler");this._rightDiv=l,"rtl"==document.dir?l.style.left="0px":l.style.right="0px";var d=this._createRulerParent(i,"textviewInnerRightRuler");this._innerRightDiv=d,d.style.zIndex="1";var c=s.createElement(i,"div");this._scrollDiv=c,c.style.margin="0px",c.style.borderWidth="0px",c.style.padding="0px",r.appendChild(c);var h=this._marginDiv=this._createRulerParent(i,"textviewMarginRuler");if(h.style.zIndex="4",!s.isIE&&!s.isIOS){var u=s.createElement(i,"div");this._clipDiv=u,u.style.position="absolute",u.style.overflow="hidden",u.style.margin="0px",u.style.borderWidth="0px",u.style.padding="0px",u.style.background="transparent",n.appendChild(u);var p=s.createElement(i,"div");this._clipScrollDiv=p,p.style.position="absolute",p.style.height="1px",p.style.top="-1000px",p.style.background="transparent",u.appendChild(p)}var f=s.createElement(i,"div");if(f.className="textviewContent",this._clientDiv=f,f.tabIndex=0,f.style.position="absolute",f.style.borderWidth="0px",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="1",f.style.WebkitUserSelect="text",f.setAttribute("spellcheck","false"),(s.isIOS||s.isAndroid)&&(f.style.WebkitTapHighlightColor="transparent"),(this._clipDiv||n).appendChild(f),this._setFullSelection(this._fullSelection,!0),s.isIOS||s.isAndroid){var g=s.createElement(i,"div");this._vScrollDiv=g,g.style.position="absolute",g.style.borderWidth="1px",g.style.borderColor="white",g.style.borderStyle="solid",g.style.borderRadius="4px",g.style.backgroundColor="black",g.style.opacity="0.5",g.style.margin="0px",g.style.padding="0px",g.style.outline="none",g.style.zIndex="3",g.style.width="8px",g.style.display="none",n.appendChild(g);var _=s.createElement(i,"div");this._hScrollDiv=_,_.style.position="absolute",_.style.borderWidth="1px",_.style.borderColor="white",_.style.borderStyle="solid",_.style.borderRadius="4px",_.style.backgroundColor="black",_.style.opacity="0.5",_.style.margin="0px",_.style.padding="0px",_.style.outline="none",_.style.zIndex="3",_.style.height="8px",_.style.display="none",n.appendChild(_)}if(s.isFirefox&&!f.setCapture){var m=s.createElement(i,"div");this._overlayDiv=m,m.style.position=f.style.position,m.style.borderWidth=f.style.borderWidth,m.style.margin=f.style.margin,m.style.padding=f.style.padding,m.style.cursor="text",m.style.zIndex="2",(this._clipDiv||n).appendChild(m)}f.contentEditable="true",this._setWrapMode(this._wrapMode,!0),this._setReadOnly(this._readonly),this._setThemeClass(this._themeClass,!0),this._setTabSize(this._tabSize,!0),this._setMarginOffset(this._marginOffset,!0),this._hookEvents(),a.initInputField(f);for(var v=this._rulers,x=0;xthis._getLineHeight()){var i=t.getBoundingClientRect(),n=this._clientDiv.getBoundingClientRect();i.bottom>n.bottom&&(t=this._getLinePrevious(t)||t)}return t.lineIndex},_getBlockSelections:function(e,t,i){var n=this._model;e=e.filter(function(e){return!e._editing});var o,r=n.getLineAtOffset(this._blockSelection.getAnchor());t>r?o=t:(o=r,r=t);for(var s=r;o>=s;s++){var a=this._getLine(s),l=a.getOffset(i.x,1),d=a.getOffset(this._blockSelection._docX,1);if(a.destroy(),l!==d||l!==n.getLineEnd(s)){var c=d>l,h=new x(c?l:d,c?d:l,c);h._editing=!0,e.push(h)}}return e},_getBoundsAtOffset:function(e){var t=this._model,i=this._getLine(t.getLineAtOffset(e)),n=i.getBoundingClientRect(e),o=this._getLinePixel(i.lineIndex);return n.top+=o,n.bottom+=o,i.destroy(),n},_getClientHeight:function(){var e=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-e.top-e.bottom)},_getInnerRightWidth:function(){var e=this._innerRightDiv.rulerWidth;if(void 0===e){var t=this._innerRightDiv.getBoundingClientRect();this._innerRightDiv.rulerWidth=e=t.right-t.left}return e},_getClientWidth:function(){var e=this._getViewPadding(),t=this._getInnerRightWidth();return Math.max(0,this._viewDiv.clientWidth-e.left-e.right-t)},_getClipboardText:function(e,t){function i(e){var i=[];return g(e,function(e){i.push(e)},null),t&&t(i),i}var n=this._getWindow(),o=n.clipboardData;if(!o&&e&&(o=e.clipboardData),o)return i(o.getData(s.isIE?"Text":"text/plain"));if(s.isElectron&&!e)return i(window.__clipboardModule.readText());if(s.isFirefox){this._ignoreFocus=!0;var r=this._clipboardDiv,a=this._rootDiv.ownerDocument;r||(r=s.createElement(a,"div"),this._clipboardDiv=r,r.style.position="fixed",r.style.whiteSpace="pre",r.style.left="-1000px",this._rootDiv.appendChild(r)),r.innerHTML="",r.firstChild.focus();var l=this,d=function(){var e=l._getTextFromElement(r);return r.innerHTML="",i(e)},c=!1;if(this._ignorePaste=!0,!s.isLinux||2!==this._lastMouseButton)try{c=a.execCommand("paste",!1,null)}catch(h){c=r.childNodes.length>1||r.firstChild&&r.firstChild.childNodes.length>0}return this._ignorePaste=!1,c?(this.focus(),this._ignoreFocus=!1,d()):e?(n.setTimeout(function(){l.focus(),d(),l._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"")}return""},_getDOMText:function(e,t){return e._line.getText(t)},_getTextFromElement:function(e){var t=e.ownerDocument,i=t.defaultView;if(!i.getSelection)return e.innerText||e.textContent;var n=t.createRange();n.selectNode(e);var o,r=i.getSelection(),s=[];for(o=0;oi)for(t=i;e>t;t++)n+=this._getLineHeight(t);else for(t=i-1;t>=e;t--)n-=this._getLineHeight(t);return n}var o=this._getLineHeight();return o*e},_getLineIndex:function(e,t){var i,n=0,o=this._model.getLineCount();if(this._lineHeight){n=this._getTopIndex();var r=-this._topIndexY+this._getScroll().y;if(e!==r)if(r>e)for(;r>e&&n>0;)e+=this._getLineHeight(--n);else for(i=this._getLineHeight(n);e-i>=r&&o-1>n;)e-=i,i=this._getLineHeight(++n)}else i=this._getLineHeight(),n=Math.floor(e/i);return t&&(0===o||0>n||n>o-1)?-1:Math.max(0,Math.min(o-1,n))},_getRulerParent:function(e){switch(e.getLocation()){case"left":return this._leftDiv;case"right":return this._rightDiv;case"innerRight":return this._innerRightDiv;case"margin":return this._marginDiv}return null},_getScroll:function(e){(void 0===e||e)&&this._cancelAnimation();var t=this._viewDiv;return{x:t.scrollLeft,y:t.scrollTop}},_getSelection:function(){return(Array.isArray(this._selection)?this._selection[0]:this._selection).clone()},_getSelections:function(){return(Array.isArray(this._selection)?this._selection:[this._selection]).map(function(e){return e.clone()})},_getTopIndex:function(e){var t=this._topChild;if(e&&this._getClientHeight()>this._getLineHeight()){var i=t.getBoundingClientRect(),n=this._getViewPadding(),o=this._viewDiv.getBoundingClientRect();i.top26?"wheel":s.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(t){return e._handleMouseWheel(t?t:l.event)}}),this._clipDiv&&t.push({target:this._clipDiv,type:s.isFirefox>26?"wheel":s.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(t){return e._handleMouseWheel(t?t:l.event)}}),s.isFirefox&&(!s.isWindows||s.isFirefox>=15)){var u=l.MutationObserver||l.MozMutationObserver;u?(this._mutationObserver=new u(function(t){e._handleDataModified(t)}),this._mutationObserver.observe(i,{subtree:!0,characterData:!0})):t.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(t){return e._handleDataModified(t?t:l.event)}})}(s.isFirefox&&(!s.isWindows||s.isFirefox>=15)||s.isIE||s.isWebkit)&&(t.push({target:this._clientDiv,type:"compositionstart",handler:function(t){return e._handleCompositionStart(t?t:l.event)}}),t.push({target:this._clientDiv,type:"compositionend",handler:function(t){return e._handleCompositionEnd(t?t:l.event)}}),t.push({target:this._clientDiv,type:"compositionupdate",handler:function(t){return e._handleCompositionUpdate(t?t:l.event)}})),this._overlayDiv&&(t.push({target:this._overlayDiv,type:"mousedown",handler:function(t){return e._handleMouseDown(t?t:l.event)}}),t.push({target:this._overlayDiv,type:"mouseover",handler:function(t){return e._handleMouseOver(t?t:l.event)}}),t.push({target:this._overlayDiv,type:"mouseout",handler:function(t){return e._handleMouseOut(t?t:l.event)}}),t.push({target:this._overlayDiv,type:"contextmenu",handler:function(t){return e._handleContextMenu(t?t:l.event)}})),this._isW3CEvents||t.push({target:this._clientDiv,type:"dblclick",handler:function(t){return e._handleDblclick(t?t:l.event)}})}this._hookRulerEvents(this._leftDiv,t),this._hookRulerEvents(this._rightDiv,t),this._hookRulerEvents(this._innerRightDiv,t),this._hookRulerEvents(this._marginDiv,t);for(var p=0;p26?"wheel":s.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(e){return i._handleMouseWheel(e?e:n.event)}}),t.push({target:e,type:"click",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"dblclick",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"mousemove",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"mouseover",handler:function(e){i._handleRulerEvent(e?e:n.event)}}),t.push({target:e,type:"mouseout",handler:function(e){i._handleRulerEvent(e?e:n.event)}})}},_getWindow:function(){return d(this._parent.ownerDocument)},_ignoreEvent:function(e){for(var t=e.target;t&&t!==this._clientDiv;){if(t.ignore)return!0;t=t.parentNode}return!1},_init:function(e){var i=e.parent;if("string"==typeof i&&(i=(e.document||document).getElementById(i)),!i)throw new Error("no parent");e.parent=i,e.model=e.model||new t.TextModel;var n=this._defaultOptions();for(var o in n)if(n.hasOwnProperty(o)){var r;r=void 0!==e[o]?e[o]:n[o].value,this["_"+o]=r}this._keyModes=[],this._rulers=[],this._selection=[new x(0,0,!1)],this._linksVisible=!1,this._redrawCount=0,this._maxLineWidth=0,this._maxLineIndex=-1,this._ignoreSelect=!0,this._ignoreFocus=!1,this._hasFocus=!1,this._dragOffset=-1,this._isRangeRects=(!s.isIE||s.isIE>=9)&&"function"==typeof i.ownerDocument.createRange().getBoundingClientRect,this._isW3CEvents=i.addEventListener,this._autoScrollX=null,this._autoScrollY=null,this._autoScrollTimerID=null,this._AUTO_SCROLL_RATE=50,this._grabControl=null,this._moseMoveClosure=null,this._mouseUpClosure=null,this._lastMouseX=0,this._lastMouseY=0,this._lastMouseTime=0,this._clickCount=0,this._clickTime=250,this._clickDist=5,this._isMouseDown=!1,this._doubleClickSelection=null,this._hScroll=0,this._vScroll=0,this._imeOffset=-1,this._createActions(),this._createView()},_checkOverlayScroll:function(){if(s.isMac&&s.isWebkit&&!this._metrics.invalid&&0===this._metrics.scrollWidth){var e=this._viewDiv,t=this._isOverOverlayScroll();e.style.pointerEvents=t.vertical||t.horizontal?"":"none"}},_isOverOverlayScroll:function(){var e=(new Date).getTime()-this._lastScrollTime<200;if(!e)return{};var t=this._viewDiv.getBoundingClientRect(),i=this._lastMouseMoveX,n=this._lastMouseMoveY,o=15;return{vertical:t.top<=n&&n1&&this.setRedraw(!1);var s=this._compoundChange;s?x.compare(this._getSelections(),s.owner.selection)||(this._endUndo(),e.selection.length>1&&this._startUndo()):e.selection.length>1&&this._startUndo();var a=this._model;try{e._ignoreDOMSelection&&(this._ignoreDOMSelection=!0);var l=0,d=0;e.selection.forEach(function(i){i.start+=l,i.end+=l;var n=Array.isArray(e.text)?e.text[d]:e.text;a.setText(n,i.start,i.end),l+=i.start-i.end+n.length,i.setCaret(t?i.start+n.length:i.start),d++})}finally{e._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}return this._setSelection(e.selection,i,!0,n),s=this._compoundChange,s&&(s.owner.selection=e.selection),e.selection.length>1&&this.setRedraw(!0),this.onModify({type:"Modify"}),!0},_onModelChanged:function(e){e.type="ModelChanged",this.onModelChanged(e),e.type="Changed";var t=e.start,i=e.addedCharCount,n=e.removedCharCount,o=e.addedLineCount,r=e.removedLineCount,s=this._getSelections();s.forEach(function(e){e.end>t&&(e.end>t&&e.start=l&&l+r>=h&&(l!==h||d.modelChangedEvent||d.lineRemoved?(d.lineRemoved=!0,d.lineChanged=!1,d.modelChangedEvent=null):(d.modelChangedEvent=e,d.lineChanged=!0)),h>l+r&&(d.lineIndex=h+o-r,d._line.lineIndex=d.lineIndex),d=this._getLineNext(d)}if(this._lineHeight){var u=[l,r].concat(c(o));Array.prototype.splice.apply(this._lineHeight,u)}this._wrapMode||l<=this._maxLineIndex&&this._maxLineIndex<=l+r&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0),this._update()},_onModelChanging:function(e){e.type="ModelChanging",this.onModelChanging(e),e.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var e=this,t=this._getWindow();this._updateTimer=t.setTimeout(function(){e._updateTimer=null,e._update()},0)}},_rangesToSelections:function(e){var t=[],i=this._model.getCharCount();return e.forEach(function(e){var n;if(e instanceof x)n=e.clone();else{var o=e.start,r=e.end,s=o>r;if(s){var a=o;o=r,r=a}o=Math.max(0,Math.min(o,i)),r=Math.max(0,Math.min(r,i)),n=new x(o,r,s)}t.push(n)}),t},_resetLineHeight:function(e,t){if(this._wrapMode||this._variableLineHeight){if(void 0!==e&&void 0!==t)for(var i=e;t>i;i++)this._lineHeight[i]=void 0;else this._lineHeight=c(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var e=this._clientDiv;if(e)for(var t=e.firstChild;t;)t.lineWidth=void 0,t=t.nextSibling},_reset:function(){this._maxLineIndex=-1,this._maxLineWidth=0,this._topChild=null,this._bottomChild=null,this._topIndexY=0,this._variableLineHeight=!1,this._resetLineHeight(),this._setSelection(new x(0,0,!1),!1,!1),this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var e=this._clientDiv;if(e){for(var t=e.firstChild;t;)t.lineRemoved=!0,t=t.nextSibling;s.isFirefox<13&&this._fixCaret()}},_scrollViewAnimated:function(e,t,i){var n=this._getWindow();if(i&&this._scrollAnimation){var o=this;this._animation=new D({window:n,duration:this._scrollAnimation,curve:[t,0],onAnimate:function(e){var i=t-Math.floor(e);o._scrollView(0,i),t-=i},onEnd:function(){o._animation=null,o._scrollView(e,t),i&&n.setTimeout(i,0)}}),this._animation.play()}else this._scrollView(e,t),i&&n.setTimeout(i,0)},_scrollView:function(e,t){this._ensureCaretVisible=!1;var i=this._viewDiv;e&&(i.scrollLeft+=e),t&&(i.scrollTop+=t)},_setClipboardText:function(e,t){if(s.isElectron&&!t)return window.__clipboardModule.writeText(e),!0;var i,n=this._getWindow(),o=n.clipboardData;if(!o&&t&&(o=t.clipboardData),o){i=[],g(e,function(e){i.push(e)},function(){i.push(s.platformDelimiter)});var r=o.setData(s.isIE?"Text":"text/plain",i.join(""));if(r||t&&(s.isFirefox>21||s.isWebkit))return!0;if(!t)return!1}var a=this._parent.ownerDocument,l=s.createElement(a,"pre");l.style.position="fixed",l.style.left="-1000px",g(e,function(e){l.appendChild(a.createTextNode(e))},function(){l.appendChild(s.createElement(a,"br"))}),l.appendChild(a.createTextNode(" ")),this._clientDiv.appendChild(l);var d=a.createRange();d.setStart(l.firstChild,0),d.setEndBefore(l.lastChild);var c=n.getSelection();c.rangeCount>0&&c.removeAllRanges(),c.addRange(d);var h=this,u=function(){l&&l.parentNode===h._clientDiv&&h._clientDiv.removeChild(l),h._updateDOMSelection()},p=!1;this._ignoreCopy=!0;try{p=a.execCommand("copy",!1,null)}catch(f){}return this._ignoreCopy=!1,!p&&t?(n.setTimeout(u,0),!1):(u(),!0)},_setGrab:function(e){e!==this._grabControl&&(e?(e.setCapture&&e.setCapture(),this._grabControl=e):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null))},_setLinksVisible:function(e){if(this._linksVisible!==e){this._linksVisible=e,s.isIE&&e&&(this._hadFocus=this._hasFocus);var t=this._clientDiv;t.contentEditable=!e,this._hadFocus&&!e&&t.focus(),this._overlayDiv&&(this._overlayDiv.style.zIndex=e?"-1":"1");for(var i=this._getLineNext();i;)i._line.updateLinks(),i=this._getLineNext(i);this._updateDOMSelection()}},_setSelection:function(e,t,i,n,o,r,s){if(e){void 0===i&&(i=!0);var a,l=this._getSelections();if(a=Array.isArray(e)?e:r?l.concat([e]):[e],this._selection=x.merge(a),s||a.forEach(function(e){e._columnX=-1}),t!==!1&&this._showCaret(!1,n,t,o),i&&this._updateDOMSelection(),!x.compare(l,a)){var d={type:"Selection",oldValue:x.convert(l),newValue:x.convert(a)};this.onSelection(d)}}},_setSelectionTo:function(e,t,i,n,o,r){var s=this._model,a=this._getSelections(),l=this.convert({x:e,y:t},"page","document"),d=this._getLineIndex(l.y),c=this._getLine(d),h=c.getOffset(l.x,l.y-this._getLinePixel(d));if(r&&!n&&x.contains(a,h))return this._dragOffset=h,c.destroy(),!1;if(this._blockSelection)a=this._getBlockSelections(a,d,l);else{var u;if(i?n?(u=a[a.length-1],u._editing=!0):(u=new x(0,0),u._editing=!0,o?a.push(u):a=[u],u._docX=l.x):u=x.editing(a),1===this._clickCount)u.extend(h),n||u.collapse();else{var p,f,g=0===(1&this._clickCount);if(g)this._doubleClickSelection?h>=this._doubleClickSelection.start?(p=this._doubleClickSelection.start,f=c.getNextOffset(h,{unit:"wordend",count:1})):(p=c.getNextOffset(h,{unit:"word",count:-1}),f=this._doubleClickSelection.end):(p=c.getNextOffset(h,{unit:"word",count:-1}),f=c.getNextOffset(p,{unit:"wordend",count:1}));else if(this._doubleClickSelection){var _=s.getLineAtOffset(this._doubleClickSelection.start);d>=_?(p=s.getLineStart(_),f=s.getLineEnd(d)):(p=s.getLineStart(d),f=s.getLineEnd(_))}else p=s.getLineStart(d),f=s.getLineEnd(d);u.setCaret(p),u.extend(f)}}return this._setSelection(a,!0,!0,null,!1),c.destroy(),!0},_setFullSelection:function(e,t){this._fullSelection=e,s.isWebkit<537.36&&(this._fullSelection=e=!0),this._domSelection||(this._domSelection=[],this._cursorVisible=!0),t||this._updateDOMSelection()},_setBlockCursor:function(e){this._blockCursorVisible=e,this._updateBlockCursorVisible()},_setOverwriteMode:function(e){this._overwriteMode=e,this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var e=this._viewDiv,t=s.createElement(e.ownerDocument,"div");t.className="textviewBlockCursor",this._cursorDiv=t,t.tabIndex=-1,t.style.zIndex="2",t.style.color="transparent",t.style.position="absolute",t.style.pointerEvents="none",t.innerHTML=" ",e.appendChild(t),this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(e,t){this._marginOffset=e,this._marginDiv.style.display=e?"block":"none",t||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(e,t){this._wrapOffset=e,t||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(e){this._readonly=e},_setSingleMode:function(e,t){this._singleMode=e,this._updateOverflow(),this._updateStyle(t)},_setNoScroll:function(e,t){this._noScroll=e,this._updateOverflow(),this._updateStyle(t)},_setTabSize:function(e,t){this._tabSize=e,this._customTabSize=void 0;var i=this._clientDiv;s.isOpera?i&&(i.style.OTabSize=this._tabSize+""):s.isWebkit>=537.1?i&&(i.style.tabSize=this._tabSize+""):s.isFirefox>=4?i&&(i.style.MozTabSize=this._tabSize+""):8!==this._tabSize&&(this._customTabSize=this._tabSize),t||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(e){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged),this._theme=e,this._theme&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged),this._setThemeClass(this._themeClass)},_setThemeClass:function(e,t){this._themeClass=e;var i="textview",n=this._theme.getThemeClass();n&&(i+=" "+n),this._themeClass&&n!==this._themeClass&&(i+=" "+this._themeClass),this._rootDiv.className=i,this._updateStyle(t)},_setUndoStack:function(e){this._undoStack=e},_setWrapMode:function(e,t){this._wrapMode=e&&this._wrappable;var i=this._clientDiv;this._wrapMode?(i.style.whiteSpace="pre-wrap",i.style.wordWrap="break-word"):(i.style.whiteSpace="pre",i.style.wordWrap="normal"),this._updateOverflow(),t||(this.redraw(),this._resetLineWidth()),this._resetLineHeight()},_showCaret:function(e,t,i,n){if(this._clientDiv&&!(this._redrawCount>0||this._ignoreDOMSelection||-1!==this._imeOffset)){var o=this._model,r=this._getSelections(),s=x.editing(r,"down"===this._autoScrollDir),a=this._getScroll(),l=s.getCaret(),d=s.start,c=s.end,h=o.getLineAtOffset(d),u=o.getLineAtOffset(c),p=Math.max(Math.max(d,o.getLineStart(u)),c-1),f=this._getClientWidth(),g=this._getClientHeight(),_=f/4,m=this._getBoundsAtOffset(l===d?d:p),v=m.left,y=m.right,b=m.top,w=m.bottom,C=0,T="object"==typeof i;!e&&!T||s.isEmpty()||(m=this._getBoundsAtOffset(l===c?d:p),C=(m.bottom>w?m.bottom:w)-(m.topa.x+f&&(L=Math.max(y-a.x-f,_));var k=0;ba.y+g&&(k=w-a.y-g),n&&(n>0?k>0&&(k=Math.max(k,n)):0>k&&(k=Math.min(k,n)));var D=T&&"always"===i.scrollPolicy;if(0!==L||0!==k||D){if(T){var A=k>0;0===k&&(k=b-a.y);var S=i.viewAnchor,E=i.selectionAnchor,O=Math.min(Math.max(0,i.viewAnchorOffset||0));k+=Math.floor("top"===S?A?(1-O)*g:-O*g:"bottom"===S?A?O*g:-(1-O)*g:"center"===S?A?g/2+O*g:g/2-(1-O)*g:A?O*g:-O*g),h!==u&&("top"===E&&l!==d?k+=Math.floor(-C):"bottom"===E&&l!==c?k+=Math.floor(C):"center"===E&&(k+=Math.floor(C/2)))}else 0!==k&&"number"==typeof i&&(0>i&&(i=0),i>1&&(i=1),k+=Math.floor(k>0?i*g:-i*g));return this._scrollViewAnimated(L,k,t),g!==this._getClientHeight()||f!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0}return t&&t(),!1}},_startIME:function(){if(-1===this._imeOffset){for(var e=!1,t=this._getSelections(),i=0;i0)&&!this._ignoreDOMSelection&&-1===this._imeOffset&&this._clientDiv){var e,t=this._getSelections(),i=this._domSelection;if(i.lengtht.length&&i.splice(t.length).forEach(function(e){e.destroy()});for(e=0;e1?this._cursorTimer||(this._cursorTimer=n.setInterval(function(){o._cursorVisible=!o._cursorVisible,o._domSelection.forEach(function(e){e.update()})},500)):this._cursorTimer&&(n.clearInterval(this._cursorTimer),this._cursorTimer=null)}},_update:function(e){if(!(this._redrawCount>0)){if(this._updateTimer){var t=this._getWindow();t.clearTimeout(this._updateTimer),this._updateTimer=null,e=!1}var i=this._clientDiv,n=this._viewDiv;if(i){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);
+var o=this._model,r=this._getScroll(!1),a=this._getViewPadding(),l=o.getLineCount(),d=this._getLineHeight(),c=!1,h=!1,u=!1,p=this._metrics.scrollWidth;this._wrapMode&&(i.style.width=(this._metrics.wrapWidth||this._getClientWidth())+"px");var f,g,_,m,v,y,x,b,w,T,L,k=0,D=0;if(this._lineHeight){for(;l>D&&(L=this._getLineHeight(D),!(k+L>r.y));)k+=L,D++;f=D,g=Math.max(0,f-1),m=_=r.y-k,f>0&&(_+=this._getLineHeight(f-1))}else{var A=Math.max(0,r.y)/d;f=Math.floor(A),g=Math.max(0,f-1),_=Math.round((A-g)*d),m=Math.round((A-f)*d),T=l*d}this._topIndexY=m;var S=this._rootDiv,E=S.clientWidth,O=S.clientHeight;if(e){for(v=0,this._leftDiv&&(y=this._leftDiv.getBoundingClientRect(),v=y.right-y.left),x=this._getClientWidth(),b=this._getClientHeight(),w=x,this._wrapMode?this._metrics.wrapWidth&&(w=this._metrics.wrapWidth):w=Math.max(this._maxLineWidth,w);l>D;)L=this._getLineHeight(D,!1),k+=L,D++;T=k}else{b=this._getClientHeight();for(var N,M,I=Math.floor((b+m)/d),B=Math.min(f+I,l-1),R=Math.min(B+1,l-1),F=i.firstChild;F;){N=F.lineIndex;var P=F.nextSibling;N>=g&&R>=N&&!F.lineRemoved&&-1!==F.lineIndex||(this._mouseWheelLine===F?(F.style.display="none",F.lineIndex=-1):i.removeChild(F)),F=P}F=this._getLineNext();var W=n.ownerDocument,V=W.createDocumentFragment();for(N=g;R>=N;N++)!F||F.lineIndex>N?new C(this,N).create(V,null):(V.firstChild&&(i.insertBefore(V,F),V=W.createDocumentFragment()),F&&F.lineChanged&&(F=new C(this,N).create(V,F),F.lineChanged=!1),F=this._getLineNext(F));V.firstChild&&i.insertBefore(V,F),s.isWebkit&&!this._wrapMode&&(i.style.width="0x7fffffffpx");var j;F=this._getLineNext();for(var U=b+_,H=!1;F;){if(M=F.lineWidth,void 0===M){j=F._line.getBoundingClientRect(),M=F.lineWidth=Math.ceil(j.right-j.left);var K=j.bottom-j.top;this._lineHeight?this._lineHeight[F.lineIndex]=K:0!==d&&0!==K&&Math.ceil(d)!==Math.ceil(K)&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[F.lineIndex]=K)}this._lineHeight&&!H&&(U-=this._lineHeight[F.lineIndex],0>U&&(B=F.lineIndex,H=!0)),this._wrapMode||(M>=this._maxLineWidth&&(this._maxLineWidth=M,this._maxLineIndex=F.lineIndex),this._checkMaxLineIndex===F.lineIndex&&(this._checkMaxLineIndex=-1)),F.lineIndex===f&&(this._topChild=F),F.lineIndex===B&&(this._bottomChild=F),F=this._getLineNext(F)}if(-1!==this._checkMaxLineIndex&&(N=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,N>=0&&l>N)){var $=new C(this,N);j=$.getBoundingClientRect(),M=j.right-j.left,M>=this._maxLineWidth&&(this._maxLineWidth=M,this._maxLineIndex=N),$.destroy()}for(;l>D;)L=this._getLineHeight(D,B>=D),k+=L,D++;T=k,this._updateRuler(this._leftDiv,f,R,O),this._updateRuler(this._rightDiv,f,R,O),this._updateRuler(this._innerRightDiv,f,R,O),this._updateRuler(this._marginDiv,f,R,O),v=0,this._leftDiv&&(y=this._leftDiv.getBoundingClientRect(),v=y.right-y.left);var G=0;if(this._rightDiv){var z=this._rightDiv.getBoundingClientRect();G=z.right-z.left}n.style.left=v+"px",n.style.right=G+"px";var Y=this._scrollDiv;if(Y.style.height=T+(s.isWebkit?0:a.bottom)+"px",x=this._getClientWidth(),!this._singleMode&&!this._wrapMode&&!this._noScroll){var q=b,X=b,Q="scroll"===n.style.overflowX;Q?q+=p:X-=p;var J=x,Z=x,et="scroll"===n.style.overflowY;et?J+=p:Z-=p,b=q,x=J,T>b&&(u=!0,x=Z),this._maxLineWidth>x&&(h=!0,b=X,T>b&&(u=!0,x=Z)),Q!==h&&(n.style.overflowX=h?"scroll":"hidden"),et!==u&&(n.style.overflowY=u?"scroll":"hidden"),c=Q!==h||et!==u}var tt=x;this._wrapMode?this._metrics.wrapWidth&&(tt=this._metrics.wrapWidth):tt=Math.max(this._maxLineWidth+this._getInnerRightWidth(),tt),w=tt,(!s.isIE||s.isIE>=9)&&this._maxLineWidth>x&&(tt+=a.right+a.left),Y.style.width=tt+"px",this._clipScrollDiv&&(this._clipScrollDiv.style.width=tt+"px"),r=this._getScroll(!1);var it=this._innerRightDiv;it&&(it.style.right=G+("scroll"===n.style.overflowY?this._metrics.scrollWidth:0)+"px",it.style.bottom=("scroll"===n.style.overflowX?p:0)+"px")}if(this._scrollHeight=T,this._vScrollDiv){var nt=b-8,ot=Math.max(15,Math.ceil(Math.min(1,nt/(T+a.top+a.bottom))*nt));this._vScrollDiv.style.left=v+x-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,r.y*nt/T))+"px",this._vScrollDiv.style.height=ot+"px"}if(!this._wrapMode&&this._hScrollDiv){var rt=x-8,st=Math.max(15,Math.ceil(Math.min(1,rt/(this._maxLineWidth+a.left+a.right))*rt));this._hScrollDiv.style.left=v+Math.floor(Math.max(0,Math.floor(r.x*rt/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=b-9+"px",this._hScrollDiv.style.width=st+"px"}var at,lt,dt=r.x,ct=this._clipDiv,ht=this._overlayDiv,ut=this._marginDiv;if(ut&&(ut.style.left=-dt+v+this._metrics.marginWidth+a.left+"px",ut.style.bottom=("scroll"===n.style.overflowX?p:0)+"px"),ct){ct.scrollLeft=dt,ct.scrollTop=0,at=v+a.left,lt=a.top;var pt=x,ft=b,gt=0,_t=-_;0===r.x&&(at-=a.left,pt+=a.left,gt=a.left),r.x+x===w&&(pt+=a.right),0===r.y&&(lt-=a.top,ft+=a.top,_t+=a.top),r.y+b===T&&(ft+=a.bottom),ct.style.left=at+"px",ct.style.top=lt+"px",ct.style.right=E-pt-at+"px",ct.style.bottom=O-ft-lt+"px",i.style.left=gt+"px",i.style.top=_t+"px",i.style.width=w+"px",i.style.height=b+_+"px",ht&&(ht.style.left=i.style.left,ht.style.top=i.style.top,ht.style.width=i.style.width,ht.style.height=i.style.height)}else{at=dt,lt=_;var mt=dt+x,vt=_+b;0===at&&(at-=a.left),0===lt&&(lt-=a.top),mt===w&&(mt+=a.right),r.y+b===T&&(vt+=a.bottom),i.style.clip="rect("+lt+"px,"+mt+"px,"+vt+"px,"+at+"px)","rtl"==document.dir?i.style.right=-dt+v+a.left+"px":i.style.left=-dt+v+a.left+"px",i.style.width=(this._wrapMode||s.isWebkit?w:x+dt)+"px",e||(i.style.top=-_+a.top+"px",i.style.height=b+_+"px"),ht&&(ht.style.clip=i.style.clip,ht.style.left=i.style.left,ht.style.width=i.style.width,e||(ht.style.top=i.style.top,ht.style.height=i.style.height))}if(this._updateDOMSelection(),c){var yt=this._ensureCaretVisible;this._ensureCaretVisible=!1,yt&&this._showCaret(),this._queueUpdate()}}}},_updateOverflow:function(){var e=this._viewDiv;this._noScroll?e.style.overflow="hidden":this._wrapMode?(e.style.overflowX="hidden",e.style.overflowY="scroll"):e.style.overflow="hidden"},_updateRuler:function(e,t,i,n){if(e)for(var o=this._parent.ownerDocument,r=this._getLineHeight(),a=this._getViewPadding(),l=e.firstChild;l;){var d=l._ruler,c=d.getOverview();if(l.rulerChanged&&(h(d.getRulerStyle(),l),e.rulerWidth=void 0),"fixed"!==c){var u=r;"page"===c&&(u+=this._topIndexY),l.style.top=-u+"px",l.style.height=n+u+"px";var p,f=l.firstChild;f?(p=f,f=f.nextSibling):(p=s.createElement(o,"div"),p.style.visibility="hidden",l.appendChild(p));var g,_;l.rulerChanged&&p&&(g=-1,_=d.getWidestAnnotation(),_&&(h(_.style,p),_.html&&(p.innerHTML=_.html)),p.lineIndex=g,p.style.height=r+a.top+"px");var m,v,y;if("page"===c){for(y=d.getAnnotations(t,i+1);f;){g=f.lineIndex;var x=f.nextSibling;g>=t&&i>=g&&!f.lineChanged||l.removeChild(f),f=x}for(f=l.firstChild.nextSibling,v=o.createDocumentFragment(),g=t;i>=g;g++)!f||f.lineIndex>g?(m=s.createElement(o,"div"),_=y[g],_&&(h(_.style,m),_.html&&(m.innerHTML=_.html),m.annotation=_),m.lineIndex=g,m.style.height=this._getLineHeight(g)+"px",v.appendChild(m)):(v.firstChild&&(l.insertBefore(v,f),v=o.createDocumentFragment()),f&&(f=f.nextSibling));v.firstChild&&l.insertBefore(v,f)}else{var b,w,C=this._getClientHeight(),T=this._model.getLineCount(),L=r*T,k=C+a.top+a.bottom-2*this._metrics.scrollWidth;if(k>L?(b=r,w=a.top):(b=k/T,w=this._metrics.scrollWidth),l.rulerChanged){for(var D=l.childNodes.length;D>1;)l.removeChild(l.lastChild),D--;y=d.getAnnotations(0,T),v=o.createDocumentFragment();for(var A in y)g=A>>>0,0>g||(m=s.createElement(o,"div"),_=y[A],h(_.style,m),m.style.position="absolute",m.style.top=w+r+Math.floor(g*b)+"px",_.html&&(m.innerHTML=_.html),m.annotation=_,m.lineIndex=g,v.appendChild(m));l.appendChild(v)}else if(l._oldTrackHeight!==k)for(m=l.firstChild?l.firstChild.nextSibling:null;m;)m.style.top=this._metrics.scrollWidth+r+Math.floor(m.lineIndex*b)+"px",m=m.nextSibling;l._oldTrackHeight=k}l.rulerChanged=!1,l=l.nextSibling}else l.rulerChanged=!1,l=l.nextSibling}},_updateStyleSheet:function(){var e="";if(s.isWebkit&&this._metrics.scrollWidth>0&&(e+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}"),e){var t=this._clientDiv.ownerDocument,i=t.getElementById("_textviewStyle");if(i)i.removeChild(i.firstChild),i.appendChild(t.createTextNode(e));else{i=s.createElement(t,"style"),i.id="_textviewStyle";var n=t.getElementsByTagName("head")[0]||t.documentElement;i.appendChild(t.createTextNode(e)),n.insertBefore(i,n.firstChild)}}},_updateStyle:function(e,t){if(!e&&s.isIE&&(this._rootDiv.style.lineHeight="normal"),t=this._metrics=t||this._calculateMetrics(),this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._rootDiv.style.lineHeight=s.isIE?t.lineHeight-(t.lineTrim.top+t.lineTrim.bottom)+"px":"normal",this._updateStyleSheet(),s.isMac&&s.isWebkit){var i=this._viewDiv;t.invalid||0!==t.scrollWidth?(i.style.pointerEvents="",i.style.zIndex=""):(i.style.pointerEvents="none",i.style.zIndex="2")}e||(this.redraw(),this._resetLineWidth())}},n.EventTarget.addMixin(T.prototype),{TextView:T}}),define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(e,t){function i(e){this._model=e,this._projections=[];var t=this;this._listener={onChanged:function(e){t._onChanged(e)},onChanging:function(e){t._onChanging(e)}},e.addEventListener("postChanged",this._listener.onChanged),e.addEventListener("preChanging",this._listener.onChanging)}return i.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(t){if(t){var i=this._model,n=this._projections;t._lineIndex=i.getLineAtOffset(t.start),t._lineCount=i.getLineAtOffset(t.end)-t._lineIndex;var o=t.text;o||(o=""),t._model="string"==typeof o?new e.TextModel(o,i.getLineDelimiter()):o;var r=this.mapOffset(t.start,!0),s=t.end-t.start,a=t._lineCount,l=t._model.getCharCount(),d=t._model.getLineCount()-1,c={type:"Changing",text:t._model.getText(),start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};this.onChanging(c);var h=this._binarySearch(n,t.start);n.splice(h,0,t);var u={type:"Changed",start:r,removedCharCount:s,addedCharCount:l,removedLineCount:a,addedLineCount:d};this.onChanged(u)}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(e,t){var i,n,o=this._projections,r=0;if(t){for(i=0;ie));i++){if(n.end>e)return-1;r+=n._model.getCharCount()-(n.end-n.start)}return e+r}for(i=0;ie-r));i++){var s=n._model.getCharCount();if(n.start+s>e-r)return-1;r+=s-(n.end-n.start)}return e-r},removeProjection:function(e){this._removeProjection(e)},_removeProjection:function(e,t){var i,n=0;for(i=0;i1;)i=Math.floor((n+o)/2),t<=e[i].start?n=i:o=i;return n},getCharCount:function(){for(var e=this._model.getCharCount(),t=this._projections,i=0;ie)return null;var i,n,o,r=this._model,s=this._projections,a=0,l=[],d=0;for(i=0;i=e-a));i++){if(n=o._model.getLineCount()-1,o._lineIndex+n>=e-a){var c=e-(o._lineIndex+a);if(n>c)return o._model.getLine(c,t);l.push(o._model.getLine(n))}d=o.end,a+=n-o._lineCount}for(d=Math.max(d,r.getLineStart(e-a));ie-a));i++){if(l.push(r.getText(d,o.start)),n=o._model.getLineCount()-1,o._lineIndex+n>e-a)return l.push(o._model.getLine(0,t)),l.join("");l.push(o._model.getText()),d=o.end,a+=n-o._lineCount}var h=r.getLineEnd(e-a,t);return h>d&&l.push(r.getText(d,h)),l.join("")},getLineAtOffset:function(e){for(var t=this._model,i=this._projections,n=0,o=0,r=0;re-n)break;var a=s._model.getCharCount();if(s.start+a>e-n){var l=e-(s.start+n);o+=s._model.getLineAtOffset(l),n+=l;break}o+=s._model.getLineCount()-1-s._lineCount,n+=a-(s.end-s.start)}return t.getLineAtOffset(e-n)+o},getLineCount:function(){for(var e=this._model,t=this._projections,i=e.getLineCount(),n=0;ne)return-1;for(var i=this._model,n=this._projections,o=0,r=0,s=0;se-o)break;var l=a._model.getLineCount()-1;if(a._lineIndex+l>e-o){var d=e-(a._lineIndex+o);return a._model.getLineEnd(d,t)+a.start+r}r+=a._model.getCharCount()-(a.end-a.start),o+=l-a._lineCount}return i.getLineEnd(e-o,t)+r},getLineStart:function(e){if(0>e)return-1;for(var t=this._model,i=this._projections,n=0,o=0,r=0;r=e-n)break;var a=s._model.getLineCount()-1;if(s._lineIndex+a>=e-n){var l=e-(s._lineIndex+n);return s._model.getLineStart(l)+s.start+o}o+=s._model.getCharCount()-(s.end-s.start),n+=a-s._lineCount}return t.getLineStart(e-n)+o},getText:function(e,t){void 0===e&&(e=0);var i,n,o,r=this._model,s=this._projections,a=0,l=[];for(i=0;ie-a));i++){if(o=n._model.getCharCount(),n.start+o>e-a){if(void 0!==t&&n.start+o>t-a)return n._model.getText(e-(n.start+a),t-(n.start+a));l.push(n._model.getText(e-(n.start+a))),e=n.end+a+o-(n.end-n.start)}a+=o-(n.end-n.start)}var d=e-a;if(void 0!==t){for(;it-a));i++){if(l.push(r.getText(d,n.start)),o=n._model.getCharCount(),n.start+o>t-a)return l.push(n._model.getText(0,t-(n.start+a))),l.join("");l.push(n._model.getText()),d=n.end,a+=o-(n.end-n.start)}l.push(r.getText(d,t-a))}else{for(;in));e++);var s=e;for(e=0;e=o));e++);var a=e,l=this._model,d=i.baseText.length-(o-n);for(e=a;ee));a++){if(l.end>e)return-1;s+=l._model.getCharCount()-(l.end-l.start)}return e+s}var i=!!this._change,n=this._change||{},o=e.start,r=o+e.removedCharCount;if(n.baseStart=o,n.baseEnd=r,n.baseText=e.text,n.addedLineCount=e.addedLineCount,!i){this._change=n,n.text=e.text;var s,a,l,d=this._projections;n.start=t(o),-1===n.start&&(n.text=this._model.getText(l.start,o)+n.text,n.addedLineCount+=this._model.getLineAtOffset(o)-this._model.getLineAtOffset(l.start),n.start=l.start+s),n.end=t(r),-1===n.end&&(n.text+=this._model.getText(r,l.end),n.addedLineCount+=this._model.getLineAtOffset(l.end)-this._model.getLineAtOffset(r),n.end=l.start+s)}n.addedCharCount=n.text.length,n.removedCharCount=n.end-n.start,n.removedLineCount=this.getLineAtOffset(n.end)-this.getLineAtOffset(n.start);var c={type:"Changing",text:n.text,start:n.start,removedCharCount:n.removedCharCount,addedCharCount:n.addedCharCount,removedLineCount:n.removedLineCount,addedLineCount:n.addedLineCount};this.onChanging(c)},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},setLineDelimiter:function(e){this._model.setLineDelimiter(e)},setText:function(e,t,i){function n(e){for(r=0,o=0;re-o));r++){var t=s._model.getCharCount();if(s.start+t>e-o)return-1;o+=t-(s.end-s.start)}return e-o}this._change={text:e||"",start:t||0,end:void 0===i?this.getCharCount():i};var o,r,s,a,l,d=this._projections,c=n(this._change.start);-1===c&&(a={projection:s,start:this._change.start-(s.start+o)},c=s.end);var h=n(this._change.end);-1===h&&(l={projection:s,end:this._change.end-(s.start+o)},h=s.start),a&&l&&a.projection===l.projection?s._model.setText(this._change.text,a.start,l.end):(this._model.setText(this._change.text,c,h),a&&(s=a.projection,s._model.setText("",a.start)),l&&(s=l.projection,s._model.setText("",0,l.end),s.start=s.end,s._lineCount=0)),this._change=void 0}},t.EventTarget.addMixin(i.prototype),{ProjectionTextModel:i}}),define("orion/editor/tooltip",["i18n!orion/editor/nls/messages","orion/editor/textView","orion/editor/projectionTextModel","orion/Deferred","orion/editor/util","orion/webui/littlelib","orion/util"],function(e,t,i,n,o,r,s){function a(e,t){this._view=e,this._editor=t;var i=e.getOptions("parent");this._create(i?i.ownerDocument:document)}return a.getTooltip=function(e,t){return e._tooltip||(e._tooltip=new a(e,t)),e._tooltip},a.prototype={_create:function(e){if(!this._tooltipDiv){var t=this._tooltipDiv=s.createElement(e,"div");t.tabIndex=0,t.className="textviewTooltip",t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true"),this._tooltipDiv.style.visibility="hidden",this._tipShowing=!1,e.body.appendChild(t);var i=this;o.addEventListener(e,"mousedown",this._mouseDownHandler=function(e){i.isVisible()&&(o.contains(t,e.target||e.srcElement)||i._locked||i.hide())},!0),o.addEventListener(e,"scroll",this._scrollHandler=function(e){i.isVisible()&&(o.contains(t,e.target||e.srcElement)||(i._topPixel!==i._view.getTopPixel()||i._leftPixel!==i._view.getHorizontalPixel())&&i.hide())},!0),o.addEventListener(e,"mousemove",this._mouseMoveHandler=function(e){i._prevX&&i._prevX===e.clientX&&i._prevY&&i._prevY===e.clientY||(i._prevX=e.clientX,i._prevY=e.clientY,!i.isVisible()||i._locked||i._hasFocus()||i._isInRect(i._outerArea,e.clientX,e.clientY)||i.hide())},!0),o.addEventListener(t,"focus",function(){i._locked||i._tooltipDiv.classList.add("textViewTooltipOnFocus")},!1),o.addEventListener(t,"blur",function(){i._tooltipDiv.classList.remove("textViewTooltipOnFocus")},!1),o.addEventListener(t,"mouseenter",function(){i._locked||i._tooltipDiv.classList.add("textViewTooltipOnHover")},!1),o.addEventListener(t,"mouseleave",function(){i._hasFocus()||i._tooltipDiv.classList.remove("textViewTooltipOnHover")},!1),o.addEventListener(t,"keydown",function(e){27===e.keyCode&&(i._locked||i.hide())},!1),this._view.addEventListener("Destroy",function(){i.destroy()})}},destroy:function(){if(this._tooltipDiv){this.hide();var e=this._tooltipDiv.parentNode;e&&e.removeChild(this._tooltipDiv);var t=this._tooltipDiv.ownerDocument;o.removeEventListener(t,"mousedown",this._mouseDownHandler,!0),o.removeEventListener(t,"scroll",this._scrollHandler,!0),o.removeEventListener(t,"mousemove",this._mouseMoveHandler,!0),this._tooltipDiv=null}},show:function(e,t,i){this._locked=t,this._giveFocus=i,this._topPixel=this._view.getTopPixel(),this._leftPixel=this._view.getHorizontalPixel(),this._processInfo(e.getTooltipInfo())},update:function(e,t){e&&(t?this._showContents(null,e.getTooltipInfo(),!0):this._processInfo(e.getTooltipInfo(),!0))},onHover:function(e,t,i){e&&(this._isInRect(this._anchorArea,t,i)||this._isInRect(this._tooltipArea,t,i)||this._locked||this._hasFocus()||this._processInfo(e.getTooltipInfo()))},hide:function(e){e&&(this._locked=void 0),!this._locked&&this.isVisible()&&(this.hover&&this.hover.clearQuickFixes(),this._hasFocus()&&this._view.focus(),this._tooltipContents&&(this._tooltipDiv.removeChild(this._tooltipContents),this._tooltipContents=null),this._tooltipDiv.classList.remove("textviewTooltipCodeProjection"),this._tooltipDiv.classList.remove("textviewTooltipOnHover"),this._tooltipDiv.classList.remove("textviewTooltipOnFocus"),this._tooltipDiv.style.visibility="hidden",this._tipShowing=!1,this._tooltipDiv.style.left="",this._tooltipDiv.style.right="",this._tooltipDiv.style.top="",this._tooltipDiv.style.bottom="",this._tooltipDiv.style.width="auto",this._tooltipDiv.style.maxWidth="",this._tooltipDiv.style.height="auto",this._tooltipDiv.style.maxHeight="",this._tooltipDiv.style.overflowX="",this._tooltipDiv.style.overflowY="",this._giveFocus=void 0,this._anchorArea=void 0,this._tooltipArea=void 0,this._outerArea=void 0,this._hoverPromises&&this._hoverPromises.forEach(function(e){e.resolved||e.cancel()}),this._hoverPromises=void 0,this._tipRect=void 0)},isVisible:function(){return this._tipShowing},_processInfo:function(e,t){if(this._tooltipDiv){var i;if(t&&this._tooltipContents?(this._tooltipContents.innerHTML="",i=this._tooltipContents):i=s.createElement(this._tooltipDiv.ownerDocument,"div"),e){if(e.contents&&this._renderImmediateInfo(i,e.contents,e.context))return this._showContents(i,e,t),!0;if(this.hover&&e.context&&(this._hoverPromises=this.hover.computeHoverInfo(e.context),this._hoverPromises)){var o=this,r=this._hoverPromises.slice(0);return r.forEach(function(r){n.when(r,function(n){if(o._hoverPromises){var s=o._hoverPromises.indexOf(r);s>=0&&o._hoverPromises.splice(s,1)}n&&o._renderPluginContent(i,n)&&(n.offsetStart&&(e.context.offsetStart=n.offsetStart),n.offsetEnd&&(e.context.offsetEnd=n.offsetEnd),n.allowFullWidth&&(e.allowFullWidth=n.allowFullWidth),o._showContents(i,e,t))},function(e){console&&e&&"Cancel"!==e.name&&(console.log("Error computing hover tooltip"),console.log(e&&e.stack))})}),!0}}}},_showContents:function(e,t,i){i?this._tooltipArea&&t.tooltipArea&&(this._tooltipArea.left!==t.tooltipArea.left||this._tooltipArea.top!==t.tooltipArea.top||this._tooltipArea.width!==t.tooltipArea.width||this._tooltipArea.height!==t.tooltipArea.height)&&(this._anchorArea=null,this._tooltipArea=null,this._outerArea=null):this.hide(),e&&(this._tooltipContents&&this._tooltipDiv.removeChild(this._tooltipContents),this._tooltipContents=e,this._tooltipDiv.appendChild(e)),this._anchorArea||(this._anchorArea=this._computeAnchorArea(t)),this._tooltipArea||(this._tooltipArea=this._computeTooltipArea(t,this._anchorArea,this._tooltipDiv)),this._outerArea||(this._outerArea=this._computeOuterArea(this._anchorArea,this._tooltipArea)),this._tooltipDiv.style.visibility="visible",this._tipShowing=!0,this._giveFocus&&(this._setInitialFocus(this._tooltipDiv),this._giveFocus=void 0)},_computeAnchorArea:function(e){if(e.anchorArea&&e.anchorArea.top&&e.anchorArea.left&&e.anchorArea.height&&e.anchorArea.width)return e.anchorArea;if(e.context){if(e.context.offsetStart&&e.context.offsetEnd){var t=this.mapOffset(e.context.offsetStart,!1),i=this.mapOffset(e.context.offsetEnd,!1);return this._computeRectangleFromOffset(t,i)}if(e.context.offset>=0){var n=this.mapOffset(e.context.offset,!1),o=this._view.getNextOffset(n,{unit:"wordend",count:0}),r=this._view.getNextOffset(o,{unit:"word",count:-1});return this._computeRectangleFromOffset(r,o)}}return{top:0,left:0,height:0,width:0}},_computeTooltipArea:function(e,t,i){var n=i.ownerDocument.documentElement,o=16;if(e.tooltipArea&&e.tooltipArea.top&&e.tooltipArea.left&&e.tooltipArea.height&&e.tooltipArea.width)return i.style.overflowY="auto",i.style.resize="none",i.style.top=e.tooltipArea.top+"px",i.style.left=e.tooltipArea.left+"px",i.style.height=e.tooltipArea.height-o+"px",i.style.width=e.tooltipArea.width-o+"px",e.tooltipArea;var r=i.getBoundingClientRect(),s={width:r.width,height:r.height},a=i.getElementsByTagName("img")[0];a&&!a.complete&&0===a.width&&(s.width+=30);var l=e.position?e.position:"below",d=(this._view._rootDiv?this._view._rootDiv:n).getBoundingClientRect(),c=d.left,h=d.top,u=d.width,p=d.height,f=u,g=p;e.allowFullWidth?s.width>u&&(s.width=u):(f=Math.min(u/2,600),g=Math.min(p/2,400),s.width=Math.min(s.width,f),s.height=Math.min(s.height,g)),i.style.width=s.width-o+"px",s.height=Math.min(i.getBoundingClientRect().height,g),25+o>s.height&&s.width>f-o&&(s.height=40+o);var _=p-(t.top+t.height-h),m=t.top-h,v=u-(t.left+t.width-c);"above"===l&&s.height>m&&s.height<=_?l="below":"below"===l&&s.height>_&&s.height<=m&&(l="above");var y=e.tooltipOffsetX?e.tooltipOffsetX:0,x=e.tooltipOffsetY?e.tooltipOffsetY:0;switch(l){case"left":s.top=s.height+x>_+t.height?p+h-s.height:t.top+x,s.top=Math.max(s.top,h),s.left=Math.max(t.left-s.width+y,c);break;case"right":s.top=s.height+x>_+t.height?p+h-s.height:t.top+x,s.top=Math.max(s.top,h),s.left=Math.max(t.left+t.width+y,c);break;case"above":s.left=s.width+y>v+t.width?u+c-s.width:t.left+y,s.left=Math.max(s.left,c),s.top=Math.max(t.top-s.height+x,h);break;case"below":s.left=s.width+y>v+t.width?u+c-s.width:t.left+y,s.left=Math.max(s.left,c),s.top=Math.max(t.top+t.height+x,h)}return s.maxWidth=Math.min(u+c-s.left,u),s.maxHeight=Math.min(p+h-s.top,p),i.style.maxWidth=s.maxWidth-o+"px",i.style.maxHeight=s.maxHeight-o+"px",i.style.width=s.width-o+"px",i.style.height=s.height-o+"px",i.style.left=s.left+"px",i.style.top=s.top+"px",s},_computeOuterArea:function(e,t){var i=Math.min(e.left,t.left),n=Math.min(e.top,t.top),o=e.left+e.width,r=t.left+t.width,s=Math.max(o,r),a=e.top+e.height,l=t.top+t.height,d=Math.max(a,l);return{left:i,top:n,width:s-i,height:d-n}},_hasFocus:function(){var e=this._tooltipDiv;return e?o.contains(e,e.ownerDocument.activeElement):!1},_isNode:function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},_setInitialFocus:function(e){var t=r.$("button",e);if(t)return void t.focus();var i=r.$("a",e);if(i){i.focus();var n=this;return void i.addEventListener("click",function(){n.hide()})}var o=r.firstTabbable(e);o&&o.focus()},_isInRect:function(e,t,i){if(!e)return!1;var n=t>=e.left&&t<=e.left+e.width,o=i>=e.top&&i<=e.top+e.height;return n&&o},mapOffset:function(e){var t=this._view,i=t.getModel();return i.getBaseModel&&(e=i.mapOffset(e,!0)),e},_computeRectangleFromOffset:function(e,t){var i,n,o=this._view,r=o.getLineAtOffset(e),s=o.getLineAtOffset(t);if(r!==s){var a=o.getLocationAtOffset(e).y;i=0;for(var l=0;s>=r;){i+=o.getLineHeight(r);var d=o.getModel().getLineEnd(r),c=o.getLocationAtOffset(d).x;c>t&&(l=c),r++}var h=o.getModel().getLineStart(s),u=o.getLocationAtOffset(h).x;n={x:u,y:a,width:l-u,height:i}}else{var p=o.getLocationAtOffset(e),f=o.getLocationAtOffset(t);i=o.getLineHeight(r),n={x:p.x,y:p.y,width:f.x-p.x,height:i}}return n=this._view.convert(n,"document","page"),{left:n.x,top:n.y,width:n.width,height:n.height}},_renderPluginContent:function(e,t){var i=this._tooltipDiv.ownerDocument;if("string"!=typeof t&&"undefined"==typeof t.content)return!1;var n=s.createElement(i,"div");if(t.title){var o=s.createElement(i,"div");this.hover.renderMarkDown?o.innerHTML=this.hover.renderMarkDown(t.title):o.textContent=t.title,o.classList.add("hoverTooltipTitle"),n.appendChild(o)}var r=s.createElement(i,"div");if("string"==typeof t)r.appendChild(i.createTextNode(t));else switch(t.type){case"delegatedUI":case"html":if(t.content){var a=i.createElement("iframe");a.id="HtmlHover",a.name="HTML Hover",a.type="text/html",a.sandbox="allow-scripts allow-same-origin allow-forms",a.style.border="none",a.style.width="100%",a.style.height="100%",this._tooltipDiv.style.paddingBottom="5px",a.srcdoc=t.content,t.width&&(a.style.width=t.width),t.height&&(a.style.height=t.height),n.style.height="100%",e.style.height="100%",n.appendChild(a)}break;case"markdown":this.hover.renderMarkDown&&(r.innerHTML=this.hover.renderMarkDown(t.content));break;default:r.appendChild(i.createTextNode(t.content))}return n.appendChild(r),e.appendChild(n),!0},_renderImmediateInfo:function(e,n,o){if(n instanceof Array&&(n=this._getAnnotationContents(n,o),!n))return!1;if("string"==typeof n)return e.textContent=n,!0;if(this._isNode(n))return e.appendChild(n),!0;if(n instanceof i.ProjectionTextModel){var r=this._view,s=r.getOptions();s.wrapMode=!1,s.parent=e;var a="tooltipTheme",l=s.themeClass;l?(l=l.replace(a,""),l&&(l=" "+l),l=a+l):l=a,s.themeClass=l;var d=this._contentsView=new t.TextView(s),c={onLineStyle:function(e){r.onLineStyle(e)}};d.addEventListener("LineStyle",c.onLineStyle),d.setModel(n),this._tooltipDiv.appendChild(e),this._tooltipDiv.classList.add("textviewTooltipCodeProjection");var h=d.computeSize();return e.style.width=h.width+8+"px",e.style.height=h.height+8+"px",d.resize(),this._tooltipDiv.removeChild(e),!0}return!1},_getAnnotationContents:function(t,n){function r(e,t,i){var r=e.title,l=s.createElement(p,"div");if(l.className="tooltipRow",e.html){var d=s.createElement(p,"div");d.className="tooltipImage",d.innerHTML=e.html,d.lastChild&&o.addEventListener(d.lastChild,"click",function(){var t=e.start,i=e.end;g.getBaseModel&&(t=g.mapOffset(t,!0),i=g.mapOffset(i,!0)),f.setSelection(t,i,1/3,function(){a.hide()})},!1),l.appendChild(d)}if(!r){var c=_.getLineStart(_.getLineAtOffset(e.start)),h=_.getLineEnd(_.getLineAtOffset(e.end),!0);r=_.getText(c,h)}if("function"==typeof r&&(r=e.title()),"string"==typeof r){var u=s.createElement(p,"span");u.className="tooltipTitle",u.appendChild(p.createTextNode(r)),r=u}return l.appendChild(r),i&&a.hover.renderQuickFixes(e,t,l),n&&(n.offsetStart=e.start,n.offsetEnd=e.end),l}var a=this,l=a.hover?!0:!1;l&&n&&n.source&&n.source.indexOf("ruler")>=0&&t.length>1&&(l=!1);for(var d,c=[],h=0;h0&&m.addProjection({start:0,end:v}),m}var x;if(t.length>0&&this._editor&&(x=this._editor.getAnnotationModel().getAnnotations()),1===t.length){if(u=r(t[0],x,l),u&&u.firstChild){var b=u.firstChild.className;b&&(b+=" "),b+="single",u.firstChild.className=b}return u}var w=s.createElement(p,"div"),C=s.createElement(p,"multi_anno");C.appendChild(p.createTextNode(e.multipleAnnotations)),w.appendChild(C);for(var T=0;Ti;i++){var o=arguments[i];for(var r in o)t.call(o,r)&&(e[r]=o[r])}return e}return{clone:function(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var i=Object.create(Object.getPrototypeOf(t));return e(i,t),i},mixin:e,toArray:function(e){return Array.isArray(e)?e:[e]}}}),define("orion/editor/editor",["i18n!orion/editor/nls/messages","orion/editor/eventTarget","orion/editor/tooltip","orion/editor/annotations","orion/objects","orion/util"],function(e,t,i,n,o,r){function s(e){e=e||{},this._domNode=e.domNode,this._model=e.model,this._undoStack=e.undoStack,this._statusReporter=e.statusReporter,this._title=null;var t=this;this._listener={onChanged:function(e){t.onChanged(e)}},this._model&&this._model.addEventListener("Changed",this._listener.onChanged),this.checkDirty()}function a(e){e=e||{},s.call(this,e),this._textViewFactory=e.textViewFactory,this._undoStackFactory=e.undoStackFactory,this._textDNDFactory=e.textDNDFactory,this._annotationFactory=e.annotationFactory,this._zoomRulerFactory=e.zoomRulerFactory,this._foldingRulerFactory=e.foldingRulerFactory,this._lineNumberRulerFactory=e.lineNumberRulerFactory,this._contentAssistFactory=e.contentAssistFactory,this._keyBindingFactory=e.keyBindingFactory,this._hoverFactory=e.hoverFactory,this._syntaxHighlighter=e.syntaxHighlighter,this._annotationStyler=null,this._annotationModel=null,this._annotationRuler=null,this._lineNumberRuler=null,this._overviewRuler=null,this._zoomRuler=null,this._foldingRuler=null,this._contentAssist=null
+}var l=n.AnnotationType,d="orion.annotation.highlightError";return s.prototype={destroy:function(){this.uninstall(),this._statusReporter=this._domNode=null,this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(e,t){return this.getModel().getText(e,t)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},install:function(){this.installed=!0},isDirty:function(){return this._undoStack?!this._undoStack.isClean():this._dirty},markClean:function(){this.getUndoStack().markClean(),this.setDirty(!1)},onDirtyChanged:function(e){return this.dispatchEvent(e)},onInputChanged:function(e){return this.dispatchEvent(e)},onChanged:function(){this.checkDirty()},reportStatus:function(e,t,i){this._statusReporter&&this._statusReporter(e,t,i)},resize:function(){},setDirty:function(e){this._dirty!==e&&(this._dirty=e,this.onDirtyChanged({type:"DirtyChanged"}))},_setModelText:function(e){this._model&&this._model.setText(e)},setInput:function(e,t,i,n){this._title=e,n||(t?this.reportStatus(t,"error"):null!==i&&void 0!==i&&("string"==typeof i&&this._setModelText(i),this._undoStack&&this._undoStack.reset())),this.checkDirty(),this.onInputChanged({type:"InputChanged",title:e,message:t,contents:i,contentsSaved:n})},setText:function(e,t,i){this.getModel().setText(e,t,i)},uninstall:function(){this.installed=!1}},t.EventTarget.addMixin(s.prototype),a.prototype=new s,o.mixin(a.prototype,{destroy:function(){s.prototype.destroy.call(this),this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=this._hoverFactory=this._zoomRulerFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationRulerVisible:function(){return this._annotationRulerVisible},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},getFoldingRuler:function(){return this._foldingRuler},getFoldingRulerVisible:function(){return this._foldingRulerVisible},getLineNumberRuler:function(){return this._lineNumberRuler},getLineNumberRulerVisible:function(){return this._lineNumberRulerVisible},getTooltip:function(){return i.Tooltip.getTooltip(this._textView,this)},getZoomRuler:function(){return this._zoomRuler},getZoomRulerVisible:function(){return this._zoomRulerVisible},getModel:function(){if(!this._textView)return null;var e=this._textView.getModel();return e.getBaseModel&&(e=e.getBaseModel()),e},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(e,t){if((this._annotationRulerVisible!==e||t)&&(this._annotationRulerVisible=e,this._annotationRuler)){var i=this._textView;e?i.addRuler(this._annotationRuler,0):i.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(e,t){if(this._foldingRulerVisible!==e||t){if(!e){var i=this.getTextActions();i&&i.expandAnnotations(!0)}if(this._foldingRulerVisible=e,this._foldingRuler){var n=this._textView;n.getModel().getBaseModel&&(e?n.addRuler(this._foldingRuler):n.removeRuler(this._foldingRuler))}}},setLineNumberRulerVisible:function(e,t){if((this._lineNumberRulerVisible!==e||t)&&(this._lineNumberRulerVisible=e,this._lineNumberRuler)){var i=this._textView;e?i.addRuler(this._lineNumberRuler,this._annotationRulerVisible?1:0):i.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(e,t){if((this._overviewRulerVisible!==e||t)&&(this._overviewRulerVisible=e,this._overviewRuler)){var i=this._textView;e?i.addRuler(this._overviewRuler):i.removeRuler(this._overviewRuler)}},setZoomRulerVisible:function(e,t){if((this._zoomRulerVisible!==e||t)&&(this._zoomRulerVisible=e,this._zoomRuler)){var i=this._textView;e?i.addRuler(this._zoomRuler):i.removeRuler(this._zoomRuler)}},mapOffset:function(e,t){var i=this._textView,n=i.getModel();return n.getBaseModel&&(e=n.mapOffset(e,t)),e},getLineAtOffset:function(e){return this.getModel().getLineAtOffset(this.mapOffset(e))},getLineStart:function(e){return this.getModel().getLineStart(e)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelectionText:function(e){var t=this._textView;return t.getSelectionText(e)},getSelection:function(){var e=this._textView,t=e.getSelection(),i=e.getModel();return i.getBaseModel&&(t.start=i.mapOffset(t.start),t.end=i.mapOffset(t.end)),t},getSelections:function(){var e=this._textView,t=e.getModel(),i=e.getSelections();return i.forEach(function(e){t.getBaseModel&&(e.start=t.mapOffset(e.start),e.end=t.mapOffset(e.end))}),i},getStyleAccessor:function(){var e=null;if(this._syntaxHighlighter){var t=this._syntaxHighlighter.getStyler();t&&t.getStyleAccessor&&(e=t.getStyleAccessor())}return e},_expandOffset:function(e){var t=this._textView.getModel(),i=this._annotationModel;if(i&&t.getBaseModel)for(var n=i.getAnnotations(e,e+1);n.hasNext();){var o=n.next();o.type===l.ANNOTATION_FOLDING&&o.expand&&o.expand()}},setCaretOffset:function(e,t,i){var n=this._textView,o=n.getModel();o.getBaseModel&&(this._expandOffset(e),e=o.mapOffset(e,!0)),n.setCaretOffset(e,t,i)},setText:function(e,t,i,n,o){var r=this._textView,s=r.getModel();s.getBaseModel&&(void 0!==t&&(this._expandOffset(t),t=s.mapOffset(t,!0)),void 0!==i&&(this._expandOffset(i),i=s.mapOffset(i,!0))),r.setText(e,t,i,n,o)},setSelection:function(e,t,i,n){var o=this._textView,r=o.getModel();r.getBaseModel&&(this._expandOffset(e),this._expandOffset(t),e=r.mapOffset(e,!0),t=r.mapOffset(t,!0)),o.setSelection(e,t,i,n)},setSelections:function(e,t,i){var n=this,o=this._textView,r=o.getModel();e.forEach(function(e){var t=e.start,i=e.end;r.getBaseModel&&(n._expandOffset(t),n._expandOffset(i),t=r.mapOffset(t,!0),i=r.mapOffset(i,!0)),e.start=t,e.end=i}),o.setSelections(e,t,i)},moveSelection:function(e,t,i,n){t=t||e;var o=this._textView;this.setSelection(e,t,1/3,function(){(void 0===n||n)&&o.focus(),i&&i()})},_getTooltipInfo:function(e,t){var i=this._textView,n=this.getAnnotationModel();if(!n)return null;var o=this._annotationStyler;if(!o)return null;if(!i.isValidTextPosition(e,t))return null;var r=i.getOffsetAtLocation(e,t);if(-1===r)return null;r=this.mapOffset(r);for(var s=o.getAnnotationsByType(n,r,r+1),a=[],l=0;l>0,f=s.getLineStart(p),g=s.getLineEnd(p);s.getBaseModel&&(f=s.mapOffset(f),g=s.mapOffset(g));var _=l.ANNOTATION_CURRENT_LINE,m=l.createAnnotation(_,f,g);h.push(m)}this._currentLineAnnotations=h,o.replaceAnnotations(c,h)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){if(this._textView=this._textViewFactory(),this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this._textView.setOptions({undoStack:this._undoStack}),this.checkDirty()),this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack)),this._contentAssistFactory){var e=this._contentAssistFactory.createContentAssistMode(this);this._contentAssist=e.getContentAssist()}var t=i.Tooltip.getTooltip(this._textView,this);this._hoverFactory&&(this._hover=this._hoverFactory.createHover(this),t.hover=this._hover);var n=this,o=this._textView,r=this;if(this._listener={onModelChanged:function(){r.checkDirty()},onMouseOver:function(e){r._listener.onMouseMove(e)},onMouseDown:function(){r._listener.mouseDown=!0},onMouseUp:function(){r._listener.mouseDown=!1},onMouseMove:function(e){t&&!r._listener.mouseDown&&(e.event.clientX!==r._listener.lastMouseX||e.event.clientY!==r._listener.lastMouseY)&&(r._listener.lastMouseX=e.event.clientX,r._listener.lastMouseY=e.event.clientY,r._hoverTimeout&&(window.clearTimeout(r._hoverTimeout),r._hoverTimeout=null),r._hoverTimeout=window.setTimeout(function(){r._hoverTimeout=null,r._listener&&t.onHover({y:e.y,x:e.x,getTooltipInfo:function(){return r._getTooltipInfo(this.x,this.y)}},e.x,e.y)},175))},onMouseOut:function(){r._hoverTimeout&&(window.clearTimeout(r._hoverTimeout),r._hoverTimeout=null)},onSelection:function(e){t&&t.hide(),r._updateCursorStatus(),r._highlightCurrentLine(e.newValue,e.oldValue)}},o.addEventListener("ModelChanged",this._listener.onModelChanged),o.addEventListener("Selection",this._listener.onSelection),o.addEventListener("MouseOver",this._listener.onMouseOver),o.addEventListener("MouseOut",this._listener.onMouseOut),o.addEventListener("MouseDown",this._listener.onMouseDown),o.addEventListener("MouseUp",this._listener.onMouseUp),o.addEventListener("MouseMove",this._listener.onMouseMove),this._keyBindingFactory){var a;a="function"==typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(n,this._undoStack,this._contentAssist),a&&(this._textActions=a.textActions,this._linkedMode=a.linkedMode,this._sourceCodeActions=a.sourceCodeActions)}var c=function(e){if(void 0!==e&&-1!==e){for(var t=this.getView(),i=t.getModel(),o=this.getAnnotationModel(),r=n.mapOffset(i.getLineStart(e)),s=n.mapOffset(i.getLineEnd(e)),a=o.getAnnotations(r,s),d=null;a.hasNext();){var c=a.next();if(c.type===l.ANNOTATION_BOOKMARK){d=c;break}}d?o.removeAnnotation(d):(d=l.createAnnotation(l.ANNOTATION_BOOKMARK,r,s,n.getText(r,s)),o.addAnnotation(d))}};if(this._annotationFactory){var h=o.getModel();if(h.getBaseModel&&(h=h.getBaseModel()),this._annotationModel=this._annotationFactory.createAnnotationModel(h),this._annotationModel){var u=this._annotationStyler=this._annotationFactory.createAnnotationStyler(o,this._annotationModel);u&&(u.addAnnotationType(l.ANNOTATION_CURRENT_SEARCH),u.addAnnotationType(l.ANNOTATION_MATCHING_SEARCH),u.addAnnotationType(l.ANNOTATION_ERROR),u.addAnnotationType(l.ANNOTATION_WARNING),u.addAnnotationType(l.ANNOTATION_MATCHING_BRACKET),u.addAnnotationType(l.ANNOTATION_CURRENT_BRACKET),u.addAnnotationType(l.ANNOTATION_CURRENT_LINE),u.addAnnotationType(l.ANNOTATION_READ_OCCURRENCE),u.addAnnotationType(l.ANNOTATION_WRITE_OCCURRENCE),u.addAnnotationType(l.ANNOTATION_SELECTED_LINKED_GROUP),u.addAnnotationType(l.ANNOTATION_CURRENT_LINKED_GROUP),u.addAnnotationType(l.ANNOTATION_LINKED_GROUP),u.addAnnotationType(d))}var p=this._annotationFactory.createAnnotationRulers(this._annotationModel),f=this._annotationRuler=p.annotationRuler;f&&(f.onDblClick=c,f.setMultiAnnotationOverlay({html:""}),f.addAnnotationType(l.ANNOTATION_ERROR),f.addAnnotationType(l.ANNOTATION_WARNING),f.addAnnotationType(l.ANNOTATION_TASK),f.addAnnotationType(l.ANNOTATION_BOOKMARK),f.addAnnotationType(l.ANNOTATION_DIFF_ADDED),f.addAnnotationType(l.ANNOTATION_DIFF_DELETED),f.addAnnotationType(l.ANNOTATION_DIFF_MODIFIED)),this.setAnnotationRulerVisible(this._annotationRulerVisible||void 0===this._annotationRulerVisible,!0),f=this._overviewRuler=p.overviewRuler,f&&(f.addAnnotationType(l.ANNOTATION_CURRENT_SEARCH),f.addAnnotationType(l.ANNOTATION_MATCHING_SEARCH),f.addAnnotationType(l.ANNOTATION_READ_OCCURRENCE),f.addAnnotationType(l.ANNOTATION_WRITE_OCCURRENCE),f.addAnnotationType(l.ANNOTATION_CURRENT_BLAME),f.addAnnotationType(l.ANNOTATION_ERROR),f.addAnnotationType(l.ANNOTATION_WARNING),f.addAnnotationType(l.ANNOTATION_TASK),f.addAnnotationType(l.ANNOTATION_BOOKMARK),f.addAnnotationType(l.ANNOTATION_MATCHING_BRACKET),f.addAnnotationType(l.ANNOTATION_CURRENT_BRACKET),f.addAnnotationType(l.ANNOTATION_CURRENT_LINE),f.addAnnotationType(l.ANNOTATION_DIFF_ADDED),f.addAnnotationType(l.ANNOTATION_DIFF_DELETED),f.addAnnotationType(l.ANNOTATION_DIFF_MODIFIED)),this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._zoomRulerFactory&&(this._zoomRuler=this._zoomRulerFactory.createZoomRuler(this._annotationModel),this.setZoomRulerVisible(this._zoomRulerVisible,!0)),this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_BLAME),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_DIFF_ADDED),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_DIFF_MODIFIED),this._lineNumberRuler.addAnnotationType(l.ANNOTATION_DIFF_DELETED),this._lineNumberRuler.onDblClick=c,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||void 0===this._lineNumberRulerVisible,!0)),this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(l.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));var g={type:"TextViewInstalled",textView:o};this.dispatchEvent(g),s.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var e=this._textView;if(e){e.destroy(),this._annotationModel&&this._annotationModel.setTextModel(null),this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._zoomRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotations=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._zoomRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0;var t={type:"TextViewUninstalled",textView:e};this.dispatchEvent(t),s.prototype.uninstall.call(this)}},_updateCursorStatus:function(){for(var t=this.getKeyModes(),i=0;i1)o=r.formatMessage(e.multiSelections,a.length);else{var l=a[0].getCaret(),d=s.getLineAtOffset(l),c=s.getLineStart(d),h=l-c;o=localStorage.languageTools?r.formatMessage(e.lineColumnOffset,d+1,h+1,l):r.formatMessage(e.lineColumn,d+1,h+1)}this.reportStatus(o)},showAnnotations:function(e,t,i,n){var o=this._annotationModel;if(o){for(var r,s=[],a=[],d=o.getTextModel(),c=o.getAnnotations();c.hasNext();)r=c.next(),-1!==t.indexOf(r.type)&&r.creatorID===this&&s.push(r);if(e)for(var h=0;h',s.blame=e,s})},showDiffAnnotations:function(e){this.showAnnotations(e,[l.ANNOTATION_DIFF_ADDED,l.ANNOTATION_DIFF_MODIFIED,l.ANNOTATION_DIFF_DELETED],null,function(e){return"added"===e.type?l.ANNOTATION_DIFF_ADDED:"modified"===e.type?l.ANNOTATION_DIFF_MODIFIED:l.ANNOTATION_DIFF_DELETED})},showSelection:function(e,t,i,n,o){if("number"==typeof e)return"number"!=typeof t&&(t=e),this.moveSelection(e,t),!0;if("number"==typeof i){var r=this.getModel(),s=r.getLineStart(i-1);return"number"==typeof n&&(s+=n),"number"!=typeof o&&(o=0),this.moveSelection(s,s+o),!0}return!1},_setModelText:function(e){this._textView&&(this._textView.setText(e),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelections()))},setInput:function(e,t,i,n,o){s.prototype.setInput.call(this,e,t,i,n),!this._textView||n||o||this._textView.focus()},onGotoLine:function(e,t,i,n){if(this._textView){var o=this.getModel();e=Math.max(0,Math.min(e,o.getLineCount()-1));var r=o.getLineStart(e),s=0;if(void 0===i&&(i=0),"string"==typeof t){var a=o.getLine(e).indexOf(t);-1!==a&&(s=a,i=s+t.length)}else{s=t;var l=o.getLineEnd(e)-r;s=Math.min(s,l),i=Math.min(i,l)}this.moveSelection(r+s,r+i,n)}}}),{BaseEditor:s,Editor:a}}),define("orion/editor/find",["i18n!orion/editor/nls/messages","orion/keyBinding","orion/editor/keyModes","orion/editor/annotations","orion/regex","orion/objects","orion/Deferred","orion/util"],function(e,t,i,n,o,r,s,a){function l(e){var t=e.getTextView();i.KeyMode.call(this,t),this.editor=e,this._active=!1,this._success=!0,this._ignoreSelection=!1,this._prefix="",t.setAction("incrementalFindCancel",function(){return this.setActive(!1),!0}.bind(this)),t.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));var n=this;this._listener={onVerify:function(e){var t=n.editor,i=t.getModel(),r=t.mapOffset(e.start),s=t.mapOffset(e.end),a=i.getText(r,s),l=n._prefix,d=l.match(new RegExp("^"+o.escape(a),"i"));d&&d.length>0&&(l=n._prefix+=e.text,n._success=!0,n._status(),n.find(n._forward,!0),e.text=null)},onSelection:function(){n._ignoreSelection||n.setActive(!1)}}}function d(e,t,i){if(e){this._editor=e,this._undoStack=t,this._showAll=!0,this._visible=!1,this._caseInsensitive=!0,this._wrap=!0,this._wholeWord=!1,this._incremental=!0,this._regex=!1,this._findAfterReplace=!0,this._hideAfterFind=!1,this._reverse=!1,this._start=void 0,this._end=void 0,this._timer=void 0,this._lastString="";var n=this;this._listeners={onEditorFocus:function(e){n._removeCurrentAnnotation(e)}},this.setOptions(i)}}var c={};return l.prototype=new i.KeyMode,r.mixin(l.prototype,{createKeyBindings:function(){var e=t.KeyBinding,i=[];return i.push({actionID:"incrementalFindBackspace",keyBinding:new e(8)}),i.push({actionID:"incrementalFindCancel",keyBinding:new e(13)}),i.push({actionID:"incrementalFindCancel",keyBinding:new e(27)}),i.push({actionID:"incrementalFindReverse",keyBinding:new e(38)}),i.push({actionID:"incrementalFind",keyBinding:new e(40)}),i.push({actionID:"incrementalFindReverse",keyBinding:new e("k",!0,!0)}),i.push({actionID:"incrementalFind",keyBinding:new e("k",!0)}),i},find:function(e,t){if(this._forward=e,!this.isActive())return this.setActive(!0),!1;var i=this._prefix;if(0===i.length)return!1;var n,o=this.editor,r=o.getModel();return n=e?this._success?t?this._start:o.getCaretOffset()+1:0:this._success?t?this._start:o.getCaretOffset():r.getCharCount()-1,s.when(o.getModel().find({string:i,start:n,reverse:!e,caseInsensitive:i.toLowerCase()===i}),function(i){var r=i.next();r?(t||(this._start=n),this._success=!0,this._ignoreSelection=!0,o.moveSelection(e?r.start:r.end,e?r.end:r.start),this._ignoreSelection=!1):this._success=!1,this._status()}.bind(this)),!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(e){if(this._active!==e){this._active=e,this._prefix="",this._success=!0;var t=this.editor,i=t.getTextView();this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(i.addEventListener("Verify",this._listener.onVerify),i.addEventListener("Selection",this._listener.onSelection),i.addKeyMode(this)):(i.removeEventListener("Verify",this._listener.onVerify),i.removeEventListener("Selection",this._listener.onSelection),i.removeKeyMode(this)),this._status()}},_backspace:function(){var e=this._prefix;return e=this._prefix=e.substring(0,e.length-1),0===e.length?(this._success=!0,this._ignoreSelection=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(!this.isActive())return void this.editor.reportStatus("");var t;t=this._forward?this._success?e.incrementalFindStr:e.incrementalFindStrNotFound:this._success?e.incrementalFindReverseStr:e.incrementalFindReverseStrNotFound,t=a.formatMessage(t,this._prefix),this.editor.reportStatus(t,this._success?"":"error")}}),c.IncrementalFind=l,d.prototype={find:function(e,t,i){this.setOptions({reverse:!e});var n,o=this.getFindString();t&&(o=t.findString||o,n=t.count);var r=this.getOptions();this.setOptions(t);var s=i?this._startOffset:this.getStartOffset();return this._doFind(o,s,n).then(function(e){return e&&(i||(this._startOffset=e.start)),this.setOptions(r),this._hideAfterFind&&this.hide(),e}.bind(this))},getStartOffset:function(){return void 0!==this._start?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var e=this._editor.getSelection(),t=this._editor.getText(e.start,e.end);return this._regex&&(t=o.escape(t)),t||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},hide:function(){this._visible=!1,this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(this._savedOptions=null)),this._removeAllAnnotations();var e=this._editor.getTextView();e&&(e.removeEventListener("Focus",this._listeners.onEditorFocus),e.focus())},_processReplaceString:function(e){var t=e;if(this._regex){t="";for(var i=!1,n=this._editor.getModel().getLineDelimiter(),o=0;o0&&(r.endUndo(),n.setRedraw(!0)),s>0?i.reportStatus(a.formatMessage(e.replacedMatches,l)):i.reportStatus(e.nothingReplaced,"error"),r._replacingAll=!1},100)}},setOptions:function(e){if(e){if((e.showAll===!0||e.showAll===!1)&&this._showAll!==e.showAll&&(this._showAll=e.showAll,this.isVisible()))if(this._showAll)this._markAllOccurrences();else{var t=this._editor.getAnnotationModel();t&&t.removeAnnotations(n.AnnotationType.ANNOTATION_MATCHING_SEARCH)}(e.caseInsensitive===!0||e.caseInsensitive===!1)&&(this._caseInsensitive=e.caseInsensitive),(e.wrap===!0||e.wrap===!1)&&(this._wrap=e.wrap),(e.wholeWord===!0||e.wholeWord===!1)&&(this._wholeWord=e.wholeWord),(e.incremental===!0||e.incremental===!1||"disabled"===e.incremental)&&("disabled"===e.incremental?(this._incremental=!1,this._incrementalDisabled=!0):this._incremental=e.incremental),(e.regex===!0||e.regex===!1)&&(this._regex=e.regex),(e.findAfterReplace===!0||e.findAfterReplace===!1)&&(this._findAfterReplace=e.findAfterReplace),(e.hideAfterFind===!0||e.hideAfterFind===!1)&&(this._hideAfterFind=e.hideAfterFind),(e.reverse===!0||e.reverse===!1)&&(this._reverse=e.reverse),e.hasOwnProperty("findCallback")&&(this._findCallback=e.findCallback),e.hasOwnProperty("start")&&(this._start=e.start),e.hasOwnProperty("end")&&(this._end=e.end)}},show:function(e){this._visible=!0,e&&(this._savedOptions||(this._savedOptions=[]),this._savedOptions.push(this.getOptions()),this.setOptions(e)),this._startOffset=this._editor.getSelection().start,this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var t=this;window.setTimeout(function(){t._incremental&&t.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_findFromModel:function(e,t,i){return this._editor.getModel().find({string:e,start:t,end:this._end,reverse:this._reverse,wrap:i?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_find:function(e,t,i,n){var o;if(this._regex)try{o=this._findFromModel(t,i,n)}catch(r){return e.reportStatus(r.message,"error"),null}else o=this._findFromModel(t,i,n);return o},_doFindForReplaceAll:function(e,t,i,n){i=i||1;var o=this._editor;if(!e)return this._removeAllAnnotations(),null;this._lastString=e;var r,s;if(s=this._find(o,e,t,n),!s)return null;if(!s.hasNext||!s.next)return null;for(var a=0;i>a&&s.hasNext();a++)r=s.next();return r},_doFind:function(t,i,o,r){o=o||1;var a=this._editor;if(!t)return this._removeAllAnnotations(),(new s).resolve();this._lastString=t;var l;return s.when(this._find(a,t,i,r)).then(function(t){if(t){for(var i=0;o>i&&t.hasNext();i++)l=t.next();if(!this._replacingAll){if(l?this._editor.reportStatus(""):this._editor.reportStatus(e.notFound,"error"),this.isVisible()){var r=n.AnnotationType.ANNOTATION_CURRENT_SEARCH,s=a.getAnnotationModel();if(s&&(s.removeAnnotations(r),l&&s.addAnnotation(n.AnnotationType.createAnnotation(r,l.start,l.end))),this._showAll){this._timer&&window.clearTimeout(this._timer);var d=this;this._timer=window.setTimeout(function(){d._markAllOccurrences(),d._timer=null},500)}}this._findCallback?this._findCallback(l):l&&a.moveSelection(l.start,l.end,null,!1)}return l}}.bind(this))},_doReplace:function(e,t,i,n){var o=this._editor;this._regex&&(n=o.getText(e,t).replace(new RegExp(i,this._caseInsensitive?"i":""),n)),o.setText(n,e,t),o.setSelection(e,e+n.length,!0)},_markAllOccurrences:function(){var e=this._editor.getAnnotationModel();if(e){for(var t,i=n.AnnotationType.ANNOTATION_MATCHING_SEARCH,o=e.getAnnotations(),r=[];o.hasNext();){var a=o.next();a.type===i&&r.push(a)}if(this.isVisible()){var l=this.getFindString();s.when(this._editor.getModel().find({string:l,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})).then(function(o){if(o){for(t=[];o.hasNext();){var s=o.next();t.push(n.AnnotationType.createAnnotation(i,s.start,s.end))}e.replaceAnnotations(r,t)}}.bind(this))}else e.replaceAnnotations(r,t)}},_removeAllAnnotations:function(){var e=this._editor.getAnnotationModel();e&&(e.removeAnnotations(n.AnnotationType.ANNOTATION_CURRENT_SEARCH),e.removeAnnotations(n.AnnotationType.ANNOTATION_MATCHING_SEARCH))},_removeCurrentAnnotation:function(){var e=this._editor.getAnnotationModel();e&&e.removeAnnotations(n.AnnotationType.ANNOTATION_CURRENT_SEARCH)}},c.Find=d,c}),define("orion/editor/findUI",["i18n!orion/editor/nls/messages","orion/editor/find","orion/objects","orion/editor/util","orion/util"],function(e,t,i,n,o){function r(e,i,n){t.Find.call(this,e,i,n)}return r.prototype=new t.Find,i.mixin(r.prototype,{getFindString:function(){var e=this._findInput;return e?e.value:t.Find.prototype.getFindString.call(this)},getReplaceString:function(){var e=this._replaceInput;return e?e.value:t.Find.prototype.getReplaceString(this)},hide:function(){var e=this.isVisible();t.Find.prototype.hide.call(this),e&&(this._rootDiv.className="textViewFind")},show:function(e){t.Find.prototype.show.call(this,e);var i=e.findString,n=e.replaceString,o=this._findInput;if(o||(this._create(),o=this._findInput),i&&(o.value=i),n){var r=this._replaceInput;r.value=n}var s=this;window.setTimeout(function(){s._rootDiv.className="textViewFind show",o.select(),o.focus()},0)},_create:function(){var t=this,i=this._editor.getTextView(),r=i.getOptions("parent"),s=r.ownerDocument,a=o.createElement(s,"div");a.className="textViewFind",n.addEventListener(a,"keydown",function(e){t._handleKeyDown(e)}),this._rootDiv=a,a.setAttribute("role","dialog"),a.setAttribute("aria-label",e.findReplace),this._createContents(s,a),i._rootDiv.insertBefore(a,i._rootDiv.firstChild)},_createContents:function(t,i){var r=this,s=o.createElement(t,"input");s.className="textViewFindInput",this._findInput=s,s.type="text",s.placeholder=e.findWith,n.addEventListener(s,"input",function(e){return r._handleInput(e)}),i.appendChild(s);var a=o.createElement(t,"span");r._createButton(t,a,e.next,function(){r.find(!0)}),r._createButton(t,a,e.previous,function(){r.find(!1)}),i.appendChild(a);var l=r._editor.getTextView().getOptions("readonly");if(!l){var d=o.createElement(t,"input");d.className="textViewReplaceInput",this._replaceInput=d,d.type="text",d.placeholder=e.replaceWith,i.appendChild(d),a=o.createElement(t,"span"),r._createButton(t,a,e.replace,function(){r.replace()}),r._createButton(t,a,e.replaceAll,function(){r.replaceAll()
+}),i.appendChild(a)}a=o.createElement(t,"span"),r._createButton(t,a,e.regex,function(e){r._toggle("regex",e.target)},this._regex,e.regexTooltip,e.regexTooltip),r._createButton(t,a,e.caseInsensitive,function(e){r._toggle("caseInsensitive",e.target)},this._caseInsensitive,e.caseInsensitiveTooltip,e.caseInsensitiveTooltip),r._createButton(t,a,e.wholeWord,function(e){r._toggle("wholeWord",e.target)},this._wholeWord,e.wholeWordTooltip,e.wholeWordTooltip),i.appendChild(a);var c=r._createButton(t,i,"",function(){r.hide()});c.className="textViewFindCloseButton",c.title=e.closeTooltip,o.confineDialogTab(s,c)},_createButton:function(e,t,i,o,r,s,a){var l=e.createElement("button");return l.type="button",this._checked(r,l),s&&(l.title=s),n.addEventListener(l,"click",function(e){o.call(this,e)},!1),i&&l.appendChild(e.createTextNode(i)),a&&l.setAttribute("aria-label",a),t.appendChild(l),l},_toggle:function(e,t){var i={};i[e]=!this["_"+e],this.setOptions(i),this._checked(i[e],t)},_checked:function(e,t){t.className="textViewFindButton",e&&(t.className+=" checked")},_handleInput:function(){return this._incremental&&this.find(!0,null,!0),!0},_handleKeyDown:function(e){var t,i=(o.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&!e.shiftKey;return i&&70===e.keyCode&&(t=!0),((o.isMac?e.metaKey:e.ctrlKey)&&!e.altKey&&75===e.keyCode||13===e.keyCode)&&(this.find(13===e.keyCode?this._reverse?e.shiftKey:!e.shiftKey:!e.shiftKey),t=!0),i&&82===e.keyCode&&(this.replace(),t=!0),27===e.keyCode&&(this.hide(),t=!0),t?(e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,!1):!0}}),{FindUI:r}}),define("orion/editor/actions",["i18n!orion/editor/nls/messages","orion/keyBinding","orion/editor/annotations","orion/editor/tooltip","orion/editor/find","orion/editor/findUI","orion/util"],function(e,t,i,n,o,r,s){function a(e,t,i,n){function o(e,t,i){s.setText(e,t,i),r+=t-i+e.length}var r=0,s=e.editor,a=s.getSelections();!n&&(t||a.length>1)&&e.startUndo(),a.forEach(function(e){e.start+=r,e.end+=r,i(e,o)}),s.setSelections(a),!n&&(t||a.length>1)&&e.endUndo()}function l(e,t,i){this.editor=e,this.undoStack=t,this._incrementalFind=new o.IncrementalFind(e),this._find=i?i:new r.FindUI(e,t),this._lastEditLocation=null,this.init()}function d(e,t,i,n){this.editor=e,this.undoStack=t,this.contentAssist=i,this.linkedMode=n,this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",this.contentAssistProposalApplied.bind(this)),this.init()}var c=i.AnnotationType,h={};return l.prototype={init:function(){var i=this.editor.getTextView();this._lastEditListener={onModelChanged:function(e){this.editor.isDirty()&&(this._lastEditLocation=e.start+e.addedCharCount)}.bind(this)},i.addEventListener("ModelChanged",this._lastEditListener.onModelChanged),i.setAction("undo",function(e){if(this.undoStack){var t=1;for(e&&e.count&&(t=e.count);t>0;)this.undoStack.undo(),--t;return!0}return!1}.bind(this),{name:e.undo}),i.setAction("redo",function(e){if(this.undoStack){var t=1;for(e&&e.count&&(t=e.count);t>0;)this.undoStack.redo(),--t;return!0}return!1}.bind(this),{name:e.redo}),i.setKeyBinding(new t.KeyBinding("f",!0),"find"),i.setAction("find",function(){if(this._find){var e=this.editor.getSelection();return this._find.show({findString:this.editor.getText(e.start,e.end)}),!0}return!1}.bind(this),{name:e.find}),i.setKeyBinding(new t.KeyBinding("k",!0),"findNext"),i.setAction("findNext",function(e){return this._find?(this._find.find(!0,e),!0):!1}.bind(this),{name:e.findNext}),i.setKeyBinding(new t.KeyBinding("k",!0,!0),"findPrevious"),i.setAction("findPrevious",function(e){return this._find?(this._find.find(!1,e),!0):!1}.bind(this),{name:e.findPrevious}),i.setKeyBinding(new t.KeyBinding("j",!0),"incrementalFind"),i.setAction("incrementalFind",function(){return this._incrementalFind&&this._incrementalFind.find(!0),!0}.bind(this),{name:e.incrementalFind}),i.setKeyBinding(new t.KeyBinding("j",!0,!0),"incrementalFindReverse"),i.setAction("incrementalFindReverse",function(){return this._incrementalFind&&this._incrementalFind.find(!1),!0}.bind(this),{name:e.incrementalFindReverse}),i.setAction("tab",function(){return this.indentLines()}.bind(this)),i.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:e.unindentLines}),i.setKeyBinding(new t.KeyBinding(38,!1,!1,!0),"moveLinesUp"),i.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:e.moveLinesUp}),i.setKeyBinding(new t.KeyBinding(40,!1,!1,!0),"moveLinesDown"),i.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:e.moveLinesDown}),i.setKeyBinding(new t.KeyBinding(38,!0,!1,!0),"copyLinesUp"),i.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:e.copyLinesUp}),i.setKeyBinding(new t.KeyBinding(40,!0,!1,!0),"copyLinesDown"),i.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:e.copyLinesDown}),i.setKeyBinding(new t.KeyBinding("d",!0,!1,!1),"deleteLines"),i.setAction("deleteLines",function(e){return this.deleteLines(e)}.bind(this),{name:e.deleteLines}),i.setKeyBinding(new t.KeyBinding("l",!s.isMac,!1,!1,s.isMac),"gotoLine"),i.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:e.gotoLine}),i.setKeyBinding(new t.KeyBinding(190,!0),"nextAnnotation"),i.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:e.nextAnnotation}),i.setKeyBinding(new t.KeyBinding(188,!0),"previousAnnotation"),i.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:e.prevAnnotation}),i.setKeyBinding(new t.KeyBinding("e",!0,!1,!0,!1),"expand"),i.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:e.expand}),i.setKeyBinding(new t.KeyBinding("c",!0,!1,!0,!1),"collapse"),i.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:e.collapse}),i.setKeyBinding(new t.KeyBinding("e",!0,!0,!0,!1),"expandAll"),i.setAction("expandAll",function(){return this.expandAnnotations(!0)}.bind(this),{name:e.expandAll}),i.setKeyBinding(new t.KeyBinding("c",!0,!0,!0,!1),"collapseAll"),i.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:e.collapseAll}),i.setKeyBinding(new t.KeyBinding("q",!s.isMac,!1,!1,s.isMac),"lastEdit"),i.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:e.lastEdit})},copyLinesDown:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!1,function(e,t){var n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineStart(n),s=i.getLineEnd(o,!0),a=i.getLineCount(),l="",d=i.getText(r,s);o===a-1&&(d=(l=i.getLineDelimiter())+d);var c=s;t(d,c,c),e.start=c+l.length,e.end=c+d.length}),!0},copyLinesUp:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!1,function(e,t){var n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineStart(n),s=i.getLineEnd(o,!0),a=i.getLineCount(),l="",d=i.getText(r,s);o===a-1&&(d+=l=i.getLineDelimiter());var c=r;t(d,c,c),e.start=c,e.end=c+d.length-l.length}),!0},deleteLines:function(e){var t=this.editor,i=t.getTextView();if(i.getOptions("readonly"))return!1;var n=1;e&&e.count&&(n=e.count);var o=t.getModel();return a(this,!1,function(e,t){var i,r=o.getLineAtOffset(e.start),s=o.getLineStart(r);i=e.start!==e.end||1===n?o.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(r+n-1,o.getLineCount()-1);var a=o.getLineEnd(i,!0);t("",s,a),e.start=e.end=s}),!0},expandAnnotation:function(e){var t=this.editor;if(!t.getFoldingRulerVisible())return!0;var n=t.getAnnotationModel();if(!n)return!0;var o=t.getModel(),r=t.getCaretOffset(),s=o.getLineAtOffset(r),a=o.getLineStart(s),l=o.getLineEnd(s,!0);o.getBaseModel&&(a=o.mapOffset(a),l=o.mapOffset(l),o=o.getBaseModel());for(var d,c=n.getAnnotations(a,l);!d&&c.hasNext();){var h=c.next();h.type===i.AnnotationType.ANNOTATION_FOLDING&&(d=h)}return d&&e!==d.expanded&&(e?d.expand():(t.setCaretOffset(d.start),d.collapse())),!0},expandAnnotations:function(e){var t=this.editor;if(!t.getFoldingRulerVisible())return!0;var n=t.getTextView(),o=t.getAnnotationModel();if(!o)return!0;var r,s=o.getAnnotations();for(n.setRedraw(!1);s.hasNext();)r=s.next(),r.type===i.AnnotationType.ANNOTATION_FOLDING&&e!==r.expanded&&(e?r.expand():r.collapse());return n.setRedraw(!0),!0},indentLines:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;if(t.getOptions("tabMode")){var i=e.getModel(),n=0,o=e.getSelections();return o.length>1&&this.startUndo(),o.some(function(r){r.start+=n,r.end+=n;var s=i.getLineAtOffset(r.start),a=i.getLineAtOffset(r.end>r.start?r.end-1:r.end);if(!(s!==a||o.length>1))return!0;var l=[];l.push("");for(var d=s;a>=d;d++)l.push(i.getLine(d,!0));var c=i.getLineStart(s),h=i.getLineEnd(a,!0),u=t.getOptions("tabSize","expandTab"),p=u.expandTab?new Array(u.tabSize+1).join(" "):" ",f=l.join(p);e.setText(f,c,h);var g=c===r.start?r.start:r.start+p.length,_=r.end+(a-s+1)*p.length;return n+=c-h+f.length,r.start=g,r.end=_,!1})?!1:(e.setSelections(o),o.length>1&&this.endUndo(),!0)}},gotoLastEdit:function(){return"number"==typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation),!0},gotoLine:function(){var t=this.editor,i=t.getModel(),n=i.getLineAtOffset(t.getCaretOffset());return n=prompt(e.gotoLinePrompty,n+1),n&&(n=parseInt(n,10),t.onGotoLine(n-1,0)),!0},moveLinesDown:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!0,function(e,t){var n=i.getLineAtOffset(e.start),o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineCount();if(o!==r-1){var s,a=i.getLineStart(n),l=i.getLineEnd(o,!0),d=i.getLineEnd(o+1,!0)-(l-a),c=0;if(o!==r-2)s=i.getText(a,l);else{var h=i.getLineEnd(o);s=i.getText(h,l)+i.getText(a,h),c+=l-h}t("",a,l),t(s,d,d),e.start=d+c,e.end=d+c+s.length}}),!0},moveLinesUp:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!0,function(e,t){var n=i.getLineAtOffset(e.start);if(0!==n){var o=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),r=i.getLineCount(),s=i.getLineStart(n-1),a=i.getLineStart(n),l=i.getLineEnd(o,!0),d=i.getText(a,l),c=0;if(o===r-1){var h=i.getLineEnd(n-1),u=i.getLineEnd(n-1,!0);d+=i.getText(h,u),a=h,c=u-h}t("",a,l),t(d,s,s),e.start=s,e.end=s+d.length-c}}),!0},nextAnnotation:function(e){function t(e){return!!e.lineStyle||e.type===c.ANNOTATION_MATCHING_BRACKET||e.type===c.ANNOTATION_CURRENT_BRACKET||!r.isAnnotationTypeVisible(e.type)}var i=this.editor,o=i.getAnnotationModel();if(!o)return!0;var r=i.getOverviewRuler()||i.getAnnotationStyler();if(!r)return!0;for(var s=i.getModel(),a=i.getCaretOffset(),l=o.getAnnotations(e?a:0,e?s.getCharCount():a),d=null;l.hasNext();){var h=l.next();if(e){if(h.start<=a)continue}else if(h.start>=a)continue;if(!t(h)&&(d=h,e))break}if(d){var u=[d];for(l=o.getAnnotations(d.start,d.start);l.hasNext();)h=l.next(),h===d||t(h)||u.push(h);var p=i.getTextView(),f=n.Tooltip.getTooltip(p,i);if(!f)return i.moveSelection(d.start),!0;i.moveSelection(d.start,d.start,function(){setTimeout(function(){var e=i.getTextView(),t=d.start,n=e.getLocationAtOffset(t);f.show({x:n.x,y:n.y,getTooltipInfo:function(){return i._getTooltipInfo(this.x,this.y)}},!1,!1)},0)})}return!0},unindentLines:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;if(t.getOptions("tabMode")){var i=e.getModel();return a(this,!1,function(e,n){for(var o=i.getLineAtOffset(e.start),r=i.getLineAtOffset(e.end>e.start?e.end-1:e.end),s=t.getOptions("tabSize"),a=new Array(s+1).join(" "),l=[],d=0,c=0,h=o;r>=h;h++){var u=i.getLine(h,!0);if(i.getLineStart(h)!==i.getLineEnd(h))if(0===u.indexOf(" "))u=u.substring(1),d++;else{if(0!==u.indexOf(a))return!0;u=u.substring(s),d+=s}h===o&&(c=d),l.push(u)}var p=i.getLineStart(o),f=i.getLineEnd(r,!0),g=i.getLineStart(r),_=l.join("");n(_,p,f);var m=p===e.start?e.start:e.start-c,v=Math.max(m,e.end-d+(e.end===g+1&&e.start!==e.end?1:0));e.start=m,e.end=v}),!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}},h.TextActions=l,d.prototype={init:function(){var i=this.editor.getTextView();i.setAction("lineStart",function(){return this.lineStart()}.bind(this)),i.setAction("enter",function(){return this.autoIndent()}.bind(this)),i.setKeyBinding(new t.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces"),i.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:e.trimTrailingWhitespaces}),i.setKeyBinding(new t.KeyBinding(191,!0),"toggleLineComment"),i.setAction("toggleLineComment",function(){return this.toggleLineComment()}.bind(this),{name:e.toggleLineComment}),i.setKeyBinding(new t.KeyBinding(191,!0,!s.isMac,!1,s.isMac),"addBlockComment"),i.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:e.addBlockComment}),i.setKeyBinding(new t.KeyBinding(220,!0,!s.isMac,!1,s.isMac),"removeBlockComment"),i.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:e.removeBlockComment}),i.setKeyBinding(new t.KeyBinding("[",!1,!1,!1,!1,"keypress"),"autoPairSquareBracket"),i.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this)),i.setKeyBinding(new t.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket"),i.setAction("skipClosingSquareBracket",function(){return this.handleClosingBracket("]")}.bind(this)),i.setKeyBinding(new t.KeyBinding("<",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket"),i.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("<",">")}.bind(this)),i.setKeyBinding(new t.KeyBinding(">",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket"),i.setAction("skipClosingAngleBracket",function(){return this.handleClosingBracket(">")}.bind(this)),i.setKeyBinding(new t.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses"),i.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this)),i.setKeyBinding(new t.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis"),i.setAction("skipClosingParenthesis",function(){return this.handleClosingBracket(")")}.bind(this)),i.setKeyBinding(new t.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces"),i.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this)),i.setKeyBinding(new t.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace"),i.setAction("skipClosingBrace",function(){return this.handleClosingBracket("}")}.bind(this)),i.setKeyBinding(new t.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation"),i.setAction("autoPairSingleQuotation",function(){return this.autoPairQuotations("'")}.bind(this)),i.setKeyBinding(new t.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation"),i.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this)),i.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){function e(e,t){if(e.start===e.end){for(var i,o=n.getLineAtOffset(e.start),a=n.getLine(o,!1),u=n.getLineStart(o),p=0,f=e.start-u;f>p&&(32===(i=a.charCodeAt(p))||9===i);)p++;var g,_,m=a.substring(0,p),v=a.substring(0,f),y=a.substring(f);if(h.smartIndentation&&123===a.charCodeAt(_=v.trimRight().length-1)){var x=f-_-1,b=y.length-y.trimLeft().length;return g=125===a.charCodeAt(f+b)?s+m+r+s+m:s+m+r,t(g,e.start-x,e.end+b),e.start=e.end=e.start+s.length+m.length+r.length-x,!0}if(h.autoCompleteComments&&!c.test(v)&&(l.test(v)||d.test(v))){var w,C=l.exec(v);if(C)return g=s+m+" * ",g+=c.test(y)?y.substring(0,y.length-2).trim():y.trim(),n.getLineCount()!==o+1&&d.test(n.getLine(o+1))||(g+=s+m+" */"),t(g,e.start,e.end+y.length),e.start=e.end=e.start+s.length+m.length+3,!0;if(C=d.exec(v))for(var T=o-1;T>=0;T--){var L=n.getLine(T,!1);if(l.test(L))return c.test(y)||47===a.charCodeAt(f)?(g=s+m+"*"+y,w=e.start+s.length+m.length+1):(g=s+m+"* "+y,w=e.start+s.length+m.length+2),t(g,e.start,e.end+y.length),e.start=e.end=w,!0;if(!d.test(L))return!1}return!1}if(c.test(v)&&32===m.charCodeAt(m.length-1))return g=s+m.substring(0,m.length-1),t(g,e.start,e.end),e.start=e.end=e.start+g.length,!0;if(p>0){for(p=f;p]"),r=i.getModel();return a(this,!1,function(i,n){var s,a=i.start===r.getCharCount()?"":r.getText(i.start,i.start+1).trim();i.start===i.end&&o.test(a)?(s=e+t,n(s,i.start,i.start),i.start=i.end=i.start+1):i.start!==i.end?(s=e+r.getText(i.start,i.end)+t,n(s,i.start,i.end),i.start+=1,i.end+=1):(n(e,i.start,i.end),i.start=i.end=i.start+e.length)}),!0},autoPairQuotations:function(e){if(!this.autoPairQuotation)return!1;var t=this.editor,i=t.getTextView();if(i.getOptions("readonly"))return!1;var n=new RegExp("^\"$|^'$"),o=new RegExp("\\w"),r=new RegExp("^$|[)}\\]>]"),s=t.getModel();return a(this,!1,function(t,i){function a(){i(e,t.start,t.end),t.start=t.end=t.start+e.length}var l=0===t.start?"":s.getText(t.start-1,t.start).trim(),d=t.start===s.getCharCount()?"":s.getText(t.start,t.start+1).trim();if(t.start!==t.end){var c=s.getText(t.start,t.end);n.test(c)?a():(i(e+c+e,t.start,t.end),t.start+=1,t.end+=1)}else d===e?t.start=t.end=t.start+1:l===e||n.test(d)||o.test(l)||!r.test(d)?a():(i(e+e,t.start,t.end),t.start=t.end=t.start+e.length)}),!0},contentAssistProposalApplied:function(e){function t(){return"number"==typeof i.escapePosition?i.escapePosition:e.data.start+i.proposal.length}var i=e.data.proposal;if(i.positions&&i.positions.length>0&&this.linkedMode){for(var n=[],o=0;o0&&this.linkedMode)this.linkedMode.enterLinkedMode({groups:i.groups,escapePosition:t()});else if("number"==typeof i.escapePosition){var r=this.editor.getTextView();r.setCaretOffset(i.escapePosition)}return!0},deletePrevious:function(){var e=this.editor,t=e.getTextView();if(t.getOptions("readonly"))return!1;var i=e.getModel();return a(this,!1,function(e,t){if(e.start===e.end){var n=0===e.start?"":i.getText(e.start-1,e.start),o=e.start===i.getCharCount()?"":i.getText(e.start,e.start+1);("("===n&&")"===o||"["===n&&"]"===o||"{"===n&&"}"===o||"<"===n&&">"===o||'"'===n&&'"'===o||"'"===n&&"'"===o)&&t("",e.start,e.start+1)}},!0),!1},_findEnclosingComment:function(e,t,i,n,o){var r,s,a,l,d,c,h,u=e.getLineAtOffset(t),p=e.getLineAtOffset(i);for(r=u;r>=0&&(s=e.getLine(r),a=r===u?t-e.getLineStart(u):s.length,l=s.lastIndexOf(n,a),d=s.lastIndexOf(o,a),!(d>l));r--)if(-1!==l){c=e.getLineStart(r)+l;break}for(r=p;rl));r++)if(-1!==d){h=e.getLineStart(r)+d;break}return{commentStart:c,commentEnd:h}},lineStart:function(){var e=this.editor,t=e.getModel();return a(this,!1,function(e){var i,n=e.getCaret(),o=t.getLineAtOffset(n),r=t.getLineStart(o),s=t.getLine(o);for(i=0;ie.start?e.end-1:e.end);o=n?n.getLineCommentDelimiter(i.getLineStart(r)):"//";for(var a,l=!0,d=[],c=r;s>=c;c++){var h=i.getLine(c,!0);if(a=h.indexOf(o),d.push(a),l&&-1!==a){if(0!==a){var u;for(u=0;a>u;u++){var p=h.charCodeAt(u);if(32!==p&&9!==p)break}l=u===a}}else l=!1}var f,g,_,m=o.length,v=i.getLineStart(r);if(l){for(_=d.length-1;_>=0;_--)a=d[_]+i.getLineStart(r+_),t("",a,a+m);var y=i.getLineStart(s);f=v===e.start?e.start:e.start-m,g=e.end-m*(s-r+1)+(e.end===y+1?m:0)}else{for(_=d.length-1;_>=0;_--)a=i.getLineStart(r+_),t(o,a,a);f=v===e.start?e.start:e.start+m,g=e.end+m*(s-r+1)}e.start=f,e.end=g}),t.setRedraw(!0),!0},trimTrailingWhitespaces:function(){var e=this.editor,t=e.getModel(),i=e.getSelections();e.getTextView().setRedraw(!1),this.startUndo();for(var n=/(\s+$)/,o=t.getLineCount(),r=0;o>r;r++){var s=t.getLine(r),a=n.exec(s);if(a){var l=t.getLineStart(r),d=a[0].length,c=l+a.index;t.setText("",c,c+d),i.forEach(function(e){e.start>c&&(e.start=Math.max(c,e.start-d)),e.start!==e.end&&e.end>c&&(e.end=Math.max(c,e.end-d))})}}this.endUndo(),e.setSelections(i,!1),e.getTextView().setRedraw(!0)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},handleClosingBracket:function(e){var t=this.editor,i=t.getTextView();if(i.getOptions("readonly"))return!1;var n=t.getModel(),o=t.getSelections();if(1===o.length&&o[0].start===o[0].end){var r=o[0].start===n.getCharCount()?"":n.getText(o[0].start,o[0].start+1);if(r===e)return o[0].start=o[0].end=o[0].start+1,t.setSelections(o),!0;var s=n.getLineAtOffset(o[0].start),a=n.getLine(s,!0);if(a.match(/^\s*$/)&&i.getOptions("tabMode")){var l=i.getOptions("tabSize"),d=new Array(l+1).join(" "),c=n.getLineStart(s),h=n.getLineEnd(s);if(c!==h){if(0===a.indexOf(" "))return a=a.substring(1),n.setText(a,c,h),t.setSelection(o[0].start-1,o[0].end-1),!1;if(0===a.indexOf(d))return a=a.substring(l),n.setText(a,c,h),t.setSelection(o[0].start-l,o[0].end-l),!1}}}return!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},setAutoPairParentheses:function(e){this.autoPairParentheses=e},setAutoPairBraces:function(e){this.autoPairBraces=e},setAutoPairSquareBrackets:function(e){this.autoPairSquareBrackets=e},setAutoPairAngleBrackets:function(e){this.autoPairAngleBrackets=e},setAutoPairQuotations:function(e){this.autoPairQuotation=e},setAutoCompleteComments:function(e){this.autoCompleteComments=e},setSmartIndentation:function(e){this.smartIndentation=e}},h.SourceCodeActions=d,String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,"")}),String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")}),h}),define("orion/editor/undoStack",[],function(){function e(e,t,i,n,o){this.model=e,this.offset=t,this.text=i,this.previousText=n,this.type=o}function t(e){this.owner=e,this.changes=[]}function i(e,t){this.size=void 0!==t?t:100,this.reset();var i=this;if(this._listener={onChanging:function(e){i._onChanging(e)},onDestroy:function(e){i._onDestroy(e)}},e.getModel){var n=e.getModel();n.getBaseModel&&(n=n.getBaseModel()),this.model=n,this.setView(e)}else this.shared=!0,this.model=e;this.model.addEventListener("Changing",this._listener.onChanging)}return e.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(e,t){return this._doUndoRedo(this.offset,this.previousText,this.text,e,t),!0},redo:function(e,t){return this._doUndoRedo(this.offset,this.text,this.previousText,e,t),!0},merge:function(e,t,i,n,o){if(n===this.type){if(1===n&&e===this.offset+this.text.length)return this.text+=t,!0;if(-1===n&&o===this.offset)return this.offset=e,this.previousText=i+this.previousText,!0;if(-1===n&&e===this.offset)return this.previousText=this.previousText+i,!0}return!1},_doUndoRedo:function(e,t,i,n,o){if(this.model.setText(t,e,e+i.length),o&&n){var r=n.getModel();r!==this.model&&(e=r.mapOffset(e,!0)),n.setSelection(e,e+t.length)}}},t.prototype={getRedoChanges:function(){for(var e=[],t=0;t=0;t--)e=e.concat(this.changes[t].getUndoChanges());return e},add:function(e){this.changes.push(e)},end:function(e){e&&(this.endSelection=e.getSelections());var t=this.owner;t&&t.end&&t.end()},undo:function(e,t){this.changes.length>1&&e&&e.setRedraw(!1);for(var i=this.changes.length-1;i>=0;i--)this.changes[i].undo(e,!1);t&&e&&e.setSelections(this.startSelection),this.changes.length>1&&e&&e.setRedraw(!0);var n=this.owner;return n&&n.undo&&n.undo(),this.changes.length>0},redo:function(e,t){this.changes.length>1&&e&&e.setRedraw(!1);for(var i=0;i1,e&&e.setRedraw(!0);var n=this.owner;return n&&n.redo&&n.redo(),this.changes.length>0},merge:function(e,t,i,n,o,r){var s=this.changes.length;return s>0&&this===r?this.changes[s-1].merge(e,t,i,n,o):!1},start:function(e){e&&(this.startSelection=e.getSelections());var t=this.owner;t&&t.start&&t.start()}},i.prototype={destroy:function(){this._onDestroy()},add:function(e){if(this.compoundChange)this.compoundChange.add(e);else{var t=this.stack.length;this.stack.splice(this.index,t-this.index,e),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--)}},markClean:function(){this._commitUndo(),this.cleanChange=this.stack[this.index-1],this.cleanChange&&(this.cleanChange.type=2)},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return this.index>0},canRedo:function(){return this.stack.length-this.index>0},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view),this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var e=[],t=this.index;t=0;t--)e=e.concat(this.stack[t].getUndoChanges());return e},undo:function(){this._commitUndo();var e,t=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;e=this.stack[--this.index]}while(!(t=e.undo(this.view,!0)));return this._ignoreUndo=!1,t},redo:function(){this._commitUndo();var e,t=!1;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;e=this.stack[this.index++]}while(!(t=e.redo(this.view,!0)));return this._ignoreUndo=!1,t},reset:function(){this.index=0,this.cleanChange=void 0,this.stack=[],this._ignoreUndo=!1,this._compoundChange=void 0},setView:function(e){this.view!==e&&(this.view&&e.removeEventListener("Destroy",this._listener.onDestroy),this.view=e,this.view&&e.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(e){this._commitUndo();var i=new t(e);return this.add(i),this.compoundChange=i,this.compoundChange.start(this.view),this.compoundChange},_commitUndo:function(){this.endCompoundChange()},_onDestroy:function(e){e&&this.shared||this.model.removeEventListener("Changing",this._listener.onChanging),this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_trackUnsavedChanges:function(e){if(this._unsavedChanges){var t=this._unsavedChanges.length,i=e.addedCharCount,n=e.removedCharCount,o=e.start,r=e.start+n,s=0;if(0===i?s=-1:0===n&&(s=1),t>0&&s===this._previousChangeType){var a=this._unsavedChanges[t-1];if(0===n&&o===a.end+a.text.length)return void(a.text+=e.text);if(0===e.addedCharCount&&r===a.start)return void(a.start=o)}this._previousChangeType=s,this._unsavedChanges.push({start:o,end:r,text:e.text})}},_onChanging:function(t){if(this._trackUnsavedChanges(t),!this._ignoreUndo){var i=t.text,n=t.start,o=t.addedCharCount,r=t.removedCharCount,s=n+r,a=0;0===o&&1===r?a=-1:1===o&&0===r&&(a=1);var l=this.stack.length,d=this.model.getText(n,s);if(l>0&&this.index===l){var c=this.stack[l-1];if(c.merge(n,i,d,a,s,this.compoundChange))return}this.add(new e(this.model,n,i,d,a))}}},{UndoStack:i}}),define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/textView","orion/editor/annotations","orion/editor/tooltip","orion/objects","orion/editor/util","orion/util"],function(e,t,i,n,o,r,s){function a(e,t,i){this._location=e||"left",this._overview=t||"page",this._rulerStyle=i,this._view=null}function l(e,t,i,n){a.call(this,t,i,n);var o=this;this._listener={onTextModelChanged:function(e){o._onTextModelChanged(e)},onAnnotationModelChanged:function(e){o._onAnnotationModelChanged(e)}},this.setAnnotationModel(e)}function d(e,t,i,n,o){l.call(this,e,t,"page",i),this._oddStyle=n||{style:{backgroundColor:"white"}},this._evenStyle=o||{style:{backgroundColor:"white"}},this._numOfDigits=0,this._firstLine=1}function c(e,t,i){l.call(this,e,t,"page",i)}function h(e,t,i){l.call(this,e,t,"document",i)}function u(e,t,i){c.call(this,e,t,i)}a.prototype={getLocation:function(){return this._location},getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},setView:function(e){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged),this._view=e,this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)}},l.prototype=o.mixin(new a,{getAnnotations:function(e,t){var i=this._annotationModel;if(!i)return[];var n=this._view.getModel(),o=n.getLineStart(e),r=n.getLineEnd(t-1),s=n;n.getBaseModel&&(s=n.getBaseModel(),o=n.mapOffset(o),r=n.mapOffset(r));for(var a=[],l=this.getAnnotationsByType(i,o,r),d=0;d=p;p++){var f=p;if(n!==s){var g=s.getLineStart(p);if(g=n.mapOffset(g,!0),-1===g)continue;f=n.getLineAtOffset(g)}if(f>=e&&t>f){var _=this._mergeAnnotation(a[f],c,p-h,u-h+1);_&&(a[f]=_)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var m in a)a[m]._multiple&&(a[m].html=a[m].html+this._multiAnnotationOverlay.html);
+return a},getAnnotationModel:function(){return this._annotationModel},getWidestAnnotation:function(){return null},setAnnotationModel:function(e){this._annotationModel&&this._annotationModel.removeEventListener("Changed",this._listener.onAnnotationModelChanged),this._annotationModel=e,this._annotationModel&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(e){this._multiAnnotation=e},setMultiAnnotationOverlay:function(e){this._multiAnnotationOverlay=e},onClick:function(e){if(void 0!==e){var t,i,o,r=this._view,s=r.getModel(),a=s.getLineStart(e),l=s.getLineEnd(e,!0),d=r.getSelection().start,c=r.getSelection().end,h=this._annotationModel;if(h){s.getBaseModel&&(a=s.mapOffset(a),l=s.mapOffset(l),d=s.mapOffset(d),c=s.mapOffset(c));var u=this;t=this._findNextAnnotation(h,a,l,d,c,function(e){return u.isAnnotationTypeVisible(e)}),i=t?t.start:a,o=t?t.end:a,s.getBaseModel&&(i=s.mapOffset(i,!0),o=s.mapOffset(o,!0)),t&&void 0!==t.groupId&&(this._currentClickGroup=this._currentClickGroup===t.groupId?null:t.groupId,this._setCurrentGroup(e))}this._view.setSelection(o,i,1/3,function(){});var p=n.Tooltip.getTooltip(this._view);p&&(t&&"left"===this.getLocation()?p.show({getTooltipInfo:function(){return u._getTooltipInfo([t])}},!1,!1):p.hide())}},onDblClick:function(){},onMouseMove:function(e,t){var i=n.Tooltip.getTooltip(this._view);if(i&&(!i.isVisible()||this._tooltipLineIndex!==e)&&(this._tooltipLineIndex=e,t.clientX!==this._lastMouseX||t.clientY!==this._lastMouseY)){this._lastMouseX=t.clientX,this._lastMouseY=t.clientY,this._hoverTimeout&&(window.clearTimeout(this._hoverTimeout),this._hoverTimeout=null);var o=t.target?t.target:t.srcElement,r=o.getBoundingClientRect();this._curElementBounds=Object.create(null),this._curElementBounds.top=r.top,this._curElementBounds.left=r.left,this._curElementBounds.height=r.height,this._curElementBounds.width=r.width,o===this.node&&(this._curElementBounds.top=t.clientY,this._curElementBounds.height=1);var s=this;s._hoverTimeout=window.setTimeout(function(){s._hoverTimeout=null,i.onHover({getTooltipInfo:function(){var e=s._getAnnotationsAtLineIndex(s._tooltipLineIndex),i=s._getTooltipContents(s._tooltipLineIndex,e);return s._getTooltipInfo(i,t.clientY,{source:"ruler",rulerLocation:s.getLocation()})}},t.clientX,t.clientY)},175)}},onMouseOver:function(e,t){this.onMouseMove(e,t),this._currentClickGroup||this._setCurrentGroup(e)},onMouseOut:function(){this._currentClickGroup||this._setCurrentGroup(-1),this._hoverTimeout&&(window.clearTimeout(this._hoverTimeout),this._hoverTimeout=null)},_findNextAnnotation:function(e,t,i,n,o,r){var s,a=null,l=t;if(n>=0&&o>=0&&n>=t&&i>n){l=n;for(var d=e.getAnnotations(n,o);!s&&d.hasNext();){var c=d.next();(!r||r(c.type))&&c.start===n&&c.end===o&&(s=c)}}for(var h,u=e.getAnnotations(l,i);u.hasNext();)if(c=u.next(),!r||r(c.type)){if(a||(a=c),!s){a=c;break}if(h&&(s.start!==c.start||s.end!==c.end)){h=!1,a=c;break}s&&s===c&&(h=!0)}return h&&(a=null),a},_getAnnotationsAtLineIndex:function(e){if(void 0!==e){var t,i=this._view,n=this._annotationModel,o=[];if(!i)return[];if(t=i.getModel(),n&&t){var r=t.getLineStart(e),s=t.getLineEnd(e);t.getBaseModel&&(r=t.mapOffset(r),s=t.mapOffset(s)),o=this.getAnnotationsByType(n,r,s)}return o}},_getTooltipInfo:function(e,t,i){if(!e)return null;var n=Object.create(null);n.top=this._curElementBounds.top,n.left=this._curElementBounds.left,n.height=this._curElementBounds.height,n.width=this._curElementBounds.width,"string"==typeof e&&t&&(n.top=t,n.height=1);var o=this.getLocation(),r=this.getRulerStyle(),s="left"===o?"right":"left",a=0,l=0;if(this._view){var d=this._view._clientDiv.getBoundingClientRect();a=d.left-(n.left+n.width)}else a=n.width;l=n.height,"left"===s&&(a=-25,1===n.height&&(a+=2)),r.styleClass.indexOf("folding")>=0&&(l-=14);var c={contents:e,position:s,tooltipOffsetX:a,tooltipOffsetY:l,anchorArea:n,context:i};return c},_getTooltipContents:function(e,t){return t},_getOnClickTooltipInfo:function(e){var t=this._view,i=Object.create(null);i.top=this._curElementBounds.top,i.left=this._curElementBounds.left,i.height=this._curElementBounds.height,i.width=this._curElementBounds.width;var n=this.getLocation(),o="left"===n?"right":"left",r={contents:[e],position:o,anchorArea:i};if(t){var s=t._clientDiv.getBoundingClientRect();r.offsetX=s.left-(i.left+i.width)}else r.offsetX=i.width;return r.offsetY=i.height,"left"===r.position&&(r.offsetX=20),r},_onAnnotationModelChanged:function(e){function t(e){for(var t=0;t=l&&void 0!==t.groupId){o=t;break}if(s&&o&&s.groupId===o.groupId)return}if(this._currentGroupAnnotation=null,s&&n.removeAnnotations(s.groupType),o&&-1!==e){this._currentGroupAnnotation=o,i=n.getAnnotations();for(var d=[];i.hasNext();)t=i.next(),delete t.groupAnnotation,t.groupId===o.groupId&&(t=t.createGroupAnnotation(),d.push(t));n.replaceAnnotations(null,d)}}}),i.AnnotationTypeList.addMixin(l.prototype),d.prototype=new l,d.prototype.getAnnotations=function(e,t){for(var i=l.prototype.getAnnotations.call(this,e,t),n=this._view.getModel(),o=e;t>o;o++){var r=o-this._firstLine&1?this._oddStyle:this._evenStyle,s=o;if(n.getBaseModel){var a=n.getLineStart(s);s=n.getBaseModel().getLineAtOffset(n.mapOffset(a))}i[o]||(i[o]={}),i[o].html=this._firstLine+s+"",i[o].style||(i[o].style=r)}return i},d.prototype.getWidestAnnotation=function(){var e=this._view.getModel().getLineCount();return this.getAnnotations(e-1,e)[e-1]},d.prototype.setFirstLine=function(e){this._firstLine=void 0!==e?e:1},d.prototype._onTextModelChanged=function(e){var t=e.start,i=this._view.getModel(),n=i.getBaseModel?i.getBaseModel().getLineCount():i.getLineCount(),o=(this._firstLine+n-1+"").length;if(this._numOfDigits!==o){this._numOfDigits=o;var r=i.getLineAtOffset(t);this._view.redrawLines(r,i.getLineCount(),this)}},c.prototype=new l,h.prototype=new l,h.prototype.getRulerStyle=function(){var e={style:{lineHeight:"1px",fontSize:"1px"}};return e=this._mergeStyle(e,this._rulerStyle)},h.prototype._getTooltipContents=function(t,i){if(i&&0===i.length){var n=this._view.getModel(),o=t;if(n.getBaseModel){var r=n.getLineStart(o);o=n.getBaseModel().getLineAtOffset(n.mapOffset(r))}return s.formatMessage(e.line,o+1)}return l.prototype._getTooltipContents.call(this,t,i)},h.prototype._mergeAnnotation=function(e,t,i,n){if(0!==i)return void 0;var o=e;if(!o){var r=3*n;o={html:" ",style:{style:{height:r+"px"}}},o.style=this._mergeStyle(o.style,t.overviewStyle)}return o},u.prototype=new c,u.prototype.onClick=function(e){if(void 0!==e){var t=this._annotationModel;if(t){var i=this._view,o=i.getModel(),r=o.getLineStart(e),s=o.getLineEnd(e,!0);o.getBaseModel&&(r=o.mapOffset(r),s=o.mapOffset(s),o=o.getBaseModel());for(var a,l=t.getAnnotations(r,s);!a&&l.hasNext();){var d=l.next();this.isAnnotationTypeVisible(d.type)&&o.getLineAtOffset(d.start)===o.getLineAtOffset(r)&&(a=d)}if(a){var c=n.Tooltip.getTooltip(this._view);c&&c.hide(),a.expanded?a.collapse():a.expand()}}}},u.prototype._getTooltipContents=function(e,t){if(t&&t.length>0){var i=this._view,n=i.getModel(),o=n.getLineStart(e);n.getBaseModel&&(o=n.mapOffset(o),n=n.getBaseModel());for(var r=n.getLineAtOffset(o),s=0;s=e.end?s-=e.end-e.start:s>=e.start&&(s=e.start)}),i.setText(r,s,s),i.setSelection(s,s+r.length),this._dropText=null,this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange(),this._dragSelection=null}},_onDragEnter:function(e){this._onDragOver(e)},_onDragOver:function(t){var i=t.event.dataTransfer.types,n=!this._view.getOptions("readonly");if(n&&i&&(n=i.contains?i.contains("text/plain")||i.contains("Text"):-1!==i.indexOf("text/plain")||-1!==i.indexOf("Text")),n){if(!e.isFirefox){var o=e.isMac?t.event.altKey:t.event.ctrlKey;this._dropEffect=t.event.dataTransfer.dropEffect=o?"copy":"move"}}else t.event.dataTransfer.dropEffect="none"},_onDrop:function(t){var i=this._view,n=t.event.dataTransfer.getData("Text");if(n){e.isFirefox||(t.event.dataTransfer.dropEffect=this._dropEffect);var o=i.getOffsetAtLocation(t.x,t.y);this._dragSelection?(this._dropOffset=o,this._dropText=n):(i.setText(n,o,o),i.setSelection(o,o+n.length))}}},{TextDND:t}}),define("orion/editor/linkedMode",["i18n!orion/editor/nls/messages","orion/keyBinding","orion/editor/keyModes","orion/editor/annotations","orion/objects","orion/util"],function(e,t,i,n,o){function r(e){this._data=e}function s(e,t,n){var o=e.getTextView();i.KeyMode.call(this,o),this.editor=e,this.undoStack=t,this.contentAssist=n,this.linkedModeModel=null,o.setAction("linkedModeEnter",function(){return this.exitLinkedMode(!0),!0}.bind(this)),o.setAction("linkedModeCancel",function(){return this.exitLinkedMode(!0),!0}.bind(this)),o.setAction("linkedModeNextGroup",function(){var e=this.linkedModeModel;return this.selectLinkedGroup((e.selectedGroupIndex+1)%e.groups.length),!0}.bind(this)),o.setAction("linkedModePreviousGroup",function(){var e=this.linkedModeModel;return this.selectLinkedGroup(e.selectedGroupIndex>0?e.selectedGroupIndex-1:e.groups.length-1),!0}.bind(this)),this.linkedModeListener={onActivating:function(){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(e){if(!this.ignoreVerify){for(var t,i,n=this.editor.mapOffset(e.start),o=this.linkedModeModel;o&&(t=this._getPositionChanged(o,n,n+e.removedCharCount),i=t.position,void 0===i||i.model!==o);)this.exitLinkedMode(!1),o=this.linkedModeModel;if(o){for(var r,s,a=0,l=e.addedCharCount-e.removedCharCount,d=t.positions,c=0;c=0;f--)l=h[f],l.model===r&&l.group===i.group&&this.editor.setText(e.text,l.oldOffset+u,l.oldOffset+p,!1);this.ignoreVerify=!1,e.text=null,this._updateAnnotations(h)}}}.bind(this)}}var a={};return r.prototype={chop:function(e,t){return t.substring(e.length)},computeProposals:function(e,t,i){var n=i.prefix,o=[],r=this._data.style?this._data.style:null;r=r?r:"emphasis";for(var s=this._data.values,a=0;a=0;r--)if(!o[r].escape){var s=o[r].position;if(s.offset<=t&&i<=s.offset+s.length){n=o[r];break}}return{position:n,positions:o}},_updateAnnotations:function(e){var t=this.editor.getAnnotationModel();if(t){for(var i,o=[],r=[],s=t.getAnnotations();s.hasNext();)switch(i=s.next(),i.type){case n.AnnotationType.ANNOTATION_LINKED_GROUP:case n.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case n.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:o.push(i)}var a=this.linkedModeModel;if(a){e=e||this._getSortedPositions(a);for(var l=0;l0?(localStorage.setItem(this._prefix+this._offsetStorageLabel,this._offset),this._closed=!1):this._closed=!0,e!==this._closed&&(localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null),i.logEvent("preferenceChange","splitterClosed",this._prefix,this._closed?0:1))},_mouseDown:function(e){return e.target===this._thumb?(n.stop(e),this._thumbDown()):void(this._tracking||(this._down(e),this._tracking=this._mouseMove.bind(this),window.addEventListener("mousemove",this._tracking),n.setFramesEnabled(!1),n.stop(e)))},_mouseMove:function(e){this._tracking&&(this._move(e.clientX,e.clientY),this._resize())},_mouseUp:function(e){this._tracking&&(n.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this._up(),n.stop(e))},_touchStart:function(e){var t=e.touches;if(1===t.length){if(n.stop(e),e.target===this._thumb)return this._thumbDown();this._down(e),this._touching=!0}},_touchMove:function(e){if(this._touching){var t=e.touches;if(1===t.length){var i=t[0];this._move(i.clientX,i.clientY)}}},_touchEnd:function(e){var t=e.touches;0===t.length&&(this._touching=!1,this._up())}},o.prototype.constructor=o,{Splitter:o,ORIENTATION_HORIZONTAL:r,ORIENTATION_VERTICAL:s}}),define("text!orion/compare/sideBySideTemplate.html",[],function(){return'\r\n'}),define("orion/compare/compareUIFactory",["orion/webui/littlelib","orion/webui/splitter","text!orion/compare/sideBySideTemplate.html"],function(e,t,i){var n=n||{};return n.TwoWayCompareUIFactory=function(){function n(e){this._parentDivID=e.parentDivID,this._commandSpanId=e.commandSpanId,this._showTitle=e.showTitle,this._leftTitle=e.leftTitle,this._rightTitle=e.rightTitle,this._showLineStatus=e.showLineStatus}return n.prototype={_init:function(){var t=this._parentDivID+"_";this._topWidgetDiv=e.node("topWidget_id"),this._topWidgetDiv.id=t+"topWidget_id",this._leftEditorParentDiv=e.node("left_editor_id"),this._leftEditorParentDiv.id=t+"left_editor_id",this._rightEditorParentDiv=e.node("right_editor_id"),this._rightEditorParentDiv.id=t+"right_editor_id",this._rightEditorWrapperDiv=e.node("right_editor_wrapper_id"),this._rightEditorWrapperDiv.id=t+"right_editor_wrapper_id",this._leftActionDiv=e.node("left_action_id"),this._leftActionDiv.id=t+"left_action_id",this._rightActionDiv=e.node("right_action_id"),this._rightActionDiv.id=t+"right_action_id",this._leftTitleDiv=e.node("left_title_id"),this._leftTitleDiv.id=t+"left_title_id",this._rightTitleDiv=e.node("right_title_id"),this._rightTitleDiv.id=t+"right_title_id",this._leftStatusDiv=e.node("left_status_id"),this._leftStatusDiv.id=t+"left_status_id",this._rightStatusDiv=e.node("right_status_id"),this._rightStatusDiv.id=t+"right_status_id",this._diffCanvasDiv=e.node("diff_canvas_id"),this._diffCanvasDiv.id=t+"diff_canvas_id",this._splitterId=t+"orion_splitter",this._showTitle||this.disableTitle(),this._showLineStatus||this.disableLineStatus()},_createSplitter:function(){var i=e.$(".split",this._topWidgetDiv);i.id=this._splitterId;var n=e.$(".leftPanelLayout",this._topWidgetDiv),o=e.$(".rightPanelLayout",this._topWidgetDiv);i&&n&&o&&(this._splitter=new t.Splitter({node:i,sidePanel:n,mainPanel:o,proportional:!0}))},buildUI:function(){e.node(this._parentDivID).innerHTML=i,this._init(),this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(t){var i=e.$(".leftPanelLayout",this._topWidgetDiv);return i===t},getEditorParentDiv:function(e){return e?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(e){return e?this._leftTitleDiv:this._rightTitleDiv},getActionDivId:function(e){return e?this._leftActionDiv.id:this._rightActionDiv.id},getStatusDiv:function(e){return e?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},getDiffCanvasDiv:function(){return this._diffCanvasDiv},disableTitle:function(){this._leftEditorParentDiv.style.top="0px",this._rightEditorWrapperDiv.style.top="0px",this._leftTitleDiv.style.height="0px",this._rightTitleDiv.style.height="0px"},disableLineStatus:function(){this._leftEditorParentDiv.style.marginBottom="0px",this._rightEditorWrapperDiv.style.marginBottom="0px",this._leftStatusDiv.style.height="0px",this._rightStatusDiv.style.height="0px"}},n}(),n});var JsDiff=function(){function e(e){return{newPos:e.newPos,components:e.components.slice(0)}}function t(e){for(var t=[],i=0;i/g,">"),t=t.replace(/"/g,""")}var n=function(e){this.ignoreWhitespace=e};n.prototype={diff:function(t,i,n){if(this.ignoreWhitespace=n,i===t)return[{value:i}];if(!i)return[{value:t,removed:!0}];if(!t)return[{value:i,added:!0}];i=this.tokenize(i),t=this.tokenize(t);var o=i.length,r=t.length,s=o+r,a=[{newPos:-1,components:[]}],l=this.extractCommon(a[0],i,t,0);if(a[0].newPos+1>=o&&l+1>=r)return a[0].components;for(var d=1;s>=d;d++)for(var c=-1*d;d>=c;c+=2){var h,u=a[c-1],p=a[c+1];l=(p?p.newPos:0)-c,u&&(a[c-1]=void 0);var f=u&&u.newPos+1=0&&r>l;if(f||g){!f||g&&u.newPos=o&&l+1>=r)return h.components;a[c]=h}else a[c]=void 0}},pushComponent:function(e,t,i,n,o){var r=e[e.length-1];r&&r.added===n&&r.removed===o?e[e.length-1]={value:this.join(r.value,t),helperValue:this.join(r.helperValue,i),added:n,removed:o}:e.push({value:t,helperValue:i,added:n,removed:o})},extractCommon:function(e,t,i,n){for(var o=t.length,r=i.length,s=e.newPos,a=s-n;o>s+1&&r>a+1&&this.equals(t[s+1],i[a+1]);)s++,a++,this.pushComponent(e.components,t[s],i[a],void 0,void 0);return e.newPos=s,a},equals:function(e,t){var i=/\S/;return!this.ignoreWhitespace||i.test(e)||i.test(t)?this._equals(e,t):!0},join:function(e,t){return e+t},tokenize:function(e){return e}};var o=new n;o._equals=function(e,t){return e===t};var r=new n(!1);r.tokenize=function(e){return t(e.split(/(\s+|\b)/))},r._equals=function(e,t){return e===t};var s=new n(!0);s.tokenize=function(e){return t(e.split(/([{}:;,]|\s+)/))},s._equals=function(e,t){return e===t};var a=new n;return a.tokenize=function(e){var t=e.split(/^/m);return t&&t.length>0&&!t[t.length-1]&&t.pop(),t},a._equals=function(e,t){if(this.ignoreWhitespace){var i=e.replace(/^\s+|\s+$|\s+(?=\s)/g,""),n=t.replace(/^\s+|\s+$|\s+(?=\s)/g,"");return i===n}return e===t},{diffChars:function(e,t,i){return o.diff(e,t,i)},diffWords:function(e,t,i){return r.diff(e,t,i)},diffLines:function(e,t,i){return a.diff(e,t,i)},diffCss:function(e,t){return s.diff(e,t)},createPatch:function(e,t,i,n,o){var r=[];r.push("Index: "+e),r.push("==================================================================="),r.push("--- "+e+" "+n),r.push("+++ "+e+" "+o);var s=a.diff(t,i);s.push({value:"",lines:[]});for(var l=0,d=0,c=[],h=1,u=1,p=0;p1&&!/\n$/.test(s[s.length-2].value)&&r.push("\\ No newline at end of file\n"),r.join("\n")},convertChangesToXML:function(e){for(var t=[],n=0;n"):o.removed&&t.push(""),t.push(i(o.value)),o.added?t.push(""):o.removed&&t.push("")}return t.join("")}}}();"undefined"!=typeof module&&(module.exports=JsDiff),"function"==typeof define&&define.amd&&define("jsdiff/diff",[],function(){return JsDiff}),define("orion/compare/jsdiffAdapter",["jsdiff/diff"],function(e){var t=t||{};return t.JSDiffAdapter=function(){function t(e){this._ignoreWhitespace=e}return t.prototype={_specialLine:function(e,t,i){return t.value===e&&i!==e},adapt:function(t,i,n){n||(n="\n");for(var o=t.split(n),r=i.split(n),s=""===o[o.length-1],a=""===r[r.length-1],l=e.diffLines(t,i,this._ignoreWhitespace),d=[],c=[],h=0,u=0,p=-1,f=0,g=!0,_=n,m=0;m1&&""===y[y.length-1]&&x--,x>1&&!g&&""===y[0]&&(x--,b++),v.lines=y,v.added||v.removed)if(v.added){-1===p&&(p=c.length+1),h+=x;for(var w=b;x+b>w;w++)c.push(v.lines[w])}else u+=x;else this._specialLine(n,v,_)||((h||u)&&(d.push([h,u,p]),h=0,u=0,p=-1,f+=u),d.push([x,x,0]),f+=x);g=!1,y.length>1&&""===y[y.length-1]&&(g=!0),_=v.value?v.value[v.value.length-1]:n}if((h||u)&&(d.push([h,u,p]),f+=u),f1){var C=d[d.length-1];0===C[2]?(C[0]+=1,C[1]+=1):-1===C[2]?d.push([1,1,0]):s===a?d.push([1,1,0]):(a&&(C[0]+=1),s&&(C[1]+=1))}return{mapper:d,changContents:{array:c,index:0}}},adaptCharDiff:function(t,i,n){for(var o=n?e.diffWords(t,i,this._ignoreWhitespace):e.diffChars(t,i,this._ignoreWhitespace),r=[],s=0,a=0,l=0,d=0,c=0;c0||d>0)&&(r.push([a,a+l,s,s+d]),a+=l,s+=d,l=0,d=0),a+=h.value.length,s+=h.helperValue?h.helperValue.length:h.value.length)}return(l>0||d>0)&&r.push([a,a+l,s,s+d]),r}},t}(),t}),define("orion/treeModelIterator",[],function(){var e={};return e.TreeModelIterator=function(){function e(e,t){this.firstLevelChildren=e,this.reset(),this._init(t)}return e.prototype={_init:function(e){e&&(this.isExpanded=e.isExpanded,this.isExpandable=e.isExpandable,this.forceExpandFunc=e.forceExpandFunc,this.getChildrenFunc=e.getChildrenFunc)},topLevel:function(e){return e.parent?e.parent===this.root:!0},_getChildren:function(e){return"function"==typeof this.getChildrenFunc?this.getChildrenFunc(e):e?e.children:null},_expanded:function(e){if(!e)return!0;var t=this._getChildren(e),i=t&&t.length>0;return this.isExpanded&&i&&(i=this.isExpanded(e)),i},_expandable:function(e){return e?this.isExpandable?this.isExpandable(e):!1:!0},_diveIn:function(e){if(this._expanded(e)){var t=this._getChildren(e);return this.setCursor(t[0]),this.cursor()}return null},_drillToLast:function(e){if(this._expanded(e)){var t=this._getChildren(e);return this._drillToLast(t[t.length-1])}return e},_forward:function(e){if(!this._cursor)return null;var t=this._diveIn(this._cursor);if(!t){if(e&&this._expandable(this._cursor)&&this.forceExpandFunc){var i=this;return this.forceExpandFunc(this._cursor,"first",function(e){e&&i.setCursor(e)})}t=this._findSibling(this._cursor,!0),t&&this.setCursor(t)}return t},_backward:function(e){if(!this._cursor)return null;var t=this._findSibling(this._cursor,!1);if(t&&t!==this._cursor.parent&&(t=this._drillToLast(t)),e&&t&&this._expandable(t)&&this.forceExpandFunc&&t!==this._cursor.parent){var i=this;return this.forceExpandFunc(t,"last",function(e){e&&i.setCursor(e)})}return t&&this.setCursor(t),t},_findSibling:function(e,t){for(var i=this.topLevel(e),n=this._getChildren(e.parent),o=i?this.firstLevelChildren:n,r=0;r0&&(this.root=this.firstLevelChildren[0].parent)},scan:function(e,t){var i=this.cursor(),n=this._scan(!0,e,t);return n||(n=this._scan(!1,e,t)),this.setCursor(i),n},iterate:function(e,t){return e?this._forward(t):this._backward(t)},iterateOnTop:function(e,t){var i=this._findSibling(this._getTopLevelParent(this.cursor()),e);i?this.setCursor(i):t&&this.firstLevelChildren.length>0&&this.setCursor(e?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(e){return this._cursor&&this._inParentChain(this._cursor,e)?(this.setCursor(e),this._cursor):null},reset:function(){this._cursor=null,this._prevCursor=null,this.root=null,this.firstLevelChildren.length>0&&(this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent)},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}},e}(),e}),define("orion/compare/diffTreeNavigator",["i18n!orion/compare/nls/messages","orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(e,t,i,n,o){var r={},s={};return r.DiffTreeNavigator=function(){function r(e,t,i,n,o,r){this._root={type:"root",children:[]},this._initialized=!1,this.initAll(e,t,i,n,o,r)}s.ANNO_DIFF_ADDED_BLOCK="orion.annotation.diff.addedBlock",s.ANNO_DIFF_CURRENT_ADDED_BLOCK="orion.annotation.diff.currentAddedBlock",s.ANNO_DIFF_DELETED_BLOCK="orion.annotation.diff.deletedBlock",s.ANNO_DIFF_CURRENT_DELETED_BLOCK="orion.annotation.diff.currentDeletedBlock",s.ANNO_DIFF_BLOCK_TOPONLY="orion.annotation.diff.blockTop",s.ANNO_DIFF_CURRENT_BLOCK_TOPONLY="orion.annotation.diff.currentBlockTop",s.ANNO_DIFF_BLOCK_CONFLICT="orion.annotation.diff.blockConflict",s.ANNO_DIFF_CURRENT_BLOCK_CONFLICT="orion.annotation.diff.currentBlockConflict",s.ANNO_DIFF_ADDED_WORD="orion.annotation.diff.addedWord",s.ANNO_DIFF_CURRENT_ADDED_WORD="orion.annotation.diff.currentAddedWord",s.ANNO_DIFF_DELETED_WORD="orion.annotation.diff.deletedWord",s.ANNO_DIFF_CURRENT_DELETED_WORD="orion.annotation.diff.currentDeletedWord",s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT="orion.annotation.diff.emptyDeletedWordLeft",s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT="orion.annotation.diff.emptyDeletedWordRight",s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT="orion.annotation.diff.emptyAddedWordLeft",s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT="orion.annotation.diff.emptyAddedWordRight",n.AnnotationType.registerType(s.ANNO_DIFF_ADDED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_ADDED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_DELETED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_DELETED_BLOCK,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_BLOCK_TOPONLY,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_BLOCK_TOPONLY,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}}),n.AnnotationType.registerType(s.ANNO_DIFF_BLOCK_CONFLICT,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_BLOCK_CONFLICT,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}}),n.AnnotationType.registerType(s.ANNO_DIFF_ADDED_WORD,{title:e["word added"],html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_ADDED_WORD,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_DELETED_WORD,{title:e["word deleted"],html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_CURRENT_DELETED_WORD,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}}),n.AnnotationType.registerType(s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});var a=5e3;return r.prototype={initAll:function(e,t,i,n,o,r,s){this._charOrWordDiff=e?e:"word",t&&(this._initialized=!0),this.editorWrapper=[{editor:t,diffFeeder:n},{editor:i,diffFeeder:o}],this._curveRuler=s,this._overviewRuler=r,this._overviewRuler&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(e){if(e)for(var t=0;t0&&this.iterator.iterate(e),this.updateCurrentAnnotation(!0)}return t},gotoChangeUsingIndex:function(e){var t=0,i=0;if(e>=0)for(;it+n-1)){var o=e-t;return this.gotoBlock(i,o)}t+=n,i++}},gotoBlock:function(e,t){this.iterator&&((0>e||e>=this._root.children.length||0===this._root.children.length)&&(e=0),this.iterator.setCursor(void 0!==t&&t>=0&&this._root.children[e].children&&t=r.start&&t<=r.end){var s=o;if(o.children&&o.children.length>0)for(var a=0;a=d.start&&t<=d.end){s=l;break}}return s}}return null}},gotoChange:function(e,t){for(var i=0;ie&&(e=0);var t=this.getFeeder().getDiffBlocks();return t&&0!==t.length?(e>t.length-1&&(e=0),t[e][1]):-1},replaceDiffAnnotations:function(e,t,i,n){if(t&&i){var o=e.getAnnotationModel();if(o){for(var r=o.getAnnotations(),s=[];n&&r.hasNext();){var a=r.next();a.type===i&&s.push(a)}o.replaceAnnotations(s,t)}}},updateCurrentAnnotation:function(e,t){if(this.replaceAllAnnotations(!0,0,"block",!1,[]),this.replaceAllAnnotations(!0,1,"block",!1,[]),this.replaceAllAnnotations(!0,0,"word",!1,[]),this.replaceAllAnnotations(!0,1,"word",!1,[]),this.iterator){var i=this.iterator.cursor();if(i){var o,r,s={start:i.oldA.start,end:i.oldA.end},a={start:i.newA.start,end:i.newA.end};"word"===i.type?(o=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(s,this.editorWrapper[0].editor.getTextView().getModel()),r=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(a,this.editorWrapper[1].editor.getTextView().getModel())):(o=this.editorWrapper[0].diffFeeder.getCurrentBlockAnnoType(i.index),r=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(i.index)),o&&this.replaceDiffAnnotations(this.editorWrapper[0].editor,[new(n.AnnotationType.getType(o.current))(s.start,s.end)],o,!0),r&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new(n.AnnotationType.getType(r.current))(a.start,a.end)],r,!0),e?(this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(i.oldA.start,i.oldA.end,!0),this.editorWrapper[1].editor.setSelection(i.newA.start,i.newA.end,!0),this.autoSelecting=!1):t&&(this.autoSelecting=!0,t!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(i.oldA.start,i.oldA.end,!0),t!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(i.newA.start,i.newA.end,!0),this.autoSelecting=!1)}}},generatePairBlockAnnotations:function(e,t){var i=this.generateBlockDiffAnnotations(0,t),n=this.generateBlockDiffAnnotations(1,t);return{parent:e,index:t,type:"block",oldA:i,newA:n}},generatePairWordAnnotations:function(e,t,i){var n=this.editorWrapper[0].diffFeeder.getTextOnBlock(t),o=this.editorWrapper[1].diffFeeder.getTextOnBlock(t),r=null,s=0,l=0;if(!(n&&o&&n.text&&o.text&&n.text.length<=a&&o.text.length<=a))return null;r=i.adaptCharDiff(n.text,o.text,"word"===this._charOrWordDiff),l=o.start,s=n.start;var d=[],c=[];this.generateWordDiffAnnotations(0,d,s,r,2,3),this.generateWordDiffAnnotations(1,c,l,r,0,1);for(var h=[],u=0;u0?t-o:0)},_positionDiffBlock:function(){var e=this.getCurrentBlockIndex();0>e&&(e=0);var t=this.getFeeder().getDiffBlocks();if(0!==t.length){if(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),t[e][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor){var n=i.lookUpLineIndex(this.getMapper(),0,t[e][1]);this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),n)}this._updateOverviewRuler(),this._updateCurveRuler()}},matchPositionFromOverview:function(e){if(this._initialized){var t;t=0>e?0:i.getAnnotationIndex(this.getFeeder().getDiffBlocks(),e),this.gotoBlock(t)}},gotoDiff:function(e,t){this.gotoChange(e,t)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,!0),this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0),this._positionDiffBlock()},nextChange:function(){var e=this.iterateOnChange(!0);return this._positionDiffBlock(),e},prevChange:function(){this.iterateOnChange(!1),this._positionDiffBlock()}},r}(),r.DiffBlockFeeder=function(){function e(){}return e.prototype={_isAddedSide:function(){return 0===this._mapperColumnIndex},getWordAnnoTypes:function(e){e.push(this._isAddedSide()?{type:"word",current:s.ANNO_DIFF_CURRENT_ADDED_WORD,normal:s.ANNO_DIFF_ADDED_WORD,list:[]}:{type:"word",current:s.ANNO_DIFF_CURRENT_DELETED_WORD,normal:s.ANNO_DIFF_DELETED_WORD,list:[]}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT}),e.push({type:"word",current:s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT})},getCurrentWordAnnoType:function(e,t){return e.start===e.end&&t?this._isAddedSide()?{current:this._repositionEmptyWord(e,t),normal:s.ANNO_DIFF_ADDED_WORD}:{current:this._repositionEmptyWord(e,t),normal:s.ANNO_DIFF_DELETED_WORD}:this._isAddedSide()?{current:s.ANNO_DIFF_CURRENT_ADDED_WORD,normal:s.ANNO_DIFF_ADDED_WORD}:{current:s.ANNO_DIFF_CURRENT_DELETED_WORD,normal:s.ANNO_DIFF_DELETED_WORD}},_repositionEmptyWord:function(e,t){var i=t.getLineAtOffset(e.start),n=t.getLineStart(i),o=t.getLineEnd(i);return n!==o?e.start===o?(e.start--,this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT:s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT):(e.end++,this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT:s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT):i>0&&(i--,n=t.getLineStart(i),o=t.getLineEnd(i),n!==o)?(e.start=o-1,e.end=o,this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_RIGHT:s.ANNO_DIFF_EMPTY_DELETED_WORD_RIGHT):this._isAddedSide()?s.ANNO_DIFF_EMPTY_ADDED_WORD_LEFT:s.ANNO_DIFF_EMPTY_DELETED_WORD_LEFT},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(e){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;var t=this._diffBlocks[e][1];return-1===t?0:this._mapper[t][this._mapperColumnIndex]
+},getOverviewLineCount:function(){return this._textModel.getLineCount()},getLineNumber:function(e){return e},getCharRange:function(e){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var t=this._diffBlocks[e][1],i=this._diffBlocks[e][0],n=i+this._mapper[t][this._mapperColumnIndex]-1,o=this._textModel.getLineStart(i);if(i>n)return{start:o,end:o};var r=this._textModel.getLineEnd(n,!0);return{start:o,end:r}},getTextOnBlock:function(e){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var t=this._diffBlocks[e][1];0===this._mapper[t][0]||0===this._mapper[t][1]||0===this._mapper[t][2];var i=this.getCharRange(e);return{start:i.start,text:this._textModel.getText(i.start,i.end)}},isMapperEmpty:function(){return 0===this._mapper.length}},e}(),r.TwoWayDiffBlockFeeder=function(){function e(e,t,i,n){this._mapperColumnIndex=i,this._reverseAnnotation=n,this.init(e,t)}return e.prototype=new r.DiffBlockFeeder,e.prototype._isAddedSide=function(){return this._reverseAnnotation?0!==this._mapperColumnIndex:0===this._mapperColumnIndex},e.prototype.init=function(e,t){if(this._textModel=e,this._diffBlocks=void 0,t){this._mapper=t,this._diffBlocks=[];for(var i=0,n=0;n=this._gapBlocks[t][0]&&e0){if(e.length<1||e.length>2)return;this._syntaxHighlighters=[{highlighter:this.options.highlighters[0],target:e[0]}],2===e.length&&2===this.options.highlighters.length&&this._syntaxHighlighters.push({highlighter:this.options.highlighters[1],target:e[1]})}},_highlightSyntax:function(){if(this._syntaxHighlighters){var e=[];this._syntaxHighlighters.forEach(function(t){e.push(t.highlighter.highlight(t.target.fileName,t.target.contentType,t.target.editor))}.bind(this)),t.all(e,function(e){return{_error:e}}).then(function(){this._diffNavigator.renderAnnotations(this.isWhitespaceIgnored()),this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1),this.dispatchEvent({type:"contentLoaded"}),this.options.toggler&&this.options.toggler.dispatchEvent({type:"contentLoaded"})}.bind(this))}else window.setTimeout(function(){this._diffNavigator.renderAnnotations(this.isWhitespaceIgnored()),this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1),this.dispatchEvent({type:"contentLoaded"}),this.options.toggler&&this.options.toggler.dispatchEvent({type:"contentLoaded"})}.bind(this),50)},isWhitespaceIgnored:function(){return this.getWidget().options.ignoreWhitespace},ignoreWhitespace:function(e){var t=this.getWidget().options;if(t.ignoreWhitespace=e,t.diffProvider&&t.diffContent){var i=e?"true":"false";t.diffProvider._diffProvider.getDiffContent(t.resource,{ignoreWS:i}).then(function(e){t.diffContent=t.hasConflicts?e.split("diff --git")[1]:e,this.getWidget().refresh(!0,!0)}.bind(this),function(){})}else this.getWidget().refresh(!0,!0)},setOptions:function(e,t){if(t&&this._clearOptions(),this.options||(this.options={}),e&&Object.keys(e).forEach(function(t){this.options[t]=e[t]}.bind(this)),e.newFileOnRight){var i=this.options.newFile;this.options.newFile=this.options.oldFile,this.options.oldFile=i}},getOptions:function(){return this.options},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},initDiffNav:function(){this._diffNavigator.gotoBlock(0,0)},nextDiff:function(){this._diffNavigator.nextDiff()},prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){return this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},getWidget:function(){return this},startup:function(){this.initEditors(),this.refresh(!0)},initEditors:function(){},initImageMode:function(){}},e}(),g.TwoWayCompareView=function(){function i(e){g.CompareView.call(this,e),this.setOptions(e,!0),this._diffNavigator=new f.DiffTreeNavigator("word"),this.type="twoWay",this._uiFactory=this.options.uiFactory,this._uiFactory||(this._uiFactory=new h.TwoWayCompareUIFactory({parentDivID:this.options.parentDivId,showTitle:this.options.showTitle?this.options.showTitle:!1,showLineStatus:this.options.showLineStatus?this.options.showLineStatus:!1}),this._uiFactory.buildUI()),this._viewLoadedCounter=0,this.options.commandProvider&&this.options.commandProvider.initCommands(this),this._curveRuler=new r.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv())}return i.prototype=Object.create(g.CompareView.prototype),i.prototype.initEditors=function(t){this.options.preCreate&&this.options.preCreate(),this._editors=[],this._editors.push(this._createEditor(t,this._uiFactory.getEditorParentDiv(!1),this._uiFactory.getStatusDiv(!1),this.options.oldFile)),this._editors.push(this._createEditor(t,this._uiFactory.getEditorParentDiv(!0),this._uiFactory.getStatusDiv(!0),this.options.newFile,!0)),this._overviewRuler=new r.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(e){this._diffNavigator.matchPositionFromOverview(e)}.bind(this)),this.options.postCreate&&this.options.postCreate(),window.onbeforeunload=function(){return this.isDirty()?e["There are unsaved changes."]:void 0}.bind(this)},i.prototype.disableAnnoBookMark=function(){this._disableAnnoBookMark(this._editors)},i.prototype.initImageMode=function(){this._editors&&(this._editors.forEach(function(e){e.destroy()}),this._editors=null),this._uiFactory.getEditorParentDiv(!0).classList.add("compareEditorParentImageMode"),this._uiFactory.getEditorParentDiv().classList.add("compareEditorParentImageMode"),this._uiFactory.disableTitle(),this._uiFactory.disableLineStatus(),this._imageMode=!0},i.prototype.getImageMode=function(){return this._imageMode},i.prototype.getEditors=function(){return this._editors},i.prototype.gotoDiff=function(e,t,i){var n=i?this._editors[1].getTextView():this._editors[0].getTextView(),o=n.getModel().getLineStart(e)+t;this._diffNavigator.gotoDiff(o,n)},i.prototype.copyToLeft=function(){this._curveRuler.copyTo(!0)},i.prototype.copyToRight=function(){this._curveRuler.copyTo(!1)},i.prototype.resizeEditors=function(){this._editors.forEach(function(e){e.getTextView().resize()})},i.prototype.getSplitter=function(){return this._uiFactory.getSplitter()},i.prototype._createEditor=function(t,i,n,o,r){var l="undefined"==typeof o.readonly?!0:o.readonly,h=function(){var e=new c.TextView({parent:i,readonly:l,theme:d.TextTheme.getTheme("nothing"),tabSize:4});this._viewLoadedCounter++,2===this._viewLoadedCounter&&this._diffNavigator.matchPositionFromOverview(-1),this.onLoad&&this.onLoad();var t=this.getSplitter();return t&&t.addResizeListener(function(t){if(t){var i=!1;i=this._uiFactory.isLeftPane(t)?r:!r,i&&e.resize()}}.bind(this)),e}.bind(this),u=o.keyBindingFactory;u||(u=new a.KeyBindingsFactory);var p=null;if(n){var f="",g="";p=function(t,i){n&&(g=i?e["ERROR: "]+t:t,n.textContent=f+g)}}var _=new s.Editor({textViewFactory:h,undoStackFactory:new a.UndoFactory,annotationFactory:new a.AnnotationFactory,keyBindingFactory:u,statusReporter:p,domNode:i});_.installTextView(),_.setInput(null,null,o.Content?o.Content:t),_.setOverviewRulerVisible(!1);var m=_.getTextView();return m.addEventListener("Selection",function(e){var t=Array.isArray(e.newValue)?e.newValue:[e.newValue];t.length>1||!t[0].isEmpty()||!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&this._diffNavigator.gotoDiff(t[0].getCaret(),m)}.bind(this)),m.getModel().addEventListener("Changed",function(e){this._curveRuler.onChanged(e,!r)||(this.options.mapper=null)}.bind(this)),r?m.addEventListener("Scroll",function(){this._curveRuler&&(this._curveRuler.matchPositionFrom(!0),this._curveRuler.render()),this.onScroll&&this.onScroll()}.bind(this)):m.addEventListener("Scroll",function(){this._curveRuler&&this._curveRuler.render()}.bind(this)),_},i.prototype.isDirty=function(){return this._editors?this._editors.some(function(e){return e.isDirty()}):!1},i.prototype._destroy=function(){this._editors&&(this._diffNavigator.destroy(),this._editors.forEach(function(e){e.destroy()}),this._uiFactory.destroy())},i.prototype.destroy=function(){this._destroyed=!0,this._destroy()},i.prototype.addRulers=function(){if(this._editors&&!this._hasRuler){var e=new r.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),t=new r.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._editors[1].getTextView().addRuler(e),this._editors[0].getTextView().addRuler(t),this._editors[0].getTextView().addRuler(this._overviewRuler),this._hasRuler=!0}},i.prototype.refresh=function(e,i,n){if(!this._destroyed){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var o=this;return this._loadImageFile(this.options.newFile.URL,this._uiFactory.getEditorParentDiv(!0)).then(function(e){return o._loadImageFile(o.options.oldFile.URL,o._uiFactory.getEditorParentDiv()).then(function(i){return(new t).resolve(e>i?e:i)})})}var r=this._generateMapper(i,this.options.oldFile.Content,this.options.newFile.Content,this.options.diffContent,this.options.hasConflicts,!this.options.toggler),s=this.options.oldFile.Content,a=this.options.newFile.Content;"string"!=typeof a&&(a=r.output);var l=new f.TwoWayDiffBlockFeeder(this._editors[0].getTextView().getModel(),r.mapper,1,this.options.newFileOnRight),d=new f.TwoWayDiffBlockFeeder(this._editors[1].getTextView().getModel(),r.mapper,0,this.options.newFileOnRight);this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editors[0],this._editors[1],l,d,this._overviewRuler,this._curveRuler),this._curveRuler.init(r.mapper,this._editors[1],this._editors[0],this._diffNavigator),e&&("number"==typeof n?1===n?this._editors[1].setInput(this.options.newFile.Name,null,a):this._editors[0].setInput(this.options.oldFile.Name,null,s):(this._editors[1].setInput(this.options.newFile.Name,null,a),this._editors[0].setInput(this.options.oldFile.Name,null,s))),this._initSyntaxHighlighter([{fileName:this.options.newFile.Name,contentType:this.options.newFile.Type,editor:this._editors[1]},{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editors[0]}]),this._highlightSyntax(),this.options.commandProvider&&this.options.commandProvider.renderCommands(this),this.addRulers(),2===this._viewLoadedCounter&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1),this.refreshTitle(0),this.refreshTitle(1);var c=this._editors[1].getTextView().getModel().getLineCount()*this._editors[1].getTextView().getLineHeight()+5,h=this._editors[0].getTextView().getModel().getLineCount()*this._editors[0].getTextView().getLineHeight()+5;return c>h?c:h}},i.prototype.refreshTitle=function(e,t){var i,o=this.options.newFile.Name,r=this.options.oldFile.Name,s="/",a=" ... ",l=o.split(s),d=r.split(s),c=[],h=[],u=!1;for(i=0;i1||!t[0].isEmpty()||!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&this._diffNavigator.gotoDiff(t[0].getCaret(),this._textView)}.bind(this))},i.prototype.disableAnnoBookMark=function(){this._disableAnnoBookMark([this._editor])},i.prototype.initImageMode=function(){this._editor&&(this._editor.destroy(),this._editor=null),n.node(this._editorDiv).classList.add("compareEditorParentImageMode"),this._imageMode=!0},i.prototype.getImageMode=function(){return this._imageMode},i.prototype._initDiffPosition=function(e){var t=e.getModel();if(t&&t.getAnnotations){var i=t.getAnnotations();if(i.length>0){var n=i[0][0],o=e.getLineHeight(),r=e.getClientArea(),s=Math.floor(r.height/o/3);e.setTopIndex(n-s>0?n-s:0)}}},i.prototype.refresh=function(i,o){if(!this._destroyed){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var r=this;return this._loadImageFile(this.options.newFile.URL,n.node(this._editorDiv),!0).then(function(e){return r._loadImageFile(r.options.oldFile.URL,n.node(r._editorDiv)).then(function(i){return(new t).resolve(e+i+20)})})}var s=this._generateMapper(o,this.options.oldFile.Content,this.options.newFile.Content,this.options.diffContent,this.options.hasConflicts,!this.options.toggler);if(s.submoduleChanged)switch(s.submoduleChanged){case"removed":this._textView.getModel().setText(e["Removed Submodule Message"]);break;case"added":this._textView.getModel().setText(e["Added Submodule Message"])}else{this._mapper=s.mapper,this._textView.getModel().setText(this.options.oldFile.Content);var a=new f.inlineDiffBlockFeeder(s.mapper,1),l=new f.inlineDiffBlockFeeder(s.mapper,0);u.mergeDiffBlocks(this._textView.getModel(),l.getDiffBlocks(),s.mapper,s.diffArray.array,s.diffArray.index,this._diffParser._lineDelimiter),a.setModel(this._textView.getModel()),l.setModel(this._textView.getModel()),this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editor,this._editor,a,l,this._overviewRuler),this._initSyntaxHighlighter([{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editor}]),this._highlightSyntax(),this.options.commandProvider&&this.options.commandProvider.renderCommands(this),this.removeRulers(),this.addRulers();var d=this._textView.getTopIndex();this._textView.redrawLines(d,d+1,this._overviewRuler),this._textView.redrawLines(d,d+1,this._rulerOrigin),this._textView.redrawLines(d,d+1,this._rulerNew),this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)}return this._textView.getLineHeight()*this._textView.getModel().getLineCount()+5}},i.prototype.setConflicting=function(e){this._conflcit=e},i.prototype.gotoDiff=function(e){this._diffNavigator.gotoChangeUsingIndex(e)},i.prototype.gotoLine=function(e,t,i,n){"number"!=typeof t&&(t=0);var o=u.convertMergedLineNumber(this._mapper,e),r=function(){n&&n(o)}.bind(this);this._editor.onGotoLine(o,t,i,r)},i.prototype.getMainEditor=function(){return this._editor?this._editor:null},i.prototype.getLineNumber=function(e,t,i){if(t){var n=this._diffNavigator.getFeeder(i?!1:!0);return n?n.getLineNumber(e):e}var o=u.convertMergedLineNumber(this._mapper,e,i);return o},i}(),g.toggleableCompareView=function(){function e(e,t){i.attach(this),t&&(t.toggler=this),this._widget="inline"===e?new g.InlineCompareView(t):new g.TwoWayCompareView(t)}return e.prototype={startup:function(){this._widget.startup()},initImageMode:function(){this._imageMode=!0,this._widget.initImageMode()},_toggle:function(e){this._widget.destroy(),n.empty(n.node(e.parentDivId)),this._widget="inline"===this._widget.type?new g.TwoWayCompareView(e):new g.InlineCompareView(e),this._imageMode?this._widget.initImageMode():this._widget.initEditors(),this._widget.refresh(!0),e.onInputChanged&&"twoWay"===this._widget.type&&e.onInputChanged()},toggle:function(){var e=this._widget.options;if(!this._imageMode){var t=this._widget.getCurrentDiffPos();e.blockNumber=t.block,e.changeNumber=t.change}this._toggle(e)},isDirty:function(){return this._widget.isDirty()},destroy:function(){return this._widget.destroy()},getWidget:function(){return this._widget}},e}(),g}),define("orion/compare/compareCommands",["i18n!orion/compare/nls/messages","orion/commands","orion/Deferred","orion/keyBinding","orion/webui/littlelib","orion/EventTarget"],function(e,t,i,n,o,r){var s={};return s.CompareCommandFactory=function(){function s(e){r.attach(this),this.setOptions(e,!0)}return s.prototype={setOptions:function(e,t){t&&(this.options={}),this.options||(this.options={}),e&&Object.keys(e).forEach(function(t){this.options[t]=e[t]}.bind(this))},getOptions:function(){return this.options},initCommands:function(o){var r=this.options.commandSpanId,s=this.options.toggleCommandSpanId,a=this.options.commandService;if(a&&(r||s)){var l=new t.Command({name:e.CpCurChangeRightToLeft,tooltip:e.CpCurChangeRightToLeft,imageClass:"core-sprite-leftarrow",id:"orion.compare.copyToLeft",groupId:"orion.compareGroup",visibleWhen:function(){return"twoWay"===o.type&&!o.getImageMode()&&o.options.newFile&&!o.options.newFile.readonly}.bind(this),callback:function(e){e.items.copyToLeft()}}),d=new t.Command({name:e.CpCurChangeLeftToRight,tooltip:e.CpCurChangeLeftToRight,imageClass:"core-sprite-rightarrow",id:"orion.compare.copyToRight",groupId:"orion.compareGroup",visibleWhen:function(){return"twoWay"===o.type&&!o.getImageMode()&&o.options.oldFile&&!o.options.oldFile.readonly}.bind(this),callback:function(e){e.items.copyToRight()}}),c=new t.Command({tooltip:e.IgnoreWhitespaceTooltip,name:e.IgnoreWhitespace,imageClass:"core-sprite-whitespace",id:"orion.compare.ignoreWhitespace",groupId:"orion.compareGroup",type:"toggle",visibleWhen:function(t){var i=t.isWhitespaceIgnored();return c.checked=i,c.name=i?e.UseWhitespace:e.IgnoreWhitespace,c.tooltip=i?e.UseWhitespaceTooltip:e.IgnoreWhitespaceTooltip,!0},preCallback:function(t){var n=t.handler.getWidget();if("function"==typeof n.options.onSave&&n.isDirty()){var o=window.confirm(e.confirmUnsavedChanges);return o?n.options.onSave(o):(new i).resolve()}return(new i).resolve(!0)},callback:function(e){e.items.ignoreWhitespace(c.checked),this.dispatchEvent({type:"compareConfigChanged",name:"ignoreWhiteSpace",value:c.checked})}.bind(this)}),h=new t.Command({tooltip:e["Switch to unified diff"],name:e.Unified,imageClass:"compare-sprite-inline-2way",id:"orion.compare.toggleInline2Way",groupId:"orion.compareGroup",type:"switch",visibleWhen:function(t){if(!t.options.toggler)return!1;var i="twoWay"===t.options.toggler.getWidget().type;return h.checked=!i,h.name=i?e.Unified:e["Side by side"],h.tooltip=i?e["Switch to unified diff"]:e["Switch to side by side diff"],!0},preCallback:function(t){var n=t.handler.getWidget();if("function"==typeof n.options.onSave&&n.isDirty()){var o=window.confirm(e.confirmUnsavedChanges);return o?n.options.onSave(o):(new i).resolve()}return(new i).resolve(!0)},callback:function(e){this.dispatchEvent({type:"compareConfigChanged",name:"mode",value:"twoWay"===e.items.options.toggler.getWidget().type?"inline":"twoWay"}),e.items.options.toggler.toggle()}.bind(this)}),u=new t.Command({name:e["Next diff block"],tooltip:e["Next diff block"],imageClass:"core-sprite-move-down",id:"orion.compare.nextDiff",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.nextDiff()}}),p=new t.Command({name:e["Previous diff block"],tooltip:e["Previous diff block"],imageClass:"core-sprite-move-up",id:"orion.compare.prevDiff",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.prevDiff()}}),f=new t.Command({name:e["Next diff change"],tooltip:e["Next diff change"],imageClass:"core-sprite-move-down",id:"orion.compare.nextChange",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.nextChange()}}),g=new t.Command({name:e["Previous diff change"],tooltip:e["Previous diff change"],imageClass:"core-sprite-move-up",id:"orion.compare.prevChange",groupId:"orion.compareGroup",visibleWhen:function(){return!o.getImageMode()},callback:function(e){e.items.prevChange(e)}});a.addCommand(l),a.addCommand(d),a.addCommand(c),a.addCommand(h),a.addCommand(u),a.addCommand(p),a.addCommand(f),a.addCommand(g),s?a.registerCommandContribution(s,"orion.compare.toggleInline2Way",108):r&&a.registerCommandContribution(r,"orion.compare.toggleInline2Way",108),r&&(a.registerCommandContribution(r,"orion.compare.copyToLeft",110,null,!1,new n.KeyBinding(37,!0,!1,!0)),a.registerCommandContribution(r,"orion.compare.copyToRight",111,null,!1,new n.KeyBinding(39,!0,!1,!0)),a.registerCommandContribution(r,"orion.compare.nextDiff",112,null,!1,new n.KeyBinding(40,!0)),a.registerCommandContribution(r,"orion.compare.prevDiff",113,null,!1,new n.KeyBinding(38,!0)),o.options.wordLevelNav?(a.registerCommandContribution(r,"orion.compare.nextChange",114,null,!1,new n.KeyBinding(40,!0,!0)),a.registerCommandContribution(r,"orion.compare.prevChange",115,null,!1,new n.KeyBinding(38,!0,!0))):(a.registerCommandContribution(r,"orion.compare.nextChange",114,null,!0,new n.KeyBinding(40,!0,!0)),a.registerCommandContribution(r,"orion.compare.prevChange",115,null,!0,new n.KeyBinding(38,!0,!0))),a.registerCommandContribution(r,"orion.compare.ignoreWhitespace",109))}},renderCommands:function(e){var t=this.options.commandSpanId,i=this.options.toggleCommandSpanId,n=this.options.commandService;n&&(t||i)&&(i&&(o.empty(o.node(i)),n.renderCommands(i,i,e,e,"tool",null)),t&&(o.empty(o.node(t)),this.options.gridRenderer&&this.options.gridRenderer.navGridHolder?(this.options.gridRenderer.navGridHolder.splice(0,this.options.gridRenderer.navGridHolder.length),this.options.gridRenderer.additionalCmdRender?this.options.gridRenderer.before?(this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder),n.renderCommands(t,t,e,e,"tool",null,this.options.gridRenderer.navGridHolder)):(n.renderCommands(t,t,e,e,"tool",null,this.options.gridRenderer.navGridHolder),this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder)):n.renderCommands(t,t,e,e,"tool",null,this.options.gridRenderer.navGridHolder)):n.renderCommands(t,t,e,e,"tool",null)))}},s}(),s}),define("compare/builder/compare",["orion/commandRegistry","orion/staticDataSource","orion/contentTypes","orion/Deferred","orion/webui/littlelib","orion/compare/compareView","orion/compare/compareCommands"],function(e,t,i,n,o,r,s){function a(e){return u.getFilenameContentType(e)}function l(e){var t=new n,i=new XMLHttpRequest;return i.open("GET",e,!0),i.onreadystatechange=function(){if(4===i.readyState){var e="undefined"!=typeof i.response?i.response:i.responseText,n="string"==typeof e?e:null,o=i.status;o>=200&&400>o?t.resolve(n):t.reject(n)}},i.send(),t}function d(e){if(!e)return e;var t=o.node(e);if(t){if("ul"!==t.nodeName.toLowerCase()){var i=document.createElement("ul");return i.id=e+"__compareCmdUL",i.classList.add("layoutLeft"),i.classList.add("commandList"),t.appendChild(i),i.id}t.classList.add("commandList")}return e}function c(e,i,n,o,l){var c=e;if(!c.highlighters&&c.oldFile&&c.oldFile.Name&&c.newFile&&c.newFile.Name&&(c.highlighters=[new t.SyntaxHighlighter,new t.SyntaxHighlighter]),c.oldFile&&c.oldFile.Name&&(c.oldFile.Type=a(c.oldFile.Name)),c.newFile&&c.newFile.Name&&(c.newFile.Type=a(c.newFile.Name)),i||l){var u=new s.CompareCommandFactory({commandService:h,commandSpanId:d(i),toggleCommandSpanId:d(l)});c.commandProvider=u}var p="inline"===n?"inline":"twoWay";this.compareView=o?new r.toggleableCompareView(p,c):"inline"===p?new r.inlineCompareView(c):new r.TwoWayCompareView(c),this.compareView.startup()}var h=new e.CommandRegistry({}),u=new i.ContentTypeRegistry(t.ContentTypes);return c.prototype={getCompareView:function(){return this.compareView},setFileNames:function(e,t){var i=this.getCompareView().getWidget().options;i.newFile&&e&&(i.newFile.Name=e,i.newFile.Type=a(e)),i.oldFile&&t&&(i.oldFile.Name=t,i.oldFile.Type=a(t))},refresh:function(){var e=this.getCompareView().getWidget().options;if(e.oldFile.URL&&e.newFile.URL){var t=[];t.push(l(e.oldFile.URL)),t.push(l(e.newFile.URL)),n.all(t,function(e){return{_error:e}}).then(function(e){this.getCompareView().getWidget().options.oldFile.Content=e[0],this.getCompareView().getWidget().options.newFile.Content=e[1],this.getCompareView().getWidget().refresh(!0)}.bind(this))}else this.getCompareView().getWidget().refresh(!0)
+}},c}),define(["compare/builder/compare"],function(e){return e});
\ No newline at end of file
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/built-compare.css b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/built-compare.css
similarity index 97%
rename from plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/built-compare.css
rename to plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/built-compare.css
index c8040b392d0..2d9a66b9a41 100644
--- a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-11.0/built-compare.css
+++ b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-12.0/built-compare.css
@@ -1,9 +1,9 @@
.headerLayout {
- height: 50px;
+ height: 35px;
}
.toolbarLayout {
- height: 50px;
+ height: 35px;
display: -webkit-box;
display: -moz-box;
@@ -91,7 +91,7 @@
top: 0;
bottom: 0;
- left: 50px;
+ left: 35px;
right: 0;
background: #3b4b54;
@@ -252,7 +252,7 @@
}
.toolbarTarget {
position: absolute;
- top: 50px;
+ top: 35px;
width: 100%;
overflow-y: auto;
}
@@ -261,11 +261,11 @@
}
.pageLayoutTarget {
position: absolute;
- width: calc( 100% - 60px );
+ width: calc( 100% - 15px );
bottom: 0;
overflow-y: auto;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.33);
- margin: 20px;
+ margin: 5px;
margin-right: 0;
padding-top: 10px;
padding-bottom: 5px;
@@ -438,7 +438,7 @@ and (max-device-width : 1024px) {
margin-right: 0 !important;
}
.sideMenu{
- width: 50px;
+ width: 35px;
background: #26343F;
float: left;
position: absolute;
@@ -471,7 +471,7 @@ and (max-device-width : 1024px) {
}
.sideMenuHome{
width: 100%;
- height: 50px;
+ height: 35px;
}
.sideMenuList{
display:inline-block !important;
@@ -523,7 +523,7 @@ and (max-device-width : 1024px) {
text-decoration:none !important;
width: 100%;
display: inline-block;
- padding: 9px 0px 12px 0px;
+ padding: 4px 0 4px 0;
}
.sideMenuItem>.submenu-trigger:hover, .sideMenuItem.expanded>.submenu-trigger{
text-decoration:none;
@@ -635,12 +635,12 @@ and (max-device-width : 1024px) {
}
.mainContent{
position:absolute;
- left:50px;
+ left:35px;
}
.innerPanels{
position:absolute;
width:100%;
- top:50px;
+ top:35px;
bottom:0;
}
.userMenu {
@@ -715,13 +715,16 @@ and (max-device-width : 1024px) {
padding-bottom:10px;
height:24px;
}
+.splashMessages {
+}
.splashMessage {
color: white;
font-size: 14px;
}
.splashDetailedMessage {
color: white;
- font-size: 14px;
+ font-size: 12px;
+ padding-left: 20px;
}
.splashVisual {
width: 24px;
@@ -1333,7 +1336,6 @@ textarea.parameterInput {
}
.mainNavColumn {
display: inline-block;
- padding: 2px;
vertical-align: baseline;
white-space: nowrap;
}
@@ -2066,7 +2068,7 @@ html[dir="rtl"] .modifiedFileMarker{
border-collapse: collapse;
border-spacing: 0;
padding: 0;
- margin-top: 40px;
+ margin-top: 5px;
overflow-y: hidden;
}
html[dir="rtl"] .sectionWrapper, html[dir="rtl"] .sectionTable{
@@ -2083,8 +2085,8 @@ html[dir="rtl"] .sectionWrapper, html[dir="rtl"] .sectionTable{
}
.sectionTable {
margin-top: 0;
- margin-left: 8%;
- margin-right: 8%;
+ margin-left: 5px;
+ margin-right: 5px;
border: 1px solid #f1f3f4;
-webkit-transition: all 0.1s ease, left 0;
transition: all 0.1s ease, left 0;
@@ -2096,7 +2098,7 @@ html[dir="rtl"] .sectionWrapper, html[dir="rtl"] .sectionTable{
border-top: none;
}
.sectionTable:last-child {
- margin-bottom: 20px;
+ margin-bottom: 5px;
}
.sectionTable.sectionClosed {
height: 0;
@@ -2106,8 +2108,8 @@ html[dir="rtl"] .sectionWrapper, html[dir="rtl"] .sectionTable{
}
.sectionWrapper{
border: 1px solid;
- margin-left: 8%;
- margin-right: 8%;
+ margin-left: 5px;
+ margin-right: 5px;
background: none repeat scroll 0 0 #f4f4f4;
vertical-align: middle;
font-weight: bold;
@@ -2502,7 +2504,7 @@ html[dir="rtl"] .fileExplorerProgressDiv {
-moz-osx-font-smoothing: grayscale;
}
.core-sprite-questionmark {
- font-weight: bold;
+ padding-bottom: 3px;
}
.core-sprite-hamburger {
margin-top: -3px;
@@ -2573,7 +2575,6 @@ html[dir="rtl"] .fileExplorerProgressDiv {
}
.core-sprite-git-logo {
font-size: 20px;
- padding-bottom: 10px !important;
}
.core-sprite-page,
.core-sprite-horizontal,
@@ -2640,7 +2641,7 @@ html[dir="rtl"] .fileExplorerProgressDiv {
.core-sprite-horizontal:before{ content:'\E042'; }
.core-sprite-vertical:before{ content:'\E041'; }
.core-sprite-pip:before{ content:'\E067'; }
-.core-sprite-questionmark:before{ content:'?'; }
+.core-sprite-questionmark:before{ content:'\E043'; }
.file-sprite-javascript:before{ content:'\E00D'; }
.file-sprite-css:before{ content:'\E00C'; }
@@ -2715,7 +2716,7 @@ html[dir="rtl"] .fileExplorerProgressDiv {
height: 100%;
}
.rulerLines {
- color: silver;
+ color: #767676;
}
.rulerLines.even
.rulerLines.odd {
@@ -2807,13 +2808,16 @@ html[dir="rtl"] .fileExplorerProgressDiv {
.textviewTooltip .hoverTooltipTitle {
font-weight: normal;
}
+.textviewTooltip .quickFixList {
+ margin-top: 5px;
+}
.textviewTooltip .commandButton {
border: 1px solid #325C80;
background-color: inherit;
color: white;
}
.textviewTooltip .commandButton:not(.dropdownTrigger){
- text-transform: initial;
+ text-transform: initial;
}
.textviewTooltip .commandList > li {
margin: 0;
@@ -2925,11 +2929,11 @@ html[dir="rtl"] .fileExplorerProgressDiv {
}
.contentassist .proposal-noemphasis-title-keywords {
background-color: aliceblue;
- color: gray;
+ color: #717171;
}
.contentassist .proposal-noemphasis-title {
background-color: aliceblue;
- color: gray;
+ color: #717171;
padding-top: 5px;
}
.contentassist .proposal-default {
@@ -3787,7 +3791,7 @@ a.breadcrumb.currentLocation {
.mainpane {
border: 0;
background: #3B4B54 !important;
- padding-right:20px;
+ padding-right:5px;
}
.mainToolbar {
color: white;
@@ -4426,6 +4430,7 @@ a.breadcrumb.currentLocation {
visibility: hidden;
z-index: 175;
position: absolute;
+ color: #222;
background-color: #fbfbfb;
border-radius: 2px;
border: 1px solid #BBB;
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-codenvy.css b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-codenvy.css
index 7e33ba4f3ec..c8ea3d777b1 100644
--- a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-codenvy.css
+++ b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-codenvy.css
@@ -4578,11 +4578,11 @@ a.breadcrumb.currentLocation {
@font-face {
font-family: 'Orion Icon Font';
- src: url('built-compare-11.0/OrionIconFont-Regular.eot');
- src: url('built-compare-11.0/OrionIconFont-Regular.eot?#iefix') format('embedded-opentype'),
- url('built-compare-11.0/OrionIconFont-Regular.woff') format('woff'),
- url('built-compare-11.0/OrionIconFont-Regular.ttf') format('truetype'),
- url('built-compare-11.0/OrionIconFont-Regular.svg#04b530a8db6e0f4a0fdb83697b7ace5f') format('svg');
+ src: url('built-compare-12.0/OrionIconFont-Regular.eot');
+ src: url('built-compare-12.0/OrionIconFont-Regular.eot?#iefix') format('embedded-opentype'),
+ url('built-compare-12.0/OrionIconFont-Regular.woff') format('woff'),
+ url('built-compare-12.0/OrionIconFont-Regular.ttf') format('truetype'),
+ url('built-compare-12.0/OrionIconFont-Regular.svg#04b530a8db6e0f4a0fdb83697b7ace5f') format('svg');
font-style: normal;
font-weight: 400;
diff --git a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-dark-codenvy.css b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-dark-codenvy.css
index a71331a7eb5..c2cddfc7d52 100644
--- a/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-dark-codenvy.css
+++ b/plugins/plugin-orion/che-plugin-orion-compare/src/main/resources/org/eclipse/che/ide/orion/public/built-compare-dark-codenvy.css
@@ -4581,11 +4581,11 @@ a.breadcrumb.currentLocation {
@font-face {
font-family: 'Orion Icon Font';
- src: url('built-compare-11.0/OrionIconFont-Regular.eot');
- src: url('built-compare-11.0/OrionIconFont-Regular.eot?#iefix') format('embedded-opentype'),
- url('built-compare-11.0/OrionIconFont-Regular.woff') format('woff'),
- url('built-compare-11.0/OrionIconFont-Regular.ttf') format('truetype'),
- url('built-compare-11.0/OrionIconFont-Regular.svg#04b530a8db6e0f4a0fdb83697b7ace5f') format('svg');
+ src: url('built-compare-12.0/OrionIconFont-Regular.eot');
+ src: url('built-compare-12.0/OrionIconFont-Regular.eot?#iefix') format('embedded-opentype'),
+ url('built-compare-12.0/OrionIconFont-Regular.woff') format('woff'),
+ url('built-compare-12.0/OrionIconFont-Regular.ttf') format('truetype'),
+ url('built-compare-12.0/OrionIconFont-Regular.svg#04b530a8db6e0f4a0fdb83697b7ace5f') format('svg');
font-style: normal;
font-weight: 400;
diff --git a/plugins/plugin-orion/che-plugin-orion-editor/pom.xml b/plugins/plugin-orion/che-plugin-orion-editor/pom.xml
index f9268eb5635..88f7561d977 100644
--- a/plugins/plugin-orion/che-plugin-orion-editor/pom.xml
+++ b/plugins/plugin-orion/che-plugin-orion-editor/pom.xml
@@ -123,10 +123,10 @@