| /* |
| |
| 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 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, 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: 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) 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) 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) 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, 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, 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) 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. |
| Copyright (c) 2012 VMware, Inc. |
| 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 |
| Andrew Eisenberg - rename to jsTemplateContentAssist.js |
| |
| 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, 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 |
| 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(k){function m(a,b){var e,j,w,x,f,l,c,d,o,g=b&&b.split("/"),h=q.map,p=h&&h["*"]||{};if(a&&a.charAt(0)===".")if(b){g=g.slice(0,g.length-1);a=g.concat(a.split("/"));for(d=0;d<a.length;d+=1)if(e=a[d],e===".")a.splice(d,1),d-=1;else if(e==="..")if(d===1&&(a[2]===".."||a[0]===".."))break;else d>0&&(a.splice(d-1,2),d-=2);a=a.join("/")}else a.indexOf("./")===0&&(a=a.substring(2));if((g||p)&&h){e=a.split("/");for(d=e.length;d>0;d-=1){j=e.slice(0,d).join("/");if(g)for(o=g.length;o>0;o-=1)if(w=h[g.slice(0, |
| o).join("/")])if(w=w[j]){x=w;f=d;break}if(x)break;!l&&p&&p[j]&&(l=p[j],c=d)}!x&&l&&(x=l,f=c);x&&(e.splice(0,f,x),a=e.join("/"))}return a}function n(a,e){return function(){return b.apply(k,t.call(arguments,0).concat([a,e]))}}function i(a){return function(b){return m(b,a)}}function c(a){return function(b){l[a]=b}}function d(a){if(p.call(o,a)){var b=o[a];delete o[a];r[a]=!0;h.apply(k,b)}if(!p.call(l,a)&&!p.call(r,a))throw Error("No "+a);return l[a]}function f(a){var b,e=a?a.indexOf("!"):-1;e>-1&&(b= |
| a.substring(0,e),a=a.substring(e+1,a.length));return[b,a]}function g(a){return function(){return q&&q.config&&q.config[a]||{}}}var h,b,a,e,l={},o={},q={},r={},p=Object.prototype.hasOwnProperty,t=[].slice;a=function(a,b){var e,j=f(a),w=j[0],a=j[1];w&&(w=m(w,b),e=d(w));w?a=e&&e.normalize?e.normalize(a,i(b)):m(a,b):(a=m(a,b),j=f(a),w=j[0],a=j[1],w&&(e=d(w)));return{f:w?w+"!"+a:a,n:a,pr:w,p:e}};e={require:function(a){return n(a)},exports:function(a){var b=l[a];return typeof b!=="undefined"?b:l[a]={}}, |
| module:function(a){return{id:a,uri:"",exports:l[a],config:g(a)}}};h=function(b,f,g,j){var w,x,D,y,h=[],q,j=j||b;if(typeof g==="function"){f=!f.length&&g.length?["require","exports","module"]:f;for(y=0;y<f.length;y+=1)if(D=a(f[y],j),x=D.f,x==="require")h[y]=e.require(b);else if(x==="exports")h[y]=e.exports(b),q=!0;else if(x==="module")w=h[y]=e.module(b);else if(p.call(l,x)||p.call(o,x)||p.call(r,x))h[y]=d(x);else if(D.p)D.p.load(D.n,n(j,!0),c(x),{}),h[y]=l[x];else throw Error(b+" missing "+x);f=g.apply(l[b], |
| h);if(b)if(w&&w.exports!==k&&w.exports!==l[b])l[b]=w.exports;else if(f!==k||!q)l[b]=f}else b&&(l[b]=g)};requirejs=require=b=function(f,l,c,j,w){if(typeof f==="string")return e[f]?e[f](l):d(a(f,l).f);else f.splice||(q=f,l.splice?(f=l,l=c,c=null):f=k);l=l||function(){};typeof c==="function"&&(c=j,j=w);j?h(k,f,l,c):setTimeout(function(){h(k,f,l,c)},4);return b};b.config=function(a){q=a;return b};define=function(a,b,e){b.splice||(e=b,b=[]);!p.call(l,a)&&!p.call(o,a)&&(o[a]=[a,b,e])};define.amd={jQuery:!0}})(); |
| define("almond",function(){}); |
| define("orion/editor/shim",[],function(){if(!Object.create)Object.create=function(k,m){function n(){}n.prototype=k;var i=new n;if(m)for(var c in m)m.hasOwnProperty(c)&&(i[c]=m[c].hasOwnProperty("value")?m[c].value:function(){if(arguments.length>0)return m[c].get();else m[c].set(arguments)});return i};if(!Object.keys)Object.keys=function(k){var m=[],n;for(n in k)k.hasOwnProperty(n)&&m.push(n);return m};if(!Function.prototype.bind)Function.prototype.bind=function(k){var m=this,n=Array.prototype.slice.call(arguments, |
| 1);return n.length?function(){return arguments.length?m.apply(k,n.concat(Array.prototype.slice.call(arguments))):m.apply(k,n)}:function(){return arguments.length?m.apply(k,arguments):m.call(k)}};if(!Array.isArray)Array.isArray=function(k){return Object.prototype.toString.call(k)==="[object Array]"};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(k){for(var m=0;m<this.length;m++)if(this[m]===k)return m;return-1};if(!Array.prototype.forEach)Array.prototype.forEach=function(k){for(var m= |
| 0;m<this.length;m++)k(this[m],m)};if(!Array.prototype.map)Array.prototype.map=function(k){for(var m=Array(this.length),n=0;n<this.length;n++)m[n]=k(this[n]);return m};if(!Array.prototype.reduce)Array.prototype.reduce=function(k,m){var n,i=!1;1<arguments.length&&(n=m,i=!0);for(var c=0;this.length>c;++c)i?n=k(n,this[c],c,this):(n=this[c],i=!0);return n};if(!String.prototype.trim)String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};if(!String.prototype.trimLeft)String.prototype.trimLeft= |
| function(){return this.replace(/^\s+/g,"")};if(!String.prototype.trimRight)String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")};return{}}); |
| (function(){function k(c,d,f,g,h,b){d[c]&&(f.push(c),(d[c]===!0||d[c]===1)&&g.push(h+c+"/"+b))}function m(c,d,f,g,h){d=g+d+"/"+h;require._fileExists(c.toUrl(d+".js"))&&f.push(d)}function n(c,d,f){for(var g in d)d.hasOwnProperty(g)&&(!c.hasOwnProperty(g)||f)?c[g]=d[g]:typeof d[g]==="object"&&n(c[g],d[g],f)}var i=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(c){var d=c.config?c.config():{};return{version:"2.0.1+",load:function(f,c,h,b){b=b||{};if(b.locale)d.locale=b.locale; |
| var a=i.exec(f),e=a[1],l=a[4],o=a[5],q=l.split("-"),r=[],p={},t,v="";if(a[5])e=a[1],f=e+o;else{o=a[4];l=d.locale;if(!l)l=d.locale=typeof navigator==="undefined"?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase();q=l.split("-")}if(b.isBuild){r.push(f);m(c,"root",r,e,o);for(t=0;t<q.length;t++)b=q[t],v+=(v?"-":"")+b,m(c,v,r,e,o);c(r,function(){h()})}else c([f],function(a){var b=[],j;k("root",a,b,r,e,o);for(t=0;t<q.length;t++)j=q[t],v+=(v?"-":"")+j,k(v,a,b,r,e,o);c(r,function(){var j, |
| x,f;for(j=b.length-1;j>-1&&b[j];j--){f=b[j];x=a[f];if(x===!0||x===1)x=c(e+f+"/"+o);n(p,x)}h(p)})})}}})})();define("orion/editor/i18n",{load:function(k,m,n){m.specified&&m.specified("orion/bootstrap")?m(["orion/i18n!"+k],function(i){n(i)}):n({})}}); |
| define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",matchingSearch:"Matching Search",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up", |
| pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down", |
| selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word", |
| deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point", |
| setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence", |
| findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All", |
| collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode entered",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",lineColumn:"Line ${0} : Col ${1}",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right", |
| viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward", |
| vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character", |
| viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",replaceAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",nothingReplaced:"Nothing replaced",notFound:"Not found"}); |
| define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(k,m){var n={root:m},i;for(i in k)k.hasOwnProperty(i)&&typeof n[i]==="undefined"&&(n[i]=k[i]);return n}); |
| define("orion/editor/eventTarget",[],function(){function k(){}k.addMixin=function(m){var n=k.prototype,i;for(i in n)n.hasOwnProperty(i)&&(m[i]=n[i])};k.prototype={addEventListener:function(k,n,i){if(!this._eventTypes)this._eventTypes={};var c=this._eventTypes[k];c||(c=this._eventTypes[k]={level:0,listeners:[]});c.listeners.push({listener:n,useCapture:i})},dispatchEvent:function(k){var n=k.type;this._dispatchEvent("pre"+n,k);this._dispatchEvent(n,k);this._dispatchEvent("post"+n,k)},_dispatchEvent:function(k, |
| n){var i=this._eventTypes?this._eventTypes[k]:null;if(i){var c=i.listeners;try{if(i.level++,c)for(var d=0,f=c.length;d<f;d++)if(c[d]){var g=c[d].listener;typeof g==="function"?g.call(this,n):g.handleEvent&&typeof g.handleEvent==="function"&&g.handleEvent(n)}}finally{if(i.level--,i.compact&&i.level===0){for(d=c.length-1;d>=0;d--)c[d]||c.splice(d,1);c.length===0&&delete this._eventTypes[k];i.compact=!1}}}},isListening:function(k){return!this._eventTypes?!1:this._eventTypes[k]!==void 0},removeEventListener:function(k, |
| n,i){if(this._eventTypes){var c=this._eventTypes[k];if(c){for(var d=c.listeners,f=0,g=d.length;f<g;f++){var h=d[f];if(h&&h.listener===n&&h.useCapture===i){c.level!==0?(d[f]=null,c.compact=!0):d.splice(f,1);break}}d.length===0&&delete this._eventTypes[k]}}}};return{EventTarget:k}});define("orion/regex",[],function(){return{escape:function(k){return k.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&")},parse:function(k){return(k=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(k))?{pattern:k[1],flags:k[2]}:null}}}); |
| define("orion/util",[],function(){var k=navigator.userAgent,m=k.indexOf("MSIE")!==-1||k.indexOf("Trident")!==-1?document.documentMode:void 0,n=parseFloat(k.split("Firefox/")[1]||k.split("Minefield/")[1])||void 0,i=k.indexOf("Opera")!==-1?parseFloat(k.split("Version/")[1]):void 0,c=parseFloat(k.split("Chrome/")[1])||void 0,d=k.indexOf("Safari")!==-1&&!c,f=parseFloat(k.split("WebKit/")[1])||void 0,g=k.indexOf("Android")!==-1,h=k.indexOf("iPad")!==-1,k=k.indexOf("iPhone")!==-1,b=h||k,a=navigator.platform.indexOf("Mac")!== |
| -1,e=navigator.platform.indexOf("Win")!==-1,l=navigator.platform.indexOf("Linux")!==-1;return{formatMessage:function(a){var b=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,e){return b[(e<<0)+1]})},createElement:function(a,b){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",b):a.createElement(b)},isIE:m,isFirefox:n,isOpera:i,isChrome:c,isSafari:d,isWebkit:f,isAndroid:g,isIPad:h,isIPhone:k,isIOS:b,isMac:a,isWindows:e,isLinux:l,platformDelimiter:e?"\r\n":"\n"}}); |
| define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(k,m,n){function i(c,d){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(c);this.setLineDelimiter(d)}i.prototype={destroy:function(){},find:function(c){if(this._text.length>1)this._text=[this._text.join("")];var d=c.string,f=c.regex,g=d,h="",b=c.caseInsensitive;if(g)if(f){if(d=m.parse(g))g=d.pattern,h=d.flags}else g=d.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$&"),b&&(g=g.replace(/[iI\u0130\u0131]/g, |
| "[Ii\u0130\u0131]"));var a=null,e;if(g){var d=c.reverse,l=c.wrap,f=c.wholeWord,o=c.start||0,c=c.end,q=c!==null&&c!==void 0;h.indexOf("g")===-1&&(h+="g");h.indexOf("m")===-1&&(h+="m");b&&h.indexOf("i")===-1&&(h+="i");f&&(g="\\b"+g+"\\b");var i=this._text[0],p,t,v=0;q&&(b=o<c?o:c,i=i.substring(b,o<c?c:o),v=b);var s=RegExp(g,h);if(d)e=function(){var a=null;for(s.lastIndex=0;;){t=s.lastIndex;p=s.exec(i);if(t===s.lastIndex)return null;if(p){if(!(p.index+v<o)){if(!l||a)break;o=i.length+v}a={start:p.index+ |
| v,end:s.lastIndex+v}}else break}if(a)o=a.start;return a};else{if(!q)s.lastIndex=o;e=function(){for(;;){t=s.lastIndex;p=s.exec(i);if(t===s.lastIndex)break;if(p)return{start:p.index+v,end:s.lastIndex+v};if(!(t!==0&&l))break}return null}}a=e()}return{next:function(){var b=a;b&&(a=e());return b},hasNext:function(){return a!==null}}},getCharCount:function(){for(var c=0,d=0;d<this._text.length;d++)c+=this._text[d].length;return c},getLine:function(c,d){var f=this.getLineCount();if(!(0<=c&&c<f))return null; |
| var g=this._lineOffsets[c];if(c+1<f){f=this.getText(g,this._lineOffsets[c+1]);if(d)return f;for(var g=f.length,h;(h=f.charCodeAt(g-1))===10||h===13;)g--;return f.substring(0,g)}else return this.getText(g)},getLineAtOffset:function(c){var d=this.getCharCount();if(!(0<=c&&c<=d))return-1;var f=this.getLineCount();if(c===d)return f-1;var g,h,b=this._lastLineIndex;if(0<=b&&b<f&&(g=this._lineOffsets[b],h=b+1<f?this._lineOffsets[b+1]:d,g<=c&&c<h))return b;for(var a=f,e=-1;a-e>1;)if(b=Math.floor((a+e)/2), |
| g=this._lineOffsets[b],h=b+1<f?this._lineOffsets[b+1]:d,c<=g)a=b;else if(c<h){a=b;break}else e=b;return this._lastLineIndex=a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(c,d){var f=this.getLineCount();if(!(0<=c&&c<f))return-1;if(c+1<f){f=this._lineOffsets[c+1];if(d)return f;for(var g=this.getText(Math.max(this._lineOffsets[c],f-2),f),h=g.length,b;(b=g.charCodeAt(h-1))===10||b===13;)h--;return f-(g.length-h)}else return this.getCharCount()}, |
| getLineStart:function(c){return!(0<=c&&c<this.getLineCount())?-1:this._lineOffsets[c]},getText:function(c,d){c===void 0&&(c=0);d===void 0&&(d=this.getCharCount());if(c===d)return"";for(var f=0,g=0,h;g<this._text.length;){h=this._text[g].length;if(c<=f+h)break;f+=h;g++}for(var b=f,a=g;g<this._text.length;){h=this._text[g].length;if(d<=f+h)break;f+=h;g++}if(a===g)return this._text[a].substring(c-b,d-f);b=this._text[a].substring(c-b);f=this._text[g].substring(0,d-f);return b+this._text.slice(a+1,g).join("")+ |
| f},onChanging:function(c){return this.dispatchEvent(c)},onChanged:function(c){return this.dispatchEvent(c)},setLineDelimiter:function(c,d){c==="auto"&&(c=void 0,this.getLineCount()>1&&(c=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=c?c:n.platformDelimiter;if(d){var f=this.getLineCount();if(f>1){for(var g=Array(f),h=0;h<f;h++)g[h]=this.getLine(h);this.setText(g.join(this._lineDelimiter))}}},setText:function(c,d,f){c===void 0&&(c="");d===void 0&&(d=0);f===void 0&&(f= |
| this.getCharCount());if(!(d===f&&c==="")){for(var g=this.getLineAtOffset(d),h=this.getLineAtOffset(f),b=d,a=f-d,e=h-g,l=c.length,o=0,i=this.getLineCount(),r=0,p=0,t=0,v=[];;){r!==-1&&r<=t&&(r=c.indexOf("\r",t));p!==-1&&p<=t&&(p=c.indexOf("\n",t));if(p===-1&&r===-1)break;t=r!==-1&&p!==-1?r+1===p?p+1:(r<p?r:p)+1:r!==-1?r+1:p+1;v.push(d+t);o++}this.onChanging({type:"Changing",text:c,start:b,removedCharCount:a,addedCharCount:l,removedLineCount:e,addedLineCount:o});v.length===0&&(t=this.getLineStart(g), |
| h=h+1<i?this.getLineStart(h+1):this.getCharCount(),d!==t&&(c=this.getText(t,d)+c,d=t),f!==h&&(c+=this.getText(f,h),f=h));t=l-a;for(h=g+e+1;h<i;h++)this._lineOffsets[h]+=t;if(v.length<5E4)g=[g+1,e].concat(v),Array.prototype.splice.apply(this._lineOffsets,g);else{t=g+1;this._lineOffsets.splice(t,e);for(i=0;i<v.length;i+=5E4)g=[t,0].concat(v.slice(i,Math.min(v.length,i+5E4))),Array.prototype.splice.apply(this._lineOffsets,g),t+=5E4}for(t=i=0;t<this._text.length;){h=this._text[t].length;if(d<=i+h)break; |
| i+=h;t++}g=i;for(v=t;t<this._text.length;){h=this._text[t].length;if(f<=i+h)break;i+=h;t++}h=this._text[t];d=this._text[v].substring(0,d-g);f=h.substring(f-i);v=[v,t-v+1];d&&v.push(d);c&&v.push(c);f&&v.push(f);Array.prototype.splice.apply(this._text,v);if(this._text.length===0)this._text=[""];this.onChanged({type:"Changed",start:b,removedCharCount:a,addedCharCount:l,removedLineCount:e,addedLineCount:o})}}};k.EventTarget.addMixin(i.prototype);return{TextModel:i}}); |
| define("orion/keyBinding",["orion/util"],function(k){function m(i,c,d,f,g,h){this.type=h||"keydown";this.keyCode=typeof i==="string"&&this.type==="keydown"?i.toUpperCase().charCodeAt(0):i;this.mod1=c!==void 0&&c!==null?c:!1;this.mod2=d!==void 0&&d!==null?d:!1;this.mod3=f!==void 0&&f!==null?f:!1;this.mod4=g!==void 0&&g!==null?g:!1}function n(i){this.keys=i}m.prototype={getKeys:function(){return[this]},match:function(i,c){if(c!==void 0){if(c!==0)return!1}else if(i instanceof Array){if(i.length>1)return!1; |
| i=i[0]}return i.type!==this.type?!1:this.keyCode===i.keyCode||this.keyCode===String.fromCharCode(k.isOpera?i.which:i.charCode!==void 0?i.charCode:i.keyCode)?this.mod1!==(k.isMac?i.metaKey:i.ctrlKey)?!1:this.type==="keydown"&&this.mod2!==i.shiftKey?!1:this.mod3!==i.altKey?!1:k.isMac&&this.mod4!==i.ctrlKey?!1:!0:!1},equals:function(i){return!i?!1:this.keyCode!==i.keyCode?!1:this.mod1!==i.mod1?!1:this.mod2!==i.mod2?!1:this.mod3!==i.mod3?!1:this.mod4!==i.mod4?!1:this.type!==i.type?!1:!0}};n.prototype= |
| {getKeys:function(){return this.keys.slice(0)},match:function(i,c){var d=this.keys;if(c!==void 0)return c>d.length?!1:d[c].match(i)?c===d.length-1?!0:c+1:!1;else{i instanceof Array||(i=[i]);if(i.length>d.length)return!1;var f;for(f=0;f<i.length;f++)if(!d[f].match(i[f]))return!1;return f===d.length?!0:f}},equals:function(i){if(!i.keys)return!1;if(i.keys.length!==this.keys.length)return!1;for(var c=0;c<i.keys.length;c++)if(!i.keys[c].equals(this.keys[c]))return!1;return!0}};return{KeyBinding:m,KeyStroke:m, |
| KeySequence:n}}); |
| define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(k,m){function n(c){if(c)this._view=c,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0}function i(c){n.call(this,c)}n.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(c){for(var d=[],f=this._keyBindings,g=0;g<f.length;g++)f[g].actionID===c&&d.push(f[g].keyBinding);return d},getView:function(){return this._view},isActive:function(){return this._view.getKeyModes().indexOf(this)!==-1}, |
| match:function(c){if(c.type==="keydown")switch(c.keyCode){case 16:case 17:case 18:case 91:return}for(var d=this._keyBindingIndex,f=this._matchingKeyBindings||this._keyBindings,g=[],h=0;h<f.length;h++){var b=f[h],a=b.keyBinding.match(c,d);if(a===!0)return this._keyBindingIndex=0,this._matchingKeyBindings=null,b.actionID;else typeof a==="number"&&g.push(b)}if(g.length===0)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=g,"noop"},setKeyBinding:function(c, |
| d){for(var f=this._keyBindings,g=0;g<f.length;g++){var h=f[g];if(h.keyBinding.equals(c)){d?h.actionID=d:h.predefined?h.actionID="noop":f.splice(g,1);return}}d&&f.push({keyBinding:c,actionID:d})},setView:function(c){this._view=c}};i.prototype=new n;i.prototype.createKeyBindings=function(){var c=k.KeyBinding,d=[];d.push({actionID:"lineUp",keyBinding:new c(38),predefined:!0});d.push({actionID:"lineDown",keyBinding:new c(40),predefined:!0});d.push({actionID:"charPrevious",keyBinding:new c(37),predefined:!0}); |
| d.push({actionID:"charNext",keyBinding:new c(39),predefined:!0});m.isMac?(d.push({actionID:"scrollPageUp",keyBinding:new c(33),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new c(34),predefined:!0}),d.push({actionID:"pageUp",keyBinding:new c(33,null,null,!0),predefined:!0}),d.push({actionID:"pageDown",keyBinding:new c(34,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(37,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(39,!0),predefined:!0}), |
| d.push({actionID:"wordPrevious",keyBinding:new c(37,null,null,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new c(39,null,null,!0),predefined:!0}),d.push({actionID:"scrollTextStart",keyBinding:new c(36),predefined:!0}),d.push({actionID:"scrollTextEnd",keyBinding:new c(35),predefined:!0}),d.push({actionID:"textStart",keyBinding:new c(38,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new c(40,!0),predefined:!0}),d.push({actionID:"scrollPageUp",keyBinding:new c(38,null,null,null, |
| !0),predefined:!0}),d.push({actionID:"scrollPageDown",keyBinding:new c(40,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(37,null,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(39,null,null,null,!0),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(38,null,null,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(40,null,null,!0),predefined:!0})):(d.push({actionID:"pageUp",keyBinding:new c(33),predefined:!0}),d.push({actionID:"pageDown", |
| keyBinding:new c(34),predefined:!0}),d.push({actionID:"lineStart",keyBinding:new c(36),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c(35),predefined:!0}),d.push({actionID:"wordPrevious",keyBinding:new c(37,!0),predefined:!0}),d.push({actionID:"wordNext",keyBinding:new c(39,!0),predefined:!0}),d.push({actionID:"textStart",keyBinding:new c(36,!0),predefined:!0}),d.push({actionID:"textEnd",keyBinding:new c(35,!0),predefined:!0}));m.isFirefox&&m.isLinux&&(d.push({actionID:"lineUp",keyBinding:new c(38, |
| !0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new c(40,!0),predefined:!0}));m.isWindows&&(d.push({actionID:"scrollLineUp",keyBinding:new c(38,!0),predefined:!0}),d.push({actionID:"scrollLineDown",keyBinding:new c(40,!0),predefined:!0}));d.push({actionID:"selectLineUp",keyBinding:new c(38,null,!0),predefined:!0});d.push({actionID:"selectLineDown",keyBinding:new c(40,null,!0),predefined:!0});d.push({actionID:"selectCharPrevious",keyBinding:new c(37,null,!0),predefined:!0});d.push({actionID:"selectCharNext", |
| keyBinding:new c(39,null,!0),predefined:!0});d.push({actionID:"selectPageUp",keyBinding:new c(33,null,!0),predefined:!0});d.push({actionID:"selectPageDown",keyBinding:new c(34,null,!0),predefined:!0});m.isMac?(d.push({actionID:"selectLineStart",keyBinding:new c(37,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(39,!0,!0),predefined:!0}),d.push({actionID:"selectWordPrevious",keyBinding:new c(37,null,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new c(39, |
| null,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new c(36,null,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new c(35,null,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new c(38,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new c(40,!0,!0),predefined:!0}),d.push({actionID:"selectLineStart",keyBinding:new c(37,null,!0,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(39,null,!0,null,!0),predefined:!0}), |
| d.push({actionID:"selectLineStart",keyBinding:new c(38,null,!0,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(40,null,!0,!0),predefined:!0})):(m.isLinux&&(d.push({actionID:"selectWholeLineUp",keyBinding:new c(38,!0,!0),predefined:!0}),d.push({actionID:"selectWholeLineDown",keyBinding:new c(40,!0,!0),predefined:!0})),d.push({actionID:"selectLineStart",keyBinding:new c(36,null,!0),predefined:!0}),d.push({actionID:"selectLineEnd",keyBinding:new c(35,null,!0),predefined:!0}),d.push({actionID:"selectWordPrevious", |
| keyBinding:new c(37,!0,!0),predefined:!0}),d.push({actionID:"selectWordNext",keyBinding:new c(39,!0,!0),predefined:!0}),d.push({actionID:"selectTextStart",keyBinding:new c(36,!0,!0),predefined:!0}),d.push({actionID:"selectTextEnd",keyBinding:new c(35,!0,!0),predefined:!0}));d.push({actionID:"undo",keyBinding:new k.KeyBinding("z",!0),predefined:!0});m.isMac?d.push({actionID:"redo",keyBinding:new k.KeyBinding("z",!0,!0),predefined:!0}):d.push({actionID:"redo",keyBinding:new k.KeyBinding("y",!0),predefined:!0}); |
| d.push({actionID:"deletePrevious",keyBinding:new c(8),predefined:!0});d.push({actionID:"deletePrevious",keyBinding:new c(8,null,!0),predefined:!0});d.push({actionID:"deleteNext",keyBinding:new c(46),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0),predefined:!0});d.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0,!0),predefined:!0});d.push({actionID:"deleteWordNext",keyBinding:new c(46,!0),predefined:!0});d.push({actionID:"tab",keyBinding:new c(9),predefined:!0}); |
| d.push({actionID:"shiftTab",keyBinding:new c(9,null,!0),predefined:!0});d.push({actionID:"enter",keyBinding:new c(13),predefined:!0});d.push({actionID:"enter",keyBinding:new c(13,null,!0),predefined:!0});d.push({actionID:"selectAll",keyBinding:new c("a",!0),predefined:!0});d.push({actionID:"toggleTabMode",keyBinding:new c("m",!0),predefined:!0});m.isMac&&(d.push({actionID:"deleteNext",keyBinding:new c(46,null,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new c(8,null,null,!0), |
| predefined:!0}),d.push({actionID:"deleteWordNext",keyBinding:new c(46,null,null,!0),predefined:!0}));d.push({actionID:"toggleWrapMode",keyBinding:new k.KeyBinding("w",!0,!1,!0)});d.push({actionID:"toggleOverwriteMode",keyBinding:new k.KeyBinding(45)});if(!m.isFirefox){var f=m.isMac&&m.isChrome;d.push({actionID:"noop",keyBinding:new c("u",!f,!1,!1,f),predefined:!0});d.push({actionID:"noop",keyBinding:new c("i",!f,!1,!1,f),predefined:!0});d.push({actionID:"noop",keyBinding:new c("b",!f,!1,!1,f),predefined:!0})}m.isFirefox&& |
| (d.push({actionID:"copy",keyBinding:new c(45,!0),predefined:!0}),d.push({actionID:"paste",keyBinding:new c(45,null,!0),predefined:!0}),d.push({actionID:"cut",keyBinding:new c(46,null,!0),predefined:!0}));m.isMac&&(d.push({actionID:"lineStart",keyBinding:new c("a",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineEnd",keyBinding:new c("e",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineUp",keyBinding:new c("p",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"lineDown",keyBinding:new c("n",!1,!1, |
| !1,!0),predefined:!0}),d.push({actionID:"charPrevious",keyBinding:new c("b",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"charNext",keyBinding:new c("f",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deletePrevious",keyBinding:new c("h",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteNext",keyBinding:new c("d",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineEnd",keyBinding:new c("k",!1,!1,!1,!0),predefined:!0}),m.isFirefox?(d.push({actionID:"scrollPageDown",keyBinding:new c("v",!1, |
| !1,!1,!0),predefined:!0}),d.push({actionID:"deleteLineStart",keyBinding:new c("u",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"deleteWordPrevious",keyBinding:new c("w",!1,!1,!1,!0),predefined:!0})):(d.push({actionID:"pageDown",keyBinding:new c("v",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"centerLine",keyBinding:new c("l",!1,!1,!1,!0),predefined:!0}),d.push({actionID:"enterNoCursor",keyBinding:new c("o",!1,!1,!1,!0),predefined:!0})));return d};return{KeyMode:n,DefaultKeyMode:i}}); |
| define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(k,m,n){function i(c){c=c||{};this._document=c.document||document}var c={};i.getTheme=function(d){var d=d||"default",f=c[d];f||(f=c[d]=new i);return f};i.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(c,f){var g=this,h=g._themeClass;g._themeClass=c;this._load(c,f,function(){g.onThemeChanged({type:"ThemeChanged",oldValue:h,newValue:g.getThemeClass()})})},onThemeChanged:function(c){return this.dispatchEvent(c)}, |
| buildStyleSheet:function(c,f){function g(b,a,e){a&&(h.push("."+c+" ."+b+" {"),h.push("\t"+(e?"background-color":"color")+": "+a+";"),h.push("}"))}var h=[];h.push("");h.push("."+c+" {");f.fontFamily&&h.push("\tfont-family: "+f.fontFamily+";");f.fontSize&&h.push("\tfont-size: "+f.fontSize+";");f.fontSize&&h.push("\tcolor: "+f.text+";");h.push("}");h.push("."+c+".textview {");f.background&&h.push("\tbackground-color: "+f.background+";");h.push("}");g("ruler.annotations",f.annotationRuler,!0);g("ruler.lines", |
| f.annotationRuler,!0);g("ruler.folding",f.annotationRuler,!0);g("ruler.overview",f.overviewRuler,!0);g("rulerLines",f.lineNumber,!1);g("rulerLines.even",f.lineNumberEven,!1);g("rulerLines.odd",f.lineNumberOdd,!1);g("annotationLine.currentLine",f.currentLine,!0);g("entity-name-tag",f.keyword,!1);g("entity-other-attribute-name",f.attribute,!1);g("string-quoted",f.string,!1);g("meta.annotation.currentLine",f.currentLine,!0);g("keyword",f.keyword,!1);g("string",f.string,!1);g("comment",f.comment,!1); |
| g("comment.block.documentation",f.comment,!1);g("keyword.other.documentation.markup",f.comment,!1);return h.join("\n")},_createStyle:function(c,f,g,h){var b=this._document,c="orion-theme-"+c,a=b.getElementById(c);if(a){if(h||a.firstChild.data===f)return;a.removeChild(a.firstChild);a.appendChild(b.createTextNode(f))}else h?(a=n.createElement(b,"link"),a.rel="stylesheet",a.type="text/css",a.href=f,a.addEventListener("load",function(){g()})):(a=n.createElement(b,"style"),a.appendChild(b.createTextNode(f))), |
| a.id=c,(b.getElementsByTagName("head")[0]||b.documentElement).appendChild(a);h||g()},_load:function(c,f,g){if(c)if(typeof f==="string")this._createStyle(c,f,g);else if(f=f.href,f.substring(f.length-4)!==".css"&&(f+=".css"),/^\//.test(f)||/[a-zA-Z0-9]+:\/\//i.test(f)||!k.toUrl)this._createStyle(c,f,g,!0);else{var h=this;k(["text!"+f],function(b){h._createStyle(c,b,g,!1)})}else g()}};m.EventTarget.addMixin(i.prototype);return{TextTheme:i}}); |
| define("orion/editor/util",[],function(){return{contains:function(k,m){if(!m)return!1;if(!k.compareDocumentPosition){for(var n=m;n;){if(k===n)return!0;n=n.parentNode}return!1}return k===m||(k.compareDocumentPosition(m)&16)!==0},addEventListener:function(k,m,n,i){typeof k.addEventListener==="function"?k.addEventListener(m,n,i===!0):k.attachEvent("on"+m,n)},removeEventListener:function(k,m,n,i){typeof k.removeEventListener==="function"?k.removeEventListener(m,n,i===!0):k.detachEvent("on"+m,n)}}}); |
| 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(k,m,n,i,c,d,f){function g(j,a,b){if(b){a.className="";for(var b=a.attributes,e=b.length;e-- >0;)(!f.isIE||f.isIE>=9||f.isIE<9&&b[e].specified)&&a.removeAttribute(b[e].name)}if(j){if(j.styleClass)a.className=j.styleClass;if(b=j.style)for(var c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c]);if(j=j.attributes)for(var l in j)j.hasOwnProperty(l)&& |
| a.setAttribute(l,j[l])}}function h(j){return j instanceof Array?j.slice(0):j}function b(j,a){if(!j)return a;if(!a)return j;for(var b in a)a.hasOwnProperty(b)&&(j.hasOwnProperty(b)||(j[b]=a[b]));return j}function a(j,w){if(j===w)return!0;if(j&&!w||!j&&w)return!1;if(j&&j.constructor===String||w&&w.constructor===String)return!1;if(j instanceof Array||w instanceof Array){if(!(j instanceof Array&&w instanceof Array))return!1;if(j.length!==w.length)return!1;for(var b=0;b<j.length;b++)if(!a(j[b],w[b]))return!1; |
| return!0}if(!(j instanceof Object)||!(w instanceof Object))return!1;for(b in j)if(j.hasOwnProperty(b)){if(!w.hasOwnProperty(b))return!1;if(!a(j[b],w[b]))return!1}for(b in w)if(!j.hasOwnProperty(b))return!1;return!0}function e(j,a,b){for(var e=0,c=0,f=0,l=j.length;f<l;){e!==-1&&e<=f&&(e=j.indexOf("\r",f));c!==-1&&c<=f&&(c=j.indexOf("\n",f));var d=f,o;if(c===-1&&e===-1){a(j.substring(f));break}e!==-1&&c!==-1?e+1===c?(o=e,f=c+1):(o=e<c?e:c,f=(e<c?e:c)+1):e!==-1?(o=e,f=e+1):(o=c,f=c+1);a(j.substring(d, |
| o));b()}}function l(j){var a,b,e,c,f=j.ownerDocument.defaultView||j.ownerDocument.parentWindow;if(f.getComputedStyle)j=f.getComputedStyle(j,null),a=j.getPropertyValue("padding-left"),b=j.getPropertyValue("padding-top"),e=j.getPropertyValue("padding-right"),c=j.getPropertyValue("padding-bottom");else if(j.currentStyle)a=j.currentStyle.paddingLeft,b=j.currentStyle.paddingTop,e=j.currentStyle.paddingRight,c=j.currentStyle.paddingBottom;return{left:parseInt(a,10)||0,top:parseInt(b,10)||0,right:parseInt(e, |
| 10)||0,bottom:parseInt(c,10)||0}}function o(j){var a,b,e,c,f=j._trim;if(!f){var f=l(j),d=j.ownerDocument.defaultView||j.ownerDocument.parentWindow;if(d.getComputedStyle)c=d.getComputedStyle(j,null),a=c.getPropertyValue("border-left-width"),b=c.getPropertyValue("border-top-width"),e=c.getPropertyValue("border-right-width"),c=c.getPropertyValue("border-bottom-width");else if(j.currentStyle)a=j.currentStyle.borderLeftWidth,b=j.currentStyle.borderTopWidth,e=j.currentStyle.borderRightWidth,c=j.currentStyle.borderBottomWidth; |
| a=parseInt(a,10)||0;b=parseInt(b,10)||0;e=parseInt(e,10)||0;c=parseInt(c,10)||0;f.left+=a;f.top+=b;f.right+=e;f.bottom+=c;j._trim=f}return f}function q(j,a,b){this.start=j;this.end=a;this.caret=b}function r(j){this.left=j.left;this.top=j.top;this.right=j.right;this.bottom=j.bottom}function p(j,a,b){this.view=j;this.lineIndex=a;this._lineDiv=b}function t(j){this._init(j||{})}var v=d.addEventListener,s=d.removeEventListener,u=function(){function j(j){this.options=j}j.prototype.play=function(){var j= |
| typeof this.options.duration==="number"?this.options.duration:350,a=this.options.easing||this.defaultEasing,b=this.options.onAnimate||function(){},e=this.options.curve[0],c=this.options.curve[1],f=c-e,l=-1,d,o=this;this.interval=this.options.window.setInterval(function(){l=l===-1?(new Date).getTime():l;var g=((new Date).getTime()-l)/j;g<1?(g=a(g),d=e+g*f,b(d)):(b(c),o.stop())},typeof this.options.rate==="number"?this.options.rate:20)};j.prototype.stop=function(){this.options.window.clearInterval(this.interval); |
| (this.options.onEnd||function(){})()};j.prototype.defaultEasing=function(j){return Math.sin(j*(Math.PI/2))};return j}();q.prototype={clone:function(){return new q(this.start,this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(j){this.caret?this.start=j:this.end=j;if(this.start>this.end)j=this.start,this.start=this.end,this.end=j,this.caret=!this.caret},setCaret:function(j){this.end=this.start=j;this.caret=!1},getCaret:function(){return this.caret? |
| this.start:this.end},toString:function(){return"start="+this.start+" end="+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===this.end},equals:function(j){return this.caret===j.caret&&this.start===j.start&&this.end===j.end}};r.prototype={toString:function(){return"{l="+this.left+", t="+this.top+", r="+this.right+", b="+this.bottom+"}"}};p.prototype={create:function(j,a){if(!this._lineDiv){var b=this._lineDiv=this._createLine(j,a,this.lineIndex);b._line= |
| this;return b}},_createLine:function(j,w,b){var e=this.view,c=e._model,l=c.getLine(b),d=c.getLineStart(b),o={type:"LineStyle",textView:e,lineIndex:b,lineText:l,lineStart:d};if(l.length<2E3)e.onLineStyle(o);c=w||f.createElement(j.ownerDocument,"div");if(!w||!a(w.viewStyle,o.style)){g(o.style,c,w);if(w)w._trim=null;c.viewStyle=o.style;c.setAttribute("role","presentation")}c.lineIndex=b;b=[];this._createRanges(o.ranges,l,0,l.length,d,{tabOffset:0,ranges:b});l=" ";!e._fullSelection&&f.isIE<9&&(l="\ufeff"); |
| o={text:l,style:e._metrics.largestFontStyle,ignoreChars:1};b.length===0||!b[b.length-1].style||b[b.length-1].style.tagName!=="div"?b.push(o):b.splice(b.length-1,0,o);var h,p,i,q,r,l=e=0,s,t;if(w){if(p=w.modelChangedEvent)p.removedLineCount===0&&p.addedLineCount===0?(t=p.start-d,s=p.addedCharCount-p.removedCharCount):t=-1,w.modelChangedEvent=void 0;p=w.firstChild}for(d=0;d<b.length;d++){o=b[d];q=o.text;e+=q.length;h=o.style;if(p)if(r=p.firstChild.data,i=p.viewStyle,r===q&&a(h,i)){l+=r.length;p._rectsCache= |
| void 0;h=p=p.nextSibling;continue}else for(;p;){if(t!==-1){i=e;i>=t&&(i-=s);r=(r=p.firstChild.data)?r.length:0;if(l+r>i)break;l+=r}i=p.nextSibling;c.removeChild(p);p=i}h=this._createSpan(c,q,h,o.ignoreChars);p?c.insertBefore(h,p):c.appendChild(h);if(w)w.lineWidth=void 0}if(w)for(j=h?h.nextSibling:null;j;)i=j.nextSibling,w.removeChild(j),j=i;else j.appendChild(c);return c},_createRanges:function(j,w,b,e,c,f){if(!(b>e)){if(j)for(var l=0;l<j.length;l++){var d=j[l];if(!(d.end<c+b)){var o=Math.max(c+b, |
| d.start)-c;if(o>e)break;var g=Math.min(c+e,d.end)-c;if(o<=g){o=Math.max(b,o);g=Math.min(e,g);b<o&&this._createRange(w,b,o,null,f);if(!d.style||!d.style.unmergeable)for(;l+1<j.length&&j[l+1].start-c===g&&a(d.style,j[l+1].style);)d=j[l+1],g=Math.min(c+e,d.end)-c,l++;this._createRange(w,o,g,d.style,f);b=g}}}b<e&&this._createRange(w,b,e,null,f)}},_createRange:function(j,a,b,e,c){if(!(a>b)){var f=this.view._customTabSize;if(f&&f!==8)for(var l=j.indexOf("\t",a);l!==-1&&l<b;){a<l&&(a={text:j.substring(a, |
| l),style:e},c.ranges.push(a),c.tabOffset+=a.text.length);a=f-c.tabOffset%f;if(a>0){for(var d="\u00a0",o=1;o<a;o++)d+=" ";a={text:d,style:e,ignoreChars:a-1};c.ranges.push(a);c.tabOffset+=a.text.length}a=l+1;if(a===b)return;l=j.indexOf("\t",a)}a<=b&&(a={text:j.substring(a,b),style:e},c.ranges.push(a),c.tabOffset+=a.text.length)}},_createSpan:function(j,a,b,e){var c=this.view,l="span";b&&b.tagName&&(l=b.tagName.toLowerCase());var d=l==="a";if(d)j.hasLink=!0;d&&!c._linksVisible&&(l="span");d=j.ownerDocument; |
| j=f.createElement(j.ownerDocument,l);b&&b.html?(j.innerHTML=b.html,j.ignore=!0):b&&b.node?(j.appendChild(b.node),j.ignore=!0):j.appendChild(d.createTextNode(b&&b.text?b.text:a));g(b,j);if(l==="a"){var o=c._getWindow();v(j,"click",function(j){return c._handleLinkClick(j?j:o.event)},!1)}j.viewStyle=b;if(e)j.ignoreChars=e;return j},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(j,a){var b=this._ensureCreated(), |
| e=this.view;if(j===void 0)return this._getLineBoundingClientRect(b,!0);var c=e._model,l=b.ownerDocument,d=this.lineIndex,o=null;if(j<c.getLineEnd(d)){d=c.getLineStart(d);for(c=b.firstChild;c;){if(!c.ignore){var g=c.firstChild,p=g.length;c.ignoreChars&&(p-=c.ignoreChars);if(d+p>j){o=j-d;if(g.length===1)o=new r(c.getBoundingClientRect());else if(e._isRangeRects)l=l.createRange(),l.setStart(g,o),l.setEnd(g,o+1),o=new r(l.getBoundingClientRect());else if(f.isIE){if(l=l.body.createTextRange(),l.moveToElementText(c), |
| l.collapse(),(d=o===0&&f.isIE===8)&&(o=1),l.moveEnd("character",o+1),l.moveStart("character",o),o=new r(l.getBoundingClientRect()),d)o.left=c.getClientRects()[0].left}else{var h=g.data;c.removeChild(g);c.appendChild(l.createTextNode(h.substring(0,o)));var i=f.createElement(l,"span");i.appendChild(l.createTextNode(h.substring(o,o+1)));c.appendChild(i);c.appendChild(l.createTextNode(h.substring(o+1)));o=new r(i.getBoundingClientRect());c.innerHTML="";c.appendChild(g);this._createdDiv||(l=e._getSelection(), |
| (d<=l.start&&l.start<d+p||d<=l.end&&l.end<d+p)&&e._updateDOMSelection())}f.isIE&&(l=b.ownerDocument.defaultView||b.ownerDocument.parentWindow,b=l.screen.logicalXDPI/l.screen.deviceXDPI,l=l.screen.logicalYDPI/l.screen.deviceYDPI,o.left*=b,o.right*=b,o.top*=l,o.bottom*=l);break}d+=p}c=c.nextSibling}}b=this.getBoundingClientRect();if(!o)e._wrapMode?(e=this.getClientRects(),o=e[e.length-1],o.left=o.right,o.left+=b.left,o.top+=b.top,o.right+=b.left,o.bottom+=b.top):(o=new r(b),o.left=o.right);if(a||a=== |
| void 0)o.left-=b.left,o.top-=b.top,o.right-=b.left,o.bottom-=b.top;return o},_getClientRects:function(j,a){var b,e,c,l;if(!j._rectsCache){b=j.getClientRects();e=Array(b.length);for(l=0;l<b.length;l++)c=e[l]=new r(b[l]),c.left-=a.left,c.top-=a.top,c.right-=a.left,c.bottom-=a.top;j._rectsCache=e}b=j._rectsCache;e=[b.length];for(l=0;l<b.length;l++)e[l]=new r(b[l]);return e},getClientRects:function(j){if(!this.view._wrapMode)return[this.getBoundingClientRect()];for(var a=this._ensureCreated(),b=[],e= |
| a.firstChild,c,l=a.getBoundingClientRect();e;){if(!e.ignore)for(var f=this._getClientRects(e,l),a=0;a<f.length;a++){var o=f[a],d;if(o.top!==o.bottom){var g=o.top+(o.bottom-o.top)/2;for(d=0;d<b.length;d++)if(c=b[d],c.top<=g&&g<c.bottom)break;if(d===b.length)b.push(o);else{if(o.left<c.left)c.left=o.left;if(o.top<c.top)c.top=o.top;if(o.right>c.right)c.right=o.right;if(o.bottom>c.bottom)c.bottom=o.bottom}}}e=e.nextSibling}return j!==void 0?b[j]:b},_getLineBoundingClientRect:function(j,a){var b=new r(j.getBoundingClientRect()); |
| if(!this.view._wrapMode){b.right=b.left;for(var e=j.lastChild;e&&e.ignoreChars===e.firstChild.length;)e=e.previousSibling;if(e)e=e.getBoundingClientRect(),b.right=e.right+o(j).right}a&&(e=o(j),b.left+=e.left,b.right-=e.right);return b},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(j){if(!this.view._wrapMode)return 0;for(var a=this.getClientRects(),j=this.getBoundingClientRect(j),j=j.top+(j.bottom-j.top)/2,b=0;b<a.length;b++)if(a[b].top<=j&& |
| j<a[b].bottom)return b;return a.length-1},getLineStart:function(j){if(!this.view._wrapMode||j===0)return this.view._model.getLineStart(j);var a=this.getClientRects();return this.getOffset(a[j].left+1,a[j].top+1)},getOffset:function(j,a){var b=this.view,e=b._model,c=this.lineIndex,l=e.getLineStart(c),o=e.getLineEnd(c);if(l===o)return l;var d=this._ensureCreated(),g=this.getBoundingClientRect(),p,h;if(b._wrapMode){p=this.getClientRects();if(a<p[0].top)a=p[0].top;for(var i=0;i<p.length;i++)if(h=p[i], |
| h.top<=a&&a<h.bottom)break;if(j<h.left)j=h.left;j>h.right&&(j=h.right-1)}else j<0&&(j=0),j>g.right-g.left&&(j=g.right-g.left);var q=d.ownerDocument,i=q.defaultView||q.parentWindow,r=f.isIE?i.screen.logicalXDPI/i.screen.deviceXDPI:1,s=f.isIE?i.screen.logicalYDPI/i.screen.deviceYDPI:1,i=l,t=d.firstChild;a:for(;t;){if(!t.ignore){var u=t.firstChild,d=u.length;t.ignoreChars&&(d-=t.ignoreChars);var v,k,n;p=this._getClientRects(t,g);for(var m=0;m<p.length;m++)if(h=p[m],h.left<=j&&j<h.right&&(!b._wrapMode|| |
| h.top<=a&&a<h.bottom)){var m=h.left+g.left,A;if(f.isIE||b._isRangeRects){for(var q=b._isRangeRects?q.createRange():q.body.createTextRange(),z=d,C=-1;z-C>1;){var J=Math.floor((z+C)/2);p=C+1;h=J===d-1&&t.ignoreChars?u.length:J+1;A=p===0&&f.isIE===8;b._isRangeRects?(q.setStart(u,p),q.setEnd(u,h)):(A&&(p=1),q.moveToElementText(t),q.move("character",p),q.moveEnd("character",h-p));p=q.getClientRects();for(var N=!1,L=0;L<p.length;L++)if(h=p[L],v=(A?m:h.left)*r-g.left,n=h.right*r-g.left,k=h.top*s-g.top,h= |
| h.bottom*s-g.top,v<=j&&j<n&&(!b._wrapMode||k<=a&&a<h)){N=!0;break}N?z=J:C=J}i+=z;p=z;h=z===d-1&&t.ignoreChars?u.length:Math.min(z+1,u.length);b._isRangeRects?(q.setStart(u,p),q.setEnd(u,h)):(q.moveToElementText(t),q.move("character",p),q.moveEnd("character",h-p));p=q.getClientRects();b=!1;p.length>0&&(h=p[0],v=(A?m:h.left)*r-g.left,n=h.right*r-g.left,b=j>v+(n-v)/2);g=i-l;e=e.getLine(c);c=e.charCodeAt(g);55296<=c&&c<=56319&&b?g<e.length&&(c=e.charCodeAt(g+1),56320<=c&&c<=57343&&(i+=1)):56320<=c&&c<= |
| 57343&&!b&&g>0&&(c=e.charCodeAt(g-1),55296<=c&&c<=56319&&(i-=1));b&&i++}else{e=[];for(c=0;c<d;c++)e.push("<span>"),c===d-1?e.push(u.data.substring(c)):e.push(u.data.substring(c,c+1)),e.push("</span>");t.innerHTML=e.join("");for(e=t.firstChild;e;){h=e.getBoundingClientRect();v=h.left-g.left;n=h.right-g.left;if(v<=j&&j<n){j>v+(n-v)/2&&i++;break}i++;e=e.nextSibling}if(!this._createdDiv)t.innerHTML="",t.appendChild(u),g=b._getSelection(),(i<=g.start&&g.start<i+d||i<=g.end&&g.end<i+d)&&b._updateDOMSelection()}break a}i+= |
| d}t=t.nextSibling}return Math.min(o,Math.max(l,i))},getNextOffset:function(j,a){if(a.unit==="line"){var b=this.view._model,e=b.getLineAtOffset(j);if(a.count>0)return a.count--,b.getLineEnd(e);a.count++;return b.getLineStart(e)}return a.unit==="wordend"||a.unit==="wordWS"||a.unit==="wordendWS"?this._getNextOffset_W3C(j,a):f.isIE?this._getNextOffset_IE(j,a):this._getNextOffset_W3C(j,a)},_getNextOffset_W3C:function(j,a){function b(j){return 33<=j&&j<=47||58<=j&&j<=64||91<=j&&j<=94||j===96||123<=j&&j<= |
| 126}function e(j){return j===32||j===9}var c=this.view._model,l=c.getLineAtOffset(j),f=c.getLine(l),o=c.getLineStart(l),c=c.getLineEnd(l),l=f.length,d=j-o,g,h=a.count<0?-1:1;if(a.unit==="word"||a.unit==="wordend"||a.unit==="wordWS"||a.unit==="wordendWS")for(var p,i,q;a.count!==0;){if(a.count>0){if(d===l)return c;g=f.charCodeAt(d);p=b(g);i=!p&&!e(g);for(d++;d<l;){g=f.charCodeAt(d);if(a.unit!=="wordWS"&&a.unit!=="wordendWS"){q=b(g);if(a.unit==="wordend"){if(!q&&p)break}else if(q&&!p)break;g=!q&&!e(g)}else g= |
| !e(g);if(a.unit==="wordend"||a.unit==="wordendWS"){if(!g&&i)break}else if(g&&!i)break;i=g;p=q;d++}}else{if(d===0)return o;d--;g=f.charCodeAt(d);p=b(g);for(i=!p&&!e(g);0<d;){g=f.charCodeAt(d-1);if(a.unit!=="wordWS"&&a.unit!=="wordendWS"){q=b(g);if(a.unit==="wordend"){if(q&&!p)break}else if(!q&&p)break;g=!q&&!e(g)}else g=!e(g);if(a.unit==="wordend"||a.unit==="wordendWS"){if(g&&!i)break}else if(!g&&i)break;i=g;p=q;d--}}a.count-=h}else for(;a.count!==0&&0<=d+h&&d+h<=l;)d+=h,g=f.charCodeAt(d),56320<=g&& |
| g<=57343&&d>0&&(g=f.charCodeAt(d-1),55296<=g&&g<=56319&&(d+=h)),a.count-=h;return o+d},_getNextOffset_IE:function(j,a){var b=this._ensureCreated(),e=this.view._model,c=this.lineIndex,l=0,f;f=e.getLineStart(c);var d=b.ownerDocument,o=a.count<0?-1:1;if(j===e.getLineEnd(c)){for(b=b.lastChild;b&&b.ignoreChars===b.firstChild.length;)b=b.previousSibling;if(!b)return f;l=d.body.createTextRange();l.moveToElementText(b);f=l.text.length;l.moveEnd(a.unit,o);l=j+l.text.length-f}else if(j===f&&a.count<0)l=f;else for(b= |
| b.firstChild;b;){e=b.firstChild.length;b.ignoreChars&&(e-=b.ignoreChars);if(f+e>j){l=d.body.createTextRange();if(j===f&&a.count<0){for(f=b.previousSibling;f;){if(f.firstChild&&f.firstChild.length)break;f=f.previousSibling}l.moveToElementText(f?f:b.previousSibling)}else l.moveToElementText(b),l.collapse(),l.moveEnd("character",j-f);f=l.text.length;l.moveEnd(a.unit,o);l=j+l.text.length-f;break}f=e+f;b=b.nextSibling}a.count-=o;return l},destroy:function(){var j=this._createdDiv;if(j)j.parentNode.removeChild(j), |
| this._createdDiv=null}};t.prototype={addKeyMode:function(j,a){var b=this._keyModes;a!==void 0?b.splice(a,0,j):b.push(j);j._modeAdded&&j._modeAdded()},addRuler:function(j,a){j.setView(this);var b=this._rulers;if(a!==void 0){var e,c;for(e=0,c=0;e<b.length&&c<a;e++)j.getLocation()===b[e].getLocation()&&c++;b.splice(c,0,j);a=c}else b.push(j);this._createRuler(j,a);this._update()},computeSize:function(){var j=0,a=0,b=this._model,e=this._clientDiv;if(!e)return{width:j,height:a};var c=e.style.width;if(f.isWebkit)e.style.width= |
| "0x7fffffffpx";for(var b=b.getLineCount(),l=0;l<b;l++){var d=this._getLine(l),o=d.getBoundingClientRect(),j=Math.max(j,o.right-o.left);a+=o.bottom-o.top;d.destroy()}if(f.isWebkit)e.style.width=c;e=this._getViewPadding();j+=e.right+e.left+this._metrics.scrollWidth;a+=e.bottom+e.top+this._metrics.scrollWidth;return{width:j,height:a}},convert:function(j,a,b){if(this._clientDiv){var e=this._getScroll(),c=this._getViewPadding(),l=this._viewDiv.getBoundingClientRect();a==="document"&&(j.x!==void 0&&(j.x+= |
| -e.x+l.left+c.left),j.y!==void 0&&(j.y+=-e.y+l.top+c.top));b==="document"&&(j.x!==void 0&&(j.x+=e.x-l.left-c.left),j.y!==void 0&&(j.y+=e.y-l.top-c.top));return j}},destroy:function(){for(var j=0;j<this._rulers.length;j++)this._rulers[j].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&& |
| (this._updateDOMSelection(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(j){if(j=this._actions[j])return j.actionDescription},getActions:function(j){var a=[],b=this._actions,e;for(e in b)b.hasOwnProperty(e)&&(j||!b[e].defaultHandler)&&a.push(e);return a},getBottomIndex:function(j){return!this._clientDiv?0:this._getBottomIndex(j)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()}, |
| getCaretOffset:function(){return this._getSelection().getCaret()},getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var j=this._getScroll();return{x:j.x,y:j.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?0:this._getScroll().x},getKeyBindings:function(j){for(var a=[],b=this._keyModes,e=0;e<b.length;e++)a=a.concat(b[e].getKeyBindings(j));return a},getKeyModes:function(){return this._keyModes.slice(0)}, |
| getLineHeight:function(j){return!this._clientDiv?0:this._getLineHeight(j)},getLineIndex:function(j){return!this._clientDiv?0:this._getLineIndex(j)},getLinePixel:function(j){return!this._clientDiv?0:this._getLinePixel(j)},getLocationAtOffset:function(j){if(!this._clientDiv)return{x:0,y:0};var a=this._model,j=Math.min(Math.max(0,j),a.getCharCount()),a=a.getLineAtOffset(j),b=this._getLine(a),j=b.getBoundingClientRect(j);b.destroy();b=j.left;a=this._getLinePixel(a)+j.top;return{x:b,y:a}},getNextOffset:function(j, |
| a){var b=new q(j,j,!1);this._doMove(a,b);return b.getCaret()},getOptions:function(){var j;if(arguments.length===0)j=this._defaultOptions();else if(arguments.length===1){if(j=arguments[0],typeof j==="string")return h(this["_"+j])}else{j={};for(var a in arguments)arguments.hasOwnProperty(a)&&(j[arguments[a]]=void 0)}for(var b in j)j.hasOwnProperty(b)&&(j[b]=h(this["_"+b]));return j},getModel:function(){return this._model},getOffsetAtLocation:function(j,a){if(!this._clientDiv)return 0;var b=this._getLineIndex(a), |
| e=this._getLine(b),b=e.getOffset(j,a-this._getLinePixel(b));e.destroy();return b},getLineAtOffset:function(j){this.getModel().getLineAtOffset(j)},getLineStart:function(j){this.getModel().getLineStart(j)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var j=this._getSelection();return{start:j.start,end:j.end}},getText:function(j,a){return this._model.getText(j,a)},getTopIndex:function(j){return!this._clientDiv?0:this._getTopIndex(j)},getTopPixel:function(){return!this._clientDiv? |
| 0:this._getScroll().y},invokeAction:function(j,a,b){if(this._clientDiv){if(j=this._actions[j]){if(!a&&j.handler&&j.handler(b))return!0;if(j.defaultHandler)return typeof j.defaultHandler(b)==="boolean"}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(j){return this.dispatchEvent(j)},onDragStart:function(j){return this.dispatchEvent(j)},onDrag:function(j){return this.dispatchEvent(j)},onDragEnd:function(j){return this.dispatchEvent(j)},onDragEnter:function(j){return this.dispatchEvent(j)}, |
| onDragOver:function(j){return this.dispatchEvent(j)},onDragLeave:function(j){return this.dispatchEvent(j)},onDrop:function(j){return this.dispatchEvent(j)},onDestroy:function(j){return this.dispatchEvent(j)},onLineStyle:function(j){return this.dispatchEvent(j)},onKeyDown:function(j){return this.dispatchEvent(j)},onKeyPress:function(j){return this.dispatchEvent(j)},onKeyUp:function(j){return this.dispatchEvent(j)},onModelChanged:function(j){return this.dispatchEvent(j)},onModelChanging:function(j){return this.dispatchEvent(j)}, |
| onModify:function(j){return this.dispatchEvent(j)},onMouseDown:function(j){return this.dispatchEvent(j)},onMouseUp:function(j){return this.dispatchEvent(j)},onMouseMove:function(j){return this.dispatchEvent(j)},onMouseOver:function(j){return this.dispatchEvent(j)},onMouseOut:function(j){return this.dispatchEvent(j)},onSelection:function(j){return this.dispatchEvent(j)},onScroll:function(j){return this.dispatchEvent(j)},onVerify:function(j){return this.dispatchEvent(j)},onFocus:function(j){return this.dispatchEvent(j)}, |
| onBlur:function(j){return this.dispatchEvent(j)},redraw:function(){if(!(this._redrawCount>0)){var j=this._model.getLineCount();this.redrawRulers(0,j);this.redrawLines(0,j)}},redrawRulers:function(j,a){if(!(this._redrawCount>0))for(var b=this.getRulers(),e=0;e<b.length;e++)this.redrawLines(j,a,b[e])},redrawLines:function(j,a,b){if(!(this._redrawCount>0)&&(j===void 0&&(j=0),a===void 0&&(a=this._model.getLineCount()),j!==a)){var e=this._clientDiv;if(e){if(b)for(e=this._getRulerParent(b).firstChild;e;){if(e._ruler=== |
| b)break;e=e.nextSibling}b?e.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(j,a);if(!b||b.getOverview()==="page")for(e=e.firstChild;e;){var c=e.lineIndex;if(j<=c&&c<a)e.lineChanged=!0;e=e.nextSibling}if(!b&&!this._wrapMode&&j<=this._maxLineIndex&&this._maxLineIndex<a)this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0;this._queueUpdate()}}},redrawRange:function(j,a){if(!(this._redrawCount>0)){var b=this._model;j===void 0&&(j=0);a===void 0&&(a=b.getCharCount()); |
| var e=b.getLineAtOffset(j),b=b.getLineAtOffset(Math.max(j,a-1))+1;this.redrawLines(e,b)}},removeKeyMode:function(j){for(var a=this._keyModes,b=0;b<a.length;b++)if(a[b]===j){a.splice(b,1);break}j._modeRemoved&&j._modeRemoved()},removeRuler:function(j){for(var a=this._rulers,b=0;b<a.length;b++)if(a[b]===j){a.splice(b,1);j.setView(null);this._destroyRuler(j);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(j,a,b){if(j){var e=this._actions,c=e[j]; |
| c||(c=e[j]={});c.handler=a;if(b!==void 0)c.actionDescription=b}},setKeyBinding:function(j,a){this._keyModes[0].setKeyBinding(j,a)},setCaretOffset:function(j,a,b){var e=this._model.getCharCount(),j=Math.max(0,Math.min(j,e));this._setSelection(new q(j,j,!1),a===void 0||a,!0,b)},setHorizontalPixel:function(j){this._clientDiv&&(j=Math.max(0,j),this._scrollView(j-this._getScroll().x,0))},setRedraw:function(j){j?--this._redrawCount===0&&this.redraw():this._redrawCount++},setModel:function(j){if(j&&j!== |
| this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var a=this._model.getLineCount(),b=this._model.getCharCount(),e=j.getLineCount(),c=j.getCharCount(),l={type:"ModelChanging",text:j.getText(),start:0,removedCharCount:b,addedCharCount:c,removedLineCount:a,addedLineCount:e};this.onModelChanging(l);this._model=j;l={type:"ModelChanged",start:0,removedCharCount:b,addedCharCount:c,removedLineCount:a, |
| addedLineCount:e};this.onModelChanged(l);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(j){var b=this._defaultOptions(),e;for(e in j)if(j.hasOwnProperty(e)){var c=j[e];if(!a(this["_"+e],c)){var l=b[e]?b[e].update:null;l?l.call(this,c):this["_"+e]=h(c)}}},setSelection:function(j,a,b,e){var c=j>a;if(c)var l=j,j=a,a=l;l=this._model.getCharCount();j= |
| Math.max(0,Math.min(j,l));a=Math.max(0,Math.min(a,l));this._setSelection(new q(j,a,c),b===void 0||b,!0,e)},setText:function(j,a,b){var e=a===void 0&&b===void 0;a===void 0&&(a=0);b===void 0&&(b=this._model.getCharCount());if(e)this._variableLineHeight=!1;this._modifyContent({text:j,start:a,end:b,_code:!0},!e);if(e)this._columnX=-1,this._setSelection(new q(0,0,!1),!0),f.isFirefox&&this._fixCaret()},setTopIndex:function(j){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,j))-this._getScroll().y)}, |
| setTopPixel:function(j){this._clientDiv&&this._scrollView(0,Math.max(0,j)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(j,a){this._clientDiv&&(j&&this._updateStyle(),a===void 0||a?this._update():this._queueUpdate())},_handleRootMouseDown:function(j){if(!this._ignoreEvent(j)){if(f.isFirefox&&j.which===1)this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0;var a=this._overlayDiv||this._clientDiv;if(f.isIE<9)a= |
| this._viewDiv;for(var b=j.target?j.target:j.srcElement;b;){if(a===b)return;b=b.parentNode}j.preventDefault&&j.preventDefault();j.stopPropagation&&j.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(j){if(!this._ignoreEvent(j)&&f.isFirefox&&j.which===1)this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1},_handleBlur:function(){if(!this._ignoreBlur){this._hasFocus= |
| !1;if(f.isIE<9&&!this._getSelection().isEmpty()){var j=this._rootDiv,a=f.createElement(j.ownerDocument,"div");j.appendChild(a);j.removeChild(a)}if(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",j=this._getWindow(),a=this._selDiv1.ownerDocument,j.getSelection){a=j.getSelection();for(j=a.anchorNode;j;){if(j===this._clientDiv){a.rangeCount>0&&a.removeAllRanges(); |
| break}j=j.parentNode}}else if(a.selection){this._ignoreSelect=!1;for(j=a.selection.createRange().parentElement();j;){if(j===this._clientDiv){a.selection.empty();break}j=j.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},_handleContextMenu:function(j){if(!this._ignoreEvent(j)){f.isIE&&this._lastMouseButton===3&&this._updateDOMSelection();var a=!1;this.isListening("ContextMenu")?(a=this._createMouseEvent("ContextMenu",j),a.screenX=j.screenX,a.screenY=j.screenY,this.onContextMenu(a), |
| a=a.defaultPrevented):f.isMac&&f.isFirefox&&j.button===0&&(a=!0);if(a)return j.preventDefault&&j.preventDefault(),!1}},_handleCopy:function(j){if(!this._ignoreEvent(j)&&!this._ignoreCopy&&this._doCopy(j))return j.preventDefault&&j.preventDefault(),!1},_handleCut:function(j){if(!this._ignoreEvent(j)&&this._doCut(j))return j.preventDefault&&j.preventDefault(),!1},_handleDataModified:function(j){this._ignoreEvent(j)||this._startIME()},_handleDblclick:function(j){if(!this._ignoreEvent(j)&&(this._lastMouseTime= |
| j.timeStamp?j.timeStamp:(new Date).getTime(),this._clickCount!==2))this._clickCount=2,this._handleMouse(j)},_handleDragStart:function(j){if(!this._ignoreEvent(j)){if(f.isFirefox){var a=this;this._getWindow().setTimeout(function(){a._clientDiv.contentEditable=!0;a._clientDiv.draggable=!1;a._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&this._dragOffset!==-1)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",j)),this._dragOffset=-1;else return j.preventDefault&&j.preventDefault(), |
| !1}},_handleDrag:function(j){if(!this._ignoreEvent(j)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",j))},_handleDragEnd:function(j){if(!this._ignoreEvent(j)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",j));f.isFirefox&&(this._fixCaret(),j.dataTransfer.dropEffect==="none"&&!j.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(j){if(!this._ignoreEvent(j)){var a=!0;this._dropTarget= |
| !0;this.isListening("DragEnter")&&(a=!1,this.onDragEnter(this._createMouseEvent("DragEnter",j)));if(f.isWebkit||a)return j.preventDefault&&j.preventDefault(),!1}},_handleDragOver:function(j){if(!this._ignoreEvent(j)){var a=!0;this.isListening("DragOver")&&(a=!1,this.onDragOver(this._createMouseEvent("DragOver",j)));if(f.isWebkit||a){if(a)j.dataTransfer.dropEffect="none";j.preventDefault&&j.preventDefault();return!1}}},_handleDragLeave:function(j){if(!this._ignoreEvent(j)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave", |
| j))},_handleDrop:function(j){if(!this._ignoreEvent(j)){this._dropTarget=!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",j));j.preventDefault&&j.preventDefault();return!1}},_handleFocus:function(){this._hasFocus=!0;f.isIOS&&this._lastTouchOffset!==void 0?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();if(this._cursorDiv)this._cursorDiv.style.display="block";if(this._selDiv1){var j=this._highlightRGB;this._selDiv1.style.background= |
| j;this._selDiv2.style.background=j;this._selDiv3.style.background=j}if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(j){if(!this._ignoreEvent(j)){if(this.isListening("KeyDown")){var a=this._createKeyEvent("KeyDown",j);this.onKeyDown(a);if(a.defaultPrevented){if(f.isFirefox)this._keyDownPrevented=!0;j.preventDefault();return}}a=!1;switch(j.keyCode){case 16:case 17:case 18:case 91:a=!0;break;default:this._setLinksVisible(!1)}if(j.keyCode===229){if(this._readonly)return j.preventDefault&& |
| j.preventDefault(),!1;a=!0;if(f.isSafari&&f.isMac&&j.ctrlKey)a=!1,j.keyCode=129;a&&this._startIME()}else a||this._commitIME();if((f.isMac||f.isLinux)&&f.isFirefox<4||f.isOpera<12.16)return this._keyDownEvent=j,!0;if(this._doAction(j))return j.preventDefault?(j.preventDefault(),j.stopPropagation()):(j.cancelBubble=!0,j.returnValue=!1,j.keyCode=0),!1}},_handleKeyPress:function(j){if(!this._ignoreEvent(j))if(this._keyDownPrevented)j.preventDefault&&(j.preventDefault(),j.stopPropagation()),this._keyDownPrevented= |
| void 0;else{if(f.isMac&&f.isWebkit&&(63232<=j.keyCode&&j.keyCode<=63487||j.keyCode===13||j.keyCode===8))return j.preventDefault&&j.preventDefault(),!1;if(((f.isMac||f.isLinux)&&f.isFirefox<4||f.isOpera<12.16)&&this._doAction(this._keyDownEvent))return j.preventDefault&&j.preventDefault(),!1;var a=f.isMac?j.metaKey:j.ctrlKey;if(j.charCode!==void 0&&a)switch(j.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(a=this._createKeyEvent("KeyPress",j),this.onKeyPress(a),a.defaultPrevented)){j.preventDefault(); |
| return}if(this._doAction(j))return j.preventDefault?(j.preventDefault(),j.stopPropagation()):(j.cancelBubble=!0,j.returnValue=!1,j.keyCode=0),!1;a=!1;if(f.isMac){if(j.ctrlKey||j.metaKey)a=!0}else if(f.isFirefox){if(j.ctrlKey||j.altKey)a=!0}else j.ctrlKey^j.altKey&&(a=!0);if(!a&&(a=f.isOpera?j.which:j.charCode!==void 0?j.charCode:j.keyCode,a>31))return this._doContent(String.fromCharCode(a)),j.preventDefault&&j.preventDefault(),!1}},_handleDocKeyUp:function(j){(f.isMac?j.metaKey:j.ctrlKey)||this._setLinksVisible(!1)}, |
| _handleKeyUp:function(j){if(!this._ignoreEvent(j)){if(this.isListening("KeyUp")){var a=this._createKeyEvent("KeyUp",j);this.onKeyUp(a);if(a.defaultPrevented){j.preventDefault();return}}this._handleDocKeyUp(j);j.keyCode===13&&this._commitIME()}},_handleLinkClick:function(j){if(!(f.isMac?j.metaKey:j.ctrlKey))return j.preventDefault&&j.preventDefault(),!1},_handleMouse:function(j){var a=this._getWindow(),b=!0,e=a;if(f.isIE||f.isFirefox&&!this._overlayDiv)e=this._clientDiv;if(this._overlayDiv){if(this._hasFocus)this._ignoreFocus= |
| !0;var c=this;a.setTimeout(function(){c.focus();c._ignoreFocus=!1},0)}this._clickCount===1?(b=this._setSelectionTo(j.clientX,j.clientY,j.shiftKey,(!f.isOpera||f.isOpera>=12.16)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(j.clientX,j.clientY,j.shiftKey),this._doubleClickSelection=this._getSelection());return b},_handleMouseDown:function(j){if(!this._ignoreEvent(j)){if(this._linksVisible)if((j.target|| |
| j.srcElement).tagName!=="A")this._setLinksVisible(!1);else return;this._commitIME();var a=j.which;a||(j.button===4&&(a=2),j.button===2&&(a=3),j.button===1&&(a=1));var b=a!==2&&j.timeStamp?j.timeStamp:(new Date).getTime(),e=b-this._lastMouseTime,c=Math.abs(this._lastMouseX-j.clientX),l=Math.abs(this._lastMouseY-j.clientY),d=this._lastMouseButton===a;this._lastMouseX=j.clientX;this._lastMouseY=j.clientY;this._lastMouseTime=b;this._lastMouseButton=a;if(a===1)this._isMouseDown=!0,d&&e<=this._clickTime&& |
| c<=this._clickDist&&l<=this._clickDist?this._clickCount++:this._clickCount=1;if(this.isListening("MouseDown")&&(b=this._createMouseEvent("MouseDown",j),this.onMouseDown(b),b.defaultPrevented)){j.preventDefault();return}if(a===1&&this._handleMouse(j)&&(f.isIE>=9||f.isOpera||f.isChrome||f.isSafari||f.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),j.preventDefault();f.isFirefox&&this._lastMouseButton===3&&this._updateDOMSelection()}},_handleMouseOver:function(j){if(!this._ignoreEvent(j)&& |
| !this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",j))},_handleMouseOut:function(j){if(!this._ignoreEvent(j)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",j))},_handleMouseMove:function(j){if(!this._animation){var a=this._isClientDiv(j);if(this.isListening("MouseMove")&&a)this.onMouseMove(this._createMouseEvent("MouseMove",j));if(!this._dropTarget){var b=this._linksVisible||this._lastMouseMoveX!== |
| j.clientX||this._lastMouseMoveY!==j.clientY;this._lastMouseMoveX=j.clientX;this._lastMouseMoveY=j.clientY;this._setLinksVisible(b&&!this._isMouseDown&&(f.isMac?j.metaKey:j.ctrlKey));if(!this._isW3CEvents){if(j.button===0)return this._setGrab(null),!0;if(!this._isMouseDown&&j.button===1&&(this._clickCount&1)!==0&&a)return this._clickCount=2,this._handleMouse(j,this._clickCount)}if(this._isMouseDown&&this._dragOffset===-1){var a=j.clientX,j=j.clientY,e=this._getViewPadding(),c=this._viewDiv.getBoundingClientRect(), |
| l=this._getClientWidth(),d=this._getClientHeight(),b=c.left+e.left,o=c.top+e.top,l=c.left+e.left+l,e=c.top+e.top+d;j<o?this._doAutoScroll("up",a,j-o):j>e?this._doAutoScroll("down",a,j-e):a<b&&!this._wrapMode?this._doAutoScroll("left",a-b,j):a>l&&!this._wrapMode?this._doAutoScroll("right",a-l,j):(this._endAutoScroll(),this._setSelectionTo(a,j,!0))}}}},_isClientDiv:function(j){for(var a=this._overlayDiv||this._clientDiv,j=j.target?j.target:j.srcElement;j;){if(a===j)return!0;j=j.parentNode}return!1}, |
| _createKeyEvent:function(j,a){return{type:j,event:a,preventDefault:function(){this.defaultPrevented=!0}}},_createMouseEvent:function(j,a){var b=this.convert({x:a.clientX,y:a.clientY},"page","document");return{type:j,event:a,clickCount:this._clickCount,x:b.x,y:b.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(j){var a=j.which?j.button===0:j.button===1;if(this.isListening("MouseUp")&&(this._isClientDiv(j)||a&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp", |
| j));if(!this._linksVisible&&a&&this._isMouseDown){if(this._dragOffset!==-1)a=this._getSelection(),a.extend(this._dragOffset),a.collapse(),this._setSelection(a,!0,!0),this._dragOffset=-1;this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null);f.isFirefox&&j.preventDefault()}},_handleMouseWheel:function(j){var a=this._getLineHeight(),b=0,e=0;f.isIE||f.isOpera?e=-j.wheelDelta/40*a:f.isFirefox?(a=f.isMac?j.detail*3:Math.max(-256,Math.min(256,j.detail))*a,j.axis===j.HORIZONTAL_AXIS? |
| b=a:e=a):f.isMac?(e=j.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=j.timeStamp,b=j.wheelDeltaX%120!==0?1:e<40?40/(40-e):40,e=j.wheelDeltaY%120!==0?1:e<40?40/(40-e):40,b=Math.ceil(-j.wheelDeltaX/b),-1<b&&b<0&&(b=-1),0<b&&b<1&&(b=1),e=Math.ceil(-j.wheelDeltaY/e),-1<e&&e<0&&(e=-1),0<e&&e<1&&(e=1)):(b=-j.wheelDeltaX,e=-j.wheelDeltaY/120*8*a);if(f.isSafari){for(a=j.target;a&&a.lineIndex===void 0;)a=a.parentNode;this._mouseWheelLine=a}a=this._getScroll();this._scrollView(b,e);b=this._getScroll(); |
| if(a.x!==b.x||a.y!==b.y)return j.preventDefault&&j.preventDefault(),!1},_handlePaste:function(j){if(!this._ignoreEvent(j)&&!this._ignorePaste&&this._doPaste(j)){if(f.isIE){var a=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){a._updateDOMSelection();a._ignoreFocus=!1},0)}j.preventDefault&&j.preventDefault();return!1}},_handleResize:function(){var j=this._rootDiv.clientWidth,b=this._rootDiv.clientHeight;if(this._rootWidth!==j||this._rootHeight!==b){this._rootWidth!==j&&this._wrapMode&& |
| this._resetLineHeight();this._rootWidth=j;this._rootHeight=b;j=f.isIE<9;b=this._calculateMetrics();if(!a(b,this._metrics)){if(this._variableLineHeight)this._variableLineHeight=!1,this._resetLineHeight();this._metrics=b;j=!0}j?this._queueUpdate():this._update()}},_handleRulerEvent:function(j){for(var a=j.target?j.target:j.srcElement,b=a.lineIndex;a&&!a._ruler;){if(b===void 0&&a.lineIndex!==void 0)b=a.lineIndex;a=a.parentNode}var e=a?a._ruler:null;if(b===void 0&&e&&e.getOverview()==="document"){var b= |
| this._getClientHeight(),c=this._model.getLineCount(),l=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),b=Math.floor((j.clientY-f.top-this._metrics.scrollWidth)*c/(b+l.top+l.bottom-2*this._metrics.scrollWidth));0<=b&&b<c||(b=void 0)}if(e)switch(j.type){case "click":if(e.onClick)e.onClick(b,j);break;case "dblclick":if(e.onDblClick)e.onDblClick(b,j);break;case "mousemove":if(e.onMouseMove)e.onMouseMove(b,j);break;case "mouseover":if(e.onMouseOver)e.onMouseOver(b,j);break;case "mouseout":if(e.onMouseOut){for(c= |
| j.relatedTarget;c&&c!==this._rootDiv;){if(c===a)return;c=c.parentNode}e.onMouseOut(b,j)}}},_handleScroll:function(){var j=this._getScroll(!1),a=this._hScroll,b=this._vScroll;if(a!==j.x||b!==j.y)this._hScroll=j.x,this._vScroll=j.y,this._commitIME(),this._update(b===j.y),this.onScroll({type:"Scroll",oldValue:{x:a,y:b},newValue:j})},_handleSelectStart:function(j){if(this._ignoreSelect)return j&&j.preventDefault&&j.preventDefault(),!1},_getModelOffset:function(j,a){if(j){var b;b=j.tagName==="DIV"?j:j.parentNode.parentNode; |
| var e=0,c=b.lineIndex;if(j.tagName!=="DIV")for(b=b.firstChild;b;){var l=b.firstChild;if(l===j){b.ignoreChars&&(e-=b.ignoreChars);e+=a;break}b.ignoreChars&&(e-=b.ignoreChars);e+=l.data.length;b=b.nextSibling}return Math.max(0,e)+this._model.getLineStart(c)}},_updateSelectionFromDOM:function(){var j=this._getWindow().getSelection(),a=this._getModelOffset(j.anchorNode,j.anchorOffset),j=this._getModelOffset(j.focusNode,j.focusOffset);a===void 0||j===void 0||this._setSelection(new q(a,j),!1,!1)},_handleSelectionChange:function(){if(this._imeOffset=== |
| -1)if(f.isAndroid){var j=this._getWindow();this._selTimer&&j.clearTimeout(this._selTimer);var a=this;this._selTimer=j.setTimeout(function(){if(a._clientDiv)a._selTimer=null,a._updateSelectionFromDOM()},250)}else this._updateSelectionFromDOM()},_handleTextInput:function(j){if(!this._ignoreEvent(j)){this._imeOffset=-1;var a=this._getWindow().getSelection();if(a.anchorNode!==this._anchorNode||a.focusNode!==this._focusNode||a.anchorOffset!==this._anchorOffset||a.focusOffset!==this._focusOffset){for(var b= |
| a.anchorNode;b;){if(b.lineIndex!==void 0)break;b=b.parentNode}if(b){var e=this._model,c=b.lineIndex,l=e.getLine(c),f=l,d=0,e=e.getLineStart(c);if(a.rangeCount>0)a.getRangeAt(0).deleteContents(),c=b.ownerDocument.createTextNode(j.data),a.getRangeAt(0).insertNode(c),d=this._getDOMText(b,c),f=d.text,d=d.offset,c.parentNode.removeChild(c);b.lineRemoved=!0;for(b=0;l.charCodeAt(b)===f.charCodeAt(b)&&b<d;)b++;a=l.length-1;for(c=f.length-l.length;l.charCodeAt(a)===f.charCodeAt(a+c)&&a+c>=d+j.data.length;)a--; |
| a++;l=f.substring(b,a+c);b+=e;a+=e;this._modifyContent({text:l,start:b,end:a,_ignoreDOMSelection:!0},!0)}}else this._doContent(j.data);j.preventDefault()}},_handleTouchStart:function(j){this._commitIME();var a=this._getWindow();if(this._touchScrollTimer)this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",a.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null;var b=j.touches;if(b.length===1){var b=b[0],e=b.clientX,c=b.clientY;this._touchStartX=e;this._touchStartY= |
| c;if(f.isAndroid&&(c<b.pageY-a.pageYOffset||e<b.pageX-a.pageXOffset))e=b.pageX-a.pageXOffset,c=b.pageY-a.pageYOffset;a=this.convert({x:e,y:c},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(a.x,a.y);this._touchStartTime=j.timeStamp;this._touching=!0}},_handleTouchMove:function(j){var a=j.touches;if(a.length===1){a=a[0];this._touchCurrentX=a.clientX;this._touchCurrentY=a.clientY;if(!this._touchScrollTimer&&j.timeStamp-this._touchStartTime<200){this._vScrollDiv.style.display="block"; |
| if(!this._wrapMode)this._hScrollDiv.style.display="block";var b=this,e=this._getWindow();this._touchScrollTimer=e.setInterval(function(){var j=0,a=0;if(b._touching)j=b._touchStartX-b._touchCurrentX,a=b._touchStartY-b._touchCurrentY,b._touchSpeedX=j/10,b._touchSpeedY=a/10,b._touchStartX=b._touchCurrentX,b._touchStartY=b._touchCurrentY;else if(Math.abs(b._touchSpeedX)<0.1&&Math.abs(b._touchSpeedY)<0.1){b._vScrollDiv.style.display="none";b._hScrollDiv.style.display="none";e.clearInterval(b._touchScrollTimer); |
| b._touchScrollTimer=null;return}else j=b._touchSpeedX*10,a=b._touchSpeedY*10,b._touchSpeedX*=0.95,b._touchSpeedY*=0.95;b._scrollView(j,a)},10)}this._touchScrollTimer&&j.preventDefault()}},_handleTouchEnd:function(j){if(j.touches.length===0)this._touching=!1},_doAction:function(j){var a,b,e=this._keyModes;for(b=e.length-1;b>=0;b--)if(a=e[b],typeof a.match==="function"&&(a=a.match(j),a!==void 0))return this.invokeAction(a);return!1},_doMove:function(j,a){var b=this._model,e=a.getCaret(),c=b.getLineAtOffset(e); |
| if(!j.count)j.count=1;for(;j.count!==0;){var l=b.getLineStart(c);if(j.count<0&&e===l)if(c>0)j.unit==="character"&&j.count++,c--,a.extend(b.getLineEnd(c));else break;else if(j.count>0&&e===b.getLineEnd(c))if(c+1<b.getLineCount())j.unit==="character"&&j.count--,c++,a.extend(b.getLineStart(c));else break;else{var f=!1;j.expandTab&&j.unit==="character"&&(e-l)%this._tabSize===0&&(f=!/[^ ]/.test(b.getText(l,e)));f?(a.extend(e-this._tabSize),j.count+=j.count<0?1:-1):(l=this._getLine(c),a.extend(l.getNextOffset(e, |
| j)),l.destroy())}e=a.getCaret()}return a},_doBackspace:function(j){var a=this._getSelection();if(a.isEmpty()){if(!j.count)j.count=1;j.count*=-1;j.expandTab=this._expandTab;this._doMove(j,a)}this._modifyContent({text:"",start:a.start,end:a.end},!0);return!0},_doCase:function(j){var a=this._getSelection();this._doMove(j,a);var b=this.getText(a.start,a.end);this._setSelection(a,!0);switch(j.type){case "lower":b=b.toLowerCase();break;case "capitalize":b=b.replace(/(?:^|\s)\S/g,function(j){return j.toUpperCase()}); |
| break;case "reverse":j="";for(a=0;a<b.length;a++){var e=b[a],c=e.toLowerCase(),e=c!==e?c:e.toUpperCase();j+=e}b=j;break;default:b=b.toUpperCase()}this._doContent(b);return!0},_doContent:function(j){var a=this._getSelection();if(this._overwriteMode&&a.isEmpty()){var b=this._model,e=b.getLineAtOffset(a.end);a.end<b.getLineEnd(e)&&(b=this._getLine(e),a.extend(b.getNextOffset(a.getCaret(),{unit:"character",count:1})),b.destroy())}this._modifyContent({text:j,start:a.start,end:a.end,_ignoreDOMSelection:!0}, |
| !0)},_doCopy:function(j){var a=this._getSelection();return!a.isEmpty()?this._setClipboardText(this._getBaseText(a.start,a.end),j):!0},_doCursorNext:function(j){var a=this._getSelection();!a.isEmpty()&&!j.select?a.start=a.end:this._doMove(j,a);j.select||a.collapse();this._setSelection(a,!0);return!0},_doCursorPrevious:function(j){var a=this._getSelection();if(!a.isEmpty()&&!j.select)a.end=a.start;else{if(!j.count)j.count=1;j.count*=-1;this._doMove(j,a)}j.select||a.collapse();this._setSelection(a,!0); |
| return!0},_doCut:function(j){var a=this._getSelection();return!a.isEmpty()?(a=this._getBaseText(a.start,a.end),this._doContent(""),this._setClipboardText(a,j)):!0},_doDelete:function(j){var a=this._getSelection();a.isEmpty()&&this._doMove(j,a);this._modifyContent({text:"",start:a.start,end:a.end},!0);return!0},_doEnd:function(j){var a=this._getSelection(),b=this._model,e;if(j.ctrl)a.extend(b.getCharCount()),e=function(){};else{var c=a.getCaret(),l=b.getLineAtOffset(c);if(this._wrapMode){var f=this._getLine(l), |
| c=f.getLineIndex(c),c=c===f.getLineCount()-1?b.getLineEnd(l):f.getLineStart(c+1)-1;f.destroy()}else j.count&&j.count>0&&(l=Math.min(l+j.count-1,b.getLineCount()-1)),c=b.getLineEnd(l);a.extend(c)}j.select||a.collapse();this._setSelection(a,!0,!0,e);return!0},_doEnter:function(j){var a=this._model,b=this._getSelection();this._doContent(a.getLineDelimiter());if(j&&j.noCursor)b.end=b.start,this._setSelection(b,!0);return!0},_doHome:function(j){var a=this._getSelection(),b=this._model,e;if(j.ctrl)a.extend(0), |
| e=function(){};else{var c=a.getCaret(),l=b.getLineAtOffset(c);this._wrapMode?(b=this._getLine(l),c=b.getLineIndex(c),c=b.getLineStart(c),b.destroy()):c=b.getLineStart(l);a.extend(c)}j.select||a.collapse();this._setSelection(a,!0,!0,e);return!0},_doLineDown:function(j){var a=this._model,b=this._getSelection(),e=b.getCaret(),c=a.getLineAtOffset(e),l=this._getLine(c),d=this._columnX,o=1,g=!1;if(d===-1||j.wholeLine||j.select&&f.isIE)d=j.wholeLine?a.getLineEnd(c+1):e,d=l.getBoundingClientRect(d).left; |
| (e=l.getLineIndex(e))<l.getLineCount()-1?o=l.getClientRects(e+1).top+1:(e=a.getLineCount()-1,g=c===e,j.count&&j.count>0?c=Math.min(c+j.count,e):c++);e=!1;if(g){if(j.select||f.isMac||f.isLinux)b.extend(a.getCharCount()),e=!0}else l.lineIndex!==c&&(l.destroy(),l=this._getLine(c)),b.extend(l.getOffset(d,o)),e=!0;e&&(j.select||b.collapse(),this._setSelection(b,!0,!0));this._columnX=d;l.destroy();return!0},_doLineUp:function(a){var b=this._model,e=this._getSelection(),c=e.getCaret(),l=b.getLineAtOffset(c), |
| d=this._getLine(l),o=this._columnX,g=!1,h;if(o===-1||a.wholeLine||a.select&&f.isIE)o=a.wholeLine?b.getLineStart(l-1):c,o=d.getBoundingClientRect(o).left;(c=d.getLineIndex(c))>0?h=d.getClientRects(c-1).top+1:(g=l===0,g||(a.count&&a.count>0?l=Math.max(l-a.count,0):l--,h=this._getLineHeight(l)-1));c=!1;if(g){if(a.select||f.isMac||f.isLinux)e.extend(0),c=!0}else d.lineIndex!==l&&(d.destroy(),d=this._getLine(l)),e.extend(d.getOffset(o,h)),c=!0;c&&(a.select||e.collapse(),this._setSelection(e,!0,!0));this._columnX= |
| o;d.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var b=this,e=this._model,c=this._getSelection(),l=c.getCaret(),d=e.getLineAtOffset(l),o=e.getLineCount(),g=this._getScroll(),e=this._getClientHeight(),h,p;if(this._lineHeight){h=this._columnX;g=this._getBoundsAtOffset(l);if(h===-1||a.select&&f.isIE)h=g.left;l=this._getLineIndex(g.top+e);p=this._getLine(l);d=this._getLinePixel(l);l=p.getOffset(h,g.top+e-d);e=p.getBoundingClientRect(l);p.destroy();c.extend(l);a.select||c.collapse(); |
| this._setSelection(c,!0,!0,function(){b._columnX=h},e.top+d-g.top);return!0}if(d<o-1){var i=this._getLineHeight(),q=Math.min(o-d-1,Math.floor(e/i)),q=Math.max(1,q);h=this._columnX;if(h===-1||a.select&&f.isIE)p=this._getLine(d),h=p.getBoundingClientRect(l).left,p.destroy();p=this._getLine(d+q);c.extend(p.getOffset(h,0));p.destroy();a.select||c.collapse();a=o*i;l=g.y+q*i;l+e>a&&(l=a-e);this._setSelection(c,!0,!0,function(){b._columnX=h},l-g.y)}return!0},_doPageUp:function(a){var b=this,e=this._model, |
| c=this._getSelection(),l=c.getCaret(),d=e.getLineAtOffset(l),o=this._getScroll(),g=this._getClientHeight(),h;if(this._lineHeight){h=this._columnX;o=this._getBoundsAtOffset(l);if(h===-1||a.select&&f.isIE)h=o.left;l=this._getLineIndex(o.bottom-g);e=this._getLine(l);d=this._getLinePixel(l);l=e.getOffset(h,o.bottom-g-d);g=e.getBoundingClientRect(l);e.destroy();c.extend(l);a.select||c.collapse();this._setSelection(c,!0,!0,function(){b._columnX=h},g.top+d-o.top);return!0}if(d>0){var p=this._getLineHeight(), |
| g=Math.max(1,Math.min(d,Math.floor(g/p)));h=this._columnX;if(h===-1||a.select&&f.isIE)e=this._getLine(d),h=e.getBoundingClientRect(l).left,e.destroy();e=this._getLine(d-g);c.extend(e.getOffset(h,this._getLineHeight(d-g)-1));e.destroy();a.select||c.collapse();a=Math.max(0,o.y-g*p);this._setSelection(c,!0,!0,function(){b._columnX=h},a-o.y)}return!0},_doPaste:function(a){var b=this;return this._getClipboardText(a,function(a){a&&(f.isLinux&&b._lastMouseButton===2&&(new Date).getTime()-b._lastMouseTime<= |
| b._clickTime&&b._setSelectionTo(b._lastMouseX,b._lastMouseY),b._doContent(a))})!==null},_doScroll:function(a){var b=a.type,e=this._model,c=e.getLineCount(),a=this._getClientHeight(),l=this._getLineHeight();c*=l;var f=this._getScroll().y,d;switch(b){case "textStart":d=0;break;case "textEnd":d=c-a;break;case "pageDown":d=f+a;break;case "pageUp":d=f-a;break;case "lineDown":d=f+l;break;case "lineUp":d=f-l;break;case "centerLine":b=this._getSelection(),d=e.getLineAtOffset(b.start),e=(e.getLineAtOffset(b.end)- |
| d+1)*l,d=d*l-a/2+e/2}d!==void 0&&(d=Math.min(Math.max(0,d),c-a),this._scrollViewAnimated(0,d-f,function(){}));return!0},_doSelectAll:function(){var a=this._model,b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(){if(this._tabMode&&!this._readonly){var a="\t";if(this._expandTab)var b=this._model,a=this._getSelection().getCaret(),e=b.getLineAtOffset(a),b=b.getLineStart(e),a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ");this._doContent(a); |
| return!0}},_doShiftTab:function(){return!this._tabMode||this._readonly?void 0:!0},_doOverwriteMode:function(){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),!0},_doTabMode:function(){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=this._model,b=this._getSelection(),e=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),c=b.getCaret(), |
| l=a.getLineCount(),d=a.getLineAtOffset(c),o;if(this._autoScrollDir==="up"||this._autoScrollDir==="down")c=this._autoScrollY/this._getLineHeight(),c=c<0?Math.floor(c):Math.ceil(c),o=Math.max(0,Math.min(l-1,d+c));else if(this._autoScrollDir==="left"||this._autoScrollDir==="right")o=this._getLineIndex(e.y),d=this._getLine(d),e.x+=d.getBoundingClientRect(c,!1).left,d.destroy();o===0&&(f.isMac||f.isLinux)?b.extend(0):o===l-1&&(f.isMac||f.isLinux)?b.extend(a.getCharCount()):(d=this._getLine(o),b.extend(d.getOffset(e.x, |
| e.y-this._getLinePixel(o))),d.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){for(var a=0,c=(new Date).getTime(),l=0;e<b;)if(this._lineHeight[e]||(a++,l||(l=e),this._lineHeight[e]=this._calculateLineHeight(e)),e++,(new Date).getTime()- |
| c>100)break;this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(e!==b){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},0)}else if(this._calculateLHTimer)a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0}},_calculateLineHeight:function(a){var a=this._getLine(a),b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,b=a.ownerDocument, |
| e=f.createElement(b,"div");e.style.lineHeight="normal";var c={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(c);g(c.style,e);e.style.position="fixed";e.style.left="-1000px";var d=f.createElement(b,"span");d.appendChild(b.createTextNode(" "));e.appendChild(d);var h=f.createElement(b,"span");h.style.fontStyle="italic";h.appendChild(b.createTextNode(" "));e.appendChild(h);var p=f.createElement(b,"span");p.style.fontWeight="bold";p.appendChild(b.createTextNode(" ")); |
| e.appendChild(p);c=f.createElement(b,"span");c.style.fontWeight="bold";c.style.fontStyle="italic";c.appendChild(b.createTextNode(" "));e.appendChild(c);a.appendChild(e);var i=e.getBoundingClientRect(),d=d.getBoundingClientRect(),h=h.getBoundingClientRect(),p=p.getBoundingClientRect(),c=c.getBoundingClientRect(),d=d.bottom-d.top,h=h.bottom-h.top,p=p.bottom-p.top,q=c.bottom-c.top,r=0,c=i.bottom-i.top<=0,i=Math.max(1,i.bottom-i.top);h>d&&(r=1);p>h&&(r=2);q>p&&(r=3);var s;if(r!==0){s={style:{}};if((r& |
| 1)!==0)s.style.fontStyle="italic";if((r&2)!==0)s.style.fontWeight="bold"}d=o(e);a.removeChild(e);q=l(this._viewDiv);e=f.createElement(b,"div");e.style.position="fixed";e.style.left="-1000px";e.style.paddingLeft=q.left+"px";e.style.paddingTop=q.top+"px";e.style.paddingRight=q.right+"px";e.style.paddingBottom=q.bottom+"px";e.style.width="100px";e.style.height="100px";q=f.createElement(b,"div");q.style.width="100%";q.style.height="100%";e.appendChild(q);a.appendChild(e);r=e.getBoundingClientRect();h= |
| q.getBoundingClientRect();p=0;if(!this._singleMode)e.style.overflow="hidden",q.style.height="200px",p=e.clientWidth,e.style.overflow="scroll",p-=e.clientWidth;a.removeChild(e);q={left:h.left-r.left,top:h.top-r.top,right:r.right-h.right,bottom:r.bottom-h.bottom};h=r=0;if(!c&&(this._wrapOffset||this._marginOffset))e=f.createElement(b,"div"),e.style.position="fixed",e.style.left="-1000px",e.innerHTML=Array(this._wrapOffset+1).join(" "),a.appendChild(e),r=e.getBoundingClientRect(),r=Math.ceil(r.right- |
| r.left),e.innerHTML=Array(this._marginOffset+1).join(" "),h=e.getBoundingClientRect(),h=Math.ceil(h.right-h.left),a.removeChild(e);return{lineHeight:i,largestFontStyle:s,lineTrim:d,viewPadding:q,scrollWidth:p,wrapWidth:r,marginWidth:h,invalid:c}},_cancelAnimation:function(){if(this._animation)this._animation.stop(),this._animation=null},_clearSelection:function(a){var b=this._getSelection();if(b.isEmpty())return!1;a==="next"?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(){if(this._imeOffset!== |
| -1){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,b=a.getLineAtOffset(this._imeOffset),e=a.getLineStart(b),c=this._getDOMText(this._getLineNode(b)).text,a=a.getLine(b),e=this._imeOffset-e,a=e+c.length-a.length;e!==a&&this._doContent(c.substring(e,a));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new n.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(e){return a._doLineUp(b(e,{select:!1}))}, |
| actionDescription:{name:k.lineUp}},lineDown:{defaultHandler:function(e){return a._doLineDown(b(e,{select:!1}))},actionDescription:{name:k.lineDown}},lineStart:{defaultHandler:function(e){return a._doHome(b(e,{select:!1,ctrl:!1}))},actionDescription:{name:k.lineStart}},lineEnd:{defaultHandler:function(e){return a._doEnd(b(e,{select:!1,ctrl:!1}))},actionDescription:{name:k.lineEnd}},charPrevious:{defaultHandler:function(e){return a._doCursorPrevious(b(e,{select:!1,unit:"character"}))},actionDescription:{name:k.charPrevious}}, |
| charNext:{defaultHandler:function(e){return a._doCursorNext(b(e,{select:!1,unit:"character"}))},actionDescription:{name:k.charNext}},pageUp:{defaultHandler:function(e){return a._doPageUp(b(e,{select:!1}))},actionDescription:{name:k.pageUp}},pageDown:{defaultHandler:function(e){return a._doPageDown(b(e,{select:!1}))},actionDescription:{name:k.pageDown}},scrollPageUp:{defaultHandler:function(e){return a._doScroll(b(e,{type:"pageUp"}))},actionDescription:{name:k.scrollPageUp}},scrollPageDown:{defaultHandler:function(e){return a._doScroll(b(e, |
| {type:"pageDown"}))},actionDescription:{name:k.scrollPageDown}},scrollLineUp:{defaultHandler:function(e){return a._doScroll(b(e,{type:"lineUp"}))},actionDescription:{name:k.scrollLineUp}},scrollLineDown:{defaultHandler:function(e){return a._doScroll(b(e,{type:"lineDown"}))},actionDescription:{name:k.scrollLineDown}},wordPrevious:{defaultHandler:function(e){return a._doCursorPrevious(b(e,{select:!1,unit:"word"}))},actionDescription:{name:k.wordPrevious}},wordNext:{defaultHandler:function(e){return a._doCursorNext(b(e, |
| {select:!1,unit:"word"}))},actionDescription:{name:k.wordNext}},textStart:{defaultHandler:function(e){return a._doHome(b(e,{select:!1,ctrl:!0}))},actionDescription:{name:k.textStart}},textEnd:{defaultHandler:function(e){return a._doEnd(b(e,{select:!1,ctrl:!0}))},actionDescription:{name:k.textEnd}},scrollTextStart:{defaultHandler:function(e){return a._doScroll(b(e,{type:"textStart"}))},actionDescription:{name:k.scrollTextStart}},scrollTextEnd:{defaultHandler:function(e){return a._doScroll(b(e,{type:"textEnd"}))}, |
| actionDescription:{name:k.scrollTextEnd}},centerLine:{defaultHandler:function(e){return a._doScroll(b(e,{type:"centerLine"}))},actionDescription:{name:k.centerLine}},selectLineUp:{defaultHandler:function(e){return a._doLineUp(b(e,{select:!0}))},actionDescription:{name:k.selectLineUp}},selectLineDown:{defaultHandler:function(e){return a._doLineDown(b(e,{select:!0}))},actionDescription:{name:k.selectLineDown}},selectWholeLineUp:{defaultHandler:function(e){return a._doLineUp(b(e,{select:!0,wholeLine:!0}))}, |
| actionDescription:{name:k.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(e){return a._doLineDown(b(e,{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineDown}},selectLineStart:{defaultHandler:function(e){return a._doHome(b(e,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineStart}},selectLineEnd:{defaultHandler:function(e){return a._doEnd(b(e,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineEnd}},selectCharPrevious:{defaultHandler:function(e){return a._doCursorPrevious(b(e, |
| {select:!0,unit:"character"}))},actionDescription:{name:k.selectCharPrevious}},selectCharNext:{defaultHandler:function(e){return a._doCursorNext(b(e,{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharNext}},selectPageUp:{defaultHandler:function(e){return a._doPageUp(b(e,{select:!0}))},actionDescription:{name:k.selectPageUp}},selectPageDown:{defaultHandler:function(e){return a._doPageDown(b(e,{select:!0}))},actionDescription:{name:k.selectPageDown}},selectWordPrevious:{defaultHandler:function(e){return a._doCursorPrevious(b(e, |
| {select:!0,unit:"word"}))},actionDescription:{name:k.selectWordPrevious}},selectWordNext:{defaultHandler:function(e){return a._doCursorNext(b(e,{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordNext}},selectTextStart:{defaultHandler:function(e){return a._doHome(b(e,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextStart}},selectTextEnd:{defaultHandler:function(e){return a._doEnd(b(e,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextEnd}},deletePrevious:{defaultHandler:function(e){return a._doBackspace(b(e, |
| {unit:"character"}))},actionDescription:{name:k.deletePrevious}},deleteNext:{defaultHandler:function(e){return a._doDelete(b(e,{unit:"character"}))},actionDescription:{name:k.deleteNext}},deleteWordPrevious:{defaultHandler:function(e){return a._doBackspace(b(e,{unit:"word"}))},actionDescription:{name:k.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(e){return a._doDelete(b(e,{unit:"word"}))},actionDescription:{name:k.deleteWordNext}},deleteLineStart:{defaultHandler:function(e){return a._doBackspace(b(e, |
| {unit:"line"}))},actionDescription:{name:k.deleteLineStart}},deleteLineEnd:{defaultHandler:function(e){return a._doDelete(b(e,{unit:"line"}))},actionDescription:{name:k.deleteLineEnd}},tab:{defaultHandler:function(){return a._doTab()},actionDescription:{name:k.tab}},shiftTab:{defaultHandler:function(){return a._doShiftTab()},actionDescription:{name:k.shiftTab}},enter:{defaultHandler:function(){return a._doEnter()},actionDescription:{name:k.enter}},enterNoCursor:{defaultHandler:function(e){return a._doEnter(b(e, |
| {noCursor:!0}))},actionDescription:{name:k.enterNoCursor}},selectAll:{defaultHandler:function(){return a._doSelectAll()},actionDescription:{name:k.selectAll}},copy:{defaultHandler:function(){return a._doCopy()},actionDescription:{name:k.copy}},cut:{defaultHandler:function(){return a._doCut()},actionDescription:{name:k.cut}},paste:{defaultHandler:function(){return a._doPaste()},actionDescription:{name:k.paste}},uppercase:{defaultHandler:function(e){return a._doCase(b(e,{type:"upper"}))},actionDescription:{name:k.uppercase}}, |
| lowercase:{defaultHandler:function(e){return a._doCase(b(e,{type:"lower"}))},actionDescription:{name:k.lowercase}},capitalize:{defaultHandler:function(e){return a._doCase(b(e,{unit:"word",type:"capitalize"}))},actionDescription:{name:k.capitalize}},reversecase:{defaultHandler:function(e){return a._doCase(b(e,{type:"reverse"}))},actionDescription:{name:k.reversecase}},toggleOverwriteMode:{defaultHandler:function(){return a._doOverwriteMode()},actionDescription:{name:k.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(){return a._doTabMode()}, |
| actionDescription:{name:k.toggleTabMode}},toggleWrapMode:{defaultHandler:function(){return a._doWrapMode()},actionDescription:{name:k.toggleWrapMode}}}},_createRulerParent:function(a){var b=f.createElement(document,"div");b.className=a;b.tabIndex=-1;b.style.overflow="hidden";b.style.MozUserSelect="none";b.style.WebkitUserSelect="none";b.style.position="absolute";b.style.top="0px";b.style.bottom="0px";b.style.cursor="default";b.style.display="none";b.setAttribute("aria-hidden","true");this._rootDiv.appendChild(b); |
| return b},_createRuler:function(a,b){if(this._clientDiv){var e=this._getRulerParent(a);if(e){if(e!==this._marginDiv||this._marginOffset)e.style.display="block";var c=f.createElement(e.ownerDocument,"div");c._ruler=a;c.rulerChanged=!0;c.style.position="relative";c.style.cssFloat="left";c.style.styleFloat="left";c.style.outline="none";if(b===void 0||b<0||b>=e.children.length)e.appendChild(c);else{for(var l=e.firstChild;l&&b-- >0;)l=l.nextSibling;e.insertBefore(c,l)}}}},_createView:function(){if(!this._clientDiv){for(var a= |
| this._parent;a.hasChildNodes();)a.removeChild(a.lastChild);var b=a.ownerDocument,e=f.createElement(b,"div");this._rootDiv=e;e.tabIndex=-1;e.style.position="relative";e.style.overflow="hidden";e.style.width="100%";e.style.height="100%";e.style.overflow="hidden";e.style.WebkitTextSizeAdjust="100%";e.setAttribute("role","application");a.appendChild(e);this._leftDiv=this._createRulerParent("textviewLeftRuler");a=f.createElement(b,"div");a.className="textviewScroll";this._viewDiv=a;a.tabIndex=-1;a.style.position= |
| "absolute";a.style.top="0px";a.style.bottom="0px";a.style.borderWidth="0px";a.style.margin="0px";a.style.outline="none";a.style.background="transparent";if(f.isMac&&f.isWebkit)a.style.pointerEvents="none",a.style.zIndex="2";e.appendChild(a);var c=this._createRulerParent("textviewRightRuler");this._rightDiv=c;c.style.right="0px";this._scrollDiv=c=f.createElement(b,"div");c.style.margin="0px";c.style.borderWidth="0px";c.style.padding="0px";a.appendChild(c);(this._marginDiv=this._createRulerParent("textviewMarginRuler")).style.zIndex= |
| "4";if(!f.isIE&&!f.isIOS)this._clipDiv=a=f.createElement(b,"div"),a.style.position="absolute",a.style.overflow="hidden",a.style.margin="0px",a.style.borderWidth="0px",a.style.padding="0px",a.style.background="transparent",e.appendChild(a),this._clipScrollDiv=c=f.createElement(b,"div"),c.style.position="absolute",c.style.height="1px",c.style.top="-1000px",c.style.background="transparent",a.appendChild(c);this._setFullSelection(this._fullSelection,!0);a=f.createElement(b,"div");a.className="textviewContent"; |
| this._clientDiv=a;a.tabIndex=0;a.style.position="absolute";a.style.borderWidth="0px";a.style.margin="0px";a.style.padding="0px";a.style.outline="none";a.style.zIndex="1";a.style.WebkitUserSelect="text";a.setAttribute("spellcheck","false");if(f.isIOS||f.isAndroid)a.style.WebkitTapHighlightColor="transparent";(this._clipDiv||e).appendChild(a);if(f.isIOS||f.isAndroid)this._vScrollDiv=c=f.createElement(b,"div"),c.style.position="absolute",c.style.borderWidth="1px",c.style.borderColor="white",c.style.borderStyle= |
| "solid",c.style.borderRadius="4px",c.style.backgroundColor="black",c.style.opacity="0.5",c.style.margin="0px",c.style.padding="0px",c.style.outline="none",c.style.zIndex="3",c.style.width="8px",c.style.display="none",e.appendChild(c),this._hScrollDiv=c=f.createElement(b,"div"),c.style.position="absolute",c.style.borderWidth="1px",c.style.borderColor="white",c.style.borderStyle="solid",c.style.borderRadius="4px",c.style.backgroundColor="black",c.style.opacity="0.5",c.style.margin="0px",c.style.padding= |
| "0px",c.style.outline="none",c.style.zIndex="3",c.style.height="8px",c.style.display="none",e.appendChild(c);if(f.isFirefox&&!a.setCapture)this._overlayDiv=b=f.createElement(b,"div"),b.style.position=a.style.position,b.style.borderWidth=a.style.borderWidth,b.style.margin=a.style.margin,b.style.padding=a.style.padding,b.style.cursor="text",b.style.zIndex="2",(this._clipDiv||e).appendChild(b);a.contentEditable="true";a.setAttribute("role","textbox");a.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode, |
| !0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,!0);this._hookEvents();e=this._rulers;for(b=0;b<e.length;b++)this._createRuler(e[b]);this._update()}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},scrollAnimation:{value:0,update:null},readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,update:this._setFullSelection}, |
| tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},singleMode:{value:!1,update:this._setSingleMode},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},marginOffset:{value:0,update:this._setMarginOffset},wrapOffset:{value:0,update:this._setWrapOffset},wrapMode:{value:!1,update:this._setWrapMode},wrappable:{value:!1,update:null},theme:{value:c.TextTheme.getTheme(),update:this._setTheme}, |
| themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var e=b.firstChild;e;){if(e._ruler===a){e._ruler=void 0;b.removeChild(e);if(b.children.length===0&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}e=e.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();if(this._autoScrollTimerID)a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID= |
| null;if(this._updateTimer)a.clearTimeout(this._updateTimer),this._updateTimer=null;a=this._rootDiv;a.parentNode.removeChild(a);this._hScrollDiv=this._vScrollDiv=this._cursorDiv=this._marginDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,b,e){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=e;this._autoScrollTimerID|| |
| this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var b=this._hasFocus;this._ignoreFocus=!0;b&&a.blur();a.contentEditable=!1;a.contentEditable=!0;b&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,b){var e=this._model;e.getBaseModel&&(a=e.mapOffset(a),b=e.mapOffset(b),e=e.getBaseModel());return e.getText(a,b)}, |
| _getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=b.getBoundingClientRect(),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),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)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,b){var c=this._model.getLineDelimiter(),l,d,o=this._getWindow(),g=o.clipboardData;if(!g&&a)g=a.clipboardData;if(g)return l=[],d=g.getData(f.isIE?"Text":"text/plain"),e(d,function(a){l.push(a)},function(){l.push(c)}),d=l.join(""),b&&b(d),d;if(f.isFirefox){this._ignoreFocus=!0;var h=this._clipboardDiv,g=this._rootDiv.ownerDocument; |
| if(!h)this._clipboardDiv=h=f.createElement(g,"div"),h.style.position="fixed",h.style.whiteSpace="pre",h.style.left="-1000px",this._rootDiv.appendChild(h);h.innerHTML="<pre contenteditable=''></pre>";h.firstChild.focus();var p=this,i=function(){var a=p._getTextFromElement(h);h.innerHTML="";l=[];e(a,function(a){l.push(a)},function(){l.push(c)});return l.join("")},q=!1;this._ignorePaste=!0;if(!f.isLinux||this._lastMouseButton!==2)try{q=g.execCommand("paste",!1,null)}catch(r){q=h.childNodes.length>1|| |
| h.firstChild&&h.firstChild.childNodes.length>0}this._ignorePaste=!1;if(!q)return a?(o.setTimeout(function(){p.focus();(d=i())&&b&&b(d);p._ignoreFocus=!1},0),null):(this.focus(),this._ignoreFocus=!1,"");this.focus();this._ignoreFocus=!1;(d=i())&&b&&b(d);return d}return""},_getDOMText:function(a,b){for(var e=a.firstChild,c="",l=0;e;){var f;if(!e.ignore)if(e.ignoreChars){f=e.lastChild;for(var d=0,o=[],g=-1;f;){var h=f.data;if(h)for(var p=h.length-1;p>=0;p--){var i=h.substring(p,p+1);d<e.ignoreChars&& |
| (i===" "||i==="\u200b"||i==="\ufeff")?d++:o.push(i==="\u00a0"?"\t":i)}if(b===f)g=o.length;f=f.previousSibling}o=o.reverse().join("");g!==-1&&(l=c.length+o.length-g);c+=o}else for(f=e.firstChild;f;){if(b===f)l=c.length;c+=f.data;f=f.nextSibling}e=e.nextSibling}return{text:c,offset:l}},_getTextFromElement:function(a){var b=a.ownerDocument,e=b.defaultView;if(!e.getSelection)return a.innerText||a.textContent;b=b.createRange();b.selectNode(a);var a=e.getSelection(),e=[],c;for(c=0;c<a.rangeCount;c++)e.push(a.getRangeAt(c)); |
| this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);b=a.toString();a.removeAllRanges();for(c=0;c<e.length;c++)a.addRange(e[c]);this._ignoreSelect=!1;return b},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var b=this._getLineNode(a);return b&&!b.lineChanged&&!b.lineRemoved?b._line:new p(this,a)},_getLineHeight:function(a,b){if(a!==void 0&&this._lineHeight){var e=this._lineHeight[a];if(e)return e;if(b||b===void 0)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight}, |
| _getLineNode:function(a){for(var b=this._clientDiv.firstChild;b;){if(a===b.lineIndex)return b;b=b.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&a.lineIndex===-1;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:this._clientDiv.lastChild;a&&a.lineIndex===-1;)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var b=this._getTopIndex(),e=-this._topIndexY+ |
| this._getScroll().y;if(a>b)for(;b<a;b++)e+=this._getLineHeight(b);else for(b-=1;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(),l=-this._topIndexY+this._getScroll().y;if(a!==l)if(a<l)for(;a<l&&e>0;)a+=this._getLineHeight(--e);else for(b=this._getLineHeight(e);a-b>=l&&e<c-1;)a-=b,b=this._getLineHeight(++e)}else b=this._getLineHeight(),e=Math.floor(a/b);return Math.max(0, |
| Math.min(c-1,e))},_getRulerParent:function(a){switch(a.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(a){(a===void 0||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var b=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){var a=b.getBoundingClientRect(),e=this._getViewPadding(), |
| c=this._viewDiv.getBoundingClientRect();a.top<c.top+e.top&&(b=this._getLineNext(b)||b)}return b.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(b){a._onModelChanging(b)},onChanged:function(b){a._onModelChanged(b)}};this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._themeListener={onChanged:function(){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged", |
| this._themeListener.onChanged);var b=this._handlers=[],e=this._clientDiv,c=this._viewDiv,l=this._rootDiv,d=this._overlayDiv||e,o=e.ownerDocument,g=this._getWindow(),h=f.isIE?o:g;b.push({target:g,type:"resize",handler:function(b){return a._handleResize(b?b:g.event)}});b.push({target:e,type:"blur",handler:function(b){return a._handleBlur(b?b:g.event)}});b.push({target:e,type:"focus",handler:function(b){return a._handleFocus(b?b:g.event)}});b.push({target:c,type:"focus",handler:function(){e.focus()}}); |
| b.push({target:c,type:"scroll",handler:function(b){return a._handleScroll(b?b:g.event)}});b.push({target:e,type:"textInput",handler:function(b){return a._handleTextInput(b?b:g.event)}});b.push({target:e,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:g.event)}});b.push({target:e,type:"keypress",handler:function(b){return a._handleKeyPress(b?b:g.event)}});b.push({target:e,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:g.event)}});f.isIE&&b.push({target:o,type:"keyup",handler:function(b){return a._handleDocKeyUp(b? |
| b:g.event)}});b.push({target:e,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:g.event)}});b.push({target:e,type:"copy",handler:function(b){return a._handleCopy(b?b:g.event)}});b.push({target:e,type:"cut",handler:function(b){return a._handleCut(b?b:g.event)}});b.push({target:e,type:"paste",handler:function(b){return a._handlePaste(b?b:g.event)}});if(f.isIOS||f.isAndroid)b.push({target:o,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:g.event)}}), |
| b.push({target:e,type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:g.event)}}),b.push({target:e,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:g.event)}}),b.push({target:e,type:"touchend",handler:function(b){return a._handleTouchEnd(b?b:g.event)}});else{b.push({target:e,type:"selectstart",handler:function(b){return a._handleSelectStart(b?b:g.event)}});b.push({target:e,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:g.event)}});b.push({target:e, |
| type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:g.event)}});b.push({target:e,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:g.event)}});b.push({target:h,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:g.event)}});b.push({target:h,type:"mousemove",handler:function(b){return a._handleMouseMove(b?b:g.event)}});b.push({target:l,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:g.event)}});b.push({target:l,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b? |
| b:g.event)}});b.push({target:d,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:g.event)}});b.push({target:d,type:"drag",handler:function(b){return a._handleDrag(b?b:g.event)}});b.push({target:d,type:"dragend",handler:function(b){return a._handleDragEnd(b?b:g.event)}});b.push({target:d,type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:g.event)}});b.push({target:d,type:"dragover",handler:function(b){return a._handleDragOver(b?b:g.event)}});b.push({target:d,type:"dragleave", |
| handler:function(b){return a._handleDragLeave(b?b:g.event)}});b.push({target:d,type:"drop",handler:function(b){return a._handleDrop(b?b:g.event)}});b.push({target:this._clientDiv,type:f.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:g.event)}});this._clipDiv&&b.push({target:this._clipDiv,type:f.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:g.event)}});if(f.isFirefox&&(!f.isWindows||f.isFirefox>=15))(c=g.MutationObserver|| |
| g.MozMutationObserver)?(this._mutationObserver=new c(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(e,{subtree:!0,characterData:!0})):b.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?b:g.event)}});this._overlayDiv&&(b.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:g.event)}}),b.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b? |
| b:g.event)}}),b.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:g.event)}}),b.push({target:this._overlayDiv,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:g.event)}}));this._isW3CEvents||b.push({target:this._clientDiv,type:"dblclick",handler:function(b){return a._handleDblclick(b?b:g.event)}})}this._hookRulerEvents(this._leftDiv,b);this._hookRulerEvents(this._rightDiv,b);this._hookRulerEvents(this._marginDiv,b);for(c=0;c<b.length;c++)l= |
| b[c],v(l.target,l.type,l.handler,l.capture)},_hookRulerEvents:function(a,b){if(a){var e=this,c=this._getWindow();f.isIE&&b.push({target:a,type:"selectstart",handler:function(){return!1}});b.push({target:a,type:f.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return e._handleMouseWheel(a?a:c.event)}});b.push({target:a,type:"click",handler:function(a){e._handleRulerEvent(a?a:c.event)}});b.push({target:a,type:"dblclick",handler:function(a){e._handleRulerEvent(a?a:c.event)}});b.push({target:a, |
| type:"mousemove",handler:function(a){e._handleRulerEvent(a?a:c.event)}});b.push({target:a,type:"mouseover",handler:function(a){e._handleRulerEvent(a?a:c.event)}});b.push({target:a,type:"mouseout",handler:function(a){e._handleRulerEvent(a?a:c.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var b=a.parent; |
| typeof b==="string"&&(b=(a.document||document).getElementById(b));if(!b)throw"no parent";a.parent=b;a.model=a.model||new m.TextModel;var e=this._defaultOptions(),c;for(c in e)e.hasOwnProperty(c)&&(this["_"+c]=a[c]!==void 0?a[c]:e[c].value);this._keyModes=[];this._rulers=[];this._selection=new q(0,0,!1);this._linksVisible=!1;this._maxLineWidth=this._redrawCount=0;this._maxLineIndex=-1;this._ignoreSelect=!0;this._hasFocus=this._ignoreFocus=!1;this._dragOffset=this._columnX=-1;this._isRangeRects=(!f.isIE|| |
| f.isIE>=9)&&typeof b.ownerDocument.createRange().getBoundingClientRect==="function";this._isW3CEvents=b.addEventListener;this._autoScrollTimerID=this._autoScrollY=this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions(); |
| this._createView()},_modifyContent:function(a,b){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(a.text===null||a.text===void 0)){var e=this._model;try{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!0;e.setText(a.text,a.start,a.end)}finally{if(a._ignoreDOMSelection)this._ignoreDOMSelection=!1}b&&(e=this._getSelection(),e.setCaret(a.start+a.text.length),this._setSelection(e,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a); |
| a.type="Changed";var b=a.start,e=a.addedCharCount,c=a.removedCharCount,l=a.addedLineCount,f=a.removedLineCount,d=this._getSelection();d.end>b&&(d.end>b&&d.start<b+c?d.setCaret(b+e):(d.start+=e-c,d.end+=e-c),this._setSelection(d,!1,!1));b=this._model.getLineAtOffset(b);for(e=this._getLineNext();e;){c=e.lineIndex;if(b<=c&&c<=b+f)b===c&&!e.modelChangedEvent&&!e.lineRemoved?(e.modelChangedEvent=a,e.lineChanged=!0):(e.lineRemoved=!0,e.lineChanged=!1,e.modelChangedEvent=null);if(c>b+f)e.lineIndex=c+l-f, |
| e._line.lineIndex=e.lineIndex;e=this._getLineNext(e)}this._lineHeight&&(a=[b,f].concat(Array(l)),Array.prototype.splice.apply(this._lineHeight,a));if(!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<=b+f)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(a!==void 0&&b!==void 0)for(var e=a;e<b;e++)this._lineHeight[e]=void 0;else this._lineHeight=Array(this._model.getLineCount());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 q(0,0,!1),!1,!1);if(this._viewDiv)this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0;var a=this._clientDiv;if(a){for(var b=a.firstChild;b;)b.lineRemoved=!0,b=b.nextSibling;if(f.isFirefox)this._ignoreFocus=!1,(b=this._hasFocus)&&a.blur(),a.contentEditable=!1,a.contentEditable=!0,b&&a.focus(),this._ignoreFocus=!1}},_scrollViewAnimated:function(a,b,e){var c= |
| this._getWindow();if(e&&this._scrollAnimation){var l=this;this._animation=new u({window:c,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);l._scrollView(0,a);b-=a},onEnd:function(){l._animation=null;l._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,b){var c, |
| l=this._getWindow(),d=l.clipboardData;if(!d&&b)d=b.clipboardData;if(d&&(c=[],e(a,function(a){c.push(a)},function(){c.push(f.platformDelimiter)}),d.setData(f.isIE?"Text":"text/plain",c.join(""))))return!0;var o=this._parent.ownerDocument,g=f.createElement(o,"pre");g.style.position="fixed";g.style.left="-1000px";e(a,function(a){g.appendChild(o.createTextNode(a))},function(){g.appendChild(f.createElement(o,"br"))});g.appendChild(o.createTextNode(" "));this._clientDiv.appendChild(g);d=o.createRange(); |
| d.setStart(g.firstChild,0);d.setEndBefore(g.lastChild);var h=l.getSelection();h.rangeCount>0&&h.removeAllRanges();h.addRange(d);var p=this,d=function(){g&&g.parentNode===p._clientDiv&&p._clientDiv.removeChild(g);p._updateDOMSelection()},h=!1;this._ignoreCopy=!0;try{h=o.execCommand("copy",!1,null)}catch(i){}this._ignoreCopy=!1;if(!h&&b)return l.setTimeout(d,0),!1;d();return!0},_setDOMSelection:function(a,b,e,c,l){for(var d,o,g,h,p=0,i=a.firstChild,q,r,s=this._model.getLine(a.lineIndex).length;i;){if(!i.ignore){q= |
| i.firstChild;r=q.length;i.ignoreChars&&(r-=i.ignoreChars);if(p+r>b||p+r>=s){d=q;o=b-p;i.ignoreChars&&r>0&&o===r&&(o+=i.ignoreChars);break}p+=r}i=i.nextSibling}for(var p=0,i=e.firstChild,t=this._model.getLine(e.lineIndex).length;i;){if(!i.ignore){q=i.firstChild;r=q.length;i.ignoreChars&&(r-=i.ignoreChars);if(r+p>c||p+r>=t){g=q;h=c-p;i.ignoreChars&&r>0&&h===r&&(h+=i.ignoreChars);break}p+=r}i=i.nextSibling}this._setDOMFullSelection(a,b,s,e,c,t);a=this._getWindow();b=this._parent.ownerDocument;if(a.getSelection){e= |
| a.getSelection();a=b.createRange();a.setStart(d,o);a.setEnd(g,h);if(this._hasFocus&&(e.anchorNode!==d||e.anchorOffset!==o||e.focusNode!==g||e.focusOffset!==h||e.anchorNode!==g||e.anchorOffset!==h||e.focusNode!==d||e.focusOffset!==o))this._anchorNode=d,this._anchorOffset=o,this._focusNode=g,this._focusOffset=h,this._ignoreSelect=!1,e.rangeCount>0&&e.removeAllRanges(),e.addRange(a),this._ignoreSelect=!0;if(this._cursorDiv&&(a=b.createRange(),l?(a.setStart(d,o),a.setEnd(d,o)):(a.setStart(g,h),a.setEnd(g, |
| h)),g=a.getClientRects()[0],h=this._cursorDiv.parentNode,d=h.getBoundingClientRect(),g&&d))this._cursorDiv.style.top=g.top-d.top+h.scrollTop+"px",this._cursorDiv.style.left=g.left-d.left+h.scrollLeft+"px"}else if(b.selection&&this._hasFocus)l=b.body,a=f.createElement(b,"div"),l.appendChild(a),l.removeChild(a),a=l.createTextRange(),a.moveToElementText(d.parentNode),a.moveStart("character",o),d=l.createTextRange(),d.moveToElementText(g.parentNode),d.moveStart("character",h),a.setEndPoint("EndToStart", |
| d),this._ignoreSelect=!1,a.select(),this._ignoreSelect=!0},_setDOMFullSelection:function(a,b,e,c,l){if(this._selDiv1&&(e=this._selDiv1,e.style.width="0px",e.style.height="0px",e=this._selDiv2,e.style.width="0px",e.style.height="0px",e=this._selDiv3,e.style.width="0px",e.style.height="0px",!(a===c&&b===l))){var f=this._model,d=this._getViewPadding(),o=this._clientDiv.getBoundingClientRect(),g=this._viewDiv.getBoundingClientRect(),e=g.left+d.left,h=o.right,d=g.top+d.top,i=o.bottom,g=o=0;this._clipDiv? |
| (g=this._clipDiv.getBoundingClientRect(),o=g.left-this._clipDiv.scrollLeft):(g=this._rootDiv.getBoundingClientRect(),o=g.left);g=g.top;this._ignoreDOMSelection=!0;var q=(new p(this,a.lineIndex,a)).getBoundingClientRect(f.getLineStart(a.lineIndex)+b,!1),r=q.left,b=(new p(this,c.lineIndex,c)).getBoundingClientRect(f.getLineStart(c.lineIndex)+l,!1),f=b.left;this._ignoreDOMSelection=!1;var s=this._selDiv1,r=Math.min(h,Math.max(e,r)),t=Math.min(i,Math.max(d,q.top)),u=h,l=Math.min(i,Math.max(d,q.bottom)); |
| s.style.left=r-o+"px";s.style.top=t-g+"px";s.style.width=Math.max(0,u-r)+"px";s.style.height=Math.max(0,l-t)+"px";if(a.lineIndex===c.lineIndex)u=Math.min(f,h),s.style.width=Math.max(0,u-r)+"px";else if(q=Math.min(i,Math.max(d,b.top)),f=Math.min(h,Math.max(e,f)),d=Math.min(i,Math.max(d,b.bottom)),i=this._selDiv3,i.style.left=e-o+"px",i.style.top=q-g+"px",i.style.width=Math.max(0,f-e)+"px",i.style.height=Math.max(0,d-q)+"px",Math.abs(a.lineIndex-c.lineIndex)>1)a=this._selDiv2,a.style.left=e-o+"px", |
| a.style.top=l-g+"px",a.style.width=Math.max(0,h-e)+"px",a.style.height=Math.max(0,q-l)+"px"}},_setGrab:function(a){if(a!==this._grabControl)a?(a.setCapture&&a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null)},_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;if(f.isIE&&a)this._hadFocus=this._hasFocus;var b=this._clientDiv;b.contentEditable=!a;this._hadFocus&&!a&&b.focus();if(this._overlayDiv)this._overlayDiv.style.zIndex= |
| a?"-1":"1";for(a=this._getLineNext();a;){if(a.hasLink)for(b=a.firstChild;b;)if(b.ignore)b=b.nextSibling;else{var e=b.nextSibling,c=b.viewStyle;c&&c.tagName&&c.tagName.toLowerCase()==="a"&&a.replaceChild(a._line._createSpan(a,b.firstChild.data,c),b);b=e}a=this._getLineNext(a)}this._updateDOMSelection()}},_setSelection:function(a,b,e,c,l){if(a){this._columnX=-1;e===void 0&&(e=!0);var f=this._selection;this._selection=a;b!==!1&&this._showCaret(!1,c,b,l);e&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection", |
| oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,b,e,c){var l=this._model,f=this._getSelection(),b=this.convert({x:a,y:b},"page","document"),a=this._getLineIndex(b.y);if(this._clickCount===1){l=this._getLine(a);a=l.getOffset(b.x,b.y-this._getLinePixel(a));l.destroy();if(c&&!e&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);e||f.collapse()}else(this._clickCount&1)===0?(l=this._getLine(a),a=l.getOffset(b.x,b.y-this._getLinePixel(a)), |
| this._doubleClickSelection?a>=this._doubleClickSelection.start?(e=this._doubleClickSelection.start,c=l.getNextOffset(a,{unit:"wordend",count:1})):(e=l.getNextOffset(a,{unit:"word",count:-1}),c=this._doubleClickSelection.end):(e=l.getNextOffset(a,{unit:"word",count:-1}),c=l.getNextOffset(e,{unit:"wordend",count:1})),l.destroy()):this._doubleClickSelection?(c=l.getLineAtOffset(this._doubleClickSelection.start),a>=c?(e=l.getLineStart(c),c=l.getLineEnd(a)):(e=l.getLineStart(a),c=l.getLineEnd(c))):(e= |
| l.getLineStart(a),c=l.getLineEnd(a)),f.setCaret(e),f.extend(c);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(a,b){this._fullSelection=a;if(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 l=f.createElement(c,"div");this._selDiv1=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);var d=f.createElement(c,"div");this._selDiv2=d;d.style.position="absolute";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.background=this._highlightRGB;d.style.width="0px";d.style.height="0px";d.style.zIndex="0";e.appendChild(d);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;l.style.background=e;d.style.background=e;c.style.background=e}b||this._updateDOMSelection()}}else{if(this._selDiv1)e.removeChild(this._selDiv1),this._selDiv1=null;if(this._selDiv2)e.removeChild(this._selDiv2),this._selDiv2=null;if(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=f.createElement(document,"div");a.className="textviewBlockCursor";this._cursorDiv=a;a.tabIndex=-1;a.style.zIndex="2";a.style.color="transparent";a.style.position="absolute";a.style.pointerEvents= |
| "none";a.innerHTML=" ";this._viewDiv.appendChild(a);this._updateDOMSelection()}}else if(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";if(!b)this._metrics=this._calculateMetrics(),this._queueUpdate()},_setWrapOffset:function(a,b){this._wrapOffset=a;if(!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)},_setTabSize:function(a,b){this._tabSize=a;this._customTabSize=void 0;var e=this._clientDiv;if(f.isOpera){if(e)e.style.OTabSize=this._tabSize+""}else if(f.isWebkit>=537.1){if(e)e.style.tabSize=this._tabSize+""}else if(f.isFirefox>=4){if(e)e.style.MozTabSize=this._tabSize+""}else if(this._tabSize!==8)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){var l=this._model,f=this._getSelection(),d=this._getScroll(),o=f.getCaret(),g=f.start,h=f.end,p=l.getLineAtOffset(h),i=Math.max(Math.max(g,l.getLineStart(p)),h-1),l=this._getClientWidth(), |
| p=this._getClientHeight(),q=l/4,r=this._getBoundsAtOffset(o===g?g:i),s=r.left,t=r.right,u=r.top,v=r.bottom;a&&!f.isEmpty()&&(r=this._getBoundsAtOffset(o===h?g:i),r.top===u?o===g?t=s+Math.min(r.right-s,l):s=t-Math.min(t-r.left,l):o===g?v=u+Math.min(r.bottom-u,p):u=v-Math.min(v-r.top,p));a=0;s<d.x&&(a=Math.min(s-d.x,-q));t>d.x+l&&(a=Math.max(t-d.x-l,q));f=0;u<d.y?f=u-d.y:v>d.y+p&&(f=v-d.y-p);c&&(c>0?f>0&&(f=Math.max(f,c)):f<0&&(f=Math.min(f,c)));if(a!==0||f!==0)return f!==0&&typeof e==="number"&&(e< |
| 0&&(e=0),e>1&&(e=1),f+=Math.floor(f>0?e*p:-e*p)),this._scrollViewAnimated(a,f,b),p!==this._getClientHeight()||l!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;else b&&b();return!1}},_startIME:function(){if(this._imeOffset===-1){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged", |
| this._modelListener.onChanged);this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var b=this._handlers[a];s(b.target,b.type,b.handler)}this._handlers=null;if(this._mutationObserver)this._mutationObserver.disconnect(),this._mutationObserver=null},_updateDOMSelection:function(){if(!(this._redrawCount>0)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,e=b.getLineAtOffset(a.start), |
| c=b.getLineAtOffset(a.end),l=this._getLineNext();if(l){var f=this._getLinePrevious(),d;e<l.lineIndex?(d=l,e=0):e>f.lineIndex?(d=f,e=0):(d=this._getLineNode(e),e=a.start-b.getLineStart(e));c<l.lineIndex?b=0:c>f.lineIndex?(l=f,b=0):(l=this._getLineNode(c),b=a.end-b.getLineStart(c));this._setDOMSelection(d,e,l,b,a.caret)}}},_update:function(a){if(!(this._redrawCount>0)){if(this._updateTimer)this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,a=!1;var b=this._clientDiv,e=this._viewDiv; |
| if(b){if(this._metrics.invalid)this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1;var c=this._model,l=this._getScroll(!1),d=this._getViewPadding(),o=c.getLineCount(),g=this._getLineHeight(),h=!1,i=!1,q=!1,r=this._metrics.scrollWidth;if(this._wrapMode)b.style.width=(this._metrics.wrapWidth||this._getClientWidth())+"px";var s,t,u,v,k=0,n=0,m;if(this._lineHeight){for(;n<o;){m=this._getLineHeight(n);if(k+m>l.y)break;k+=m;n++}s=n;t=Math.max(0,s-1);u=c=l.y-k;s>0&&(c+=this._getLineHeight(s- |
| 1))}else v=Math.max(0,l.y)/g,s=Math.floor(v),t=Math.max(0,s-1),c=Math.round((v-t)*g),u=Math.round((v-s)*g);this._topIndexY=u;v=this._rootDiv;var I=v.clientWidth,F=v.clientHeight;if(a){g=0;this._leftDiv&&(s=this._leftDiv.getBoundingClientRect(),g=s.right-s.left);s=this._getClientWidth();v=this._getClientHeight();i=s;if(this._wrapMode){if(this._metrics.wrapWidth)i=this._metrics.wrapWidth}else i=Math.max(this._maxLineWidth,i);for(;n<o;)m=this._getLineHeight(n,!1),k+=m,n++;o=k}else{v=this._getClientHeight(); |
| u=Math.min(s+Math.floor((v+u)/g),o-1);var l=Math.min(u+1,o-1),A;for(m=b.firstChild;m;){A=m.lineIndex;var z=m.nextSibling;if(!(t<=A&&A<=l)||m.lineRemoved||m.lineIndex===-1)this._mouseWheelLine===m?(m.style.display="none",m.lineIndex=-1):b.removeChild(m);m=z}m=this._getLineNext();var z=e.ownerDocument,C=z.createDocumentFragment();for(A=t;A<=l;A++)if(!m||m.lineIndex>A)(new p(this,A)).create(C,null);else{C.firstChild&&(b.insertBefore(C,m),C=z.createDocumentFragment());if(m&&m.lineChanged)m=(new p(this, |
| A)).create(C,m),m.lineChanged=!1;m=this._getLineNext(m)}C.firstChild&&b.insertBefore(C,m);if(f.isWebkit&&!this._wrapMode)b.style.width="0x7fffffffpx";m=this._getLineNext();A=v+c;for(C=!1;m;){t=m.lineWidth;if(t===void 0)if(z=m._line.getBoundingClientRect(),t=m.lineWidth=Math.ceil(z.right-z.left),z=z.bottom-z.top,this._lineHeight)this._lineHeight[m.lineIndex]=z;else if(g!==0&&z!==0&&Math.ceil(g)!==Math.ceil(z))this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[m.lineIndex]=z;if(this._lineHeight&& |
| !C&&(A-=this._lineHeight[m.lineIndex],A<0))u=m.lineIndex,C=!0;if(!this._wrapMode){if(t>=this._maxLineWidth)this._maxLineWidth=t,this._maxLineIndex=m.lineIndex;if(this._checkMaxLineIndex===m.lineIndex)this._checkMaxLineIndex=-1}if(m.lineIndex===s)this._topChild=m;if(m.lineIndex===u)this._bottomChild=m;m=this._getLineNext(m)}if(this._checkMaxLineIndex!==-1&&(A=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=A&&A<o)){g=new p(this,A);z=g.getBoundingClientRect();t=z.right-z.left;if(t>=this._maxLineWidth)this._maxLineWidth= |
| t,this._maxLineIndex=A;g.destroy()}for(;n<o;)m=this._getLineHeight(n,n<=u),k+=m,n++;o=k;this._updateRuler(this._leftDiv,s,l,F);this._updateRuler(this._rightDiv,s,l,F);this._updateRuler(this._marginDiv,s,l,F);g=0;this._leftDiv&&(s=this._leftDiv.getBoundingClientRect(),g=s.right-s.left);l=0;this._rightDiv&&(l=this._rightDiv.getBoundingClientRect(),l=l.right-l.left);e.style.left=g+"px";e.style.right=l+"px";l=this._scrollDiv;l.style.height=o+"px";s=this._getClientWidth();if(!this._singleMode&&!this._wrapMode){k= |
| h=v;(n=e.style.overflowX==="scroll")?h+=r:k-=r;m=u=s;(t=e.style.overflowY==="scroll")?u+=r:m-=r;v=h;s=u;o>v&&(q=!0,s=m);this._maxLineWidth>s&&(i=!0,v=k,o>v&&(q=!0,s=m));if(n!==i)e.style.overflowX=i?"scroll":"hidden";if(t!==q)e.style.overflowY=q?"scroll":"hidden";h=n!==i||t!==q}q=s;if(this._wrapMode){if(this._metrics.wrapWidth)q=this._metrics.wrapWidth}else q=Math.max(this._maxLineWidth,q);i=q;if((!f.isIE||f.isIE>=9)&&this._maxLineWidth>s)q+=d.right+d.left;l.style.width=q+"px";if(this._clipScrollDiv)this._clipScrollDiv.style.width= |
| q+"px";l=this._getScroll(!1)}if(this._vScrollDiv)q=v-8,k=Math.max(15,Math.ceil(Math.min(1,q/(o+d.top+d.bottom))*q)),this._vScrollDiv.style.left=g+s-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,l.y*q/o))+"px",this._vScrollDiv.style.height=k+"px";if(!this._wrapMode&&this._hScrollDiv)q=s-8,k=Math.max(15,Math.ceil(Math.min(1,q/(this._maxLineWidth+d.left+d.right))*q)),this._hScrollDiv.style.left=g+Math.floor(Math.max(0,Math.floor(l.x*q/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=v- |
| 9+"px",this._hScrollDiv.style.width=k+"px";n=l.x;k=this._clipDiv;q=this._overlayDiv;if(u=this._marginDiv)u.style.left=-n+g+this._metrics.marginWidth+d.left+"px",u.style.bottom=(e.style.overflowX==="scroll"?r:0)+"px";if(k){k.scrollLeft=n;k.scrollTop=0;e=g+d.left;r=d.top;a=s;g=v;n=0;u=-c;if(l.x===0)e-=d.left,a+=d.left,n=d.left;l.x+s===i&&(a+=d.right);l.y===0&&(r-=d.top,g+=d.top,u+=d.top);l.y+v===o&&(g+=d.bottom);k.style.left=e+"px";k.style.top=r+"px";k.style.right=I-a-e+"px";k.style.bottom=F-g-r+"px"; |
| b.style.left=n+"px";b.style.top=u+"px";b.style.width=i+"px";b.style.height=v+c+"px";if(q)q.style.left=b.style.left,q.style.top=b.style.top,q.style.width=b.style.width,q.style.height=b.style.height}else{e=n;r=c;I=n+s;F=c+v;e===0&&(e-=d.left);r===0&&(r-=d.top);I===i&&(I+=d.right);l.y+v===o&&(F+=d.bottom);b.style.clip="rect("+r+"px,"+I+"px,"+F+"px,"+e+"px)";b.style.left=-n+g+d.left+"px";b.style.width=(this._wrapMode||f.isWebkit?i:s+n)+"px";if(!a)b.style.top=-c+d.top+"px",b.style.height=v+c+"px";if(q&& |
| (q.style.clip=b.style.clip,q.style.left=b.style.left,q.style.width=b.style.width,!a))q.style.top=b.style.top,q.style.height=b.style.height}this._updateDOMSelection();if(h)b=this._ensureCaretVisible,this._ensureCaretVisible=!1,b&&this._showCaret(),this._queueUpdate()}}},_updateOverflow:function(){var a=this._viewDiv;this._wrapMode?(a.style.overflowX="hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,b,e,c){if(a)for(var l=this._parent.ownerDocument,d=this._getLineHeight(), |
| o=this._getViewPadding(),a=a.firstChild;a;){var h=a._ruler,p=d,i=h.getOverview();i==="page"&&(p+=this._topIndexY);a.style.top=-p+"px";a.style.height=c+p+"px";a.rulerChanged&&g(h.getRulerStyle(),a);var q,r=a.firstChild;r?(q=r,r=r.nextSibling):(q=f.createElement(l,"div"),q.style.visibility="hidden",a.appendChild(q));var s;if(a.rulerChanged&&q){p=-1;if(s=h.getWidestAnnotation())if(g(s.style,q),s.html)q.innerHTML=s.html;q.lineIndex=p;q.style.height=d+o.top+"px"}var t;if(i==="page"){for(h=h.getAnnotations(b, |
| e+1);r;)p=r.lineIndex,s=r.nextSibling,(!(b<=p&&p<=e)||r.lineChanged)&&a.removeChild(r),r=s;r=a.firstChild.nextSibling;t=l.createDocumentFragment();for(p=b;p<=e;p++)if(!r||r.lineIndex>p){q=f.createElement(l,"div");if(s=h[p]){g(s.style,q);if(s.html)q.innerHTML=s.html;q.annotation=s}q.lineIndex=p;q.style.height=this._getLineHeight(p)+"px";t.appendChild(q)}else if(t.firstChild&&(a.insertBefore(t,r),t=l.createDocumentFragment()),r)r=r.nextSibling;t.firstChild&&a.insertBefore(t,r)}else{s=this._getClientHeight(); |
| p=this._model.getLineCount();r=s+o.top+o.bottom-2*this._metrics.scrollWidth;i=d*p<r?d:r/p;if(a.rulerChanged){for(s=a.childNodes.length;s>1;)a.removeChild(a.lastChild),s--;h=h.getAnnotations(0,p);t=l.createDocumentFragment();for(var u in h)if(p=u>>>0,!(p<0)){q=f.createElement(l,"div");s=h[u];g(s.style,q);q.style.position="absolute";q.style.top=this._metrics.scrollWidth+d+Math.floor(p*i)+"px";if(s.html)q.innerHTML=s.html;q.annotation=s;q.lineIndex=p;t.appendChild(q)}a.appendChild(t)}else if(a._oldTrackHeight!== |
| r)for(q=a.firstChild?a.firstChild.nextSibling:null;q;)q.style.top=this._metrics.scrollWidth+d+Math.floor(q.lineIndex*i)+"px",q=q.nextSibling;a._oldTrackHeight=r}a.rulerChanged=!1;a=a.nextSibling}},_updateStyleSheet:function(){var a="";f.isWebkit&&this._metrics.scrollWidth>0&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");f.isFirefox&&f.isMac&&this._highlightRGB&&this._highlightRGB!=="Highlight"&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var b= |
| document.getElementById("_textviewStyle");if(b)b.removeChild(b.firstChild),b.appendChild(document.createTextNode(a));else{b=f.createElement(document,"style");b.id="_textviewStyle";var e=document.getElementsByTagName("head")[0]||document.documentElement;b.appendChild(document.createTextNode(a));e.insertBefore(b,e.firstChild)}}},_updateStyle:function(a){if(!a&&f.isIE)this._rootDiv.style.lineHeight="normal";var b=this._metrics=this._calculateMetrics();this._rootDiv.style.lineHeight=f.isIE?b.lineHeight- |
| (b.lineTrim.top+b.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};i.EventTarget.addMixin(t.prototype);return{TextView:t}}); |
| define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(k,m){function n(i){this._model=i;this._projections=[];var c=this;this._listener={onChanged:function(d){c._onChanged(d)},onChanging:function(d){c._onChanging(d)}};i.addEventListener("postChanged",this._listener.onChanged);i.addEventListener("preChanging",this._listener.onChanging)}n.prototype={destroy:function(){if(this._model)this._model.removeEventListener("postChanged",this._listener.onChanged), |
| this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null},addProjection:function(i){if(i){var c=this._model,d=this._projections;i._lineIndex=c.getLineAtOffset(i.start);i._lineCount=c.getLineAtOffset(i.end)-i._lineIndex;var f=i.text;f||(f="");i._model=typeof f==="string"?new k.TextModel(f,c.getLineDelimiter()):f;var c=this.mapOffset(i.start,!0),f=i.end-i.start,g=i._lineCount,h=i._model.getCharCount(),b=i._model.getLineCount()-1;this.onChanging({type:"Changing",text:i._model.getText(), |
| start:c,removedCharCount:f,addedCharCount:h,removedLineCount:g,addedLineCount:b});var a=this._binarySearch(d,i.start);d.splice(a,0,i);this.onChanged({type:"Changed",start:c,removedCharCount:f,addedCharCount:h,removedLineCount:g,addedLineCount:b})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(i,c){var d=this._projections,f=0,g,h;if(c){for(g=0;g<d.length;g++){h=d[g];if(h.start>i)break;if(h.end>i)return-1;f+=h._model.getCharCount()- |
| (h.end-h.start)}return i+f}for(g=0;g<d.length;g++){h=d[g];if(h.start>i-f)break;var b=h._model.getCharCount();if(h.start+b>i-f)return-1;f+=b-(h.end-h.start)}return i-f},removeProjection:function(i){var c,d=0;for(c=0;c<this._projections.length;c++){var f=this._projections[c];if(f===i){i=f;break}d+=f._model.getCharCount()-(f.end-f.start)}if(c<this._projections.length){var f=this._model,d=i.start+d,g=i.end-i.start,h=i._lineCount,b=i._model.getCharCount(),a=i._model.getLineCount()-1;this.onChanging({type:"Changing", |
| text:f.getText(i.start,i.end),start:d,removedCharCount:b,addedCharCount:g,removedLineCount:a,addedLineCount:h});this._projections.splice(c,1);this.onChanged({type:"Changed",start:d,removedCharCount:b,addedCharCount:g,removedLineCount:a,addedLineCount:h})}},_binarySearch:function(i,c){for(var d=i.length,f=-1,g;d-f>1;)g=Math.floor((d+f)/2),c<=i[g].start?d=g:f=g;return d},getCharCount:function(){for(var i=this._model.getCharCount(),c=this._projections,d=0;d<c.length;d++){var f=c[d];i+=f._model.getCharCount()- |
| (f.end-f.start)}return i},getLine:function(i,c){if(i<0)return null;var d=this._model,f=this._projections,g=0,h=[],b=0,a,e,l;for(a=0;a<f.length;a++){l=f[a];if(l._lineIndex>=i-g)break;e=l._model.getLineCount()-1;if(l._lineIndex+e>=i-g)if(b=i-(l._lineIndex+g),b<e)return l._model.getLine(b,c);else h.push(l._model.getLine(e));b=l.end;g+=e-l._lineCount}for(b=Math.max(b,d.getLineStart(i-g));a<f.length;a++){l=f[a];if(l._lineIndex>i-g)break;h.push(d.getText(b,l.start));e=l._model.getLineCount()-1;if(l._lineIndex+ |
| e>i-g)return h.push(l._model.getLine(0,c)),h.join("");h.push(l._model.getText());b=l.end;g+=e-l._lineCount}f=d.getLineEnd(i-g,c);b<f&&h.push(d.getText(b,f));return h.join("")},getLineAtOffset:function(i){for(var c=this._model,d=this._projections,f=0,g=0,h=0;h<d.length;h++){var b=d[h];if(b.start>i-f)break;var a=b._model.getCharCount();if(b.start+a>i-f){d=i-(b.start+f);g+=b._model.getLineAtOffset(d);f+=d;break}g+=b._model.getLineCount()-1-b._lineCount;f+=a-(b.end-b.start)}return c.getLineAtOffset(i- |
| f)+g},getLineCount:function(){for(var i=this._projections,c=this._model.getLineCount(),d=0;d<i.length;d++){var f=i[d];c+=f._model.getLineCount()-1-f._lineCount}return c},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(i,c){if(i<0)return-1;for(var d=this._model,f=this._projections,g=0,h=0,b=0;b<f.length;b++){var a=f[b];if(a._lineIndex>i-g)break;var e=a._model.getLineCount()-1;if(a._lineIndex+e>i-g)return a._model.getLineEnd(i-(a._lineIndex+g),c)+a.start+h;h+= |
| a._model.getCharCount()-(a.end-a.start);g+=e-a._lineCount}return d.getLineEnd(i-g,c)+h},getLineStart:function(i){if(i<0)return-1;for(var c=this._model,d=this._projections,f=0,g=0,h=0;h<d.length;h++){var b=d[h];if(b._lineIndex>=i-f)break;var a=b._model.getLineCount()-1;if(b._lineIndex+a>=i-f)return b._model.getLineStart(i-(b._lineIndex+f))+b.start+g;g+=b._model.getCharCount()-(b.end-b.start);f+=a-b._lineCount}return c.getLineStart(i-f)+g},getText:function(i,c){i===void 0&&(i=0);var d=this._model,f= |
| this._projections,g=0,h=[],b,a,e;for(b=0;b<f.length;b++){a=f[b];if(a.start>i-g)break;e=a._model.getCharCount();if(a.start+e>i-g)if(c!==void 0&&a.start+e>c-g)return a._model.getText(i-(a.start+g),c-(a.start+g));else h.push(a._model.getText(i-(a.start+g))),i=a.end+g+e-(a.end-a.start);g+=e-(a.end-a.start)}var l=i-g;if(c!==void 0){for(;b<f.length;b++){a=f[b];if(a.start>c-g)break;h.push(d.getText(l,a.start));e=a._model.getCharCount();if(a.start+e>c-g)return h.push(a._model.getText(0,c-(a.start+g))),h.join(""); |
| h.push(a._model.getText());l=a.end;g+=e-(a.end-a.start)}h.push(d.getText(l,c-g))}else{for(;b<f.length;b++)a=f[b],h.push(d.getText(l,a.start)),h.push(a._model.getText()),l=a.end;h.push(d.getText(l))}return h.join("")},_onChanged:function(){var i=this._change,c=i.baseStart,d=i.baseEnd,f,g,h=this._projections;for(f=0;f<h.length;f++)if(g=h[f],g.end>c)break;var b=f;for(f=0;f<h.length;f++)if(g=h[f],g.start>=d)break;var a=f,e=this._model,c=i.baseText.length-(d-c);for(f=a;f<h.length;f++)g=h[f],g.start+=c, |
| g.end+=c,g._lineIndex=e.getLineAtOffset(g.start);g=h.splice(b,a-b);for(f=0;f<g.length;f++)g[f].annotation&&g[f].annotation._expand();this.onChanged({type:"Changed",start:i.start,removedCharCount:i.removedCharCount,addedCharCount:i.addedCharCount,removedLineCount:i.removedLineCount,addedLineCount:i.addedLineCount});this._change=void 0},_onChanging:function(i){var c=!!this._change,d=this._change||{},f=i.start,g=f+i.removedCharCount;d.baseStart=f;d.baseEnd=g;d.baseText=i.text;d.addedLineCount=i.addedLineCount; |
| if(!c){this._change=d;d.text=i.text;var h=this._projections,b,a,e,i=function(c){for(a=0,b=0;a<h.length;a++){e=h[a];if(e.start>c)break;if(e.end>c)return-1;b+=e._model.getCharCount()-(e.end-e.start)}return c+b};d.start=i(f);if(d.start===-1)d.text=this._model.getText(e.start,f)+d.text,d.addedLineCount+=this._model.getLineAtOffset(f)-this._model.getLineAtOffset(e.start),d.start=e.start+b;d.end=i(g);if(d.end===-1)d.text+=this._model.getText(g,e.end),d.addedLineCount+=this._model.getLineAtOffset(e.end)- |
| this._model.getLineAtOffset(g),d.end=e.start+b}d.addedCharCount=d.text.length;d.removedCharCount=d.end-d.start;d.removedLineCount=this.getLineAtOffset(d.end)-this.getLineAtOffset(d.start);this.onChanging({type:"Changing",text:d.text,start:d.start,removedCharCount:d.removedCharCount,addedCharCount:d.addedCharCount,removedLineCount:d.removedLineCount,addedLineCount:d.addedLineCount})},onChanging:function(i){return this.dispatchEvent(i)},onChanged:function(i){return this.dispatchEvent(i)},setLineDelimiter:function(i){this._model.setLineDelimiter(i)}, |
| setText:function(i,c,d){function f(e){for(b=0,h=0;b<g.length;b++){a=g[b];if(a.start>e-h)break;var c=a._model.getCharCount();if(a.start+c>e-h)return-1;h+=c-(a.end-a.start)}return e-h}this._change={text:i||"",start:c||0,end:d===void 0?this.getCharCount():d};var g=this._projections,h,b,a,e,l,i=f(this._change.start);if(i===-1)e={projection:a,start:this._change.start-(a.start+h)},i=a.end;c=f(this._change.end);if(c===-1)l={projection:a,end:this._change.end-(a.start+h)},c=a.start;if(e&&l&&e.projection=== |
| l.projection)a._model.setText(this._change.text,e.start,l.end);else{this._model.setText(this._change.text,i,c);if(e)a=e.projection,a._model.setText("",e.start);if(l)a=l.projection,a._model.setText("",0,l.end),a.start=a.end,a._lineCount=0}this._change=void 0}};m.EventTarget.addMixin(n.prototype);return{ProjectionTextModel:n}}); |
| define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(k,m){function n(b,a,e){this.start=b;this.end=a;this._projectionModel=e;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function i(){}function c(b,a){var e=b.lastIndexOf("."),e=b.substring(e+1),c={title:k[e],style:{styleClass:"annotation "+e},html:"<div class='annotationHTML "+e+"'></div>",overviewStyle:{styleClass:"annotationOverview "+e}};a?c.lineStyle={styleClass:"annotationLine "+ |
| e}:c.rangeStyle={styleClass:"annotationRange "+e};i.registerType(b,c)}function d(){}function f(b){this._annotations=[];var a=this;this._listener={onChanged:function(b){a._onChanged(b)}};this.setTextModel(b)}function g(b,a){this._view=b;this._annotationModel=a;var e=this;this._listener={onDestroy:function(a){e._onDestroy(a)},onLineStyle:function(a){e._onLineStyle(a)},onChanged:function(a){e._onAnnotationModelChanged(a)}};b.addEventListener("Destroy",this._listener.onDestroy);b.addEventListener("postLineStyle", |
| this._listener.onLineStyle);a.addEventListener("Changed",this._listener.onChanged)}n.prototype={_expandedHTML:"<div class='annotationHTML expanded'></div>",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"<div class='annotationHTML collapsed'></div>",_collapsedStyle:{styleClass:"annotation collapsed"},_collapse:function(){if(!this.expanded)return!1;this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this); |
| return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},collapse:function(){if(this._collapse()){var b=this._projectionModel,a=b.getBaseModel();this._projection={annotation:this,start:a.getLineStart(a.getLineAtOffset(this.start)+1),end:a.getLineEnd(a.getLineAtOffset(this.end),!0)};b.addProjection(this._projection)}},expand:function(){this._expand()&& |
| this._projectionModel.removeProjection(this._projection)}};i.ANNOTATION_ERROR="orion.annotation.error";i.ANNOTATION_WARNING="orion.annotation.warning";i.ANNOTATION_TASK="orion.annotation.task";i.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";i.ANNOTATION_BOOKMARK="orion.annotation.bookmark";i.ANNOTATION_FOLDING="orion.annotation.folding";i.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";i.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";i.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine"; |
| i.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";i.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";i.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";i.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";i.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";i.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";i.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";i.ANNOTATION_BLAME="orion.annotation.blame";i.ANNOTATION_CURRENT_BLAME= |
| "orion.annotation.currentBlame";var h={};i.registerType=function(b,a){var e=a;if(typeof e!=="function")e=function(a,b,e){this.start=a;this.end=b;if(e!==void 0)this.title=e},e.prototype=a;e.prototype.type=b;h[b]=e;return b};i.createAnnotation=function(b,a,e,c){return new (this.getType(b))(a,e,c)};i.getType=function(b){return h[b]};c(i.ANNOTATION_ERROR);c(i.ANNOTATION_WARNING);c(i.ANNOTATION_TASK);c(i.ANNOTATION_BREAKPOINT);c(i.ANNOTATION_BOOKMARK);c(i.ANNOTATION_CURRENT_BRACKET);c(i.ANNOTATION_MATCHING_BRACKET); |
| c(i.ANNOTATION_CURRENT_SEARCH);c(i.ANNOTATION_MATCHING_SEARCH);c(i.ANNOTATION_READ_OCCURRENCE);c(i.ANNOTATION_WRITE_OCCURRENCE);c(i.ANNOTATION_SELECTED_LINKED_GROUP);c(i.ANNOTATION_CURRENT_LINKED_GROUP);c(i.ANNOTATION_LINKED_GROUP);c(i.ANNOTATION_CURRENT_LINE,!0);c(i.ANNOTATION_BLAME,!0);c(i.ANNOTATION_CURRENT_BLAME,!0);i.registerType(i.ANNOTATION_FOLDING,n);d.addMixin=function(b){var a=d.prototype,e;for(e in a)a.hasOwnProperty(e)&&(b[e]=a[e])};d.prototype={addAnnotationType:function(b){if(!this._annotationTypes)this._annotationTypes= |
| [];this._annotationTypes.push(b)},getAnnotationTypePriority:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===b)return a+1;return 0},getAnnotationsByType:function(b,a,e){b=b.getAnnotations(a,e);for(e=[];b.hasNext();)a=b.next(),this.getAnnotationTypePriority(a.type)!==0&&e.push(a);var c=this;e.sort(function(a,b){return c.getAnnotationTypePriority(a.type)-c.getAnnotationTypePriority(b.type)});return e},isAnnotationTypeVisible:function(b){return this.getAnnotationTypePriority(b)!== |
| 0},removeAnnotationType:function(b){if(this._annotationTypes)for(var a=0;a<this._annotationTypes.length;a++)if(this._annotationTypes[a]===b){this._annotationTypes.splice(a,1);break}}};f.prototype={addAnnotation:function(b){if(b){var a=this._annotations,e=this._binarySearch(a,b.start);a.splice(e,0,b);b._annotationModel=this;this.onChanged({type:"Changed",added:[b],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(b,a){var e=this._annotations,c,d=0,f;f=b=== |
| void 0&&a===void 0?function(){return d<e.length?e[d++]:null}:function(){for(;d<e.length;){var c=e[d++];if(b===c.start||(b>c.start?b<c.end:c.start<a))return c;if(c.start>=a)break}return null};c=f();return{next:function(){var a=c;a&&(c=f());return a},hasNext:function(){return c!==null}}},modifyAnnotation:function(b){if(b&&!(this._getAnnotationIndex(b)<0))this.onChanged({type:"Changed",added:[],removed:[],changed:[b]})},onChanged:function(b){return this.dispatchEvent(b)},removeAnnotations:function(b){var a= |
| this._annotations,e,c;if(b){e=[];for(c=a.length-1;c>=0;c--){var d=a[c];if(d.type===b)a.splice(c,1),e.splice(0,0,d),d._annotationModel=null}}else e=a;this.onChanged({type:"Changed",removed:e,added:[],changed:[]})},removeAnnotation:function(b){if(b){var a=this._getAnnotationIndex(b);if(!(a<0))b._annotationModel=null,this.onChanged({type:"Changed",removed:this._annotations.splice(a,1),added:[],changed:[]})}},replaceAnnotations:function(b,a){var e=this._annotations,c,d,f,g=[];if(b)for(c=b.length-1;c>= |
| 0;c--)if(f=b[c],d=this._getAnnotationIndex(f),!(d<0))f._annotationModel=null,e.splice(d,1),g.splice(0,0,f);a||(a=[]);for(c=0;c<a.length;c++)f=a[c],d=this._binarySearch(e,f.start),f._annotationModel=this,e.splice(d,0,f);this.onChanged({type:"Changed",removed:g,added:a,changed:[]})},setTextModel:function(b){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=b)&&this._model.addEventListener("Changed",this._listener.onChanged)},_binarySearch:function(b,a){for(var e= |
| b.length,c=-1,d;e-c>1;)d=Math.floor((e+c)/2),a<=b[d].start?e=d:c=d;return e},_getAnnotationIndex:function(b){for(var a=this._annotations,e=this._binarySearch(a,b.start);e<a.length&&a[e].start===b.start;){if(a[e]===b)return e;e++}return-1},_onChanged:function(b){var a=b.start,e=b.removedCharCount,c=this._annotations,d=a+e;if(0<c.length){for(var f={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:b},b=b.addedCharCount-e,e=0;e<c.length;e++){var g=c[e];if(g.start>=d)g._oldStart=g.start, |
| g._oldEnd=g.end,g.start+=b,g.end+=b,f.changed.push(g);else if(!(g.end<=a))g.start<a&&d<g.end?(g._oldStart=g.start,g._oldEnd=g.end,g.end+=b,f.changed.push(g)):(c.splice(e,1),f.removed.push(g),g._annotationModel=null,g.expand&&g.expand(),e--)}if(f.added.length>0||f.removed.length>0||f.changed.length>0)this.onChanged(f)}}};m.EventTarget.addMixin(f.prototype);g.prototype={destroy:function(){var b=this._view;if(b)b.removeEventListener("Destroy",this._listener.onDestroy),b.removeEventListener("LineStyle", |
| this._listener.onLineStyle),this.view=null;(b=this._annotationModel)&&b.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var e;if(a.tagName&&!b.tagName)b.tagName=a.tagName;if(a.style){if(!b.style)b.style={};for(e in a.style)b.style[e]||(b.style[e]=a.style[e])}if(a.attributes){if(!b.attributes)b.attributes={};for(e in a.attributes)b.attributes[e]|| |
| (b.attributes[e]=a.attributes[e])}}return b},_mergeStyleRanges:function(b,a){b||(b=[]);var e,c;for(c=0;c<b.length&&a;c++){var d=b[c];if(a.end<=d.start)break;if(!(a.start>=d.end)){e=this._mergeStyle({},d.style);e=this._mergeStyle(e,a.style);var f=[];f.push(c,1);a.start<d.start&&f.push({start:a.start,end:d.start,style:a.style});a.start>d.start&&f.push({start:d.start,end:a.start,style:d.style});f.push({start:Math.max(d.start,a.start),end:Math.min(d.end,a.end),style:e});a.end<d.end&&f.push({start:a.end, |
| end:d.end,style:d.style});a=a.end>d.end?{start:d.end,end:a.end,style:a.style}:null;Array.prototype.splice.apply(b,f)}}a&&(e=this._mergeStyle({},a.style),b.splice(c,0,{start:a.start,end:a.end,style:e}));return b},_onAnnotationModelChanged:function(b){function a(a,b){f.getBaseModel&&(a=f.mapOffset(a,!0),b=f.mapOffset(b,!0));a!==-1&&b!==-1&&c.redrawRange(a,b)}function e(b,e){for(var c=0;c<b.length;c++)if(d.isAnnotationTypeVisible(b[c].type)){var l=b[c];a(l.start,l.end);e&&l._oldStart!==void 0&&l._oldEnd&& |
| a(l._oldStart,l._oldEnd)}}var c=this._view;if(c){var d=this,f=c.getModel();e(b.added);e(b.removed);e(b.changed,!0)}},_onDestroy:function(){this.destroy()},_onLineStyle:function(b){var a=this._annotationModel,e=b.textView.getModel(),c=a.getTextModel(),d=b.lineStart,f=b.lineStart+b.lineText.length;c!==e&&(d=e.mapOffset(d),f=e.mapOffset(f));for(a=a.getAnnotations(d,f);a.hasNext();)if(d=a.next(),this.isAnnotationTypeVisible(d.type)){if(d.rangeStyle){var f=d.start,g=d.end;c!==e&&(f=e.mapOffset(f,!0),g= |
| e.mapOffset(g,!0));b.ranges=this._mergeStyleRanges(b.ranges,{start:f,end:g,style:d.rangeStyle})}if(d.lineStyle)b.style=this._mergeStyle({},b.style),b.style=this._mergeStyle(b.style,d.lineStyle)}}};d.addMixin(g.prototype);return{FoldingAnnotation:n,AnnotationType:i,AnnotationTypeList:d,AnnotationModel:f,AnnotationStyler:g}}); |
| define("orion/editor/tooltip","i18n!orion/editor/nls/messages,orion/editor/textView,orion/editor/textModel,orion/editor/projectionTextModel,orion/editor/util,orion/util".split(","),function(k,m,n,i,c,d){function f(c){this._view=c;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(c.getOptions("parent").ownerDocument)}f.getTooltip=function(c){if(!c._tooltip)c._tooltip=new f(c);return c._tooltip};f.prototype={_create:function(f){if(!this._tooltipDiv){var h= |
| this._tooltipDiv=d.createElement(f,"div");h.tabIndex=0;h.className="textviewTooltip";h.setAttribute("aria-live","assertive");h.setAttribute("aria-atomic","true");var b=this._tooltipContents=d.createElement(f,"div");h.appendChild(b);f.body.appendChild(h);var a=this;c.addEventListener(h,"mouseover",function(){if(a._hideDelay){var b=a._getWindow();if(a._delayedHideTimeout)b.clearTimeout(a._delayedHideTimeout),a._delayedHideTimeout=null;if(a._hideTimeout)b.clearTimeout(a._hideTimeout),a._hideTimeout= |
| null;a._nextTarget=null}},!1);c.addEventListener(h,"mouseout",function(b){b=b.relatedTarget||b.toElement;b===h||a._hasFocus()||(!b||!c.contains(h,b))&&a._hide()},!1);c.addEventListener(h,"keydown",function(b){b.keyCode===27&&a._hide()},!1);c.addEventListener(f,"mousedown",this._mouseDownHandler=function(b){a.isVisible()&&(c.contains(h,b.target||b.srcElement)||a._hide())},!0);this._view.addEventListener("Destroy",function(){a.destroy()});this._hide()}},_getWindow:function(){var c=this._tooltipDiv.ownerDocument; |
| return c.defaultView||c.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var d=this._tooltipDiv.parentNode;d&&d.removeChild(this._tooltipDiv);c.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var d=this._tooltipDiv;return!d?!1:c.contains(d,d.ownerDocument.activeElement)},hide:function(c){if(c===void 0)c=this._hideDelay;var d=this._getWindow();if(this._delayedHideTimeout)d.clearTimeout(this._delayedHideTimeout), |
| this._delayedHideTimeout=null;var b=this;c?b._delayedHideTimeout=d.setTimeout(function(){b._delayedHideTimeout=null;b._hide();b.setTarget(b._nextTarget,0)},c):(b._hide(),b.setTarget(b._nextTarget,0))},_hide:function(){var c=this._tooltipDiv;if(c){this._hasFocus()&&this._view.focus();if(this._contentsView)this._contentsView.destroy(),this._contentsView=null;if(this._tooltipContents)this._tooltipContents.innerHTML="";c.style.visibility="hidden";c=this._getWindow();if(this._showTimeout)c.clearTimeout(this._showTimeout), |
| this._showTimeout=null;if(this._delayedHideTimeout)c.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null;if(this._hideTimeout)c.clearTimeout(this._hideTimeout),this._hideTimeout=null;if(this._fadeTimeout)c.clearInterval(this._fadeTimeout),this._fadeTimeout=null}},isVisible:function(){return this._tooltipDiv&&this._tooltipDiv.style.visibility==="visible"},setTarget:function(c,d,b){if(this.isVisible()){if(!this._hasFocus())this._nextTarget=c,this.hide(b)}else if(this._target=c){var a= |
| this,c=a._getWindow();if(a._showTimeout)c.clearTimeout(a._showTimeout),a._showTimeout=null;d===0?a.show(!0):a._showTimeout=c.setTimeout(function(){a._showTimeout=null;a.show(!0)},d?d:a._showDelay)}},show:function(c){if(this._target){var d=this._target.getTooltipInfo();if(d){var b=this._tooltipDiv,a=this._tooltipContents;b.style.left=b.style.right=b.style.width=b.style.height=a.style.width=a.style.height="auto";var e=d.contents;e instanceof Array&&(e=this._getAnnotationContents(e));if(typeof e==="string")a.innerHTML= |
| e;else if(this._isNode(e))a.appendChild(e);else if(e instanceof i.ProjectionTextModel){var l=this._view,f=l.getOptions();f.wrapMode=!1;f.parent=a;var q=f.themeClass;q?((q=q.replace("tooltipTheme",""))&&(q=" "+q),q="tooltipTheme"+q):q="tooltipTheme";f.themeClass=q;f=this._contentsView=new m.TextView(f);f.addEventListener("LineStyle",function(a){l.onLineStyle(a)});f.setModel(e);e=f.computeSize();a.style.width=e.width+"px";a.style.height=e.height+"px";f.resize()}else return;a=b.ownerDocument.documentElement; |
| d.anchor==="right"?(e=a.clientWidth-d.x,b.style.right=e+"px"):(e=parseInt(this._getNodeStyle(b,"padding-left","0"),10),e+=parseInt(this._getNodeStyle(b,"border-left-width","0"),10),e=d.x-e,b.style.left=e+"px");b.style.maxWidth=a.clientWidth-e-10+"px";e=parseInt(this._getNodeStyle(b,"padding-top","0"),10);e+=parseInt(this._getNodeStyle(b,"border-top-width","0"),10);e=d.y-e;b.style.top=e+"px";b.style.maxHeight=a.clientHeight-e-10+"px";b.style.opacity="1";b.style.visibility="visible";if(c){var r=this, |
| p=this._getWindow();r._hideTimeout=p.setTimeout(function(){r._hideTimeout=null;var a=parseFloat(r._getNodeStyle(b,"opacity","1"));r._fadeTimeout=p.setInterval(function(){b.style.visibility==="visible"&&a>0?(a-=0.1,b.style.opacity=a):r._hide()},r._fadeDelay/10)},r._autoHideDelay)}}}},_getAnnotationContents:function(f){function h(a,b){var e=t.getLineStart(t.getLineAtOffset(a)),c=t.getLineEnd(t.getLineAtOffset(b),!0);return t.getText(e,c)}function b(a){var b=a.title,e=d.createElement(q,"div");e.className= |
| "tooltipRow";if(a.html)e.innerHTML=a.html,e.lastChild&&c.addEventListener(e.lastChild,"click",function(){var b=a.start,e=a.end;p.getBaseModel&&(b=p.mapOffset(b,!0),e=p.mapOffset(e,!0));r.setSelection(b,e,1/3,function(){o._hide()})},!1),e.appendChild(q.createTextNode("\u00a0"));b||(b=h(a.start,a.end));typeof b==="function"&&(b=a.title());if(typeof b==="string"){var j=d.createElement(q,"span");j.appendChild(q.createTextNode(b));b=j}e.appendChild(b);return e}for(var a,e=[],l=0;l<f.length;l++)a=f[l], |
| a.title!==""&&!a.groupAnnotation&&e.push(a);f=e;if(f.length===0)return null;var o=this,q=this._tooltipDiv.ownerDocument,r=this._view,p=r.getModel(),t=p.getBaseModel?p.getBaseModel():p;if(f.length===1)if(a=f[0],a.title!==void 0){a=b(a);if(a.firstChild)(f=a.firstChild.className)&&(f+=" "),f+="single",a.firstChild.className=f;return a}else return f=new i.ProjectionTextModel(t),e=t.getLineStart(t.getLineAtOffset(a.start)),l=t.getCharCount(),a.end!==l&&f.addProjection({start:a.end,end:l}),e>0&&f.addProjection({start:0, |
| end:e}),f;else{e=d.createElement(q,"div");a=d.createElement(q,"em");a.appendChild(q.createTextNode(k.multipleAnnotations));e.appendChild(a);for(l=0;l<f.length;l++)a=f[l],(a=b(a))&&e.appendChild(a);return e}},_getNodeStyle:function(c,d,b){var a;if(c&&(a=c.style[d],!a))if(c.currentStyle){for(a=0;(a=d.indexOf("-",a))!==-1;)d=d.substring(0,a)+d.substring(a+1,a+2).toUpperCase()+d.substring(a+2);a=c.currentStyle[d]}else a=(c=c.ownerDocument.defaultView.getComputedStyle(c,null))?c.getPropertyValue(d):null; |
| return a||b},_isNode:function(c){return typeof Node==="object"?c instanceof Node:c&&typeof c==="object"&&typeof c.nodeType==="number"&&typeof c.nodeName==="string"}};return{Tooltip:f}}); |
| define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(k,m,n,i){function c(b,a,e,c){this._location=a||"left";this._overview=e||"page";this._rulerStyle=c;this._view=null;var d=this;this._listener={onTextModelChanged:function(a){d._onTextModelChanged(a)},onAnnotationModelChanged:function(a){d._onAnnotationModelChanged(a)}};this.setAnnotationModel(b)}function d(b,a,e,l,d){c.call(this,b,a,"page",e);this._oddStyle=l||{style:{backgroundColor:"white"}}; |
| this._evenStyle=d||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function f(b,a,e){c.call(this,b,a,"page",e)}function g(b,a,e){c.call(this,b,a,"document",e)}function h(b,a,e){f.call(this,b,a,e)}c.prototype={getAnnotations:function(b,a){var e=this._annotationModel;if(!e)return[];var c=this._view.getModel(),d=c.getLineStart(b),f=c.getLineEnd(a-1),g=c;c.getBaseModel&&(g=c.getBaseModel(),d=c.mapOffset(d),f=c.mapOffset(f));for(var h=[],e=this.getAnnotationsByType(e,d,f),d=0;d< |
| e.length;d++)for(var f=e[d],i=g.getLineAtOffset(f.start),v=g.getLineAtOffset(Math.max(f.start,f.end-1)),s=i;s<=v;s++){var u=s;if(c!==g){u=g.getLineStart(s);u=c.mapOffset(u,!0);if(u===-1)continue;u=c.getLineAtOffset(u)}if(b<=u&&u<a){var j=this._mergeAnnotation(h[u],f,s-i,v-i+1);j&&(h[u]=j)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var k in h)h[k]._multiple&&(h[k].html+=this._multiAnnotationOverlay.html);return h},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location}, |
| getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(b){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=b)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(b){this._multiAnnotation=b},setMultiAnnotationOverlay:function(b){this._multiAnnotationOverlay= |
| b},setView:function(b){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=b;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(b){if(b!==void 0){var a=this._view,e=a.getModel(),c=e,d=e.getLineStart(b),f=d,g=d,h=this._annotationModel;if(h){a=a.getSelection();g=e.getLineEnd(b,!0);if(d<=a.start&&a.start<g)d=a.start;e.getBaseModel&&(d=e.mapOffset(d), |
| g=e.mapOffset(g),c=e.getBaseModel());for(var i,g=h.getAnnotations(d,g),h=null;!i&&g.hasNext();)a=g.next(),this.isAnnotationTypeVisible(a.type)&&(h=a,a.start<=d||(i=a));if(h&&h.groupId!==void 0)this._currentClickGroup=this._currentClickGroup===h.groupId?null:h.groupId,this._setCurrentGroup(b);i&&c.getLineAtOffset(i.start)===c.getLineAtOffset(d)?(d=i.start,g=i.end):g=d=f;e.getBaseModel&&(d=e.mapOffset(d,!0),g=e.mapOffset(g,!0))}(b=n.Tooltip.getTooltip(this._view))&&b.setTarget(null);this._view.setSelection(g, |
| d,1/3,function(){})}},onDblClick:function(){},onMouseMove:function(b,a){var e=n.Tooltip.getTooltip(this._view);if(e&&!(e.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=b;var c=this;e.setTarget({y:a.clientY,getTooltipInfo:function(){return c._getTooltipInfo(c._tooltipLineIndex,this.y)}})}},onMouseOver:function(b,a){this.onMouseMove(b,a);this._currentClickGroup||this._setCurrentGroup(b)},onMouseOut:function(){this._currentClickGroup||this._setCurrentGroup(-1);var b=n.Tooltip.getTooltip(this._view); |
| b&&b.setTarget(null)},_getTooltipInfo:function(b,a){if(b!==void 0){var e=this._view,c=e.getModel(),d=this._annotationModel,f=[];if(d){var f=c.getLineStart(b),g=c.getLineEnd(b);c.getBaseModel&&(f=c.mapOffset(f),g=c.mapOffset(g));f=this.getAnnotationsByType(d,f,g)}d=this._getTooltipContents(b,f);if(!d)return null;d={contents:d,anchor:this.getLocation()};f=e.getClientArea();f.y=this.getOverview()==="document"?e.convert({y:a},"view","document").y:e.getLocationAtOffset(c.getLineStart(b)).y;e.convert(f, |
| "document","page");d.x=f.x;d.y=f.y;d.anchor==="right"&&(d.x+=f.width);return d}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(d.isAnnotationTypeVisible(a[b].type)){var f=a[b].start,g=a[b].end;c.getBaseModel&&(f=c.mapOffset(f,!0),g=c.mapOffset(g,!0));f!==-1&&g!==-1&&e.redrawLines(c.getLineAtOffset(f),c.getLineAtOffset(Math.max(f,g-1))+1,d)}}var e=this._view;if(e){var c=e.getModel(),d=this,f=c.getLineCount();b.textModelChangedEvent? |
| (b=b.textModelChangedEvent.start,c.getBaseModel&&(b=c.mapOffset(b,!0)),b=c.getLineAtOffset(b),e.redrawLines(b,f,d)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,e){b||(b={});if(e===0)if(b.html&&a.html){if(a.html!==b.html&&!b._multiple&&this._multiAnnotation)b.html=this._multiAnnotation.html;b._multiple=!0}else b.html=a.html;b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass? |
| b.styleClass+=" "+a.styleClass:b.styleClass=a.styleClass;var e;if(a.style){if(!b.style)b.style={};for(e in a.style)b.style[e]===void 0&&(b.style[e]=a.style[e])}if(a.attributes){if(!b.attributes)b.attributes={};for(e in a.attributes)b.attributes[e]===void 0&&(b.attributes[e]=a.attributes[e])}}return b},_setCurrentGroup:function(b){var a=this._annotationModel,e=null,c=a.getTextModel(),d,f=this._currentGroupAnnotation;if(b!==-1){var g=c.getLineStart(b),h=c.getLineEnd(b);c.getBaseModel&&(g=c.mapOffset(g), |
| h=c.mapOffset(h));for(d=a.getAnnotations(g,h);d.hasNext();)if(c=d.next(),this.isAnnotationTypeVisible(c.type)&&c.start<=g&&c.end>=h&&c.groupId!==void 0){e=c;break}if(f&&e&&f.groupId===e.groupId)return}this._currentGroupAnnotation=null;f&&a.removeAnnotations(f.groupType);if(e&&b!==-1){this._currentGroupAnnotation=e;d=a.getAnnotations();for(b=[];d.hasNext();)c=d.next(),delete c.groupAnnotation,c.groupId===e.groupId&&(c=c.createGroupAnnotation(),b.push(c));a.replaceAnnotations(null,b)}}};m.AnnotationTypeList.addMixin(c.prototype); |
| d.prototype=new c;d.prototype.getAnnotations=function(b,a){for(var e=c.prototype.getAnnotations.call(this,b,a),d=this._view.getModel(),f=b;f<a;f++){var g=f&1?this._oddStyle:this._evenStyle,h=f;d.getBaseModel&&(h=d.getLineStart(h),h=d.getBaseModel().getLineAtOffset(d.mapOffset(h)));e[f]||(e[f]={});e[f].html=this._firstLine+h+"";if(!e[f].style)e[f].style=g}return e};d.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();return this.getAnnotations(b-1,b)[b-1]};d.prototype.setFirstLine= |
| function(b){this._firstLine=b!==void 0?b:1};d.prototype._onTextModelChanged=function(b){var b=b.start,a=this._view.getModel(),e=(this._firstLine+(a.getBaseModel?a.getBaseModel().getLineCount():a.getLineCount())-1+"").length;if(this._numOfDigits!==e)this._numOfDigits=e,this._view.redrawLines(a.getLineAtOffset(b),a.getLineCount(),this)};f.prototype=new c;g.prototype=new c;g.prototype.getRulerStyle=function(){var b={style:{lineHeight:"1px",fontSize:"1px"}};return b=this._mergeStyle(b,this._rulerStyle)}; |
| g.prototype._getTooltipContents=function(b,a){if(a.length===0){var e=this._view.getModel(),d=b;e.getBaseModel&&(d=e.getLineStart(d),d=e.getBaseModel().getLineAtOffset(e.mapOffset(d)));return i.formatMessage(k.line,d+1)}return c.prototype._getTooltipContents.call(this,b,a)};g.prototype._mergeAnnotation=function(b,a,e,c){if(e===0){if(!b)b={html:" ",style:{style:{height:3*c+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle);return b}};h.prototype=new f;h.prototype.onClick=function(b){if(b!== |
| void 0){var a=this._annotationModel;if(a){var e=this._view.getModel(),c=e.getLineStart(b),b=e.getLineEnd(b,!0);e.getBaseModel&&(c=e.mapOffset(c),b=e.mapOffset(b),e=e.getBaseModel());for(var d,a=a.getAnnotations(c,b);!d&&a.hasNext();)b=a.next(),this.isAnnotationTypeVisible(b.type)&&(d=b);d&&e.getLineAtOffset(d.start)===e.getLineAtOffset(c)&&((e=n.Tooltip.getTooltip(this._view))&&e.setTarget(null),d.expanded?d.collapse():d.expand())}}};h.prototype._getTooltipContents=function(b,a){return a.length=== |
| 1&&a[0].expanded?null:f.prototype._getTooltipContents.call(this,b,a)};h.prototype._onAnnotationModelChanged=function(b){function a(a){for(g=0;g<a.length;g++)if(d.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;c.getBaseModel&&(b=c.mapOffset(b,!0));b!==-1&&(p=Math.min(p,c.getLineAtOffset(b)))}}if(b.textModelChangedEvent)f.prototype._onAnnotationModelChanged.call(this,b);else{var e=this._view;if(e){var c=e.getModel(),d=this,g,h=c.getLineCount(),p=h;a(b.added);a(b.removed);a(b.changed);b=e.getRulers(); |
| for(g=0;g<b.length;g++)e.redrawLines(p,h,b[g])}}};return{Ruler:c,AnnotationRuler:f,LineNumberRuler:d,OverviewRuler:g,FoldingRuler:h}}); |
| define("orion/editor/undoStack",[],function(){function k(i,c,d,f,g){this.model=i;this.offset=c;this.text=d;this.previousText=f;this.type=g}function m(i){this.owner=i;this.changes=[]}function n(i,c){this.size=c!==void 0?c:100;this.reset();var d=this;this._listener={onChanging:function(c){d._onChanging(c)},onDestroy:function(c){d._onDestroy(c)}};if(i.getModel){var f=i.getModel();f.getBaseModel&&(f=f.getBaseModel());this.model=f;this.setView(i)}else this.shared=!0,this.model=i;this.model.addEventListener("Changing", |
| this._listener.onChanging)}k.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(i,c){this._doUndoRedo(this.offset,this.previousText,this.text,i,c);return!0},redo:function(i,c){this._doUndoRedo(this.offset,this.text,this.previousText,i,c);return!0},merge:function(i,c,d,f,g){if(f===this.type)if(f===1&&i=== |
| this.offset+this.text.length)return this.text+=c,!0;else if(f===-1&&g===this.offset)return this.offset=i,this.previousText=d+this.previousText,!0;else if(f===-1&&i===this.offset)return this.previousText+=d,!0;return!1},_doUndoRedo:function(i,c,d,f,g){this.model.setText(c,i,i+d.length);g&&f&&(d=f.getModel(),d!==this.model&&(i=d.mapOffset(i,!0)),f.setSelection(i,i+c.length))}};m.prototype={getRedoChanges:function(){for(var i=[],c=0;c<this.changes.length;c++)i=i.concat(this.changes[c].getRedoChanges()); |
| return i},getUndoChanges:function(){for(var i=[],c=this.changes.length-1;c>=0;c--)i=i.concat(this.changes[c].getUndoChanges());return i},add:function(i){this.changes.push(i)},end:function(i){if(i)this.endSelection=i.getSelection(),this.endCaret=i.getCaretOffset();(i=this.owner)&&i.end&&i.end()},undo:function(i,c){this.changes.length>1&&i&&i.setRedraw(!1);for(var d=this.changes.length-1;d>=0;d--)this.changes[d].undo(i,!1);this.changes.length>1&&i&&i.setRedraw(!0);if(c&&i){var d=this.startSelection.start, |
| f=this.startSelection.end;i.setSelection(this.startCaret?d:f,this.startCaret?f:d)}(d=this.owner)&&d.undo&&d.undo();return this.changes.length>0},redo:function(i,c){this.changes.length>1&&i&&i.setRedraw(!1);for(var d=0;d<this.changes.length;d++)this.changes[d].redo(i,!1);i&&i.setRedraw(!0);if(c&&i){var d=this.endSelection.start,f=this.endSelection.end;i.setSelection(this.endCaret?d:f,this.endCaret?f:d)}(d=this.owner)&&d.redo&&d.redo();return this.changes.length>0},merge:function(i,c,d,f,g){var h=this.changes.length; |
| return h>0?this.changes[h-1].merge(i,c,d,f,g):!1},start:function(i){if(i)this.startSelection=i.getSelection(),this.startCaret=i.getCaretOffset();(i=this.owner)&&i.start&&i.start()}};n.prototype={destroy:function(){this._onDestroy()},add:function(i){this.compoundChange?this.compoundChange.add(i):(this.stack.splice(this.index,this.stack.length-this.index,i),this.index++,this.stack.length>this.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 this.index>0},canRedo:function(){return this.stack.length-this.index>0},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var i=[],c=this.index;c<this.stack.length;c++)i=i.concat(this.stack[c].getRedoChanges()); |
| return i},getUndoChanges:function(){this._commitUndo();for(var i=[],c=this.index;c>=0;c--)i=i.concat(this.stack[c].getUndoChanges());return i},undo:function(){this._commitUndo();var i;i=!1;this._ignoreUndo=!0;do{if(this.index<=0)break;i=this.stack[--this.index]}while(!(i=i.undo(this.view,!0)));this._ignoreUndo=!1;return i},redo:function(){this._commitUndo();var i;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;i=this.stack[this.index++]}while(!i.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(i){if(this.view!==i)this.view&&i.removeEventListener("Destroy",this._listener.onDestroy),(this.view=i)&&i.addEventListener("Destroy",this._listener.onDestroy)},startCompoundChange:function(i){this._commitUndo();i=new m(i);this.add(i);this.compoundChange=i;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()}, |
| _onDestroy:function(i){(!i||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);if(this.view)this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null},_onChanging:function(i){if(!this._ignoreUndo){var c=i.text,d=i.start,f=i.addedCharCount,g=i.removedCharCount,i=d+g,h=0;f===0&&g===1?h=-1:f===1&&g===0&&(h=1);f=this.stack.length;g=this.model.getText(d,i);(!(f>0&&this.index===f)||!this.stack[f-1].merge(d,c,g,h,i))&&this.add(new k(this.model,d,c, |
| g,h))}}};return{UndoStack:n}}); |
| define("orion/editor/textDND",["orion/util"],function(k){function m(k,i){this._view=k;this._undoStack=i;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var c=this;this._listener={onDragStart:function(d){c._onDragStart(d)},onDragEnd:function(d){c._onDragEnd(d)},onDragEnter:function(d){c._onDragEnter(d)},onDragOver:function(d){c._onDragOver(d)},onDrop:function(d){c._onDrop(d)},onDestroy:function(d){c._onDestroy(d)}};k.addEventListener("DragStart",this._listener.onDragStart);k.addEventListener("DragEnd", |
| this._listener.onDragEnd);k.addEventListener("DragEnter",this._listener.onDragEnter);k.addEventListener("DragOver",this._listener.onDragOver);k.addEventListener("Drop",this._listener.onDrop);k.addEventListener("Destroy",this._listener.onDestroy)}m.prototype={destroy:function(){var k=this._view;if(k)k.removeEventListener("DragStart",this._listener.onDragStart),k.removeEventListener("DragEnd",this._listener.onDragEnd),k.removeEventListener("DragEnter",this._listener.onDragEnter),k.removeEventListener("DragOver", |
| this._listener.onDragOver),k.removeEventListener("Drop",this._listener.onDrop),k.removeEventListener("Destroy",this._listener.onDestroy),this._view=null},_onDestroy:function(){this.destroy()},_onDragStart:function(k){var i=this._view,c=i.getSelection(),i=i.getModel();if(i.getBaseModel)c.start=i.mapOffset(c.start),c.end=i.mapOffset(c.end),i=i.getBaseModel();if(i=i.getText(c.start,c.end))this._dragSelection=c,k.event.dataTransfer.effectAllowed="copyMove",k.event.dataTransfer.setData("Text",i)},_onDragEnd:function(m){if(this._dragSelection){var i= |
| this._view,c=m.event.dataTransfer.dropEffect;if(!k.isFirefox&&(c!=="none"||this._dropText))c=m.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(m=c==="move")&&i.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var c=this._dropText,d=this._dropOffset;if(m)if(d>=this._dragSelection.end)d-=this._dragSelection.end-this._dragSelection.start;else if(d>=this._dragSelection.start)d=this._dragSelection.start;i.setText(c, |
| d,d);i.setSelection(d,d+c.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(k){this._onDragOver(k)},_onDragOver:function(m){var i=m.event.dataTransfer.types,c=!this._view.getOptions("readonly");c&&i&&(c=i.contains?i.contains("text/plain")||i.contains("Text"):i.indexOf("text/plain")!==-1||i.indexOf("Text")!==-1);if(c){if(!k.isFirefox)this._dropEffect=m.event.dataTransfer.dropEffect=(k.isMac?m.event.altKey: |
| m.event.ctrlKey)?"copy":"move"}else m.event.dataTransfer.dropEffect="none"},_onDrop:function(m){var i=this._view,c=m.event.dataTransfer.getData("Text");if(c){if(!k.isFirefox)m.event.dataTransfer.dropEffect=this._dropEffect;m=i.getOffsetAtLocation(m.x,m.y);this._dragSelection?(this._dropOffset=m,this._dropText=c):(i.setText(c,m,m),i.setSelection(m,m+c.length))}}};return{TextDND:m}}); |
| define("orion/objects",[],function(){function k(k){for(var n=1;n<arguments.length;n++){var i=arguments[n],c;for(c in i)Object.prototype.hasOwnProperty.call(i,c)&&(k[c]=i[c])}return k}return{clone:function(m){if(Array.isArray(m))return Array.prototype.slice.call(m);var n=Object.create(Object.getPrototypeOf(m));k(n,m);return n},mixin:k,toArray:function(k){return Array.isArray(k)?k:[k]}}}); |
| define("orion/editor/editor","i18n!orion/editor/nls/messages,orion/editor/eventTarget,orion/editor/tooltip,orion/editor/annotations,orion/objects,orion/util".split(","),function(k,m,n,i,c,d){function f(b){b=b||{};this._domNode=b.domNode;this._model=b.model;this._undoStack=b.undoStack;this._statusReporter=b.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 g(b){b=b||{};f.call(this,b);this._textViewFactory=b.textViewFactory;this._undoStackFactory=b.undoStackFactory;this._textDNDFactory=b.textDNDFactory;this._annotationFactory=b.annotationFactory;this._foldingRulerFactory=b.foldingRulerFactory;this._lineNumberRulerFactory=b.lineNumberRulerFactory;this._contentAssistFactory=b.contentAssistFactory;this._keyBindingFactory=b.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel= |
| this._annotationStyler=null}var h=i.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(b,a){return this.getModel().getText(b,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(b){return this.dispatchEvent(b)},onInputChanged:function(b){return this.dispatchEvent(b)},onChanged:function(){this.checkDirty()},reportStatus:function(b,a,e){this._statusReporter&&this._statusReporter(b,a,e)},resize:function(){},setDirty:function(b){if(this._dirty!==b)this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"})}, |
| _setModelText:function(b){this._model&&this._model.setText(b)},setInput:function(b,a,e,c){this._title=b;c||(a?this.reportStatus(a,"error"):e!==null&&e!==void 0&&typeof e==="string"&&this._setModelText(e),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:b,message:a,contents:e,contentsSaved:c})},setText:function(b,a,e){this.getModel().setText(b,a,e)},uninstall:function(){this.installed=!1}};m.EventTarget.addMixin(f.prototype);g.prototype=new f; |
| c.mixin(g.prototype,{destroy:function(){f.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=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},getModel:function(){if(!this._textView)return null;var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},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(b,a){if(this._annotationRulerVisible!==b||a)if(this._annotationRulerVisible=b,this._annotationRuler){var e=this._textView;b?e.addRuler(this._annotationRuler,0):e.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b,a){if(this._foldingRulerVisible!==b||a)if(this._foldingRulerVisible= |
| b,this._foldingRuler){var e=this._textView;e.getModel().getBaseModel&&(b?e.addRuler(this._foldingRuler):e.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(b,a){if(this._lineNumberRulerVisible!==b||a)if(this._lineNumberRulerVisible=b,this._lineNumberRuler){var e=this._textView;b?e.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):e.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b,a){if(this._overviewRulerVisible!==b||a)if(this._overviewRulerVisible= |
| b,this._overviewRuler){var e=this._textView;b?e.addRuler(this._overviewRuler):e.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var e=this._textView.getModel();e.getBaseModel&&(b=e.mapOffset(b,a));return b},getLineAtOffset:function(b){return this.getModel().getLineAtOffset(this.mapOffset(b))},getLineStart:function(b){return this.getModel().getLineStart(b)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var b=this._textView,a=b.getSelection(), |
| b=b.getModel();if(b.getBaseModel)a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end);return a},_expandOffset:function(b){var a=this._textView.getModel(),e=this._annotationModel;if(e&&a.getBaseModel)for(b=e.getAnnotations(b,b+1);b.hasNext();)a=b.next(),a.type===h.ANNOTATION_FOLDING&&a.expand&&a.expand()},setCaretOffset:function(b,a,e){var c=this._textView,d=c.getModel();d.getBaseModel&&(this._expandOffset(b),b=d.mapOffset(b,!0));c.setCaretOffset(b,a,e)},setText:function(b,a,e){var c=this._textView, |
| d=c.getModel();d.getBaseModel&&(a!==void 0&&(this._expandOffset(a),a=d.mapOffset(a,!0)),e!==void 0&&(this._expandOffset(e),e=d.mapOffset(e,!0)));c.setText(b,a,e)},setSelection:function(b,a,e,c){var d=this._textView,f=d.getModel();f.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=f.mapOffset(b,!0),a=f.mapOffset(a,!0));d.setSelection(b,a,e,c)},moveSelection:function(b,a,e,c){var d=this._textView;this.setSelection(b,a||b,1/3,function(){(c===void 0||c)&&d.focus();e&&e()})},_getTooltipInfo:function(b, |
| a){var e=this._textView,c=this.getAnnotationModel();if(!c)return null;var d=this._annotationStyler;if(!d)return null;var f=e.getOffsetAtLocation(b,a);if(f===-1)return null;f=this.mapOffset(f);d=d.getAnnotationsByType(c,f,f+1);c=[];for(f=0;f<d.length;f++)d[f].rangeStyle&&c.push(d[f]);if(c.length===0)return null;e=e.convert({x:b,y:a},"document","page");return{contents:c,anchor:"left",x:e.x+10,y:e.y+20}},_highlightCurrentLine:function(b,a){var e=this._annotationModel;if(e){var c=this._textView;if(!c.getOptions("singleMode")){var d= |
| c.getModel(),f=a?d.getLineAtOffset(a.start):-1,g=d.getLineAtOffset(b.start),c=b.start===b.end,p=!a||a.start===a.end,i=d.getLineStart(g),k=d.getLineEnd(g);d.getBaseModel&&(i=d.mapOffset(i),k=d.mapOffset(k));d=this._currentLineAnnotation;if(!(f===g&&p&&c&&d&&d.start===i&&d.end===k)){var f=d?[d]:null,s;c&&(d=h.createAnnotation(h.ANNOTATION_CURRENT_LINE,i,k),s=[d]);this._currentLineAnnotation=d;e.replaceAnnotations(f,s)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView= |
| this._textViewFactory();if(this._undoStackFactory)this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty();if(this._textDNDFactory)this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack);if(this._contentAssistFactory)this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist();var b=this,a=this._textView,e=this;this._listener={onModelChanged:function(){e.checkDirty()},onMouseOver:function(a){e._listener.onMouseMove(a)},onMouseMove:function(b){var c= |
| n.Tooltip.getTooltip(a);if(c&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY))e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY,c.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return e._getTooltipInfo(this.x,this.y)}})},onMouseOut:function(b){var c=n.Tooltip.getTooltip(a);if(c&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY))e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY, |
| c.setTarget(null)},onScroll:function(){var b=n.Tooltip.getTooltip(a);b&&b.setTarget(null,0,0)},onSelection:function(a){e._updateCursorStatus();e._highlightCurrentLine(a.newValue,a.oldValue)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("MouseOver",this._listener.onMouseOver);a.addEventListener("MouseOut",this._listener.onMouseOut);a.addEventListener("MouseMove",this._listener.onMouseMove);a.addEventListener("Scroll", |
| this._listener.onScroll);if(this._keyBindingFactory){var c;if(c=typeof this._keyBindingFactory==="function"?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(b,this._undoStack,this._contentAssist))this._textActions=c.textActions,this._linkedMode=c.linkedMode,this._sourceCodeActions=c.sourceCodeActions}c=function(a){if(a!==void 0&&a!==-1){for(var e=this.getView().getModel(),c=this.getAnnotationModel(),d=b.mapOffset(e.getLineStart(a)), |
| a=b.mapOffset(e.getLineEnd(a)),e=c.getAnnotations(d,a),f=null;e.hasNext();){var l=e.next();if(l.type===h.ANNOTATION_BOOKMARK){f=l;break}}f?c.removeAnnotation(f):(f=h.createAnnotation(h.ANNOTATION_BOOKMARK,d,a),f.title=void 0,c.addAnnotation(f))}};if(this._annotationFactory){var d=a.getModel();d.getBaseModel&&(d=d.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(d))if(d=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))d.addAnnotationType(h.ANNOTATION_CURRENT_SEARCH), |
| d.addAnnotationType(h.ANNOTATION_MATCHING_SEARCH),d.addAnnotationType(h.ANNOTATION_ERROR),d.addAnnotationType(h.ANNOTATION_WARNING),d.addAnnotationType(h.ANNOTATION_MATCHING_BRACKET),d.addAnnotationType(h.ANNOTATION_CURRENT_BRACKET),d.addAnnotationType(h.ANNOTATION_CURRENT_LINE),d.addAnnotationType(h.ANNOTATION_READ_OCCURRENCE),d.addAnnotationType(h.ANNOTATION_WRITE_OCCURRENCE),d.addAnnotationType(h.ANNOTATION_SELECTED_LINKED_GROUP),d.addAnnotationType(h.ANNOTATION_CURRENT_LINKED_GROUP),d.addAnnotationType(h.ANNOTATION_LINKED_GROUP), |
| d.addAnnotationType("orion.annotation.highlightError");var d=this._annotationFactory.createAnnotationRulers(this._annotationModel),g=this._annotationRuler=d.annotationRuler;if(g)g.onDblClick=c,g.setMultiAnnotationOverlay({html:"<div class='annotationHTML overlay'></div>"}),g.addAnnotationType(h.ANNOTATION_ERROR),g.addAnnotationType(h.ANNOTATION_WARNING),g.addAnnotationType(h.ANNOTATION_TASK),g.addAnnotationType(h.ANNOTATION_BOOKMARK);this.setAnnotationRulerVisible(this._annotationRulerVisible||this._annotationRulerVisible=== |
| void 0,!0);if(g=this._overviewRuler=d.overviewRuler)g.addAnnotationType(h.ANNOTATION_CURRENT_SEARCH),g.addAnnotationType(h.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(h.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(h.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType(h.ANNOTATION_CURRENT_BLAME),g.addAnnotationType(h.ANNOTATION_ERROR),g.addAnnotationType(h.ANNOTATION_WARNING),g.addAnnotationType(h.ANNOTATION_TASK),g.addAnnotationType(h.ANNOTATION_BOOKMARK),g.addAnnotationType(h.ANNOTATION_MATCHING_BRACKET), |
| g.addAnnotationType(h.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(h.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||this._overviewRulerVisible===void 0,!0)}if(this._lineNumberRulerFactory)this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(h.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(h.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=c,this.setLineNumberRulerVisible(this._lineNumberRulerVisible|| |
| this._lineNumberRulerVisible===void 0,!0);if(this._foldingRulerFactory)this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(h.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||this._foldingRulerVisible===void 0,!0);this.dispatchEvent({type:"TextViewInstalled",textView:a});f.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var b=this._textView;if(b)b.destroy(), |
| this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0,this.dispatchEvent({type:"TextViewUninstalled",textView:b}),f.prototype.uninstall.call(this)},_updateCursorStatus:function(){var b= |
| this.getModel(),a=this.getCaretOffset(),e=b.getLineAtOffset(a),b=b.getLineStart(e);a-=b;for(var b=this.getKeyModes(),c=0;c<b.length;c++){var f=b[c];if(f.isActive()&&f.isStatusActive&&f.isStatusActive())return}this.reportStatus(d.formatMessage(k.lineColumn,e+1,a+1))},showAnnotations:function(b,a,e,c){var d=this._annotationModel;if(d){for(var f=[],g=[],i=d.getTextModel(),t=d.getAnnotations(),k;t.hasNext();)k=t.next(),a.indexOf(k.type)!==-1&&k.creatorID===this&&f.push(k);if(b)for(a=0;a<b.length;a++)if(k= |
| b[a]){if(e)k=e(k);else{var s;typeof k.line==="number"?(s=i.getLineStart(k.line-1),t=s+k.start-1,s=s+k.end-1):(t=k.start,s=k.end);var u=c(k);if(!u)continue;k=h.createAnnotation(u,t,s,k.description)}k.creatorID=this;g.push(k)}d.replaceAnnotations(f,g)}},showProblems:function(b){this.showAnnotations(b,[h.ANNOTATION_ERROR,h.ANNOTATION_WARNING,h.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return h.ANNOTATION_ERROR;case "warning":return h.ANNOTATION_WARNING;case "task":return h.ANNOTATION_TASK}return null})}, |
| showOccurrences:function(b){this.showAnnotations(b,[h.ANNOTATION_READ_OCCURRENCE,h.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?h.ANNOTATION_READ_OCCURRENCE:h.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(b){var a=this._blameRGB,e=this.getTextView().getOptions("parent").ownerDocument;if(!a){var f=d.createElement(e,"div");f.className="annotation blame";e.body.appendChild(f);var g=(e.defaultView||e.parentWindow).getComputedStyle(f).getPropertyValue("background-color");f.parentNode.removeChild(f); |
| var f=g.indexOf("("),q=g.indexOf(")"),g=g.substring(f+1,q);this._blameRGB=a=g.split(",").slice(0,3)}var r=function(){var a=i.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=c.mixin({},a.style);a.style.style=c.mixin({},a.style.style);a.style.style.backgroundColor="";this.groupAnnotation=a;a.blame=this.blame;a.html=this.html;a.creatorID=this.creatorID;return a},p=function(){var a=d.createElement(e,"div");a.className="tooltipTitle";var b=this.blame.Message.indexOf("\n"); |
| if(b===-1)b=this.blame.Message.length;var c=d.createElement(e,"a");c.href=this.blame.CommitLink;c.appendChild(e.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(c);a.appendChild(d.createElement(e,"br"));a.appendChild(e.createTextNode(d.formatMessage(k.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},t=this.getModel();this.showAnnotations(b,[h.ANNOTATION_BLAME,h.ANNOTATION_CURRENT_BLAME],function(b){var e=t.getLineStart(b.Start-1),d=t.getLineEnd(b.End-1,!0),e=i.AnnotationType.createAnnotation(h.ANNOTATION_BLAME, |
| e,d,p),d=a.slice(0);d.push(b.Shade);e.style=c.mixin({},e.style);e.style.style=c.mixin({},e.style.style);e.style.style.backgroundColor="rgba("+d.join()+")";e.groupId=b.Name;e.groupType=h.ANNOTATION_CURRENT_BLAME;e.createGroupAnnotation=r;e.html='<img class="annotationHTML blame" src="'+b.AuthorImage+'"/>';e.blame=b;return e})},showSelection:function(b,a,e,c,d){typeof b==="number"?(typeof a!=="number"&&(a=b),this.moveSelection(b,a)):typeof e==="number"&&(b=this.getModel().getLineStart(e-1),typeof c=== |
| "number"&&(b+=c),typeof d!=="number"&&(d=0),this.moveSelection(b,b+d))},_setModelText:function(b){this._textView&&(this._textView.setText(b),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(b,a,e,c,d){f.prototype.setInput.call(this,b,a,e,c);this._textView&&!c&&!d&&this._textView.focus()},onGotoLine:function(b,a,e,c){if(this._textView){var d=this.getModel(),b=Math.max(0,Math.min(b,d.getLineCount()-1)),f=d.getLineStart(b), |
| g=0;e===void 0&&(e=0);typeof a==="string"?(b=d.getLine(b).indexOf(a),b!==-1&&(g=b,e=g+a.length)):(g=a,a=d.getLineEnd(b)-f,g=Math.min(g,a),e=Math.min(e,a));this.moveSelection(f+g,f+e,c)}}});return{BaseEditor:f,Editor:g}}); |
| define("orion/editor/find","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/annotations,orion/regex,orion/objects,orion/util".split(","),function(k,m,n,i,c,d,f){function g(a){var b=a.getTextView();n.KeyMode.call(this,b);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";b.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));b.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this)); |
| var d=this;this._listener={onVerify:function(a){var b=d.editor,e=b.getModel(),f=b.mapOffset(a.start),b=b.mapOffset(a.end),e=e.getText(f,b);if((e=d._prefix.match(RegExp("^"+c.escape(e),"i")))&&e.length>0)d._prefix+=a.text,d._success=!0,d._status(),d.find(d._forward,!0),a.text=null},onSelection:function(){d._ignoreSelection||d.setActive(!1)}}}function h(a,b,c){if(a){this._editor=a;this._undoStack=b;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental= |
| !0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var d=this;this._listeners={onEditorFocus:function(a){d._removeCurrentAnnotation(a)}};this.setOptions(c)}}var b={};g.prototype=new n.KeyMode;d.mixin(g.prototype,{createKeyBindings:function(){var a=m.KeyBinding,b=[];b.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});b.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});b.push({actionID:"incrementalFindCancel", |
| keyBinding:new a(27)});b.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});b.push({actionID:"incrementalFind",keyBinding:new a(40)});b.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});b.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return b},find:function(a,b){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var c=this._prefix;if(c.length===0)return!1;var d=this.editor,f=d.getModel(),f=a?this._success?b?this._start:d.getCaretOffset()+ |
| 1:0:this._success?b?this._start:d.getCaretOffset():f.getCharCount()-1;if(c=d.getModel().find({string:c,start:f,reverse:!a,caseInsensitive:c.toLowerCase()===c}).next()){if(!b)this._start=f;this._ignoreSelection=this._success=!0;d.moveSelection(a?c.start:c.end,a?c.end:c.start);this._ignoreSelection=!1}else this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){if(this._active!==a)this._active=a,this._prefix= |
| "",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status()},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0, |
| a.length-1);return a.length===0?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?k.incrementalFindStr:k.incrementalFindStrNotFound:this._success?k.incrementalFindReverseStr:k.incrementalFindReverseStrNotFound;a=f.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}}); |
| b.IncrementalFind=g;h.prototype={find:function(a,b,c){this.setOptions({reverse:!a});var d=this.getFindString(),f;if(b)d=b.findString||d,f=b.count;a=this.getOptions();this.setOptions(b);b=c?this._startOffset:this.getStartOffset();if((f=this._doFind(d,b,f))&&!c)this._startOffset=f.start;this.setOptions(a);this._hideAfterFind&&this.hide();return f},getStartOffset:function(){return this._start!==void 0?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var a= |
| this._editor.getSelection(),a=this._editor.getText(a.start,a.end);this._regex&&(a=c.escape(a));return a||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""}, |
| hide:function(){this._visible=!1;if(this._savedOptions&&(this.setOptions(this._savedOptions.pop()),this._savedOptions.length===0))this._savedOptions=null;this._removeAllAnnotations();var a=this._editor.getTextView();a&&(a.removeEventListener("Focus",this._listeners.onEditorFocus),a.focus())},_processReplaceString:function(a){var b=a;if(this._regex){for(var b="",c=!1,d=this._editor.getModel().getLineDelimiter(),f=0;f<a.length;f++){var g=a.substring(f,f+1);if(c){switch(g){case "R":b+=d;break;case "r":b+= |
| "\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+g}c=!1}else g==="\\"?c=!0:b+=g}c&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,c=this._processReplaceString(this.getReplaceString()),d=b.getSelection().start;if(b=b.getModel().find({string:a,start:d,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(), |
| this._doReplace(b.start,b.end,a,c),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var b=this._editor,c=b.getTextView();b.reportStatus(k.replaceAll);var d=this._processReplaceString(this.getReplaceString()),g=this;window.setTimeout(function(){for(var h=0,i=0;;){var t=g._doFind(a,h,null,!0);if(!t)break;i++;i===1&&(c.setRedraw(!1),g.startUndo());g._doReplace(t.start,t.end,a,d);h=g.getStartOffset()}i> |
| 0&&(g.endUndo(),c.setRedraw(!0));h>0?b.reportStatus(f.formatMessage(k.replacedMatches,i)):b.reportStatus(k.nothingReplaced,"error");g._replacingAll=!1},100)}},setOptions:function(a){if(a){if((a.showAll===!0||a.showAll===!1)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(i.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(a.caseInsensitive===!0||a.caseInsensitive===!1)this._caseInsensitive= |
| a.caseInsensitive;if(a.wrap===!0||a.wrap===!1)this._wrap=a.wrap;if(a.wholeWord===!0||a.wholeWord===!1)this._wholeWord=a.wholeWord;if(a.incremental===!0||a.incremental===!1)this._incremental=a.incremental;if(a.regex===!0||a.regex===!1)this._regex=a.regex;if(a.findAfterReplace===!0||a.findAfterReplace===!1)this._findAfterReplace=a.findAfterReplace;if(a.hideAfterFind===!0||a.hideAfterFind===!1)this._hideAfterFind=a.hideAfterFind;if(a.reverse===!0||a.reverse===!1)this._reverse=a.reverse;if(a.hasOwnProperty("findCallback"))this._findCallback= |
| a.findCallback;if(a.hasOwnProperty("start"))this._start=a.start;if(a.hasOwnProperty("end"))this._end=a.end}},show:function(a){this._visible=!0;if(a){if(!this._savedOptions)this._savedOptions=[];this._savedOptions.push(this.getOptions());this.setOptions(a)}this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var b=this;window.setTimeout(function(){b._incremental&&b.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&& |
| this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(a,b,c){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:c?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,c,d){var c=c||1,f=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var g,h;if(this._regex)try{h=this._find(a,b,d)}catch(t){f.reportStatus(t.message, |
| "error");return}else h=this._find(a,b,d);for(a=0;a<c&&h.hasNext();a++)g=h.next();if(!this._replacingAll){g?this._editor.reportStatus(""):this._editor.reportStatus(k.notFound,"error");if(this.isVisible()){c=i.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(h=f.getAnnotationModel())h.removeAnnotations(c),g&&h.addAnnotation(i.AnnotationType.createAnnotation(c,g.start,g.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var v=this;this._timer=window.setTimeout(function(){v._markAllOccurrences(); |
| v._timer=null},500)}}this._findCallback?this._findCallback(g):g&&f.moveSelection(g.start,g.end,null,!1)}return g},_doReplace:function(a,b,c,d){var f=this._editor;if(this._regex&&(d=f.getText(a,b).replace(RegExp(c,this._caseInsensitive?"i":""),d),!d))return;f.setText(d,a,b);f.setSelection(a,a+d.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=i.AnnotationType.ANNOTATION_MATCHING_SEARCH,c=a.getAnnotations(),d=[],f;c.hasNext();){var g=c.next();g.type=== |
| b&&d.push(g)}if(this.isVisible()){c=this.getFindString();c=this._editor.getModel().find({string:c,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(f=[];c.hasNext();)g=c.next(),f.push(i.AnnotationType.createAnnotation(b,g.start,g.end))}a.replaceAnnotations(d,f)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(i.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(i.AnnotationType.ANNOTATION_MATCHING_SEARCH))}, |
| _removeCurrentAnnotation:function(){var a=this._editor.getAnnotationModel();a&&a.removeAnnotations(i.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};b.Find=h;return b}); |
| define("orion/editor/actions","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/annotations,orion/editor/tooltip,orion/editor/find,orion/util".split(","),function(k,m,n,i,c,d){function f(a,b,d){this.editor=a;this.undoStack=b;this._incrementalFind=new c.IncrementalFind(a);this._find=d?d:new c.Find(a,b);this._lastEditLocation=null;this.init()}function g(a,b,c,d){this.editor=a;this.undoStack=b;this.contentAssist=c;this.linkedMode=d;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied", |
| this.contentAssistProposalApplied.bind(this));this.init()}var h=n.AnnotationType,b={};f.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){if(this.editor.isDirty())this._lastEditLocation=a.start+a.addedCharCount}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(a){if(this.undoStack){var b=1;if(a&&a.count)b=a.count;for(;b>0;)this.undoStack.undo(),--b;return!0}return!1}.bind(this), |
| {name:k.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;if(a&&a.count)b=a.count;for(;b>0;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:k.redo});a.setKeyBinding(new m.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(k.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:k.find});a.setKeyBinding(new m.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find? |
| (this._find.find(!0,a),!0):!1}.bind(this),{name:k.findNext});a.setKeyBinding(new m.KeyBinding("k",!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:k.findPrevious});a.setKeyBinding(new m.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:k.incrementalFind});a.setKeyBinding(new m.KeyBinding("j",!0,!0),"incrementalFindReverse"); |
| a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:k.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:k.unindentLines});a.setKeyBinding(new m.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:k.moveLinesUp});a.setKeyBinding(new m.KeyBinding(40, |
| !1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:k.moveLinesDown});a.setKeyBinding(new m.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:k.copyLinesUp});a.setKeyBinding(new m.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:k.copyLinesDown});a.setKeyBinding(new m.KeyBinding("d",!0,!1,!1), |
| "deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:k.deleteLines});a.setKeyBinding(new m.KeyBinding("l",!d.isMac,!1,!1,d.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:k.gotoLine});a.setKeyBinding(new m.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:k.nextAnnotation});a.setKeyBinding(new m.KeyBinding(188,!0),"previousAnnotation"); |
| a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:k.prevAnnotation});a.setKeyBinding(new m.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:k.expand});a.setKeyBinding(new m.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:k.collapse});a.setKeyBinding(new m.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll", |
| function(){return this.expandAnnotations(!0)}.bind(this),{name:k.expandAll});a.setKeyBinding(new m.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:k.collapseAll});a.setKeyBinding(new m.KeyBinding("q",!d.isMac,!1,!1,d.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:k.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1; |
| var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),f=b.getLineStart(d),d=b.getLineEnd(c,!0),g=b.getLineCount(),h="",f=b.getText(f,d);c===g-1&&(f=(h=b.getLineDelimiter())+f);a.setText(f,d,d);a.setSelection(d+h.length,d+f.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),c=b.getLineAtOffset(c.end>c.start?c.end- |
| 1:c.end),d=b.getLineStart(d),f=b.getLineEnd(c,!0),g=b.getLineCount(),h="",f=b.getText(d,f);c===g-1&&(f+=h=b.getLineDelimiter());a.setText(f,d,d);a.setSelection(d,d+f.length-h.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=1;if(a&&a.count)c=a.count;var d=b.getSelection(),f=b.getModel(),g=f.getLineAtOffset(d.start),a=f.getLineStart(g),c=d.start!==d.end||c===1?f.getLineAtOffset(d.end>d.start?d.end-1:d.end):Math.min(g+c-1,f.getLineCount()- |
| 1),c=f.getLineEnd(c,!0);b.setText("",a,c);return!0},expandAnnotation:function(a){var b=this.editor,c=b.getAnnotationModel();if(!c)return!0;var d=b.getModel(),f=b.getCaretOffset(),g=d.getLineAtOffset(f),f=d.getLineStart(g),g=d.getLineEnd(g,!0);d.getBaseModel&&(f=d.mapOffset(f),g=d.mapOffset(g),d.getBaseModel());for(var h,c=c.getAnnotations(f,g);!h&&c.hasNext();)d=c.next(),d.type===n.AnnotationType.ANNOTATION_FOLDING&&(h=d);h&&a!==h.expanded&&(a?h.expand():(b.setCaretOffset(h.start),h.collapse())); |
| return!0},expandAnnotations:function(a){var b=this.editor,c=b.getTextView(),d=b.getAnnotationModel();if(!d)return!0;b.getModel();d=d.getAnnotations();for(c.setRedraw(!1);d.hasNext();)b=d.next(),b.type===n.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());c.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var c=a.getModel(),d=a.getSelection(),f=c.getLineAtOffset(d.start), |
| g=c.getLineAtOffset(d.end>d.start?d.end-1:d.end);if(f!==g){var h=[];h.push("");for(var i=f;i<=g;i++)h.push(c.getLine(i,!0));i=c.getLineStart(f);c=c.getLineEnd(g,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(h.join(b),i,c);a.setSelection(i===d.start?d.start:d.start+b.length,d.end+(g-f+1)*b.length);return!0}return!1}},gotoLastEdit:function(){typeof this._lastEditLocation==="number"&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a= |
| this.editor,b=a.getModel().getLineAtOffset(a.getCaretOffset());if(b=prompt(k.gotoLinePrompty,b+1))b=parseInt(b,10),a.onGotoLine(b-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start),f=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),g=b.getLineCount();if(f===g-1)return!0;var d=b.getLineStart(d),c=b.getLineEnd(f,!0),h=b.getLineEnd(f+1,!0)-(c-d),i=0;f!==g-2?b=b.getText(d,c):(f=b.getLineEnd(f), |
| b=b.getText(f,c)+b.getText(d,f),i+=c-f);this.startUndo();a.setText("",d,c);a.setText(b,h,h);a.setSelection(h+i,h+i+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start);if(d===0)return!0;var f=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),g=b.getLineCount(),c=b.getLineStart(d-1),h=b.getLineStart(d),i=b.getLineEnd(f,!0),k=b.getText(h,i),s=0;f===g-1&&(f=b.getLineEnd(d- |
| 1),d=b.getLineEnd(d-1,!0),k+=b.getText(f,d),h=f,s=d-f);this.startUndo();a.setText("",h,i);a.setText(k,c,c);a.setSelection(c,c+k.length-s);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===h.ANNOTATION_MATCHING_BRACKET||a.type===h.ANNOTATION_CURRENT_BRACKET||!f.isAnnotationTypeVisible(a.type)}var c=this.editor,d=c.getAnnotationModel();if(!d)return!0;var f=c.getOverviewRuler()||c.getAnnotationStyler();if(!f)return!0;for(var g=c.getModel(),p=c.getCaretOffset(), |
| t=d.getAnnotations(a?p:0,a?g.getCharCount():p),k=null;t.hasNext();){var s=t.next();if(a){if(s.start<=p)continue}else if(s.start>=p)continue;if(!b(s)&&(k=s,a))break}if(k){for(var u=[k],t=d.getAnnotations(k.start,k.start);t.hasNext();)s=t.next(),s!==k&&!b(s)&&u.push(s);var j=c.getTextView(),m=g.getLineAtOffset(k.start),n=i.Tooltip.getTooltip(j);if(!n)return c.moveSelection(k.start),!0;c.moveSelection(k.start,k.start,function(){n.setTarget({getTooltipInfo:function(){var a=j.convert({x:j.getLocationAtOffset(k.start).x, |
| y:j.getLocationAtOffset(g.getLineStart(m)).y},"document","page");return{contents:u,x:a.x,y:a.y+Math.floor(j.getLineHeight(m)*1.33)}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var c=a.getModel(),d=a.getSelection(),f=c.getLineAtOffset(d.start),g=c.getLineAtOffset(d.end>d.start?d.end-1:d.end),h=b.getOptions("tabSize"),i=Array(h+1).join(" "),k=[],s=b=0,u=f;u<=g;u++){var j=c.getLine(u,!0);if(c.getLineStart(u)!== |
| c.getLineEnd(u))if(j.indexOf("\t")===0)j=j.substring(1),b++;else if(j.indexOf(i)===0)j=j.substring(h),b+=h;else return!0;u===f&&(s=b);k.push(j)}f=c.getLineStart(f);h=c.getLineEnd(g,!0);c=c.getLineStart(g);a.setText(k.join(""),f,h);g=f===d.start?d.start:d.start-s;d=Math.max(g,d.end-b+(d.end===c+1&&d.start!==d.end?1:0));a.setSelection(g,d);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};b.TextActions= |
| f;g.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 m.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:k.trimTrailingWhitespaces});a.setKeyBinding(new m.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment", |
| function(){return this.toggleLineComment()}.bind(this),{name:k.toggleLineComment});a.setKeyBinding(new m.KeyBinding(191,!0,!d.isMac,!1,d.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:k.addBlockComment});a.setKeyBinding(new m.KeyBinding(220,!0,!d.isMac,!1,d.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:k.removeBlockComment});a.setKeyBinding(new m.KeyBinding("[", |
| !1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new m.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new m.KeyBinding("<",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("<",">")}.bind(this)); |
| a.setKeyBinding(new m.KeyBinding(">",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket(">")}.bind(this));a.setKeyBinding(new m.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new m.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",function(){return this.skipClosingBracket(")")}.bind(this)); |
| a.setKeyBinding(new m.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new m.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new m.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",function(){return this.autoPairQuotations("'")}.bind(this)); |
| a.setKeyBinding(new m.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,b=a.getTextView();if(b.getOptions("readonly"))return!1;var c=a.getSelection();if(c.start===c.end){for(var d=a.getModel(),f=d.getLineAtOffset(c.start),g=d.getLine(f,!1),h=d.getLineStart(f),i=0,k=c.start- |
| h,s;i<k&&((s=g.charCodeAt(i))===32||s===9);)i++;var h=g.substring(0,i),b=b.getOptions("tabSize","expandTab"),u=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=d.getLineDelimiter(),j=/^[\s]*\/\*[\*]*[\s]*$/,m=/^[\s]*\*/,n=/\*\/[\s]*$/,D=g.substring(0,k),y=g.substring(k),K;if(this.smartIndentation&&g.charCodeAt(K=D.trimRight().length-1)===123)return d=k-K-1,y=y.length-y.trimLeft().length,g=g.charCodeAt(k+y)===125?b+h+u+b+h:b+h+u,a.setText(g,c.start-d,c.end+y),a.setCaretOffset(c.start+b.length+h.length+ |
| u.length-d),!0;else if(this.autoCompleteComments&&!n.test(D)&&(j.test(D)||m.test(D))){if(i=j.exec(D)){g=b+h+" * ";g+=n.test(y)?y.substring(0,y.length-2).trim():y.trim();if(d.getLineCount()===f+1||!m.test(d.getLine(f+1)))g+=b+h+" */";a.setText(g,c.start,c.end+y.length);a.setCaretOffset(c.start+b.length+h.length+3);return!0}if(i=m.exec(D))for(f-=1;f>=0;f--)if(i=d.getLine(f,!1),j.test(i))return n.test(y)||g.charCodeAt(k)===47?(g=b+h+"*"+y,h=c.start+b.length+h.length+1):(g=b+h+"* "+y,h=c.start+b.length+ |
| h.length+2),a.setText(g,c.start,c.end+y.length),a.setCaretOffset(h),!0;else if(!m.test(i))break}else if(n.test(D)&&h.charCodeAt(h.length-1)===32)return g=b+h.substring(0,h.length-1),a.setText(g,c.start,c.end),a.setCaretOffset(c.start+g.length),!0;else if(i>0){for(i=k;i<g.length&&((s=g.charCodeAt(i++))===32||s===9);)c.end++;a.setText(d.getLineDelimiter()+h,c.start,c.end);return!0}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(), |
| c=a.getSelection(),d=this._findEnclosingComment(b,c.start,c.end);if(d.commentStart!==void 0&&d.commentEnd!==void 0)return!0;b=b.getText(c.start,c.end);if(b.length===0)return!0;var d=b.length,b=b.replace(/\/\*|\*\//g,""),f=b.length;a.setText("/*"+b+"*/",c.start,c.end);a.setSelection(c.start+2,c.end+2+(f-d));return!0},autoPairBrackets:function(a,b){if(a==="["&&!this.autoPairSquareBrackets)return!1;else if(a==="{"&&!this.autoPairBraces)return!1;else if(a==="("&&!this.autoPairParentheses)return!1;else if(a=== |
| "<"&&!this.autoPairAngleBrackets)return!1;var c=this.editor;if(c.getTextView().getOptions("readonly"))return!1;var d=c.getSelection(),f=c.getModel(),g=c.getCaretOffset()===f.getCharCount()?"":f.getText(d.start,d.start+1).trim(),h=/^$|[)}\]>]/;if(d.start===d.end&&h.test(g))return c.setText(a+b,d.start,d.start),c.setCaretOffset(d.start+1),!0;else if(d.start!==d.end)return f=f.getText(d.start,d.end),c.setText(a+f+b,d.start,d.end),c.setSelection(d.start+1,d.end+1),!0;return!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1; |
| var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel(),f=b.getCaretOffset(),g=f===0?"":d.getText(c.start-1,c.start).trim(),h=f===d.getCharCount()?"":d.getText(c.start,c.start+1).trim(),f=/^"$|^'$/,i=/\w/,k=/^$|[)}\]>]/;if(c.start!==c.end){d=d.getText(c.start,c.end);if(f.test(d))return!1;b.setText(a+d+a,c.start,c.end);b.setSelection(c.start+1,c.end+1)}else if(h===a)b.setCaretOffset(c.start+1);else if(g===a||f.test(h)||i.test(g)||!k.test(h))return!1; |
| else b.setText(a+a,c.start,c.start),b.setCaretOffset(c.start+1);return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&a.positions.length>0&&this.linkedMode){for(var b=[],c=0;c<a.positions.length;++c)b[c]={positions:[{offset:a.positions[c].offset,length:a.positions[c].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&a.groups.length>0&&this.linkedMode?this.linkedMode.enterLinkedMode({groups:a.groups,escapePosition:a.escapePosition}): |
| a.escapePosition&&this.editor.getTextView().setCaretOffset(a.escapePosition);return!0},deletePrevious:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getSelection();if(b.start!==b.end)return!1;var c=a.getModel(),d=a.getCaretOffset(),f=d===0?"":c.getText(b.start-1,b.start),c=d===c.getCharCount()?"":c.getText(b.start,b.start+1);(f==="("&&c===")"||f==="["&&c==="]"||f==="{"&&c==="}"||f==="<"&&c===">"||f==='"'&&c==='"'||f==="'"&&c==="'")&&a.setText("",b.start,b.start+ |
| 1);return!1},_findEnclosingComment:function(a,b,c){var d=a.getLineAtOffset(b),f=a.getLineAtOffset(c),g,h,i,k,s,u;for(g=d;g>=0;g--)if(h=a.getLine(g),i=g===d?b-a.getLineStart(d):h.length,k=h.lastIndexOf("/*",i),h=h.lastIndexOf("*/",i),h>k)break;else if(k!==-1){s=a.getLineStart(g)+k;break}for(g=f;g<a.getLineCount();g++)if(h=a.getLine(g),i=g===f?c-a.getLineStart(f):0,k=h.indexOf("/*",i),h=h.indexOf("*/",i),k!==-1&&k<h)break;else if(h!==-1){u=a.getLineStart(g)+h;break}return{commentStart:s,commentEnd:u}}, |
| lineStart:function(){for(var a=this.editor,b=a.getModel(),c=a.getCaretOffset(),d=b.getLineAtOffset(c),f=b.getLineStart(d),b=b.getLine(d),d=0;d<b.length;d++){var g=b.charCodeAt(d);if(!(g===32||g===9))break}d+=f;return c!==d?(a.setSelection(d,d),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),c=a.getSelection(),d=b.getText(c.start,c.end),f,g,h;for(h=0;h<d.length;h++)if(d.substring(h,h+2)==="/*"){f=c.start+h;break}for(;h<d.length;h++)if(d.substring(h, |
| h+2)==="*/"){g=c.start+h;break}if(f!==void 0&&g!==void 0)a.setText(b.getText(f+2,g),f,g+2),a.setSelection(f,g);else{d=this._findEnclosingComment(b,c.start,c.end);if(d.commentStart===void 0||d.commentEnd===void 0)return!0;b=b.getText(d.commentStart+2,d.commentEnd);a.setText(b,d.commentStart,d.commentEnd+2);a.setSelection(c.start-2,c.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=a.getModel(),c=a.getSelection(),d=b.getLineAtOffset(c.start), |
| f=b.getLineAtOffset(c.end>c.start?c.end-1:c.end),g=!0,h=[],i,k,s=d;s<=f;s++)if(i=b.getLine(s,!0),h.push(i),!g||(k=i.indexOf("//"))===-1)g=!1;else if(k!==0){var u;for(u=0;u<k;u++)if(g=i.charCodeAt(u),!(g===32||g===9))break;g=u===k}s=b.getLineStart(d);u=b.getLineEnd(f,!0);if(g){for(g=0;g<h.length;g++)i=h[g],k=i.indexOf("//"),h[g]=i.substring(0,k)+i.substring(k+2);h=h.join("");i=b.getLineStart(f);b=s===c.start?c.start:c.start-2;c=c.end-2*(f-d+1)+(c.end===i+1?2:0)}else h.splice(0,0,""),h=h.join("//"), |
| b=s===c.start?c.start:c.start+2,c=c.end+2*(f-d+1);a.setText(h,s,u);a.setSelection(b,c);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),c=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var d=/(\s+$)/,f=b.getLineCount(),g=0;g<f;g++){var h=b.getLine(g),i=d.exec(h);if(i){var k=b.getLineStart(g),h=i[0].length,i=k+i.index;b.setText("",i,i+h);if(c.start>i)c.start=Math.max(i,c.start-h);if(c.start!==c.end&&c.end>i)c.end=Math.max(i,c.end- |
| h)}}a.getUndoStack().endCompoundChange();a.getTextView().setRedraw(!0);a.setSelection(c.start,c.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var c=b.getSelection(),d=b.getModel();return(b.getCaretOffset()===d.getCharCount()?"":d.getText(c.start,c.start+1))===a?(b.setCaretOffset(c.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},setSmartIndentation:function(a){this.smartIndentation=a}};b.SourceCodeActions=g;if(!String.prototype.trimLeft)String.prototype.trimLeft= |
| function(){return this.replace(/^\s+/g,"")};if(!String.prototype.trimRight)String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")};return b}); |
| define("orion/editor/templates",[],function(){function k(k,i,c,d){this.prefix=k;this.description=i;this.template=c;this.name=d;this._parse()}function m(k,i){this._keywords=k||[];this._templates=[];this.addTemplates(i||[])}k.prototype={getProposal:function(k,i,c){var k=i-k.length,i={},d,f=c.delimiter!==void 0?c.delimiter:"\n";c.indentation&&(f+=c.indentation);for(var g=c.tab!==void 0?c.tab:"\t",h=0,b=this.variables,a=this.segments,c=[],e=0;e<a.length;e++){var l=a[e],o=b[l];if(o!==void 0)switch(l){case "${tab}":l= |
| g;break;case "${delimiter}":l=f;break;case "${cursor}":l="";d=h;break;default:var q=i[l];q||(q=i[l]={data:o.data,positions:[]});l=o.substitution;q.data&&q.data.values&&(l=q.data.values[0]);q.positions.push({offset:k+h,length:l.length})}c.push(l);h+=l.length}var f=[],r;for(r in i)i.hasOwnProperty(r)&&f.push(i[r]);c=c.join("");if(d===void 0)d=c.length;return{proposal:c,name:this.name,description:this.description,groups:f,escapePosition:k+d,style:"noemphasis"}},match:function(k){return this.prefix.indexOf(k)=== |
| 0},_parse:function(){var k=this.template,i=[],c={},d,f=0,k=k.replace(/\n/g,"${delimiter}"),k=k.replace(/\t/g,"${tab}");k.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(g,h,b){var a=g.substring(2,g.length-1),h=g,e=a,l=null,o=e.indexOf(":");o!==-1&&(e=e.substring(0,o),h="${"+e+"}",l=JSON.parse(a.substring(o+1).replace("\\}","}").trim()));(a=c[h])||(a=c[h]={});a.substitution=e;if(l)a.data=l;(d=k.substring(f,b))&&i.push(d);i.push(h);f=b+g.length;return e});(d=k.substring(f,k.length))&&i.push(d);this.segments= |
| i;this.variables=c}};m.prototype={addTemplates:function(m){for(var i=this.getTemplates(),c=0;c<m.length;c++)i.push(new k(m[c].prefix,m[c].description,m[c].template,m[c].name))},computeProposals:function(k,i,c){var d=this.getPrefix(k,i,c),f=[];this.isValid(d,k,i,c)&&(f=f.concat(this.getTemplateProposals(d,i,c)),f=f.concat(this.getKeywordProposals(d)));return f},getKeywords:function(){return this._keywords},getKeywordProposals:function(k){var i=[],c=this.getKeywords();if(c){for(var d=0;d<c.length;d++)c[d].indexOf(k)=== |
| 0&&i.push({proposal:c[d].substring(k.length),description:c[d],style:"noemphasis_keyword"});0<i.length&&i.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return i},getPrefix:function(k,i,c){return c.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(k,i,c){for(var d=[],f=this.getTemplates(),g=0;g<f.length;g++){var h=f[g];h.match(k)&&(h=h.getProposal(k,i,c),this.removePrefix(k,h),d.push(h))}0<d.length&&(d.sort(function(b, |
| a){return b.name<a.name?-1:b.name>a.name?1:0}),d.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return d},removePrefix:function(k,i){if(!(i.overwrite=i.proposal.substring(0,k.length)!==k))i.proposal=i.proposal.substring(k.length)},isValid:function(){return!0}};return{Template:k,TemplateContentAssist:m}}); |
| 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(k,m,n,i,c,d){function f(c,b,a){var e=c.getTextView();n.KeyMode.call(this,e);this.editor=c;this.undoStack=b;this.contentAssist=a;this.linkedModeModel=null;e.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));e.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1); |
| return!0}.bind(this));e.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));e.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(a.selectedGroupIndex>0?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]), |
| this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.editor.mapOffset(a.start),c=this.linkedModeModel,e,d;c;)if(e=this._getPositionChanged(c,b,b+a.removedCharCount),d=e.position,d===void 0||d.model!==c)this.exitLinkedMode(!1),c=this.linkedModeModel;else break;if(c){c=0;a=a.addedCharCount-a.removedCharCount;e=e.positions;for(var f,g=0;g<e.length;++g){f=e[g];d=f.position;var h=d.offset<=b&&b<=d.offset+d.length;h&&!f.ansestor?(d.offset+=c, |
| d.length+=a,c+=a):(d.offset+=c,f.ansestor&&h&&(d.length+=a));if(f.escape)f.model.escapePosition=d.offset}this._updateAnnotations(e)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,c=b.mapOffset(a.start),e=this.editor.mapOffset(a.end),d=this.linkedModeModel,f,g;d;)if(f=this._getPositionChanged(d,c,e),g=f.position,g===void 0||g.model!==d)this.exitLinkedMode(!1),d=this.linkedModeModel;else break;if(d){var h=this._compoundChange;h?h.owner.model===d&&h.owner.group===g.group|| |
| (this.endUndo(),this.startUndo()):this.startUndo();d.selectedGroupIndex=g.group;var h=0,i=a.text.length-(e-c);f=f.positions;var j;c-=g.position.offset;for(var k=e-g.position.offset,m=0;m<f.length;++m)if(j=f[m],e=j.position,j.oldOffset=e.offset,j.model===d&&j.group===g.group?(e.offset+=h,e.length+=i,h+=i):(e.offset+=h,j.ansestor&&(e.length+=g.count*i)),j.escape)j.model.escapePosition=e.offset;this.ignoreVerify=!0;for(m=f.length-1;m>=0;m--)j=f[m],j.model===d&&j.group===g.group&&b.setText(a.text,j.oldOffset+ |
| c,j.oldOffset+k);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var g={};f.prototype=new n.KeyMode;d.mixin(f.prototype,{createKeyBindings:function(){var c=m.KeyBinding,b=[];b.push({actionID:"linkedModeEnter",keyBinding:new c(13)});b.push({actionID:"linkedModeCancel",keyBinding:new c(27)});b.push({actionID:"linkedModeNextGroup",keyBinding:new c(9)});b.push({actionID:"linkedModePreviousGroup",keyBinding:new c(9,!1,!0)});return b},enterLinkedMode:function(c){if(!this.linkedModeModel){var b= |
| this.editor.getTextView();b.addKeyMode(this);b.addEventListener("Verify",this.linkedModeListener.onVerify);b.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(k.linkedModeEntered,null,!0)}this._sortedPositions=null;if(this.linkedModeModel)c.previousModel=this.linkedModeModel,c.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=c;this.linkedModeModel= |
| c;this.selectLinkedGroup(0)},exitLinkedMode:function(c){if(this.isActive()){if(this._compoundChange)this.endUndo(),this._compoundChange=null;this._sortedPositions=null;var b=this.linkedModeModel;this.linkedModeModel=b.previousModel;b.parentGroup=b.previousModel=void 0;if(this.linkedModeModel)this.linkedModeModel.nextModel=void 0;if(!this.linkedModeModel){var a=this.editor,e=a.getTextView();e.removeKeyMode(this);e.removeEventListener("Verify",this.linkedModeListener.onVerify);e.removeEventListener("ModelChanged", |
| this.linkedModeListener.onModelChanged);e=this.contentAssist;e.removeEventListener("Activating",this.linkedModeListener.onActivating);e.offset=void 0;this.editor.reportStatus(k.linkedModeExited,null,!0);c&&a.setCaretOffset(b.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var c=this,b=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:b,group:b.selectedGroupIndex,end:function(){c._compoundChange=null}})}},endUndo:function(){this.undoStack&& |
| this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(d){var b=this.linkedModeModel;if(b){b.selectedGroupIndex=d;var d=b.groups[d],a=d.positions[0],e=this.editor;e.setSelection(a.offset,a.offset+a.length);if(b=this.contentAssist)if(b.offset=void 0,d.data&&d.data.type==="link"&&d.data.values)(this._groupContentAssistProvider=new c.TemplateContentAssist(d.data.values)).getPrefix=function(){var b= |
| e.getSelection();return b.start===b.end&&(b=e.getCaretOffset(),a.offset<=b&&b<=a.offset+a.length)?e.getText(a.offset,b):""},b.offset=a.offset,b.deactivate(),b.activate();else if(this._groupContentAssistProvider)this._groupContentAssistProvider=null,b.deactivate()}this._updateAnnotations()},_getModelPositions:function(c,b,a){for(var e=b.groups,d=0;d<e.length;d++)for(var f=e[d].positions,g=0;g<f.length;g++){var i=f[g];a&&(i={offset:i.offset+a,length:i.length});i={index:g,group:d,count:f.length,model:b, |
| position:i};c.push(i);if(b.nextModel&&b.nextModel.parentGroup===d)i.ansestor=!0,this._getModelPositions(c,b.nextModel,(a||0)+f[g].offset-f[0].offset)}},_getSortedPositions:function(c){var b=this._sortedPositions;if(!b){for(b=[];c.previousModel;)c=c.previousModel;for(this._getModelPositions(b,c);c;)c.escapePosition!==void 0&&b.push({escape:!0,model:c,position:{offset:c.escapePosition,length:0}}),c=c.nextModel;b.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=b}return b}, |
| _getPositionChanged:function(c,b,a){for(var e,c=this._getSortedPositions(c),d=c.length-1;d>=0;d--){var f=c[d].position;if(f.offset<=b&&a<=f.offset+f.length){e=c[d];break}}return{position:e,positions:c}},_updateAnnotations:function(c){var b=this.editor.getAnnotationModel();if(b){var a=[],e=[];b.getTextModel();for(var d=b.getAnnotations(),f;d.hasNext();)switch(f=d.next(),f.type){case i.AnnotationType.ANNOTATION_LINKED_GROUP:case i.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case i.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:a.push(f)}if(d= |
| this.linkedModeModel)for(var c=c||this._getSortedPositions(d),g=0;g<c.length;g++)if(f=c[g],f.model===d){var k=i.AnnotationType.ANNOTATION_LINKED_GROUP;f.group===d.selectedGroupIndex&&(k=f.index===0?i.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:i.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);f=f.position;f=i.AnnotationType.createAnnotation(k,f.offset,f.offset+f.length,"");e.push(f)}b.replaceAnnotations(a,e)}}});g.LinkedMode=f;return g}); |
| define("orion/editor/factories","orion/editor/actions,orion/editor/undoStack,orion/editor/rulers,orion/editor/annotations,orion/editor/textDND,orion/editor/linkedMode".split(","),function(k,m,n,i,c,d){function f(){}function g(){}function h(){}function b(){}function a(){}function e(){}var l={};f.prototype={createKeyBindings:function(a,b,c,e){var e=new k.TextActions(a,b,e),f=new d.LinkedMode(a,b,c),a=new k.SourceCodeActions(a,b,c,f);return{textActions:e,linkedMode:f,sourceCodeActions:a}}};l.KeyBindingsFactory= |
| f;g.prototype={createUndoStack:function(a){a=a.getTextView();return new m.UndoStack(a,200)}};l.UndoFactory=g;h.prototype={createLineNumberRuler:function(a){return new n.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};l.LineNumberRulerFactory=h;b.prototype={createFoldingRuler:function(a){return new n.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};l.FoldingRulerFactory=b;a.prototype={createAnnotationModel:function(a){return new i.AnnotationModel(a)}, |
| createAnnotationStyler:function(a,b){return new i.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new n.AnnotationRuler(a,"left",{styleClass:"ruler annotations"}),a=new n.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};l.AnnotationFactory=a;e.prototype={createTextDND:function(a,b){return new c.TextDND(a.getTextView(),b)}};l.TextDNDFactory=e;return l}); |
| define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(k,m,n,i){return i.mixin({},k,m,n)}); |
| (function(k,m){typeof define==="function"&&define.amd?define("orion/Deferred",m):typeof exports==="object"?module.exports=m():(k.orion=k.orion||{},k.orion.Deferred=m())})(this,function(){function k(){for(var f;f=c.shift();)f();d=!1}function m(f){c.push(f);d||(d=!0,setTimeout(k,0))}function n(c){return function(){c.apply(void 0,arguments)}}function i(){function d(){for(var b;b=l.shift();){var f=b.deferred,g=e==="fulfilled"?"resolve":"reject";if(typeof b[g]==="function")try{var h=(0,b[g])(a),i=h&&(typeof h=== |
| "object"||typeof h==="function")&&h.then;if(typeof i==="function")if(h===f.promise)f.reject(new TypeError);else{var k=h.cancel;typeof k==="function"?f._protected(c).parentCancel=k.bind(h):delete f._protected(c).parentCancel;i.call(h,n(f.resolve),n(f.reject),n(f.progress))}else f.resolve(h)}catch(j){f.reject(j)}else f[g](a)}}function g(b){delete q.parentCancel;e="rejected";a=b;l.length&&m(d)}function h(b){function c(a){return function(b){t||(t=!0,a(b))}}var t=!1;delete q.parentCancel;try{var v=b&& |
| (typeof b==="object"||typeof b==="function")&&b.then;if(typeof v==="function")if(b===k)g(new TypeError);else{e="assumed";var s=b&&b.cancel;if(typeof s!=="function"){var u=new i,b=u.promise;try{v(u.resolve,u.reject,u.progress)}catch(j){u.reject(j)}s=b.cancel;v=b.then}a=b;v.call(b,c(h),c(g));q.parentCancel=s.bind(b)}else e="fulfilled",a=b,l.length&&m(d)}catch(w){c(g)(w)}}function b(){var a=q.parentCancel;if(a)delete q.parentCancel,a();else if(!e)a=Error("Cancel"),a.name="Cancel",g(a)}var a,e,l=[],k= |
| this,q={};Object.defineProperty(this,"_protected",{value:function(a){if(a!==c)throw Error("protected");return q}});this.resolve=function(a){e||h(a);return k};this.reject=function(a){e||g(a);return k};this.progress=function(a){e||l.forEach(function(b){if(b.progress)try{b.progress(a)}catch(c){}});return k.promise};this.cancel=function(){q.parentCancel?setTimeout(b,0):b();return k};this.then=function(a,b,g){a={resolve:a,reject:b,progress:g,deferred:new i};l.push(a);a.deferred._protected(c).parentCancel= |
| k.promise.cancel.bind(k);(e==="fulfilled"||e==="rejected")&&m(d);return a.deferred.promise};this.promise={then:k.then,cancel:k.cancel}}var c=[],d=!1;i.all=function(c,d){function h(b,c){l||(e[b]=c,--a===0&&k.resolve(e))}function b(a,b){if(!l){if(d)try{h(a,d(b));return}catch(c){b=c}k.reject(b)}}var a=c.length,e=[],l=!1,k=new i;k.then(void 0,function(){l=!0;c.forEach(function(a){a.cancel&&a.cancel()})});a===0?k.resolve(e):c.forEach(function(a,c){a.then(h.bind(void 0,c),b.bind(void 0,c))});return k.promise}; |
| i.when=function(c,d,h,b){var a;if(!(c&&typeof c.then==="function"))a=new i,a.resolve(c),c=a.promise;return c.then(d,h,b)};return i}); |
| define("orion/webui/littlelib",["orion/util"],function(k){function m(c,d){d||(d=document);return d.querySelectorAll(c)}function n(c){if(c.tabIndex>=0)return c;if(c.hasChildNodes())for(var d=0;d<c.childNodes.length;d++){var b=n(c.childNodes[d]);if(b)return b}return null}function i(c){if(c.tabIndex>=0)return c;if(c.hasChildNodes())for(var d=c.childNodes.length-1;d>=0;d--){var b=i(c.childNodes[d]);if(b)return b}return null}function c(f,h){if(f.nodeType===3){var b=d.exec(f.nodeValue);b&&b.length>1&&h(f, |
| b)}if(f.hasChildNodes())for(b=0;b<f.childNodes.length;b++)c(f.childNodes[b],h)}var d=/\$\{([^\}]+)\}/,f=null;return{$:function(c,d){d||(d=document);return d.querySelector(c)},$$:m,$$array:function(c,d){return Array.prototype.slice.call(m(c,d))},node:function(c){var d=c;typeof c==="string"&&(d=document.getElementById(c));return d},contains:function(c,d){if(!c||!d)return!1;if(c===d)return!0;var b=c.compareDocumentPosition(d);return Boolean(b&16)},bounds:function(c){c=c.getBoundingClientRect();return{left:c.left+ |
| document.documentElement.scrollLeft,top:c.top+document.documentElement.scrollTop,width:c.width,height:c.height}},empty:function(c){for(;c.hasChildNodes();)c.removeChild(c.firstChild)},firstTabbable:n,lastTabbable:i,stop:function(c){if(window.document.all)c.keyCode=0;c.preventDefault&&(c.preventDefault(),c.stopPropagation())},processTextNodes:function(d,f){c(d,function(b,a){b.parentNode.replaceChild(document.createTextNode(f[a[1]]||a[1]),b)})},processDOMNodes:function(d,f){c(d,function(b,a){var c= |
| f[a[1]];if(c){var d=document.createRange(),g=a.index;d.setStart(b,g);d.setEnd(b,g+a[0].length);d.deleteContents();d.insertNode(c)}})},addAutoDismiss:function(c,d){function b(a){f.forEach(function(b){var c=!1,d=b.excludeNodes.some(function(b){return document.body.contains(b)?(c=!0,b.contains(a.target)):!1});if(c&&!d)try{b.dismiss(a)}catch(f){typeof console!=="undefined"&&console&&console.error(f&&f.message)}});f=f.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})} |
| f===null&&(f=[],document.addEventListener("click",b,!0),k.isIOS&&document.addEventListener("touchend",function(a){function b(){a.target.removeEventListener("click",b)}a.touches.length===0&&a.target.addEventListener("click",b)},!1));f.push({excludeNodes:c,dismiss:d})},setFramesEnabled:function(c){for(var d=document.getElementsByTagName("iframe"),b=0;b<d.length;b++)d[b].parentNode.style.pointerEvents=c?"":"none"},removeAutoDismiss:function(c){f=f.filter(function(d){return c!==d.dismiss})},KEY:{BKSPC:8, |
| TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}}); |
| define("orion/editor/contentAssist","i18n!orion/editor/nls/messages,orion/keyBinding,orion/editor/keyModes,orion/editor/eventTarget,orion/Deferred,orion/objects,orion/editor/util,orion/util,orion/webui/littlelib".split(","),function(k,m,n,i,c,d,f,g,h){var b,a,e;function l(c){this.textView=c;this.state=b;this.resetProviderInfoArray();var d=this;this.contentAssistListener={onModelChanging:function(a){this._latestModelChangingEvent=a}.bind(this),onSelection:function(c){this.isDeactivatingChange(this._latestModelChangingEvent, |
| c)?this.setState(b):this.isActive()&&(this.state===a&&this.setState(e),this.filterProposals(c));this._latestModelChangingEvent=null}.bind(this),onScroll:function(){this.setState(b)}.bind(this)};c.setKeyBinding(g.isMac?new m.KeyBinding(" ",!1,!1,!1,!0):new m.KeyBinding(" ",!0),"contentAssist");c.setKeyBinding(g.isMac?new m.KeyBinding(" ",!1,!1,!0,!0):new m.KeyBinding(" ",!0,!1,!0),"contentAssist");c.setAction("contentAssist",function(){c.getOptions("readonly")||d.activate();return!0},{name:k.contentAssist})} |
| function o(a,b){var c=a.textView;n.KeyMode.call(this,c);this.contentAssist=a;this.widget=b;this.proposals=[];var d=this;this.contentAssist.addEventListener("ProposalsComputed",function(a){d.proposals=a.data.proposals;if(d.proposals.length===0)d.selectedIndex=-1,d.cancel();else{for(d.selectedIndex=0;d.proposals[d.selectedIndex]&&d.proposals[d.selectedIndex].unselectable;)d.selectedIndex++;if(d.proposals[d.selectedIndex]){if(d.widget){var b=!0;if(a.autoApply){for(a=d.selectedIndex+1;d.proposals[a]&& |
| d.proposals[a].unselectable;)a++;d.proposals[a]||(b=!1,d.contentAssist.apply(d.proposals[d.selectedIndex]))}b&&(d.widget.show(),d.widget.selectNode(d.selectedIndex))}}else d.selectedIndex=-1,d.cancel()}});c.setAction("contentAssistApply",function(){return this.enter()}.bind(this));c.setAction("contentAssistCancel",function(){return this.cancel()}.bind(this));c.setAction("contentAssistNextProposal",function(){return this.lineDown()}.bind(this));c.setAction("contentAssistPreviousProposal",function(){return this.lineUp()}.bind(this)); |
| c.setAction("contentAssistNextPage",function(){return this.pageDown()}.bind(this));c.setAction("contentAssistPreviousPage",function(){return this.pageUp()}.bind(this));c.setAction("contentAssistHome",function(){this.widget&&this.widget.scrollIndex(0,!0);return this.lineDown(0)}.bind(this));c.setAction("contentAssistEnd",function(){return this.lineUp(this.proposals.length-1)}.bind(this));c.setAction("contentAssistTab",function(){return this.tab()}.bind(this));this.widget&&(this.widget.setContentAssistMode(this), |
| this.widget.createAccessible())}function q(a,b){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=this.textViewListenerAdded=!1;var c=this.textView.getOptions("parent").ownerDocument;this.parentNode=typeof b==="string"?c.getElementById(b):b;if(!this.parentNode){this.parentNode=g.createElement(c,"div");this.parentNode.className="contentassist";var d=c.getElementsByTagName("body")[0];if(d)d.appendChild(this.parentNode);else throw Error("parentNode is required");}this.parentNode.addEventListener("scroll", |
| this.onScroll.bind(this));var e=this;this.textViewListener={onMouseDown:function(a){(a.event.target||a.event.srcElement).parentElement!==e.parentNode&&e.contentAssist.deactivate()}};this.contentAssist.addEventListener("Deactivating",function(){e.hide()});this.scrollListener=function(){e.isShowing&&e.position()};f.addEventListener(c,"scroll",this.scrollListener)}b=1;a=2;e=3;var r={selected:"selected",hr:"proposal-hr",emphasis:"proposal-emphasis",noemphasis:"proposal-noemphasis",noemphasis_keyword:"proposal-noemphasis-keyword", |
| noemphasis_title:"proposal-noemphasis-title",noemphasis_title_keywords:"proposal-noemphasis-title-keywords",dfault:"proposal-default"};l.prototype={apply:function(a){if(!a)return!1;var c=this.textView,d=c.getSelection(),e=this._initialCaretOffset,f=e,j=d=Math.max(d.start,d.end),g=c.getModel();g.getBaseModel&&(f=g.mapOffset(f),j=g.mapOffset(j),g=g.getBaseModel());a.overwrite&&(e=this.getPrefixStart(g,f));f={proposal:a,start:f,end:j};this.setState(b);c.setText(typeof a==="string"?a:a.proposal,e,d); |
| this.dispatchEvent({type:"ProposalApplied",data:f});return!0},activate:function(c,d){if(this.state===b)this._autoTriggered=d?!0:!1,this.setState(a,c)},deactivate:function(){this.setState(b)},getTextView:function(){return this.textView},isActive:function(){return this.state===a||this.state===e},isDeactivatingChange:function(a,b){var c=!1;b.newValue.start<this._initialCaretOffset?c=!0:a&&(c=a.removedLineCount>0||a.addedLineCount>0);return c},setState:function(c,d){var e;if(c===a)this._filterText="", |
| e="Activating",this._mode&&this._mode.setActive(!0);else if(c===b)e="Deactivating",this._mode&&this._mode.setActive(!1),this._initialCaretOffset=-1,this._filterText="";e&&this.dispatchEvent({type:e,providerInfoArray:d});this.state=c;this.onStateChange(c)},setMode:function(a){this._mode=a},onStateChange:function(c){if(c===b){if(this.listenerAdded)this._latestModelChangingEvent=null,this.textView.removeEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.removeEventListener("Scroll", |
| this.contentAssistListener.onScroll),this.textView.removeEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!1}else if(c===a){if(!this.listenerAdded)this.textView.addEventListener("ModelChanging",this.contentAssistListener.onModelChanging),this.textView.addEventListener("Scroll",this.contentAssistListener.onScroll),this.textView.addEventListener("Selection",this.contentAssistListener.onSelection),this.listenerAdded=!0;this.computeProposals()}},computeProposals:function(){var a= |
| this,b=this.textView.getCaretOffset(),c=this.textView.getSelection(),c=Math.min(c.start,c.end);this._initialCaretOffset=Math.min(b,c);this._computeProposals(this._initialCaretOffset).then(function(b){a._computedProposals=b;a.isActive()&&(b=a._flatten(b),a.dispatchEvent({type:"ProposalsComputed",data:{proposals:b},autoApply:!a._autoTriggered}))})},getPrefixStart:function(a,b){for(var c=b;c>0&&/[A-Za-z0-9_]/.test(a.getText(c-1,c));)c--;return c},handleError:function(a){typeof console!=="undefined"&& |
| (console.log("Error retrieving content assist proposals"),console.log(a&&a.stack))},_computeProposals:function(a){var b=this._providerInfoArray,e=this.textView,f=e.getSelection(),g=e.getModel(),j=a;if(g.getBaseModel)j=g.mapOffset(j),f.start=g.mapOffset(f.start),f.end=g.mapOffset(f.end),g=g.getBaseModel();for(var a=g.getLine(g.getLineAtOffset(j)),h=0;h<a.length&&/\s/.test(a.charAt(h));)h++;var h=a.substring(0,h),e=e.getOptions("tabSize","expandTab"),e=e.expandTab?Array(e.tabSize+1).join(" "):"\t", |
| i={line:a,offset:j,prefix:g.getText(this.getPrefixStart(g,j),j),selection:f,delimiter:g.getLineDelimiter(),tab:e,indentation:h},l=this,b=b.map(function(a){var a=a.provider,b;try{var e,f;if(e=a.computeContentAssist){var h=l.editorContextProvider,k=h.getEditorContext();i=d.mixin(i,h.getOptions());f=e.apply(a,[k,i])}else if(e=a.getProposals||a.computeProposals)f=e.apply(a,[g.getText(),j,i]);b=l.progress?l.progress.progress(f,"Generating content assist proposal"):f}catch(s){l.handleError(s)}return c.when(b)}); |
| return c.all(b,this.handleError)},filterProposals:function(){var a="",b=0;if(this._latestModelChangingEvent){a=this._latestModelChangingEvent.text;if(b=this._latestModelChangingEvent.removedCharCount)this._filterText=this._filterText.substring(0,this._filterText.length-b);if(a)this._filterText=this._filterText.concat(a);a=this.textView.getModel();a.getBaseModel&&(a=a.getBaseModel());var c=this.textView.getText(this.getPrefixStart(a,this._initialCaretOffset),this._initialCaretOffset),d=[];this._computedProposals.forEach(function(a){a= |
| a.filter(function(a){if(r[a.style]===r.hr||r[a.style]===r.noemphasis_title)return!0;var b="";if(a.overwrite){if(a.name)b=a.name;else if(a.proposal)b=a.proposal;else return!1;return 0===b.indexOf(c+this._filterText)}else return a.name||a.proposal?(b=!1,a.name&&(b=0===a.name.indexOf(c+this._filterText)),!b&&a.proposal&&(b=0===a.proposal.indexOf(this._filterText)),b):typeof a==="string"?0===a.indexOf(this._filterText):!1},this);a.length>0&&d.push(a)},this);d=this._removeExtraUnselectableElements(d); |
| this.dispatchEvent({type:"ProposalsComputed",data:{proposals:this._flatten(d)},autoApply:!1})}},_removeExtraUnselectableElements:function(a){return a.map(function(a){return a.filter(function(b,c){var d=!0;if(r[b.style]===r.hr)0===c||a.length-1===c?d=!1:r.hr===r[a[c-1].style]&&(d=!1);else if(r[b.style]===r.noemphasis_title){var e=a[c+1];e?r[e.style]===r.noemphasis_title&&(d=!1):d=!1}return d})})},setEditorContextProvider:function(a){this.editorContextProvider=a},_generateProviderId:function(){this._uniqueProviderIdCounter? |
| this._uniqueProviderIdCounter++:this._uniqueProviderIdCounter=0;return"ContentAssistGeneratedID_"+this._uniqueProviderIdCounter},setAutoTriggerEnabled:function(a){this._autoTriggerEnabled=a;this._updateAutoTriggerListenerState()},setProviders:function(a){this.setProviderInfoArray(a.map(function(a){return{provider:a,id:this._generateProviderId()}},this))},setProviderInfoArray:function(a){this.resetProviderInfoArray();this._providerInfoArray=a;this._charTriggersInstalled=a.some(function(a){return a.charTriggers}); |
| this._updateAutoTriggerListenerState()},resetProviderInfoArray:function(){this._providerInfoArray=[];this._charTriggersInstalled=!1;this._updateAutoTriggerListenerState()},setProgress:function(a){this.progress=a},setStyleAccessor:function(a){this._styleAccessor=a},_flatten:function(a){return a.reduce(function(a,b){var c=a;if(Array.isArray(b)&&b.length>0){var c=b,d=a;b[0].style&&0===r[b[0].style].indexOf(r.noemphasis)&&(c=a,d=b);c.length>0&&c[c.length-1].style&&r.hr!==r[c[c.length-1].style]&&(c=c.concat({proposal:"", |
| name:"",description:"---------------------------------",style:"hr",unselectable:!0}));c=c.concat(d)}return c},[])},_triggerListener:function(){if(this._styleAccessor){var a=this.textView.getCaretOffset(),b=null,c=[];if(this._charTriggersInstalled){var d=this.textView.getText(a-1,a);this._providerInfoArray.forEach(function(e){var f=e.charTriggers;if(f&&f.test(d)){var f=!1,g=e.excludedStyles;g&&(b||(b=this._styleAccessor.getStyles(a-1)),f=b.some(function(a){return g.test(a.style)}));f||c.push(e)}}, |
| this);c.length>0&&this.activate(c,!0)}}},_updateAutoTriggerListenerState:function(){if(!this._boundTriggerListener)this._boundTriggerListener=this._triggerListener.bind(this);if(this._triggerListenerInstalled){if(!this._autoTriggerEnabled||!this._charTriggersInstalled)this.textView.removeEventListener("Modify",this._boundTriggerListener),this._triggerListenerInstalled=!1}else if(this._autoTriggerEnabled&&this._charTriggersInstalled)this.textView.addEventListener("Modify",this._boundTriggerListener), |
| this._triggerListenerInstalled=!0}};i.EventTarget.addMixin(l.prototype);o.prototype=new n.KeyMode;d.mixin(o.prototype,{createKeyBindings:function(){var a=m.KeyBinding,b=[];b.push({actionID:"contentAssistApply",keyBinding:new a(13)});b.push({actionID:"contentAssistCancel",keyBinding:new a(27)});b.push({actionID:"contentAssistNextProposal",keyBinding:new a(40)});b.push({actionID:"contentAssistPreviousProposal",keyBinding:new a(38)});b.push({actionID:"contentAssistNextPage",keyBinding:new a(34)});b.push({actionID:"contentAssistPreviousPage", |
| keyBinding:new a(33)});b.push({actionID:"contentAssistHome",keyBinding:new a(h.KEY.HOME)});b.push({actionID:"contentAssistEnd",keyBinding:new a(h.KEY.END)});b.push({actionID:"contentAssistTab",keyBinding:new a(9)});return b},cancel:function(){this.getContentAssist().deactivate()},getContentAssist:function(){return this.contentAssist},getProposals:function(){return this.proposals},isActive:function(){return this.getContentAssist().isActive()},setActive:function(a){a?this.contentAssist.textView.addKeyMode(this): |
| this.contentAssist.textView.removeKeyMode(this)},lineUp:function(a,b){return this.selectNew(a,b,!1)},lineDown:function(a,b){return this.selectNew(a,b,!0)},selectNew:function(a,b,c){if(c){if(void 0===a&&(a=this.selectedIndex+1),a>=this.proposals.length)if(b)return!0;else a=0}else if(void 0===a&&(a=this.selectedIndex-1),0>a)if(b)return!0;else 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;else a=0}else if(a--, |
| 0>a)if(b)return!0;else 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)}else 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)}else 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}});q.prototype={onClick:function(a){if(!a)a=window.event;this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},onScroll:function(){this.previousCloneNode&&!this.preserveCloneThroughScroll&&(this._removeCloneNode(),this.previousSelectedNode.classList.add(r.selected)); |
| this.preserveCloneThroughScroll=!1},createDiv:function(a,b,c){var d=b.ownerDocument,e=g.createElement(d,"div");e.id="contentoption"+c;e.setAttribute("role","option");e.className=r[a.style]?r[a.style]:r.dfault;a.style==="hr"?a=g.createElement(d,"hr"):(a=this._createDisplayNode(e,a,c),e.contentAssistProposalIndex=c);e.appendChild(a);b.appendChild(e)},createAccessible:function(){var a=this._contentAssistMode,b=this;this.parentNode.addEventListener("keydown",function(c){if(!c)c=window.event;c.preventDefault&& |
| c.preventDefault();if(c.keyCode===h.KEY.ESCAPE)return a.cancel();else if(c.keyCode===h.KEY.UP)return a.lineUp();else if(c.keyCode===h.KEY.DOWN)return a.lineDown();else if(c.keyCode===h.KEY.ENTER)return a.enter();else if(c.keyCode===h.KEY.PAGEDOWN)return a.pageDown();else if(c.keyCode===h.KEY.PAGEUP)return a.pageUp();else if(c.keyCode===h.KEY.HOME)return b.scrollIndex(0,!0),a.lineDown(0);else if(c.keyCode===h.KEY.END)return a.lineUp(a.getProposals().length-1);return!1})},_createDisplayNode:function(a, |
| b,c){var d=null,e=null;if(typeof b==="string")e=b;else if(b.description&&typeof b.description==="string")if(b.name&&typeof b.name==="string"){var f=this._createNameNode(b.name);f.contentAssistProposalIndex=c;d=document.createElement("span");d.appendChild(f);f=document.createTextNode(b.description);d.appendChild(f);a.setAttribute("title",b.name+b.description)}else e=b.description;else e=b.proposal;e&&(d=this._createNameNode(e),a.setAttribute("title",e));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<a.length;b++)if(a[b].offsetTop>=this.parentNode.scrollTop)return b;return 0},getBottomIndex:function(){for(var a=this.parentNode.childNodes,b=0;b<a.length;b++){var c=a[b];if(c.offsetTop+ |
| c.offsetHeight>this.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;if(this.previousSelectedNode)this.previousSelectedNode.classList.remove(r.selected),this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode();if(-1!==a){b=this.parentNode.childNodes[a];b.classList.add(r.selected);this.parentNode.setAttribute("aria-activedescendant", |
| b.id);b.focus();if(b.offsetTop<this.parentNode.scrollTop)b.scrollIntoView(!0),this.preserveCloneThroughScroll=!0;else if(b.offsetTop+b.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight)b.scrollIntoView(!1),this.preserveCloneThroughScroll=!0;var c=h.bounds(b.firstChild||b),d=h.bounds(this.parentNode),a=window.getComputedStyle(this.parentNode),e=window.getComputedStyle(b),e=parseInt(a.paddingLeft)+parseInt(a.paddingRight)+parseInt(e.paddingLeft)+parseInt(e.paddingRight);if(c.width>= |
| d.width-e){e=parseInt(a.top);d=b.cloneNode(!0);d.classList.add("cloneProposal");d.style.top=e+b.offsetTop-this.parentNode.scrollTop+"px";d.style.left=a.left;d.setAttribute("id",d.id+"_clone");c=c.left+c.width-parseInt(document.documentElement.clientWidth);if(c>0)a=parseInt(a.left)-c,0>a&&(a=0),d.style.left=a+"px";a=document.createElement("div");a.id="clone_contentassist";a.classList.add("contentassist");a.classList.add("cloneWrapper");a.appendChild(d);a.onclick=this.parentNode.onclick;this.parentNode.parentNode.insertBefore(a, |
| this.parentNode);var f=function(a){a.contentAssistProposalIndex=b.contentAssistProposalIndex;if(a.hasChildNodes())for(var c=0;c<a.childNodes.length;c++)f(a.childNodes[c])};f(a);b.classList.remove(r.selected);this.previousCloneNode=a}}this.previousSelectedNode=b},setContentAssistMode:function(a){this._contentAssistMode=a},show:function(){var a=this._contentAssistMode.getProposals();if(a.length===0)this.hide();else{this.parentNode.innerHTML="";for(var b=0;b<a.length;b++)this.createDiv(a[b],this.parentNode, |
| b);this.position();this.parentNode.onclick=this.onClick.bind(this);this.isShowing=!0;if(!this.textViewListenerAdded)this.textView.addEventListener("MouseDown",this.textViewListener.onMouseDown),this.textViewListenerAdded=!0}},hide:function(){this.parentNode.ownerDocument.activeElement===this.parentNode&&this.textView.focus();this.parentNode.style.display="none";this.parentNode.onclick=null;this.isShowing=!1;if(this.textViewListenerAdded)this.textView.removeEventListener("MouseDown",this.textViewListener.onMouseDown), |
| this.textViewListenerAdded=!1;if(this.previousSelectedNode)this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode()},position:function(){var a=this.contentAssist,b=this.textView;if(a.offset!==void 0){var a=a.offset,c=b.getModel();c.getBaseModel&&(a=c.mapOffset(a,!0))}else a=this.textView.getCaretOffset();a=b.getLocationAtOffset(a);a.y+=b.getLineHeight();this.textView.convert(a,"document","page");this.parentNode.style.position="fixed";this.parentNode.style.left=a.x+"px";this.parentNode.style.top= |
| a.y+"px";this.parentNode.style.display="block";this.parentNode.scrollTop=0;b=this.parentNode.ownerDocument;c=b.documentElement.clientWidth;if(a.y+this.parentNode.offsetHeight>b.documentElement.clientHeight)this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px";if(a.x+this.parentNode.offsetWidth>c)this.parentNode.style.left=c-this.parentNode.offsetWidth+"px"},_removeCloneNode:function(){this.parentNode.parentNode.contains(this.previousCloneNode)&&this.parentNode.parentNode.removeChild(this.previousCloneNode); |
| this.previousCloneNode=null}};return{ContentAssist:l,ContentAssistMode:o,ContentAssistWidget:q}}); |
| define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",patterns:[{include:"#brace_open"},{include:"#brace_close"},{include:"#bracket_open"},{include:"#bracket_close"},{include:"#parenthesis_open"},{include:"#parenthesis_close"},{include:"#number_decimal"},{include:"#number_hex"},{include:"#string_doubleQuote"},{include:"#string_singleQuote"}],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:"/\\*\\*",end:"\\*/",name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\<\\S*\\>",name:"keyword.other.documentation.markup"},{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",patterns:[{include:"orion.lib"},{include:"#comment_singleLine"},{include:"#comment_block"}],repository:{comment_singleLine:{match:"//.*",name:"comment.line.double-slash",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:"/\\*",end:"\\*/",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(k){var m="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(","),k= |
| k.grammars;k.push({id:"orion.css",contentTypes:["text/css"],patterns:[{include:"orion.lib"},{include:"orion.c-like#comment_block"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+m.join("|")+")\\b",name:"keyword.control.css"},{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"},{begin:"(['\"])(?:\\\\.|[^\\\\\\1])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\\\1])*(\\1|[^\\\\]$))",name:"string.quoted.multiline.css"}], |
| repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});return{id:k[k.length-1].id,grammars:k,keywords:m}}); |
| define("orion/editor/cssContentAssist",["orion/editor/templates","orion/editor/stylers/text_css/syntax"],function(k,m){function n(a){return JSON.stringify(a).replace("}","\\}")}function i(){}for(var c={type:"link",values:"visible,hidden,scroll,auto,no-display,no-content".split(",")},d={type:"link",values:"solid,dashed,dotted,double,groove,ridge,inset,outset".split(",")},f={type:"link",values:[]},g=0;g<10;g++)f.values.push(g.toString());for(var h={type:"link",values:"black,white,red,green,blue,magenta,yellow,cyan,grey,darkred,darkgreen,darkblue,darkmagenta,darkcyan,darkyellow,darkgray,lightgray".split(",")}, |
| b=[{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:"+n(h)+"} ${style:"+n(d)+"} ${width:"+n(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:"@",description:"import - import style sheet",template:'@import "${uri}";'}],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:c},{prop:"overflow-x",values:c},{prop:"overflow-y", |
| values:c},{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:h},{prop:"border-top-color",values:h},{prop:"border-bottom-color",values:h},{prop:"border-right-color", |
| values:h},{prop:"border-left-color",values:h},{prop:"background-color",values:h},{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"]}}],g=0;g<a.length;g++)c=a[g],b.push({prefix:c.prop,description:c.prop+" - "+c.prop+" style",template:c.prop+": ${value:"+n(c.values)+"};"});a="width,height,top,bottom,left,right,min-width,min-height,max-width,max-height,margin,padding,padding-left,padding-right,padding-top,padding-bottom,margin-left,margin-top,margin-bottom,margin-right".split(",");for(g=0;g<a.length;g++)c=a[g],b.push({prefix:c,description:c+" - "+c+" pixel style",template:c+": ${value}px;"}); |
| a=["padding","margin"];for(g=0;g<a.length;g++)c=a[g],b.push({prefix:c,description:c+" - "+c+" top right bottom left style",template:c+": ${top}px ${left}px ${bottom}px ${right}px;"}),b.push({prefix:c,description:c+" - "+c+" top right,left bottom style",template:c+": ${top}px ${right_left}px ${bottom}px;"}),b.push({prefix:c,description:c+" - "+c+" top,bottom right,left style",template:c+": ${top_bottom}px ${right_left}px"});a=["border","border-top","border-bottom","border-left","border-right"];for(g= |
| 0;g<a.length;g++)c=a[g],b.push({prefix:c,description:c+" - "+c+" style",template:c+": ${width:"+n(f)+"}px ${style:"+n(d)+"} ${color:"+n(h)+"};"});i.prototype=new k.TemplateContentAssist(m.keywords,b);i.prototype.getPrefix=function(a,b){for(var c=b;c&&/[A-Za-z\-\@]/.test(a.charAt(c-1));)c--;return c?a.substring(c,b):""};return{CssContentAssistProvider:i}}); |
| define("orion/editor/htmlContentAssist",["orion/editor/templates"],function(k){function m(){}var n=new k.Template("","Simple HTML document",'<!DOCTYPE html>\n<html lang="en">\n\t<head>\n\t\t<meta charset=utf-8>\n\t\t<title>${title}</title>\n\t</head>\n\t<body>\n\t\t<h1>${header}</h1>\n\t\t<p>\n\t\t\t${cursor}\n\t\t</p>\n\t</body>\n</html>'),i=[{prefix:"<img",name:"<img>",description:" - HTML image element",template:'<img src="${cursor}" alt="${Image}"/>'},{prefix:"<a",name:"<a>",description:" - HTML anchor element", |
| template:'<a href="${cursor}"></a>'},{prefix:"<ul",name:"<ul>",description:" - HTML unordered list",template:"<ul>\n\t<li>${cursor}</li>\n</ul>"},{prefix:"<ol",name:"<ol>",description:" - HTML ordered list",template:"<ol>\n\t<li>${cursor}</li>\n</ol>"},{prefix:"<dl",name:"<dl>",description:" - HTML definition list",template:"<dl>\n\t<dt>${cursor}</dt>\n\t<dd></dd>\n</dl>"},{prefix:"<table",name:"<table>",description:" - basic HTML table",template:"<table>\n\t<tr>\n\t\t<td>${cursor}</td>\n\t</tr>\n</table>"}, |
| {prefix:"<\!--",name:"<\!-- --\>",description:" - HTML comment",template:"<\!-- ${cursor} --\>"}],c,d,f,g,h="abbr,b,button,canvas,cite,command,dd,del,dfn,dt,em,embed,font,h1,h2,h3,h4,h5,h6,i,ins,kbd,label,li,mark,meter,object,option,output,progress,q,rp,rt,samp,small,strong,sub,sup,td,time,title,tt,u,var".split(",");for(g=0;g<h.length;g++)c=h[g],f="<"+c+"></"+c+">",d="<"+c+">${cursor}</"+c+">",i.push({prefix:"<"+c,description:f,template:d});h="address,article,aside,audio,bdo,blockquote,body,caption,code,colgroup,datalist,details,div,fieldset,figure,footer,form,head,header,hgroup,iframe,legend,map,menu,nav,noframes,noscript,optgroup,p,pre,ruby,script,section,select,span,style,tbody,textarea,tfoot,th,thead,tr,video".split(","); |
| for(g=0;g<h.length;g++)c=h[g],f="<"+c+"></"+c+">",d="<"+c+">\n\t${cursor}\n</"+c+">",i.push({prefix:"<"+c,description:f,template:d});h="area,base,br,col,hr,input,link,meta,param,keygen,source".split(",");for(g=0;g<h.length;g++)c=h[g],d=f="<"+c+"/>",i.push({prefix:"<"+c,description:f,template:d});m.prototype=new k.TemplateContentAssist([],i);m.prototype.getPrefix=function(b,a){for(var c="",d=a;d&&/[A-Za-z0-9<!-]/.test(b.charAt(d-1));)if(d--,b.charAt(d)==="<"){c=b.substring(d,a);break}return c};m.prototype.computeProposals= |
| function(b,a,c){return b.length===0?[n.getProposal("",a,c)]:k.TemplateContentAssist.prototype.computeProposals.call(this,b,a,c).sort(function(a,b){var c=a.prefix||a.proposal,d=b.prefix||b.proposal;if(c){if(!d)return 1}else return-1;return c.toLowerCase().localeCompare(d.toLowerCase())})};return{HTMLContentAssistProvider:m}}); |
| define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(k){var m="break,case,class,catch,continue,const,debugger,default,delete,do,else,enum,export,extends,false,finally,for,function,if,implements,import,in,instanceof,interface,let,new,null,package,private,protected,public,return,static,super,switch,this,throw,true,try,typeof,undefined,var,void,while,with,yield".split(","),k=k.grammars;k.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{include:"orion.lib#doc_block"}, |
| {include:"orion.c-like"},{match:"\\b(?:"+m.join("|")+")\\b",name:"keyword.control.js"},{begin:"(['\"])(?:\\\\.|[^\\\\\\1])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\\\1])*(\\1|[^\\\\]$))",name:"string.quoted.multiline.js"}]});return{id:k[k.length-1].id,grammars:k,keywords:m}}); |
| define("orion/editor/jsTemplateContentAssist",["orion/editor/templates","orion/editor/stylers/application_javascript/syntax"],function(k,m){function n(){}var i=[{prefix:"if",name:"if",description:" - if statement",template:"if (${condition}) {\n\t${cursor}\n}"},{prefix:"if",name:"if",description:" - if else statement",template:"if (${condition}) {\n\t${cursor}\n} else {\n\t\n}"},{prefix:"for",name:"for",description:" - iterate over array",template:"for (var ${i}=0; ${i}<${array}.length; ${i}++) {\n\t${cursor}\n}"}, |
| {prefix:"for",name:"for",description:" - iterate over array with local var",template:"for (var ${i}=0; ${i}<${array}.length; ${i}++) {\n\tvar ${value} = ${array}[${i}];\n\t${cursor}\n}"},{prefix:"for",name:"for..in",description:" - iterate over properties of an object",template:"for (var ${property} in ${object}) {\n\tif (${object}.hasOwnProperty(${property})) {\n\t\t${cursor}\n\t}\n}"},{prefix:"while",name:"while",description:" - while loop with condition",template:"while (${condition}) {\n\t${cursor}\n}"}, |
| {prefix:"do",name:"do",description:" - do while loop with condition",template:"do {\n\t${cursor}\n} while (${condition});"},{prefix:"switch",name:"switch",description:" - switch case statement",template:"switch (${expression}) {\n\tcase ${value1}:\n\t\t${cursor}\n\t\tbreak;\n\tdefault:\n}"},{prefix:"case",name:"case",description:" - case statement",template:"case ${value}:\n\t${cursor}\n\tbreak;"},{prefix:"try",name:"try",description:" - try..catch statement",template:"try {\n\t${cursor}\n} catch (${err}) {\n}"}, |
| {prefix:"try",name:"try",description:" - try..catch statement with finally block",template:"try {\n\t${cursor}\n} catch (${err}) {\n} finally {\n}"},{prefix:"typeof",name:"typeof",description:" - typeof statement",template:'typeof ${object} === "${type:'+JSON.stringify({type:"link",values:"undefined,object,boolean,number,string,function,xml".split(",")}).replace("}","\\}")+'}"'},{prefix:"instanceof",name:"instanceof",description:" - instanceof statement",template:"${object} instanceof ${type}"},{prefix:"with", |
| name:"with",description:" - with statement",template:"with (${object}) {\n\t${cursor}\n}"},{prefix:"function",name:"function",description:" - function declaration",template:"/**\n * @name ${name}\n * @param ${parameter}\n */\nfunction ${name} (${parameter}) {\n\t${cursor}\n}"},{prefix:"function",name:"function",description:" - function expression",template:"/**\n * @name ${name}\n * @function\n * @param ${parameter}\n */\n${name}: function(${parameter}) {\n\t${cursor}\n}"},{prefix:"define",name:"define", |
| description:" - define function call",template:"/* global define */\ndefine('${name}',[\n'${import}'\n], function(${importname}) {\n\t${cursor}\n});"},{prefix:"nls",name:"nls",description:" - non NLS string",template:"${cursor} //$NON-NLS-${0}$"},{prefix:"log",name:"log",description:" - console log",template:"console.log(${object});"},{prefix:"mongodb",name:"mongodb",description:" - Node.js require statement for MongoDB",template:"var ${name} = require('mongodb');\n"},{prefix:"mongodb",name:"mongodb client", |
| description:" - create a new MongoDB client",template:"var MongoClient = require('mongodb').MongoClient;\nvar Server = require('mongodb').Server;\n${cursor}"},{prefix:"mongodb",name:"mongodb open",description:" - create a new MongoDB client and open a connection",template:"var MongoClient = require('mongodb').MongoClient;\nvar Server = require('mongodb').Server;\nvar ${client} = new MongoClient(new Server(${host}, ${port}));\ntry {\n\t${client}.open(function(error, ${client}) {\n\t\tvar ${db} = ${client}.db(${name});\n\t\t${cursor}\n\t});\n} finally {\n\t${client}.close();\n};"}, |
| {prefix:"mongodb",name:"mongodb connect",description:" - connect to an existing MongoDB database",template:"var MongoClient = require('mongodb').MongoClient;\nMongoClient.connect(${url}, function(error, db) {\n\t${cursor}\n});\n"},{prefix:"mongodb",name:"mongodb connect (Cloud Foundry)",description:" - connect to an existing MongoDB database using Cloud Foundry",template:"if (${process}.env.VCAP_SERVICES) {\n\tvar env = JSON.parse(${process}.env.VCAP_SERVICES);\n\tvar mongo = env['${mongo-version}'][0].credentials;\n} else {\n\tvar mongo = {\n\t\tusername : 'username',\n\t\tpassword : 'password',\n\t\turl : 'mongodb://username:password@localhost:27017/database'\n\t};\n}\nvar MongoClient = require('mongodb').MongoClient;\nMongoClient.connect(mongo.url, function(error, db) {\n\t${cursor}\n});\n"}, |
| {prefix:"mongodb",name:"mongodb collection",description:" - create a MongoDB database collection",template:"${db}.collection(${id}, function(${error}, collection) {\n\t${cursor}\n});"},{prefix:"mongodb",name:"mongodb strict collection",description:" - create a MongoDB database strict collection",template:"${db}.collection(${id}, {strict:true}, function(${error}, collection) {\n\t${cursor}\n});"},{prefix:"redis",name:"redis",description:" - Node.js require statement for Redis",template:"var ${name} = require('redis');\n"}, |
| {prefix:"redis",name:"redis client",description:" - create a new Redis client",template:"var ${name} = require('redis');\nvar ${client} = ${name}.createClient(${port}, ${host}, ${options});\n"},{prefix:"redis",name:"redis connect",description:" - create a new Redis client and connect",template:"var ${name} = require('redis');\nvar ${client} = ${name}.createClient(${port}, ${host}, ${options});\ntry {\n\t${cursor}\n} finally {\n\t${client}.close();\n}\n"},{prefix:"redis",name:"redis set",description:" - create a new Redis client set call", |
| template:"client.set(${key}, ${value});\n"},{prefix:"redis",name:"redis get",description:" - create a new Redis client get call",template:"client.get(${key}, function(${error}, ${reply}) {\n\t${cursor}\n});\n"},{prefix:"redis",name:"redis on",description:" - create a new Redis client event handler",template:"client.on(${event}, function(${arg}) {\n\t${cursor}});\n"},{prefix:"pg",name:"postgres",description:" - Node.js require statement for Postgres DB",template:"var pg = require('pg');\n"},{prefix:"pg", |
| name:"postgres client",description:" - create a new Postgres DB client",template:"var pg = require('pg');\nvar url = \"postgres://postgres:${port}@${host}/${database}\";\nvar ${client} = new pg.Client(url);\n"},{prefix:"pg",name:"postgres connect",description:" - create a new Postgres DB client and connect",template:"var pg = require('pg');\nvar url = \"postgres://postgres:${port}@${host}/${database}\";\nvar ${client} = new pg.Client(url);\n${client}.connect(function(error) {\n\t${cursor}\n});\n"}, |
| {prefix:"pg",name:"postgres query",description:" - create a new Postgres DB query statement",template:"${client}.query(${sql}, function(error, result) {\n\t${cursor}\n});\n"},{prefix:"mysql",name:"mysql",description:" - Node.js require statement for MySQL DB",template:"var mysql = require('mysql');\n"},{prefix:"mysql",name:"mysql connection",description:" - create a new MySQL DB connection",template:"var mysql = require('mysql');\nvar ${connection} = mysql.createConnection({\n\thost : ${host},\n\tuser : ${username},\n\tpassword : ${password}\n});\ntry {\n\t${connection}.connect();\n\t${cursor}\n} finally {\n\t${connection}.end();\n}"}, |
| {prefix:"mysql",name:"mysql query",description:" - create a new MySQL DB query statement",template:"${connection}.query(${sql}, function(error, rows, fields) {\n\t${cursor}\n});\n"},{prefix:"express",name:"express",description:" - Node.js require statement for Express",template:"var ${name} = require('express');"},{prefix:"express",name:"express app",description:" - create a new Express app",template:"var express = require('express');\nvar ${app} = express();\n${cursor}\napp.listen(${timeout});\n"}, |
| {prefix:"express",name:"express configure",description:" - create an Express app configure statement",template:"app.configure(function() {\n\tapp.set(${id}, ${value});\n});"},{prefix:"express",name:"express specific configure",description:" - create a specific Express app configure statement",template:"app.configure(${name}, function() {\n\tapp.set(${id}, ${value});\n});"},{prefix:"express",name:"express app get",description:" - create a new Express app.get call",template:"var value = app.get(${id}, function(request, result){\n\t${cursor}\n});\n"}, |
| {prefix:"express",name:"express app set",description:" - create a new Express app set call",template:"app.set(${id}, ${value});\n"},{prefix:"express",name:"express app use",description:" - create a new Express app use statement",template:"app.use(${fnOrObject});\n"},{prefix:"express",name:"express app engine",description:" - create a new Express app engine statement",template:"app.engine(${fnOrObject});\n"},{prefix:"express",name:"express app param",description:" - create a new Express app param statement", |
| template:"app.param(${id}, ${value});\n"},{prefix:"express",name:"express app error use",description:" - create a new Express app error handling use statement",template:"app.use(function(error, request, result, next) {\n\tresult.send(${code}, ${message});\n});\n"},{prefix:"amqp",name:"amqp",description:" - Node.js require statement for AMQP framework",template:"var amqp = require('amqp');\n"},{prefix:"amqp",name:"amqp connection",description:" - create a new AMQP connection ",template:"var amqp = require('amqp');\nvar ${connection} = amqp.createConnection({\n\thost: ${host},\n\tport: ${port},\n\tlogin: ${login},\n\tpassword: ${password}\n});\n"}, |
| {prefix:"amqp",name:"amqp on",description:" - create a new AMQP connection on statement",template:"${connection}.on(${event}, function() {\n\t${cursor}\n});\n"},{prefix:"amqp",name:"amqp queue",description:" - create a new AMQP connection queue statement",template:"${connection}.queue(${id}, function(queue) {\n\tqueue.bind('#'); //catch all messages\n\tqueue.subscribe(function (message, headers, deliveryInfo) {\n\t\t// Receive messages\n\t});\n\t${cursor}\n});\n"},{prefix:"amqp",name:"amqp exchange", |
| description:" - create a new AMQP connection exchange",template:"var exchange = ${connection}.exchange(${id}, {type: 'topic'}, function(exchange) {\n\t${cursor}\n});\n"}];n.prototype=new k.TemplateContentAssist(m.keywords,i);n.prototype.isValid=function(c,d,f){c=d.charAt(f-c.length-1);return!c||":!@#$^&*.?<>".indexOf(c)===-1};return{JSTemplateContentAssistProvider:n}}); |
| define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(k,m){function n(d){return d.getProperty("objectClass").indexOf(c)!==-1&&d.getProperty("type")==="highlighter"}function i(c,d,h){this.initialize(c,d,h);this.lineStyles=[]}var c="orion.edit.highlighter",d=c+" service must be an event emitter";m.AnnotationType.registerType("orion.annotation.highlightError",{title:k.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}}); |
| i.prototype={initialize:function(d,g,h){this.textView=d;this.serviceRegistry=g;this.annotationModel=h;this.services=[];var b=this;this.listener={onModelChanging:function(a){b.onModelChanging(a)},onModelChanged:function(a){b.onModelChanged(a)},onDestroy:function(a){b.onDestroy(a)},onLineStyle:function(a){b.onLineStyle(a)},onStyleReady:function(a){b.onStyleReady(a)},onServiceAdded:function(a){b.onServiceAdded(a.serviceReference,b.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){b.onServiceRemoved(a.serviceReference, |
| b.serviceRegistry.getService(a.serviceReference))}};d.addEventListener("ModelChanging",this.listener.onModelChanging);d.addEventListener("ModelChanged",this.listener.onModelChanged);d.addEventListener("Destroy",this.listener.onDestroy);d.addEventListener("LineStyle",this.listener.onLineStyle);g.addEventListener("registered",this.listener.onServiceAdded);g.addEventListener("unregistering",this.listener.onServiceRemoved);d=g.getServiceReferences(c);for(h=0;h<d.length;h++){var a=d[h];n(a)&&this.addServiceListener(g.getService(a))}}, |
| onDestroy:function(){this.destroy()},destroy:function(){if(this.textView)this.textView.removeEventListener("ModelChanging",this.listener.onModelChanging),this.textView.removeEventListener("ModelChanged",this.listener.onModelChanged),this.textView.removeEventListener("Destroy",this.listener.onDestroy),this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView=null;if(this.services){for(var c=0;c<this.services.length;c++)this.removeServiceListener(this.services[c]);this.services= |
| null}if(this.serviceRegistry)this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null;this.lineStyles=this.listener=null},onModelChanging:function(c){this.startLine=this.textView.getModel().getLineAtOffset(c.start)},onModelChanged:function(c){var d=this.startLine;(c.addedLineCount||c.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[d,c.removedLineCount].concat(this._getEmptyStyle(c.addedLineCount)))}, |
| onStyleReady:function(c){var d=c.lineStyles||c.style,c=Number.MAX_VALUE,h=-1,b=this.textView.getModel(),a;for(a in d)Object.prototype.hasOwnProperty.call(d,a)&&(this.lineStyles[a]=d[a],c=Math.min(c,a),h=Math.max(h,a));c=Math.max(c,0);h=Math.min(h,b.getLineCount());if(d=this.annotationModel){for(var e=d.getAnnotations(b.getLineStart(c),b.getLineEnd(h)),i=[];e.hasNext();){var k=e.next();k.type==="orion.annotation.highlightError"&&i.push(k)}e=[];for(k=c;k<=h;k++){a=k;var q=this.lineStyles[a],q=q&&q.errors; |
| a=b.getLineStart(a);if(q)for(var r=0;r<q.length;r++){var p=q[r];e.push(m.AnnotationType.createAnnotation("orion.annotation.highlightError",p.start+a,p.end+a))}}d.replaceAnnotations(i,e)}this.textView.redrawLines(c,h+1)},onLineStyle:function(c){function d(b,a){for(var c=b.length,f=[],g=0;g<c;g++){var h=b[g];f.push({start:h.start+a,end:h.end+a,style:h.style})}return f}var h=this.lineStyles[c.lineIndex];if(h)if(h.ranges)c.ranges=d(h.ranges,c.lineStart);else if(h.style)c.style=h.style},_getEmptyStyle:function(c){for(var d= |
| [],h=0;h<c;h++)d.push(null);return d},setContentType:function(c){this.contentType=c;if(this.services)for(c=0;c<this.services.length;c++){var d=this.services[c];if(d.setContentType){var h=this.serviceRegistry.getService("orion.page.progress");h?h.progress(d.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):d.setContentType(this.contentType)}}},onServiceAdded:function(c,d){n(c)&&this.addServiceListener(d)},onServiceRemoved:function(c, |
| d){this.services.indexOf(d)!==-1&&this.removeServiceListener(d)},addServiceListener:function(c){if(typeof c.addEventListener==="function"){if(c.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(c),c.setContentType&&this.contentType){var g=this.serviceRegistry.getService("orion.page.progress");g?g.progress(c.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):c.setContentType(this.contentType)}}else typeof console!== |
| "undefined"&&console.log(Error(d))},removeServiceListener:function(c){typeof c.removeEventListener==="function"?(c.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),c=this.services.indexOf(c),c!==-1&&this.services.splice(c,1)):typeof console!=="undefined"&&console.log(Error(d))}};return i}); |
| define("orion/editor/mirror",["i18n!orion/editor/nls/messages","orion/editor/eventTarget","orion/editor/annotations"],function(k,m,n){function i(b){this.string=b;this.tokenStart=this.pos=0}function c(){return{token:function(b){return b.skipToEnd()}}}function d(){this._modes={};this.mimeModes={};this.options={};this.StringStream=i;this.defineMode("null",c);this.defineMIME("text/plain","null")}function f(b){var a=[],c;for(c in b)Object.prototype.hasOwnProperty.call(b,c)&&a.push(c);return a}function g(b, |
| a,c){c=c||{};this.model=b;this.codeMirror=a;this.isWhitespaceVisible=typeof c.whitespacesVisible==="undefined"?!1:c.whitespacesVisible;this.mode=null;this.isModeLoaded=!1;this.lines=[];this.dirtyLines=[];this.startLine=Number.MAX_VALUE;this.endLine=-1;this.timer=null;this.initialize(b)}function h(b,a,c){this.init(b,a,c)}i.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos===0},peek:function(){return this.string[this.pos]},next:function(){return this.string[this.pos++]}, |
| eat:function(b){var a=this.string[this.pos];return typeof a==="string"&&(a===b||b.test&&b.test(a)||typeof b==="function"&&b(a))?this.string[this.pos++]:void 0},eatWhile:function(b){for(var a=!1;this.eat(b)!==void 0;)a=!0;return a},eatSpace:function(){return this.eatWhile(/\s/)},skipToEnd:function(){this.pos=this.string.length},skipTo:function(b){b=this.string.indexOf(b,this.pos);return b!==-1?(this.pos=b,!0):!1},match:function(b,a,c){a=a===!0||typeof a==="undefined";if(typeof b==="string"){var d= |
| c?this.string.toLowerCase():this.string,b=c?b.toLowerCase():b,c=d.indexOf(b,this.pos);if(c!==-1&&a)this.pos=c+b.length;return c!==-1}else return(b=this.string.substring(this.pos).match(b))&&a&&typeof b[0]==="string"&&(this.pos+=b.index+b[0].length),b},backUp:function(b){this.pos-=b},column:function(){for(var b=0,a=0;a<this.tokenStart;)b+=this.string[a++]==="\t"?4:1;return b},indentation:function(){for(var b=this.string.search(/\S/),a=0,c=0;c<b;)a+=this.string[c++]==="\t"?4:1;return a},current:function(){return this.string.substring(this.tokenStart, |
| this.pos)},advance:function(){this.tokenStart=this.pos}};d.prototype={options:{},setOption:function(b,a){this.options[b]=a},getOption:function(b){return this.options[b]},copyState:function(b,a){if(typeof b.copyState==="function")return b.copyState(a);var c={},d;for(d in a){var f=a[d];c[d]=f instanceof Array?f.slice():f}return c},startState:function(b,a){return b.startState(a)},defineMode:function(b,a){this._modes[b]=a},defineMIME:function(b,a){this.mimeModes[b]=a},getMode:function(b,a){var c={},d; |
| typeof a==="string"&&this.mimeModes[a]&&(a=this.mimeModes[a]);typeof a==="object"&&(c=a,d=this._modes[a.name]);d=d||this._modes[a];return typeof d!=="function"?(typeof console!=="undefined"&&console&&console.log("Mode not found: "+a),this.getMode(b,"null")):d(b,c)},listModes:function(){return f(this._modes)},listMIMEs:function(){return f(this.mimeModes)},_getModeName:function(b){b=this.mimeModes[b];if(typeof b==="object")b=b.name;return b}};g.prototype={initialize:function(){var b=this;this.listener= |
| {onModelChanging:function(a){b._onModelChanging(a)},onModelChanged:function(a){b._onModelChanged(a)},onDestroy:function(a){b._onDestroy(a)}};this.model.addEventListener("Changing",this.listener.onModelChanging);this.model.addEventListener("Changed",this.listener.onModelChanged);this.model.addEventListener("Destroy",this.listener.onDestroy)},destroy:function(){this.model&&(this.model.removeEventListener("Changing",this.listener.onModelChanging),this.model.removeEventListener("Changed",this.listener.onModelChanged), |
| this.model.removeEventListener("Destroy",this.listener.onDestroy));this.dirtyLines=this.lines=this.mode=this.codeMirror=this.model=null;clearTimeout(this.timer);this.timer=null},_onModelChanging:function(b){this.startLine=this.model.getLineAtOffset(b.start)},_onModelChanged:function(b){this._dbgEvent(b);var a=this.startLine;(b.removedLineCount||b.addedLineCount)&&Array.prototype.splice.apply(this.lines,[a+1,b.removedLineCount].concat(this._newLines(b.addedLineCount)));this.mode&&(b=Math.max(b.addedLineCount, |
| b.removedLineCount),b=a+Math.min(b,500),this.highlight(a,b),this.highlightLater(b+1))},_onDestroy:function(){this.destroy()},setViewportIndex:function(b){this.viewportIndex=b},_dbgEvent:function(){},_dbgStyle:function(){},_newLines:function(b){for(var a=[],c=0;c<b;c++)a.push({style:null,eolState:null});return a},setMode:function(b,a){if(b)this.mode=this.codeMirror.getMode(this.codeMirror.options,b),this.lines=this._newLines(this.model.getLineCount()),a&&this.highlight()},highlight:function(b,a,c){if(this.mode){for(var d= |
| this.model.getLineCount(),b=typeof b==="undefined"?0:b,a=typeof a==="undefined"?d-1:Math.min(a,d-1),d=this.mode,f=this.getState(b),g=b;g<=a;g++){var h=this.lines[g];this.highlightLine(g,h,f);h.eolState=this.codeMirror.copyState(d,f)}this._expandRange(b,a);if(!c)this.onHighlightDone()}},highlightLater:function(b){this.dirtyLines.push(b);var a=this;this.timer=setTimeout(function(){a._highlightJob()},50)},_highlightJob:function(){for(var b=+new Date+30,a=this.mode.compareStates,c=this.model.getLineCount();this.dirtyLines.length;){var d= |
| this.viewportIndex,f=this.lines[d],d=f&&!f.eolState?d:this.dirtyLines.pop();if(d>=c)break;this._expandRange(d,d);for(var f=this._getResumeLineIndex(d),d=f+1,f=(f=f>=0&&this.lines[f].eolState)?this.codeMirror.copyState(this.mode,f):this.mode.startState(),g=0,h=d;h<c;h++){var i=this.lines[h],k=i.eolState,m=this.highlightLine(h,i,f);i.eolState=this.codeMirror.copyState(this.mode,f);m&&this._expandRange(d,h+1);var i=a&&k&&a(k,i.eolState),s=!a&&!m&&g++>3;if(i||s)break;else if(!k||m)g=0;k=h<c||this.dirtyLines.length; |
| if(+new Date>b&&k){this.highlightLater(h+1);this.onHighlightDone();return}}}this.onHighlightDone()},onHighlightDone:function(){this.startLine!==Number.MAX_VALUE&&this.endLine!==-1&&this.dispatchEvent({type:"Highlight",start:this.startLine,end:this.endLine});this.startLine=Number.MAX_VALUE;this.endLine=-1},_getResumeLineIndex:function(b){for(var a=this.lines,c=b-1;c>=0;c--)if(a[c].eolState||b-c>40)return c;return-1},getState:function(b){var a=this.mode,c=this.lines,d,f;for(d=b-1;d>=0;d--)if(f=c[d], |
| f.eolState||b-d>40)break;var g=d>=0&&c[d].eolState;if(g){g=this.codeMirror.copyState(a,g);for(d=Math.max(0,d);d<b-1;d++)f=c[d],this.highlightLine(d,f,g),f.eolState=this.codeMirror.copyState(a,g);return g}else return a.startState()},highlightLine:function(b,a,c){if(this.mode){var d=this.model;d.getLineStart(b)===d.getLineEnd(b)&&this.mode.blankLine&&this.mode.blankLine(c);for(var f=a.style||[],b=d.getLine(b),b=new i(b),d=!a.style,g=[],h=0;!b.eol();h++){var k=this.mode.token(b,c)||null,m=b.current(); |
| this._whitespaceStyle(k,m,b.tokenStart);k=[b.tokenStart,b.pos,k];m=f[h];g.push(k);d=d||!m||m[0]!==k[0]||m[1]!==k[1]||m[2]!==k[2];b.advance()}if(d=d||g.length!==f.length)a.style=g.length?g:null;return d}},_whitespaceStyle:function(b,a,c){if(!b&&this.isWhitespaceVisible&&/\s+/.test(a)){for(var b=[],d,f,g=0;g<a.length;g++){var h=a[g];h!==f&&(f&&b.push([c+d,c+g,f==="\t"?"punctuation separator tab":"punctuation separator space"]),d=g,f=h)}b.push([c+d,c+g,f==="\t"?"punctuation separator tab":"punctuation separator space"]); |
| return b}return null},_expandRange:function(b,a){this.startLine=Math.min(this.startLine,b);this.endLine=Math.max(this.endLine,a)},toStyleRangesAndErrors:function(b,a){var c=b.style;if(!c)return null;for(var d=[],f=[],g=typeof a==="undefined"?0:this.model.getLineStart(a),h=0;h<c.length;h++){var i=c[h],k=!i[2]?null:i[2]==="punctuation separator tab"||i[2]==="punctuation separator space"?i[2]:"cm-"+i[2];k&&(i={start:g+i[0],end:g+i[1],style:{styleClass:k}},d.push(i),k==="cm-error"&&f.push(i))}return[d, |
| f]},getLineStyle:function(b){return this.lines[b]},getLineStyles:function(){return this.lines}};m.EventTarget.addMixin(g.prototype);n.AnnotationType.registerType("orion.annotation.highlightError",{title:k.syntaxError,html:"<div class='annotationHTML error'></div>",rangeStyle:{styleClass:"annotationRange error"}});h.prototype={init:function(b,a,c){this.textView=b;this.annotationModel=c;this.modeApplier=new g(b.getModel(),a);var d=this;this.listener={onLineStyle:function(a){d.onLineStyle(a)},onDestroy:function(a){d.onDestroy(a)}, |
| onHighlight:function(a){d.onHighlight(a)}};b.addEventListener("LineStyle",this.listener.onLineStyle);b.addEventListener("Destroy",this.listener.onDestroy);this.modeApplier.addEventListener("Highlight",this.listener.onHighlight)},destroy:function(){this.modeApplier&&(this.modeApplier.removeEventListener("Highlight",this.listener.onHighlight),this.modeApplier.destroy());this.textView&&(this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView.removeEventListener("Destroy", |
| this.listener.onDestroy));this.listener=this.modeApplier=this.annotationModel=this.textView=null},setMode:function(b){this.modeApplier.setMode(b)},onLineStyle:function(b){var a=b.lineIndex,c=this.modeApplier,d=c.getLineStyle(a);if(!d||!d.eolState){var f=this.textView.getModel().getLineCount();c.highlight(a,Math.min(a+20,f-1),!0);d=c.getLineStyle(a)}f=this.textView.getModel();if(d){var g=c.toStyleRangesAndErrors(d,a);if(g&&(b.ranges=g[0],b=this.annotationModel)){c=[];d=[];if(g=g[1])for(var h=0;h<g.length;h++){var i= |
| g[h];i.style.styleClass==="cm-error"&&d.push(n.AnnotationType.createAnnotation("orion.annotation.highlightError",i.start,i.end))}for(a=b.getAnnotations(f.getLineStart(a),f.getLineEnd(a));a.hasNext();)f=a.next(),f.type==="orion.annotation.highlightError"&&c.push(f);b.replaceAnnotations(c,d)}}},onHighlight:function(b){this.textView.redrawLines(b.start,b.end)},onDestroy:function(){this.destroy()}};return{Mirror:d,ModeApplier:g,CodeMirrorStyler:h}}); |
| define("orion/editor/textMateStyler",["orion/regex"],function(k){function m(c){var d;if(c instanceof Array){d=Array(c.length);for(var f=0;f<c.length;f++)d[f]=m(c[f])}else for(f in d={},c)if(Object.prototype.hasOwnProperty.call(c,f)){var g=c[f];d[f]=typeof g==="object"&&g!==null?m(g):g}return d}function n(c,d,f){this.initialize(c);this.grammar=m(d);this.externalGrammars=f?m(f):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var i={unsupported:[{regex:/\(\?[ims\-]:/, |
| func:function(){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(c){return c[1]==="="?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(){return"atomic group"}}],toRegExp:function(c){function d(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var f="",g,c=i.processGlobalFlag("x",c,function(b){for(var a="",c=!1,d=b.length,f=0;f<d;){var g=b.charAt(f);if(!c&&g==="#")for(;f<d&&g!=="\r"&&g!=="\n";)g=b.charAt(++f); |
| else if(!c&&/\s/.test(g))for(;f<d&&/\s/.test(g);)g=b.charAt(++f);else g==="\\"?(a+=g,/\s/.test(b.charAt(f+1))||(a+=b.charAt(f+1),f+=1)):(g==="["?c=!0:g==="]"&&(c=!1),a+=g),f+=1}return a}),c=i.processGlobalFlag("i",c,function(b){f+="i";return b});for(g=0;g<this.unsupported.length;g++){var h;(h=this.unsupported[g].regex.exec(c))&&d(this.unsupported[g].func(h),h)}return RegExp(c,f)},processGlobalFlag:function(c,d,f){function g(b,a){for(var c=0,d=b.length,f=-1,g=a;g<d&&f===-1;g++)switch(b.charAt(g)){case "\\":g++; |
| break;case "(":c++;break;case ")":c--,c===0&&(f=g)}return f}var h="(?"+c+")",c="(?"+c+":";if(d.substring(0,h.length)===h)return f(d.substring(h.length));else if(d.substring(0,c.length)===c){h=g(d,0);if(h<d.length-1)throw Error("Only a "+c+") group that encloses the entire regex is supported in: "+d);return f(d.substring(c.length,h))}return d},hasBackReference:function(c){return/\\\d+/.test(c.source)},getSubstitutedRegex:function(c,d,f){for(var f=typeof f==="undefined"?!0:!1,c=c.source.split(/(\\\d+)/g), |
| g=[],h=0;h<c.length;h++){var b=c[h],a=/\\(\d+)/.exec(b);a?(b=d[a[1]]||"",g.push(f?k.escape(b):b)):g.push(b)}return RegExp(g.join(""))},groupify:function(c,d){for(var f=c.source,g=f.length,h=[],b=0,a=[],e=1,i=1,k=[],m={},r={},p=0;p<g;p++){var n=h[h.length-1],v=f.charAt(p);switch(v){case "(":if(n===4)h.pop(),k.push(")"),a[a.length-1].end=p;var s=p+2<g?f.charAt(p+1)+""+f.charAt(p+2):null;if(s==="?:"||s==="?="||s==="?!"){var u;s==="?:"?u=1:(u=3,b++);h.push(u);a.push({start:p,end:-1,type:u});k.push(v); |
| k.push(s);p+=s.length}else h.push(2),a.push({start:p,end:-1,type:2,oldNum:e,num:i}),k.push(v),b===0&&(r[i]=null),m[e]=i,e++,i++;break;case ")":n=h.pop();n===3&&b--;a[a.length-1].end=p;k.push(v);break;case "*":case "+":case "?":case "}":var j=v,w=f.charAt(p-1),s=p-1;if(v==="}"){for(u=p-1;f.charAt(u)!=="{"&&u>=0;u--);w=f.charAt(u-1);s=u-1;j=f.substring(u,p+1)}u=a[a.length-1];if(w===")"&&(u.type===2||u.type===4)){k.splice(u.start,0,"(");k.push(j);k.push(")");v={start:u.start,end:k.length-1,type:4,num:u.num}; |
| for(w=0;w<a.length;w++)if(n=a[w],(n.type===2||n.type===4)&&n.start>=u.start&&n.end<=s)if(n.start+=1,n.end+=1,n.num+=1,n.type===2)m[n.oldNum]=n.num;a.push(v);i++;break}default:v!=="|"&&n!==2&&n!==4&&b===0&&(h.push(4),a.push({start:p,end:-1,type:4,num:i}),k.push("("),r[i]=null,i++),k.push(v),v==="\\"&&(v=f.charAt(p+1),k.push(v),p+=1)}}for(;h.length;)h.pop(),k.push(")");var f=RegExp(k.join("")),g={},d=d||m,x;for(x in d)d.hasOwnProperty(x)&&(g[x]="\\"+d[x]);f=this.getSubstitutedRegex(f,g,!1);return[f, |
| m,r]},complexCaptures:function(c){if(!c)return!1;for(var d in c)if(c.hasOwnProperty(d)&&d!=="0")return!0;return!1}};n.prototype={initialize:function(c){this.textView=c;this.textView.stylerOptions=this;var d=this;this._listener={onModelChanged:function(c){d.onModelChanged(c)},onDestroy:function(c){d.onDestroy(c)},onLineStyle:function(c){d.onLineStyle(c)},onStorage:function(c){d.onStorage(c)}};c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Destroy",this._listener.onDestroy); |
| c.addEventListener("LineStyle",this._listener.onLineStyle);c.redrawLines()},onDestroy:function(){this.destroy()},destroy:function(){if(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(c){for(c=[c];c.length!==0;){var d= |
| c.pop();if(!d._resolvedRule||!d._typedRule)if(d._resolvedRule=this._resolve(d),d._typedRule=this._createTypedRule(d),this.addStyles(d.name),this.addStyles(d.contentName),this.addStylesForCaptures(d.captures),this.addStylesForCaptures(d.beginCaptures),this.addStylesForCaptures(d.endCaptures),d._resolvedRule!==d&&c.push(d._resolvedRule),d.patterns)for(var f=0;f<d.patterns.length;f++)c.push(d.patterns[f])}},addStyles:function(c){if(c&&!this._styles[c]){this._styles[c]=[];for(var d=c.split("."),f=0;f< |
| d.length;f++)this._styles[c].push(d.slice(0,f+1).join("-"))}},addStylesForCaptures:function(c){for(var d in c)c.hasOwnProperty(d)&&this.addStyles(c[d].name)},ContainerRule:function(){function c(c){this.rule=c;this.subrules=c.patterns}c.prototype.valueOf=function(){return"aa"};return c}(),BeginEndRule:function(){function c(c){this.rule=c;this.beginRegex=i.toRegExp(c.begin);this.endRegex=i.toRegExp(c.end);this.subrules=c.patterns||[];this.endRegexHasBackRef=i.hasBackReference(this.endRegex);var f=i.complexCaptures(c.captures), |
| c=i.complexCaptures(c.beginCaptures)||i.complexCaptures(c.endCaptures);if(this.isComplex=f||c)f=i.groupify(this.beginRegex),this.beginRegex=f[0],this.beginOld2New=f[1],this.beginConsuming=f[2],f=i.groupify(this.endRegex,this.beginOld2New),this.endRegex=f[0],this.endOld2New=f[1],this.endConsuming=f[2]}c.prototype.valueOf=function(){return this.beginRegex};return c}(),MatchRule:function(){function c(c){this.rule=c;this.matchRegex=i.toRegExp(c.match);if(this.isComplex=i.complexCaptures(c.captures))c= |
| i.groupify(this.matchRegex),this.matchRegex=c[0],this.matchOld2New=c[1],this.matchConsuming=c[2]}c.prototype.valueOf=function(){return this.matchRegex};return c}(),_createTypedRule:function(c){return c.match?new this.MatchRule(c):c.begin?new this.BeginEndRule(c):new this.ContainerRule(c)},_resolve:function(c){var d=c;if(c.include){if(c.begin||c.end||c.match)throw Error('Unexpected regex pattern in "include" rule '+c.include);c=c.include;if(c.charAt(0)==="#"){if(d=this.grammar.repository&&this.grammar.repository[c.substring(1)], |
| !d)throw Error("Couldn't find included rule "+c+" in grammar repository");}else if(c==="$self")d=this.grammar;else if(c==="$base")throw Error('Include "$base" is not supported');else if(d=this._allGrammars[c],!d)for(var f=0;f<this.externalGrammars.length;f++){var g=this.externalGrammars[f];if(g.scopeName===c){this.preprocess(g);d=this._allGrammars[c]=g;break}}}return d},ContainerNode:function(){function c(c,f){this.parent=c;this.rule=f;this.children=[];this.end=this.start=null}c.prototype.addChild= |
| function(c){this.children.push(c)};c.prototype.valueOf=function(){var c=this.rule;return"ContainerNode { "+(c.include||"")+" "+(c.name||"")+(c.comment||"")+"}"};return c}(),BeginEndNode:function(){function c(c,f,g){this.parent=c;this.rule=f;this.children=[];this.setStart(g);this.endMatch=this.end=null;this.endRegexSubstituted=f.endRegexHasBackRef?i.getSubstitutedRegex(f.endRegex,g):null}c.prototype.addChild=function(c){this.children.push(c)};c.prototype.getIndexInParent=function(){return this.parent? |
| this.parent.children.indexOf(this):-1};c.prototype.setStart=function(c){this.start=c.index;this.beginMatch=c};c.prototype.setEnd=function(c){c&&typeof c==="object"?(this.endMatch=c,this.end=c.index+c[0].length):(this.endMatch=null,this.end=c)};c.prototype.shiftStart=function(c){this.start+=c;this.beginMatch.index+=c};c.prototype.shiftEnd=function(c){this.end+=c;this.endMatch&&(this.endMatch.index+=c)};c.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range="+this.start+".."+this.end+ |
| "}"};return c}(),push:function(c,d){if(d)for(var f=d.length;f>0;)c.push(d[--f])},exec:function(c,d,f){(d=c.exec(d))&&(d.index+=f);c.lastIndex=0;return d},afterMatch:function(c){return c.index+c[0].length},getEndMatch:function(c,d,f){if(c instanceof this.BeginEndNode){var g=c.rule,c=c.endRegexSubstituted||g.endRegex;return!c?null:this.exec(c,d,f)}return null},initialParse:function(){this.textView.getModel().getCharCount();this._tree=new this.ContainerNode(null,this.grammar._typedRule);this.parse(this._tree, |
| !1,0)},onModelChanged:function(c){var d=c.addedCharCount,f=c.removedCharCount,c=c.start;if(this._tree){var g=this.textView.getModel(),h=g.getCharCount(),g=g.getLineEnd(g.getLineAtOffset(c)-1),b=this.getFirstDamaged(g,g),g=g===-1?0:g,d=b?this.parse(b,!0,g,c,d,f):h;this.textView.redrawRange(g,d)}else this.initialParse()},getFirstDamaged:function(c,d){if(c<0)return this._tree;for(var f=[this._tree],g=null;f.length;){var h=f.pop();if(!h.parent||this.isDamaged(h,c,d)){h instanceof this.BeginEndNode&&(g= |
| h);for(var b=0;b<h.children.length;b++)f.push(h.children[b])}}return g||this._tree},isDamaged:function(c,d,f){return c.start<=f&&c.end>d},parse:function(c,d,f,g,h,b){var a=this.textView.getModel(),e=a.getLineStart(a.getLineCount()-1),i=a.getCharCount(),k=this.getInitialExpected(c,f),m=-1;if(d)c.repaired=!0,c.endNeedsUpdate=!0,m=(m=c.children[c.children.length-1])?a.getLineEnd(a.getLineAtOffset(m.end+(h-b))):-1,g=a.getLineEnd(a.getLineAtOffset(g+b)),m=Math.max(m,g);for(var m=m===-1?i:m,g=k,n=c,p=!1, |
| t=f,v=-1;n&&(!d||t<m);){var s=this.getNextMatch(a,n,t);s||(t=t>=e?i:a.getLineStart(a.getLineAtOffset(t)+1));var u=s&&s.match,j=s&&s.rule,w=s&&s.isEnd;if(s&&s.isSub){if(t=this.afterMatch(u),j instanceof this.BeginEndRule)p=!0,d&&j===g.rule&&n===g.parent?(n=g,n.setStart(u),n.repaired=!0,n.endNeedsUpdate=!0,g=this.getNextExpected(g,"begin")):(d&&(this.prune(n,g),d=!1),u=new this.BeginEndNode(n,j,u),n.addChild(u),n=u)}else if(w||t===i){if(n instanceof this.BeginEndNode)u?(p=!0,v=Math.max(v,n.end),n.setEnd(u), |
| t=this.afterMatch(u),d&&n===g&&n.parent===g.parent?(n.repaired=!0,delete n.endNeedsUpdate,g=this.getNextExpected(g,"end")):d&&(this.prune(n,g),d=!1)):(n.setEnd(i),delete n.endNeedsUpdate);n=n.parent}d&&t>=m&&!p&&(this.prune(c,k),d=!1)}this.removeUnrepairedChildren(c,d,f);this.cleanup(d,c,f,m,i,h,b);return d?Math.max(v,t):t},removeUnrepairedChildren:function(c,d,f){if(d){for(var d=c.children,g=-1,h=0;h<d.length;h++){var b=d[h];if(!b.repaired&&this.isDamaged(b,f,Number.MAX_VALUE)){g=h;break}}if(g!== |
| -1)c.children.length=g}},cleanup:function(c,d,f,g,h,b,a){if(c){c=b-a;h=this.getIntersecting(g-c+1,h);d=this.getIntersecting(f,g);for(f=0;f<h.length;f++)g=h[f],!g.repaired&&g instanceof this.BeginEndNode&&(g.shiftEnd(c),g.shiftStart(c));for(f=0;f<d.length;f++)g=d[f],g.repaired&&g.endNeedsUpdate&&g.shiftEnd(c),delete g.endNeedsUpdate,delete g.repaired}else{d=this.getIntersecting(f,g);for(f=0;f<d.length;f++)delete d[f].repaired}},getNextMatch:function(c,d,f,g){var h=c.getLineAtOffset(f),h=c.getLineEnd(h), |
| b=c.getText(f,h),a=[],e=[],c=[],h=[];for(this.push(a,d.rule.subrules);a.length;){var i=a.length?a.pop():null,i=i&&i._resolvedRule._typedRule;if(i instanceof this.ContainerRule&&e.indexOf(i)===-1)e.push(i),this.push(a,i.subrules);else if(!i||!g||i.matchRegex){var k=i&&this.exec(i.matchRegex||i.beginRegex,b,f);k&&(c.push(k),h.push(i))}}a=Number.MAX_VALUE;e=-1;for(i=0;i<c.length;i++)if(k=c[i],k.index<a)a=k.index,e=i;if(!g&&(f=this.getEndMatch(d,b,f)))if(g=d.rule.applyEndPatternLast,e===-1||f.index<a|| |
| !g&&f.index===a)return{isEnd:!0,rule:d.rule,match:f};return e===-1?null:{isSub:!0,rule:h[e],match:c[e]}},getInitialExpected:function(c,d){var f,g;if(c===this._tree)for(f=0;f<c.children.length;f++){if(g=c.children[f],g.start>=d)return g}else if(c instanceof this.BeginEndNode&&c.endMatch){var h=c.endMatch.index;for(f=0;f<c.children.length;f++)if(g=c.children[f],g.start>=d)break;if(g&&g.start<h)return g}return c},getNextExpected:function(c,d){if(d==="begin"){var f=c.children[0];return f?f:c}else if(d=== |
| "end"&&(f=c.parent)){var g=f.children[f.children.indexOf(c)+1];return g?g:f}return null},prune:function(c,d){if(d.parent===c)c.children.length=d.getIndexInParent();else if(c instanceof this.BeginEndNode)c.endMatch=null,c.end=null;if(c.parent)c.parent.children.length=c.getIndexInParent()+1},onLineStyle:function(c){this._tree||this.initialParse();var d=c.lineStart,f=this.textView.getModel(),g=f.getLineEnd(c.lineIndex),h=f.getLineEnd(f.getLineAtOffset(d)-1),h=this.getFirstDamaged(h,h),d=this.getLineScope(f, |
| h,d,g);c.ranges=this.toStyleRanges(d);c.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(c,d,f,g){for(var h=f,b=this.getInitialExpected(d,f),a=[],e=[];d&&h<g;){var i=this.getNextMatch(c,d,h);if(!i)break;var k=i&&i.match,m=i&&i.rule,n=i&&i.isSub,i=i&&i.isEnd;k.index!==h&&e.push({start:h,end:k.index,node:d});if(n)h=this.afterMatch(k),m instanceof this.BeginEndRule?(this.addBeginScope(a,k,m),d=b,b=this.getNextExpected(b,"begin")):this.addMatchScope(a,k,m);else if(i)h=this.afterMatch(k), |
| this.addEndScope(a,k,m),b=this.getNextExpected(b,"end"),d=d.parent}h<g&&e.push({start:h,end:g,node:d});c=this.getInheritedLineScope(e,f,g);return a.concat(c)},getInheritedLineScope:function(c){for(var d=[],f=0;f<c.length;f++)for(var g=c[f],h=g.node;h;){var b=h.rule.rule,a=b.name;if(b=b.contentName||a){this.addScopeRange(d,g.start,g.end,b);break}h=h.parent}return d},addBeginScope:function(c,d,f){var g=f.rule;this.addCapturesScope(c,d,g.beginCaptures||g.captures,f.isComplex,f.beginOld2New,f.beginConsuming)}, |
| addEndScope:function(c,d,f){var g=f.rule;this.addCapturesScope(c,d,g.endCaptures||g.captures,f.isComplex,f.endOld2New,f.endConsuming)},addMatchScope:function(c,d,f){var g=f.rule,h=g.name;(g=g.captures)?this.addCapturesScope(c,d,g,f.isComplex,f.matchOld2New,f.matchConsuming):this.addScope(c,d,h)},addScope:function(c,d,f){f&&c.push({start:d.index,end:this.afterMatch(d),scope:f})},addScopeRange:function(c,d,f,g){g&&c.push({start:d,end:f,scope:g})},addCapturesScope:function(c,d,f,g,h,b){if(f)if(g){for(var g= |
| {1:0},a=0,e=1;d[e]!==void 0;e++)b[e]!==void 0&&(a+=d[e].length),d[e+1]!==void 0&&(g[e+1]=a);b=d.index;for(a=1;f[a];a++){var e=f[a].name,i=h[a],k=b+g[i];typeof d[i]!=="undefined"&&this.addScopeRange(c,k,k+d[i].length,e)}}else this.addScope(c,d,f[0]&&f[0].name)},getIntersecting:function(c,d){for(var f=[],g=this._tree?[this._tree]:[];g.length;){var h=g.pop(),b=!1;h instanceof this.ContainerNode?b=!0:this.isDamaged(h,c,d)&&(b=!0,f.push(h));if(b)for(var b=h.children.length,a=0;a<b;a++)g.push(h.children[a])}return f.reverse()}, |
| toStyleRanges:function(c){for(var d=[],f=0;f<c.length;f++){var g=c[f],h=this._styles[g.scope];if(!h)throw Error("styles not found for "+g.scope);h=h.join(" ");d.push({start:g.start,end:g.end,style:{styleClass:h}})}return d}};return{RegexUtil:i,TextMateStyler:n}}); |
| define("orion/editor/htmlGrammar",[],function(){return{HtmlGrammar:function(){return{scopeName:"source.html",uuid:"3B5C76FB-EBB5-D930-F40C-047D082CE99B",patterns:[{begin:"<!(doctype|DOCTYPE)",end:">",contentName:"entity.name.tag.doctype.html",beginCaptures:{0:{name:"entity.name.tag.doctype.html"}},endCaptures:{0:{name:"entity.name.tag.doctype.html"}}},{begin:"<\!--",end:"--\>",beginCaptures:{0:{name:"punctuation.definition.comment.html"}},endCaptures:{0:{name:"punctuation.definition.comment.html"}}, |
| patterns:[{match:"--",name:"invalid.illegal.badcomment.html"}],contentName:"comment.block.html"},{match:"<[A-Za-z0-9_\\-:]+(?= ?)",name:"entity.name.tag.html"},{include:"#attrName"},{include:"#qString"},{include:"#qqString"},{include:"#entity"},{match:"</[A-Za-z0-9_\\-:]+>",name:"entity.name.tag.html"},{match:">",name:"entity.name.tag.html"}],repository:{attrName:{match:"[A-Za-z\\-:]+(?=\\s*=\\s*['\"])",name:"entity.other.attribute.name.html"},qqString:{match:'(")[^"]+(")',name:"string.quoted.double.html"}, |
| qString:{match:"(')[^']+(')",name:"string.quoted.single.html"},entity:{match:"&[A-Za-z0-9]+;",name:"constant.character.entity.html"}}}}}}); |
| define("orion/editor/textStyler",["orion/editor/annotations"],function(k){function m(a,b){this._unnamedCounter=0;this._patterns=[];this._rootId=b;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function n(a,b,c,d,e){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.pattern=b;this._styler=c;this._parent=e;this._linePatterns=[];this._blockPatterns=[];this._enclosurePatterns= |
| {};if(d)this._initPatterns(),this._subBlocks=t(d,d.getText(this.start,this.end),this,this.start)}function i(a){this._styler=a}function c(a,b,c,d){this.highlightCaretLine=this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectTasks=this.foldingEnabled=!0;this.view=a;this.annotationModel=b;this.patternManager=new m(c,d);this._accessor=new i(this);this._bracketAnnotations=void 0;var e=this;this._listener={onChanged:function(a){e._onModelChanged(a)},onDestroy:function(a){e._onDestroy(a)}, |
| onLineStyle:function(a){e._onLineStyle(a)},onMouseDown:function(a){e._onMouseDown(a)},onSelection:function(a){e._onSelection(a)}};c=a.getModel();c.getBaseModel&&(c=c.getBaseModel());c.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);d=c.getCharCount();this._rootBlock= |
| new n({start:0,contentStart:0,end:d,contentEnd:d},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(d=[],v(this._rootBlock,c,d),b.replaceAnnotations([],d));a.redrawLines()}var d={styleClass:"meta annotation currentLine"},f=/$/,g=/\\(\d)/g,h=/(.*)(?:[\r\n]|$)/g,b={regex:/ /g,style:{styleClass:"punctuation separator space",unmergeable:!0}},a={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},e=function(a,b,c,d){var e=c,f=a.lastIndex;h.lastIndex= |
| c;var c=h.exec(b),g,i;a.lastIndex=0;if(c){for(i=c.index;0<=--i;)if(g=b.charAt(i),g==="\n"||g==="\r")break;g=b.substring(i+1,c.index+c[1].length);a.lastIndex=i=c.index-i-1}for(;c&&c.index<b.length;){var k;if(d){var l=a.lastIndex;if(a.test(g))a.lastIndex=l,k=a.exec(g)}else k=a.exec(g);if(k)return k.index+=e,k.index-=i,a.lastIndex=f,k;i=0;e+=c[0].length;if(c=h.exec(b))g=c[1],a.lastIndex=0}a.lastIndex=f;return null},l=function(a,b){var c=a.toString();g.lastIndex=0;if(!g.test(c))return a;g.lastIndex=0; |
| for(var d=g.exec(c);d;)c=c.replace(d[0],b[d[1]]||""),g.lastIndex=0,d=g.exec(c);return RegExp(c.substring(1,c.length-2),"g")},o=function(a,b,c,d){if(b=e(a.pattern.regex?a.pattern.regex:a.pattern.regexBegin,b,d,!0)){a.result=b;for(d=0;d<c.length;d++)if(b.index<c[d].result.index||b.index===c[d].result.index&&a.pattern.pattern.index<c[d].pattern.pattern.index){c.splice(d,0,a);return}c.push(a)}},q=function(a,b,c,d){if(b[0])d.push({start:c,end:c+a[0].length,style:b[0].name});else for(var e=0,f=1;f<a.length;f++)if(a[f]){var g= |
| b[f];if(g){var i=c+e;d.push({start:i,end:i+a[f].length,style:g.name})}e+=a[f].length}},r=function(a,b,c){var d=a.start;b.forEach(function(b){d<=b.start&&c.push({start:d,end:b.start,style:a.style});c.push(b);d=b.end});d<a.end&&c.push({start:d,end:a.end,style:a.style})},p=function(a,b,c,d,g){if(c=c.getLinePatterns()){var i=[];c.forEach(function(b){var c=b.regex||b.regexBegin;c.oldLastIndex=c.lastIndex;(c=e(c,a,0))&&i.push({result:c,pattern:b})});i.sort(function(a,b){return a.result.index<b.result.index? |
| -1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var h=0;i.length>0;){var k=i[0];i.splice(0,1);if(!(k.result.index<h)){var m=k.result.index,p,n=[];if(k.pattern.regex){h=k.result;p=m+h[0].length;p={start:b+m,end:b+p,style:k.pattern.pattern.name};if(!g){k.pattern.pattern.captures&&q(h,k.pattern.pattern.captures,b+m,n);n.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(m=0;m<n.length-1;m++)if(n[m+1].start<n[m].end){var t={start:n[m+1].end, |
| end:n[m].end,style:n[m].style};n[m].end=n[m+1].start;n.splice(m+2,0,t)}}r(p,n,d)}else{h=k.pattern.regexEnd;h=l(h,k.result);h=e(h,a,k.result.index+k.result[0].length);if(!h)f.lastIndex=0,h=f.exec(a);p=h.index+h[0].length;d.push({start:b+m,end:b+p,style:k.pattern.pattern.name})}h=h.index+h[0].length}o(k,a,i,h)}c.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},t=function(a,b,c,d){var g=[];c.getBlockPatterns().forEach(function(a){var c=e(a.regexBegin||a.regex,b,0);c&&g.push({result:c, |
| pattern:a})}.bind(this));if(!g.length)return g;g.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var h=0,i=[];g.length>0;){var k=g[0];g.splice(0,1);if(!(k.result.index<h)){var m=a.getLineAtOffset(d+k.result.index),q=a.getLine(m),r=[];p(q,a.getLineStart(m),c,r);m=d+k.result.index;for(q=0;q<r.length;q++)if(r[q].start===m){var h=k.result.index,t=null,v=k.pattern.regexEnd;if(v){h+=k.result[0].length; |
| for(var v=l(v,k.result),B=h;!t;){B=e(v,b,B);if(!B)f.lastIndex=0,B=f.exec(b);var E=[],G=new n({start:m,end:d+B.index+B[0].length,contentStart:d+h,contentEnd:d+B.index},k.pattern,c.getStyler(),a,c);p(b.substring(h,B.index+B[0].length),h,G,E);if(!E.length||E[E.length-1].end<=B.index)t=G;B=B.index+B[0].length}}else t=new n({start:m,end:m+k.result[0].length,contentStart:m,contentEnd:m+k.result[0].length},k.pattern,c.getStyler(),a,c);i.push(t);h=t.end-d;break}q===r.length&&(h=k.result.index+1)}o(k,b,g, |
| h)}return i},v=function(a,b,c){if(a.getAnnotationModel()){var d=k.AnnotationType.ANNOTATION_TASK;if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&a.pattern.pattern.name.indexOf("comment")===0){var e=[];p(b.getText(a.contentStart,a.end),a.contentStart,a,e,!0);for(var f=0;f<e.length;f++)e[f].style==="meta.annotation.task.todo"&&c.push(k.AnnotationType.createAnnotation(d,e[f].start,e[f].end,b.getText(e[f].start,e[f].end)))}a.getBlocks().forEach(function(a){v(a,b,c)}.bind(this))}};m.prototype= |
| {getPatterns:function(a){var b=[0],c={},d=RegExp("^"+(a?typeof a==="string"?a:a.qualifiedId:this._rootId)+"#[^#]+$"),e=[];this._patterns.forEach(function(a){if(d.test(a.qualifiedId))a.include?e.push(a):(a.index=b[0]++,c[a.id]=a)}.bind(this));e.forEach(function(a){this._processInclude(a,b,c)}.bind(this));var f=[];Object.keys(c).forEach(function(a){f.push(c[a])});return f},_addPatterns:function(a,b){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,b)}.bind(this))},_addRepositoryPatterns:function(a, |
| b){Object.keys(a).forEach(function(c){this._addPattern(a[c],c,b)}.bind(this))},_addPattern:function(a,b,c){a.parentId=c;a.id=b;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_processInclude:function(a,b,c){var d,e=a.include.indexOf("#");d=e===0?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):e===-1?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");var f=[];this._patterns.forEach(function(a){if(d.test(a.qualifiedId))if(a.include)f.push(a); |
| else if(!c[a.id])a.index=b[0]++,c[a.id]=a}.bind(this));f.forEach(function(a){this._processInclude(a,b,c)}.bind(this))},_NO_ID:"NoID"};n.prototype={adjustEnd:function(a){this.end+=a;this.contentEnd+=a;this._subBlocks.forEach(function(b){b.adjustEnd(a)})},adjustStart:function(a){this.start+=a;this.contentStart+=a;this._subBlocks.forEach(function(b){b.adjustStart(a)})},computeStyle:function(a,b){if(!this.pattern||!(this.start<=b&&b<this.end))return null;var c={start:this.start,end:this.end,style:this.pattern.pattern.name}; |
| if(this.contentStart<=b&&b<this.contentEnd)return this.pattern.pattern.contentName?{start:this.contentStart,end:this.contentEnd,style:this.pattern.pattern.contentName}:c;var d,e,f,g;if(b<this.contentStart){e=this.pattern.pattern.beginCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexBegin;f=a.getText(this.start,this.contentStart);g=this.start}else{e=this.pattern.pattern.endCaptures||this.pattern.pattern.captures;if(!e)return c;d=this.pattern.regexEnd;f=a.getText(this.contentEnd, |
| this.end);g=this.contentEnd}d.lastIndex=0;if(f=d.exec(f)){d=[];q(f,e,g,d);for(e=0;e<d.length;e++)if(d[e].start<=b&&b<d[e].end)return d[e]}return c},getAnnotationModel:function(){return this._styler._getAnnotationModel()},getBlockPatterns:function(){return this._blockPatterns},getBlocks:function(){return this._subBlocks},getEnclosurePatterns:function(){return this._enclosurePatterns},getLinePatterns:function(){return this._linePatterns},getParent:function(){return this._parent},getPatternManager:function(){return this._styler._getPatternManager()}, |
| getStyler:function(){return this._styler},isRenderingWhitespace:function(){return this._styler._isRenderingWhitespace()},_initPatterns:function(){var a=function(a){var b=/^\(\?i\)\s*/.exec(a);b&&(a=a.substring(b[0].length));return a};this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(b){var c;if(b.match&&!b.begin&&!b.end){c="g";var d=a(b.match);d!==b.match&&(c+="i");c={regex:RegExp(d,c),pattern:b};this._linePatterns.push(c);if(b.patterns)this._blockPatterns.push(c); |
| else if(b.name&&b.name.indexOf("punctuation.section")===0&&(b.name.indexOf(".begin")!==-1||b.name.indexOf(".end")!==-1))this._enclosurePatterns[b.name]=c}else if(!b.match&&b.begin&&b.end){c="g";d=a(b.begin);d!==b.begin&&(c+="i");var e="g",f=a(b.end);f!==b.end&&(e+="i");c={regexBegin:RegExp(d,c),regexEnd:RegExp(f,e),pattern:b};this._linePatterns.push(c);this._blockPatterns.push(c)}}.bind(this))}};i.prototype={getStyles:function(a){return this._styler.getStyles(a)}};c.prototype={destroy:function(){var a= |
| this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var b=[],c=this.view.getModel();c.getBaseModel&& |
| (c=c.getBaseModel());var d=this._findBlock(this._rootBlock,a),e=c.getLineAtOffset(a),f=c.getLine(e),g=[];p(f,c.getLineStart(e),d,g);for(e=0;e<g.length;e++){if(a<g[e].start)break;if(g[e].start<=a&&a<g[e].end){b.push(g[e]);break}}for(;d;)(g=d.computeStyle(c,a))&&b.splice(0,0,g),d=d.getParent();return b},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,b){if(this.whitespacesVisible!==a)this.whitespacesVisible=a,b&&this.view.redraw()},setTabsVisible:function(a){if(this.tabsVisible!== |
| a)this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw()},setSpacesVisible:function(a){if(this.spacesVisible!==a)this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw()},setDetectHyperlinks:function(){},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;d===void 0&&(d=-1);if(e===void 0)e=a.length;for(;e-d>1;)if(f= |
| Math.floor((e+d)/2),b<=a[f].start)e=f;else if(c&&b<a[f].end){e=f;break}else d=f;return e},_computeFolding:function(a){if(this.foldingEnabled){var b=this.view.getModel();if(b.getBaseModel){var c=this.annotationModel;if(c){c.removeAnnotations(k.AnnotationType.ANNOTATION_FOLDING);for(var d=[],e=b.getBaseModel(),f=0;f<a.length;f++){var g=a[f];(g=this._createFoldingAnnotation(b,e,g.start,g.end))&&d.push(g)}c.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,c,d){var e=b.getLineAtOffset(c), |
| b=b.getLineAtOffset(d);return e===b?null:new (k.AnnotationType.getType(k.AnnotationType.ANNOTATION_FOLDING))(c,d,a)},_findBlock:function(a,b){var c=a.getBlocks();if(!c.length)return a;var d=this._binarySearch(c,b,!0);return d<c.length&&c[d].start<=b&&b<c[d].end?this._findBlock(c[d],b):a},_findBrackets:function(a,b,c,d,e,f){for(var g=[],h=[],i=e,k=c.getBlocks(),l=this._binarySearch(k,e,!0);l<k.length;l++){if(k[l].start>=f)break;var m=k[l].start,n=k[l].end;i<m&&(p(d.substring(i-e,m-e),i,c,h),h.forEach(function(c){c.style.indexOf(a.pattern.name)=== |
| 0?g.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&g.push(-(c.start+1))}),h=[]);i=n}i<f&&(p(d.substring(i-e,f-e),i,c,h),h.forEach(function(c){c.style.indexOf(a.pattern.name)===0?g.push(c.start+1):c.style.indexOf(b.pattern.name)===0&&g.push(-(c.start+1))}));return g},_findMatchingBracket:function(a,b,c){for(var d=a.getLineAtOffset(c),f=a.getLineEnd(d),g=a.getText(c,f),h,i=b.getEnclosurePatterns(),k=Object.keys(i),l=0;l<k.length;l++){var m=i[k[l]],n=e(m.regex,g,0);if(n&&n.index===0){h=m;break}}if(!h)return-1; |
| g=!1;h.pattern.name.indexOf(".begin")!==-1?(g=!0,l=h.pattern.name.replace(".begin",".end")):l=h.pattern.name.replace(".end",".begin");i=i[l];if(!i)return-1;k=a.getLine(d);m=a.getLineStart(d);f=this._findBrackets(h,i,b,k,m,f);for(l=0;l<f.length;l++)if(k=f[l]>=0?1:-1,f[l]*k-1===c){c=1;if(g){for(l++;l<f.length;l++)if(k=f[l]>=0?1:-1,c+=k,c===0)return f[l]*k-1;d+=1;for(l=a.getLineCount();d<l;){k=a.getLine(d);m=a.getLineStart(d);f=a.getLineEnd(d);f=this._findBrackets(h,i,b,k,m,f);for(g=0;g<f.length;g++)if(k= |
| f[g]>=0?1:-1,c+=k,c===0)return f[g]*k-1;d++}}else{for(l--;l>=0;l--)if(k=f[l]>=0?1:-1,c+=k,c===0)return f[l]*k-1;for(d-=1;d>=0;){k=a.getLine(d);m=a.getLineStart(d);f=a.getLineEnd(d);f=this._findBrackets(h,i,b,k,m,f);for(l=f.length-1;l>=0;l--)if(k=f[l]>=0?1:-1,c+=k,c===0)return f[l]*k-1;d--}}break}return-1},_getAnnotationModel:function(){return this.annotationModel},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,c=b.getModel(),b=b.getSelection();if(b.start===b.end&&c.getLineAtOffset(b.start)=== |
| a)return d}return null},_getPatternManager:function(){return this.patternManager},_getStyles:function(a,b,c,d){b.getBaseModel&&(d=b.mapOffset(d));for(var f=d+c.length,g=[],h=d,i=a.getBlocks(),k=this._binarySearch(i,d,!0);k<i.length;k++){if(i[k].start>=f)break;var l=i[k].start,m=i[k].end;h<l&&p(c.substring(h-d,l-d),h,a,g);var n=Math.max(h,l);if(n===l&&i[k].pattern.regexBegin){var o=e(i[k].pattern.regexBegin,c.substring(n-d),0);if(o){var r=i[k].pattern.pattern.beginCaptures||i[k].pattern.pattern.captures; |
| r?q(o,r,n,g):g.push({start:n,end:n+o[0].length,style:i[k].pattern.pattern.name});n+=o[0].length}}var l=Math.min(f,m),t=[];if(l===m&&i[k].pattern.regexEnd&&(h=c.substring(l-h-(i[k].end-i[k].contentEnd)),o=e(i[k].pattern.regexEnd,h,0)))(r=i[k].pattern.pattern.endCaptures||i[k].pattern.pattern.captures)?q(o,r,l-o[0].length,t):i[k].pattern.pattern.name&&t.push({start:l-o[0].length,end:l,style:i[k].pattern.pattern.name}),l-=o[0].length;var h=this._getStyles(i[k],b,c.substring(n-d,l-d),n),v=i[k].pattern.pattern.contentName|| |
| i[k].pattern.pattern.name;if(v){var H=n;h.forEach(function(a){a.start-H&&g.push({start:H,end:a.start,style:v});g.push(a);H=a.end});l-H&&g.push({start:H,end:l,style:v})}else g=g.concat(h);g=g.concat(t);h=m}h<f&&p(c.substring(h-d,f-d),h,a,g);if(b.getBaseModel)for(a=0;a<g.length;a++)c=g[a].end-g[a].start,g[a].start=b.mapOffset(g[a].start,!0),g[a].end=g[a].start+c;return g},_isRenderingWhitespace:function(){return this.whitespacesVisible&&(this.tabsVisible||this.spacesVisible)},_onDestroy:function(){this.destroy()}, |
| _onLineStyle:function(c){if(c.textView===this.view)c.style=this._getLineStyle(c.lineIndex);c.ranges=this._getStyles(this._rootBlock,c.textView.getModel(),c.lineText,c.lineStart);c.ranges.forEach(function(a){if(a.style)a.style={styleClass:a.style.replace(/\./g," ")}});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(b,c.ranges,c.lineText,c.lineStart),this.tabsVisible&&this._spliceStyles(a,c.ranges,c.lineText,c.lineStart))},_onSelection:function(a){var b=a.oldValue,c=a.newValue, |
| d=this.view,a=d.getModel(),e;if(this.highlightCaretLine){var f=a.getLineAtOffset(b.start);e=a.getLineAtOffset(c.start);var g=c.start===c.end,b=b.start===b.end;f===e&&b&&g||(b&&d.redrawLines(f,f+1),(f!==e||!b)&&g&&d.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,h,i;if(c.start===c.end&&(i=d.getCaretOffset())>0)i-=1,a.getBaseModel&&(i=a.mapOffset(i),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,i),a=this._findMatchingBracket(a,c,i),a!==-1&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET, |
| a,a+1),k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,i,i+1)]);this._bracketAnnotations=h;this.annotationModel.replaceAnnotations(b,h)}},_onMouseDown:function(a){if(a.clickCount===2){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(d>0){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());var g=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,g,e);e!==-1&&(a.preventDefault(),a=e,c.getBaseModel&&(a=c.mapOffset(a,!0)),d> |
| a&&(d--,a++),b.setSelection(a,d))}}},_onModelChanged:function(a){var b=a.start,c=a.removedCharCount,a=a.addedCharCount-c,d=this.view,e=d.getModel(),f=e.getBaseModel?e.getBaseModel():e,c=b+c,g=f.getCharCount(),i=this._rootBlock.getBlocks(),h=i.length,l=f.getLineStart(f.getLineAtOffset(b)),m=this._binarySearch(i,l,!0),n=this._binarySearch(i,c,!1,m-1,h),o;m<h&&i[m].start<=l&&l<i[m].end?(o=i[m].start,o>b&&(o+=a)):o=m===h&&h>0&&g-a===i[h-1].end?i[h-1].start:l;var p;do n<h?(p=i[n].end,p>b&&(p+=a),n+=1): |
| (n=h,p=g),l=f.getText(o,p),l=t(f,l,this._rootBlock,o);while(l.length&&i.length&&n<h&&l[l.length-1].pattern.pattern.id!==i[n-1].pattern.pattern.id);for(g=m;g<i.length;g++)h=i[g],h.start>b&&h.adjustStart(a),h.start>b&&h.adjustEnd(a);var q=n-m!==l.length;if(!q)for(g=0;g<l.length;g++){var h=i[m+g],r=l[g];if(h.start!==r.start||h.end!==r.end||h.type!==r.type){q=!0;break}}g=[m,n-m].concat(l);Array.prototype.splice.apply(i,g);q&&(g=o,h=p,e!==f&&(g=e.mapOffset(g,!0),h=e.mapOffset(h,!0)),d.redrawRange(g,h)); |
| if(this.annotationModel){d=[];i=[];m=[];o=this.annotationModel.getAnnotations(o,p);for(p=this.foldingEnabled&&f!==e;o.hasNext();)if(h=o.next(),p&&h.type===k.AnnotationType.ANNOTATION_FOLDING){m.push(h);for(g=0;g<l.length;g++)if(h.start===l[g].start&&h.end===l[g].end)break;g===l.length?(d.push(h),h.expand()):(g=h.start,n=h.end,g>b&&(g-=a),n>b&&(n-=a),g<=b&&b<n&&g<=c&&c<n&&(g=f.getLineAtOffset(h.start),n=f.getLineAtOffset(h.end),g!==n?h.expanded||h.expand():this.annotationModel.removeAnnotation(h))); |
| for(g=0;g<l.length;g++){h=l[g];for(n=0;n<m.length;n++)if(m[n].start===h.start&&m[n].end===h.end)break;n===m.length&&(h=this._createFoldingAnnotation(e,f,h.start,h.end))&&i.push(h)}}else h.type===k.AnnotationType.ANNOTATION_TASK&&d.push(h);if(this.detectTasks)for(g=0;g<l.length;g++)v(l[g],f,i);this.annotationModel.replaceAnnotations(d,i)}},_spliceStyles:function(a,b,c,d){for(var e=a.regex,f=e.lastIndex=0,g=e.exec(c);g;){for(g=d+g.index;f<b.length;){if(g<b[f].end)break;f++}var h={start:g,end:g+1,style:a.style}; |
| if(f<b.length&&b[f].start<=g){var i={start:g+1,end:b[f].end,style:b[f].style};b[f].end=g;b.splice(f+1,0,i);b.splice(f+1,0,h);f+=2}else b.splice(f,0,h),f++;g=e.exec(c)}}};return{TextStyler:c}}); |
| define("orion/editor/stylers/text_x-php/syntax",["orion/editor/stylers/lib/syntax"],function(k){var m="abstract,and,array,as,break,callable,case,catch,class,clone,const,continue,declare,default,die,do,echo,else,elseif,empty,enddeclare,endfor,endforeach,endif,endswitch,endwhile,eval,exit,extends,false,FALSE,final,finally,for,foreach,function,global,goto,if,implements,include,include_once,insteadof,interface,instanceof,isset,list,namespace,new,null,NULL,or,parent,print,private,protected,public,require,require_once,return,self,static,switch,throw,trait,try,true,TRUE,unset,use,var,while,xor,yield,__halt_compiler,__CLASS__,__DIR__,__FILE__,__FUNCTION__,__LINE__,__METHOD__,__NAMESPACE__,__TRAIT__".split(","),k= |
| k.grammars;k.push({id:"orion.php",contentTypes:["text/x-php"],patterns:[{include:"orion.lib#doc_block"},{include:"orion.c-like"},{match:"(?i)<\\?(?:=|php)?(?:\\s|$)",name:"entity.name.declaration.php"},{match:"<%=?(?:\\s|$)",name:"entity.name.declaration.php"},{match:"#.*",name:"comment.line.number-sign.php",patterns:[{include:"orion.lib#todo_comment_singleLine"}]},{begin:"<<<(\\w+)$",end:"^\\1;$",name:"string.unquoted.heredoc.php"},{begin:"<<<'(\\w+)'$",end:"^\\1;$",name:"string.unquoted.heredoc.nowdoc.php"}, |
| {match:"\\b0[bB][01]+\\b",name:"constant.numeric.binary.php"},{match:"\\b(?:"+m.join("|")+")\\b",name:"keyword.control.php"}]});return{id:"orion.php",grammars:k,keywords:m}}); |
| define("orion/editor/stylers/application_xml/syntax",["orion/editor/stylers/lib/syntax"],function(k){k=k.grammars;k.push({id:"orion.xml",contentTypes:["application/xml","application/xhtml+xml"],patterns:[{include:"#comment"},{include:"#xmlDeclaration"},{begin:"<!(?:doctype|DOCTYPE)",end:">",captures:{0:{name:"entity.name.tag.doctype.xml"}},patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}],name:"meta.tag.doctype.xml"},{begin:"</?[A-Za-z0-9]+", |
| end:"/?>",captures:{0:{name:"entity.name.tag.xml"}},name:"meta.tag.xml",patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}]},{match:"<|>|&",name:"constant.character"}],repository:{comment:{begin:"<\!--",end:"--\>",name:"comment.block.xml",patterns:[{match:"(\\b)(TODO)(\\b)(((?!--\>).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}]},xmlDeclaration:{begin:"<\\?xml", |
| end:"\\?>",captures:{0:{name:"entity.name.tag.declaration.xml"}},patterns:[{include:"#comment"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"}],name:"meta.tag.declaration.xml"}}});return{id:k[k.length-1].id,grammars:k,keywords:[]}}); |
| define("orion/editor/stylers/text_html/syntax",["orion/editor/stylers/lib/syntax","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_css/syntax","orion/editor/stylers/text_x-php/syntax","orion/editor/stylers/application_xml/syntax"],function(k,m,n,i,c){k=k.grammars.concat(m.grammars).concat(n.grammars).concat(i.grammars).concat(c.grammars);k.push({id:"orion.html",contentTypes:["text/html"],patterns:[{include:"orion.xml"},{begin:"(?i)(<style)([^>]*)(>)",end:"(?i)(</style>)", |
| captures:{1:{name:"entity.name.tag.html"},3:{name:"entity.name.tag.html"}},contentName:"source.css.embedded.html",patterns:[{include:"orion.css"}]},{begin:"(?i)<script\\s*>|<script\\s.*?(?:language\\s*=\\s*(['\"])javascript\\1|type\\s*=\\s*(['\"])(?:text|application)/(?:javascript|ecmascript)\\2).*?>",end:"(?i)<\/script>",captures:{0:{name:"entity.name.tag.html"}},contentName:"source.js.embedded.html",patterns:[{include:"orion.js"}]},{begin:"(?i)<script\\s.*?(?:language\\s*=\\s*(['\"])php\\1|type\\s*=\\s*(['\"])text/x-php\\2).*?>", |
| end:"(?i)<\/script>",captures:{0:{name:"entity.name.tag.html"}},contentName:"source.php.embedded.html",patterns:[{include:"orion.php"}]},{begin:"(?i)<\\?(?:=|php)?(?:\\s|$)",end:"\\?>",captures:{0:{name:"entity.name.declaration.php"}},contentName:"source.php.embedded.html",patterns:[{include:"orion.php"}]},{begin:"<%=?(?:\\s|$)",end:"%>",captures:{0:{name:"entity.name.declaration.php"}},contentName:"source.php.embedded.html",patterns:[{include:"orion.php"}]}],repository:{xmlDeclaration:{}}});return{id:k[k.length- |
| 1].id,grammars:k,keywords:[]}}); |
| define("orion/editor/edit","require,orion/editor/shim,orion/editor/textView,orion/editor/textModel,orion/editor/textTheme,orion/editor/projectionTextModel,orion/editor/eventTarget,orion/keyBinding,orion/editor/rulers,orion/editor/annotations,orion/editor/tooltip,orion/editor/undoStack,orion/editor/textDND,orion/editor/editor,orion/editor/editorFeatures,orion/editor/contentAssist,orion/editor/cssContentAssist,orion/editor/htmlContentAssist,orion/editor/jsTemplateContentAssist,orion/editor/AsyncStyler,orion/editor/mirror,orion/editor/textMateStyler,orion/editor/htmlGrammar,orion/editor/textStyler,orion/editor/stylers/application_javascript/syntax,orion/editor/stylers/text_css/syntax,orion/editor/stylers/text_html/syntax".split(","),function(k, |
| m,n,i,c,d,f,g,h,b,a,e,l,o,q,r,p,t,v,s,u,j,w,x,D,y,K){function O(a){var b=a.firstChild;if(b&&b.tagName==="TEXTAREA")return b.value;var c=a.ownerDocument,d=c.defaultView||c.parentWindow,e;if(!(e=!d.getSelection)){if(!(b=a.childNodes.length===1&&b.nodeType===Node.TEXT_NODE)){for(var f,b=a;b&&b!==c&&f!=="none";)f=d.getComputedStyle?d.getComputedStyle(b,null).getPropertyValue("display"):b.currentStyle.display,b=b.parentNode;b=f==="none"}e=b}if(e)return a.innerText||a.textContent;c=c.createRange();c.selectNode(a); |
| a=d.getSelection();d=[];for(f=0;f<a.rangeCount;f++)d.push(a.getRangeAt(f));a.removeAllRanges();a.addRange(c);c=a.toString();a.removeAllRanges();for(f=0;f<d.length;f++)a.addRange(d[f]);return c}function P(a){if(a.substring(0,12)==="data-editor-")return a=a.substring(12),a=a.replace(/-([a-z])/ig,function(a,b){return b.toUpperCase()})}function M(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function Q(a,b){var c={};M(c,b);for(var d,e=0,f=a.attributes,g=f.length;e<g;e++){d=f.item(e);var h=P(d.nodeName); |
| if(h){d=d.nodeValue;if(d==="true"||d==="false")d=d==="true";c[h]=d}}return c}function R(a,b){if(a.getElementsByClassName)return a.getElementsByClassName(b);b=b.replace(/ *$/,"");return a.querySelectorAll?a.querySelectorAll((" "+b).replace(/ +/g,".")):null}function B(a){var b=a.document||document,e=a.parent;e||(e="editor");typeof e==="string"&&(e=b.getElementById(e));if(!e&&a.className&&(b=R(b,a.className))){a.className=void 0;if(b.length>1&&a.noFocus===void 0)a.noFocus=!0;for(var f=[],g=b.length- |
| 1;g>=0;g--)a.parent=b[g],f.push(B(a));return f}if(!e)throw"no parent";a=Q(e,a);if(typeof a.theme==="string"){var b=c.TextTheme.getTheme(a.theme),g=a.theme.lastIndexOf("/"),h=a.theme;g!==-1&&(h=h.substring(g+1));h.substring(h.length-4)===".css"&&(h=h.substring(0,h.length-4));b.setThemeClass(h,{href:a.theme});a.theme=b}var j;a.readonly||(f={createContentAssistMode:function(a){j=new r.ContentAssist(a.getTextView());a=new r.ContentAssistWidget(j);a=new r.ContentAssistMode(j,a);j.setMode(a);return a}}); |
| var l=new o.Editor({textViewFactory:function(){return new n.TextView({parent:e,model:new d.ProjectionTextModel(a.model?a.model:new i.TextModel("")),tabSize:a.tabSize?a.tabSize:4,readonly:a.readonly,fullSelection:a.fullSelection,tabMode:a.tabMode,expandTab:a.expandTab,singleMode:a.singleMode,themeClass:a.themeClass,theme:a.theme,wrapMode:a.wrapMode,wrappable:a.wrappable})},undoStackFactory:new q.UndoFactory,annotationFactory:new q.AnnotationFactory,lineNumberRulerFactory:new q.LineNumberRulerFactory, |
| foldingRulerFactory:new q.FoldingRulerFactory,textDNDFactory:new q.TextDNDFactory,contentAssistFactory:f,keyBindingFactory:new q.KeyBindingsFactory,statusReporter:a.statusReporter,domNode:e});l.addEventListener("TextViewInstalled",function(){var b=l.getLineNumberRuler();b&&a.firstLineIndex!==void 0&&b.setFirstLine(a.firstLineIndex);if(b=l.getSourceCodeActions())b.setAutoPairParentheses(a.autoPairParentheses),b.setAutoPairBraces(a.autoPairBraces),b.setAutoPairSquareBrackets(a.autoPairSquareBrackets), |
| b.setAutoPairAngleBrackets(a.autoPairAngleBrackets),b.setAutoPairQuotations(a.autoPairQuotations),b.setAutoCompleteComments(a.autoCompleteComments),b.setSmartIndentation(a.smartIndentation)});f=a.contents;f===void 0&&(f=O(e));f||(f="");l.installTextView();l.setLineNumberRulerVisible(a.showLinesRuler===void 0||a.showLinesRuler);l.setAnnotationRulerVisible(a.showAnnotationRuler===void 0||a.showFoldingRuler);l.setOverviewRulerVisible(a.showOverviewRuler===void 0||a.showOverviewRuler);l.setFoldingRulerVisible(a.showFoldingRuler=== |
| void 0||a.showFoldingRuler);l.setInput(a.title,null,f,!1,a.noFocus);({styler:null,highlight:function(b,c){this.styler&&this.styler.destroy&&this.styler.destroy();this.styler=null;b==="js"?b="application/javascript":b==="css"?b="text/css":b==="html"?b="text/html":b==="java"&&(b="text/x-java-source");var d=c.getTextView(),e=c.getAnnotationModel();b&&(b=b.replace(/[*|:/".<>?+]/g,"_"),k(["./stylers/"+b+"/syntax"],function(a){this.styler=new x.TextStyler(d,e,a.grammars,a.id)}));b==="text/css"&&c.setFoldingRulerVisible(a.showFoldingRuler=== |
| void 0||a.showFoldingRuler)}}).highlight(a.contentType||a.lang,l);if(j){var m=new p.CssContentAssistProvider,s=new t.HTMLContentAssistProvider,u=new v.JSTemplateContentAssistProvider;j.addEventListener("Activating",function(){/css$/.test(a.lang)?j.setProviders([m]):/js$/.test(a.lang)?j.setProviders([u]):/html$/.test(a.lang)&&j.setProviders([s])})}if(e.clientHeight<=50)f=l.getTextView().computeSize().height,e.style.height=f+"px";return l}var E=this.orion?this.orion.editor:void 0;if(E)for(var G=0;G< |
| arguments.length;G++)M(E,arguments[G]);return B});var orion=this.orion||(this.orion={}),editor=orion.editor||(orion.editor={});editor.edit=require("orion/editor/edit"); |