/* Copyright (c) 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Copyright (c) 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Copyright (c) 2010, 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013,2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Mihai Sucan (Mozilla Foundation) - fix for Bug#334583 Bug#348471 Bug#349485 Bug#350595 Bug#360726 Bug#361180 Bug#362835 Bug#362428 Bug#362286 Bug#354270 Bug#361474 Bug#363945 Bug#366312 Bug#370584 Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Copyright (c) 2010, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: Felipe Heidrich (IBM Corporation) - initial API and implementation Silenio Quarti (IBM Corporation) - initial API and implementation Copyright (c) 2009, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2011, 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2010, 2012 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Alex Lakatos - fix for bug#369781 Copyright (c) 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2014 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation Copyright (c) 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation RequireJS i18n 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. Available via the MIT or new BSD license. see: http://github.com/requirejs/i18n for details Copyright (c) 2011, 2013 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). Contributors: IBM Corporation - initial API and implementation */ var requirejs,require,define; (function(p){function t(a,b){var c,l,m,w,n,f,d,s,g,h=b&&b.split("/"),u=e.map,q=u&&u["*"]||{};if(a&&"."===a.charAt(0))if(b){h=h.slice(0,h.length-1);a=h.concat(a.split("/"));for(s=0;sg;++g)k?r=p(r,this[g],g,this):(r=this[g],k=!0);return r});String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});String.prototype.trimLeft||(String.prototype.trimLeft= function(){return this.replace(/^\s+/g,"")});String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")});return{}}); (function(){function p(g,h,f,q,d,c){h[g]&&(f.push(g),(!0===h[g]||1===h[g])&&q.push(d+g+"/"+c))}function t(g,h,f,q,d){h=q+h+"/"+d;require._fileExists(g.toUrl(h+".js"))&&f.push(h)}function r(g,h,f){for(var q in h)h.hasOwnProperty(q)&&(!g.hasOwnProperty(q)||f)?g[q]=h[q]:"object"===typeof h[q]&&r(g[q],h[q],f)}var k=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(g){var h=g.config?g.config():{},h=h||{};return{version:"2.0.1+",load:function(f,g,d,c){c=c||{};c.locale&&(h.locale= c.locale);var a=k.exec(f),b=a[1],l=a[4],n=a[5],e=l.split("-"),s=[],u={},x,v="";a[5]?(b=a[1],f=b+n):(n=a[4],l=h.locale,l||(l=h.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),e=l.split("-"));if(c.isBuild){s.push(f);t(g,"root",s,b,n);for(x=0;xk.length)q=[q+1,b].concat(k),Array.prototype.splice.apply(this._lineOffsets,q);else{x=q+1;this._lineOffsets.splice(x,b);for(e=0;eh.length?!1:h[g].match(k)?g===h.length-1?!0:g+1:!1;k instanceof Array||(k=[k]);if(k.length>h.length)return!1;var f;for(f=0;fa?(a=r(a),d=g+a*f,k(d)):(k(h),c.stop())},"number"===typeof this.options.rate?this.options.rate:20)};p.prototype.stop=function(){this.options.window.clearInterval(this.interval);(this.options.onEnd||function(){})()};p.prototype.defaultEasing=function(p){return Math.sin(p*(Math.PI/2))};return p}()}}); 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".split(" "),function(p,t,r,k,g,h,f){function q(m,w,a){if(a){w.className="";a=w.attributes;for(var b=a.length;0f.isIE&&a[b].specified)&&w.removeAttribute(a[b].name)}if(m){m.styleClass&&(w.className=m.styleClass);if(a=m.style)for(var e in a)a.hasOwnProperty(e)&&(w.style[e]=a[e]);if(m=m.attributes)for(var c in m)m.hasOwnProperty(c)&& w.setAttribute(c,m[c])}}function d(m){return m instanceof Array?m.slice(0):m}function c(m,a){if(!m)return a;if(!a)return m;for(var b in a)a.hasOwnProperty(b)&&(m.hasOwnProperty(b)||(m[b]=a[b]));return m}function a(m,w){if(m===w)return!0;if(m&&!w||!m&&w||m&&m.constructor===String||w&&w.constructor===String)return!1;if(m instanceof Array||w instanceof Array){if(!(m instanceof Array&&w instanceof Array)||m.length!==w.length)return!1;for(var b=0;bthis.end&&(m=this.start,this.start=this.end,this.end=m,this.caret=!this.caret)}, setCaret:function(m){this.end=this.start=m;this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},toString:function(){return"start\x3d"+this.start+" end\x3d"+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===this.end},equals:function(m){return this.caret===m.caret&&this.start===m.start&&this.end===m.end}};u.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}}; x.prototype={create:function(m,a){if(!this._lineDiv){var b=this._lineDiv=this._createLine(m,a,this.lineIndex);b._line=this;return b}},_createLine:function(m,w,b){var e=this.view,c=e._model,l=c.getLine(b),n=c.getLineStart(b),d={type:"LineStyle",textView:e,lineIndex:b,lineText:l,lineStart:n};e.onLineStyle(d);var s=m.ownerDocument,c=w||f.createElement(s,"div");if(!w||!a(w.viewStyle,d.style))q(d.style,c,w),w&&(w._trim=null),c.viewStyle=d.style,c.setAttribute("role","presentation");c.lineIndex=b;if(w&& c.viewLineText===l&&a(d.ranges,c.viewRanges))return c;c.viewRanges=d.ranges;c.viewLineText=l;b=[];this._createRanges(d.ranges,l,0,l.length,n,{tabOffset:0,ranges:b});d=" ";!e._fullSelection&&9>f.isIE&&(d="\ufeff");e={text:d,style:e._metrics.largestFontStyle,ignoreChars:1};0===b.length||!b[b.length-1].style||"div"!==b[b.length-1].style.tagName?b.push(e):b.splice(b.length-1,0,e);var g,h,u,k=d=0;if(f.isFirefox&&2E3=v&&(s-=x);u=(u=h.firstChild.data)?u.length:0;if(k+u>s)break;k+=u}s=h.nextSibling;c.removeChild(h);h=s}g=this._createSpan(c,n,g,e.ignoreChars);h?c.insertBefore(g,h):c.appendChild(g);w&&(w.lineWidth=void 0)}if(w)for(x=g?g.nextSibling:null;x;)s=x.nextSibling,w.removeChild(x),x=s}c.parentNode||m.appendChild(c);return c},_createRanges:function(m,w,b,e,c,l){if(!(b>e)){if(m)for(var n=0;ne)break;var s=Math.min(c+e,f.end)- c;if(d<=s){d=Math.max(b,d);s=Math.min(e,s);bb)){var l=this.view._customTabSize;if(l&&8!==l)for(var n=m.indexOf("\t",a);-1!==n&&nm){var n=m-s;if(1===w.length)d=new u(a.getBoundingClientRect());else if(e._isRangeRects)c=l.createRange(),c.setStart(w,n),c.setEnd(w,n+1),d=new u(c.getBoundingClientRect());else if(f.isIE)c=l.body.createTextRange(),c.moveToElementText(a),c.collapse(),(w=0===n&&8===f.isIE)&&(n=1),c.moveEnd("character",n+1),c.moveStart("character", n),d=new u(c.getBoundingClientRect()),w&&(d.left=a.getClientRects()[0].left);else{var g=w.data;a.removeChild(w);a.appendChild(l.createTextNode(g.substring(0,n)));var h=f.createElement(l,"span");h.appendChild(l.createTextNode(g.substring(n,n+1)));a.appendChild(h);a.appendChild(l.createTextNode(g.substring(n+1)));d=new u(h.getBoundingClientRect());a.innerHTML="";a.appendChild(w);this._createdDiv||(a=e._getSelection(),(s<=a.start&&a.startl.right&&(l.right=e.right),e.bottom>l.bottom&&(l.bottom=e.bottom))}}return!0});return void 0!==m?a[m]:a},_getLineBoundingClientRect:function(m,a){var b=new u(m.getBoundingClientRect());if(!this.view._wrapMode){b.right= b.left;for(var e=m.lastChild;e&&e.ignoreChars===e.firstChild.length;)e=e.previousSibling;e&&(e=e.getBoundingClientRect(),b.right=e.right+n(m).right)}a&&(e=n(m),b.left+=e.left,b.right-=e.right);return b},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(m){if(!this.view._wrapMode)return 0;var a=this.getClientRects();m=this.getBoundingClientRect(m);m=m.top+(m.bottom-m.top)/2;for(var b=0;bl||a+n>=d)return b=c,e=l-a,m.ignoreChars&&(0y+(z-y)/2);e=s-d;q=n.getLine(l);v=q.charCodeAt(e);55296<=v&& 56319>=v&&k?e=v&&(s+=1)):56320<=v&&(57343>=v&&!k)&&0=v&&(s-=1));k&&s++}else{v=[];for(t=0;ty+(z-y)/2&&s++;break}s++;v=v.nextSibling}u._createdDiv||(e.innerHTML="",e.appendChild(q), e=c._getSelection(),(s<=e.start&&e.startk.right&&(m=k.right-1)}else 0>m&&(m=0),m>h.right-h.left&&(m=h.right-h.left);var v,p;if(this._lastHitChild&&this._lastHitChild.parentNode){if(v=this._lastHitOffset,p=this._lastHitChild,k=e(p),!k){q=v;for(var x=v+this._nodeLength(p),y=p.previousSibling,r=p.nextSibling;y||r;){if(y){q-=this._nodeLength(y);if(k=e(y)){p=y;v=q;break}y=y.previousSibling}if(r){if(k=e(r)){p=r;v=x;break}x+=this._nodeLength(r);r=r.nextSibling}}}}else v= d,this.forEach(function(m){p=m;if(k=e(p))return!1;v+=this._nodeLength(p);return!0});p&&k&&(this._lastHitChild=p,this._lastHitOffset=v,v=b(p,v,k));return Math.min(s,Math.max(d,v))},getNextOffset:function(m,a){if("line"===a.unit){var b=this.view._model,e=b.getLineAtOffset(m);if(0=m||58<=m&&64>=m||91<=m&&94>=m||96===m||123<=m&&126>=m}function e(m){return 32===m||9===m}var c=this.view._model,n=c.getLineAtOffset(m),l=c.getLine(n),d=c.getLineStart(n),c=c.getLineEnd(n),n=l.length,f=m-d,s,g=0>a.count?-1:1;if("word"===a.unit||"wordend"===a.unit||"wordWS"===a.unit||"wordendWS"===a.unit)for(var h,u,q;0!==a.count;){if(0=s&&0=s&&(f+=g)),a.count-=g;return d+f},_getNextOffset_IE:function(m,a){var b=this._ensureCreated(),e=this.view._model,c=this.lineIndex,n=0,l;l=e.getLineStart(c);var d=e.getLine(c),f=e.getLineStart(c),s=b.ownerDocument,g=0>a.count?-1:1;if(m===e.getLineEnd(c)){for(b=b.lastChild;b&&b.ignoreChars===b.firstChild.length;)b=b.previousSibling; if(!b)return l;n=s.body.createTextRange();n.moveToElementText(b);l=n.text.length;n.moveEnd(a.unit,g);n=m+n.text.length-l}else if(m===l&&0>a.count)n=l;else for(b=b.firstChild;b;){e=this._nodeLength(b);if(l+e>m){n=s.body.createTextRange();if(m===l&&0>a.count){for(l=b.previousSibling;l&&(!l.firstChild||!l.firstChild.length);)l=l.previousSibling;n.moveToElementText(l?l:b.previousSibling)}else n.moveToElementText(b),n.collapse(),n.moveEnd("character",m-l);l=n.text.length;n.moveEnd(a.unit,g);n=m+n.text.length- l;break}l=e+l;b=b.nextSibling}l=n-f;n=d.charCodeAt(l);56320<=n&&57343>=n&&0=n&&(l+=g));a.count-=g;return l+f},updateLinks:function(){var m=this._ensureCreated();if(this.hasLink){var a=this;this.forEach(function(b){var e=b.viewStyle;e&&(e.tagName&&"a"===e.tagName.toLowerCase())&&m.replaceChild(a._createSpan(m,b.firstChild.data,e),b);return!0})}},destroy:function(){var m=this._createdDiv;m&&(m.parentNode.removeChild(m),this._createdDiv=null)}};v.prototype={addKeyMode:function(m, a){var b=this._keyModes;void 0!==a?b.splice(a,0,m):b.push(m);m._modeAdded&&m._modeAdded()},addRuler:function(m,a){var b=this._rulers;if(void 0!==a){var e,c;for(c=e=0;ea;if(c){var n=m;m=a;a=n}n=this._model.getCharCount();m=Math.max(0,Math.min(m,n));a=Math.max(0,Math.min(a,n));m=new s(m,a,c);this._setSelection(m,void 0===b||b,!0,e)},setText:function(m,a,b){var e=void 0===a&&void 0===b;void 0===a&&(a= 0);void 0===b&&(b=this._model.getCharCount());e&&(this._variableLineHeight=!1);this._modifyContent({text:m,start:a,end:b,_code:!0},!e);e&&(this._columnX=-1,this._setSelection(new s(0,0,!1),!0),13>f.isFirefox&&this._fixCaret())},setTopIndex:function(m,a){this._clientDiv&&this._scrollViewAnimated(0,this._getLinePixel(Math.max(0,m))-this._getScroll().y,a)},setTopPixel:function(m,a){this._clientDiv&&this._scrollViewAnimated(0,Math.max(0,m)-this._getScroll().y,a)},showSelection:function(m,a){return this._showCaret(m? !1:!0,a,m)},update:function(m,a){this._clientDiv&&((m||this._metrics.invalid)&&this._updateStyle(),void 0===a||a?this._update():this._queueUpdate())},_handleRootMouseDown:function(m){this._cancelCheckSelection();if(!this._ignoreEvent(m)){13>f.isFirefox&&1===m.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var a=this._overlayDiv||this._clientDiv;9>f.isIE&&(a=this._viewDiv);for(var b=m.target?m.target:m.srcElement;b;){if(a===b||b.className&& -1!==b.className.indexOf("textViewFind"))return;b=b.parentNode}m.preventDefault&&m.preventDefault();m.stopPropagation&&m.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(m){this._ignoreEvent(m)||(13>f.isFirefox&&1===m.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1),f.isFirefox&&1===m.which&&(this._fixCaret(),this._ignoreBlur=!1))},_handleBlur:function(){this._cancelCheckSelection(); if(!this._ignoreBlur){this._commitIME();this._hasFocus=!1;if(9>f.isIE&&!this._getSelection().isEmpty()){var m=this._rootDiv,a=f.createElement(m.ownerDocument,"div");m.appendChild(a);m.removeChild(a)}this._cursorDiv&&(this._cursorDiv.style.display="none");if(this._selDiv1)if(this._selDiv1.style.background="lightgray",this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",m=this._getWindow(),a=this._selDiv1.ownerDocument,m.getSelection){a=m.getSelection();for(m=a.anchorNode;m;){if(m=== this._clientDiv){0f.isFirefox){var a=this;this._getWindow().setTimeout(function(){a._clientDiv.contentEditable=!0;a._clientDiv.draggable=!1;a._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&-1!==this._dragOffset)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",m)),this._dragOffset=-1;else return m.preventDefault&&m.preventDefault(),!1}},_handleDrag:function(m){if(!this._ignoreEvent(m)&& this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",m))},_handleDragEnd:function(m){if(!this._ignoreEvent(m)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",m));13>f.isFirefox&&(this._fixCaret(),"none"===m.dataTransfer.dropEffect&&!m.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(m){if(!this._ignoreEvent(m)){var a=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(a=!1,this.onDragEnter(this._createMouseEvent("DragEnter", m)));if(f.isWebkit||a)return m.preventDefault&&m.preventDefault(),!1}},_handleDragOver:function(m){if(!this._ignoreEvent(m)){var a=!0;this.isListening("DragOver")&&(a=!1,this.onDragOver(this._createMouseEvent("DragOver",m)));if(f.isWebkit||a)return a&&(m.dataTransfer.dropEffect="none"),m.preventDefault&&m.preventDefault(),!1}},_handleDragLeave:function(m){if(!this._ignoreEvent(m)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",m))},_handleDrop:function(m){if(!this._ignoreEvent(m)){this._dropTarget= !1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",m));m.preventDefault&&m.preventDefault();return!1}},_handleFocus:function(){this._hasFocus=!0;f.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();this._cursorDiv&&(this._cursorDiv.style.display="block");if(this._selDiv1){var m=this._highlightRGB;this._selDiv1.style.background=m;this._selDiv2.style.background=m;this._selDiv3.style.background= m}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(m){this._cancelCheckSelection();if(!this._ignoreEvent(m)){if(this.isListening("KeyDown")){var a=this._createKeyEvent("KeyDown",m);this.onKeyDown(a);if(a.defaultPrevented){f.isFirefox&&(this._keyDownPrevented=!0);m.preventDefault();return}}a=!1;switch(m.keyCode){case 16:case 17:case 18:case 91:a=!0;break;default:this._setLinksVisible(!1)}if(229===m.keyCode){if(this._readonly)return m.preventDefault&&m.preventDefault(),!1; a=!0;f.isSafari&&f.isMac&&m.ctrlKey&&(a=!1,m.keyCode=129);a&&this._startIME()}else a||this._commitIME();if((f.isMac||f.isLinux)&&4>f.isFirefox||12.16>f.isOpera)return this._keyDownEvent=m,!0;if(this._doAction(m))return m.preventDefault?(m.preventDefault(),m.stopPropagation()):(m.cancelBubble=!0,m.returnValue=!1,m.keyCode=0),!1}},_handleKeyPress:function(m){if(!this._ignoreEvent(m))if(this._keyDownPrevented)m.preventDefault&&(m.preventDefault(),m.stopPropagation()),this._keyDownPrevented=void 0;else{if(f.isMac&& f.isWebkit&&(63232<=m.keyCode&&63487>=m.keyCode||13===m.keyCode||8===m.keyCode)||((f.isMac||f.isLinux)&&4>f.isFirefox||12.16>f.isOpera)&&this._doAction(this._keyDownEvent))return m.preventDefault&&m.preventDefault(),!1;var a=f.isMac?m.metaKey:m.ctrlKey;if(void 0!==m.charCode&&a)switch(m.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(a=this._createKeyEvent("KeyPress",m),this.onKeyPress(a),a.defaultPrevented)){m.preventDefault();return}if(this._doAction(m))return m.preventDefault? (m.preventDefault(),m.stopPropagation()):(m.cancelBubble=!0,m.returnValue=!1,m.keyCode=0),!1;a=!1;if(f.isMac){if(m.ctrlKey||m.metaKey)a=!0}else if(f.isFirefox){if(m.ctrlKey||m.altKey)a=!0}else m.ctrlKey^m.altKey&&(a=!0);if(!a&&(a=f.isOpera?m.which:void 0!==m.charCode?m.charCode:m.keyCode,31c?this._doAutoScroll("down",b,a-c):bl&&!this._wrapMode?this._doAutoScroll("right",b-l,a):(this._endAutoScroll(),this._setSelectionTo(b,a,!0))}}}},_isClientDiv:function(a){var b=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(b===a)return!0;a=a.parentNode}return!1}, _createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(a,b){var e=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:e.x,y:e.y,preventDefault:function(){this.defaultPrevented=!0}}},_createTouchEvent:function(a,b){var e=b.touches.length?this.convert({x:b.touches[0].clientX,y:b.touches[0].clientY},"page","document"):{};return{type:a,event:b,touchCount:b.touches.length, x:e.x,y:e.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var b=a.which?0===a.button:1===a.button;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||b&&this._isMouseDown)){var e=this._createMouseEvent("MouseUp",a);this.onMouseUp(e);if(e.defaultPrevented){a.preventDefault();this._isMouseDown=!1;return}}this._linksVisible||(b&&this._isMouseDown&&(-1!==this._dragOffset&&(e=this._getSelection(),e.extend(this._dragOffset),e.collapse(),this._setSelection(e,!0,!0), this._dragOffset=-1),this._isMouseDown=!1,this._endAutoScroll(),this._isW3CEvents&&this._setGrab(null)),b&&f.isFirefox&&(this._updateDOMSelection(),a.preventDefault()))},_handleMouseWheel:function(a){if(!this._noScroll){var b=this._getLineHeight(),e=0,c=0;f.isIE||f.isOpera?c=-a.wheelDelta/40*b:f.isFirefox?"wheel"===a.type?a.deltaMode?(e=Math.max(-256,Math.min(256,a.deltaX))*b,c=Math.max(-256,Math.min(256,a.deltaY))*b):(e=a.deltaX,c=a.deltaY):(b=f.isMac?3*a.detail:Math.max(-256,Math.min(256,a.detail))* b,a.axis===a.HORIZONTAL_AXIS?e=b:c=b):f.isMac?(c=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,e=0!==a.wheelDeltaX%120?1:40>c?40/(40-c):40,c=0!==a.wheelDeltaY%120?1:40>c?40/(40-c):40,e=Math.ceil(-a.wheelDeltaX/e),-1e&&(e=-1),0e&&(e=1),c=Math.ceil(-a.wheelDeltaY/c),-1c&&(c=-1),0c&&(c=1)):(e=-a.wheelDeltaX,c=8*(-a.wheelDeltaY/120)*b);if(f.isSafari||f.isChrome&&f.isMac){for(b=a.target;b&&void 0===b.lineIndex;)b=b.parentNode;this._mouseWheelLine=b}b=this._getScroll(); this._scrollView(e,c);e=this._getScroll();if(b.x!==e.x||b.y!==e.y)return a.preventDefault&&a.preventDefault(),!1}},_handlePaste:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(f.isIE){var b=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){b._updateDOMSelection();b._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(){var m=this._rootDiv.clientWidth,b=this._rootDiv.clientHeight;if(this._rootWidth!== m||this._rootHeight!==b)this._rootWidth!==m&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=m,this._rootHeight=b,m=9>f.isIE,b=this._calculateMetrics(),a(b,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=b,m=!0),m?this._queueUpdate():this._update(),this.dispatchEvent({type:"Resize"})},_handleRulerEvent:function(a){for(var b=a.target?a.target:a.srcElement,e=b.lineIndex;b&&!b._ruler;)void 0===e&&void 0!==b.lineIndex&&(e=b.lineIndex), b=b.parentNode;var c=b?b._ruler:null;if(void 0===e&&c&&"document"===c.getOverview()){var e=this._getClientHeight(),n=this._model.getLineCount(),l=this._getViewPadding(),d=this._viewDiv.getBoundingClientRect(),e=Math.floor((a.clientY-d.top-this._metrics.scrollWidth)*n/(e+l.top+l.bottom-2*this._metrics.scrollWidth));0<=e&&e=s+a.data.length;)b--;b++;l=d.substring(e,b+n);this._ignoreQueueUpdate=f.isSafari;this._modifyContent({text:l, start:e+c,end:b+c,_ignoreDOMSelection:!0,_ignoreDOMSelection1:f.isChrome},!0);this._ignoreQueueUpdate=!1}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){if(this.isListening("TouchStart")){var b=this._createTouchEvent("TouchStart",a);this.onTouchStart(b);if(b.defaultPrevented){a.preventDefault();return}if(this._noScroll)return}this._commitIME();b=this._getWindow();this._touchScrollTimer&&(this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",b.clearInterval(this._touchScrollTimer), this._touchScrollTimer=null);var e=a.touches;if(1===e.length){var e=e[0],c=e.clientX,n=e.clientY;this._touchStartX=c;this._touchStartY=n;if(f.isAndroid&&(na.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var e=this,c=this._getWindow();this._touchScrollTimer=c.setInterval(function(){var a=0,b=0;if(e._touching)a=e._touchStartX-e._touchCurrentX,b=e._touchStartY- e._touchCurrentY,e._touchSpeedX=a/10,e._touchSpeedY=b/10,e._touchStartX=e._touchCurrentX,e._touchStartY=e._touchCurrentY;else{if(0.1>Math.abs(e._touchSpeedX)&&0.1>Math.abs(e._touchSpeedY)){e._vScrollDiv.style.display="none";e._hScrollDiv.style.display="none";c.clearInterval(e._touchScrollTimer);e._touchScrollTimer=null;return}a=10*e._touchSpeedX;b=10*e._touchSpeedY;e._touchSpeedX*=0.95;e._touchSpeedY*=0.95}e._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){if(this.isListening("TouchEnd")){var b= this._createTouchEvent("TouchEnd",a);this.onTouchEnd(b);if(b.defaultPrevented){a.preventDefault();return}if(this._noScroll)return}0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var b,e,c=this._keyModes;for(e=c.length-1;0<=e;e--)if(b=c[e],"function"===typeof b.match&&(b=b.match(a),void 0!==b))return this.invokeAction(b);return!1},_doMove:function(a,b){var e=this._model,c=b.getCaret(),n=e.getLineAtOffset(c);a.count||(a.count=1);for(;0!==a.count;){var l=e.getLineStart(n);if(0>a.count&& c===l)if(0a.count?1:-1):(l=this._getLine(n),b.extend(l.getNextOffset(c,a)),l.destroy())}c=b.getCaret()}return b},_doBackspace:function(a){var b= this._getSelection();b.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,b));this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var e=this.getText(b.start,b.end);this._setSelection(b,!0);switch(a.type){case "lower":e=e.toLowerCase();break;case "capitalize":e=e.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;ba&&(n=a-e);this._setSelection(c,!0,!0,function(){b._columnX=g},n-s.y)}return!0},_doPageUp:function(a){var b=this,e=this._model,c=this._getSelection(), n=c.getCaret(),l=e.getLineAtOffset(n),d=this._getScroll(),s=this._getClientHeight(),g;if(this._lineHeight){g=this._columnX;d=this._getBoundsAtOffset(n);if(-1===g||a.select&&f.isIE)g=d.left;n=this._getLineIndex(d.bottom-s);e=this._getLine(n);l=this._getLinePixel(n);n=e.getOffset(g,d.bottom-s-l);s=e.getBoundingClientRect(n);e.destroy();c.extend(n);a.select||c.collapse();this._setSelection(c,!0,!0,function(){b._columnX=g},s.top+l-d.top);return!0}if(0c?Math.floor(c):Math.ceil(c),d=Math.max(0,Math.min(n-1,l+c));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)d=this._getLineIndex(e.y),l=this._getLine(l),e.x+=l.getBoundingClientRect(c,!1).left,l.destroy();0===d&&(f.isMac||f.isLinux)?b.extend(0):d===n-1&&(f.isMac||f.isLinux)?b.extend(a.getCharCount()):(l=this._getLine(d),b.extend(l.getOffset(e.x, e.y-this._getLinePixel(d))),l.destroy());this._setSelection(b,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var b=this._model.getLineCount(),e=0;if(a){a=0;for(var c=(new Date).getTime(),n=0;e=h.bottom-h.top,h=Math.max(1,h.bottom-h.top);s>d&&(k=1);g>s&&(k=2);u>g&&(k=3);var x;0!==k&&(x={style:{}},0!==(k& 1)&&(x.style.fontStyle="italic"),0!==(k&2)&&(x.style.fontWeight="bold"));d=n(e);a.removeChild(e);k=l(this._viewDiv);e=f.createElement(b,"div");e.style.position="fixed";e.style.left="-1000px";e.style.paddingLeft=k.left+"px";e.style.paddingTop=k.top+"px";e.style.paddingRight=k.right+"px";e.style.paddingBottom=k.bottom+"px";e.style.width="100px";e.style.height="100px";k=f.createElement(b,"div");k.style.width="100%";k.style.height="100%";e.appendChild(k);a.appendChild(e);s=e.getBoundingClientRect();g= k.getBoundingClientRect();u=0;!this._singleMode&&!this._noScroll&&(e.style.overflow="hidden",k.style.height="200px",u=e.clientWidth,e.style.overflow="scroll",u-=e.clientWidth);a.removeChild(e);var k={left:g.left-s.left,top:g.top-s.top,right:s.right-g.right,bottom:s.bottom-g.bottom},v=0,p=g=0;if(!c){e=f.createElement(b,"div");e.style.position="fixed";e.style.left="-1000px";a.appendChild(e);e.innerHTML=Array(2).join("a");s=e.getBoundingClientRect();p=Math.ceil(s.right-s.left);if(this._wrapOffset||this._marginOffset)e.innerHTML= Array(this._wrapOffset+1+(f.isWebkit?0:1)).join(" "),s=e.getBoundingClientRect(),v=Math.ceil(s.right-s.left),e.innerHTML=Array(this._marginOffset+1).join(" "),g=e.getBoundingClientRect(),g=Math.ceil(g.right-g.left);a.removeChild(e)}return{lineHeight:h,largestFontStyle:x,lineTrim:d,viewPadding:k,scrollWidth:u,wrapWidth:v,marginWidth:g,charWidth:p,invalid:c}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var b=this._getSelection(); if(b.isEmpty())return!1;"next"===a?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(a){if(-1!==this._imeOffset){var b=this._model,e=b.getLineAtOffset(this._imeOffset),c=b.getLineStart(e),n=this._getLineNode(e);if(!a){this._scrollDiv.focus();this._clientDiv.focus();var l=this._getDOMText(n).text,b=b.getLine(e),c=this._imeOffset-c,b=c+l.length-b.length;c!==b&&(a=l.substring(c,b))}a&&(!this._doContent(a)&&!f.isWebkit)&&(n.lineRemoved=!0,this._queueUpdate());this._imeOffset= -1}},_createActions:function(){this.addKeyMode(new r.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(c(b,{select:!1}))},actionDescription:{name:p.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(c(b,{select:!1}))},actionDescription:{name:p.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(c(b,{select:!1,ctrl:!1}))},actionDescription:{name:p.lineStart}},lineEnd:{defaultHandler:function(b){return a._doEnd(c(b, {select:!1,ctrl:!1}))},actionDescription:{name:p.lineEnd}},charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(c(b,{select:!1,unit:"character"}))},actionDescription:{name:p.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(c(b,{select:!1,unit:"character"}))},actionDescription:{name:p.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(c(b,{select:!1}))},actionDescription:{name:p.pageUp}},pageDown:{defaultHandler:function(b){return a._doPageDown(c(b, {select:!1}))},actionDescription:{name:p.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(c(b,{type:"pageUp"}))},actionDescription:{name:p.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(c(b,{type:"pageDown"}))},actionDescription:{name:p.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(c(b,{type:"lineUp"}))},actionDescription:{name:p.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(c(b,{type:"lineDown"}))}, actionDescription:{name:p.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(c(b,{select:!1,unit:"word"}))},actionDescription:{name:p.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(c(b,{select:!1,unit:"word"}))},actionDescription:{name:p.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(c(b,{select:!1,ctrl:!0}))},actionDescription:{name:p.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(c(b,{select:!1,ctrl:!0}))}, actionDescription:{name:p.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(c(b,{type:"textStart"}))},actionDescription:{name:p.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(c(b,{type:"textEnd"}))},actionDescription:{name:p.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(c(b,{type:"centerLine"}))},actionDescription:{name:p.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(c(b,{select:!0}))},actionDescription:{name:p.selectLineUp}}, selectLineDown:{defaultHandler:function(b){return a._doLineDown(c(b,{select:!0}))},actionDescription:{name:p.selectLineDown}},selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(c(b,{select:!0,wholeLine:!0}))},actionDescription:{name:p.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(c(b,{select:!0,wholeLine:!0}))},actionDescription:{name:p.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(c(b,{select:!0,ctrl:!1}))}, actionDescription:{name:p.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(c(b,{select:!0,ctrl:!1}))},actionDescription:{name:p.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(c(b,{select:!0,unit:"character"}))},actionDescription:{name:p.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(c(b,{select:!0,unit:"character"}))},actionDescription:{name:p.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(c(b, {select:!0}))},actionDescription:{name:p.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(c(b,{select:!0}))},actionDescription:{name:p.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(c(b,{select:!0,unit:"word"}))},actionDescription:{name:p.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(c(b,{select:!0,unit:"word"}))},actionDescription:{name:p.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(c(b, {select:!0,ctrl:!0}))},actionDescription:{name:p.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(c(b,{select:!0,ctrl:!0}))},actionDescription:{name:p.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(c(b,{unit:"character"}))},actionDescription:{name:p.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(c(b,{unit:"character"}))},actionDescription:{name:p.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(c(b, {unit:"word"}))},actionDescription:{name:p.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(c(b,{unit:"word"}))},actionDescription:{name:p.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(c(b,{unit:"line"}))},actionDescription:{name:p.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(c(b,{unit:"line"}))},actionDescription:{name:p.deleteLineEnd}},tab:{defaultHandler:function(b){return a._doTab(c(b,{}))}, actionDescription:{name:p.tab}},shiftTab:{defaultHandler:function(b){return a._doShiftTab(c(b,{}))},actionDescription:{name:p.shiftTab}},enter:{defaultHandler:function(b){return a._doEnter(c(b,{}))},actionDescription:{name:p.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(c(b,{noCursor:!0}))},actionDescription:{name:p.enterNoCursor}},selectAll:{defaultHandler:function(b){return a._doSelectAll(c(b,{}))},actionDescription:{name:p.selectAll}},copy:{defaultHandler:function(b){return a._doCopy(c(b, {}))},actionDescription:{name:p.copy}},cut:{defaultHandler:function(b){return a._doCut(c(b,{}))},actionDescription:{name:p.cut}},paste:{defaultHandler:function(b){return a._doPaste(c(b,{}))},actionDescription:{name:p.paste}},uppercase:{defaultHandler:function(b){return a._doCase(c(b,{type:"upper"}))},actionDescription:{name:p.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(c(b,{type:"lower"}))},actionDescription:{name:p.lowercase}},capitalize:{defaultHandler:function(b){return a._doCase(c(b, {unit:"word",type:"capitalize"}))},actionDescription:{name:p.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(c(b,{type:"reverse"}))},actionDescription:{name:p.reversecase}},toggleOverwriteMode:{defaultHandler:function(b){return a._doOverwriteMode(c(b,{}))},actionDescription:{name:p.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(b){return a._doTabMode(c(b,{}))},actionDescription:{name:p.toggleTabMode}},toggleWrapMode:{defaultHandler:function(b){return a._doWrapMode(c(b, {}))},actionDescription:{name:p.toggleWrapMode}}}},_createRulerParent:function(a,b){var e=f.createElement(a,"div");e.className=b;e.tabIndex=-1;e.style.overflow="hidden";e.style.MozUserSelect="none";e.style.WebkitUserSelect="none";e.style.position="absolute";e.style.top="0px";e.style.bottom="0px";e.style.cursor="default";e.style.display="none";e.setAttribute("aria-hidden","true");this._rootDiv.appendChild(e);return e},_createRuler:function(a,b){if(this._clientDiv){var e=this._getRulerParent(a);if(e){if(e!== this._marginDiv||this._marginOffset)e.style.display="block";e.rulerWidth=void 0;var c=f.createElement(e.ownerDocument,"div");c._ruler=a;a.node=c;c.rulerChanged=!0;c.style.position="relative";c.style.cssFloat="left";c.style.styleFloat="left";c.style.outline="none";if(void 0===b||0>b||b>=e.children.length)e.appendChild(c);else{for(var n=e.firstChild;n&&0this._getLineHeight()){a=b.getBoundingClientRect();var e=this._clientDiv.getBoundingClientRect(); a.bottom>e.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a));a=b.getBoundingClientRect(a);var e=this._getLinePixel(b.lineIndex);a.top+=e;a.bottom+=e;b.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getInnerRightWidth:function(){var a=this._innerRightDiv.rulerWidth;void 0===a&&(a=this._innerRightDiv.getBoundingClientRect(), this._innerRightDiv.rulerWidth=a=a.right-a.left);return a},_getClientWidth:function(){var a=this._getViewPadding(),b=this._getInnerRightWidth();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right-b)},_getClipboardText:function(a,e){var c=this._singleMode?"":this._model.getLineDelimiter(),n,l,d=this._getWindow(),s=d.clipboardData;!s&&a&&(s=a.clipboardData);if(s)return n=[],l=s.getData(f.isIE?"Text":"text/plain"),b(l,function(a){n.push(a)},function(){n.push(c)}),l=n.join(""),e&&e(l),l;if(f.isFirefox){this._ignoreFocus= !0;var g=this._clipboardDiv,s=this._rootDiv.ownerDocument;g||(this._clipboardDiv=g=f.createElement(s,"div"),g.style.position="fixed",g.style.whiteSpace="pre",g.style.left="-1000px",this._rootDiv.appendChild(g));g.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";g.firstChild.focus();var h=this,u=function(){var a=h._getTextFromElement(g);g.innerHTML="";n=[];b(a,function(a){n.push(a)},function(){n.push(c)});return n.join("")},q=!1;this._ignorePaste=!0;if(!f.isLinux||2!==this._lastMouseButton)try{q= s.execCommand("paste",!1,null)}catch(k){q=1b)for(;b=a;b--)e-=this._getLineHeight(b);return e}return this._getLineHeight()*a},_getLineIndex:function(a){var b,e=0,c=this._model.getLineCount();if(this._lineHeight){var e=this._getTopIndex(),n=-this._topIndexY+this._getScroll().y; if(a!==n)if(a=n&&ethis._getLineHeight()){a=b.getBoundingClientRect();var e=this._getViewPadding(),c=this._viewDiv.getBoundingClientRect();a.top(new Date).getTime()-this._lastScrollTime))return{};var a=this._viewDiv.getBoundingClientRect(), b=this._lastMouseMoveX,e=this._lastMouseMoveY;return{vertical:a.top<=e&&eb&&(d.end>b&&d.startb+l&&(e.lineIndex=c+n-l,e._line.lineIndex=e.lineIndex),e=this._getLineNext(e);this._lineHeight&&(a=[b,l].concat(Array(n)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&(b<=this._maxLineIndex&&this._maxLineIndex<= b+l)&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._update()},_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==b)for(var e=a;e< b;e++)this._lineHeight[e]=void 0;else e=this._model.getLineCount(),this._lineHeight=Array(e);this._calculateLineHeightTimer()}else this._lineHeight=null},_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new s(0,0,!1),!1,!1);this._viewDiv&& (this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var a=this._clientDiv;if(a){for(a=a.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;13>f.isFirefox&&this._fixCaret()}},_scrollViewAnimated:function(a,b,e){var c=this._getWindow();if(e&&this._scrollAnimation){var n=this;this._animation=new C({window:c,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);n._scrollView(0,a);b-=a},onEnd:function(){n._animation=null;n._scrollView(a,b);e&&c.setTimeout(e,0)}});this._animation.play()}else this._scrollView(a, b),e&&c.setTimeout(e,0)},_scrollView:function(a,b){this._ensureCaretVisible=!1;var e=this._viewDiv;a&&(e.scrollLeft+=a);b&&(e.scrollTop+=b)},_setClipboardText:function(a,e){var c,n=this._getWindow(),l=n.clipboardData;!l&&e&&(l=e.clipboardData);if(l&&(c=[],b(a,function(a){c.push(a)},function(){c.push(f.platformDelimiter)}),l.setData(f.isIE?"Text":"text/plain",c.join(""))||21=this._doubleClickSelection.start?(e=this._doubleClickSelection.start,c=n.getNextOffset(a,{unit:"wordend",count:1})):(e=n.getNextOffset(a,{unit:"word",count:-1}),c=this._doubleClickSelection.end):(e=n.getNextOffset(a,{unit:"word",count:-1}),c=n.getNextOffset(e,{unit:"wordend",count:1})),n.destroy()): this._doubleClickSelection?(c=n.getLineAtOffset(this._doubleClickSelection.start),a>=c?(e=n.getLineStart(c),c=n.getLineEnd(a)):(e=n.getLineStart(a),c=n.getLineEnd(c))):(e=n.getLineStart(a),c=n.getLineEnd(a)),l.setCaret(e),l.extend(c);this._setSelection(l,!0,!0);return!0},_setFullSelection:function(a,b){this._fullSelection=a;f.isWebkit&&(this._fullSelection=!0);var e=this._clipDiv||this._rootDiv;if(e)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!f.isIOS){var c=e.ownerDocument;this._highlightRGB= f.isWebkit?"transparent":"Highlight";var n=f.createElement(c,"div");this._selDiv1=n;n.style.position="absolute";n.style.borderWidth="0px";n.style.margin="0px";n.style.padding="0px";n.style.outline="none";n.style.background=this._highlightRGB;n.style.width="0px";n.style.height="0px";n.style.zIndex="0";e.appendChild(n);var l=f.createElement(c,"div");this._selDiv2=l;l.style.position="absolute";l.style.borderWidth="0px";l.style.margin="0px";l.style.padding="0px";l.style.outline="none";l.style.background= this._highlightRGB;l.style.width="0px";l.style.height="0px";l.style.zIndex="0";e.appendChild(l);this._selDiv3=c=f.createElement(c,"div");c.style.position="absolute";c.style.borderWidth="0px";c.style.margin="0px";c.style.padding="0px";c.style.outline="none";c.style.background=this._highlightRGB;c.style.width="0px";c.style.height="0px";c.style.zIndex="0";e.appendChild(c);if(f.isFirefox&&f.isMac){e=this._getWindow().getComputedStyle(c,null).getPropertyValue("background-color");switch(e){case "rgb(119, 141, 168)":e= "rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":e="rgb(198, 198, 198)";break;case "rgb(255, 193, 31)":e="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":e="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":e="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":e="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":e="rgb(232, 184, 255)";break;default:e="rgb(180, 213, 255)"}this._highlightRGB=e;n.style.background=e;l.style.background=e;c.style.background=e}b||this._updateDOMSelection()}}else this._selDiv1&& (e.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&(e.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(e.removeChild(this._selDiv3),this._selDiv3=null)},_setBlockCursor:function(a){this._blockCursorVisible=a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=this._viewDiv,b=f.createElement(a.ownerDocument, "div");b.className="textviewBlockCursor";this._cursorDiv=b;b.tabIndex=-1;b.style.zIndex="2";b.style.color="transparent";b.style.position="absolute";b.style.pointerEvents="none";b.innerHTML="\x26nbsp;";a.appendChild(b);this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";b||(this._metrics=this._calculateMetrics(),this._queueUpdate())}, _setWrapOffset:function(a,b){this._wrapOffset=a;b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setNoScroll:function(a,b){this._noScroll=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,b){this._tabSize=a;this._customTabSize=void 0;var e=this._clientDiv;f.isOpera? e&&(e.style.OTabSize=this._tabSize+""):537.1<=f.isWebkit?e&&(e.style.tabSize=this._tabSize+""):4<=f.isFirefox?e&&(e.style.MozTabSize=this._tabSize+""):8!==this._tabSize&&(this._customTabSize=this._tabSize);b||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a, b){this._themeClass=a;var e="textview",c=this._theme.getThemeClass();c&&(e+=" "+c);this._themeClass&&c!==this._themeClass&&(e+=" "+this._themeClass);this._rootDiv.className=e;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var e=this._clientDiv;this._wrapMode?(e.style.whiteSpace="pre-wrap",e.style.wordWrap="break-word"):(e.style.whiteSpace="pre",e.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a, b,e,c){if(this._clientDiv&&!(0z?v.bottom: z)-(v.topd.x+n&&(a=Math.max(y-d.x-n,x));l=0;rd.y+k&&(l=z-d.y-k);c&&(0l&&(l=Math.min(l,c)));c=C&&"always"===e.scrollPolicy;if(0!==a||0!==l||c)return C?(c=0e&&(e=0),1l.lineIndex?(e=l,d=b.getLineStart(l.lineIndex)):(e=this._getLineNode(e), d=a.start);cl.lineIndex?(c=l,b=b.getLineStart(l.lineIndex)):(c=this._getLineNode(c),b=a.end);this._setDOMSelection(e,d,c,b,a.caret)}}},_update:function(a){if(!(0n.y)break;r+=t;z++}k=z;v=Math.max(0,k-1);p=c=n.y-r;0E?(new x(this,E)).create(I,null):(I.firstChild&&(b.insertBefore(I,t),I=F.createDocumentFragment()),t&&t.lineChanged&&(t=(new x(this,E)).create(I,t),t.lineChanged=!1),t=this._getLineNext(t));I.firstChild&&b.insertBefore(I,t);f.isWebkit&&!this._wrapMode&&(b.style.width="0x7fffffffpx");t=this._getLineNext(); E=y+c;for(I=!1;t;)v=t.lineWidth,void 0===v&&(F=t._line.getBoundingClientRect(),v=t.lineWidth=Math.ceil(F.right-F.left),F=F.bottom-F.top,this._lineHeight?this._lineHeight[t.lineIndex]=F:0!==s&&(0!==F&&Math.ceil(s)!==Math.ceil(F))&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[t.lineIndex]=F)),this._lineHeight&&!I&&(E-=this._lineHeight[t.lineIndex],0>E&&(p=t.lineIndex,I=!0)),this._wrapMode||(v>=this._maxLineWidth&&(this._maxLineWidth=v,this._maxLineIndex=t.lineIndex),this._checkMaxLineIndex=== t.lineIndex&&(this._checkMaxLineIndex=-1)),t.lineIndex===k&&(this._topChild=t),t.lineIndex===p&&(this._bottomChild=t),t=this._getLineNext(t);-1!==this._checkMaxLineIndex&&(E=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=E&&E=this._maxLineWidth&&(this._maxLineWidth=v,this._maxLineIndex=E),s.destroy()));for(;zy&&(u=!0,k=v),this._maxLineWidth>k&&(h=!0,y=z,d>y&&(u=!0,k=v)),p!==h&&(e.style.overflowX=h?"scroll":"hidden"),E!==u&&(e.style.overflowY=u?"scroll":"hidden"),g=p!==h||E!==u);u=k;this._wrapMode?this._metrics.wrapWidth&&(u=this._metrics.wrapWidth):u=Math.max(this._maxLineWidth+this._getInnerRightWidth(),u);h=u;if((!f.isIE||9<=f.isIE)&&this._maxLineWidth>k)u+=l.right+l.left;n.style.width=u+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=u+"px");n=this._getScroll(!1);if(u= this._innerRightDiv)u.style.right=r+("scroll"===e.style.overflowY?this._metrics.scrollWidth:0)+"px",u.style.bottom=("scroll"===e.style.overflowX?q:0)+"px"}this._scrollHeight=d;this._vScrollDiv&&(u=y-8,r=Math.max(15,Math.ceil(Math.min(1,u/(d+l.top+l.bottom))*u)),this._vScrollDiv.style.left=s+k-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,n.y*u/d))+"px",this._vScrollDiv.style.height=r+"px");!this._wrapMode&&this._hScrollDiv&&(u=k-8,r=Math.max(15,Math.ceil(Math.min(1,u/(this._maxLineWidth+ l.left+l.right))*u)),this._hScrollDiv.style.left=s+Math.floor(Math.max(0,Math.floor(n.x*u/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=y-9+"px",this._hScrollDiv.style.width=r+"px");z=n.x;r=this._clipDiv;u=this._overlayDiv;if(p=this._marginDiv)p.style.left=-z+s+this._metrics.marginWidth+l.left+"px",p.style.bottom=("scroll"===e.style.overflowX?q:0)+"px";r?(r.scrollLeft=z,r.scrollTop=0,e=s+l.left,q=l.top,a=k,s=y,z=0,p=-c,0===n.x&&(e-=l.left,a+=l.left,z=l.left),n.x+k===h&&(a+=l.right),0===n.y&& (q-=l.top,s+=l.top,p+=l.top),n.y+y===d&&(s+=l.bottom),r.style.left=e+"px",r.style.top=q+"px",r.style.right=C-a-e+"px",r.style.bottom=J-s-q+"px",b.style.left=z+"px",b.style.top=p+"px",b.style.width=h+"px",b.style.height=y+c+"px",u&&(u.style.left=b.style.left,u.style.top=b.style.top,u.style.width=b.style.width,u.style.height=b.style.height)):(e=z,q=c,C=z+k,J=c+y,0===e&&(e-=l.left),0===q&&(q-=l.top),C===h&&(C+=l.right),n.y+y===d&&(J+=l.bottom),b.style.clip="rect("+q+"px,"+C+"px,"+J+"px,"+e+"px)",b.style.left= -z+s+l.left+"px",b.style.width=(this._wrapMode||f.isWebkit?h:k+z)+"px",a||(b.style.top=-c+l.top+"px",b.style.height=y+c+"px"),u&&(u.style.clip=b.style.clip,u.style.left=b.style.left,u.style.width=b.style.width,a||(u.style.top=b.style.top,u.style.height=b.style.height)));this._updateDOMSelection();g&&(b=this._ensureCaretVisible,this._ensureCaretVisible=!1,b&&this._showCaret(),this._queueUpdate())}}},_updateOverflow:function(){var a=this._viewDiv;this._noScroll?a.style.overflow="hidden":this._wrapMode? (a.style.overflowX="hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,b,e,c){if(a)for(var n=this._parent.ownerDocument,l=this._getLineHeight(),d=this._getViewPadding(),s=a.firstChild;s;){var g=s._ruler,h=g.getOverview();s.rulerChanged&&(q(g.getRulerStyle(),s),a.rulerWidth=void 0);if("fixed"!==h){var u=l;"page"===h&&(u+=this._topIndexY);s.style.top=-u+"px";s.style.height=c+u+"px";var k,x=s.firstChild;x?(k=x,x=x.nextSibling):(k=f.createElement(n,"div"),k.style.visibility= "hidden",s.appendChild(k));var v;if(s.rulerChanged&&k){u=-1;if(v=g.getWidestAnnotation())q(v.style,k),v.html&&(k.innerHTML=v.html);k.lineIndex=u;k.style.height=l+d.top+"px"}var p;if("page"===h){for(g=g.getAnnotations(b,e+1);x;)u=x.lineIndex,v=x.nextSibling,(!(b<=u&&u<=e)||x.lineChanged)&&s.removeChild(x),x=v;x=s.firstChild.nextSibling;p=n.createDocumentFragment();for(u=b;u<=e;u++)if(!x||x.lineIndex>u){k=f.createElement(n,"div");if(v=g[u])q(v.style,k),v.html&&(k.innerHTML=v.html),k.annotation=v;k.lineIndex= u;k.style.height=this._getLineHeight(u)+"px";p.appendChild(k)}else p.firstChild&&(s.insertBefore(p,x),p=n.createDocumentFragment()),x&&(x=x.nextSibling);p.firstChild&&s.insertBefore(p,x)}else{v=this._getClientHeight();u=this._model.getLineCount();x=v+d.top+d.bottom-2*this._metrics.scrollWidth;h=l*u>>0,0>u||(k=f.createElement(n,"div"),v=g[y], q(v.style,k),k.style.position="absolute",k.style.top=this._metrics.scrollWidth+l+Math.floor(u*h)+"px",v.html&&(k.innerHTML=v.html),k.annotation=v,k.lineIndex=u,p.appendChild(k));s.appendChild(p)}else if(s._oldTrackHeight!==x)for(k=s.firstChild?s.firstChild.nextSibling:null;k;)k.style.top=this._metrics.scrollWidth+l+Math.floor(k.lineIndex*h)+"px",k=k.nextSibling;s._oldTrackHeight=x}}s.rulerChanged=!1;s=s.nextSibling}},_updateStyleSheet:function(){var a="";f.isWebkit&&0k)break;if(d.end>k)return-1;f+= d._model.getCharCount()-(d.end-d.start)}return k+f}for(q=0;qk-f)break;var c=d._model.getCharCount();if(d.start+c>k-f)return-1;f+=c-(d.end-d.start)}return k-f},removeProjection:function(k){this._removeProjection(k)},_removeProjection:function(k,g){var h,f=0;for(h=0;hk)return null;var h=this._model,f=this._projections,q=0,d=[],c=0,a,b,l;for(a=0;a=k-q)break;b=l._model.getLineCount()-1;if(l._lineIndex+b>=k-q){c=k-(l._lineIndex+q);if(ck-q)break;d.push(h.getText(c,l.start));b=l._model.getLineCount()-1;if(l._lineIndex+b>k-q)return d.push(l._model.getLine(0,g)),d.join("");d.push(l._model.getText());c=l.end;q+=b-l._lineCount}f=h.getLineEnd(k-q,g);ck-f)break;var a=c._model.getCharCount();if(c.start+a>k-f){h=k-(c.start+f);q+=c._model.getLineAtOffset(h); f+=h;break}q+=c._model.getLineCount()-1-c._lineCount;f+=a-(c.end-c.start)}return g.getLineAtOffset(k-f)+q},getLineCount:function(){for(var k=this._projections,g=this._model.getLineCount(),h=0;hk)return-1;for(var h=this._model,f=this._projections,q=0,d=0,c=0;ck-q)break;var b=a._model.getLineCount()- 1;if(a._lineIndex+b>k-q)return a._model.getLineEnd(k-(a._lineIndex+q),g)+a.start+d;d+=a._model.getCharCount()-(a.end-a.start);q+=b-a._lineCount}return h.getLineEnd(k-q,g)+d},getLineStart:function(k){if(0>k)return-1;for(var g=this._model,h=this._projections,f=0,q=0,d=0;d=k-f)break;var a=c._model.getLineCount()-1;if(c._lineIndex+a>=k-f)return c._model.getLineStart(k-(c._lineIndex+f))+c.start+q;q+=c._model.getCharCount()-(c.end-c.start);f+=a-c._lineCount}return g.getLineStart(k- f)+q},getText:function(k,g){void 0===k&&(k=0);var h=this._model,f=this._projections,q=0,d=[],c,a,b;for(c=0;ck-q)break;b=a._model.getCharCount();if(a.start+b>k-q){if(void 0!==g&&a.start+b>g-q)return a._model.getText(k-(a.start+q),g-(a.start+q));d.push(a._model.getText(k-(a.start+q)));k=a.end+q+b-(a.end-a.start)}q+=b-(a.end-a.start)}var l=k-q;if(void 0!==g){for(;cg-q)break;d.push(h.getText(l,a.start));b=a._model.getCharCount();if(a.start+ b>g-q)return d.push(a._model.getText(0,g-(a.start+q))),d.join("");d.push(a._model.getText());l=a.end;q+=b-(a.end-a.start)}d.push(h.getText(l,g-q))}else{for(;cg);f++);var c=f;for(f=0;f=h);f++);var a=f,b=this._model,g=k.baseText.length- (h-g);for(f=a;fl)break;if(b.end>l)return-1;c+=b._model.getCharCount()-(b.end-b.start)}return l+c};h.start=k(f);-1===h.start&&(h.text=this._model.getText(b.start,f)+h.text,h.addedLineCount+=this._model.getLineAtOffset(f)-this._model.getLineAtOffset(b.start),h.start=b.start+c);h.end=k(q);-1===h.end&&(h.text+=this._model.getText(q,b.end),h.addedLineCount+= this._model.getLineAtOffset(b.end)-this._model.getLineAtOffset(q),h.end=b.start+c)}h.addedCharCount=h.text.length;h.removedCharCount=h.end-h.start;h.removedLineCount=this.getLineAtOffset(h.end)-this.getLineAtOffset(h.start);this.onChanging({type:"Changing",text:h.text,start:h.start,removedCharCount:h.removedCharCount,addedCharCount:h.addedCharCount,removedLineCount:h.removedLineCount,addedLineCount:h.addedLineCount})},onChanging:function(k){return this.dispatchEvent(k)},onChanged:function(k){return this.dispatchEvent(k)}, setLineDelimiter:function(k){this._model.setLineDelimiter(k)},setText:function(k,g,h){function f(b){for(d=c=0;cb-d)break;var e=a._model.getCharCount();if(a.start+e>b-d)return-1;d+=e-(a.end-a.start)}return b-d}this._change={text:k||"",start:g||0,end:void 0===h?this.getCharCount():h};var q=this._projections,d,c,a,b,l;k=f(this._change.start);-1===k&&(b={projection:a,start:this._change.start-(a.start+d)},k=a.end);g=f(this._change.end);-1===g&&(l={projection:a,end:this._change.end- (a.start+d)},g=a.start);b&&l&&b.projection===l.projection?a._model.setText(this._change.text,b.start,l.end):(this._model.setText(this._change.text,k,g),b&&(a=b.projection,a._model.setText("",b.start)),l&&(a=l.projection,a._model.setText("",0,l.end),a.start=a.end,a._lineCount=0));this._change=void 0}};t.EventTarget.addMixin(r.prototype);return{ProjectionTextModel:r}}); define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(p,t){function r(){}function k(a,b,c){this.start=a;this.end=b;this._projectionModel=c;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function g(a,b){var c=a.lastIndexOf("."),c=a.substring(c+1),n={title:p[c],style:{styleClass:"annotation "+c},html:"\x3cdiv class\x3d'annotationHTML "+c+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+c}};b?n.lineStyle= {styleClass:"annotationLine "+c}:n.rangeStyle={styleClass:"annotationRange "+c};r.registerType(a,n)}function h(){}function f(a,b,c,n,e){var s;void 0===n&&(n=-1);void 0===e&&(e=a.length);for(;1n.start?a=b)break}return null};n=s();return{next:function(){var a=n;a&&(n=s());return a},hasNext:function(){return null!==n}}},modifyAnnotation:function(a){if(a&&!(0>this._getAnnotationIndex(a)))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var b=this._annotations,c,n;if(a){c=[];for(n=b.length-1;0<=n;n--){var e=b[n];e.type===a&&(b.splice(n,1),c.splice(0,0,e),e._annotationModel=null)}}else c=b;this.onChanged({type:"Changed", removed:c,added:[],changed:[]})},removeAnnotation:function(a){if(a){var b=this._getAnnotationIndex(a);0>b||(a._annotationModel=null,a={type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]},this.onChanged(a))}},replaceAnnotations:function(a,b){var c=this._annotations,n,e,s,d=[];if(a)for(n=a.length-1;0<=n;n--)s=a[n],e=this._getAnnotationIndex(s),0>e||(s._annotationModel=null,c.splice(e,1),d.splice(0,0,s));b||(b=[]);for(n=0;n=s?(d._oldStart=d.start,d._oldEnd=d.end,d.start+=c,d.end+=c,a.changed.push(d)):d.end<=b||(d.start=e.end)){c=this._mergeStyle({},e.style);c=this._mergeStyle(c,b.style);var d=[];d.push(n,1);b.starte.start&&d.push({start:e.start, end:b.start,style:e.style});d.push({start:Math.max(e.start,b.start),end:Math.min(e.end,b.end),style:c});b.ende.end?{start:e.end,end:b.end,style:b.style}:null;Array.prototype.splice.apply(a,d)}}b&&(c=this._mergeStyle({},b.style),a.splice(n,0,{start:b.start,end:b.end,style:c}));return a},_onAnnotationModelChanged:function(a){function b(a,b){d.getBaseModel&&(a=d.mapOffset(a,!0),b=d.mapOffset(b,!0));-1!==a&&-1!==b&&n.redrawRange(a,b)}function c(a, n){for(var l=0;l=h&&void 0!==l.groupId){c=l;break}if(f&&c&&f.groupId===c.groupId)return}this._currentGroupAnnotation=null;f&&b.removeAnnotations(f.groupType);if(c&&-1!==a){this._currentGroupAnnotation= c;d=b.getAnnotations();for(a=[];d.hasNext();)l=d.next(),delete l.groupAnnotation,l.groupId===c.groupId&&(l=l.createGroupAnnotation(),a.push(l));b.replaceAnnotations(null,a)}}});r.AnnotationTypeList.addMixin(d.prototype);c.prototype=new d;c.prototype.getAnnotations=function(a,b){for(var c=d.prototype.getAnnotations.call(this,a,b),l=this._view.getModel(),f=a;fthis.size&&(this.stack.shift(),this.index--))},markClean:function(){this._commitUndo();if(this.cleanChange= this.stack[this.index-1])this.cleanChange.type=2},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return 0=this.index)break;k=this.stack[--this.index]}while(!(k=k.undo(this.view,!0)));this._ignoreUndo=!1;return k},redo:function(){this._commitUndo();var k;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;k=this.stack[this.index++]}while(!k.redo(this.view, !0));this._ignoreUndo=!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(k){this.view!==k&&(this.view&&k.removeEventListener("Destroy",this._listener.onDestroy),(this.view=k)&&k.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(k){this._commitUndo();k=new t(k);this.add(k);this.compoundChange=k;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()}, _onDestroy:function(k){(!k||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(k){if(!this._ignoreUndo){var g=k.text,h=k.start,f=k.addedCharCount,q=k.removedCharCount;k=h+q;var d=0;0===f&&1===q?d=-1:1===f&&0===q&&(d=1);f=this.stack.length;q=this.model.getText(h,k);(!(0=this._dragSelection.end?h-=this._dragSelection.end-this._dragSelection.start:h>=this._dragSelection.start&&(h=this._dragSelection.start));k.setText(g,h,h);k.setSelection(h, h+g.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(p){this._onDragOver(p)},_onDragOver:function(r){var k=r.event.dataTransfer.types,g=!this._view.getOptions("readonly");g&&k&&(g=k.contains?k.contains("text/plain")||k.contains("Text"):-1!==k.indexOf("text/plain")||-1!==k.indexOf("Text"));g?p.isFirefox||(this._dropEffect=r.event.dataTransfer.dropEffect=(p.isMac?r.event.altKey:r.event.ctrlKey)?"copy": "move"):r.event.dataTransfer.dropEffect="none"},_onDrop:function(r){var k=this._view,g=r.event.dataTransfer.getData("Text");g&&(p.isFirefox||(r.event.dataTransfer.dropEffect=this._dropEffect),r=k.getOffsetAtLocation(r.x,r.y),this._dragSelection?(this._dropOffset=r,this._dropText=g):(k.setText(g,r,r),k.setSelection(r,r+g.length)))}};return{TextDND:t}}); define("orion/editor/editor","i18n!orion/editor/nls/messages orion/editor/eventTarget orion/editor/tooltip orion/editor/annotations orion/objects orion/util".split(" "),function(p,t,r,k,g,h){function f(c){c=c||{};this._domNode=c.domNode;this._model=c.model;this._undoStack=c.undoStack;this._statusReporter=c.statusReporter;this._title=null;var a=this;this._listener={onChanged:function(b){a.onChanged(b)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()} function q(c){c=c||{};f.call(this,c);this._textViewFactory=c.textViewFactory;this._undoStackFactory=c.undoStackFactory;this._textDNDFactory=c.textDNDFactory;this._annotationFactory=c.annotationFactory;this._zoomRulerFactory=c.zoomRulerFactory;this._foldingRulerFactory=c.foldingRulerFactory;this._lineNumberRulerFactory=c.lineNumberRulerFactory;this._contentAssistFactory=c.contentAssistFactory;this._keyBindingFactory=c.keyBindingFactory;this._hoverFactory=c.hoverFactory;this._contentAssist=this._foldingRuler= this._zoomRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=this._annotationStyler=null}var d=k.AnnotationType;f.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(c,a){return this.getModel().getText(c, a)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(c){return this.dispatchEvent(c)},onInputChanged:function(c){return this.dispatchEvent(c)},onChanged:function(c){this.checkDirty()},reportStatus:function(c,a,b){this._statusReporter&&this._statusReporter(c,a,b)},resize:function(){},setDirty:function(c){this._dirty!== c&&(this._dirty=c,this.onDirtyChanged({type:"DirtyChanged"}))},_setModelText:function(c){this._model&&this._model.setText(c)},setInput:function(c,a,b,l){this._title=c;l||(a?this.reportStatus(a,"error"):null!==b&&(void 0!==b&&"string"===typeof b)&&this._setModelText(b),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:c,message:a,contents:b,contentsSaved:l})},setText:function(c,a,b){this.getModel().setText(c,a,b)},uninstall:function(){this.installed= !1}};t.EventTarget.addMixin(f.prototype);q.prototype=new f;g.mixin(q.prototype,{destroy:function(){f.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},getZoomRuler:function(){return this._zoomRuler},getModel:function(){if(!this._textView)return null;var c=this._textView.getModel();c.getBaseModel&&(c=c.getBaseModel());return c},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(c,a){if(this._annotationRulerVisible!==c||a)if(this._annotationRulerVisible=c,this._annotationRuler){var b=this._textView;c?b.addRuler(this._annotationRuler,0):b.removeRuler(this._annotationRuler)}}, setFoldingRulerVisible:function(c,a){if(this._foldingRulerVisible!==c||a)if(this._foldingRulerVisible=c,this._foldingRuler){var b=this._textView;b.getModel().getBaseModel&&(c?b.addRuler(this._foldingRuler):b.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(c,a){if(this._lineNumberRulerVisible!==c||a)if(this._lineNumberRulerVisible=c,this._lineNumberRuler){var b=this._textView;c?b.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):b.removeRuler(this._lineNumberRuler)}}, setOverviewRulerVisible:function(c,a){if(this._overviewRulerVisible!==c||a)if(this._overviewRulerVisible=c,this._overviewRuler){var b=this._textView;c?b.addRuler(this._overviewRuler):b.removeRuler(this._overviewRuler)}},setZoomRulerVisible:function(c,a){if(this._zoomRulerVisible!==c||a)if(this._zoomRulerVisible=c,this._zoomRuler){var b=this._textView;c?b.addRuler(this._zoomRuler):b.removeRuler(this._zoomRuler)}},mapOffset:function(c,a){var b=this._textView.getModel();b.getBaseModel&&(c=b.mapOffset(c, a));return c},getLineAtOffset:function(c){return this.getModel().getLineAtOffset(this.mapOffset(c))},getLineStart:function(c){return this.getModel().getLineStart(c)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var c=this._textView,a=c.getSelection(),c=c.getModel();c.getBaseModel&&(a.start=c.mapOffset(a.start),a.end=c.mapOffset(a.end));return a},_expandOffset:function(c){var a=this._textView.getModel(),b=this._annotationModel;if(b&&a.getBaseModel)for(c= b.getAnnotations(c,c+1);c.hasNext();)a=c.next(),a.type===d.ANNOTATION_FOLDING&&a.expand&&a.expand()},setCaretOffset:function(c,a,b){var l=this._textView,n=l.getModel();n.getBaseModel&&(this._expandOffset(c),c=n.mapOffset(c,!0));l.setCaretOffset(c,a,b)},setText:function(c,a,b){var l=this._textView,n=l.getModel();n.getBaseModel&&(void 0!==a&&(this._expandOffset(a),a=n.mapOffset(a,!0)),void 0!==b&&(this._expandOffset(b),b=n.mapOffset(b,!0)));l.setText(c,a,b)},setSelection:function(c,a,b,l){var n=this._textView, e=n.getModel();e.getBaseModel&&(this._expandOffset(c),this._expandOffset(a),c=e.mapOffset(c,!0),a=e.mapOffset(a,!0));n.setSelection(c,a,b,l)},moveSelection:function(c,a,b,l){var n=this._textView;this.setSelection(c,a||c,1/3,function(){(void 0===l||l)&&n.focus();b&&b()})},_getTooltipInfo:function(c,a){var b=this._textView,l=this.getAnnotationModel();if(!l)return null;var n=this._annotationStyler;if(!n)return null;var e=b.getOffsetAtLocation(c,a);if(-1===e)return null;for(var e=this.mapOffset(e),d= n.getAnnotationsByType(l,e,e+1),l=[],n=[],f=0;fd.start?d.end-1:d.end),f=c.getLineStart(e),e=c.getLineEnd(d,!0),g=c.getLineCount(),h="",f=c.getText(f,e);d===g-1&&(f=(h=c.getLineDelimiter())+f);a.setText(f,e,e);a.setSelection(e+h.length,e+f.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),d=c.getLineAtOffset(d.end>d.start?d.end- 1:d.end),e=c.getLineStart(e),f=c.getLineEnd(d,!0),g=c.getLineCount(),h="",f=c.getText(e,f);d===g-1&&(f+=h=c.getLineDelimiter());a.setText(f,e,e);a.setSelection(e,e+f.length-h.length);return!0},deleteLines:function(a){var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=1;a&&a.count&&(d=a.count);var e=c.getSelection(),f=c.getModel(),g=f.getLineAtOffset(e.start);a=f.getLineStart(g);d=e.start!==e.end||1===d?f.getLineAtOffset(e.end>e.start?e.end-1:e.end):Math.min(g+d-1,f.getLineCount()- 1);d=f.getLineEnd(d,!0);c.setText("",a,d);return!0},expandAnnotation:function(a){var c=this.editor,d=c.getAnnotationModel();if(!d)return!0;var e=c.getModel(),f=c.getCaretOffset(),g=e.getLineAtOffset(f),f=e.getLineStart(g),g=e.getLineEnd(g,!0);e.getBaseModel&&(f=e.mapOffset(f),g=e.mapOffset(g),e.getBaseModel());for(var h,d=d.getAnnotations(f,g);!h&&d.hasNext();)e=d.next(),e.type===r.AnnotationType.ANNOTATION_FOLDING&&(h=e);h&&a!==h.expanded&&(a?h.expand():(c.setCaretOffset(h.start),h.collapse())); return!0},expandAnnotations:function(a){var c=this.editor,d=c.getTextView(),c=c.getAnnotationModel();if(!c)return!0;var e=c.getAnnotations();for(d.setRedraw(!1);e.hasNext();)c=e.next(),c.type===r.AnnotationType.ANNOTATION_FOLDING&&a!==c.expanded&&(a?c.expand():c.collapse());d.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,c=a.getTextView();if(c.getOptions("readonly"))return!1;if(c.getOptions("tabMode")){var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),g=d.getLineAtOffset(e.end> e.start?e.end-1:e.end);if(f!==g){var h=[];h.push("");for(var k=f;k<=g;k++)h.push(d.getLine(k,!0));k=d.getLineStart(f);d=d.getLineEnd(g,!0);c=c.getOptions("tabSize","expandTab");c=c.expandTab?Array(c.tabSize+1).join(" "):"\t";a.setText(h.join(c),k,d);a.setSelection(k===e.start?e.start:e.start+c.length,e.end+(g-f+1)*c.length);return!0}return!1}},gotoLastEdit:function(){"number"===typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor, c=a.getModel().getLineAtOffset(a.getCaretOffset());if(c=prompt(p.gotoLinePrompty,c+1))c=parseInt(c,10),a.onGotoLine(c-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start),f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=c.getLineCount();if(f===g-1)return!0;var e=c.getLineStart(e),d=c.getLineEnd(f,!0),h=c.getLineEnd(f+1,!0)-(d-e),k=0;f!==g-2?c=c.getText(e,d):(f=c.getLineEnd(f), c=c.getText(f,d)+c.getText(e,f),k+=d-f);this.startUndo();a.setText("",e,d);a.setText(c,h,h);a.setSelection(h+k,h+k+c.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var c=a.getModel(),d=a.getSelection(),e=c.getLineAtOffset(d.start);if(0===e)return!0;var f=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),g=c.getLineCount(),d=c.getLineStart(e-1),h=c.getLineStart(e),k=c.getLineEnd(f,!0),q=c.getText(h,k),p=0;f===g-1&&(f=c.getLineEnd(e- 1),e=c.getLineEnd(e-1,!0),q+=c.getText(f,e),h=f,p=e-f);this.startUndo();a.setText("",h,k);a.setText(q,d,d);a.setSelection(d,d+q.length-p);this.endUndo();return!0},nextAnnotation:function(a){function d(a){return!!a.lineStyle||a.type===c.ANNOTATION_MATCHING_BRACKET||a.type===c.ANNOTATION_CURRENT_BRACKET||!f.isAnnotationTypeVisible(a.type)}var n=this.editor,e=n.getAnnotationModel();if(!e)return!0;var f=n.getOverviewRuler()||n.getAnnotationStyler();if(!f)return!0;for(var g=n.getModel(),h=n.getCaretOffset(), q=e.getAnnotations(a?h:0,a?g.getCharCount():h),p=null;q.hasNext();){var r=q.next();if(a){if(r.start<=h)continue}else if(r.start>=h)continue;if(!d(r)&&(p=r,a))break}if(p){for(var t=[p],q=e.getAnnotations(p.start,p.start);q.hasNext();)r=q.next(),r!==p&&!d(r)&&t.push(r);var m=n.getTextView(),w=g.getLineAtOffset(p.start),B=k.Tooltip.getTooltip(m);if(!B)return n.moveSelection(p.start),!0;n.moveSelection(p.start,p.start,function(){B.setTarget({getTooltipInfo:function(){var a=m.convert({x:m.getLocationAtOffset(p.start).x, y:m.getLocationAtOffset(g.getLineStart(w)).y},"document","page");return{contents:t,x:a.x,y:a.y+Math.floor(1.33*m.getLineHeight(w))}}},0)})}return!0},unindentLines:function(){var a=this.editor,c=a.getTextView();if(c.getOptions("readonly"))return!1;if(c.getOptions("tabMode")){for(var d=a.getModel(),e=a.getSelection(),f=d.getLineAtOffset(e.start),g=d.getLineAtOffset(e.end>e.start?e.end-1:e.end),h=c.getOptions("tabSize"),k=Array(h+1).join(" "),q=[],p=c=0,r=f;r<=g;r++){var m=d.getLine(r,!0);if(d.getLineStart(r)!== d.getLineEnd(r))if(0===m.indexOf("\t"))m=m.substring(1),c++;else if(0===m.indexOf(k))m=m.substring(h),c+=h;else return!0;r===f&&(p=c);q.push(m)}f=d.getLineStart(f);h=d.getLineEnd(g,!0);d=d.getLineStart(g);a.setText(q.join(""),f,h);g=f===e.start?e.start:e.start-p;e=Math.max(g,e.end-c+(e.end===d+1&&e.start!==e.end?1:0));a.setSelection(g,e);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};a.TextActions= q;d.prototype={init:function(){var a=this.editor.getTextView();a.setAction("lineStart",function(){return this.lineStart()}.bind(this));a.setAction("enter",function(){return this.autoIndent()}.bind(this));a.setKeyBinding(new t.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:p.trimTrailingWhitespaces});a.setKeyBinding(new t.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment", function(){return this.toggleLineComment()}.bind(this),{name:p.toggleLineComment});a.setKeyBinding(new t.KeyBinding(191,!0,!f.isMac,!1,f.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:p.addBlockComment});a.setKeyBinding(new t.KeyBinding(220,!0,!f.isMac,!1,f.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:p.removeBlockComment});a.setKeyBinding(new t.KeyBinding("[", !1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new t.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new t.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c", "\x3e")}.bind(this));a.setKeyBinding(new t.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new t.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new t.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis", function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new t.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new t.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new t.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation", function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new t.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation");a.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this));a.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){var a=this.editor,c=a.getTextView();if(c.getOptions("readonly")||c.getOptions("singleMode"))return!1;var d=a.getSelection();if(d.start===d.end){for(var e=a.getModel(), f=e.getLineAtOffset(d.start),g=e.getLine(f,!1),h=e.getLineStart(f),k=0,q=d.start-h,p;k]/;return e.start===e.end&&h.test(g)?(d.setText(a+c,e.start,e.start),d.setCaretOffset(e.start+1),!0):e.start!==e.end?(f=f.getText(e.start,e.end),d.setText(a+f+c,e.start,e.end),d.setSelection(e.start+1,e.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1; var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),e=c.getModel(),f=c.getCaretOffset(),g=0===f?"":e.getText(d.start-1,d.start).trim(),h=f===e.getCharCount()?"":e.getText(d.start,d.start+1).trim(),f=/^"$|^'$/,k=/\w/,q=/^$|[)}\]>]/;if(d.start!==d.end){e=e.getText(d.start,d.end);if(f.test(e))return!1;c.setText(a+e+a,d.start,d.end);c.setSelection(d.start+1,d.end+1)}else{if(h!==a){if(g===a||f.test(h)||k.test(g)||!q.test(h))return!1;c.setText(a+a,d.start,d.start)}c.setCaretOffset(d.start+ 1)}return!0},contentAssistProposalApplied:function(a){function c(){return"number"===typeof d.escapePosition?d.escapePosition:a.data.start+d.proposal.length}var d=a.data.proposal;if(d.positions&&0q);g--)if(-1!==q){p=a.getLineStart(g)+q;break}for(g=f;gf.start?f.end-1:f.end),k=!0,q=[],p,r=g;r<=h;r++){var m=e.getLine(r,!0);p=m.indexOf(d);q.push(p);if(!k||-1===p)k=!1;else if(0!==p){for(k=0;kk&&(d.start=Math.max(k,d.start-h));d.start!==d.end&&d.end>k&&(d.end=Math.max(k,d.end-h))}}a.getUndoStack().endCompoundChange();a.setSelection(d.start,d.end,!1);a.getTextView().setRedraw(!0)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),e=c.getModel();return(c.getCaretOffset()===e.getCharCount()?"":e.getText(d.start, d.start+1))===a?(c.setCaretOffset(d.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},setAutoPairParentheses:function(a){this.autoPairParentheses=a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a}, setLineComment:function(a){this.lineComment=a},setSmartIndentation:function(a){this.smartIndentation=a}};a.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,"")});return a}); define("orion/editor/templates",[],function(){function p(p,k,g,h){this.prefix=p;this.description=k;this.template=g;this.name=h;this._parse()}function t(p,k){this._keywords=p||[];this._templates=[];this.addTemplates(k||[])}p.prototype={getProposal:function(p,k,g){p=k-p.length;k={};var h,f=void 0!==g.delimiter?g.delimiter:"\n";g.indentation&&(f+=g.indentation);var q=void 0!==g.tab?g.tab:"\t",d=0,c=this.variables,a=this.segments;g=[];for(var b=0;ba.name?1:0}),h.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return h},removePrefix:function(p,k){if(!(k.overwrite=k.proposal.substring(0,p.length)!==p))k.proposal=k.proposal.substring(p.length)},isValid:function(p,k,g,h){return!0}};return{Template:p,TemplateContentAssist:t}}); define("orion/editor/linkedMode","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/editor/templates orion/objects orion/util".split(" "),function(p,t,r,k,g,h){function f(d,c,a){var b=d.getTextView();r.KeyMode.call(this,b);this.editor=d;this.undoStack=c;this.contentAssist=a;this.linkedModeModel=null;b.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));b.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1); return!0}.bind(this));b.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));b.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(0=this.proposals.length){if(b)return!0; a=0}}else if(void 0===a&&(a=this.selectedIndex-1),0>a){if(b)return!0;a=this.proposals.length-1}for(var d=a;this.proposals[a]&&this.proposals[a].unselectable;){if(c){if(a++,a>=this.proposals.length){if(b)return!0;a=0}}else if(a--,0>a){if(b)return!0;a=this.proposals.length-1}if(a===d){a=-1;break}}this.selectedIndex=a;this.widget&&this.widget.selectNode(a);return!0},pageUp:function(){if(this.widget){var a=this.widget.getTopIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!1),a=this.widget.getTopIndex()); return 0===a?this.lineDown(a,!0):this.lineUp(a,!0)}return this.lineUp()},pageDown:function(){if(this.widget){var a=this.widget.getBottomIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!0),a=this.widget.getBottomIndex());return this.lineDown(a,!0)}return this.lineDown()},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},tab:function(){return this.widget?(this.widget.parentNode.focus(),!0):!1}});b.prototype={onClick:function(a){a||(a=window.event); this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},onScroll:function(a){this.previousCloneNode&&!this.preserveCloneThroughScroll&&(this._removeCloneNode(),this.previousSelectedNode.classList.add(n.selected));this.preserveCloneThroughScroll=!1},createDiv:function(a,b,c){var d=b.ownerDocument,f=q.createElement(d,"div");f.id="contentoption"+c;f.setAttribute("role","option");f.className=n[a.style]?n[a.style]:n.dfault;"hr"===a.style?a=q.createElement(d,"hr"):(a=this._createDisplayNode(f, a,c),f.contentAssistProposalIndex=c);f.appendChild(a);b.appendChild(f)},createAccessible:function(){var a=this._contentAssistMode,b=this;f.addEventListener(this.parentNode,"keydown",function(c){c||(c=window.event);c.preventDefault&&c.preventDefault();return c.keyCode===d.KEY.ESCAPE?a.cancel():c.keyCode===d.KEY.UP?a.lineUp():c.keyCode===d.KEY.DOWN?a.lineDown():c.keyCode===d.KEY.ENTER?a.enter():c.keyCode===d.KEY.PAGEDOWN?a.pageDown():c.keyCode===d.KEY.PAGEUP?a.pageUp():c.keyCode===d.KEY.HOME?(b.scrollIndex(0, !0),a.lineDown(0)):c.keyCode===d.KEY.END?a.lineUp(a.getProposals().length-1):!1})},_createDisplayNode:function(a,b,c){var d=null,f=null;if("string"===typeof b)f=b;else if(b.description&&"string"===typeof b.description)if(b.name&&"string"===typeof b.name){var g=this._createNameNode(b.name);g.contentAssistProposalIndex=c;d=document.createElement("span");d.appendChild(g);g=document.createTextNode(b.description);d.appendChild(g);a.setAttribute("title",b.name+b.description)}else f=b.description;else f= b.proposal;f&&(d=this._createNameNode(f),a.setAttribute("title",f));d.contentAssistProposalIndex=c;return d},_createNameNode:function(a){var b=document.createElement("span");b.classList.add("proposal-name");b.appendChild(document.createTextNode(a));return b},getProposal:function(a){var b=null;a=a.contentAssistProposalIndex;void 0!==a&&(b=this._contentAssistMode.getProposals()[a]||null);return b},getTopIndex:function(){for(var a=this.parentNode.childNodes,b=0;b=this.parentNode.scrollTop)return b; return 0},getBottomIndex:function(){for(var a=this.parentNode.childNodes,b=0;bthis.parentNode.scrollTop+this.parentNode.clientHeight)return Math.max(0,b-1)}return a.length-1},scrollIndex:function(a,b){this.parentNode.childNodes[a].scrollIntoView(b);this.preserveCloneThroughScroll=!0},selectNode:function(a){var b=null;this.previousSelectedNode&&(this.previousSelectedNode.classList.remove(n.selected),this.previousSelectedNode=null,this.previousCloneNode&& this._removeCloneNode());if(-1!==a){b=this.parentNode.childNodes[a];b.classList.add(n.selected);this.parentNode.setAttribute("aria-activedescendant",b.id);b.focus();b.offsetTopthis.parentNode.scrollTop+this.parentNode.clientHeight&&(b.scrollIntoView(!1),this.preserveCloneThroughScroll=!0);var c=d.bounds(b.firstChild||b),f=d.bounds(this.parentNode);a=window.getComputedStyle(this.parentNode); var g=window.getComputedStyle(b),g=parseInt(a.paddingLeft)+parseInt(a.paddingRight)+parseInt(g.paddingLeft)+parseInt(g.paddingRight);if(c.width>=f.width-g){g=parseInt(a.top);f=b.cloneNode(!0);f.classList.add("cloneProposal");f.style.top=g+b.offsetTop-this.parentNode.scrollTop+"px";f.style.left=a.left;f.setAttribute("id",f.id+"_clone");c=c.left+c.width-parseInt(document.documentElement.clientWidth);0a&&(a=0),f.style.left=a+"px");a=document.createElement("div");a.id="clone_contentassist"; a.classList.add("contentassist");a.classList.add("cloneWrapper");a.appendChild(f);a.onclick=this.parentNode.onclick;this.parentNode.parentNode.insertBefore(a,this.parentNode);var l=function(a){a.contentAssistProposalIndex=b.contentAssistProposalIndex;if(a.hasChildNodes())for(var c=0;cc){var d=a.y-this.textView.getLineHeight();this.parentNode.offsetHeight>d?c>d?this.parentNode.style.maxHeight=c+"px":(this.parentNode.style.maxHeight= d+"px",this.parentNode.style.top="0"):(this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px",this.parentNode.style.maxHeight=d+"px")}else this.parentNode.style.maxHeight=c+"px";a.x+this.parentNode.offsetWidth>b?(a=b-this.parentNode.offsetWidth,0>a&&(a=0),this.parentNode.style.left=a+"px",this.parentNode.style.maxWidth=b-a):this.parentNode.style.maxWidth=b+a.x+"px"},_removeCloneNode:function(){this.parentNode.parentNode.contains(this.previousCloneNode)&&this.parentNode.parentNode.removeChild(this.previousCloneNode); this.previousCloneNode=null}};return{ContentAssist:c,ContentAssistMode:a,ContentAssistWidget:b}}); define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"}, doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"meta.documentation.annotation"},{match:"\\\x3c\\S*\\\x3e",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/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(p){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 font-size-adjust 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".split(" ");p= p.grammars;p.push({id:"orion.css",contentTypes:["text/css"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{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"},{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"},{match:"(?:-webkit-|-moz-|-ms-|-o-|\\b)(?:"+t.join("|")+")\\b",name:"support.type.propertyName.css"}],repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b", name:"constant.numeric.hex.css"}}});return{id:p[p.length-1].id,grammars:p,keywords:t}}); define("webtools/cssContentAssist",["orion/editor/templates","orion/editor/stylers/text_css/syntax"],function(p,t){function r(a){return JSON.stringify(a).replace("}","\\}")}function k(){}for(var g={type:"link",values:"visible hidden scroll auto no-display no-content".split(" ")},h={type:"link",values:"solid dashed dotted double groove ridge inset outset".split(" ")},f={type:"link",values:[]},q=0;10>q;q++)f.values.push(q.toString());for(var d={type:"link",values:"black white red green blue magenta yellow cyan grey darkred darkgreen darkblue darkmagenta darkcyan darkyellow darkgray lightgray".split(" ")}, c=[{prefix:"rule",description:"rule - class selector rule",template:".${class} {\n\t${cursor}\n}"},{prefix:"rule",description:"rule - id selector rule",template:"#${id} {\n\t${cursor}\n}"},{prefix:"outline",description:"outline - outline style",template:"outline: ${color:"+r(d)+"} ${style:"+r(h)+"} ${width:"+r(f)+"}px;"},{prefix:"background-image",description:"background-image - image style",template:'background-image: url("${uri}");'},{prefix:"url",description:"url - url image",template:'url("${uri}");'}, {prefix:"rgb",description:"rgb - rgb color",template:"rgb(${red},${green},${blue});"},{prefix:"@import",description:"import - import style sheet",template:'@import "${uri}";'},{prefix:"csslint",description:"csslint - add embedded rule severity",template:"/*csslint ${:"+r({type:"link",values:"adjoining-classes box-model box-sizing bulletproof-font-face compatible-vendor-prefixes display-property-grouping duplicate-background-images duplicate-properties empty-rules fallback-colors floats font-faces font-sizes gradients ids import important known-properties outline-none overqualified-elements qualified-headings regex-selectors rules-count selector-max-approaching selector-max shorthand star-property-hack text-indent underscore-property-hack unique-headings universal-selector unqualified-attributes vendor-prefix zero-units".split(" ")})+ "}: ${a:"+r({type:"link",values:["false","true","0","1","2"]})+"} */"}],a=[{prop:"display",values:{type:"link",values:"none block box flex inline inline-block inline-flex inline-table list-item table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group inherit".split(" ")}},{prop:"overflow",values:g},{prop:"overflow-x",values:g},{prop:"overflow-y",values:g},{prop:"float",values:{type:"link",values:["left","right","none","inherit"]}}, {prop:"position",values:{type:"link",values:["absolute","fixed","relative","static","inherit"]}},{prop:"cursor",values:{type:"link",values:"auto crosshair default e-resize help move n-resize ne-resize nw-resize pointer progress s-resize se-resize sw-resize text w-resize wait inherit".split(" ")}},{prop:"color",values:d},{prop:"border-top-color",values:d},{prop:"border-bottom-color",values:d},{prop:"border-right-color",values:d},{prop:"border-left-color",values:d},{prop:"background-color",values:d}, {prop:"font-style",values:{type:"link",values:["italic","normal","oblique","inherit"]}},{prop:"font-weight",values:{type:"link",values:"bold normal bolder lighter 100 200 300 400 500 600 700 800 900 inherit".split(" ")}},{prop:"white-space",values:{type:"link",values:"pre pre-line pre-wrap nowrap normal inherit".split(" ")}},{prop:"word-wrap",values:{type:"link",values:["normal","break-word"]}},{prop:"visibility",values:{type:"link",values:["hidden","visible","collapse","inherit"]}}],q=0;q=this.string.length},sol:function(){return 0===this.pos},peek:function(){return this.string[this.pos]},next:function(){return this.string[this.pos++]}, eat:function(c){var a=this.string[this.pos];return"string"===typeof a&&(a===c||c.test&&c.test(a)||"function"===typeof c&&c(a))?this.string[this.pos++]:void 0},eatWhile:function(c){for(var a=!1;void 0!==this.eat(c);)a=!0;return a},eatSpace:function(){return this.eatWhile(/\s/)},skipToEnd:function(){this.pos=this.string.length},skipTo:function(c){c=this.string.indexOf(c,this.pos);return-1!==c?(this.pos=c,!0):!1},match:function(c,a,b){a=!0===a||"undefined"===typeof a;if("string"===typeof c){var d=b? this.string.toLowerCase():this.string;c=b?c.toLowerCase():c;b=d.indexOf(c,this.pos);-1!==b&&a&&(this.pos=b+c.length);return-1!==b}if((c=this.string.substring(this.pos).match(c))&&a&&"string"===typeof c[0])this.pos+=c.index+c[0].length;return c},backUp:function(c){this.pos-=c},column:function(){for(var c=0,a=0;a=b)break;this._expandRange(d,d);for(var f=this._getResumeLineIndex(d),d=f+1,f=(f=0<=f&&this.lines[f].eolState)?this.codeMirror.copyState(this.mode,f):this.mode.startState(),e=0,g=d;gc&&k){this.highlightLater(g+1);this.onHighlightDone();return}}}this.onHighlightDone()},onHighlightDone:function(){this.startLine!==Number.MAX_VALUE&&-1!==this.endLine&&this.dispatchEvent({type:"Highlight",start:this.startLine,end:this.endLine});this.startLine=Number.MAX_VALUE;this.endLine=-1},_getResumeLineIndex:function(c){for(var a=this.lines,b=c-1;0<=b;b--)if(a[b].eolState||40/,func:function(g){return"atomic group"}}],toRegExp:function(g){function h(c,a){throw Error('Unsupported regex feature "'+c+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var f="",q;g=k.processGlobalFlag("x",g,function(c){for(var a="",b=!1,d=c.length,f=0;f=z.start&&t.end<=y)t.start+=1,t.end+=1,t.num+=1,2===t.type&&(e[t.oldNum]=t.num);a.push(v);l++;break}default:"|"!==v&&(2!==t&&4!==t)&&0===c&&(d.push(4),a.push({start:r,end:-1,type:4,num:l}),n.push("("),p[l]=null,l++),n.push(v),"\\"===v&&(v=f.charAt(r+1),n.push(v),r+=1)}}for(;d.length;)d.pop(),n.push(")");f=RegExp(n.join(""));k={};h=h||e;for(var w in h)h.hasOwnProperty(w)&&(k[w]="\\"+h[w]);f=this.getSubstitutedRegex(f,k,!1);return[f,e,p]},complexCaptures:function(g){if(!g)return!1;for(var h in g)if(g.hasOwnProperty(h)&& "0"!==h)return!0;return!1}};r.prototype={initialize:function(g){this.textView=g;this.textView.stylerOptions=this;var h=this;this._listener={onModelChanged:function(f){h.onModelChanged(f)},onDestroy:function(f){h.onDestroy(f)},onLineStyle:function(f){h.onLineStyle(f)},onStorage:function(f){h.onStorage(f)}};g.addEventListener("ModelChanged",this._listener.onModelChanged);g.addEventListener("Destroy",this._listener.onDestroy);g.addEventListener("LineStyle",this._listener.onLineStyle);g.redrawLines()}, onDestroy:function(g){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanged",this._listener.onModelChanged),this.textView.removeEventListener("Destroy",this._listener.onDestroy),this.textView.removeEventListener("LineStyle",this._listener.onLineStyle),this.textView=null);this._listener=this._tree=this._styles=this.grammar=null},preprocess:function(g){for(g=[g];0!==g.length;){var h=g.pop();if(!h._resolvedRule||!h._typedRule)if(h._resolvedRule=this._resolve(h), h._typedRule=this._createTypedRule(h),this.addStyles(h.name),this.addStyles(h.contentName),this.addStylesForCaptures(h.captures),this.addStylesForCaptures(h.beginCaptures),this.addStylesForCaptures(h.endCaptures),h._resolvedRule!==h&&g.push(h._resolvedRule),h.patterns)for(var f=0;fg)return this._tree;for(var f=[this._tree],k=null;f.length;){var d=f.pop();if(!d.parent||this.isDamaged(d,g,h)){d instanceof this.BeginEndNode&&(k=d);for(var c=0;c h},parse:function(g,h,f,k,d,c){var a=this.textView.getModel(),b=a.getLineStart(a.getLineCount()-1),l=a.getCharCount(),n=this.getInitialExpected(g,f),e=-1;h&&(g.repaired=!0,g.endNeedsUpdate=!0,e=(e=g.children[g.children.length-1])?a.getLineEnd(a.getLineAtOffset(e.end+(d-c))):-1,k=a.getLineEnd(a.getLineAtOffset(k+c)),e=Math.max(e,k));e=-1===e?l:e;k=n;for(var p=g,r=!1,t=f,v=-1;p&&(!h||t=b?l:a.getLineStart(a.getLineAtOffset(t)+1));var z=y&&y.match,C=y&&y.rule, m=y&&y.isEnd;if(y&&y.isSub)t=this.afterMatch(z),C instanceof this.BeginEndRule&&(r=!0,h&&C===k.rule&&p===k.parent?(p=k,p.setStart(z),p.repaired=!0,p.endNeedsUpdate=!0,k=this.getNextExpected(k,"begin")):(h&&(this.prune(p,k),h=!1),z=new this.BeginEndNode(p,C,z),p.addChild(z),p=z));else if(m||t===l)p instanceof this.BeginEndNode&&(z?(r=!0,v=Math.max(v,p.end),p.setEnd(z),t=this.afterMatch(z),h&&p===k&&p.parent===k.parent?(p.repaired=!0,delete p.endNeedsUpdate,k=this.getNextExpected(k,"end")):h&&(this.prune(p, k),h=!1)):(p.setEnd(l),delete p.endNeedsUpdate)),p=p.parent;h&&(t>=e&&!r)&&(this.prune(g,n),h=!1)}this.removeUnrepairedChildren(g,h,f);this.cleanup(h,g,f,e,l,d,c);return h?Math.max(v,t):t},removeUnrepairedChildren:function(g,h,f){if(h){h=g.children;for(var k=-1,d=0;d=h)return k}else if(g instanceof this.BeginEndNode&&g.endMatch){var d=g.endMatch.index;for(f=0;f=h);f++);if(k&&k.startb.result.index?1:a.pattern.pattern.index< b.pattern.pattern.index?-1:1});for(var p=0;0b.result.index?1:a.pattern.pattern.indexb.start?1:0});for(k=0;k=f);p++){var r=k[p].start,t=k[p].end;h=f);k++){var p=h[k].start,r=h[k].end;ed&&h.end-c<=-d){h=t;continue}z=f.getText(h.start,Math.min(g,h.end+d+1));if(!this._stylerAdapter.verifyBlock(f,z,h,d)){h=t;continue}}r=h.getBlocks();var w=r.length,B=q(r,e,!0),A=q(r,a,!1,B-1,w);k=!1;if(B&&r.length&&r[B-1].end===c){z=f.getText(r[B-1].start,Math.min(g,c+1));var D=this.computeBlocks(f,z,h,r[B-1].start,null,null,null);D.length&&D[0].end!==r[B-1].end&&(B--,k=!0)}Bc&&(m+=d)):B===w&&0c&&(m+=d)):m=Math.max(e,h.contentStart);C=Ac&&(D-=d),k>c&&(k-=d),D<=c&&(cd&&(a--,d++),this._view.setSelection(d, a))}}},_onSelection:function(d){var c=d.oldValue,a=d.newValue;d=this._view.getModel();var b;if(this._highlightCaretLine){var f=d.getLineAtOffset(c.start);b=d.getLineAtOffset(a.start);var g=a.start===a.end,c=c.start===c.end;f===b&&c&&g||(c&&this._view.redrawLines(f,f+1),(f!==b||!c)&&g&&this._view.redrawLines(b,b+1))}if(this._annotationModel){var c=this._bracketAnnotations,e,h;if(a.start===a.end&&0<(h=this._view.getCaretOffset()))h-=1,d.getBaseModel&&(h=d.mapOffset(h),d=d.getBaseModel()),a=this._findBlock(this._rootBlock, h),d=this._findMatchingBracket(d,a,h),-1!==d&&(e=[p.AnnotationType.createAnnotation(p.AnnotationType.ANNOTATION_MATCHING_BRACKET,d,d+1),p.AnnotationType.createAnnotation(p.AnnotationType.ANNOTATION_CURRENT_BRACKET,h,h+1)]);this._bracketAnnotations=e;this._annotationModel.replaceAnnotations(c,e)}},_spliceStyles:function(d,c,a,b){for(var f=d.regex,g=f.lastIndex=0,e=f.exec(a);e;){for(e=b+e.index;g?+]/g,"_"),p(["./stylers/"+b+"/syntax"],function(a){a= new w.createPatternBasedAdapter(a.grammars,a.id);this.styler=new w.TextStyler(d,e,a)},function(a){}));"text/css"===b&&c.setFoldingRulerVisible(void 0===a.showFoldingRuler||a.showFoldingRuler)}}).highlight(a.contentType||a.lang,r);if(q){var t=new x.CssContentAssistProvider,y=new v.HTMLContentAssistProvider;q.addEventListener("Activating",function(){/css$/.test(a.lang)?q.setProviders([t]):/html$/.test(a.lang)&&q.setProviders([y])})}l=b.defaultView||b.parentWindow;!a.noComputeSize&&("none"!==H(l,b,c)&& 50>=c.clientHeight)&&(b=r.getTextView().computeSize().height,c.style.height=b+"px");return r}var L=this.orion?this.orion.editor:void 0;if(L){for(var N=0;N