(function(){function k(){for(var c=navigator.userAgent,f={browser:!1,version:!1},b=[{name:"Chrome/Chromium",regExp:/(?:chrome|crios|chromium)\/(\d+)/i,minVersion:24},{name:"Firefox",regExp:/firefox\/(\d+)/i,minVersion:17},{name:"Microsoft Internet Explorer",regExp:/msie\s(\d+)/i,minVersion:10},{name:"Microsoft Internet Explorer",regExp:/Trident\/(\d+)/i,minVersion:6},{name:"Safari",regExp:/version\/(\d+).*?safari/i,minVersion:6}],e=0;e<b.length;e++){var d=b[e],m=c.match(d.regExp);if(m){f.browser=
!0;f.version=m[1]>=d.minVersion;f.name=d.name;break}}return f}function n(){try{return"localStorage"in window&&null!==window.localStorage}catch(c){return!1}}function l(c){alert(c);throw Error("unsupported browser");}var g=k();if(g.browser)g.version||l("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+g.name+".\n");else if(n()&&!localStorage.skipBrowserCheck)if(confirm("Sorry, your browser is not supported. The latest version of Chrome, Firefox or Safari web browser is recommended.\nContinue anyway?"))localStorage.skipBrowserCheck=
1;else throw"unsupported browser";else n()||l("Sorry, your browser is not supported.\n\nTo use Orion, the latest version of the Chrome, Firefox, or Safari web browser is recommended.\n");return{isSupportedBrowser:k,supportsLocalStorage:n,throwBrowserAlert:l}})();define("orion/browserCompatibility",function(){});
(function(k,n){"function"===typeof define&&define.amd?define("orion/Deferred",n):"object"===typeof exports?module.exports=n():(k.orion=k.orion||{},k.orion.Deferred=n())})(this,function(){function k(){for(var e;e=c.shift();)e();f=!1}function n(e){c.push(e);f||(f=!0,b())}function l(e){return function(d){e(d)}}function g(){function e(){for(var a;a=f.shift();){var d=a.deferred,e="fulfilled"===c?"resolve":"reject";a=a[e];if("function"===typeof a)try{var b=a(h),m=b&&("object"===typeof b||"function"===typeof b)&&
b.then;if("function"===typeof m)if(b===d.promise)d.reject(new TypeError);else{var q=b.cancel;"function"===typeof q?d._parentCancel=q.bind(b):delete d._parentCancel;m.call(b,l(d.resolve),l(d.reject),l(d.progress))}else d.resolve(b)}catch(g){d.reject(g)}else d[e](h)}}function d(a){delete q._parentCancel;c="rejected";h=a;f.length&&n(e)}function b(a){function v(a){return function(d){(!c||"assumed"===c)&&a(d)}}delete q._parentCancel;try{var u=a&&("object"===typeof a||"function"===typeof a)&&a.then;if("function"===
typeof u)if(a===q)d(new TypeError);else{c="assumed";var l=a&&a.cancel;if("function"!==typeof l){var k=new g;a=k.promise;try{u(k.resolve,k.reject,k.progress)}catch(y){k.reject(y)}l=a.cancel;u=a.then}h=a;u.call(a,v(b),v(d));q._parentCancel=l.bind(a)}else c="fulfilled",h=a,f.length&&n(e)}catch(x){v(d)(x)}}function a(){var a=q._parentCancel;a?(delete q._parentCancel,a()):c||(a=Error("Cancel"),a.name="Cancel",d(a))}var h,c,f=[],q=this;this.resolve=function(a){c||b(a);return q};this.reject=function(a){c||
d(a);return q};this.progress=function(a){c||f.forEach(function(d){if(d.progress)try{d.progress(a)}catch(h){}});return q.promise};this.cancel=function(){q._parentCancel?setTimeout(a,0):a();return q};this.then=function(a,d,h){var b=new g;b._parentCancel=q.promise.cancel;f.push({resolve:a,reject:d,progress:h,deferred:b});("fulfilled"===c||"rejected"===c)&&n(e);return b.promise};this.promise={then:q.then,cancel:q.cancel}}var c=[],f=!1,b=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var e=
process.nextTick;return function(){e(k)}}if("function"===typeof MutationObserver){var d=document.createElement("div");(new MutationObserver(k)).observe(d,{attributes:!0});return function(){d.setAttribute("class","_tick")}}return function(){setTimeout(k,0)}}();g.all=function(e,d){function b(a,d){f||(c[a]=d,0===--h&&q.resolve(c))}function a(a,h){if(!f){if(d)try{b(a,d(h));return}catch(e){h=e}q.reject(h)}}var h=e.length,c=[],f=!1,q=new g;q.then(void 0,function(){f=!0;e.forEach(function(a){a.cancel&&a.cancel()})});
0===h?q.resolve(c):e.forEach(function(d,h){d.then(b.bind(void 0,h),a.bind(void 0,h))});return q.promise};g.when=function(e,d,b,a){var h;e&&"function"===typeof e.then||(h=new g,h.resolve(e),e=h.promise);return e.then(d,b,a)};return g});
define("orion/EventTarget",[],function(){function k(){this._namedListeners={}}k.prototype={dispatchEvent:function(k){if(!k.type)throw Error("unspecified type");var l=this._namedListeners[k.type];l&&l.forEach(function(g){try{"function"===typeof g?g(k):g.handleEvent(k)}catch(c){"undefined"!==typeof console&&console.log(c)}});return!k.defaultPrevented},addEventListener:function(k,l){if("function"===typeof l||l.handleEvent)this._namedListeners[k]=this._namedListeners[k]||[],this._namedListeners[k].push(l)},
removeEventListener:function(k,l){var g=this._namedListeners[k];if(g)for(var c=0;c<g.length;c++)if(g[c]===l){1===g.length?delete this._namedListeners[k]:g.splice(c,1);break}}};k.prototype.constructor=k;k.attach=function(n){var l=new k;n.dispatchEvent=l.dispatchEvent.bind(l);n.addEventListener=l.addEventListener.bind(l);n.removeEventListener=l.removeEventListener.bind(l)};return k});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(k,n){function l(e,d,b){this._properties=b||{};this._properties["service.id"]=e;this._properties.objectClass=d;this._properties["service.names"]=d}function g(e,d,b){this._serviceId=e;this._serviceReference=d;this._internalRegistry=b}function c(e,d){function b(a){return function(){var b;try{if(!d())throw Error("Service was unregistered");var m=e[a].apply(e,Array.prototype.slice.call(arguments));if(m&&"function"===typeof m.then)return m;
b=new k;b.resolve(m)}catch(c){b=new k,b.reject(c)}return b.promise}}for(var a in e)"function"===typeof e[a]&&(this[a]=b(a))}function f(b,d){this.type=b;this.serviceReference=d}function b(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new n;var b=this;this._internalRegistry={isRegistered:function(d){return b._entries[d]?!0:!1},unregisterService:function(d){var m=b._entries[d];if(!m)throw Error("Service has already been unregistered: "+d);var a=m.reference;b._serviceEventTarget.dispatchEvent(new f("unregistering",
a));b._entries[d]=null;a.getProperty("objectClass").forEach(function(d){for(var m=b._namedReferences[d],c=0;c<m.length;c++)if(m[c]===a){1===m.length?delete b._namedReferences[d]:m.splice(c,1);break}})},modifyService:function(d){var m=b._entries[d];if(!m)throw Error("Service not found while trying to send modified event: "+d);b._serviceEventTarget.dispatchEvent(new f("modified",m.reference))}}}l.prototype={getPropertyKeys:function(){var b=[],d;for(d in this._properties)this._properties.hasOwnProperty(d)&&
b.push(d);return b},getProperty:function(b){return this._properties[b]}};l.prototype.constructor=l;g.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(b){var d=this._serviceReference._properties;this._serviceReference._properties=b||{};b["service.id"]=this._serviceId;
b.objectClass=d.objectClass;b["service.names"]=d["service.names"];this._internalRegistry.modifyService(this._serviceId)}};g.prototype.constructor=g;b.prototype={getService:function(b){var d;if("string"===typeof b)(b=this._namedReferences[b])&&b.some(function(b){d=this._entries[b.getProperty("service.id")].service;return!!d},this);else if(b=this._entries[b.getProperty("service.id")])d=b.service;return d||null},getServiceReferences:function(b){if(b)return this._namedReferences[b]?this._namedReferences[b]:
[];var d=[];this._entries.forEach(function(b){b&&d.push(b.reference)});return d},registerService:function(b,d,m){if("undefined"===typeof d||null===d)throw Error("invalid service");"string"===typeof b?b=[b]:Array.isArray(b)||(b=[]);var a=this._entries.length,h=new l(a,b,m),s=this._namedReferences;b.forEach(function(a){s[a]=s[a]||[];s[a].push(h)});b=new c(d,this._internalRegistry.isRegistered.bind(null,a));this._entries.push({reference:h,service:b});b=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new f("registered",
h));return new g(a,h,b)},addEventListener:function(b,d){this._serviceEventTarget.addEventListener(b,d)},removeEventListener:function(b,d){this._serviceEventTarget.removeEventListener(b,d)}};b.prototype.constructor=b;return{ServiceRegistry:b}});
define("orion/xhr",["orion/Deferred"],function(k){function n(l,g,c,f){var b="undefined"!==typeof c.response?c.response:c.responseText,e;try{e=c.status}catch(d){e=0}l={args:g,response:b,responseText:"string"===typeof b?b:null,status:e,url:l,xhr:c};"undefined"!==typeof f&&(l.error=f);return l}return function(l,g,c){c=c||{};var f=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,b=new k,e=c.headers||{},d=c.log||!1,m;"undefined"===typeof e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof c.data&&("POST"===l||"PUT"===l))m=c.data;var a=!1,h=!1;b.promise.then(void 0,function(d){a=!0;!h&&d instanceof Error&&"Cancel"===d.name&&f.abort()});f.onabort=function(){h=!0;if(!a){var d=Error("Cancel");d.name="Cancel";b.reject(d)}};f.onload=function(){var a=n(g,c,f);200<=f.status&&400>f.status?b.resolve(a):(b.reject(a),d&&"undefined"!==typeof console&&console.log(Error(f.statusText)))};f.onerror=function(){var a=n(g,c,f);b.reject(a);d&&"undefined"!==typeof console&&console.log(Error(f.statusText))};
f.onprogress=function(a){a.xhr=f;b.progress(a)};try{f.open(l,g,!0);"string"===typeof c.responseType&&(f.responseType=c.responseType);if("number"===typeof c.timeout)if("number"===typeof f.timeout)f.timeout=c.timeout,f.addEventListener("timeout",function(a){b.reject(n(g,c,f,"Timeout exceeded"))});else{var s=setTimeout(function(){b.reject(n(g,c,f,"Timeout exceeded"))},c.timeout);b.promise.then(clearTimeout.bind(null,s),clearTimeout.bind(null,s))}Object.keys(e).forEach(function(a){f.setRequestHeader(a,
e[a])});f.send(m||null)}catch(t){b.reject(n(g,c,f,t))}return b.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(k,n,l){function g(d,a){this._name=d;this._providers=a;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function c(d,a){return{get:function(h,b){if(0===a)return null;var e=localStorage.getItem(d+h);if(null===e)return null;e=JSON.parse(e);return b||-1===a||e._expires&&e._expires>(new Date).getTime()?(delete e._expires,e):null},set:function(h,b){if(0!==a)if(-1!==a&&(b._expires=(new Date).getTime()+
1E3*a),0===Object.keys(b).length)localStorage.removeItem(d+h);else{var e=JSON.stringify(b);localStorage.setItem(d+h,e);delete b._expires}},remove:function(a){localStorage.removeItem(d+a)}}}function f(d){this._currentPromises={};this._cache=new c("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var a=d.getServiceReferences("orion.core.preference.provider");0<a.length&&(this._service=d.getService(a[0]))}return!!this._service}}function b(d){this._location=
d;this._currentPromise=null;this._cache=new c("/orion/preferences/default",3600)}function e(){this._cache=new c("/orion/preferences/local",-1)}function d(d,a){this._userProvider=new f(d);this._localProvider=new e;a=a||"defaults.pref";-1===a.indexOf("://")&&(a=k.toUrl(a));this._defaultsProvider=new b(a);this._serviceRegistration=d.registerService("orion.core.preference",this)}g.prototype={_flush:function(){for(var d=[],a=0;a<this._stores.length;++a){var h=this._stores[a];-1!==this._dirty.indexOf(h)&&
d.push(this._providers[a].put(this._name,h));if(this._pendingDeletes[a]&&0<this._pendingDeletes[a].length){for(h=0;h<this._pendingDeletes[a].length;h++)d.push(this._providers[a].remove(this._name,this._pendingDeletes[a][h]));delete this._pendingDeletes[a]}}this._dirty=[];return n.all(d)},_scheduleFlush:function(d){d&&-1===this._dirty.indexOf(d)&&this._dirty.push(d);this._flushPending||(this._flushPending=!0,window.setTimeout(function(){this._flushPending&&(this._flushPending=!1,this._flush())}.bind(this),
0))},_getCached:function(){if(!this._cached){this._cached={};for(var d=0;d<this._stores.length;++d){var a=this._stores[d],h;for(h in a)a.hasOwnProperty(h)&&"undefined"===typeof this._cached[h]&&(this._cached[h]=a[h])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(d){return this._getCached()[d]},put:function(d,a){if(0!==this._stores.length){var h=this._stores[0];h[d]!==a&&(h[d]=a,this._cached=null,this._scheduleFlush(h))}},remove:function(d){for(var a=0;a<
this._stores.length;++a){var h=this._stores[a];if(h.hasOwnProperty(d))return delete h[d],this._pendingDeletes[a]||(this._pendingDeletes[a]=[]),this._pendingDeletes[a].push(d),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var d=0;d<this._stores.length;++d)this._stores[d]={},this._scheduleFlush(this._stores[d]);this._cached=null},sync:function(d){if(this._flushPending)return this._flushPending=!1,this._flush();for(var a=this,h=[],b=0;b<this._providers.length;++b)h.push(this._providers[b].get(this._name,
d).then(function(d){return function(h){a._stores[d]=h}}(b)));return n.all(h).then(function(){a._cached=null;a._getCached()})},flush:function(){this._flush()}};f.prototype={get:function(d,a){if(this._currentPromises[d])return this._currentPromises[d];var h=new n,b=null;a?this._cache.remove(d):b=this._cache.get(d);if(null!==b)h.resolve(b);else{this._currentPromises[d]=h;var e=this;this._service.get(d).then(function(a){e._cache.set(d,a);delete e._currentPromises[d];h.resolve(a)},function(a){404===a.status?
(a={},e._cache.set(d,a),delete e._currentPromises[d],h.resolve(a)):(delete e._currentPromises[d],h.resolve(e._cache.get(d,!0)||{}))})}return h},put:function(d,a){this._cache.set(d,a);return this._service.put(d,a)},remove:function(d,a){var h=this._cache.get(d);delete h[a];this._cache.set(d,h);return this._service.remove(d,a)}};b.prototype={get:function(d,a){if(this._currentPromise)return this._currentPromise;var h=new n,b=null;a?this._cache.remove(d):b=this._cache.get(d);if(null!==b)h.resolve(b);else{this._currentPromise=
h;var e=this;l("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=JSON.parse(a.response);e._cache.set(d,a[d]||{});e._currentPromise=null;h.resolve(a[d]||{})},function(a){401===a.xhr.status||404===a.xhr.status?(e._cache.set(d,{}),e._currentPromise=null,h.resolve({})):(e._currentPromise=null,a=e._cache.get(d,!0),null!==a?h.resolve(a[d]||{}):h.resolve({}))})}return h},put:function(d,a){var b=new n;b.resolve();return b},remove:function(d,a){var b=this._cache.get(d);
delete b[a];this.put(d,b)}};e.prototype={get:function(d){var a=new n;d=this._cache.get(d);null!==d?a.resolve(d):a.resolve({});return a},put:function(d,a){var b=new n;this._cache.set(d,a);b.resolve();return b},remove:function(d,a){var b=this._cache.get(d);delete b[a];this.put(d,b)}};d.DEFAULT_SCOPE=1;d.LOCAL_SCOPE=2;d.USER_SCOPE=4;d.prototype={listenForChangedSettings:function(b,a,h){if(!a||"number"!==typeof a||7<a||1>a)h=a,a=d.DEFAULT_SCOPE|d.LOCAL_SCOPE|d.USER_SCOPE;window.addEventListener("storage",
h,!1);return 0!==(d.USER_SCOPE&a)?"/orion/preferences/user"+b:0!==(d.LOCAL_SCOPE&a)?"/orion/preferences/local"+b:"/orion/preferences/default"+b},getPreferences:function(b,a){if(!a||"number"!==typeof a||7<a||1>a)a=d.DEFAULT_SCOPE|d.LOCAL_SCOPE|d.USER_SCOPE;var h=[];d.USER_SCOPE&a&&this._userProvider.available()&&h.push(this._userProvider);d.LOCAL_SCOPE&a&&h.push(this._localProvider);d.DEFAULT_SCOPE&a&&h.push(this._defaultsProvider);var e=new g(b,h);return e.sync().then(function(){return e})},getSetting:function(d,
a,b){for(var e,c=0;c<d.length;c++)if(d[c].label===a)for(var q=0;q<d[c].data.length;q++)if(d[c].data[q].label===b){e=d[c].data[q].value;break}return e}};return{PreferencesService:d}});
(function(){function k(a){if("string"!==typeof a)throw new TypeError;}function n(a){return a?a.split("\x26"):[]}function l(a){return 0===a.length?"":a.join("\x26")}function g(a){var p=/([^=]*)(?:=?)(.*)/.exec(a);a=p[1]?decodeURIComponent(p[1]):"";p=p[2]?decodeURIComponent(p[2]):"";return[a,p]}function c(a){var p=encodeURIComponent(a[0]);a[1]&&(p+="\x3d"+encodeURIComponent(a[1]));return p}function f(a,p){var d="",b=[],h=0;return{next:function(){d!==a.query&&(d=a.query,b=n(d));if(h<b.length){var e=
g(b[h++]);switch(p){case "keys":return e[0];case "values":return e[1];case "keys+values":return[e[0],e[1]];default:throw new TypeError;}}throw C;}}}function b(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function e(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function d(a){var p=[];a.split("/").forEach(function(a){".."===a?p.pop():"."!==a&&p.push(a)});return p.join("/")}function m(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function a(a,p){if("string"!==
typeof a)throw new TypeError;a=m(a);var b=q.exec(a);if(!b)return null;var h={};h.scheme=b[1]||"";if(h.scheme&&!v.test(h.scheme))return null;var A=b[2];if(A&&(A=r.exec(A),h.userinfo=A[1],h.host=A[2],h.port=A[3],h.port&&!u.test(h.port)))return null;h.path=b[3];h.query=b[4];h.fragment=b[5];!h.scheme&&p&&(h.scheme=p.scheme,!h.host&&p.host&&(h.userinfo=p.userinfo,h.host=p.host,h.port=p.port,h.pathRelative=!0));h.pathRelative&&(h.path?"/"!==h.path[0]&&(b=/^(.*\/)[^\/]*$/.exec(p.path)[1]||"/",h.path=b+h.path):
h.path=p.path);h.scheme&&(h.scheme=h.scheme.toLowerCase());h.port&&(h.port=e(h.port));h.host&&h.path&&(h.path=d(h.path));return h}function h(p,d){var h;if(d){d=d.href||d;h=a(d);if(!h||!h.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:h})}h=a(p,h);if(!h)throw new SyntaxError;Object.defineProperty(this,"_input",{value:p,writable:!0});Object.defineProperty(this,"_url",{value:h,writable:!0});var e=new b(this);Object.defineProperty(this,"query",{get:function(){return this._url?
e:null},enumerable:!0})}try{var s;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(s=new window.URL("http://www.w3.org?q")).protocol&&s.query)return}catch(t){}var q=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,r=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,v=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,u=/^\d*$/,w=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,z=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,y=/^([^?#\s]*)$/,x=/^([^\s]*)$/,p=/^\S*$/,A=/([^:]*):?(.*)/,C="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),B={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(b.prototype,{get:{value:function(a){k(a);var p;n(this._url.query).some(function(d){d=g(d);if(d[0]===a)return p=d[1],!0});return p},enumerable:!0},set:{value:function(a,p){k(a);k(p);var d=n(this._url.query);d.some(function(h,b){var e=g(h);if(e[0]===a)return e[1]=p,d[b]=c(e),!0})||d.push(c([a,p]));this._url.query=l(d)},enumerable:!0},has:{value:function(a){k(a);
return n(this._url.query).some(function(p){if(g(p)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){k(a);var p=n(this._url.query),d=p.filter(function(p){return g(p)[0]!==a});return d.length!==p.length?(this._url.query=l(d),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,p){if("function"!==typeof a)throw new TypeError;var d=f(this._url,"keys+values");try{for(;;){var h=d.next();a.call(p,h[1],h[0],this)}}catch(b){if(b!==C)throw b;
}},enumerable:!0},keys:{value:function(){return f(this._url,"keys")},enumerable:!0},values:{value:function(){return f(this._url,"values")},enumerable:!0},items:{value:function(){return f(this._url,"keys+values")}},size:{get:function(){return n(this._url.query).length},enumerable:!0},getAll:{value:function(a){k(a);var p=[];n(this._url.query).forEach(function(d){d=g(d);d[0]===a&&p.push(d[1])});return p},enumerable:!0},append:{value:function(a,p){k(a);k(p);var d=n(this._url.query);d.push(c([a,p]));this._url.query=
l(d)},enumerable:!0}});Object.defineProperties(h.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var p=a.scheme?a.scheme+":":"";a.host&&(p+="//",a.userinfo&&(p+=a.userinfo+"@"),p+=a.host,a.port&&(p+=":"+a.port));p+=a.path;a.query&&(p+="?"+a.query);a.fragment&&(p+="#"+a.fragment);a=p}else a=this._input;return a},set:function(p){k(p);this._input=p;this._url=a(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){k(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||v.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){k(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=A.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){k(a);if(this._url){var p=
A.exec(this._userinfo);a=[encodeURIComponent(a||"")];p[2]&&a.push(p[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=A.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){k(a);if(this._url){var p=[A.exec(this._userinfo)[1]||""];a&&p.push(encodeURIComponent(a));this._userinfo=p.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){k(a);if(this._url&&(a=z.exec(a)))this._url.host=a[1],this._url.port=e(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){k(a);this._url&&w.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===B[this.protocol]&&(a="");return a},set:function(a){k(a);this._url&&u.exec(a)&&(this._url.port=e(a))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){k(a);
this._url&&y.exec(a)&&(this._url.host&&a&&"/"!==a[0]&&(a="/"+a),this._url.path=a?d(a):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){k(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),x.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){k(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),p.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((s=window.URL||window.webkitURL)&&s.createObjectURL)Object.defineProperty(h,"createObjectURL",{value:s.createObjectURL.bind(s),enumerable:!1}),Object.defineProperty(h,"revokeObjectURL",{value:s.revokeObjectURL.bind(s),enumerable:!1});window.URL=h})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(k,n,l){function g(a,d){var h=Object.keys(a),b=Object.keys(d);if(h.length!==b.length)return!1;h.sort();b.sort();for(var e=0,c=h.length;e<c;e++){var m=h[e];if(m!==b[e])return!1;var f=a[m],m=d[m];if(f!==m&&JSON.stringify(f)!==JSON.stringify(m))return!1}return!0}function c(a){if(-1===a.indexOf("://"))try{return(new URL(a,location.href)).href}catch(d){}return a}function f(a){var d=null,h={key:function(h){return(d=
d||Object.keys(a))[h]},getItem:function(d){return a[d]},setItem:function(h,b){a[h]=b;d=null},removeItem:function(h){delete a[h];d=null},clear:function(){(d=d||Object.keys(a)).forEach(function(d){delete a[d]}.bind(this));d=null}};Object.defineProperty(h,"length",{get:function(){return(d=d||Object.keys(a)).length}});return h}function b(a,d){if(d&&d instanceof XMLHttpRequest){var h,b;try{h=d.status,b=d.statusText}catch(e){h=0,b=""}return{status:h||0,statusText:b}}return d}function e(a){var d=a?JSON.parse(JSON.stringify(a,
b)):a;a instanceof Error&&(d.__isError=!0,d.message=d.message||a.message,d.name=d.name||a.name);return d}function d(a,d){this.type=a;this.plugin=d}function m(a,d){this.__objectId=a;this.__methods=d}function a(a,h,b){function c(a){R&&b.postMessage(a,R)}function f(a){if(!R)return(new k).reject(Error("plugin not connected"));a.id=String(P++);var p=new k;W[a.id]=p;p.then(null,function(p){"active"===I&&p instanceof Error&&"Cancel"===p.name&&c({requestId:a.id,method:"cancel",params:p.message?[p.message]:
[]})});var d=Object.prototype.toString;a.params.forEach(function(b,h){if("[object Object]"===d.call(b)&&!(b instanceof m)){var e,A;for(e in b)"[object Function]"===d.call(b[e])&&(A=A||[],A.push(e));if(A){var C=U++;S[C]=b;e=function(){delete S[C]};p.then(e,e);a.params[h]=new m(C,A)}}});b.postMessage(a,R);return p.promise}function u(a,p){a||0===a?c({id:a,result:null,error:p}):console.log(p)}function l(a,p,d,b){b.forEach(function(a,p){if(a&&"undefined"!==typeof a.__objectId){var d={};a.__methods.forEach(function(p){d[p]=
function(){return f({objectId:a.__objectId,method:p,params:Array.prototype.slice.call(arguments)})}});b[p]=d}});var h=void 0===typeof a?null:{id:a,result:null,error:null};try{var A=d.apply(p,b);h&&(A&&"function"===typeof A.then?(X[a]=A,A.then(function(p){delete X[a];h.result=p;c(h)},function(p){X[a]&&(delete X[a],h.error=e(p),c(h))},function(){c({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(h.result=A,c(h)))}catch(C){h&&(h.error=e(C),c(h))}}function z(a){try{if(a.method){var p=
a.method,d=a.params||[];if("serviceId"in a){var h=Q[a.serviceId];h||u(a.id,"service not found");p in h?l(a.id,h,h[p],d):u(a.id,"method not found")}else if("objectId"in a){var e=S[a.objectId];e||u(a.id,"object not found");p in e?l(a.id,e,e[p],d):u(a.id,"method not found")}else if("requestId"in a){var A=X[a.requestId];A&&"cancel"===p&&A.cancel&&A.cancel.apply(A,d)}else if("responseId"in a){var c=W[a.responseId];c&&"progress"===p&&c.progress&&c.progress.apply(c,d)}else if("plugin"===a.method){var m=
a.params[0];F({headers:m.headers,services:m.services}).then(function(){T&&T.resolve(C)})}else if("timeout"===a.method)T&&T.reject(a.error);else throw Error("Bad method: "+a.method);}else{var s=W[String(a.id)];delete W[String(a.id)];if(a.error){var f=b.handleServiceError(C,a.error);s.reject(f)}else s.resolve(a.result)}}catch(g){console.log("Plugin._messageHandler "+g)}}function y(a){var p={};if(a.methods&&(a.methods.forEach(function(d){p[d]=function(){var p={serviceId:a.serviceId,method:d,params:Array.prototype.slice.call(arguments)};
return"active"===I?f(p):C.start({"transient":!0}).then(function(){return f(p)})}}),p.addEventListener&&p.removeEventListener)){var d=new n,b=U++;S[b]={handleEvent:d.dispatchEvent.bind(d)};var h=new m(b,["handleEvent"]),e=p.addEventListener;p.addEventListener=function(a,p){d._namedListeners[a]||e(a,h);d.addEventListener(a,p)};var A=p.removeEventListener;p.removeEventListener=function(a,p){d.removeEventListener(a,p);d._namedListeners[a]||A(a,h)}}return p}function x(p){var d=JSON.parse(JSON.stringify(p.properties));
d.__plugin__=a;p=p.names||p.type||[];Array.isArray(p)||(p=[p]);d.objectClass=p;return d}function p(a){var p=y(a),d=x(a),d=b.registerService(a.names||a.type,p,d);M[a.serviceId]={registration:d,proxy:p}}function A(){b.persist(a,{created:B,headers:J,services:E,autostart:G,lastModified:H})}var C=this;h=h||{};var B=h.created||(new Date).getTime(),J=h.headers||{},E=h.services||[],G=h.autostart,H=h.lastModified||0,I="installed",K,T,R,O,M={},P=0,U=0,X={},W={},S={},Q={},F;this._persist=A;this._resolve=function(){I=
"resolved";b.dispatchEvent(new d("resolved",C))};this._getAutostart=function(){return G};this._getCreated=function(){return B};this.getLocation=function(){return a};this.getHeaders=function(){return JSON.parse(JSON.stringify(J))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return H};this.getServiceReferences=function(){var a=[];Object.keys(M).forEach(function(p){a.push(M[p].registration.getReference())});
return a};this.setParent=function(a){return O!==a?(O=a,C.stop({"transient":!0}).then(function(){if("started"===G)return C.start({"transient":!0});if("lazy"===G)return C.start({lazy:!0,"transient":!0})})):(new k).resolve()};this.getState=function(){return I};this.start=function(h){if("uninstalled"===I)return(new k).reject(Error("Plugin is uninstalled"));if(K)return K.promise.then(this.start.bind(this,h));if("active"===I)return(new k).resolve();if(!h||!h.transient){var e=h&&h.lazy?"lazy":"started";
e!==G&&(G=e,A())}e=b.getState();if("starting"!==e&&"active"!==e)return h.transient?(new k).reject(Error("start transient error")):(new k).resolve();if("installed"===I)try{this._resolve()}catch(c){return(new k).reject(c)}"resolved"===I&&E.forEach(function(a){p(a)});if(h&&h.lazy)return"starting"!==I&&(I="starting",b.dispatchEvent(new d("lazy activation",C))),(new k).resolve();var m=new k;K=m;I="starting";b.dispatchEvent(new d("starting",C));T=new k;R=b.connect(a,z,O);T.then(function(){T=null;I="active";
b.dispatchEvent(new d("started",C));K=null;m.resolve()},function(){T=null;I="stopping";b.dispatchEvent(new d("stopping",C));Object.keys(M).forEach(function(a){M[a].registration.unregister();delete M[a]});b.disconnect(R);R=null;I="resolved";K=null;b.dispatchEvent(new d("stopped",C));m.reject(Error("plugin activation error"))});return m.promise};this.stop=function(a){if("uninstalled"===I)return(new k).reject(Error("Plugin is uninstalled"));if(K)return K.promise.then(this.stop.bind(this,a));if((!a||
!a.transient)&&"stopped"!==G)G="stopped",A();if("active"!==I&&"starting"!==I)return(new k).resolve();K=a=new k;I="stopping";b.dispatchEvent(new d("stopping",C));Object.keys(M).forEach(function(a){M[a].registration.unregister();delete M[a]});R&&(b.disconnect(R),R=null);I="resolved";K=null;b.dispatchEvent(new d("stopped",C));a.resolve();return a.promise};F=function(h){if("uninstalled"===I)return(new k).reject(Error("Plugin is uninstalled"));if(!h)return 0===H&&(H=(new Date).getTime(),A()),b.loadManifest(a).then(F);
var e=J,c=E,m=G;J=h.headers||{};E=h.services||{};G=h.autostart||G;h.lastModified?H=h.lastModified:(H=(new Date).getTime(),A());if(g(J,e)&&g(E,c)&&G===m)return(new k).resolve();if("active"===I||"starting"===I){var f=[];Object.keys(E).forEach(function(a){var d=E[a];f.push(a);var h=M[a];if(h){if(g(d.methods,Object.keys(h.proxy))){a=x(d);var b=h.registration.getReference(),e={};b.getPropertyKeys().forEach(function(a){e[a]=b.getProperty(a)});g(a,e)||h.registration.setProperties(a);return}h.registration.unregister();
delete M[a]}p(d)});Object.keys(M).forEach(function(a){-1===f.indexOf(a)&&(M[a].registration.unregister(),delete M[a])})}"active"===I&&(b.disconnect(R),T=new k,R=b.connect(a,z,O),T.then(function(){T=null},function(){T=null;I="stopping";b.dispatchEvent(new d("stopping"),C);Object.keys(M).forEach(function(a){M[a].registration.unregister();delete M[a]});b.disconnect(R);R=null;I="resolved";b.dispatchEvent(new d("stopped",C))}));return(new k).resolve()};this.update=function(a){return F(a).then(function(){b.dispatchEvent(new d("updated",
C))})};this.uninstall=function(){if("uninstalled"===I)return(new k).reject(Error("Plugin is uninstalled"));if("active"===I||"starting"===I||"stopping"===I)return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));b.removePlugin(this);I="uninstalled";b.dispatchEvent(new d("uninstalled",C));return(new k).resolve()}}var h=/^http[s]?/i;return{Plugin:a,PluginRegistry:function(b,e){function m(a){var p=a.source;z.some(function(d){if(p===d.target){try{var h;if("undefined"===typeof d.useStructuredClone){var b=
"string"!==typeof a.data;h=b?a.data:JSON.parse(a.data);d.useStructuredClone=b}else h=d.useStructuredClone?a.data:JSON.parse(a.data);d.handler(h)}catch(e){}return!0}})}e=e||{};var g=e.storage||localStorage;g.getItem||(g=f(g));var v="installed",u,l=[],z=[],y=new n,x={},p={registerService:b.registerService.bind(b),connect:function(a,p,d,h){function b(a){a=Error(a);a.name="timeout";p({method:"timeout",error:a})}var e={handler:p,url:a},c=setTimeout(b.bind(null,"Load timeout for: "+a),h||15E3),m=document.createElement("iframe");
m.name=a+"_"+(new Date).getTime();m.src=a;m.onload=function(){clearTimeout(c);c=setTimeout(b.bind(null,"Plugin handshake timeout for: "+a),5E3)};m.sandbox="allow-scripts allow-same-origin";m.style.width=m.style.height="100%";m.frameBorder=0;(d||u).appendChild(m);e.target=m.contentWindow;e.close=function(){clearTimeout(c);if(m){var a=m.parentNode;a&&a.removeChild(m);m=null}};z.push(e);return e},disconnect:function(a){for(var p=0;p<z.length;p++)if(a===z[p]){z.splice(p,1);try{a.close()}catch(d){}break}},
removePlugin:function(a){for(var p=0;p<l.length;p++)if(a===l[p]){l.splice(p,1);break}g.removeItem("plugin."+a.getLocation())},persist:function(a,p){g.setItem("plugin."+a,JSON.stringify(p))},postMessage:function(a,p){p.target.postMessage(p.useStructuredClone?a:JSON.stringify(a),p.url)},dispatchEvent:function(a){try{y.dispatchEvent(a)}catch(p){console&&console.log("PluginRegistry.dispatchEvent "+p)}},loadManifest:function(a){var d=new k,h=p.connect(a,function(a){h&&a.method&&("manifest"===a.method||
"plugin"===a.method?(a=a.params[0],p.disconnect(h),h=null,d.resolve(a)):"timeout"===a.method&&(p.disconnect(h),h=null,d.reject(a.error)))});return d.promise},getState:function(){return v},handleServiceError:function(a,p){if(p&&401===p.status){var d=a.getHeaders(),b=a.getName()||a.getLocation(),e=document.createElement("span");e.appendChild(document.createTextNode("Authentication required for: "+b+"."));d.login&&(e.appendChild(document.createTextNode(" ")),b=document.createElement("a"),b.target="_blank",
b.textContent="Login",b.href=d.login,h.test(b.href)?(e.appendChild(b),e.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+d.login));return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(e)}}if(p.__isError){var c=p;p=Error(c.message);Object.keys(c).forEach(function(a){p[a]=c[a]});delete p.__isError}return p}};this.getLocation=function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};
this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=p.getState;this.init=function(){if(!("starting"===v||"active"===v||"stopping"===v)){addEventListener("message",m,!1);for(var d=[],h=0,b=g.length;h<b;h++)d.push(g.key(h));d.forEach(function(d){if(0===d.indexOf("plugin.")){var h=d.substring(7);d=JSON.parse(g.getItem(d));d.created&&l.push(new a(h,d,p))}});l.sort(function(a,p){return a._getCreated()<p._getCreated()?-1:1});e.parent?u=e.parent:(u=document.createElement("div"),
e.visible||(u.style.display="none",u.style.visibility="hidden"),document.body.appendChild(u));e.plugins&&Object.keys(e.plugins).forEach(function(d){d=c(d);if(!this.getPlugin(d)){var h=e.plugins[d];"object"!==typeof h&&(h={});h.autostart=h.autostart||e.defaultAutostart||"lazy";l.push(new a(d,h,p))}}.bind(this));v="starting"}};this.start=function(){"starting"!==v&&this.init();if("starting"!==v)return(new k).reject("Cannot start framework. Framework is already "+v+".");var a=[],p=(new Date).getTime();
l.forEach(function(d){var h=d._getAutostart();0===d.getLastModified()?a.push(d.update().then(function(){if("started"===h)return d.start({"transient":!0});if("lazy"===h)return d.start({lazy:!0,"transient":!0});d._resolve()})):"started"===h?a.push(d.start({"transient":!0})):"lazy"===h?(a.push(d.start({lazy:!0,"transient":!0})),p>d.getLastModified()+864E5&&d.update()):d._resolve()});return k.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){v="active"})};this.stop=function(){if("starting"!==
v&&"active"!==v)return(new k).reject("Cannot stop registry. Registry is already "+v+".");v="stopping";var a=[];l.forEach(function(p){a.push(p.stop({"transient":!0}))});return k.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){if(!e.parent){var a=u.parentNode;a&&a.removeChild(u)}u=null;removeEventListener("message",m);v="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new k).reject("Cannot uninstall registry")};
this.installPlugin=function(h,b){h=c(h);var e=this.getPlugin(h);if(e)return(new k).resolve(e);if(x[h])return x[h];if(b)return e=new a(h,b,p),l.push(e),e._persist(),p.dispatchEvent(new d("installed",e)),(new k).resolve(e);var m=p.loadManifest(h).then(function(b){e=new a(h,b,p);l.push(e);e._persist();delete x[h];p.dispatchEvent(new d("installed",e));return e},function(a){delete x[h];throw a;});return x[h]=m};this.getPlugins=function(){return l.slice()};this.getPlugin=function(a){var p=null;a=c(a);l.some(function(d){if(a===
d.getLocation())return p=d,!0});return p};this.addEventListener=y.addEventListener.bind(y);this.removeEventListener=y.removeEventListener.bind(y);this.resolvePlugins=function(){var a=!0;l.forEach(function(p){a=a&&p._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function k(g,c){function f(a){var h=a.getProperty("service.id"),b=this.addingService(a);b&&(e[h]=a,d[h]=b)}function b(a){var h=a.getProperty("service.id"),b=d[h];delete e[h];delete d[h];this.removedService(a,b)}this.serviceRegistry=g;var e={},d={},m=n,a,h;this.close=function(){if(m!==l)throw"Already closed";m=n;g.removeEventListener("registered",a);g.removeEventListener("unregistering",h);h=a=null;var d=this;this.getServiceReferences().forEach(function(a){b.call(d,
a)});if("function"===typeof this.onClose)this.onClose()};this.getServiceReferences=function(){var a=Object.keys(e);return!a.length?null:a.map(function(a){return e[a]})};this.open=function(){if(m!==n)throw"Already open";m=l;var d=this;a=function(a){if(-1!==a.serviceReference.getProperty("objectClass").indexOf(c)&&(f.call(d,a.serviceReference),"function"===typeof d.onServiceAdded))return d.onServiceAdded(a.serviceReference,d.serviceRegistry.getService(a.serviceReference))};h=function(a){-1!==a.serviceReference.getProperty("objectClass").indexOf(c)&&
b.call(d,a.serviceReference)};g.addEventListener("registered",a);g.addEventListener("unregistering",h);g.getServiceReferences(c).forEach(function(a){f.call(d,a);if("function"===typeof d.onServiceAdded)return d.onServiceAdded(a,g.getService(a))});if("function"===typeof this.onOpen)this.onOpen()}}var n=0,l=1;k.prototype={addingService:function(g){return this.serviceRegistry.getService(g)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(g,c){}};return k});
define("orion/objects",[],function(){function k(k){for(var l=1;l<arguments.length;l++){var g=arguments[l],c;for(c in g)Object.prototype.hasOwnProperty.call(g,c)&&(k[c]=g[c])}return k}return{clone:function(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var l=Object.create(Object.getPrototypeOf(n));k(l,n);return l},mixin:k,toArray:function(k){return Array.isArray(k)?k:[k]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(k,n,l){var g,c,f,b,e,d="pid";g=function(a,h,b){function e(a,d,b){d.forEach(function(e,c){try{var p=a[c].getProperty("__plugin__"),A=p&&h.getPlugin(p);(!p||A&&"active"===A.getState())&&d[c].updated(b)}catch(m){"undefined"!==typeof console&&console.log(m)}})}n.call(this,a,"orion.cm.managedservice");var c={},m={},f=function(h){var e=[];h.plugin.getServiceReferences().forEach(function(h){if(-1!==h.getProperty("objectClass").indexOf("orion.cm.managedservice")){var c=
h.getProperty(d);h=a.getService(h);c&&h&&(c=(c=b._find(c))&&c.getProperties(),e.push(h.updated(c)))}});return k.all(e)};this.addingService=function(h){var b=h.getProperty(d),e=a.getService(h);if(!b||!e)return null;c[b]||(c[b]=[]);m[b]||(m[b]=[]);c[b].push(h);m[b].push(e);return e};this.onServiceAdded=function(a,h){var c=a.getProperty(d),c=b._find(c);e([a],[h],c&&c.getProperties())};this.onOpen=function(){h.addEventListener("started",f)};this.onClose=function(){h.removeEventListener("started",f)};
this.notifyUpdated=function(a){var d=a.getPid();e(c[d]||[],m[d]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();e(c[a]||[],m[a]||[],null)};this.removedService=function(a,h){var b=a.getProperty(d),e=c[b],f=m[b];1<e.length?e.splice(e.indexOf(a),1):delete c[b];1<f.length?f.splice(f.indexOf(h),1):delete m[b]}};c=function(){function a(a,d,e){this.store=new f(this,e);this.configAdmin=new b(this,this.store);this.tracker=new g(a,d,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(d){a.tracker.open();return d})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();b=function(){function a(a,d){this.factory=a;this.store=d}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var m="/cm/configurations";
f=function(){function a(a,b){this.factory=a;this.prefsService=b;this.configs=Object.create(null);this.pref=null;var c=this;this.initPromise=this.prefsService.getPreferences(m).then(function(a){c.pref=a;a.keys().forEach(function(h){if(!c.configs[h]){var b=a.get(h);"object"===typeof b&&null!==b&&0<Object.keys(b).length&&(b[d]=h,c.configs[h]=new e(c.factory,c,b))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var d=this._find(a);
d||(d=new e(this.factory,this,a),this.configs[a]=d);return d},list:function(){var a=this,d=[];this.pref.keys().forEach(function(b){(b=a._find(b))&&null!==b.getProperties()&&d.push(b)});return d},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,d){this.pref.put(a,d.getProperties(!0)||{})}};return a}();e=function(){function a(a,b){b=l.clone(b);delete b[d];a.properties=b}function b(h,e,c){this.factory=h;this.store=e;if(null!==c&&"object"===typeof c)this.pid=c[d],a(this,
c);else if("string"===typeof c)this.pid=c,this.properties=null;else throw Error("Invalid pid/properties "+c);}b.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var b=null;this.properties&&(b=l.clone(this.properties),a||(b[d]=this.pid));return b},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(d){this._checkRemoved();a(this,d);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return b}();return{ConfigurationAdminFactory:c}});
define("orion/bootstrap","require orion/Deferred orion/serviceregistry orion/preferences orion/pluginregistry orion/config".split(" "),function(k,n,l,g,c,f){var b;return{startup:function(){if(b)return b;b=new n;var e=new l.ServiceRegistry,d=new g.PreferencesService(e);return d.getPreferences("/plugins").then(function(m){var a={plugins:{}};m.keys().forEach(function(d){var b=k.toUrl(d);a.plugins[b]=m[d]});var h=new c.PluginRegistry(e,a);return h.start().then(function(){if(0<e.getServiceReferences("orion.core.preference.provider").length)return d.getPreferences("/plugins",
d.USER_SCOPE).then(function(a){var d=[];a.keys().forEach(function(a){a=k.toUrl(a);h.getPlugin(a)||d.push(h.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return n.all(d,function(a){console.log(a)})})}).then(function(){return(new f.ConfigurationAdminFactory(e,h,d)).getConfigurationAdmin().then(e.registerService.bind(e,"orion.cm.configadmin"))}).then(function(){var a=e.getService("orion.core.auth");if(a){var d=a.getUser().then(function(d){if(d)localStorage.setItem("lastLogin",
(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),b=localStorage.getItem("lastLogin");if(!b||b<(new Date).getTime()-9E5)return d}}).then(function(){var a={serviceRegistry:e,preferences:d,pluginRegistry:h};b.resolve(a);return a})})}}});
(function(){function k(c,f,b,e,d,m){f[c]&&(b.push(c),(!0===f[c]||1===f[c])&&e.push(d+c+"/"+m))}function n(c,f,b,e,d){f=e+f+"/"+d;require._fileExists(c.toUrl(f+".js"))&&b.push(f)}function l(c,f,b){for(var e in f)f.hasOwnProperty(e)&&(!c.hasOwnProperty(e)||b)?c[e]=f[e]:"object"===typeof f[e]&&l(c[e],f[e],b)}var g=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(c){var f=c.config?c.config():{},f=f||{};return{version:"2.0.1+",load:function(b,e,d,c){c=c||{};c.locale&&(f.locale=
c.locale);var a=g.exec(b),h=a[1],s=a[4],t=a[5],q=s.split("-"),r=[],v={},u,w="";a[5]?(h=a[1],b=h+t):(t=a[4],s=f.locale,s||(s=f.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),q=s.split("-"));if(c.isBuild){r.push(b);n(e,"root",r,h,t);for(u=0;u<q.length;u++)c=q[u],w+=(w?"-":"")+c,n(e,w,r,h,t);e(r,function(){d()})}else e([b],function(a){var b=[],c;k("root",a,b,r,h,t);for(u=0;u<q.length;u++)c=q[u],w+=(w?"-":"")+c,k(w,a,b,r,h,t);e(r,function(){var p,
c,m;for(p=b.length-1;-1<p&&b[p];p--){m=b[p];c=a[m];if(!0===c||1===c)c=e(h+m+"/"+t);l(v,c)}d(v)})})}}})})();
define("orion/i18n",[],function(){return{load:function(k,n,l,g){g=g||{};var c=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,f=c.exec(k);if(f){if(!n.defined||n.defined(k))try{l(n(k));return}catch(b){}if(g.isBuild||g.isTest)l({});else if(n.specified&&!n.specified("orion/bootstrap"))l({});else{var e=f[1],d=f[3]?f[2]:"",m=f[3]||f[2];n(["orion/bootstrap"],function(a){a.startup().then(function(a){var b=a.serviceRegistry;a=b.getServiceReferences("orion.i18n.message");if(d)a.some(function(a){return k===a.getProperty("name")?
(b.getService(a).getMessageBundle().then(function(a){l(a)},function(){l({})}),!0):!1})||l({});else{var t={},q;a.forEach(function(a){var b=a.getProperty("name");if((f=c.exec(b))&&e===f[1]&&m===(f[3]||f[2]))if(d=f[3]?f[2]:""){if((a=g.locale||("undefined"!==typeof navigator?navigator.language||navigator.userLanguage:null))&&0===a.toLowerCase().indexOf(d.toLowerCase()))t[d]=!0,(!n.specified||!n.specified(b))&&define(b,["orion/i18n!"+b],function(a){return a})}else q=a});!n.specified||!n.specified(k)?q?
b.getService(q).getMessageBundle().then(function(a){Object.keys(t).forEach(function(d){"undefined"===typeof a[d]&&(a[d]=t[d])});define(k,[],a);l(a)},function(){define(k,[],t);l(t)}):(define(k,[],t),l(t)):l(t)}})})}}else l(null)}}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/util",[],function(){var k=navigator.userAgent,n=-1!==k.indexOf("MSIE")||-1!==k.indexOf("Trident")?document.documentMode:void 0,l=parseFloat(k.split("Firefox/")[1]||k.split("Minefield/")[1])||void 0,g=-1!==k.indexOf("Opera")?parseFloat(k.split("Version/")[1]):void 0,c=parseFloat(k.split("Chrome/")[1])||void 0,f=-1!==k.indexOf("Safari")&&!c,b=parseFloat(k.split("WebKit/")[1])||void 0,e=-1!==k.indexOf("Android"),d=-1!==k.indexOf("iPad"),k=-1!==k.indexOf("iPhone"),m=d||k,a=-1!==navigator.platform.indexOf("Mac"),
h=-1!==navigator.platform.indexOf("Win"),s=-1!==navigator.platform.indexOf("Linux"),t="ontouchstart"in document.createElement("input");return{formatMessage:function(a){var d=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,b){return d[(b<<0)+1]})},createElement:function(a,d){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",d):a.createElement(d)},isIE:n,isFirefox:l,isOpera:g,isChrome:c,isSafari:f,isWebkit:b,isAndroid:e,isIPad:d,isIPhone:k,isIOS:m,isMac:a,isWindows:h,
isLinux:s,isTouch:t,platformDelimiter:h?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(k){function n(d,b){b||(b=document);return b.querySelectorAll(d)}function l(d){var b=d.tabIndex;0===b&&k.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[d.nodeName.toLowerCase()]&&!d.attributes.tabIndex&&(b=-1);return b}function g(d){if(0<=l(d))return d;if(d.hasChildNodes())for(var b=0;b<d.childNodes.length;b++){var a=g(d.childNodes[b]);if(a)return a}return null}function c(d){if(0<=
l(d))return d;if(d.hasChildNodes())for(var b=d.childNodes.length-1;0<=b;b--){var a=c(d.childNodes[b]);if(a)return a}return null}function f(d,e){if(3===d.nodeType){var a=b.exec(d.nodeValue);a&&1<a.length&&e(d,a)}if(d.hasChildNodes())for(a=0;a<d.childNodes.length;a++)f(d.childNodes[a],e)}var b=/\$\{([^\}]+)\}/,e=null;return{$:function(d,b){b||(b=document);return b.querySelector(d)},$$:n,$$array:function(d,b){return Array.prototype.slice.call(n(d,b))},node:function(d){var b=d;"string"===typeof d&&(b=
document.getElementById(d));return b},contains:function(d,b){if(!d||!b)return!1;if(d===b)return!0;var a=d.compareDocumentPosition(b);return Boolean(a&16)},bounds:function(d){d=d.getBoundingClientRect();return{left:d.left+document.documentElement.scrollLeft,top:d.top+document.documentElement.scrollTop,width:d.width,height:d.height}},empty:function(d){for(;d.hasChildNodes();)d.removeChild(d.firstChild)},firstTabbable:g,lastTabbable:c,stop:function(d){window.document.all&&(d.keyCode=0);d.preventDefault&&
(d.preventDefault(),d.stopPropagation())},processTextNodes:function(d,b){f(d,function(a,d){a.parentNode.replaceChild(document.createTextNode(b[d[1]]||d[1]),a)})},processDOMNodes:function(d,b){f(d,function(a,d){var e=b[d[1]];if(e){var c=document.createRange(),q=d.index;c.setStart(a,q);c.setEnd(a,q+d[0].length);c.deleteContents();c.insertNode(e)}})},addAutoDismiss:function(d,b){function a(a){e.forEach(function(d){var b=!1,e=d.excludeNodes.some(function(d){return document.body.contains(d)?(b=!0,d.contains(a.target)):
!1});if(b&&!e)try{d.dismiss(a)}catch(c){"undefined"!==typeof console&&console&&console.error(c&&c.message)}});e=e.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}null===e&&(e=[],document.addEventListener("click",a,!0),k.isIOS&&document.addEventListener("touchend",function(a){function d(){a.target.removeEventListener("click",d)}0===a.touches.length&&a.target.addEventListener("click",d)},!1));e.push({excludeNodes:d,dismiss:b})},setFramesEnabled:function(d){for(var b=
document.getElementsByTagName("iframe"),a=0;a<b.length;a++)b[a].parentNode.style.pointerEvents=d?"":"none"},removeAutoDismiss:function(d){e=e.filter(function(b){return d!==b.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/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(k,n,l){function g(b){l.attach(this);this._init(b)}function c(b,e){var d=document.createElement(void 0===e?"span":e);d.tabIndex=0;d.className="dropdownMenuItem";d.role="menuitem";var c=document.createElement("span");c.appendChild(document.createTextNode(b));c.classList.add("dropdownCommandName");d.appendChild(c);c=document.createElement("li");c.appendChild(d);return c}function f(){var b=document.createElement("li");
b.classList.add("dropdownSeparator");return b}g.prototype={_init:function(b){this._dropdownNode=n.node(b.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=b.populate;this._selectionClass=b.selectionClass;this._parentDropdown=b.parentDropdown;this._positioningNode=b.positioningNode;if(!this._parentDropdown)for(var e=this._dropdownNode.parentNode;e&&document!==e;){if(e.classList&&e.classList.contains("dropdownMenu")){this._parentDropdown=e.dropdown;break}e=e.parentNode}this._dropdownNode.tabIndex=
0;this._triggerNode=b.triggerNode?b.triggerNode:n.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!b.skipTriggerEventListeners){var d=this;this._triggerNode.addEventListener("click",function(b){d.toggle(b)&&n.stop(b)},!1);"span"===this._triggerNode.tagName.toLowerCase()&&this._triggerNode.addEventListener("keydown",function(b){if(b.keyCode===n.KEY.ENTER||b.keyCode===n.KEY.SPACE)d.toggle(),n.stop(b)},!1)}this._dropdownNode.addEventListener("keydown",
this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(b){var e=this;b.addEventListener("click",function(d){e.toggle(d)&&n.stop(d)},!1)},toggle:function(b){return this.isVisible()?this.close():this.open(b)},isVisible:function(){return this._isVisible},open:function(b){var e=!1;this.isVisible()||(this.dispatchEvent({type:"triggered",dropdown:this,event:b}),n.setFramesEnabled(!1),this._populate&&(this.empty(),this._populate(this._dropdownNode)),0<this.getItems().length&&(this._hookedAutoDismiss||
(this._boundAutoDismiss?n.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),e=n.$$array(".dropdownSubMenu",this._dropdownNode),n.addAutoDismiss([this._triggerNode].concat(e),this._boundAutoDismiss),this._hookedAutoDismiss=!0),this._triggerNode.classList.add("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.add(this._selectionClass),this._dropdownNode.classList.add("dropdownMenuOpen"),this._isVisible=!0,this._positionDropdown(b),this._dropdownNode.focus(),
e=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)));return e},_autoDismiss:function(b){if(this.close(!1)&&this._dropdownNode.contains(b.target))for(b=this._parentDropdown;b;)b.close(!1),b=b._parentDropdown},_positionDropdown:function(b){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px";else{b=n.bounds(this._dropdownNode);var e=n.bounds(document.body);if(b.left+b.width>e.left+
e.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-b.width+"px";else{var d=n.bounds(this._boundingNode(this._triggerNode)),c=n.bounds(this._triggerNode);this._dropdownNode.style.left=c.left-d.left-b.width+c.width+"px"}b=b.top+b.height-(e.top+e.height);0<b&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-b)+"px")}},_boundingNode:function(b){var e=window.getComputedStyle(b,null);return null===e||"absolute"===e.getPropertyValue("position")||
!b.parentNode||b===document.body?b:this._boundingNode(b.parentNode)},close:function(b){var e=!1;this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),n.setFramesEnabled(!0),b&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=null),e=!0);return e},
getItems:function(){var b=[],e=this;n.$$array("li:not(.dropdownSeparator) \x3e .dropdownMenuItem",this._dropdownNode,!0).forEach(function(d){d.parentNode.parentNode===e._dropdownNode&&b.push(d)});b.forEach(function(d){d._hasDropdownMouseover||(d.addEventListener("mouseover",function(b){d.dropdown?d.dropdown.open(b):(e._closeSelectedSubmenu(),n.stop(b));e._selectItem(d)}),d._hasDropdownMouseover=!0)});return b},empty:function(){var b=this;n.$$array("li",this._dropdownNode).forEach(function(e){e.parentNode===
b._dropdownNode&&e.parentNode.removeChild(e)});this._hookedAutoDismiss=!1},_dropdownKeyDown:function(b){if(b.keyCode===n.KEY.UP||b.keyCode===n.KEY.DOWN||b.keyCode===n.KEY.RIGHT||b.keyCode===n.KEY.ENTER||b.keyCode===n.KEY.LEFT){var e=this.getItems();if(e.length&&0<e.length){if(this._selectedItem){var d=e.indexOf(this._selectedItem);0>d&&(d=e.indexOf(this._selectedItem.parentNode));0<=d&&(b.keyCode===n.KEY.UP&&0<d?(d--,this._selectItem(e[d])):b.keyCode===n.KEY.DOWN&&d<e.length-1?(d++,this._selectItem(e[d])):
b.keyCode===n.KEY.ENTER||b.keyCode===n.KEY.RIGHT?this._selectedItem.classList.contains("dropdownTrigger")&&this._selectedItem.dropdown?(this._selectedItem.dropdown.open(),this._selectedItem.dropdown._selectItem()):b.keyCode===n.KEY.ENTER&&this._selectedItem.click():b.keyCode===n.KEY.LEFT&&this._selectedItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&(this.close(!0),this._parentDropdown&&this._parentDropdown._dropdownNode.focus()))}else this._selectItem(e[0]);n.stop(b)}}else b.keyCode===
n.KEY.ESCAPE&&(this.close(!0),n.stop(b))},_selectItem:function(b){if(b=b||this.getItems()[0])this._selectedItem&&this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=b,this._selectedItem.classList.add("dropdownMenuItemSelected");document.activeElement!==this._dropdownNode&&this._dropdownNode.focus()},submenuOpen:function(b){b!==this._selectedSubmenu&&(this._closeSelectedSubmenu(),this._selectedSubmenu=b)},_closeSelectedSubmenu:function(){for(var b=this._selectedSubmenu;b;)b.close(),
b=b._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&n.removeAutoDismiss(this._boundAutoDismiss)},appendMenuItem:function(b,e){var d=c(b,e);this._dropdownNode.appendChild(d);return d},appendSeparator:function(){var b=f();this._dropdownNode.appendChild(b);return b}};g.prototype.constructor=g;return{Dropdown:g,appendKeyBindingString:function(b,e){var d=document.createElement("span");d.classList.add("dropdownKeyBinding");d.appendChild(document.createTextNode(e));b.appendChild(d)},
createMenuItem:c,createSeparator:f}});
define("text",["module"],function(k){var n,l,g=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],c=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,f=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,b="undefined"!==typeof location&&location.href,e=b&&location.protocol&&location.protocol.replace(/\:/,""),d=b&&location.hostname,m=b&&(location.port||void 0),a=[],h=k.config&&k.config()||{};n={version:"2.0.5",strip:function(a){if(a){a=a.replace(c,"");var d=a.match(f);d&&(a=d[1])}else a="";return a},
jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:h.createXhr||function(){var a,d,b;if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!==typeof ActiveXObject)for(d=0;3>d;d+=1){b=g[d];try{a=new ActiveXObject(b)}catch(h){}if(a){g=[b];break}}return a},parseName:function(a){var d,
b,h=!1,e=a.indexOf(".");d=0===a.indexOf("./")||0===a.indexOf("../");-1!==e&&(!d||1<e)?(d=a.substring(0,e),b=a.substring(e+1,a.length)):d=a;a=b||d;e=a.indexOf("!");-1!==e&&(h="strip"===a.substring(e+1),a=a.substring(0,e),b?b=a:d=a);return{moduleName:d,ext:b,strip:h}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,d,b,h){var e,c;e=n.xdRegExp.exec(a);if(!e)return!0;a=e[2];e=e[3];e=e.split(":");c=e[1];e=e[0];return(!a||a===d)&&(!e||e.toLowerCase()===b.toLowerCase())&&(!c&&!e||c===h)},finishLoad:function(d,
b,e,c){e=b?n.strip(e):e;h.isBuild&&(a[d]=e);c(e)},load:function(a,c,f,g){if(g.isBuild&&!g.inlineText)f();else{h.isBuild=g.isBuild;var v=n.parseName(a);g=v.moduleName+(v.ext?"."+v.ext:"");var l=c.toUrl(g),k=h.useXhr||n.useXhr;!b||k(l,e,d,m)?n.get(l,function(d){n.finishLoad(a,v.strip,d,f)},function(a){f.error&&f.error(a)}):c([g],function(a){n.finishLoad(v.moduleName+"."+v.ext,v.strip,a,f)})}},write:function(d,b,h,e){a.hasOwnProperty(b)&&(e=n.jsEscape(a[b]),h.asModule(d+"!"+b,"define(function () { return '"+
e+"';});\n"))},writeFile:function(a,d,b,h,e){d=n.parseName(d);var c=d.ext?"."+d.ext:"",m=d.moduleName+c,f=b.toUrl(d.moduleName+c)+".js";n.load(m,b,function(d){d=function(a){return h(f,a)};d.asModule=function(a,d){return h.asModule(a,f,d)};n.write(a,m,d,e)},e)}};if("node"===h.env||!h.env&&"undefined"!==typeof process&&process.versions&&process.versions.node)l=require.nodeRequire("fs"),n.get=function(a,d){var b=l.readFileSync(a,"utf8");0===b.indexOf("\ufeff")&&(b=b.substring(1));d(b)};else if("xhr"===
h.env||!h.env&&n.createXhr())n.get=function(a,d,b,e){var c=n.createXhr(),m;c.open("GET",a,!0);if(e)for(m in e)e.hasOwnProperty(m)&&c.setRequestHeader(m.toLowerCase(),e[m]);if(h.onXhr)h.onXhr(c,a);c.onreadystatechange=function(h){4===c.readyState&&(h=c.status,399<h&&600>h?(h=Error(a+" HTTP status: "+h),h.xhr=c,b(h)):d(c.responseText))};c.send(null)};else if("rhino"===h.env||!h.env&&"undefined"!==typeof Packages&&"undefined"!==typeof java)n.get=function(a,d){var b,h,e=new java.io.File(a),c=java.lang.System.getProperty("line.separator"),
e=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(e),"utf-8")),m="";try{b=new java.lang.StringBuffer;(h=e.readLine())&&h.length()&&65279===h.charAt(0)&&(h=h.substring(1));for(null!==h&&b.append(h);null!==(h=e.readLine());)b.append(c),b.append(h);m=String(b.toString())}finally{e.close()}d(m)};return n});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger"\x3e${ButtonText}\x3c!--span class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span--\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});
define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger dropdownDefaultButton"\x3e${ButtonText}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});define("text!orion/webui/submenutriggerbutton.html",[],function(){return'\x3cli class\x3d"dropdownSubMenu"\x3e\x3cspan class\x3d"dropdownTrigger dropdownMenuItem" role\x3d"menuitem" tabindex\x3d"0"\x3e\x3cspan class\x3d"dropdownCommandName"\x3e${ButtonText}\x3c/span\x3e\x3cspan class\x3d"dropdownArrowRight core-sprite-closedarrow"\x3e\x3c/span\x3e\x3c/span\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e\x3c/li\x3e'});
define("text!orion/webui/checkedmenuitem.html",[],function(){return'\x3cli\x3e\x3clabel class\x3d"dropdownMenuItem"\x3e\x3cinput class\x3d"checkedMenuItem" role\x3d"menuitem" type\x3d"checkbox" /\x3e${ItemText}\x3c/label\x3e\x3c/li\x3e'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(k,n){function l(g){this._init(g)}l.prototype={_init:function(g){this._node=n.node(g.node);if(!this._node)throw"no dom node for tooltip found";this._position=g.position||["right","above","below","left"];this._text=g.text;this._hideDelay=void 0===g.hideDelay?200:g.hideDelay;this._tailSize=g.tailSize||10;this._trigger=g.trigger||"mouseover";this._afterShowing=g.afterShowing;this._afterHiding=g.afterHiding;var c=this;if("click"===
this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(b){b.target===c._node&&(c.show(),n.stop(b))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===g.showDelay?500:g.showDelay;g=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(b){n.contains(c._node,b.target)&&(c.show(),n.stop(b))},!1);this._leaveHandler=function(b){n.contains(c._node,b.target)&&c.hide()};for(var f=0;f<g.length;f++)this._node.addEventListener(g[f],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text){this._tipTextContent=document.createElement("div");this._tipTextContent.classList.add("textContent");this._tipInner.appendChild(this._tipTextContent);var g=document.createTextNode(this._text);this._tipTextContent.appendChild(g)}this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var c=this;n.addAutoDismiss([this._tip,this._node],function(){c.hide()});"mouseover"===this._trigger&&(this._tipInner.role="tooltip",this._tipInner.id="tooltip"+(new Date).getTime().toString(),this._node.setAttribute("aria-describedby",this._tipInner.id),this._tip.addEventListener("mouseover",function(f){c._timeout&&(window.clearTimeout(c._timeout),c._timeout=null);c._tip.addEventListener("mouseout",function(b){n.contains(c._tip,b.target)&&(c.hide(),n.stop(b))},
!1)},!1))}return this._tip},_positionTip:function(g,c){this._makeTipNode();"left"===g?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var f=this._node,b;for(b=n.bounds(f);f&&!b.width&&!b.height;f=f.parentNode)b=n.bounds(f);var f=n.bounds(this._tipInner),e;switch(g){case "above":e=b.top-f.height-this._tailSize-1;b=b.left-this._tailSize;break;case "below":e=b.top+b.height+this._tailSize+1;b=b.left-this._tailSize;break;case "left":e=b.top-this._tailSize/2;b=b.left-f.width-
this._tailSize-1;break;default:e=b.top-this._tailSize/2,b=b.left+b.width+this._tailSize+1}var d=n.bounds(document.documentElement);if(e+f.height>d.height)if(c)e=d.height-f.height-1;else return!1;if(b+f.width>d.width)if(c)b=d.width-f.width-1;else return!1;if(0>b)if(c)b=4;else return!1;if(0>e)if(c)e=4;else return!1;this._tail&&this._tail.previousPosition!==g&&(this._tip.removeChild(this._tail),this._tail=null);this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+
g),"above"===g||"left"===g?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),"left"===g&&(this._tail.style.left=f.width+"px"),this._tail.previousPosition=g);this._tip.style.top=e+"px";this._tip.style.left=b+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing"))this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),this._showDelay?this._timeout=
window.setTimeout(this._showImmediately.bind(this),this._showDelay):this._showImmediately()},_showImmediately:function(){for(var g=!1,c=0;!g&&c<this._position.length;)g=this._positionTip(this._position[c]),c++;g||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(g){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);if(this._tip&&this._tip.classList.contains("tooltipShowing")){void 0===g&&(g=
this._hideDelay);var c=this;this._timeout=window.setTimeout(function(){c._tip.classList.remove("tooltipShowing");c._tip.removeAttribute("style");c._afterHiding&&c._afterHiding()},g)}},destroy:function(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);this._tip&&(document.body.removeChild(this._tip),this._tail=this._tipTextContent=this._tipInner=this._tip=null);if(this._node){this._node.removeEventListener("click",this._clickHandler,!1);this._node.removeEventListener("mouseover",
this._mouseoverHandler,!1);for(var g=["mouseout","click"],c=0;c<g.length;c++)this._node.removeEventListener(g[c],this._leaveHandler,!1)}}};l.prototype.constructor=l;return{Tooltip:l}});
define("orion/commands","orion/util orion/webui/littlelib orion/webui/dropdown text!orion/webui/dropdowntriggerbutton.html text!orion/webui/dropdowntriggerbuttonwitharrow.html text!orion/webui/submenutriggerbutton.html text!orion/webui/checkedmenuitem.html orion/webui/tooltip".split(" "),function(k,n,l,g,c,f,b,e){function d(a){var d=a.invocation;if(d){var b=a.command;if(b.hrefCallback)return a=b.hrefCallback.call(d.handler||window,d),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;if(d.commandRegistry)return d.commandRegistry._invoke(d),
!0;if(b.onClick||b.callback)return window.setTimeout(function(){(b.onClick||b.callback).call(d.handler||window,d)},0),!0}return!1}function m(a,b){for(var h in b)if(b[h]&&b[h].keyBinding&&b[h].command&&b[h].keyBinding.match(a)){var p=b[h],e=p.keyBinding;if((!e.domScope||n.contains(n.node(e.domScope),a.target))&&d(p)){n.stop(a);break}}}function a(){var a={};if(u){var d,b,p;b=Object.keys(w);for(d=0;d<b.length;d++)p=b[d],a[p]=w[p];var h=u();b=Object.keys(h);for(d=0;d<b.length;d++)p=b[d],a[p]=h[p]}else a=
w;return a}function h(d){m(d,a())}function s(a,d){a=a||window.event;if(function(a){if(k.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.ctrlKey)return!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return 0<a["char"].length;if(a.charCode||a.keyCode)switch(a=a.charCode||
a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return 32<=a&&112>a||123<a}return!1}(a)){if("true"===a.target.contentEditable)return;var b=a.target.nodeName.toLowerCase();if("input"===b)switch(a.target.type.toLowerCase()){case "text":case "password":case "search":case "color":case "date":case "datetime":case "datetime-local":case "email":case "month":case "number":case "range":case "tel":case "time":case "url":case "week":return}else if("textarea"===b)return}d?d(a):h(a)}function t(){this._init()}
function q(a,d,b){d.classList.add("commandImage");var p;a.imageClass?a.addImageClassToElement?d.classList.add(a.imageClass):(p=document.createElement("span"),d.appendChild(p),p.classList.add(a.spriteClass),p.classList.add(a.imageClass)):(p=new Image,p.alt=a.name,p.name=b,p.id=b,p.src=a.image,d.appendChild(p));return p}function r(a,d,b,p,h){this.commandRegistry=h;this.handler=a;this.items=d;this.userData=b;this.command=p;p.parameters&&(this.parameters=p.parameters.makeCopy());this.id=p.id}function v(a){this._init(a)}
var u=null,w={};t.prototype={setProxy:function(a){this.proxy=a},setKeyBindings:function(a){this.bindings=a},_init:function(){var a=this;document.addEventListener("keydown",function(d){return s(d,function(d){var p=a.proxy,b=a.bindings;if(b&&p)for(var h=0;h<b.length;h++)b[h].match(d)&&(p.processKey({type:d.type,keyCode:d.keyCode,altKey:d.altKey,ctrlKey:d.ctrlKey,metaKey:d.metaKey,shiftKey:d.shiftKey}),n.stop(d))})})}};window.document.addEventListener("keydown",s,!1);r.prototype={collectsParameters:function(){return this.commandRegistry&&
this.commandRegistry.collectsParameters()},makeCopy:function(a){var d=new r(this.handler,this.items,this.userData,this.command,this.commandRegistry);d.domNode=this.domNode;d.domParent=this.domParent;a?d.parameters=a.makeCopy():this.parameters&&(d.parameters=this.parameters.makeCopy());return d}};r.prototype.constructor=r;v.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;
this.positioningNode=a.positioningNode;this.image=a.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.selectionClass=a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters;this.isEditor=a.isEditor},populateChoicesMenu:function(a,d,b,p,
h){b=this.getChoices(d,b,p);var e=b.some(function(a){return a.checked});b.forEach(function(p){if(p.name){var b=document.createElement("li");a.appendChild(b);var c=document.createElement("span");c.tabIndex=0;c.role="menuitem";c.classList.add("dropdownMenuItem");if(e){var m=document.createElement("span");m.classList.add("check");m.appendChild(document.createTextNode(p.checked?"\u25cf":""));c.appendChild(m)}m=document.createTextNode(p.name);c.appendChild(m);b.appendChild(c);c.choice=p;c.addEventListener("click",
function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,d)},!1);c.addEventListener("keydown",function(a){(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,d)},!1)}else h._generateMenuSeparator(a)})},getChoices:function(a,d,b){return this.choiceCallback?this.choiceCallback.call(d,a,b):null},makeChoiceCallback:function(a,d){return function(b){a.callback&&a.callback.call(a,d,b)}},hasImage:function(){return this.imageClass||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"!==this.image}};v.prototype.constructor=v;return{Command:v,CommandInvocation:r,createDropdownMenu:function(a,d,b,p,h,e,m,f,s){a=n.node(a);if(!a)throw"no parent node was specified";var t=document.createRange();t.selectNode(a);t=s?t.createContextualFragment(c):t.createContextualFragment(g);n.processTextNodes(t,{ButtonText:d});a.appendChild(t);a=a.lastChild;
var r;s?(s=a.previousSibling,r=s.lastChild):s=a.previousSibling;p?s.classList.add(p):(s.classList.add("orionButton"),s.classList.add("commandButton"));h&&(e||(s.textContent="",s.setAttribute("aria-label",d)),q({spriteClass:"commandSprite",imageClass:h},s,d),s.classList.add("orionButton"));s.dropdown=new l.Dropdown({dropdown:a,populate:b,selectionClass:m,skipTriggerEventListeners:!!r,positioningNode:f});a.dropdown=s.dropdown;return{menuButton:s,menu:a,dropdown:s.dropdown,dropdownArrow:r}},createCheckedMenuItem:function(a,
d,h,p){a=n.node(a);if(!a)throw"no parent node was specified";var e=document.createRange();e.selectNode(a);e=e.createContextualFragment(b);n.processTextNodes(e,{ItemText:d});a.appendChild(e);a=n.$(".checkedMenuItem",a.lastChild);a.checked=h;a.addEventListener("change",p,!1);return a},createCommandItem:function(a,d,b,p,h,c,m){var f;c=c||!d.name&&d.hasImage();if(d.hrefCallback)f=document.createElement("a"),f.id=p,c&&d.hasImage()?q(d,f,p):(f.className="commandLink",f.appendChild(document.createTextNode(d.name))),
m=d.hrefCallback.call(b.handler,b),m.then?m.then(function(a){f.href=a}):f.href=m?m:"#";else{f=document.createElement("button");f.className="orionButton";c?d.hasImage()?(q(d,f,p),d.name&&f.setAttribute("aria-label",d.name)):(f.classList.add("commandButton"),f.classList.add("commandMissingImageButton"),f.appendChild(document.createTextNode(d.name))):(f.classList.add("commandButton"),p=document.createTextNode(d.name),f.appendChild(p));var g=m||d.callback;g&&(d.onClick=g,f.addEventListener("click",function(a){g.call(b.handler,
b)},!1))}"ul"===a.nodeName.toLowerCase()?(m=document.createElement("li"),a.appendChild(m),a=m):f.classList.add("commandMargins");a.appendChild(f);d.tooltip&&(f.commandTooltip=new e.Tooltip({node:f,text:d.tooltip,position:["above","below","right","left"]}));h&&(w[d.id]={keyBinding:h,command:d,invocation:b});return f},createCommandMenuItem:function(a,d,b,p,h,c){var m,f,q=a.dropdown;if(d.hrefCallback)f=l.createMenuItem(d.name,"a"),m=f.firstElementChild,h=d.hrefCallback.call(b.handler,b),h.then?h.then(function(a){m.href=
a}):m.href=h?h:"#",m.addEventListener("keydown",function(a){(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)&&m.click()},!1);else{f=l.createMenuItem(d.name);m=f.firstElementChild;var g=h||d.callback;g&&(d.onClick=g,m.addEventListener("click",function(a){q.close(!0);g.call(b.handler,b)},!1),m.addEventListener("keydown",function(a){if(a.keyCode===n.KEY.ENTER||a.keyCode===n.KEY.SPACE)a.preventDefault(),m.click()},!1))}d.tooltip&&(m.commandTooltip=new e.Tooltip({node:m,text:d.tooltip,position:["above",
"below","right","left"]}));c&&l.appendKeyBindingString(m,c);a.appendChild(f);p&&(w[d.id]={keyBinding:p,command:d,invocation:b});return m},executeBinding:d,setKeyBindingProvider:function(a){u=a},localKeyBindings:w,CommandsProxy:t,getKeyBindings:a,processKey:h,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:m}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Viewer":"Orion Markdown Viewer","Orion JSON Editor":"Orion JSON Editor",
"View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"2014-04-02_22-01-33","LOG: ":"LOG: ",View:"View","no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ","Resource is out of sync with the server. Do you want to save it anyway?":"Resource is out of sync with the server. Do you want to save it anyway?",
Operations:"Operations","Operations running":"Operations running","Some operations finished with warning":"Some operations finished with warning","Some operations finished with error":"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Saved searches":"Saved searches","Recent searches":"Recent searches","Regular expression":"Regular expression",
"Search options":"Search options","Global search":"Global search","Orion Home":"Orion Home","Close notification":"Close notification","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site",
"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plugin","Generate a sample plugin for integrating with Orion.":"Generate a sample plugin for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* \x3d any string, ? \x3d any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/uiUtils",["orion/webui/littlelib"],function(k){function n(g){var c="",f=-1!==navigator.platform.indexOf("Mac");f?(g.mod4&&(c+="\u2303"),g.mod3&&(c+="\u2325"),g.mod2&&(c+="\u21e7"),g.mod1&&(c+="\u2318")):(g.mod1&&(c+="Ctrl+"),g.mod2&&(c+="Shift+"),g.mod3&&(c+="Alt+"));if(g.alphaKey)return c+g.alphaKey;if("keypress"===g.type)return c+g.keyCode;for(var b in k.KEY)if(typeof("number"===k.KEY[b])&&k.KEY[b]===g.keyCode){if(f)switch(k.KEY[b]){case k.KEY.BKSPC:b="\u232b";break;case k.KEY.TAB:b=
"\u21e5";break;case k.KEY.ENTER:b="\u23ce";break;case k.KEY.ESCAPE:b="\u238b";break;case k.KEY.SPACE:b="\u2423";break;case k.KEY.PAGEUP:b="\u21de";break;case k.KEY.PAGEDOWN:b="\u21df";break;case k.KEY.END:b="\u21f2";break;case k.KEY.HOME:b="\u21f1";break;case k.KEY.DEL:b="\u2326"}switch(k.KEY[b]){case k.KEY.DOWN:b="\u2193";break;case k.KEY.UP:b="\u2191";break;case k.KEY.RIGHT:b="\u2192";break;case k.KEY.LEFT:b="\u2190"}return c+b}var e;switch(g.keyCode){case 59:e=g.mod2?":":";";break;case 61:e=g.mod2?
"+":"\x3d";break;case 188:e=g.mod2?"\x3c":",";break;case 190:e=g.mod2?"\x3e":".";break;case 191:e=g.mod2?"?":"/";break;case 192:e=g.mod2?"~":"`";break;case 219:e=g.mod2?"{":"[";break;case 220:e=g.mod2?"|":"\\";break;case 221:e=g.mod2?"}":"]";break;case 222:e=g.mod2?'"':"'"}return e?c+e:112<=g.keyCode&&123>=g.keyCode?c+"F"+(g.keyCode-111):c+String.fromCharCode(g.keyCode)}function l(g){var c=-1!==window.navigator.platform.indexOf("Mac");return c&&g.metaKey||!c&&g.ctrlKey}return{getUserKeyString:function(g){var c=
"";g=g.getKeys();for(var f=0;f<g.length;f++)0!==f&&(c+=" "),c+=n(g[f]);return c},getUserText:function(g){var c=g.id,f=g.refNode,b=g.hideRefNode,e=g.initialText,d=g.onComplete,m=g.onEditDestroy,a=g.selectTo,h=g.isInitialValid;g=g.insertAsChild;var s=!1,t=function(a){return function(q){if(!s){var g=k.node(c),t=g.value;g&&(a&&q.keyCode===k.KEY.ESCAPE?(b&&(f.style.display="inline"),s=!0,g.parentNode.removeChild(g),m&&m()):a&&q.keyCode!==k.KEY.ENTER||(0===t.length||!h&&t===e?b&&(f.style.display="inline"):
(d(t),b&&f.parentNode&&(f.style.display="inline")),s=!0,g.parentNode&&g.parentNode.removeChild(g),m&&m()))}}},q=document.createElement("input");q.id=c;q.value=e||"";g?f.appendChild(q):f.parentNode.insertBefore(q,f.nextSibling);q.classList.add("userEditBoxPrompt");b&&(f.style.display="none");q.addEventListener("keydown",t(!0),!1);q.addEventListener("blur",t(!1),!1);window.setTimeout(function(){q.focus();if(e){var d=k.node(c),b=a?e.indexOf(a):-1;0<b?d.createTextRange?(d=d.createTextRange(),d.collapse(!0),
d.moveStart("character",0),d.moveEnd("character",b),d.select()):d.setSelectionRange?d.setSelectionRange(0,b):void 0!==d.selectionStart&&(d.selectionStart=0,d.selectionEnd=b):d.select()}},0)},openInNewWindow:l,followLink:function(g,c){c&&l(c)?window.open(g):window.location=g},createButton:function(g,c){var f=document.createElement("button");f.className="orionButton commandButton commandMargins";f.addEventListener("click",function(b){c();k.stop(b)},!1);g&&f.appendChild(document.createTextNode(g));return f},
createDropdownButton:function(g,c,f){},isFormElement:function(g){switch(g.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(k,n){function l(g,c){c||(c="orion.page.selection");this._serviceRegistry=g;k.attach(this);this._serviceRegistration=g.registerService(c,this);this._selections=null}l.prototype={getSelection:function(g){var c=this._getSingleSelection();"function"===typeof g&&g(c);return c},getSelections:function(g){var c=Array.isArray(this._selections)?this._selections.slice():[];"function"===typeof g&&g(c);return c},_getSingleSelection:function(){return this._selections&&
0<this._selections.length?this._selections[0]:null},setSelections:function(g){var c=this._selections;Array.isArray(g)?this._selections=0<g.length?g.slice():null:this._selections=g?[g]:null;c!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};l.prototype.constructor=l;return{Selection:l}});
define("orion/explorers/navigationUtils",[],function(){function k(l,g,c,f){!n&&l&&(l.push({domNode:g}),g.tabIndex=-1,g.style.outline="none")}var n=-1!==navigator.userAgent.indexOf("iPad");return{addNavGrid:function(l,g,c){l&&(l=l.getGridNavHolder(g,!0))&&k(l,c)},generateNavGrid:k,removeNavGrid:function(l,g){if(l)for(var c=0;c<l.length;c++)if(l[c].domNode===g){l.splice(c,1);break}}}});
define("orion/PageUtil",[],function(){var k=/^http[s]?/i;return{hash:function(){var k=window.location.href.split("#")[1];return k?"#"+k:""},matchResourceParameters:function(k){k=k||window.location.toString();var l={resource:""},g=k.indexOf("#");if(-1!==g&&(k=k.substring(g+1),0!==k.length)){k=k.split(",");l.resource=decodeURIComponent(k[0]);for(g=1;g<k.length;g++){var c=/([^=]*)(=?)(.*)/.exec(k[g]),f=decodeURIComponent(c[1]||""),c=decodeURIComponent(c[3]||"");""!==f&&"resource"!==f&&(l[f]=c)}}return l},
validateURLScheme:function(n,l){var g=n;if(-1===n.indexOf("://")){var c=document.createElement("a");c.href=n;g=c.href}c=!1;if(c=l?l.some(function(c){return RegExp("^"+c+":","i").test(g)}):k.test(g))return n;console.log("Illegal URL Scheme: '"+n+"'");return""}}});
define("orion/commandRegistry","orion/commands orion/explorers/navigationUtils orion/PageUtil orion/uiUtils orion/webui/littlelib orion/webui/dropdown orion/webui/tooltip text!orion/webui/checkedmenuitem.html text!orion/webui/dropdowntriggerbutton.html text!orion/webui/submenutriggerbutton.html".split(" "),function(k,n,l,g,c,f,b,e,d,m){function a(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(a);this._parameterCollector=
null}function h(a,d){this.token=a;this.parameterName=d}function s(a,d,b){this.event=a;this.handler=d;this.capture=b||!1}function t(a,d,b,h,e,c){this.name=a;this.type=d;this.label=b;this.value=h;this.lines=e||1;this.eventListeners=Array.isArray(c)?c:c?[c]:[]}function q(a,d,b){this._storeParameters(a);this._hasOptionalParameters=d&&d.hasOptionalParameters;this._options=d;this.optionsRequested=!1;this.getParameters=b;this.clientCollect=d&&d.clientCollect}a.prototype={_init:function(a){this._selectionService=
a.selection;var d=this;k.setKeyBindingProvider(function(){return d._activeBindings})},processURL:function(a){for(var d in this._urlBindings)if(this._urlBindings[d]&&this._urlBindings[d].urlBinding&&this._urlBindings[d].command){var b=this._urlBindings[d].urlBinding.match(a);if(b){var h=this._urlBindings[d],e=h.command,c=h.invocation;if(c&&c.parameters&&e.callback){c.parameters.setValue(b.parameterName,b.parameterValue);var m=this;window.setTimeout(function(){m._invoke(c)},0);break}}}},findCommand:function(a){return this._commandList[a]},
runCommand:function(a,d,b,h){d?(a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(d):1)&&a.callback&&this._invoke(new k.CommandInvocation(b,d,null,a,this),h):(d=this._urlBindings[a])&&d.command&&d.command.callback&&this._invoke(d.invocation,h)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=a},openParameterCollector:function(a,d,b){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,
d,b))},confirm:function(a,d,b,h,e,c){var m=!1;if(this._parameterCollector&&!e){var p=this;this._parameterCollector.close();if(this._parameterCollector.open(a,function(a,e){var c=document.createElement("span");c.classList.add("parameterPrompt");c.textContent=d;a.appendChild(c);c=document.createElement("button");c.addEventListener("click",function(a){m=!0;p._parameterCollector.close()},!1);e.appendChild(c);c.appendChild(document.createTextNode(b));c.className="dismissButton";var f=document.createElement("button");
f.addEventListener("click",function(a){m=!1;p._parameterCollector.close()},!1);e.appendChild(f);f.appendChild(document.createTextNode(h));f.className="dismissButton";return c},function(){c(m)}))return}m=window.confirm(d);c(m)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(a,d){return this._collectAndInvoke(a.makeCopy(d),!1)},_collectAndInvoke:function(a,d){if(a)if(this._parameterCollector&&
a.parameters&&a.parameters.hasParameters()&&(d||a.parameters.shouldCollectParameters())){var h=!1;a.parameters.updateParameters(a);if(a.parameters.shouldCollectParameters()&&(h=this._parameterCollector.collectParameters(a),!h)){var e=new b.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),h=e.contentContainer();h.classList.add("parameterPopup");var c=window.document.activeElement,m=this._parameterCollector.getFillFunction(a,
function(){c&&c.focus();e.destroy()})(h);e.show();window.setTimeout(function(){m.focus();m.select()},0);h=!0}h||a.command.callback.call(a.handler||window,a)}else a.command.callback.call(a.handler||window,a);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(a){this._collectAndInvoke(a,!0)},showKeyBindings:function(a){function d(a){return function(){k.executeBinding(a)}}var b={},h,e,c=[],m;for(m in this._activeBindings)(e=
this._activeBindings[m])&&e.keyBinding&&e.command&&(e.command.name||e.command.tooltip)&&c.push(e);c.sort(function(a,d){return(a.command.name||a.command.tooltip).localeCompare(d.command.name||d.command.tooltip)});for(m=0;m<c.length;m++)e=c[m],e.keyBinding.scopeName?(b[e.keyBinding.scopeName]||(b[e.keyBinding.scopeName]=[]),b[e.keyBinding.scopeName].push(e)):(h=g.getUserKeyString(e.keyBinding),a.createItem(h,e.command.name||e.command.tooltip,d(e)));for(var p in b)b[p].length&&0<b[p].length&&(a.createHeader(p),
b[p].forEach(function(b){h=g.getUserKeyString(b.keyBinding);a.createItem(h,b.command.name||b.command.tooltip,d(b))}))},addCommand:function(a){this._commandList[a.id]=a;var d=this._pendingBindings[a.id];if(d){var b=this;d.forEach(function(d){b._addBinding(a,d.type,d.binding,d.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,d,b,h,e,c,m,p,A,C){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];e&&(a=this._createEntryForPath(a,
e));a[d]?(h&&(a[d].title=h),b&&(a[d].position=b),m&&(a[d].imageClass=m),p&&(a[d].tooltip=p),A&&(a[d].selectionClass=A),!0===C?a[d].pretendDefaultActionId=!0:a[d].defaultActionId=C,a[d].emptyGroupMessage=c):(a[d]={title:h,position:b,emptyGroupMessage:c,imageClass:m,tooltip:p,selectionClass:A,defaultActionId:!0===C?null:C,pretendDefaultActionId:!0===C,children:{}},a.sortedContributions=null)},_createEntryForPath:function(a,d){d&&d.split("/").forEach(function(d){1<d.length&&(a[d]||(a[d]={position:0,
children:{}},a.sortedContributions=null),a=a[d].children)});return a},registerSelectionService:function(a,d){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=d},registerCommandContribution:function(a,d,b,h,e,c,m){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];h&&(a=this._createEntryForPath(a,h));a[d]={position:b};c&&((b=this._commandList[d])?this._addBinding(b,"key",
c,e):this._addPendingBinding(d,"key",c,e));m&&((b=this._commandList[d])?this._addBinding(b,"url",m,e):this._addPendingBinding(d,"url",m,e));a.sortedContributions=null},unregisterCommandContribution:function(a,d,b){if(this._contributionsByScopeId[a]){delete this._commandList[d];delete this._activeBindings[d];delete this._urlBindings[d];delete this._pendingBindings[d];var h=this._contributionsByScopeId[a];b&&b.split("/").forEach(function(a){1<a.length&&h[a]&&(h=h[a].children)});delete h[d];h.sortedContributions=
null}},_addBinding:function(a,d,b,h){if(!a.id)throw Error("No command id: "+a);"key"===d?this._activeBindings[a.id]={command:a,keyBinding:b,bindingOnly:h}:"url"===d&&(this._urlBindings[a.id]={command:a,urlBinding:b,bindingOnly:h})},_addPendingBinding:function(a,d,b,h){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:d,binding:b,bindingOnly:h})},_checkForTrailingSeparator:function(a,d,b){var h;if("tool"===d||"button"===d)if((h=0<a.childNodes.length?a.childNodes[a.childNodes.length-
1]:null)&&h.classList.contains("commandSeparator"))return b?(a.removeChild(h),!1):!0;if("menu"===d&&(a=c.$$array("li \x3e *",a),0<a.length&&a[a.length-1].classList.contains("dropdownSeparator")))if(h=a[a.length-1],b)h.parentNode.parentNode.removeChild(h.parentNode);else return!0;return!1},renderCommands:function(a,d,b,h,e,m,f){if("string"!==typeof a)throw"a scope id for rendering must be specified";d=c.node(d);if(!d)throw"no parent";var p=this._contributionsByScopeId[a];if(!b&&p){b=p.localSelectionService||
this._selectionService;var A=this;b&&b.getSelections(function(b){A.renderCommands(a,d,b,h,e,m)})}else p&&(this._render(p,d,b,h,e||"button",m,f),this._checkForTrailingSeparator(d,e,!0))},destroy:function(a){a=c.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var d=a.firstChild;d.commandTooltip&&d.commandTooltip.destroy();d.emptyGroupTooltip&&d.emptyGroupTooltip.destroy();this.destroy(d);a.removeChild(d)}},_render:function(a,d,h,e,c,m,f){var p=a.sortedContributions;if(!p){var p=[],A=!1,C;for(C in a)if(Object.prototype.hasOwnProperty.call(a,
C)){var q=a[C];q&&"number"===typeof q.position&&(q.id=C,p.push(q),A=!0)}A&&(p.sort(function(a,d){return a.position-d.position}),a.sortedContributions=p)}var s=0,t=this;p.forEach(function(a){var p;a.imageClass||(a.imageClass=null);if(a.children&&0<Object.getOwnPropertyNames(a.children).length){var C=a.children;if("tool"===c||"button"===c)if(a.title){var A;a.defaultActionId&&((C=t._commandList[a.defaultActionId])&&(C.visibleWhen?C.visibleWhen(h):1)?(A=new k.CommandInvocation(e,h,m,C,t),A.domParent=
d):a.pretendDefaultActionId=!0);C=t._createDropdownMenu(d,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass,null,A,a.pretendDefaultActionId);f&&n.generateNavGrid(f,C.menuButton);C&&(t._render(a.children,C.menu,h,e,"menu",m,f),t._checkForTrailingSeparator(C.menu,"menu",!0),0===C.menu.childNodes.length?a.emptyGroupMessage?C.menuButton.emptyGroupTooltip||(C.menuButton.emptyGroupTooltip=new b.Tooltip({node:C.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right","above",
"left"]})):(f&&n.removeNavGrid(f,C.menuButton),a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},a(C.menu),a(C.menuButton),a(C.destroyButton)):C.menuButton.style.visibility="visible")}else{var q;0<d.childNodes.length&&!t._checkForTrailingSeparator(d,c)&&(q=t.generateSeparatorImage(d));t._render(C,d,h,e,c,m,f);0<d.childNodes.length&&d.childNodes[d.childNodes.length-1]!==q&&(q=t.generateSeparatorImage(d))}else if(a.title){if(a=t._createDropdownMenu(d,a.title,!0,null,null,a.imageClass))t._render(C,
a.menu,h,e,"menu",m,f),t._checkForTrailingSeparator(a.menu,"menu",!0),0===a.menu.childNodes.length&&a.destroyButton&&d.removeChild(a.destroyButton)}else 0<d.childNodes.length&&t._generateMenuSeparator(d),t._render(C,d,h,e,c,m,f),t._generateMenuSeparator(d)}else{var B=t._commandList[a.id],C=B?!0:!1;A=a=null;if(B){p=new k.CommandInvocation(e,h,m,B,t);p.domParent=d;q=!1;try{q=C&&(B.visibleWhen?B.visibleWhen(h):!0)}catch(r){throw console.log(r),r;}t._activeBindings[B.id]&&t._activeBindings[B.id].keyBinding&&
(a=t._activeBindings[B.id],a.invocation=q?p:null,a.bindingOnly&&(C=!1));t._urlBindings[B.id]&&t._urlBindings[B.id].urlBinding&&(A=t._urlBindings[B.id],A.invocation=q?p:null,A.bindingOnly&&(C=!1));C=C&&q}C&&(B.choiceCallback?("tool"===c||"button"===c?(a=d,C=!1,"ul"===d.nodeName.toLowerCase()&&(a=document.createElement("li"),d.appendChild(a))):(a=d,C=!0),t._createDropdownMenu(a,B.name,C,function(a){B.populateChoicesMenu(a,h,e,m,t)}.bind(B),B.imageClass,B.tooltip||B.title,B.selectionClass,B.positioningNode)):
(p.handler=p.handler||this,p.domParent=d,C=function(a){t._invoke(p)},"menu"===c?(A=null,a&&a.keyBinding&&(A=g.getUserKeyString(a.keyBinding)),a=k.createCommandMenuItem(d,B,p,null,C,A)):(a=c+B.id+s,a=k.createCommandItem(d,B,p,a,null,"tool"===c,C)),n.generateNavGrid(f,a),p.domNode=a,s++))}})},_createDropdownMenu:function(a,d,h,e,q,g,s,p,A,C){a=c.node(a);if(!a||!c.contains(document.body,a))return null;var t,l,E=a;if(h)g=document.createRange(),g.selectNode(a),g=g.createContextualFragment(m),c.processTextNodes(g,
{ButtonText:d}),a.appendChild(g),l=a.lastChild,q=l.lastChild,d=q.previousSibling,d.dropdown=new f.Dropdown({dropdown:q,populate:e,parentDropdown:a.dropdown}),q.dropdown=d.dropdown;else{"ul"===a.nodeName.toLowerCase()&&(E=document.createElement("li"),a.appendChild(E),l=E);a=null;q&&(a="dropdownButtonWithIcon",g=g||d);g=q?g||d:g;var G=k.createDropdownMenu(E,d,e,a,q,!1,s,p,A||C);t=G.dropdownArrow;d=G.menuButton;if(t){A&&(A.domNode=G.menuButton);var n=this;d.onclick=function(a){var d=c.bounds(t);a.clientX>=
d.left&&G.dropdown?G.dropdown.toggle(a):n._invoke(A)};G.dropdown&&(d.onkeydown=function(a){c.KEY.DOWN===a.keyCode&&(G.dropdown.toggle(a),c.stop(a))})}q=G.menu;var I;(e=A&&A.command&&(A.command.tooltip||A.command.name))?I=A.command.tooltip||A.command.name:e&&(I=g);I&&(d.commandTooltip=new b.Tooltip({node:d,text:I,position:["above","below","right","left"]}))}return{menuButton:d,menu:q,dropdown:d.dropdown,destroyButton:l,dropdownArrow:t}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,
"menu")){var d=document.createElement("li");d.classList.add("dropdownSeparator");var b=document.createElement("span");b.classList.add("dropdownSeparator");d.appendChild(b);a.appendChild(d)}},generateSeparatorImage:function(a){var d;d="ul"===a.nodeName.toLowerCase()?document.createElement("li"):document.createElement("span");a.appendChild(d);d.classList.add("core-sprite-sep");d.classList.add("imageSprite");d.classList.add("commandSeparator");return d}};a.prototype.constructor=a;h.prototype={match:function(a){a=
l.matchResourceParameters(a);return"undefined"!==typeof a[this.token]?(this.parameterValue=a[this.token],this):null}};h.prototype.constructor=h;s.prototype.constructor=s;t.prototype={optionsRequested:function(){return this.optionsRequested}};t.prototype.constructor=t;q.prototype={_storeParameters:function(a){this.parameterTable=null;if(a){var d=this.parameterTable={};a.forEach(function(a){d[a.name]=a})}},updateParameters:function(a){"function"===typeof this.getParameters&&this._storeParameters(this.getParameters(a))},
hasParameters:function(){return null!==this.parameterTable},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(a){return this.parameterTable[a]},valueFor:function(a){return(a=this.parameterTable[a])?a.value:null},setValue:function(a,d){var b=this.parameterTable[a];b&&(b.value=d)},forEach:function(a){for(var d in this.parameterTable)this.parameterTable[d].type&&this.parameterTable[d].name&&a(this.parameterTable[d])},makeCopy:function(){var a=
[];this.forEach(function(d){d=new t(d.name,d.type,d.label,d.value,d.lines,d.eventListeners);a.push(d)});var d=new q(a,this._options,this.getParameters);d.clientCollect=this.clientCollect;return d},hasOptionalParameters:function(){return this._hasOptionalParameters}};q.prototype.constructor=q;return{CommandRegistry:a,URLBinding:h,ParametersDescription:q,CommandParameter:t,CommandEventListener:s}});define("text!orion/banner/slideout.html",[],function(){return'\x3cdiv id\x3d"slideContainer" class\x3d"slideParameters slideContainer"\x3e\n\t\x3cspan id\x3d"pageCommandParameters" class\x3d"layoutLeft parameters"\x3e\x3c/span\x3e\n\t\x3cspan id\x3d"pageCommandDismiss" class\x3d"layoutRight parametersDismiss"\x3e\x3c/span\x3e\n\x3c/div\x3e'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(k,n,l){return{slideoutHTMLFragment:function(g){var c=document.createElement("div");c.innerHTML=l;var f=n.$("#slideContainer",c);f.id=g+f.id;f=n.$("#pageCommandParameters",c);f.id=g+f.id;f=n.$("#pageCommandDismiss",c);f.id=g+f.id;return c.innerHTML}}});
define("orion/section","orion/webui/littlelib orion/selection orion/commandRegistry orion/commonHTMLFragments orion/objects orion/selection".split(" "),function(k,n,l,g,c,f){function b(d,b){var a=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!b.id)throw Error("Missing required argument: id");this.id=b.id;if(!b.title)throw Error("Missing required argument: title");var h=b.useAuxStyle?["sectionWrapper",
"sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");d.appendChild(this.domNode);for(var e=0;e<h.length;e++)this.domNode.classList.add(h[e]);this.domNode.id=b.id;b.canHide&&(this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitleTwistie"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=
0,this.domNode.addEventListener("click",function(d){(d.target===a.titleNode||d.target===a.twistie||d.target===a.domNode)&&a._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(d){d.keyCode===k.KEY.ENTER&&(d.target===a.domNode||d.target===a.titleNode||d.target===a.twistie)&&a._changeExpandedState()},!1));if(b.iconClass){var c=document.createElement("span");c.classList.add("sectionIcon");this.domNode.appendChild(c);h=Array.isArray(b.iconClass)?b.iconClass:[b.iconClass];h.forEach(function(a){c.classList.add(a)})}b.headerClass&&
(h=Array.isArray(b.headerClass)?b.headerClass:[b.headerClass],h.forEach(function(a){this.domNode.classList.add(a)}.bind(this)));this.titleNode=document.createElement("div");this.titleNode.id=b.id+"Title";this.titleNode.classList.add("sectionAnchor");this.titleNode.classList.add("sectionTitle");this.titleNode.classList.add("layoutLeft");this.domNode.appendChild(this.titleNode);this.titleNode.textContent=b.title;"function"===typeof b.getItemCount&&(h=document.createElement("div"),h.classList.add("layoutLeft"),
h.classList.add("sectionItemCount"),this.domNode.appendChild(h),h.textContent=b.getItemCount(this));this._progressNode=document.createElement("div");this._progressNode.id=b.id+"Progress";this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.visibility="hidden";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);h=document.createElement("div");h.id=b.id+
"FilterSearchBox";this.domNode.appendChild(h);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=b.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("ul");this.actionsNode.id=b.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("commandList");this.actionsNode.classList.add("sectionActions");
this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("ul");this.selectionNode.id=b.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);b.slideout&&(h=g.slideoutHTMLFragment(b.id),e=document.createRange(),e.selectNode(this.domNode),h=e.createContextualFragment(h),this.domNode.appendChild(h));this._contentParent=
document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);d.appendChild(this._contentParent);b.content&&this.setContent(b.content);"function"===typeof b.onExpandCollapse&&(this._onExpandCollapse=b.onExpandCollapse);this._preferenceService=b.preferenceService;this._collapse();if(this._preferenceService){var f=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=
a.get(f.id);void 0===a?b.hidden||f._expand():a&&f._expand();f._updateExpandedState(!1)})}else b.hidden||this._expand(),this._updateExpandedState(!1);this._commandService=b.commandService;this._lastMonitor=0;this._loading={}}function e(d){this._section=d;this._id=++d._lastMonitor}b.prototype={setTitle:function(d){this.titleNode.textContent=d},getHeaderElement:function(d){return this.domNode},getTitleElement:function(d){return this.titleNode},getActionElement:function(d){return this._toolActionsNode},
setContent:function(d){"string"===typeof d?this._contentParent.innerHTML=d:(this._contentParent.innerHTML="",this._contentParent.appendChild(d))},getContentElement:function(){return this._contentParent},embedExplorer:function(d,b,a){this._contentParent.innerHTML="";d.parent||(d.parent=b);this._contentParent.appendChild(d.parent);d.section=this;c.mixin(d,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(a){if(!k.node(a)){var d=document.createElement("ul");
d.id=a;d.classList.add("commandList");d.classList.add("layoutRight");this.section.actionsNode.appendChild(d)}}.bind(this))},getCommandsVisible:function(){return"hidden"!==this.section.actionsNode.style.visibility},setCommandsVisible:function(a,d){this.section.actionsNode.style.visibility=a?"":"hidden";void 0===d&&(d=a?null:"cursorOnly");this.renderer.selectionPolicy=d;var b=this.getNavHandler();b&&b.setSelectionPolicy(d);a?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(a){k.node(a)&&
this.commandRegistry.destroy(a)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var a=this;this.actionsSections&&(this.actionsSections.forEach(function(d){delete a[d]}),delete this.actionsSections)},updateCommands:function(a){this.section.actionsNode&&this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,a))},loaded:function(){var d=this;!this.selection&&!a&&(this.serviceRegistry||this.registry?(this.selection=
new f.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(a){d.updateCommands(a.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry"));var b=this.registerCommands();!b||!b.then?d.updateCommands():b.then(function(){d.updateCommands()})}});d.renderer&&(d.renderer.section=this,c.mixin(d.renderer,{getCellHeaderElement:function(a){(a=Object.getPrototypeOf(this).getCellHeaderElement.call(this,
a))&&this.section.setTitle(a.innerHTML);return null}}))},createProgressMonitor:function(){return new e(this)},_setMonitorMessage:function(d,b){this._progressNode.style.visibility="visible";this._loading[d]=b;var a="",h;for(h in this._loading)""!==a&&(a+="\n"),a+=this._loading[h];this._progressNode.title=a},_monitorDone:function(d){delete this._loading[d];d="";for(var b in this._loading)""!==d&&(d+="\n"),d+=this._loading[b];this._progressNode.title=d;""===d&&(this._progressNode.style.visibility="hidden")},
_changeExpandedState:function(){this.hidden?this._expand():this._collapse();this._updateExpandedState(!0)},_updateExpandedState:function(d){var b=!this.hidden,a=this.twistie,h=this.id;a&&(a.classList.add(b?this._expandImageClass:this._collapseImageClass),a.classList.remove(b?this._collapseImageClass:this._expandImageClass));this._preferenceService&&d&&this._preferenceService.getPreferences("/window/views").then(function(a){a.put(h,b)});this._onExpandCollapse&&this._onExpandCollapse(b,this)},_expand:function(){this._contentParent.classList.remove("sectionClosed");
this.domNode.classList.remove("sectionClosed");this.hidden=!1},_collapse:function(){this.hidden=!0;this._contentParent.classList.add("sectionClosed");this.domNode.classList.add("sectionClosed")}};b.prototype.constructor=b;e.prototype={begin:function(d){this.status=d;this._section._setMonitorMessage(this.id,d)},worked:function(d){this.status=d;this._section._setMonitorMessage(this.id,d)},done:function(d){this.status=d;this._section._monitorDone(this.id)}};e.prototype.constructor=e;return{Section:b}});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(k,n){function l(g){this._init(g)}l.prototype={_init:function(g){var c=g.parent,f=this,c=n.node(c);if(!c)throw k["no parent"];if(!g.model)throw k["no tree model"];if(!g.renderer)throw k["no renderer"];this._parent=c;this._treeModel=g.model;this._onComplete=g.onComplete;this._renderer=g.renderer;this._showRoot=void 0===g.showRoot?!1:g.showRoot;this._indent=void 0===g.indent?16:g.indent;this._onCollapse=g.onCollapse;
this._labelColumnIndex=void 0===g.labelColumnIndex?0:g.labelColumnIndex;this._id=void 0===g.id?"treetable":g.id;this._tableStyle=g.tableStyle;this._tableElement=g.tableElement||"table";this._tableBodyElement=g.tableBodyElement||"tbody";this._tableRowElement=g.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(b){f._showRoot?(b._depth=0,f._generate([b],0)):f._treeModel.getChildren(b,function(b){f.destroyed||f._generate(b,0)})})},destroy:function(){this.destroyed=!0},_generate:function(g,
c){n.empty(this._parent);var f=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(f);var b=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(b);b.id=this._id;this._tableStyle&&b.classList.add(this._tableStyle);this._renderer.initTable(b,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";0===g.length?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(g,c);b.appendChild(this._bodyElement);f.appendChild(b);this._parent.appendChild(f);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(g,c,f){for(var b=0;b<g.length;b++){var e=document.createElement(this._tableRowElement);e.id=this._treeModel.getId(g[b]);e._depth=c;e._item=g[b];this._renderer.render(g[b],e);e.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*c+"px";this._renderer.rowCallback&&this._renderer.rowCallback(e,g[b]);f?(this._bodyElement.insertBefore(e,f.nextSibling),f&&(f=e)):this._bodyElement.appendChild(e)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(g,c,f){var b=this._treeModel.getId(g),e;if(b===this._id)this._removeChildRows(b),this._generateChildren(c,0),this._rowsChanged();else{var d=n.node(b);d?(d._item=g,
d&&(f||d._expanded)?(this._removeChildRows(b),c?(d._expanded=!0,this._renderer.updateExpandVisuals(d,!0),this._generateChildren(c,d._depth+1,d),this._rowsChanged()):(e=this,this._renderer.updateExpandVisuals(d,"progress"),c=this._treeModel.getChildren(d._item,function(b){e.destroyed||(e._renderer.updateExpandVisuals(d,!0),d._expanded||(d._expanded=!0,e._generateChildren(b,d._depth+1,d),e._rowsChanged()))}))):this._renderer.updateExpandVisuals(d,!1)):console.log(k["could not find table row "]+b)}},
getItem:function(g){var c=n.node(g);return c&&c._item?c._item:g},toggle:function(g){var c=n.node(g);c&&(c._expanded?this.collapse(g):this.expand(g))},isExpanded:function(g){g="string"===typeof g?g:this._treeModel.getId(g);return(g=n.node(g))?g._expanded:!1},expand:function(g,c,f){g="string"===typeof g?g:this._treeModel.getId(g);var b=n.node(g);if(b){var e=this;b._expanded?c&&c.apply(e,f):(this._renderer.updateExpandVisuals(b,"progress"),this._treeModel.getChildren(b._item,function(d){e.destroyed||
(e._renderer.updateExpandVisuals(b,!0),b._expanded||(b._expanded=!0,e._generateChildren(d,b._depth+1,b),e._rowsChanged()),c&&c.apply(e,f))}))}},_removeChildRows:function(g){for(var c=g===this._id,f=!1,b=-1,e=[],d=n.$$array(".treeTableRow",this._parent),m=0;m<d.length;m++){var a=d[m];if(f)break;c?a._depth>b?e.push(a):f=!0:a.id===g&&(c=!0,b=a._depth)}for(g=0;g<e.length;g++)c=e[g],c.parentNode.removeChild(c)},collapse:function(g){g="string"===typeof g?g:this._treeModel.getId(g);var c=n.node(g);if(c){if(!c._expanded)return;
c._expanded=!1;this._renderer.updateExpandVisuals(c,!1);this._removeChildRows(g);this._rowsChanged()}this._onCollapse&&this._onCollapse(c._item)},getIndent:function(){return this._indent}};l.prototype.constructor=l;return{TableTree:l}});
define("orion/treeModelIterator",[],function(){var k={};k.TreeModelIterator=function(){function k(l,g){this.firstLevelChildren=l;this.reset();this._init(g)}k.prototype={_init:function(l){l&&(this.isExpanded=l.isExpanded,this.isExpandable=l.isExpandable,this.forceExpandFunc=l.forceExpandFunc,this.getChildrenFunc=l.getChildrenFunc)},topLevel:function(l){return l.parent?l.parent===this.root:!0},_getChildren:function(l){return"function"===typeof this.getChildrenFunc?this.getChildrenFunc(l):l?l.children:
null},_expanded:function(l){if(!l)return!0;var g=this._getChildren(l),g=g&&0<g.length;this.isExpanded&&g&&(g=this.isExpanded(l));return g},_expandable:function(l){return!l?!0:this.isExpandable?this.isExpandable(l):!1},_diveIn:function(l){return this._expanded(l)?(l=this._getChildren(l),this.setCursor(l[0]),this.cursor()):null},_drillToLast:function(l){return this._expanded(l)?(l=this._getChildren(l),this._drillToLast(l[l.length-1])):l},_forward:function(l){if(!this._cursor)return null;var g=this._diveIn(this._cursor);
if(!g){if(l&&this._expandable(this._cursor)&&this.forceExpandFunc){var c=this;return this.forceExpandFunc(this._cursor,"first",function(f){f&&c.setCursor(f)})}(g=this._findSibling(this._cursor,!0))&&this.setCursor(g)}return g},_backward:function(l){if(!this._cursor)return null;var g=this._findSibling(this._cursor,!1);g&&g!==this._cursor.parent&&(g=this._drillToLast(g));if(l&&g&&this._expandable(g)&&this.forceExpandFunc&&g!==this._cursor.parent){var c=this;return this.forceExpandFunc(g,"last",function(f){f&&
c.setCursor(f)})}g&&this.setCursor(g);return g},_findSibling:function(l,g){for(var c=this.topLevel(l),f=this._getChildren(l.parent),f=c?this.firstLevelChildren:f,b=0;b<f.length;b++)if(f[b]===l)return 0===b&&!g?c?null:l.parent:b===f.length-1&&g?c?null:this._findSibling(l.parent,g):g?f[b+1]:f[b-1];return null},_inParentChain:function(l,g){for(var c=l.parent;c;){if(c===g)return!0;c=c.parent}return!1},_getTopLevelParent:function(l){if(this.topLevel(l))return l;for(l=l.parent;l;){if(this.topLevel(l))return l;
l=l.parent}return null},_onCollapse:function(l){return this._expanded(l.parent)?l:this._onCollapse(l.parent)},_scan:function(l,g,c){this.setCursor(g);var f=[];for(f.push(g);;){if(this.iterate(l))f.push(this.cursor());else break;if(c===this.cursor())return f}return null},setCursor:function(l){this._prevCursor=this._cursor;this._cursor=l},setTree:function(l){this.firstLevelChildren=l;0<this.firstLevelChildren.length&&(this.root=this.firstLevelChildren[0].parent)},scan:function(l,g){var c=this.cursor(),
f=this._scan(!0,l,g);f||(f=this._scan(!1,l,g));this.setCursor(c);return f},iterate:function(l,g){return l?this._forward(g):this._backward(g)},iterateOnTop:function(l,g){var c=this._findSibling(this._getTopLevelParent(this.cursor()),l);c?this.setCursor(c):g&&0<this.firstLevelChildren.length&&this.setCursor(l?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(l){return!this._cursor?null:this._inParentChain(this._cursor,l)?(this.setCursor(l),this._cursor):
null},reset:function(){this.root=this._prevCursor=this._cursor=null;0<this.firstLevelChildren.length&&(this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent)},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}};return k}();return k});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(k,n,l){var g={},c=-1!==navigator.userAgent.indexOf("iPad"),f=-1!==window.navigator.platform.indexOf("Mac");g.ExplorerNavHandler=function(){function b(b,d,c){this.explorer=b;this.model=this.explorer.model;this._navDict=d;this._listeners=[];this._selections=[];this._currentColumn=0;b=this._getEventListeningDiv();b.tabIndex=0;b.classList.add("selectionModelContainer");var a=this;this._modelIterator=
new n.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:c.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(d){return a.explorer.renderer.isExpandable(d)}:function(d){return a.isExpandable(d)},forceExpandFunc:this.explorer.forceExpandFunc?function(d,b,e){return a.explorer.forceExpandFunc(d,b,e)}:void 0});this._init(c);(!c||!1!==c.setFocus)&&b.focus();c=function(d){if(l.isFormElement(d.target)||a.explorer.preventDefaultFunc&&a.explorer.preventDefaultFunc(d,
a._modelIterator.cursor()))return!0;if(d.keyCode===k.KEY.DOWN)return a.onDownArrow(d);if(d.keyCode===k.KEY.UP)return a.onUpArrow(d);if(d.keyCode===k.KEY.RIGHT)return a.onRightArrow(d);if(d.keyCode===k.KEY.LEFT)return a.onLeftArrow(d);if(d.keyCode===k.KEY.SPACE)return a.onSpace(d);if(d.keyCode===k.KEY.ENTER)return a.onEnter(d)};b.addEventListener("keydown",c,!1);this._listeners.push({type:"keydown",listener:c});c=function(d){if(a.explorer.onFocus)a.explorer.onFocus(!1);else a.toggleCursor(null,!1)};
b.addEventListener("blur",c,!1);this._listeners.push({type:"blur",listener:c});c=function(d){if(a.explorer.onFocus)a.explorer.onFocus(!0);else a.toggleCursor(null,!0)};b.addEventListener("focus",c,!1);this._listeners.push({type:"focus",listener:c});this._parentDiv=b}b.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(b){this._linearGridMove=!1;b&&(this._selectionPolicy=b.selectionPolicy,this.gridClickSelectionPolicy=b.gridClickSelectionPolicy||
"none",this.preventDefaultFunc=b.preventDefaultFunc,this.postDefaultFunc=b.postDefaultFunc)},_ctrlKeyOn:function(b){return f?b.metaKey:b.ctrlKey},removeListeners:function(){if(this._listeners)for(var b=0;b<this._listeners.length;b++)this._parentDiv.removeEventListener(this._listeners[b].type,this._listeners[b].listener,!1)},focus:function(){var b=this._getEventListeningDiv();b&&b.focus()},_getEventListeningDiv:function(b){return this.explorer.keyEventListeningDiv&&"function"===typeof this.explorer.keyEventListeningDiv?
this.explorer.keyEventListeningDiv(b):k.node(this.explorer._parentId)},isExpandable:function(b){return!b?!1:k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)))?!0:!1},isExpanded:function(b){return!b?!1:this.explorer.myTree.isExpanded(this.model.getId(b))},refreshSelection:function(b,d){var c=this;this.explorer.selection&&this.explorer.selection.getSelections(function(a){c._clearSelection(d);for(var h=0;h<a.length;h++)c._selections.push(a[h]);0<c._selections.length?c.cursorOn(c._selections[0],
!0,!1,b):c.cursorOn(null,!1,!1,b);c._shiftSelectionAnchor&&0<=c._inSelection(c._shiftSelectionAnchor)||(c._shiftSelectionAnchor=null)})},refreshModel:function(b,d,c,a){this._currentColumn=0;this.topIterationNodes=[];this.model=d;this._navDict=b;this.model.getTopIterationNodes?this.topIterationNodes=this.model.getTopIterationNodes():c&&(this.topIterationNodes=c);this._modelIterator.setTree(this.topIterationNodes);!a&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(b){b=this.model.getId(b);for(var d=0;d<this._selections.length;d++)if(b===this.model.getId(this._selections[d]))return d;return-1},_clearSelection:function(b){if(b)for(b=0;b<this._selections.length;b++)this._checkRow(this._selections[b],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(b){this._selectionPolicy!==
b&&(("readonlySelection"===this._selectionPolicy||"readonlySelection"===b)&&this._toggleSelectionClass("disabledRow","readonlySelection"===b),this._selectionPolicy=b,"cursorOnly"===this._selectionPolicy&&this._clearSelection(!0))},setSelection:function(b,d,c){"readonlySelection"!==this._selectionPolicy&&("cursorOnly"===this._selectionPolicy?d&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(b,!0):this._isRowSelectable(b)&&(!d||"singleSelection"===this._selectionPolicy?(this._clearSelection(!0),
this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b):(d=this._inSelection(b),0<=d?(this._checkRow(b,!0),this._selections.splice(d,1)):(this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b)),c&&(this._shiftSelectionAnchor=this._lastSelection),this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))))},moveColumn:function(b,d){b||(b=this.currentModel());var c=this._getGridChildren(b);if(c&&1<c.length||
0===d&&c){0!==d&&this.toggleCursor(b,!1);var a=this._currentColumn,h=!0,a=a+d;0>a?(this._linearGridMove&&0!==d&&(this._modelIterator.iterate(!1)?b=this.currentModel():h=!1),a=h?c.length-1:this._currentColumn):a>=c.length&&(this._linearGridMove&&0!==d&&(this._modelIterator.iterate(!0)?b=this.currentModel():h=!1),a=h?0:this._currentColumn);this._currentColumn=a;0!==d&&this.toggleCursor(b,!0);return!0}return!1},_getGridChildren:function(b){return this._navDict?this._navDict.getGridNavHolder(b):null},
getCurrentGrid:function(b){b||(b=this.currentModel());return(b=this._getGridChildren(b))&&0<b.length?b[this._currentColumn]:null},getAriaContainerElement:function(b){for(var d=this._parentDiv,c;b&&b!==d&&"grid"!==(c=b.getAttribute("role"))&&"tree"!==c&&"treegrid"!==c;)b=b.parentNode;return b===d?null:b},toggleCursor:function(b,d){var c=this.getRowDiv(b),a=this.getCurrentGrid(b);a?(c&&(d?c.classList.add("treeIterationCursorRow"):c.classList.remove("treeIterationCursorRow")),a.domNode&&(c=this.getAriaContainerElement(a.domNode),
d?(a.domNode.classList.add("treeIterationCursor"),c&&c.setAttribute("aria-activedescendant",a.domNode.id)):a.domNode.classList.remove("treeIterationCursor"))):c&&(d?c.classList.add("treeIterationCursorRow_Dotted"):c.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(b,d,c,a){var h,f;if(b||d){if(f===this._modelIterator.cursor())return;h=this._modelIterator.cursor();f=b;this._modelIterator.setCursor(f)}else h=this._modelIterator.prevCursor(),
f=this._modelIterator.cursor();if(h!==f||d)if(this.toggleCursor(h,!1),!d||f){this.moveColumn(null,0);this.toggleCursor(f,!0);if((b=this.getRowDiv())&&!a){a=b.parentNode;for(d=document.documentElement;a&&a!==d;){var g=window.getComputedStyle(a,null);if(!g)break;g=g.getPropertyValue("overflow-y");if("auto"===g||"scroll"===g)break;a=a.parentNode}a&&(d=!0,b.offsetTop<=a.scrollTop?(d=!1,void 0===c&&(c=!1)):b.offsetTop+b.offsetHeight>=a.scrollTop+a.clientHeight&&(d=!1,void 0===c&&(c=!0)),d||b.scrollIntoView(!c))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(h,
f)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var b=[],d=0;d<this._selections.length;d++)b.push(this.model.getId(this._selections[d]));return b},getRowDiv:function(b){b=b?b:this._modelIterator.cursor();if(!b)return null;b=this.model.getId(b);var d=this._navDict.getValue(b);return d&&d.rowDomNode?d.rowDomNode:k.node(b)},iterate:function(b,d,c,a){var h=null;if(this.topIterationNodes&&0!==this.topIterationNodes.length)if(a){a=this.currentModel();for((h=this._modelIterator.iterate(b,
d))&&this._setCursorOnItem(b,c);h&&h.isNotSelectable;)(h=this._modelIterator.iterate(b,d))&&this._setCursorOnItem(b,c);h||(this.cursorOn(a,!0,!1,!0),this._setCursorOnItem(b,c))}else this._modelIterator.iterate(b,d)&&this._setCursorOnItem(b,c)},_toggleSelectionClass:function(b,d){this._selections.forEach(function(c){(c=this.getRowDiv(c))&&(d?c.classList.add(b):c.classList.remove(b))}.bind(this))},_setCursorOnItem:function(b,d){this.cursorOn(null,!1,b);if(d){var c=this._inSelection(this._modelIterator.prevCursor()),
a=this._inSelection(this._modelIterator.cursor());0<=c&&0<=a?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(b,d){if(this.explorer.renderer._useCheckboxSelection&&"singleSelection"!==this._selectionPolicy){var c=this.getRowDiv(b);if(c){var a=k.node(this.explorer.renderer.getCheckBoxId(c.id)),h=d?!a.checked:!0;if(h!==a.checked)this.explorer.renderer.onCheck(c,a,h,!0)}}else this._select(b,d)},_select:function(b,d){b||(b=this._modelIterator.cursor());
var c=this.getRowDiv(b);c&&(0>this._inSelection(b)?c.classList.add("checkedRow"):c.classList.remove("checkedRow"))},_onModelGrid:function(b,d){var c=this._getGridChildren(b);if(c)for(var a=0;a<c.length;a++)if(d.target===c[a].domNode)return!0;return!1},onClick:function(b,d){if("readonlySelection"===this._selectionPolicy||this.isDisabled(this.getRowDiv(b)))k.stop(d);else{var m=k.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)));if(d.target!==m&&!("none"===this.gridClickSelectionPolicy&&
this._onModelGrid(b,d)))if(this.cursorOn(b,!0,!1,!0),c)this.setSelection(b,!0);else if(this._ctrlKeyOn(d))this.setSelection(b,!0,!0);else if(d.shiftKey&&this._shiftSelectionAnchor){if(m=this._modelIterator.scan(this._shiftSelectionAnchor,b)){this._clearSelection(!0);for(var a=0;a<m.length;a++)this.setSelection(m[a],!0)}}else this.setSelection(b,!1,!0)}},onCollapse:function(b){this._modelIterator.collapse(b)&&this.cursorOn()},onUpArrow:function(b){this.iterate(!1,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&
!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},onDownArrow:function(b){this.iterate(!0,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},_shouldMoveColumn:function(b){var d=this.currentModel(),c=this._getGridChildren(d);return c&&1<c.length?this.isExpandable(d)?this._ctrlKeyOn(b):!0:!1},onLeftArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,-1),b.preventDefault(),
!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&this.isExpanded(d))return this.explorer.myTree.collapse(d),b.preventDefault(),!0;this._modelIterator.topLevel(d)?this.explorer.scopeUp&&"function"===typeof this.explorer.scopeUp&&this.explorer.scopeUp():(this.cursorOn(d.parent),this.setSelection(d.parent,!1,!0))},onRightArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,1),b.preventDefault(),!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&
!this.isExpanded(d))return this.explorer.myTree.expand(d),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(d)),b.preventDefault(),!1},_isRowSelectable:function(b){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(b):!0},onSpace:function(b){this.setSelection(this.currentModel(),!0,!0);b.preventDefault()},onEnter:function(b){var d=this.getCurrentGrid(this._modelIterator.cursor());if(d)if(d.widget)if("function"===typeof d.onClick)d.onClick();else"function"===
typeof d.widget.focus&&d.widget.focus();else{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(b),!1,!1,!1,0,null);d.domNode.dispatchEvent(c)}else if(d=this._modelIterator.cursor())if(this.explorer.renderer.getRowActionElement&&(c=this.explorer.renderer.getRowActionElement(this.model.getId(d)),c.href&&(this._ctrlKeyOn(b)?window.open(c.href):window.location.href=c.href)),this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(b,
d),b.preventDefault(),!1},setIsNotSelectable:function(b,d){b.isNotSelectable=d},disableItem:function(b){var d=this.getRowDiv(b);this.isExpandable(b)&&this.isExpanded(b)&&(this._modelIterator.collapse(b),this.explorer.myTree.toggle(d.id));d.classList.remove("checkedRow");d.classList.add("disabledNavRow");this.setIsNotSelectable(b,!0)},isDisabled:function(b){return b.classList.contains("disabledNavRow")},enableItem:function(b){var d=this.getRowDiv(b);d&&(d.classList.remove("disabledNavRow"),this.setIsNotSelectable(b,
!1))}};return b}();g.ExplorerNavDict=function(){function b(b){this._dict={};this._model=b}b.prototype={addRow:function(b,d){var c=this._model.getId(b);this._dict[c]={model:b,rowDomNode:d}},getValue:function(b){return this._dict[b]},getGridNavHolder:function(b,d){if(!b)return null;var c=this._model.getId(b);return this._dict[c]?(!this._dict[c].gridChildren&&d&&(this._dict[c].gridChildren=[]),this._dict[c].gridChildren):null},initGridNavHolder:function(b){if(!b)return null;b=this._model.getId(b);this._dict[b]&&
(this._dict[b].gridChildren=null)}};return b}();return g});
define("orion/explorers/explorer","i18n!orion/nls/messages require orion/webui/littlelib orion/webui/treetable orion/explorers/explorerNavHandler orion/commands".split(" "),function(k,n,l,g,c,f){var b={};b.Explorer=function(){function b(d,c,a,h){this.registry=d;this.renderer=a;this.selection=c;this.commandService=h;this.renderer&&(this.renderer.explorer=this);this.myTree=null}b.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(d,b){this.myTree&&this.myTree.refresh.bind(this.myTree)(d,b,!0)},updateCommands:function(d){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(d)},makeNewItemPlaceHolder:function(d,b,a,h){d=this.getRow(d);if(a)return d=d.childNodes[a],d.appendChild(document.createElement("br")),h=document.createElement("span"),h.id=b+"placeHolderRow",d.appendChild(h),{tempNode:h,refNode:h};if(d){var c=document.createElement("tr");
c.id=b+"placeHolderRow";a=document.createElement("td");a.id=b+"placeHolderCol";c.appendChild(a);h?(d.parentNode.insertBefore(c,d.nextSibling),d=parseInt(d.firstChild.style.paddingLeft),a.style.paddingLeft=this.myTree.getIndent()+d+"px"):d.appendChild(c);h=l.node(b+"placeHolderRow");d=l.node(b+"placeHolderCol");if(h&&d)return{tempNode:h,refNode:d}}return null},getRow:function(d){if(d=this.model.getId(d))return l.node(d)},collapseAll:function(){for(var d=this._navHandler.getTopLevelNodes(),b=0;b<d.length;b++)this.myTree.collapse(d[b])},
expandAll:function(d){if(d)this._expandRecursively(d);else if(this._navHandler){d=this._navHandler.getTopLevelNodes();for(var b=0;b<d.length;b++)this._expandRecursively(d[b])}},_expandRecursively:function(d){if(this._navHandler&&this._navHandler.isExpandable(d)){var b=this;this.myTree.expand(d,function(){b.model.getChildren(d,function(a){if(!(void 0===a||null===a))for(var d=a.length,c=0;c<d;c++)b._expandRecursively(a[c])})})}},createTree:function(d,b,a){d="string"===typeof d?d:d.id||d;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var h=d+"innerTree",e=l.node(h);e&&l.empty(e);b&&(b.rootId=h);this.model=b;this._parentId=d;this._treeOptions=a;if(!a||a&&!a.noSelection)this.selectionPolicy=a?a.selectionPolicy:"",this._navDict=new c.ExplorerNavDict(this.model);this.myTree=new g.TableTree({id:h,model:b,parent:d,onComplete:a?a.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:a?!!a.showRoot:
!1,indent:a?a.indent:void 0,onCollapse:a?a.onCollapse:void 0,navHandlerFactory:a?a.navHandlerFactory:void 0,tableElement:a?a.tableElement:void 0,tableBodyElement:a?a.tableBodyElement:void 0,tableRowElement:a?a.tableRowElement:void 0});this.renderer._initializeUIState();"cursorOnly"===this.selectionPolicy&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var d=this.getNavHandler(),b=[];
if(d&&this.getNavDict())for(var a=d.getSelection(),h=0;h<a.length;h++){var c=d.getRowDiv(a[h]);c&&c.parentNode&&(c=this.getNavDict().getValue(this.model.getId(a[h])),c.model&&b.push(c.model))}this.selection.setSelections(b)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var d=this._treeOptions;if(!d||d&&!d.noSelection){this.getNavHandler()||(this._navHandler=d&&d.navHandlerFactory&&"function"===typeof d.navHandlerFactory.createNavHandler?
d.navHandlerFactory.createNavHandler(this,this._navDict,d):new c.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:d?d.getChildrenFunc:null,setFocus:d&&d.setFocus,selectionPolicy:d?d.selectionPolicy:null}));var b=this;this.model.getRoot(function(a){a instanceof Array?b.getNavHandler().refreshModel(b.getNavDict(),b.model,a):a.children&&a.children instanceof Array&&b.getNavHandler().refreshModel(b.getNavDict(),b.model,a.children);d&&d.setFocus&&b.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,
checkbox:!1};return b}();b.createExplorerCommands=function(b,d){function c(a){return"function"===typeof a.getItemCount&&0<a.getItemCount()?d?d(a):!0:!1}var a=new f.Command({tooltip:k["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return c(a)},callback:function(a){a.items.expandAll()}}),h=new f.Command({tooltip:k["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",
visibleWhen:function(a){return c(a)},callback:function(a){a.items.collapseAll()}});b.addCommand(a);b.addCommand(h)};b.ExplorerModel=function(){function b(d,c,a){this.rootPath=d;this.fetchItems=c;this.idPrefix=a||""}b.prototype={destroy:function(){this.destroyed=!0},getRoot:function(d){var b=this;this.fetchItems(this.rootPath).then(function(a){b.root=a;d(a)})},getChildren:function(d,b){d.Children?b(d.Children):d.ChildrenLocation?this.fetchItems(d.ChildrenLocation).then(function(a){d.Children=a;b(a)}):
b([])},getId:function(d){if(d.Location===this.root.Location)return this.rootId;d=d.Location.replace(/[\\\/]/g,"");for(var b=this.idPrefix,a=0;a<d.length;a++)b=d[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?b+d.charCodeAt(a):b+d[a];return b}};return b}();b.ExplorerFlatModel=function(){function c(d,b,a){this.rootPath=d;this.fetchItems=b;this.root=a}c.prototype=new b.ExplorerModel;c.prototype.getRoot=function(d){if(this.root)d(this.root);else{var b=this;this.fetchItems(this.rootPath).then(function(a){b.root=a;
d(a)})}};c.prototype.getChildren=function(d,b){d===this.root?b(this.root):b([])};return c}();b.ExplorerRenderer=function(){function b(d,c){this.explorer=c;this._init(d);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}b.prototype={_init:function(d){d&&(this._useCheckboxSelection=void 0===d.checkbox?!1:d.checkbox,this.selectionPolicy=d.singleSelection?"singleSelection":
"",this._cachePrefix=d.cachePrefix,this.getCheckedFunc=d.getCheckedFunc,this.onCheckedFunc=d.onCheckedFunc,this._highlightSelection=!0,this._treeTableClass=d.treeTableClass||"treetable",!1===d.highlightSelection&&(this._highlightSelection=!1),this.actionScopeId||(this.actionScopeId=d.actionScopeId),this.commandService||(this.commandService=d.commandService))},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(d,b){this.tableTree=b;this.tableNode=d;l.empty(d);this._treeTableClass&&
d.classList.add(this._treeTableClass);this.renderTableHeader(d)},getActionsColumn:function(d,b,a,h,c){a=a||"tool";var e=document.createElement("td");e.id=b.id+"actionswrapper";h&&e.classList.add(h);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,e,d,this.explorer,a,null,c&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(d,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return e},initCheckboxColumn:function(d){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(d,b){if(this._useCheckboxSelection){var a=document.createElement("td"),h=document.createElement("span");h.id=this.getCheckBoxId(b.id);h.classList.add("core-sprite-check");h.classList.add("selectionCheckmarkSprite");h.rowId=b.id;this.getCheckedFunc&&(h.checked=this.getCheckedFunc(d),h.checked?(this._highlightSelection&&b.classList.add("checkedRow"),h.classList.add("core-sprite-check_on")):
(this._highlightSelection&&b.classList.remove("checkedRow"),h.classList.remove("core-sprite-check_on")));a.appendChild(h);var c=this;h.addEventListener("click",function(a){c.onCheck(b,a.target,a.target.checked?!1:!0,!0)},!1);return a}},getCheckBoxId:function(b){return b+"selectedState"},onCheck:function(b,c,a,h,e){(c.checked=a)?c.classList.add("core-sprite-check_on"):c.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(c.rowId,a,h);this.explorer.getNavHandler()&&e&&
this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(b.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var b=this.explorer.getNavHandler().getSelectionIds(),c=this._getUIStatePreferencePath();c&&window.sessionStorage&&(window.sessionStorage[c+"selection"]=JSON.stringify(b))}},_restoreSelections:function(b){var c=this.explorer.getNavDict(),a=this.explorer.getNavHandler();if(a&&c&&"cursorOnly"!==a.getSelectionPolicy()&&(b=window.sessionStorage[b+
"selection"],"string"===typeof b&&(b=0<b.length?JSON.parse(b):null),b)){for(var h=[],a=0;a<b.length;a++){var e=c.getValue(b[a]);if(e&&e.rowDomNode&&e.model&&(h.push(e.model),this._highlightSelection&&e.rowDomNode.classList.add("checkedRow"),e=l.node(this.getCheckBoxId(e.rowDomNode.id))))e.checked=!0,e.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(h),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(b){window.sessionStorage[b+
"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(b){var c=!1,a=window.sessionStorage[b+"expanded"];"string"===typeof a&&(a=0<a.length?JSON.parse(a):null);var h;if(a)for(h=0;h<a.length;h++)if(l.node(a[h])){this._expanded.push(a[h]);var e=this;this.tableTree.expand(a[h],function(){e._restoreSelections(b)});c=!0}return!c},_getUIStatePreferencePath:function(){if(this.explorer){var b=this.explorer.getRootPath();if(this._cachePrefix&&b)return b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,""),
"/"+this._cachePrefix+"/"+b+"/uiState"}return null},expandCollapseImageId:function(b){return b+"__expand"},updateExpandVisuals:function(b,c){var a=l.node(this.expandCollapseImageId(b.id));a&&(a.classList.remove(this._expandImageClass),a.classList.remove(this._collapseImageClass),a.classList.remove(this._progressImageClass),a.classList.add("progress"===c?this._progressImageClass:c?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(b,c,a,h){var e=document.createElement("span");
e.id=this.expandCollapseImageId(b.id);c.appendChild(e);e.classList.add(this._twistieSpriteClass);e.classList.add(this._collapseImageClass);if(a){var f=document.createElement("span");c.appendChild(f);f.classList.add(h||"imageSprite");f.classList.add(a)}var q=this;e.onclick=function(a){if(!q.explorer.getNavHandler().isDisabled(b)){q.tableTree.toggle(b.id);if(q.tableTree.isExpanded(b.id))q._expanded.push(b.id),q.explorer.postUserExpand&&q.explorer.postUserExpand(b.id);else for(var h in q._expanded)if(q._expanded[h]===
b.id){q._expanded.splice(h,1);break}(a=q._getUIStatePreferencePath())&&window.sessionStorage&&q._storeExpansions(a)}};return e},render:function(b,c){c.classList.add("navRow");this.renderRow(b,c)},rowsChanged:function(){"cursorOnly"!==this.explorer.selectionPolicy&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());(l.$(".sectionTreeTable",this.tableNode.parentNode)||l.$(".treetable",this.tableNode.parentNode))&&l.$$array(".treeTableRow",this.tableNode).forEach(function(b,c){var a=!(c%
2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",h="darkSectionTreeTableRow"===a?"lightSectionTreeTableRow":"darkSectionTreeTableRow";b.classList.add(a);b.classList.remove(h)})},updateCommands:function(){if(this.commandService)for(var b=l.$$array(".treeTableRow"),c=0;c<b.length;c++){var a=b[c],h=l.node(a.id+"actionswrapper");this.commandService.destroy(h);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,h,a._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=
[];var b=this._getUIStatePreferencePath();b&&window.sessionStorage&&this._restoreExpansions(b)&&this._restoreSelections(b)}};return b}();b.SelectionRenderer=function(){function c(b,e){this._init(b);this.explorer=e}c.prototype=new b.ExplorerRenderer;c.prototype.renderTableHeader=function(b){var c=document.createElement("thead"),a=document.createElement("tr");c.classList.add("navTableHeading");this._useCheckboxSelection&&a.appendChild(this.initCheckboxColumn(b));for(var h=0,e=this.getCellHeaderElement(h);e;)0<
e.innerHTML.length&&e.classList.add("navColumn"),a.appendChild(e),e=this.getCellHeaderElement(++h);c.appendChild(a);0<h&&b.appendChild(c)};c.prototype.renderRow=function(b,c){c.verticalAlign="baseline";c.classList.add("treeTableRow");"cursorOnly"!==this.explorer.selectionPolicy&&c.classList.add("selectableNavRow");var a=this.explorer.getNavDict();if(a){a.addRow(b,c);var h=this;c.addEventListener("click",function(a){if(h.explorer.getNavHandler())h.explorer.getNavHandler().onClick(b,a)},!1)}if(a=this.getCheckboxColumn(b,
c))a.classList.add("checkColumn"),c.appendChild(a);for(var a=0,e=this.getCellElement(a,b,c);e;)c.appendChild(e),0===a?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle(b)):e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++a,b,c)};c.prototype.getCellHeaderElement=function(b){};c.prototype.getCellElement=function(b,c,a){};return c}();b.SimpleFlatModel=function(){function c(b,
e,a){this.items=b;this.getKey=a;this.idPrefix=e;this.root={children:b}}c.prototype=new b.ExplorerModel;c.prototype.getRoot=function(b){b(this.root)};c.prototype.getId=function(b){b=this.getKey(b).replace(/[\\\/]/g,"");for(var c="",a=0;a<b.length;a++)c=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?c+b.charCodeAt(a):c+b[a];return this.idPrefix+c};c.prototype.getChildren=function(b,c){b===this.root?c(this.items):c([])};return c}();return b});
define("orion/URITemplate",[],function(){function k(a){this._text=a}function n(a){return a.replace("%25","%")}function l(a,b){if("U"===b)return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===b)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(m,n);if("U+R-,"===b)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function g(a,b,d){for(var c=
[],e=0;e<a.length;e++)"undefined"!==typeof a[e]&&c.push(l(a[e],b));return c.join(d)}function c(a,b,d,c){for(var e=Object.keys(a),f=[],m=0;m<e.length;m++)"undefined"!==typeof a[e[m]]&&f.push(l(e[m],b)+d+l(a[e[m]],b));return f.join(c)}function f(a){if(0===a.length)throw Error("Invalid Expression: 0 length expression");(this._operator=e[a[0]])?a=a.substring(1):this._operator=e.NUL;for(var b=[],c=a.split(","),f=0;f<c.length;f++){var q=c[f].match(d);if(null===q)throw Error("Bad VarSpec: "+a);b.push({name:q[1],
explode:!!q[2],prefix:q[3]?parseInt(q[3],10):-1})}this._varSpecList=b}function b(a){for(var b=[],d=0,c=a.indexOf("{",d);-1!==c;){b.push(new k(a.substring(d,c)));d=a.indexOf("}",c+1);if(-1===d)throw Error("Invalid template: "+a);b.push(new f(a.substring(c+1,d)));d+=1;c=a.indexOf("{",d)}b.push(new k(a.substring(d)));this._templateComponents=b}var e={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"\x26":{first:"\x26",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},d=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,m=/%25[0-9A-F][0-9A-F]/g;k.prototype={expand:function(a){return encodeURI(this._text)}};
f.prototype={expand:function(a){for(var b=[],d=0;d<this._varSpecList.length;d++){var e=this._varSpecList[d],f=e.name,m=a[f],k=typeof m;if("undefined"!==k&&null!==m){var u=0===b.length?this._operator.first:this._operator.sep;if("string"===k)this._operator.named&&(u+=l(f,"U+R"),u+=0===m.length?this._operator.ifemp:"\x3d"),-1!==e.prefix&&e.prefix<m.length&&(m=m.substring(0,e.prefix)),u+=l(m,this._operator.allow);else if(Array.isArray(m)){if(0===m.length)continue;e.explode?u+=g(m,this._operator.allow,
this._operator.sep):(e=g(m,this._operator.allow,","),this._operator.named&&(u+=l(f,"U+R"),u+=0===e.length?this._operator.ifemp:"\x3d"),u+=e)}else if("object"===k){if(0===Object.keys(m).length)continue;e.explode?u+=c(m,this._operator.allow,"\x3d",this._operator.sep):(e=c(m,this._operator.allow,",",","),this._operator.named&&(u+=l(f,"U+R"),u+=0===e.length?this._operator.ifemp:"\x3d"),u+=e)}else throw Error("bad param type: "+f+" : "+k);b.push(u)}}return b.join("")}};b.prototype={expand:function(a){for(var b=
[],d=0;d<this._templateComponents.length;d++)b.push(this._templateComponents[d].expand(a));return b.join("")}};return b});
define("orion/i18nUtil",["require","orion/Deferred"],function(k,n){function l(c){if(c=localStorage.getItem("orion/messageBundle/"+c))if(c=JSON.parse(c),c._expires&&c._expires>(new Date).getTime())return delete c._expires,c;return null}var g={};return{getMessageBundle:function(c){function f(a){a?k(["i18n!"+c],function(a){if(a){var b=c;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+b,JSON.stringify(a));delete a._expires}e.resolve(a)}):b(Error(c))}function b(a){e.reject(a)}
if(g[c])return g[c];var e=new n;g[c]=e;var d=l(c);if(d)return e.resolve(d),e;try{k([c],f,b)}catch(m){k(["orion/i18n!"+c],f,b)}return e},formatMessage:function(c){var f=arguments;return c.replace(/\$\{([^\}]+)\}/g,function(b,c){return f[(c<<0)+1]})}}});
define("orion/edit/editorContext",[],function(){return{getEditorContext:function(k){var n=Object.create(null);k.getServiceReferences("orion.edit.context").forEach(function(l){var g=k.getService(l);Object.keys(g).forEach(function(c){"function"===typeof g[c]&&(n[c]=g[c].bind(g))})});return n},getOptions:function(k){var n=Object.create(null);k.getServiceReferences("orion.edit.context").forEach(function(l){l.getPropertyKeys().forEach(function(g){"service.id"!==g&&"service.names"!==g&&"objectClass"!==
g&&(n[g]=l.getProperty(g))})});return n}}});
define("orion/keyBinding",["orion/util"],function(k){function n(g,c,f,b,e,d){this.type=d||"keydown";this.keyCode="string"===typeof g&&"keydown"===this.type?g.toUpperCase().charCodeAt(0):g;this.mod1=void 0!==c&&null!==c?c:!1;this.mod2=void 0!==f&&null!==f?f:!1;this.mod3=void 0!==b&&null!==b?b:!1;this.mod4=void 0!==e&&null!==e?e:!1}function l(g){this.keys=g}n.prototype={getKeys:function(){return[this]},match:function(g,c){if(void 0!==c){if(0!==c)return!1}else if(g instanceof Array){if(1<g.length)return!1;
g=g[0]}return g.type!==this.type?!1:this.keyCode===g.keyCode||this.keyCode===String.fromCharCode(k.isOpera?g.which:void 0!==g.charCode?g.charCode:g.keyCode)?this.mod1!==(k.isMac?g.metaKey:g.ctrlKey)||"keydown"===this.type&&this.mod2!==g.shiftKey||this.mod3!==g.altKey||k.isMac&&this.mod4!==g.ctrlKey?!1:!0:!1},equals:function(g){return!g||this.keyCode!==g.keyCode||this.mod1!==g.mod1||this.mod2!==g.mod2||this.mod3!==g.mod3||this.mod4!==g.mod4||this.type!==g.type?!1:!0}};l.prototype={getKeys:function(){return this.keys.slice(0)},
match:function(g,c){var f=this.keys;if(void 0!==c)return c>f.length?!1:f[c].match(g)?c===f.length-1?!0:c+1:!1;g instanceof Array||(g=[g]);if(g.length>f.length)return!1;var b;for(b=0;b<g.length;b++)if(!f[b].match(g[b]))return!1;return b===f.length?!0:b},equals:function(g){if(!g.keys||g.keys.length!==this.keys.length)return!1;for(var c=0;c<g.keys.length;c++)if(!g.keys[c].equals(this.keys[c]))return!1;return!0}};return{KeyBinding:n,KeyStroke:n,KeySequence:l}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(k,n,l){function g(c,f){this._activeContainer=null;this._getElementsFunction=c;this._toolbarLayoutFunction=f}g.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&l.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&l.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();this._oldFocusNode&&(this._oldFocusNode.focus(),this._oldFocusNode=null)}this._activeElements=null},open:function(c,f,b){"string"===typeof c&&(c=l.node(c));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===c)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(c))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=b;var e=f(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!e)return!1;this._activeElements.focusNode=e;c=l.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(0===c.length){f=this._activeElements.dismissArea||
this._activeElements.parameterArea;c=document.createElement("button");c.id="closebox";c.className="imageSprite core-sprite-close dismissButton";c.title=k.Close;f.appendChild(c);var d=this;c.addEventListener("click",function(b){d.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);e&&(this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){e.focus();e.select&&e.select()},0));this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(c,f){l.$$array("input",f).forEach(function(b){"checkbox"===b.type?c.parameters.setValue(b.parameterName,b.checked):"button"!==b.type&&c.parameters.setValue(b.parameterName,b.value.trim())});l.$$array("textArea",f).forEach(function(b){c.parameters.setValue(b.parameterName,b.value.trim())});c.command.callback&&c.command.callback.call(c.handler,c)},collectParameters:function(c){return c.parameters?
(c.domNode&&c.domNode.classList.add("commandMarker"),this.open(c.domNode||c.domParent,this.getFillFunction(c))):!1},getFillFunction:function(c,f){var b=this;return function(e,d){var m=null,a=function(){f&&f();b.close()},h=function(d){d.keyCode===l.KEY.ENTER&&b._collectAndCall(c,e);if(d.keyCode===l.KEY.ESCAPE||d.keyCode===l.KEY.ENTER)a(),l.stop(d)};c.parameters.forEach(function(b){var d=null;b.label&&(d=document.createElement("label"),d.classList.add("parameterInput"),d.setAttribute("for",b.name+"parameterCollector"),
d.textContent=b.label,e.appendChild(d));var f=b.name+"parameterCollector",g,d=d||e;"text"===b.type&&"number"===typeof b.lines&&1<b.lines?(g=document.createElement("textarea"),g.rows=b.lines,g.type="textarea",g.id=f,d.appendChild(g),h=function(b){b.keyCode===l.KEY.ESCAPE&&(a(),l.stop(b))}):"boolean"===b.type?(g=document.createElement("input"),g.type="checkbox",g.id=f,d.appendChild(g),b.value&&(g.checked=!0)):(g=document.createElement("input"),g.type=b.type,g.id=f,d.appendChild(g),b.value&&(g.value=
b.value));g.classList.add("parameterInput");g.setAttribute("speech","speech");g.setAttribute("x-webkit-speech","x-webkit-speech");g.parameterName=b.name;m||(m=g);0<b.eventListeners.length&&b.eventListeners.forEach(function(a){g.addEventListener(a.event,function(b){return a.handler(b,c)},a.capture)});g.addEventListener("keydown",h,!1)});var g=d;g||(g=document.createElement("span"),g.classList.add("layoutRight"),g.classList.add("parametersDismiss"),e.appendChild(g));var t=function(a,b){var d=document.createElement("button");
b.appendChild(d);a&&d.appendChild(document.createTextNode(a));d.classList.add("dismissButton");return d};c.parameters.hasOptionalParameters()&&(c.parameters.optionsRequested=!1,t(k.More,g).addEventListener("click",function(){c.parameters.optionsRequested=!0;b._collectAndCall(c,e);a()},!1));t(k.Submit,g).addEventListener("click",function(){b._collectAndCall(c,e);a()},!1);g=t(null,g);g.id="closebox";g.classList.add("imageSprite");g.classList.add("core-sprite-close");g.title=k.Close;g.addEventListener("click",
function(b){a()},!1);return m}}};g.prototype.constructor=g;return{CommandParameterCollector:g}});define("orion/regex",[],function(){return{escape:function(k){return k.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26")},parse:function(k){return(k=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(k))?{pattern:k[1],flags:k[2]}:null}}});
define("orion/contentTypes",[],function(){function k(b,a){if("string"!==typeof b)return null;for(var d=b&&b.split(".").pop(),c=null,e=0;e<a.length;e++){var f=a[e],g;g=c;var l=f,k=d,w=0<=l.filename.indexOf(b),n;n=k.toLowerCase();n=-1!==l.extension.indexOf(n);if(w||n){if(!(n=!g))w&&(k=k.toLowerCase(),w=-1!==g.extension.indexOf(k)),n=w;n&&(g=l)}g===f&&(c=f)}return c}function n(b){return null===b||"undefined"===typeof b?[]:Array.isArray(b)?b:[b]}function l(b){return n(b).map(function(a){return String.prototype.toLowerCase.call(a)})}
function g(b){return{id:b.id,name:b.name,image:b.image,imageClass:b.imageClass,"extends":b["extends"],extension:l(b.extension),filename:n(b.filename)}}function c(b){var a=Object.create(null);b.map(g).forEach(function(b){Object.prototype.hasOwnProperty.call(a,b.id)||(a[b.id]=b)});return a}function f(f){if(f&&f.registerService){this.serviceRegistry=f;for(var a=f.getServiceReferences(e).concat(f.getServiceReferences(d)),h=[],g=0;g<a.length;g++)for(var t=n(a[g].getProperty("contentTypes")),q=0;q<t.length;q++)h.push(t[q]);
this.map=c(h);f.registerService(b,this)}else if(Array.isArray(f))this.serviceRegistry=null,this.map=c(f);else throw Error("Invalid parameter");}var b="orion.core.contentTypeRegistry",e="orion.core.contenttype",d="orion.file.contenttype";f.prototype={getContentTypes:function(){var b=this.getContentTypesMap(),a=[],d;for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&a.push(b[d]);return a},getContentTypesMap:function(){return this.map},getFileContentType:function(b){return k(b.Name,this.getContentTypes())},
getFilenameContentType:function(b){return k(b,this.getContentTypes())},getContentType:function(b){return this.map[b]||null},isExtensionOf:function(b,a){b="string"===typeof b?this.getContentType(b):b;a="string"===typeof a?this.getContentType(a):a;if(!b||!a)return!1;if(b.id===a.id)return!0;for(var d=b,c={};d&&(d=this.getContentType(d["extends"]));){if(d.id===a.id)return!0;if(c[d.id])throw Error("Cycle: "+d.id);c[d.id]=!0}return!1},isSomeExtensionOf:function(b,a){for(var d=0;d<a.length;d++)if(this.isExtensionOf(b,
a[d]))return!0;return!1}};return{ContentTypeRegistry:f,getFilenameContentType:k}});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(k,n,l,g,c,f,b){function e(){return k.toUrl?(new URL(k.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function d(a){var b={};a.getPropertyKeys().forEach(function(d){"objectClass"!==d&&"service.names"!==d&&"service.id"!==d&&"__plugin__"!==d&&(b[d]=a.getProperty(d))});return b}function m(a){return c.getMessageBundle(a.nls).then(function(b){a.textContent=
a.nameKey?b[a.nameKey]:a.name;return a},function(b){a.textContent=a.nameKey||a.name;return a})}function a(a,b){var c=a.getServiceReferences(b||"orion.page.link"),h=l.matchResourceParameters(window.location.href),f={OrionHome:e(),Location:h.resource},q=[];c.forEach(function(a){a=d(a);if(a.uriTemplate&&(a.nls||a.name)){var b=(new g(a.uriTemplate)).expand(f),b=l.validateURLScheme(b);a.href=b;a.nls?q.push(m(a)):(a.textContent=a.name,q.push((new n).resolve(a)))}});return n.all(q)}function h(a){var b=this.categories=
Object.create(null);a.forEach(function(a){b[a.id]=a})}function s(a){this.allPageLinks=a;this.allPageLinks.sort(t)}function t(a,b){var d=a.textContent&&a.textContent.toLowerCase(),c=b.textContent&&b.textContent.toLowerCase();return d<c?-1:d>c?1:0}var q;f.mixin(h.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});f.mixin(s.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var b=a.href;a=
a.textContent;var d=document.createElement("a");d.href=b;d.target="_self";d.classList.add("targetSelector");d.textContent=a;return d})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(a){var b;return!q?(b=[],a.getServiceReferences("orion.page.link.category").forEach(function(a){a=d(a);if(a.id&&(a.name||a.nameKey))a.nls?b.push(m(a)):(a.textContent=a.name,b.push((new n).resolve(a)))}),n.all(b).then(function(a){return q=new h(a)})):(new n).resolve(q)},getPageLinksInfo:function(b,
d){return a(b,d).then(function(a){return new s(a)})},getOrionHome:e}});
define("orion/extensionCommands","require orion/Deferred orion/commands orion/regex orion/contentTypes orion/URITemplate orion/i18nUtil orion/URL-shim orion/PageLinks i18n!orion/edit/nls/messages".split(" "),function(k,n,l,g,c,f,b,e,d,m){function a(a){var b={};a.getPropertyKeys().forEach(function(d){b[d]=a.getProperty(d)});return b}var h={},s=d.getOrionHome();h._cloneItemWithoutChildren=function v(a){if(null===a||"object"!==typeof a)return a;var b=a.constructor(),d;for(d in a)"children"!==d&&"Children"!==
d&&(b[d]=v(a[d]));return b};h._getOpenWithNavCommandExtensions=function(a,b){function d(a,b){for(var p=a.getServiceReferences("orion.navigate.openWith"),c=[],h=[],e=0;e<p.length;e++){var A=p[e];if(A.getProperty("editor")===b.id){var f=A.getProperty("contentType");f instanceof Array?c=c.concat(f):c.push(f||"*/*");A=A.getProperty("excludedContentTypes");A instanceof Array?h=h.concat(A):null!==A&&"undefined"!==typeof A&&h.push(A)}}0===c.length&&(c=null);0===h.length&&(h=null);return{contentTypes:c,excludedContentTypes:h}}
for(var c=function(){for(var b=a.getServiceReferences("orion.edit.editor"),d=[],p=0;p<b.length;p++){var c=b[p],h=c.getProperty("id");d.push({id:h,"default":c.getProperty("default")||!1,name:c.getProperty("name"),nameKey:c.getProperty("nameKey"),nls:c.getProperty("nls"),uriTemplate:c.getProperty("orionTemplate")||c.getProperty("uriTemplate"),validationProperties:c.getProperty("validationProperties")||[]})}return d}(),h=[],e=0;e<c.length;e++){var p=c[e],A=d(a,p);h.push({properties:{name:p.name||p.id,
nameKey:p.nameKey,id:"eclipse.openWithCommand."+p.id,contentType:A.contentTypes,excludedContentTypes:A.excludedContentTypes,uriTemplate:p.uriTemplate,nls:p.nls,forceSingleItem:!0,isEditor:p["default"]?"default":"editor",validationProperties:p.validationProperties},service:{}})}return h};h._makeValidator=function(a,b,d,h){function e(a,b,d,p,c){var h=!1,f;if("!"===b.charAt(0))return"undefined"===typeof a[b.substring(1)];if("undefined"!==typeof a[b]){if("undefined"===typeof d)f=a[b],h=!0;else if("string"===
typeof d){if(!typeof("string"===a[b]))return!1;if(p.variableName){if(d=RegExp(d).exec(a[b]))h=d[0],f="before"===p.variableMatchPosition?a[b].substring(0,d.index):"after"===p.variableMatchPosition?a[b].substring(d.index+h.length):"only"===p.variableMatchPosition?h:a[b],h=!0}else return RegExp(d).test(a[b])}else a[b]===d&&(f=a[b],h=!0);b=p.variableName;p=p.replacements;if(h&&b&&(c[b]=f,c.itemCached=a,p)){if("string"!==typeof f)return window.console.log("Cannot replace "+b+", value is not a string: "+
f),h;for(a=0;a<p.length;a++){f=!1;if(p[a].pattern){d=p[a].pattern;var g=p[a].replacement||"";c[b]=c[b].replace(RegExp(d),g).replace(RegExp(d),g)}else f=!0;f&&window.console.log("Invalid replacements specified in validation property.  "+p[a])}}return h}return!1}function g(a,b,d,p){var c=d.match,h,f;if(0<=(h=b.indexOf("["))){if(0>(f=b.indexOf("]")))return!1;var q=b.substring(0,h),m;if(!(m=a[q])||!Array.isArray(m))return!1;h=b.substring(h+1,f);h=parseInt(h,10);if(isNaN(h))return!1;0>h&&(h+=m.length);
b=b.substring(f+1);b=q+":"+String(h)+b}return 0<=b.indexOf("|")?(h=b.substring(0,b.indexOf("|")),b=b.substring(b.indexOf("|")+1),g(a,h,d,p)?!0:g(a,b,d,p)):0<=b.indexOf(":")?(h=b.substring(0,b.indexOf(":")),b=b.substring(b.indexOf(":")+1),a[h]?g(a[h],b,d,p):!1):e(a,b,c,d,p)}function p(b,d,p){if(p.info.validationProperties)for(var h=0;h<p.info.validationProperties.length;h++){var e=p.info.validationProperties[h];if("undefined"!==typeof e.source){if(!g(b,e.source,e,p))return!1}else return window.console.log("Invalid validationProperties in "+
a.id+".  No source property specified."),!1}var h=!0,f=d?c.getFilenameContentType(b.Name,d):null,f=f||{id:"application/octet-stream"};p.info.excludedContentTypes&&d&&(h=p.info.excludedContentTypes.every(function(a){a=a.replace(/([*?])/g,".$1");return-1!==f.id.search(a)?!1:!0}));h&&p.info.contentType&&d&&(h=p.info.contentType.some(function(a){a=a.replace(/([*?])/g,".$1");return-1!==f.id.search(a)?!0:!1}));return h}return{info:a,validationFunction:function(a){"function"===typeof h&&(a=h.call(this,a));
if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||this.info.uriTemplate)&&1!==a.length||1>a.length)return!1}else a=[a];for(var b=0;b<a.length;b++)if(!p(a[b],d,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var b={},d;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&(b[d]=a[d]);if(this.info.validationProperties)for(d=0;d<this.info.validationProperties.length;d++){var p=this.info.validationProperties[d];
p.source&&p.variableName&&(this.itemCached===a&&this[p.variableName]||g(a,p.source,p,this),a[p.variableName]?window.console.log("Variable name "+p.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):b[p.variableName]=this[p.variableName])}b.OrionHome=s;return(new f(this.info.uriTemplate)).expand(b)}return null}}};var t=m.UnnamedCommand;h._createCommandOptions=function(a,d,c,e,f,g){function p(b,p){var C=h._makeValidator(a,c,e,g);b.visibleWhen=
C.validationFunction.bind(C);if(f)if(C.generatesURI.bind(C)())b.hrefCallback=function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return C.getURI.bind(C)(a)};else{var A=a;b.callback=function(a){var p;if(A.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,p=h._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){p=[];for(var e=0;e<a.items.length;e++)p.push(h._cloneItemWithoutChildren(a.items[e]))}else p=h._cloneItemWithoutChildren(a.items);if(c)var C=c.getService("orion.page.progress");
d.run?C?C.progress(d.run(p),"Running command: "+b.name):d.run(p):c&&(C?C.progress(c.getService(d).run(p),"Running command: "+b.name):c.getService(d).run(p))}}p.resolve(b)}var A=new n;if(a.nls){var C=function(b){var d;b?(d=a.tooltipKey&&b[a.tooltipKey],b=a.nameKey&&b[a.nameKey]||a.name||t,d=d||a.tooltip||""):(b=a.name||a.nameKey||t,d=a.tooltip||a.tooltipKey||"");p({name:b,image:a.image,id:a.id||a.name,tooltip:d,isEditor:a.isEditor,showGlobally:a.showGlobally},A)};b.getMessageBundle(a.nls).then(C,C.bind(this,
null))}else p({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},A);return A};h.getOpenWithCommand=function(a,b,d){var c;a=d||h.getOpenWithCommands(a);for(d=0;d<a.length;d++)if(a[d].visibleWhen(b)){var e="default"===a[d].isEditor;if(!c||e)if(c=a[d],e)break}return c};h.getOpenWithCommands=function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];c.isEditor&&b.push(c)}return b};var q;h.createAndPlaceFileCommandsExtension=function(a,
b,d,c,e,f){return h.createFileCommands(a,null,f?"all":void 0,!!f,b).then(function(a){e&&0<a.length&&(b.addCommandGroup(d,"eclipse.openWith",1E3,m.OpenWith,e,null,null,null,"dropdownSelection"),b.addCommandGroup(d,"eclipse.fileCommandExtensions",1E3,m.OpenRelated,e));a.forEach(function(a){var p=null;e&&(p=a.isEditor?e+"/eclipse.openWith":e+"/eclipse.fileCommandExtensions");b.registerCommandContribution(d,a.id,c,p)});return{}})};h.createFileCommands=function(a,b,d,c,e){d=void 0===d?"global":d;c=void 0===
c?!0:c;var f=[];h._cachedFileCommands||h._createCachedFileCommands(a);("all"===d||"global"===d)&&h._cachedFileCommands.forEach(function(a){var b=a.properties;("all"===d||b.forceSingleItem&&b.showGlobally)&&f.push(a)});return n.when(function(){var d=a.getService("orion.core.contentTypeRegistry")||b;return q||n.when(d.getContentTypes(),function(a){return q=a})}(),function(){c&&(h._cachedOpenWithExtensions||(h._cachedOpenWithExtensions=h._getOpenWithNavCommandExtensions(a,q)),f=f.concat(h._cachedOpenWithExtensions),
e._addedOpenWithCommands=c);var b=f.map(function(b){var d=b.properties;b=b.service;var p=e.findCommand(d.id||d.name);return p?(new n).resolve(p):h._createCommandOptions(d,b,a,q,!0).then(function(a){a=new l.Command(a);e.addCommand(a);return a})});return n.all(b,function(a){return{_error:a}}).then(function(a){return a})})};h._createCachedFileCommands=function(b){var d=b.getServiceReferences("orion.navigate.command");h._cachedFileCommands=[];for(var c=0;c<d.length;c++)if("orion.navigateFromMetadata"!==
d[c].getProperty("id")){var e=b.getService(d[c]),f=a(d[c]);h._cachedFileCommands.push({properties:f,service:e})}};h.getFileCommandIds=function(){var a=[];if(h._cachedFileCommands)h._cachedFileCommands.length&&(a=h._cachedFileCommands.map(function(a){return a.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return a};h.createOpenWithCommands=function(a,b,d){return d&&d._addedOpenWithCommands?(new n).resolve(h.getOpenWithCommands(d)):h.createFileCommands(a,b,
"none",!0,d)};return h});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(k,n){function l(g){this._init(g)}l.prototype={_init:function(g){var c=n.node(g.container);if(!c)throw"no parent container";this._container=c;c.classList.remove("currentLocation");this._id=g.id||"eclipse.breadcrumbs";this._resource=g.resource||null;this._rootSegmentName=g.rootSegmentName;this._workspaceRootSegmentName=g.workspaceRootSegmentName;this._workspaceRootURL=g.workspaceRootURL;this._makeHref=g.makeHref;this._makeFinalHref=
g.makeFinalHref;this._maxLength=g.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var g;if(this._resource&&this._resource.Parents&&!this._resource.skip){g=document.createElement("a");var c=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(g,c):g.href=k.toUrl("edit/edit.html")+"#"+c}else g=document.createElement("span");n.empty(g);g.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return g}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(g){var c=document.createElement("a");c.classList.add("breadcrumb");c.appendChild(document.createTextNode(g));return c},addSegmentHref:function(g,c){this._makeHref?this._makeHref(g,c.Location,c):g.href=k.toUrl("edit/edit.html")+"#"+c.ChildrenLocation},buildSegments:function(g,c){if(this._resource.Parents){var f=this._resource.Parents.slice(0),b,e;f&&(f=f.slice(0),"reverse"===c&&(f=f.reverse().slice(0)),
f.forEach(function(d){d.skip||(g?(e=g,g=null):e=d.Name,b=this.buildSegment(e),this.path+=d.Name,this.addSegmentHref(b,d),b.include=!1,this.segments.push(b))}.bind(this)))}},addDivider:function(){var g=document.createElement("span");g.appendChild(document.createTextNode(" / "));this.path+="/";g.classList.add("breadcrumbSeparator");this.append(g)},refresh:function(){(this.crumbs=n.node(this._id))?n.empty(this.crumbs):(this.crumbs=document.createElement("span"),this.crumbs.id=this._id,this._container.appendChild(this.crumbs),
this.dirty=document.createElement("span"),this.dirty.id="dirty",this.dirty.className="modifiedFileMarker",this._container.appendChild(this.dirty));this.crumbs.style.width="auto";this.crumbs.style.visibility="visible";this.crumbs.parentNode.className="currentLocation";this.crumbs.parentNode.style.width="auto"},append:function(g){this.crumbs.appendChild(g)},addTitle:function(g,c){var f=c||document.title;0===this.crumbs.childNodes.length&&(g=document.createElement("span"),g.appendChild(document.createTextNode(f)),
g.classList.add("breadcrumb"),g.classList.add("currentLocation"),this.append(g))},finalSegment:function(g,c){if(!this._resource.skip){var f;f=c?c:this._resource.Name;this._makeFinalHref?(g=this.buildSegment(f),this.addSegmentHref(g,this._resource)):(g=document.createElement("span"),g.appendChild(document.createTextNode(f)));g.classList.add("currentLocation");this.path+=this._resource.Name;this.append(g)}},firstSegment:function(g){g&&(this.append(g),this._resource&&this._resource.Parents&&!this._resource.skip?
(g.classList.add("breadcrumb"),this.addDivider()):(this._resource.skip||(g.href=""),g.classList.add("currentLocation")))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(g){!0===g.include&&(this.append(g),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var g=this.segments.slice(0).reverse();g.forEach(function(c){this.append(c);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?c.include=
!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=g.reverse()}},measure:function(){var g=this._container;g.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:g.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var g=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;c?this.addTitle(g,c):(this.finalSegment(g,c),this._resource&&this._resource.Parents&&(this.buildSegments(c,"reverse"),this.measureSegments(),this.firstSegment(g)),
this.crumbs.offsetWidth>=this.MAX_LENGTH&&(this.INCLUDE_FIRST_SECTION=!1))},render:function(){this.refresh();var g=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;c?this.addTitle(g,c):(!0===this.INCLUDE_FIRST_SECTION&&this.firstSegment(g),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(g,c)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};l.prototype.constructor=l;return{BreadCrumbs:l}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(k,n,l){function g(c){n.attach(this);this._init(c)}g.prototype={_init:function(c){this._tracking=null;this._animationDelay=501;this._closeReversely=c.closeReversely;this.$node=l.node(c.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=l.node(c.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=l.node(c.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=c.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");c.toggle&&(this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),this._thumb.classList.add("splitThumb"),this._thumb.classList.add(this._vertical?"splitVerticalThumbLayout":"splitThumbLayout"));this._closeByDefault="closed"===this.$node.getAttribute("data-initial-state");"undefined"!==typeof c.closeByDefault&&(this._closeByDefault=c.closeByDefault);this._initializeFromStoredSettings();
this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition();this.$node.style.visibility="visible";this.$mainNode.style.display="block";this.$sideNode.style.display="block";this.$node.addEventListener("mousedown",this._mouseDown.bind(this),!1);window.addEventListener("mouseup",this._mouseUp.bind(this),!1);window.addEventListener("resize",this._resize.bind(this),!1)},isClosed:function(){return this._closed},toggleSidePanel:function(){this._thumbDown()},openSidePanel:function(){this._closed||
this._thumbDown()},addResizeListener:function(c){this.addEventListener("resize",function(f){c(f.node)})},_initializeFromStoredSettings:function(){var c=localStorage.getItem(this._prefix+"/toggleState");this._closed="string"===typeof c?"closed"===c:this._closeByDefault;var c=l.bounds(this.$node.parentNode),f=l.bounds(this.$node),b;this._vertical?(b=localStorage.getItem(this._prefix+"/yPosition"))?(this._splitTop=parseInt(b,10),this._splitTop>c.top+c.height-f.height&&(this._splitTop=c.top+c.height/
2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitTop=0):(b=localStorage.getItem(this._prefix+"/xPosition"))?(this._splitLeft=parseInt(b,10),this._splitLeft>c.left+c.width-f.width&&(this._splitLeft=c.left+c.width/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitLeft=0)},_getSplitPosition:function(){var c=l.bounds(this.$node),f=l.bounds(this.$node.parentNode);return this.vertical?c.top-f.top:c.left-f.left},_adjustToSplitPosition:function(c){var f=
l.bounds(this.$node),b=l.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=f.height;if(c||!this._splitTop)this._splitTop=f.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);c=this._splitTop;"relative"===this.$node.parentNode.style.position&&(c=this._splitTop-b.top);this.$sideNode.style.height=c+"px";this.$sideNode.style.display="block";this.$node.style.top=c+"px"}else{this._splitWidth=f.width;if(c||!this._splitLeft)this._splitLeft=f.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);c=this._splitLeft;"relative"===this.$node.parentNode.style.position&&(c=this._splitLeft-b.left);this.$sideNode.style.width=c+"px";this.$sideNode.style.display="block";this.$node.style.left=c+"px"}this._resize()},_resize:function(c,f,b){c=c||0;var e=l.bounds(this.$node.parentNode),d=l.bounds(this.$node);this._vertical?(void 0===b&&(b=d.top-e.top),b+=d.height,this.$mainNode.style.top=b+"px"):(void 0===f&&(f=d.left-e.left),f+=d.width,this.$mainNode.style.left=f+"px");var g=
this;window.setTimeout(function(){g._notifyResizeListeners(g.$mainNode);g._notifyResizeListeners(g.$sideNode)},c)},_notifyResizeListeners:function(c){this.dispatchEvent({type:"resize",node:c})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(c,f){c||this._addAnimation();var b=this._splitTop,e=this._splitLeft;if(this._closed)this._closed=!1,!this._splitLeft&&!this._splitTop&&"number"===typeof this._initialSplit&&(b=e=this._initialSplit);
else if(this._closed=!0,this._closeReversely){var d=l.bounds(this.$node.parentNode),g=l.bounds(this.$node);this._vertical?b=d.height-g.height:e=d.width-g.width}else b=e=0;this._vertical?(this.$sideNode.style.height=b+"px",this.$node.style.top=b+"px"):(this.$sideNode.style.width=e+"px",this.$node.style.left=e+"px");this._resize(this._animationDelay,e,b);c||this._removeAnimation();f||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var a=this;window.setTimeout(function(){a._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var c=this;window.setTimeout(function(){c.$sideNode.classList.remove(c._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");c.$mainNode.classList.remove(c._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");c.$node.classList.remove(c._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add(this._vertical?"sidePanelVerticalLayoutAnimation":
"sidePanelLayoutAnimation");this.$mainNode.classList.add(this._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");this.$node.classList.add(this._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},_mouseDown:function(c){if(c.target===this._thumb)return l.stop(c),this._thumbDown();this._tracking||(this.$node.classList.add("splitTracking"),this.$mainNode.classList.add("panelTracking"),this.$sideNode.classList.add("panelTracking"),this._tracking=this._mouseMove.bind(this),
window.addEventListener("mousemove",this._tracking),l.setFramesEnabled(!1),l.stop(c))},_mouseMove:function(c){if(this._tracking){var f=l.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=c.clientY;this._splitTop<f.top+5?this._splitTop=f.top+5:this._splitTop>f.top+f.height-5&&(this._splitTop=f.top+f.height-5);var b=this._splitTop,b=this._splitTop-f.top;this.$node.style.top=b+"px"}else this._splitLeft=c.clientX,this._splitLeft<f.left+5?this._splitLeft=f.left+5:this._splitLeft>f.left+f.width-
5&&(this._splitLeft=f.left+f.width-5),b=this._splitLeft-2*f.left,this.$node.style.left=b+"px";this._adjustToSplitPosition(!0);l.stop(c)}},_mouseUp:function(c){this._tracking&&(l.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),this.$sideNode.classList.remove("panelTracking"),l.stop(c))}};g.prototype.constructor=g;return{Splitter:g}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(k,n,l){function g(c){this.commandRegistry=c.commandRegistry;this.create();this._filterString="";this._providers=[]}g.prototype={addProvider:function(c){this._providers.push(c)},create:function(){var c=this._keyAssistDiv=document.createElement("div");c.id="keyAssist";c.style.display="none";c.classList.add("keyAssistFloat");c.setAttribute("role","menu");var f=this._keyAssistInput=document.createElement("input");
f.classList.add("keyAssistInput");f.type="text";f.placeholder=k["Filter bindings"];c.appendChild(f);var b=this._keyAssistContents=document.createElement("div");b.classList.add("keyAssistContents");if(l.isIOS||l.isAndroid)b.style.overflowY="auto";c.appendChild(b);var e=this._keyAssistTable=document.createElement("table");e.tabIndex=0;e.classList.add("keyAssistList");b.appendChild(e);document.body.appendChild(c);f.addEventListener("keydown",function(b){this._keyDown(b)}.bind(this));e.addEventListener("keydown",
function(b){this._keyDown(b)}.bind(this));f.addEventListener("input",function(b){this.filterChanged()}.bind(this));b.addEventListener(l.isFirefox?"DOMMouseScroll":"mousewheel",function(b){this._scrollWheel(b)}.bind(this));document.addEventListener("keydown",function(b){b.keyCode===n.KEY.ESCAPE&&this.hide()}.bind(this));n.addAutoDismiss([c],function(){this.hide()}.bind(this))},createContents:function(){n.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var c=this._idCount=
this._keyAssistContents.scrollTop=0;c<this._providers.length;c++)this._providers[c].showKeyBindings(this);this.createHeader(k.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(c,f,b){if(this._filterString){var e=this._filterString.toLowerCase(),d;e!==this._filterString?(e=this._filterString,d=function(a){return a}):d=function(a){return a.toLowerCase()};if(-1===d(f).indexOf(e)&&-1===d(c).indexOf(e)&&-1===d(this._lastHeader).indexOf(e))return}var g=this._keyAssistTable.insertRow(-1);
g.id="keyAssist-keyBinding-"+this._idCount++;g.setAttribute("role","menuitem");g._execute=b;g.classList.add("keyAssistItem");g.addEventListener("click",function(a){this._selectedRow=g;this.execute();a.preventDefault()}.bind(this));b=g.insertCell(-1);b.classList.add("keyAssistName");b.appendChild(document.createTextNode(f));b=g.insertCell(-1);b.classList.add("keyAssistAccel");b.appendChild(document.createTextNode(c))},createHeader:function(c){this._lastHeader=c;var f=this._keyAssistTable.insertRow(-1);
f.classList.add("keyAssistSection");var f=f.insertCell(-1),b=document.createElement("h2");b.appendChild(document.createTextNode(c));f.appendChild(b)},execute:function(){window.setTimeout(function(){this.hide();var c=this._selectedRow;this._selectedRow=null;c&&c._execute&&c._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var c=this._keyAssistInput.value;this._filterString!==c&&(this._filterString=
c,this.createContents())}.bind(this),100)},hide:function(){if(this.isVisible()){var c=document.activeElement,f=this._keyAssistDiv,c=f===c||0!==(f.compareDocumentPosition(c)&16);f.style.display="none";c&&1!==document.compareDocumentPosition(this._previousActiveElement)&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return"block"===this._keyAssistDiv.style.display},removeProvider:function(c){c=this._providers.indexOf(c);-1!==c&&this._providers.splice(c,
1)},select:function(c){var f=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(0===f.length)this._selectedIndex=-1;else{var b=this._selectedIndex,b=(b+(c?1:-1))%f.length;0>b&&(b=f.length-1);-1!==this._selectedIndex&&(c=f[this._selectedIndex],c.classList.remove("selected"),this._selectedRow=null);this._selectedIndex=b;if(-1!==this._selectedIndex){this._selectedRow=c=f[this._selectedIndex];c.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",c.id);this._keyAssistTable.focus();
var f=c.getBoundingClientRect(),e=this._keyAssistContents,d=e.getBoundingClientRect();c.offsetTop<e.scrollTop?0===b?e.scrollTop=0:c.scrollIntoView(!0):f.bottom>d.bottom&&c.scrollIntoView(!1)}}},show:function(){this.isVisible()||(this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(0.75*this._keyAssistDiv.parentNode.clientHeight)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),
this._keyAssistInput.select())},_keyDown:function(c){if(40===c.keyCode)this.select(!0);else if(38===c.keyCode)this.select(!1);else if(13===c.keyCode)this.execute();else return;c.preventDefault()},_scrollWheel:function(c){var f=0,f=l.isIE||l.isOpera?-c.wheelDelta:l.isFirefox?40*c.detail:-c.wheelDeltaY,b=this._keyAssistContents,e=b.scrollTop;b.scrollTop+=f;if(e!==b.scrollTop)return c.preventDefault&&c.preventDefault(),!1}};return{KeyAssistPanel:g}});
define("orion/widgets/themes/ThemePreferences",[],function(){function k(k,l){this._preferences=k;this._themeData=l;var g=l.getThemeStorageInfo();this._themeVersion=g.version;var c=k.listenForChangedSettings(g.storage,2,function(f){f.key===c&&this.apply()}.bind(this))}k.prototype={_initialize:function(k,l,g){var c,f;void 0===this._themeVersion||g.get("version")===this._themeVersion?(c=g.get(k.styleset),(f=g.get("selected"))&&(f=JSON.parse(f))):f=c=null;c||(c=l.getStyles(),g.put(k.styleset,JSON.stringify(c)));
if(!f||void 0===f[k.selectedKey])f=f||{},f[k.selectedKey]=k.defaultTheme,g.put("selected",JSON.stringify(f));g.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(k){var l=this._themeData,g=l.getThemeStorageInfo();this._preferences.getPreferences(g.storage,2).then(function(c){this._initialize(g,l,c);var f=JSON.parse(c.get("selected"));c=JSON.parse(c.get(g.styleset));var b;if(c)for(var e=0;e<c.length;e++)if(c[e].name===f[g.selectedKey]){b=c[e];break}k({style:b,styles:c})}.bind(this))},
setTheme:function(k,l){var g=this._themeData,c=g.getThemeStorageInfo();this._preferences.getPreferences(c.storage,2).then(function(f){this._initialize(c,g,f);var b=JSON.parse(f.get("selected"));k||(k=b[c.selectedKey]);b[c.selectedKey]=k;f.put("selected",JSON.stringify(b));l?f.put(c.styleset,JSON.stringify(l)):l=JSON.parse(f.get(c.styleset));for(var e=0;e<l.length;e++)if(l[e].name===b[c.selectedKey]){g.processSettings(l[e]);break}f.put("version",this._themeVersion)}.bind(this))},setFontSize:function(k){var l=
this._themeData,g=l.getThemeStorageInfo();this._preferences.getPreferences(g.storage,2).then(function(c){this._initialize(g,l,c);var f=JSON.parse(c.get("selected")),b=JSON.parse(c.get(g.styleset)),e;if(b)for(var d=0;d<b.length;d++)b[d].fontSize=k,b[d].name===f[g.selectedKey]&&(e=b[d]);c.put(g.styleset,JSON.stringify(b));l.processSettings(e)}.bind(this))}};return{ThemePreferences:k}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
"Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value","JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item",
"Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",
EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",
smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",
scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair \x3cAngle\x3e Brackets",
autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated","Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:",
"Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color","Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute",
"Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute","CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: "});
define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/editor/eventTarget",[],function(){function k(){}k.addMixin=function(n){var l=k.prototype,g;for(g in l)l.hasOwnProperty(g)&&(n[g]=l[g])};k.prototype={addEventListener:function(k,l,g){this._eventTypes||(this._eventTypes={});var c=this._eventTypes[k];c||(c=this._eventTypes[k]={level:0,listeners:[]});c.listeners.push({listener:l,useCapture:g})},dispatchEvent:function(k){var l=k.type;this._dispatchEvent("pre"+l,k);this._dispatchEvent(l,k);this._dispatchEvent("post"+l,k)},_dispatchEvent:function(k,
l){var g=this._eventTypes?this._eventTypes[k]:null;if(g){var c=g.listeners;try{if(g.level++,c)for(var f=0,b=c.length;f<b;f++)if(c[f]){var e=c[f].listener;"function"===typeof e?e.call(this,l):e.handleEvent&&"function"===typeof e.handleEvent&&e.handleEvent(l)}}finally{if(g.level--,g.compact&&0===g.level){for(f=c.length-1;0<=f;f--)c[f]||c.splice(f,1);0===c.length&&delete this._eventTypes[k];g.compact=!1}}}},isListening:function(k){return!this._eventTypes?!1:void 0!==this._eventTypes[k]},removeEventListener:function(k,
l,g){if(this._eventTypes){var c=this._eventTypes[k];if(c){for(var f=c.listeners,b=0,e=f.length;b<e;b++){var d=f[b];if(d&&d.listener===l&&d.useCapture===g){0!==c.level?(f[b]=null,c.compact=!0):f.splice(b,1);break}}0===f.length&&delete this._eventTypes[k]}}}};return{EventTarget:k}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(k,n,l){function g(c){c=c||{};this._document=c.document||document}var c={};g.getTheme=function(f){f=f||"default";var b=c[f];b||(b=c[f]=new g);return b};g.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(c,b){var e=this,d=e._themeClass;e._themeClass=c;this._load(c,b,function(){e.onThemeChanged({type:"ThemeChanged",oldValue:d,newValue:e.getThemeClass()})})},onThemeChanged:function(c){return this.dispatchEvent(c)},
buildStyleSheet:function(c,b){function e(b,a,h){a&&(d.push("."+c+" ."+b+" {"),d.push("\t"+(h?"background-color":"color")+": "+a+";"),d.push("}"))}var d=[];d.push("");d.push("."+c+" {");b.fontFamily&&d.push("\tfont-family: "+b.fontFamily+";");b.fontSize&&d.push("\tfont-size: "+b.fontSize+";");b.fontSize&&d.push("\tcolor: "+b.text+";");d.push("}");d.push("."+c+".textview {");b.background&&d.push("\tbackground-color: "+b.background+";");d.push("}");e("ruler.annotations",b.annotationRuler,!0);e("ruler.lines",
b.annotationRuler,!0);e("ruler.folding",b.annotationRuler,!0);e("ruler.overview",b.overviewRuler,!0);e("rulerLines",b.lineNumber,!1);e("rulerLines.even",b.lineNumberEven,!1);e("rulerLines.odd",b.lineNumberOdd,!1);e("annotationLine.currentLine",b.currentLine,!0);e("entity-name-tag",b.keyword,!1);e("entity-other-attribute-name",b.attribute,!1);e("string-quoted",b.string,!1);e("meta.annotation.currentLine",b.currentLine,!0);e("keyword",b.keyword,!1);e("string",b.string,!1);e("comment",b.comment,!1);
e("comment.block.documentation",b.comment,!1);e("keyword.other.documentation.markup",b.comment,!1);return d.join("\n")},_createStyle:function(c,b,e,d){var g=this._document;c="orion-theme-"+c;var a=g.getElementById(c);if(a){if(d||a.firstChild.data===b)return;a.removeChild(a.firstChild);a.appendChild(g.createTextNode(b))}else d?(a=l.createElement(g,"link"),a.rel="stylesheet",a.type="text/css",a.href=b,a.addEventListener("load",function(){e()})):(a=l.createElement(g,"style"),a.appendChild(g.createTextNode(b))),
a.id=c,(g.getElementsByTagName("head")[0]||g.documentElement).appendChild(a);d||e()},_load:function(c,b,e){if(c)if("string"===typeof b)this._createStyle(c,b,e);else if(b=b.href,".css"!==b.substring(b.length-4)&&(b+=".css"),/^\//.test(b)||/[a-zA-Z0-9]+:\/\//i.test(b)||!k.toUrl)this._createStyle(c,b,e,!0);else{var d=this;k(["text!"+b],function(b){d._createStyle(c,b,e,!1)})}else e()}};n.EventTarget.addMixin(g.prototype);return{TextTheme:g}});
define("orion/widgets/themes/ThemeClass",[],function(){function k(k){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=k;this.classString="."+k+"{ "}k.prototype.className=null;k.prototype.classString=void 0;k.prototype.style=void 0;k.prototype.closeString=" }\n";k.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:k}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(k){function n(){}n.prototype.navbar="white";n.prototype.button="#777777";n.prototype.location="#EFEFEF";n.prototype.selection="#cedce7";n.prototype.sidepanel="#F7F7F7";n.prototype.mainpanel="white";n.prototype.navtext="#bfbfbf";n.prototype.content="#3087B3";n.prototype.search="#444";n.prototype.toolpanel="white";n.prototype.writeNavigationStyle=function(){var l="",g=[],c=new k.ThemeClass("orionPage");
c.style.backgroundColor="#fdfdfd";c.style.width="100%";c.style.height="100%";g.push(c);c=new k.ThemeClass("topRowBanner");c.style.margin="0";c.style.border="0";c.style.backgroundColor=this.navbar;c.style.height="16px";c.style.padding="10px";c.style.paddingLeft="6px";c.style.paddingRight="2px";c.style.borderBottom="none";c.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";c.style.zIndex="100";g.push(c);c=new k.ThemeClass("a");c.style.textDecoration="none";c.style.color=
this.content;g.push(c);c=new k.ThemeClass("navlink");c.style.display="inline-block";c.style.padding="2px";c.style.color=this.content;c.style.verticalAlign="bottom";g.push(c);c=new k.ThemeClass("primaryNav");c.style.color=this.navtext;c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.paddingTop="0";c.style.verticalAlign="baseline";g.push(c);c=new k.ThemeClass("primaryNav a");c.style.fontSize="8pt";c.style.color=this.navtext;c.style.marginRight="6px";c.style.marginLeft="6px";c.style.verticalAlign=
"baseline";c.style.textDecoration="none";g.push(c);c=new k.ThemeClass("primaryNav a:hover");c.style.color="#bfbfbf";c.style.cursor="hand";c.style.color="white";c.style.fontWeight="normal";g.push(c);for(var f in g)l+=g[f].toString();return l};n.prototype.writeLocationStyle=function(){var l="",g=[],c=new k.ThemeClass("titleArea");c.style.margin="0";c.style.paddingTop="5px";c.style.border="0";c.style.background=this.location;c.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";c.style.borderBottom="1px solid "+this.location;c.style.minHeight="20px";g.push(c);c=new k.ThemeClass("breadcrumb");c.style.fontSize="8pt";c.style.textDecoration="none";c.style.color="#f1f1f2;";c.style.paddingTop="2px";g.push(c);c=new k.ThemeClass("a.breadcrumb:hover");c.style.textDecoration="none";c.style.borderBottom="1px dotted";c.style.color="#F58B0F";c.style.cursor="pointer";g.push(c);c=new k.ThemeClass("breadcrumbSeparator");c.style.fontSize=
"8pt";c.style.textDecoration="none";c.style.color=this.separator;c.style.fontWeight="bold";g.push(c);c=new k.ThemeClass("currentLocation");c.style.fontWeight="bold";c.style.fontSize="8pt";c.style.color=this.breadcrumb;c.style.textDecoration="none";c.style.textWrap="normal";c.style.lineHeight="10pt";g.push(c);c=new k.ThemeClass("a.currentLocation:hover");c.style.fontWeight="bold";c.style.fontSize="10pt";c.style.color="#666666";c.style.textDecoration="none";c.style.borderBottom="0";g.push(c);c=new k.ThemeClass("navlinkonpage");
c.style.color=this.content;c.style.verticalAlign="middle";g.push(c);this.bannerProgress&&(c=new k.ThemeClass("topRowBanner .progressPane_running"),c.style.borderColor=this.bannerProgress,g.push(c));for(var f in g)l+=g[f].toString();return l};n.prototype.writeButtonStyle=function(){var l="",g=[],c=new k.ThemeClass("commandButton");c.style.color="#666";c.style.border="1px solid #dedede";c.style.backgroundColor="#ddd";c.style.textAlign="center";c.style.verticalAlign="middle";c.style.cursor="pointer";
c.style.display="inline-block";c.style.padding="4px 6px";c.style.borderRadius="3px";c.style.lineHeight="12px";c.style.fontSize="9pt";c.style.userSelect="none";g.push(c);c=new k.ThemeClass("commandButton:over");c.style.backgroundColor="#e6e6e6";c.style.border="1px solid #808080";g.push(c);c=new k.ThemeClass("commandMenu");c.style.color="#222";c.style.display="inline-block";c.style.verticalAlign="baseline";c.style.margin="0";c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.border="1px solid #dedede";
c.style.backgroundColor="#efefef";c.style.cursor="pointer";c.style.borderRadius="1px";g.push(c);c=new k.ThemeClass("commandMenuItem");c.style.border="0";c.style.padding="0";c.style.margin="0";g.push(c);for(var f in g)l+=g[f].toString();return l};n.prototype.writeMainStyle=function(){var l="",g=[],c=new k.ThemeClass("searchbox");c.style.backgroundImage="url(../images/core_sprites.png)";c.style.backgroundRepeat="no-repeat";c.style.backgroundPosition="4px -297px";c.style.width="12px";c.style.height=
"12px";c.style.backgroundColor=this.search;c.style.border="1px solid "+this.search;c.style.fontSize="11px";c.style.width="15em";c.style.height="16px";c.style.borderRadius="10px";c.style.color="#999";c.style.padding="0";c.style.paddingLeft="20px";c.style.marginLeft="5px";c.style.marginTop="6px !important";c.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";g.push(c);c=new k.ThemeClass("searchbox:focus");c.style.color="white";c.style.outline=
"none";g.push(c);c=new k.ThemeClass("checkedRow");c.style.cssText="background-color:"+this.selection+" !important;";g.push(c);c=new k.ThemeClass("navbar-item-selected");c.style.background=this.selection;c.style.color=this.content;g.push(c);c=new k.ThemeClass("auxpane");c.style.border="0";c.style.background=this.sidepanel;g.push(c);c=new k.ThemeClass("mainpane");c.style.background=this.mainpanel;c.style.border=0;g.push(c);c=new k.ThemeClass("mainToolbar");c.style.background=this.toolpanel;g.push(c);
for(var f in g)l+=g[f].toString();return l};n.prototype.render=function(k){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};n.prototype.getSheet=function(k){k.navbar.value?(this.navbar=k.navbar.value,this.button=k.button.value,this.location=k.location.value,this.selection=k.selection.value,this.sidepanel=k.sidepanel.value,this.mainpanel=k.mainpanel.value,this.navtext=k.navtext.value,this.search=
k.search.value,this.content=k.content.value,this.toolpanel=k.toolpanel.value,this.bannerProgress=k.bannerProgress.value):(this.navbar=k.navbar,this.button=k.button,this.location=k.location,this.selection=k.selection,this.sidepanel=k.sidepanel,this.mainpanel=k.mainpanel,this.navtext=k.navtext,this.search=k.search,this.content=k.content,this.toolpanel=k.toolpanel,this.bannerProgress=k.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:n}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(k,n,l){function g(){}function c(){this.styles=[];var b=new g;b.name="Orion";b.navbar="white";b.button="#EFEFEF";b.location="#efefef";b.selection="FEC";b.sidepanel="#FBFBFB";b.mainpanel="white";b.toolpanel="white";b.navtext="#bfbfbf";b.content="#3087B3";b.search="#444";b.breadcrumb="#3087B3";b.separator="#333";b.bannerProgress="whitesmoke";
this.styles.push(b);b=new g;b.name="Orion2014";b.navbar="white";b.button="#EFEFEF";b.location="#EFEFEF";b.selection="FEC";b.sidepanel="#EEEEEE";b.mainpanel="#EEEEEE";b.toolpanel="#EEEEEE";b.navtext="#BFBFBF";b.content="#333333";b.search="#444444";b.breadcrumb="#333333";b.separator="#333333";b.bannerProgress="orange";this.styles.push(b);b=new g;b.name="Green Zone";b.navbar="seagreen";b.button="lavender";b.location="darkseagreen";b.selection="moccasin";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel=
"white";b.navtext="#FBFBFB";b.content="darkgreen";b.search="darkgreen";b.breadcrumb="#3087B3";b.separator="seagreen";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name="Pretty In Pink";b.navbar="plum";b.button="lavender";b.location="pink";b.selection="lavender";b.sidepanel="seashell";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumorchid";b.search="violet";b.breadcrumb="#3087B3";b.separator="plum";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name=
"Blue Monday";b.navbar="cornflowerblue";b.button="lavender";b.location="skyblue";b.selection="lavender";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="royalblue";b.search="royalblue";b.breadcrumb="#3087B3";b.separator="cornflowerblue";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name="Vanilla Skies";b.navbar="sandybrown";b.button="lemmonchiffon";b.location="cornsilk";b.selection="lemonchiffon";b.sidepanel="white";b.mainpanel="white";b.toolpanel=
"white";b.navtext="lemonchiffon";b.content="chocolate";b.search="moccasin";b.breadcrumb="#3087B3";b.separator="sandybrown";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new g;b.name="Beetlejuice";b.navbar="indigo";b.button="slateblue";b.location="darkslateblue";b.selection="silver";b.sidepanel="lavender";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumslateblue";b.search="#444";b.breadcrumb="#3087B3";b.separator="indigo";b.bannerProgress="#F2F2F2";this.styles.push(b);
b=new g;b.name="Red";b.navbar="#CD2127";b.button="#777777";b.location="#D85F56";b.selection="lightcoral";b.sidepanel="#EFDAB2";b.mainpanel="#FDFADD";b.toolpanel="#FDFADD";b.navtext="#FBFBFB";b.content="darkred";b.search="#D85F56";b.breadcrumb="darkred";b.separator="#CD2127";b.bannerProgress="#F2F2F2";this.styles.push(b)}function f(){return this.styles}g.prototype.name="Orion";g.prototype.navbar="#404648";g.prototype.button="#EFEFEF";g.prototype.location="#333";g.prototype.breadcrumb="#3087B3";g.prototype.separator=
"#333";g.prototype.selection="FEC";g.prototype.sidepanel="#FBFBFB";g.prototype.mainpanel="white";g.prototype.toolpanel="white";g.prototype.navtext="#bfbfbf";g.prototype.content="#3087B3";g.prototype.search="#444";g.prototype.bannerProgress="white";c.prototype.styles=[];c.prototype.getStyles=f;c.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};c.prototype.getViewData=function(){var b={top:10,left:10,
width:350,height:350};b.shapes=[{type:"RECTANGLE",name:k["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:k["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:k["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:k["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",
name:k["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:k.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:k["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:k.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:k.Content,label:"/",x:78,y:60,family:"content",
fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:k.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:k["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:k.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:k["Button Text"],label:"Button",x:158,y:90,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"TRIANGLE",
name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:k["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:k["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:k["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:k["Line Color"],
x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:k["Side Panel"],x:10,y:71,width:140,height:289,family:"sidepanel",fill:"#FBFBFB",order:12},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:k["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},
{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"}];for(var c=0;3>c;c++)b.shapes.push({type:"TEXT",name:k.Content,label:"org.eclipse.orion.content",x:170,y:127+20*c,fill:"#3087B3",family:"content"});for(c=0;3>c;c++)b.shapes.push({type:"TEXT",name:k.Content,label:"Item",x:25,y:115+20*c,fill:"#3087B3",family:"content"});for(c=0;3>c;c++)b.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+20*c,x2:165,y2:124+20*c,x3:160,y3:127+20*c,family:"navbar",fill:"#333"});b.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return b};c.prototype.processSettings=function(b){var c=new l.ThemeSheetWriter;(new n.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",c.getSheet(b))};return{ThemeData:c,getStyles:f}});
define("orion/widgets/nls/root/messages",{"no input":"no input","no output":"no output","Choose a Folder":"Choose a Folder",OK:"OK",Profile:"Profile","Sign out":"Sign out","N/A":"N/A","logged in since ":"logged in since ","Sign in":"Sign in","Authentication required!":"Authentication required!","Name:":"Name:","Plug-ins":"Plug-ins"," \x3cNo available services or timed out, check URL and try reloading\x3e":" \x3cNo available services or timed out, check URL and try reloading\x3e",Properties:"Properties",
" (Service Id: ":" (Service Id: ",Services:"Services","SFTP Transfer":"SFTP Transfer","Remote host:":"Remote host:","Port:":"SFTP Port:","Remote path:":"Remote path:","User name:":"User name:","Password:":"Password:","Start Transfer":"Start Transfer","Location:":"Location:","orion.sftpConnections":"orion.sftpConnections","Drag a file here":"Drag a file here","unzip zips":"Unzip *.zip files","or if you prefer":"(or upload a file using the buttons below)",Upload:"Upload","Browse...":"Browse...","Import a file or zip":"Import a file or zip",
"Missing required argument: searchRenderer":"Missing required argument: searchRenderer","Missing required argument: favService":"Missing required argument: favService","Find File Named":"Find File Named","Type the name of a file to open (? \x3d any character, * \x3d any string):":"Type the name of a file to open (? \x3d any character, * \x3d any string):",Search:"Search","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","\x3c/a\x3e":"\x3c/a\x3e","\x3e":"\x3e","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(k){function n(l,g,c){this.elements=c;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='\x3cheader class\x3d"UAHeader"\x3eDevelop software from within the cloud\x3c/header\x3e';this.elementNode=document.createElement("div");this.switchesContainer=document.createElement("div");this.switches=document.createElement("span");this.radioButtons=[];this.elementNode.className=
"UAContainer-body";this.taskPanel.appendChild(this.elementNode);this.switchesContainer.className="UAContainer-switch-body";this.switches.className="UAContainer-switches";this.switchesContainer.innerHTML="";this.switchesContainer.appendChild(this.switches);this.taskPanel.appendChild(this.switchesContainer);!0===g?(this.container=document.createElement("div"),this.container.className="UAModal",this.container.appendChild(this.taskPanel),this.backdrop=document.createElement("div"),this.backdrop.className=
"UAModalBackground",document.body.appendChild(this.backdrop),document.body.appendChild(this.container),k.addAutoDismiss([this.container],this.destroy.bind(this))):l.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}n.prototype.elementNode=null;n.prototype.switchesContainer=null;n.prototype.switches=null;n.prototype.radioButtons=null;n.prototype.chosenSwitch=
null;n.prototype.addElement=function(k){var g=document.createElement("span");g.className="UAContainer-icon";g.innerHTML='\x3cspan class\x3d"workingSpan"\x3e\x3cimg src\x3d"'+k.image+'" id\x3d"'+k.label+'ImageNode" alt\x3d"'+k.alt+'" height\x3d"64" width\x3d"64"\x3e\x3c/span\x3e\x3cspan class\x3d"UAIcon-label"\x3e\x3cspan class\x3d"UALabel" id\x3d"'+k.label+'LabelNode" \x3e'+k.label+"\x3c/span\x3e\x3c/span\x3e";g.onmouseover=function(){document.getElementById(k.label+"ImageNode").src=k.secondaryImage;
document.getElementById(k.label+"LabelNode").className="UALabel-live";g.className="UAContainer-icon-live"};g.onmouseout=function(){document.getElementById(k.label+"ImageNode").src=k.image;document.getElementById(k.label+"LabelNode").className="UALabel";g.className="UAContainer-icon"};var c=this;g.onclick=function(){c.showMedia(k)};this.elementNode.appendChild(g)};n.prototype.clearElements=function(){this.elementNode.innerHTML=""};n.prototype.showMedia=function(k){this.clearElements();this.addElement(k);
var g=document.createElement("span");g.className="UAContainer-media";g.innerHTML='\x3cdiv\x3e\x3c/div\x3e\x3cdiv\x3e\x3c/div\x3e\x3cspan class\x3d"mediaSpan"\x3e\x3cimg src\x3d"'+k.media+'" alt\x3d"'+k.alt+'" height\x3d"300" width\x3d"400"\x3e\x3c/span\x3e';this.elementNode.appendChild(g);setTimeout(function(){g.style.opacity=1},100);k=document.getElementById(k.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=k.parentNode;k.className="chosenCircle"};n.prototype.createSwitch=
function(k){var g;g=k?k.label+"switch":"indexSwitch";var c=document.createElement("span");c.className="workingSpan";c.innerHTML='\x3cdiv class\x3d"circle" id \x3d"'+g+'"\x3e\x3c/div\x3e';var f=this;c.onclick=k?function(){f.showMedia(k)}:function(){f.initialize();f.chosenSwitch.firstChild.className="circle";f.chosenSwitch=c;f.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(c);return this.radioButtons[this.radioButtons.length]=c};n.prototype.initialize=function(){this.clearElements();
this.elements.forEach(this.addElement.bind(this))};n.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return n});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(k,n,l,g){function c(){}var f=null;c.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'\x3cdiv class\x3d"dialog" role\x3d"dialog"\x3e\x3cdiv class\x3d"dialogTitle"\x3e\x3cspan id\x3d"title" class\x3d"dialogTitleText layoutLeft"\x3e\x3c/span\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" id\x3d"closeDialog"\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv id\x3d"dialogContent" class\x3d"dialogContent layoutBlock"\x3e\x3c/div\x3e\x3cdiv id\x3d"buttons" class\x3d"dialogButtons"\x3e\x3c/div\x3e\x3c/div\x3e',_initialize:function(){var b=
document.body;this.$frameParent=b;this.$$modalExclusions=this.$$modalExclusions||[];var c=document.createRange();c.selectNode(b);c=c.createContextualFragment(this.CONTAINERTEMPLATE);b.appendChild(c);this.$frame=b.lastChild;this.title&&l.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=l.$("#closeDialog",this.$frame);var d=this;this.$close.addEventListener("click",function(b){d.hide()},!1);this.$parent=l.$(".dialogContent",this.$frame);c=document.createRange();c.selectNode(this.$parent);
b=c.createContextualFragment(this.TEMPLATE);this.messages&&l.processTextNodes(b,this.messages);this.$parent.appendChild(b);this.$buttonContainer=l.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(b){b.keyCode===l.KEY.ESCAPE?d.hide():b.keyCode===l.KEY.ENTER&&"function"===typeof d._defaultCallback&&d._defaultCallback()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent);this.modal&&this._makeModal()},
_makeButtons:function(){if(this.$buttonContainer&&Array.isArray(this.buttons)){var b=this;this.buttons.forEach(function(c){var d=g.createButton(c.text,c.callback);c.id&&(d.id=c.id,b["$"+d.id]=d);c.isDefault&&(b._defaultCallback=c.callback,b._defaultButton=d);b.$buttonContainer.appendChild(d)})}},_makeModal:function(b){var c=this;this.$frame.addEventListener("blur",function(a){c.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var b=!l.contains(c.$frame,a.target);if(b)for(var d=0;d<
c.$$modalExclusions.length;d++)if(l.contains(c.$$modalExclusions[d],a.target)){b=!1;break}b&&(window.setTimeout(function(){(c.$lastFocusedElement||c.$parent).focus()},0),l.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);b=this.$frameParent.childNodes;var d=!1;this._addedBackdrop=[];for(var f=0;f<b.length;f++){for(var a=0;a<this.$$modalExclusions.length;a++)if(l.contains(this.$$modalExclusions[a],b[f])){d=
!0;break}!d&&b[f]!==c.$frame&&b[f].classList&&!b[f].classList.contains("tooltipContainer")&&(a=b[f],a.classList.contains("modalBackdrop")||(a.classList.add("modalBackdrop"),this._addedBackdrop.push(a)))}(b=l.lastTabbable(this.$buttonContainer)||l.lastTabbable(this.$parent))&&b.addEventListener("keydown",function(a){if(a.keyCode===l.KEY.TAB){var b=c._getFirstFocusField();b&&b!==a.target&&b.focus();l.stop(a)}},!1)},_addChildDialog:function(b){this.$$modalExclusions.push(b.$frame||b.$parent)},_inModalExclusion:function(b){return this.$$modalExclusions.some(function(c){return b.$frame===
c||b.$parent===c})},_bindElements:function(b){for(var c=0;c<b.childNodes.length;c++){var d=b.childNodes[c];d.id&&(this["$"+d.id]=d);this._bindElements(d)}},hide:function(b){!b&&f===this&&(f=null);"function"===typeof this._beforeHiding&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0));this.$frame.classList.remove("dialogShowing");l.setFramesEnabled(!0);"function"===
typeof this._afterHiding&&this._afterHiding();var c=this;this.keepAlive||window.setTimeout(function(){c.destroy()},0)},show:function(b){if(this.modal)if(f){if(!f._inModalExclusion(this)){this.hide(!0);return}}else f=this;"function"===typeof this._beforeShowing&&this._beforeShowing();l.setFramesEnabled(!1);var c=l.bounds(this.$frame),d=l.bounds(document.documentElement),g;b?(g=l.bounds(b),b=g.top+g.height+4,g=g.left+4,b+c.height>d.height&&(b=Math.max(0,d.height-c.height-4)),g+c.width>d.width&&(g=Math.max(0,
d.width-c.width-4))):(g=Math.max(0,(d.width-c.width)/2),b=Math.max(0,(d.height-c.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=b+"px";this.$frame.style.left=g+"px";this.$frame.classList.add("dialogShowing");"function"===typeof this._afterShowing&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return l.firstTabbable(this.$parent)||this._defaultButton||l.firstTabbable(this.$buttonContainer)||this.$close},
destroy:function(){this.$frame&&(f===this&&(f=null),l.setFramesEnabled(!0),this._addedBackdrop&&0<this._addedBackdrop.length&&this._addedBackdrop.forEach(function(b){b.classList.remove("modalBackdrop")}),this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0),this.$frameParent.removeChild(this.$frame),this.$parent=this.$frame=void 0)}};c.prototype.constructor=c;return{Dialog:c}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages require orion/webui/littlelib orion/PageLinks orion/widgets/userAssistance/UATaskPanel orion/webui/dialog orion/webui/dropdown".split(" "),function(k,n,l,g,c,f,b){function e(b){this._displaySignOut=!0;this._init(b)}e.prototype={_init:function(b){this._dropdownNode=l.node(b.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=b.dropdown;this._serviceRegistry=b.serviceRegistry;this.authenticatedServices=
{};this.unauthenticatedServices={};this._noSeparator=b.noSeparator;this._dropDownItemClass=b.dropDownItemClass;this._keyAssistClass=b.keyAssistClass;void 0!==b.signOut&&(this._displaySignOut=b.signOut)},isSingleService:function(){return 1===this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},hasServices:function(){return 0<this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},length:function(b){var c=0,a;for(a in b)b.hasOwnProperty(a)&&c++;
return c},_makeMenuItem:function(d,c){var a=b.createMenuItem(d).firstElementChild;"string"===typeof this._dropDownItemClass&&""!==this._dropDownItemClass&&a.classList.add(this._dropDownItemClass);a.addEventListener("click",c,!1);a.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&c()},!1);return a},_renderAuthenticatedService:function(b,c){var a=this,h=this.authenticatedServices[b].authService;if(h&&h.logout&&this._displaySignOut){var e=this._makeMenuItem(k["Sign Out"],
function(){h.logout().then(function(){a.addUserItem(b,h,a.authenticatedServices[b].label);localStorage.removeItem(b);localStorage.removeItem("lastLogin");for(var c=localStorage.length-1;0<=c;c--){var e=localStorage.key(c);e&&0===e.indexOf("/orion/preferences/user")&&localStorage.removeItem(e)}h.getAuthForm(window.location.href).then(function(a){window.location=a})})});this._dropdownNode.appendChild(e.parentNode)}},renderServices:function(){function d(b){a[b]||(a[b]=c.createDocumentFragment());return a[b]}
var c=document,a=[],h=this._serviceRegistry;g.getPageLinksInfo(h,"orion.page.link.user").then(function(e){this._dropdown?this._dropdown.empty():this._dropdownNode&&l.empty(this._dropdownNode);e.getAllLinks().forEach(function(a){var b,h;if(a.category&&(h=/user\.(\d+)/.exec(a.category)))b=parseInt(h[1],10);if("number"!==typeof b||isNaN(b))b=1;b=d(b);h=c.createElement("li");var e=c.createElement("a");e.role="menuitem";"string"===typeof this._dropDownItemClass?""!==this._dropDownItemClass&&e.classList.add(this._dropDownItemClass):
e.classList.add("dropdownMenuItem");e.href=a.href;e.textContent=a.textContent;h.appendChild(e);b.appendChild(h);e.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&e.click()},!1)}.bind(this));this.keyAssistFunction&&(e=this._makeMenuItem(k["Keyboard Shortcuts"],this.keyAssistFunction),"string"===typeof this._keyAssistClass?""!==this._keyAssistClass&&e.classList.add(this._keyAssistClass):e.classList.add("key-assist-menuitem"),e=e.parentNode,d(0).appendChild(e));
if(e=h.getServiceReferences("orion.page.getstarted")[0])e=e.getProperty("data"),e=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,e)).parentNode,d(0).appendChild(e);var f=this;a.sort(function(a,b){return a-b}).forEach(function(d,c){if(c<a.length-1&&!this._noSeparator){var h=b.createSeparator();d.appendChild(h)}f._dropdownNode.appendChild(d)}.bind(this));if(this.isSingleService())for(var g in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(g)&&this._renderAuthenticatedService(g,
0)}.bind(this))},getStartedDialog:function(b){new c(null,!0,b)},setKeyAssist:function(b){this.keyAssistFunction=b;this.renderServices()},addUserItem:function(b,c,a,h){h?(this.unauthenticatedServices[b]&&delete this.unauthenticatedServices[b],this.authenticatedServices[b]={authService:c,label:a,data:h}):(this.authenticatedServices[b]&&delete this.authenticatedServices[b],this.unauthenticatedServices[b]=this.unauthenticatedServices[b]?{authService:c,label:a,pending:this.unauthenticatedServices[b].pending}:
{authService:c,label:a});this.renderServices()}};e.prototype.constructor=e;return{UserMenu:e}});
define("orion/crawler/nls/root/messages",{"Searching file:":"Searching file:","is not supported in this file system":"is not supported in this file system","${0} files found out of ${1}":"${0} files found out of ${1}","The search term on this location will not use indexed files.":"The search term on this location will not use indexed files.","It will take longer time. Do you want to proceed?":"It will take longer time. Do you want to proceed?","Search cancelled by user":"Search cancelled by user",
Cancel:"Cancel"});define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/searchUtils","i18n!orion/nls/messages require orion/regex orion/commandRegistry orion/PageUtil orion/URITemplate".split(" "),function(k,n,l,g,c,f){function b(b,c,a){var h="";a&&(h="^");if(h=l.parse("/"+h+b.searchStr+"/"))a=h.pattern,h=h.flags,-1===h.indexOf("i")&&!c.caseSensitive&&(h+="i"),b.regExp={pattern:a,flags:h},b.wildCard=!0}var e={ALL_FILE_TYPE:"*.*",doSearch:function(b,c,a,h){if(b){var f=!0;"*"===a&&(a="");""===a&&(f=h&&h.type!==e.ALL_FILE_TYPE);f&&(""!==a&&e.addRecentSearch(c,
a,h?h.regEx:!1),b=b.createSearchParams(a,!1,!1,h),b=e.generateSearchHref(b),window.location=b)}else window.alert(k["Can't search: no search service is available"])},generateSearchHelper:function(d,c){var a=d.keyword,h=a,f={};d.fileType&&d.fileType!==e.ALL_FILE_TYPE&&""===a&&(h="*."+d.fileType);if(d.regEx)f.searchStr=a,b(f,d,c);else{var g=-1<a.indexOf("*"),q=-1<a.indexOf("?");g&&(a=a.split("*").join(".*"));q&&(a=a.split("?").join("."));!g&&!q&&!d.nameSearch?(f.searchStr=d.caseSensitive?a.split("\\").join(""):
a.split("\\").join("").toLowerCase(),f.wildCard=!1):(f.searchStr=d.caseSensitive?a:a.toLowerCase(),b(f,d,c),f.wildCard=!0)}f.searchStrLength=f.searchStr.length;return{params:d,inFileQuery:f,displayedSearchTerm:h}},convertSearchParams:function(b){void 0!==b.rows&&(b.rows=parseInt(b.rows,10));void 0!==b.start&&(b.start=parseInt(b.start,10));"string"===typeof b.regEx&&(b.regEx="true"===b.regEx.toLowerCase());"string"===typeof b.caseSensitive&&(b.caseSensitive="true"===b.caseSensitive.toLowerCase());
"string"===typeof b.nameSearch&&(b.nameSearch="true"===b.nameSearch.toLowerCase())},copySearchParams:function(b,c){var a={},h;for(h in b)if(void 0!==b[h]&&null!==b[h]&&(c||"replace"!==h))a[h]=b[h];return a},generateSearchHref:function(b){var c=n.toUrl("search/search.html");b=e.copySearchParams(b,!0);var a=b.resource;b.resource=void 0;return"undefined"!==typeof b.keyword?(new f(c+"#{,resource,params*}")).expand({resource:a,params:b}):(new f(c+"#{,resource}")).expand({resource:a})},generateFindURLBinding:function(b,
c,a,h,e){b={find:c.searchStr,regEx:c.wildCard?!0:void 0,caseSensitive:b.caseSensitive?!0:void 0,replaceWith:"string"===typeof h?h:void 0,atLine:"number"===typeof a?a:void 0};return e?b:","+(new f("{,params*}")).expand({params:b})},convertFindURLBinding:function(b){"string"===typeof b.regEx&&(b.regEx="true"===b.regEx.toLowerCase());"string"===typeof b.caseSensitive&&(b.caseSensitive="true"===b.caseSensitive.toLowerCase());"string"===typeof b.atLine&&(b.atLine=parseInt(b.atLine,10))},replaceRegEx:function(b,
c,a){return b.replace(RegExp(c.pattern,c.flags),a)},replaceStringLiteral:function(b,c,a){c=l.parse("/"+c+"/gim");return e.replaceRegEx(b,c,a)},searchOnelineLiteral:function(b,c,a){var h;h=0;for(var e=!1,f=[];!(h=c.indexOf(b.searchStr,h),0>h);){f.push({startIndex:h,length:b.searchStrLength});e=!0;if(a)break;h+=b.searchStrLength}return e?f:null},findRegExp:function(b,c,a,h){if(!c)return null;a=a||"";a+=(-1===a.indexOf("g")?"g":"")+(-1===a.indexOf("m")?"m":"");var e=null;return(e=RegExp(c,a).exec(b.substring(h)))&&
{startIndex:e.index+h,length:e[0].length}},searchOnelineRegEx:function(b,c,a){for(var h=0,f=!1,g=[];;)if(h=e.findRegExp(c,b.regExp.pattern,b.regExp.flags,h)){g.push(h);f=!0;if(a)break;h=h.startIndex+h.length}else break;return f?g:null},generateNewContents:function(b,c,a,h,f,g){if(h&&c){b||(a.contents=[]);for(var q=0;q<c.length;q++){for(var k=c[q],l=!1,u=!1,n=[],z,y=0,x=0;x<h.children.length;x++)if(h.children[x].lineNumber-1===q){y=x;for(l=0;l<h.children[x].matches.length;l++)!1!==h.children[x+l].checked&&
n.push(l);u=0<n.length;z=h.children[x].matches;l=!0;break}if(l){if(u){n=e.replaceCheckedMatches(k,f,z,n,g);k=n.replacedStr;for(l=0;l<h.children[y].matches.length;l++)h.children[y+l].newMatches=n.newMatches}else for(l=0;l<h.children[y].matches.length;l++)h.children[y+l].newMatches=h.children[y+l].matches;b?a.contents[q]=k:a.contents.push(k)}else b||a.contents.push(k)}}},generateMatchContext:function(b,c,a){var h=[],e=2*b+1,f;c.length<=e?(f=0,b=c.length-1):(f=a-b,0>f?(f=0,b=f+e-1):(b=a+b,b>c.length-
1&&(b=c.length-1,f=b-e+1)));for(e=f;e<=b;e++)h.push({context:c[e],current:e===a});return h},splitFile:function(b){for(var c=0,a=0,h=0,e=0,f=[];;){-1!==c&&c<=h&&(c=b.indexOf("\r",h));-1!==a&&a<=h&&(a=b.indexOf("\n",h));if(-1===a&&-1===c){f.push(b.substring(e));break}var g=1;-1!==c&&-1!==a?c+1===a?(g=2,h=a+1):h=(c<a?c:a)+1:h=-1!==c?c+1:a+1;f.push(b.substring(e,h-g));e=h}return f},searchWithinFile:function(b,c,a,h,f,g){a=e.splitFile(a);f&&(c.contents=a);if(c){c.children=[];for(var q=h=0;q<a.length;q++){var k=
a[q];if(k&&0<k.length){var l=g?k:k.toLowerCase();if(l=b.wildCard?e.searchOnelineRegEx(b,l):e.searchOnelineLiteral(b,l)){var u,n=q+1;if(f)for(var z=0;z<l.length;z++)u=z+1,u={parent:c,checked:c.checked,type:"detail",matches:l,lineNumber:n,matchNumber:u,name:k,location:c.location+"-"+n+"-"+u},c.children.push(u);else u={parent:c,context:e.generateMatchContext(2,a,q),checked:c.checked,type:"detail",matches:l,lineNumber:n,name:k,location:c.location+"-"+n},c.children.push(u);h+=l.length}}}c.totalMatches=
h}},replaceCheckedMatches:function(b,c,a,h,e){for(var f=0,g="",k=[],l=0;l<a.length;l++){f!==a[l].startIndex&&(g+=b.substring(f,a[l].startIndex));a[l].length&&(e=a[l].length);for(var f=!1,u=0;u<h.length;u++)if(h[u]===l){f=!0;break}f?(k.push({startIndex:g.length,length:c.length}),g+=c):(k.push({startIndex:g.length,length:e}),g+=b.substring(a[l].startIndex,a[l].startIndex+e));f=a[l].startIndex+e}f<b.length&&(g+=b.substring(f));return{replacedStr:g,newMatches:k}},fullPathNameByMeta:function(b){var c=
b.length,a="";if(0<c)for(c-=1;-1<c;c--)a=a+(""===a?"":"/")+b[c].Name;return a},path2FolderName:function(b,c,a){return b.substring(0,b.length-c.length-(a?0:1))},_storeRecentSearch:function(b,c,a,h){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b.put("recentSearch",c);a&&window.setTimeout(function(){a.dispatchEvent({type:"inputDataListChanged",deleting:h})}.bind(this),20)})},addRecentSearch:function(b,c,a){"string"===typeof c&&c&&b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(h){var f;
h=h.get("recentSearch");"string"===typeof h&&(h=JSON.parse(h));if(h){for(f in h)if(h[f].name===c)return;20<=h.length&&h.splice(19,h.length-20+1)}else h=[];h.splice(0,0,{name:c,regEx:a});e._storeRecentSearch(b,h)})},removeRecentSearch:function(b,c,a){"string"===typeof c&&c&&b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(h){var f;h=h.get("recentSearch");"string"===typeof h&&(h=JSON.parse(h));if(h)for(f in h)if(h[f].name===c){h.splice(f,1);e._storeRecentSearch(b,
h,a,!0);break}})},getSearches:function(b,c,a){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get(c);"string"===typeof b&&(b=JSON.parse(b));b&&a&&a(b)})},getMixedSearches:function(b,c,a,h){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){var d=b.get("recentSearch");"string"===typeof d&&(d=JSON.parse(d));c&&(b=b.get("search"),"string"===typeof b&&(b=JSON.parse(b)),b&&b.forEach(function(b){if(a){var c=e.parseQueryStr(b.query);
d.some(function(a){return c.searchStrTitle===a.name})||d.push({name:c.searchStrTitle,label:b.name})}else d.push({name:null,label:b.name,value:b.query})}));d&&h&&h(d)})},getOpenSearchPref:function(b,c){b.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");c(a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?!0:!1:!1)})},setOpenSearchPref:function(b,c){b.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",
{openInNewTab:c})})}};return e});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages require orion/i18nUtil orion/searchUtils orion/contentTypes orion/Deferred".split(" "),function(k,n,l,g,c,f){function b(b,d,c,a){this.registry=b;this.fileClient=d;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=a&&a.searchOnName;this._buildSkeletonOnly=a&&a.buildSkeletonOnly;this._fetchChildrenCallBack=a&&a.fetchChildrenCallBack;this._searchParams=c;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:g.generateSearchHelper(c);this._location=a&&a.location;this._childrenLocation=a&&a.childrenLocation?a.childrenLocation:this._location;this._reportOnCancel=a&&a.reportOnCancel;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}b.prototype.search=function(b){var d=
this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=b;this._cancelled=!1;this._deferredArray=[];d.getContentTypes().then(function(b){this.contentTypesCache=b;var a=this;this._visitRecursively(this._childrenLocation).then(function(){(!a._cancelled||a._reportOnCancel)&&a._reportResult();a._cancelled&&a._HandleStatus({name:"Cancel"})}.bind(a),function(b){a._reportResult();a._HandleStatus(b)}.bind(a))}.bind(this))};b.prototype.searchName=function(b,d){b&&(this._searchParams=
b,this.searchHelper=g.generateSearchHelper(b,!0));d&&(this.onSearchNameComplete=d);var c=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(0<this.fileSkeleton.length){for(var a=0;a<this.fileSkeleton.length;a++){var h=this.fileSkeleton[a].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this.searchHelper.inFileQuery,h,!0):g.searchOnelineLiteral(this.searchHelper.inFileQuery,h,!0))if(c.push(this.fileSkeleton[a]),c.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:c.length,
docs:c}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};b.prototype.buildSkeleton=function(b,d){this._buildingSkeleton=!0;var c=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var a=this;b();c.getContentTypes().then(function(b){a.contentTypesCache=b;a._visitRecursively(a._childrenLocation).then(function(){a._buildingSkeleton=!1;d();a.searchHelper&&!a._buildSkeletonOnly&&a.searchName()})})};b.prototype._sort=function(b){b.sort(function(b,
c){var a,h;if("Path asc"===this._searchParams.sort){a=b.Location&&b.Location.toLowerCase();a=g.path2FolderName(a,b.Name&&b.Name.toLowerCase(),!0);h=c.Location&&c.Location.toLowerCase();h=g.path2FolderName(h,c.Name&&c.Name.toLowerCase(),!0);if(a<h)return-1;if(a>h)return 1}return this._sortOnNameSingle(b,c)}.bind(this))};b.prototype._HandleStatus=function(b){this._statusService&&"Cancel"===b.name&&(console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length),this._statusService.setProgressResult({Message:k["Search cancelled by user"],
Severity:"Warning"}))};b.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})};b.prototype._sortOnNameSingle=function(b,d){var c=b.Name&&b.Name.toLowerCase(),a=d.Name&&d.Name.toLowerCase();return c<a?-1:c>a?1:0};b.prototype._onFileType=function(b){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===g.ALL_FILE_TYPE?!0:0<=b.extension.indexOf(this.searchHelper.params.fileType):
!0};b.prototype._visitRecursively=function(b){var d=[],g=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(b);return(g._progressService?this._progressService.progress(g.fileClient.fetchChildren(b),"Crawling search for children of "+b):g.fileClient.fetchChildren(b)).then(function(a){for(var b=0;b<a.length;b++)if(void 0!==a[b].Directory&&!1===a[b].Directory)if(g._searchOnName)d.push(g._buildSingleSkeleton(a[b]));else if(g._buildSkeletonOnly)d.push(g._buildSingleSkeleton(a[b]));else{if(!g._cancelled){var e=
c.getFilenameContentType(a[b].Name,g.contentTypesCache);if(e&&("text/plain"===e["extends"]||"text/plain"===e.id)&&g._onFileType(e))e=g._sniffSearch(a[b]),d.push(e),g._deferredArray.push(e)}}else if(a[b].Location)if(g._cancelled)break;else e=g._visitRecursively(a[b].ChildrenLocation),d.push(e),g._deferredArray.push(e);return f.all(d)})};b.prototype._hitOnceWithinFile=function(b){b=this._searchParams.caseSensitive?b:b.toLowerCase();return this.searchHelper.inFileQuery.wildCard?g.searchOnelineRegEx(this.searchHelper.inFileQuery,
b,!0):g.searchOnelineLiteral(this.searchHelper.inFileQuery,b,!0)};b.prototype._reportSingleHit=function(b){this._cancelled||(b.LastModified=b.LocalTimeStamp,this.fileLocations.push(b),this._hitCounter++,this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0))};b.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(b){b.cancel()})};b.prototype._sniffSearch=function(b){this._totalCounter++;
var d=this;if(!this._cancelled)if(""===this.searchHelper.params.keyword)this._reportSingleHit(b),this._statusService&&this._statusService.setProgressResult({Message:l.formatMessage(k["${0} files found out of ${1}"],this._hitCounter,this._totalCounter)});else return(d._progressService?d._progressService.progress(d.fileClient.read(b.Location),"Reading file "+b.Location):d.fileClient.read(b.Location)).then(function(c){d._hitOnceWithinFile(c)&&d._reportSingleHit(b);d._statusService&&d._statusService.setProgressResult({Message:l.formatMessage(k["${0} files found out of ${1}"],
d._hitCounter,d._totalCounter)},k.Cancel)},function(b){b&&b.message&&"cancel"!==b.message.toLowerCase()&&console.error("Error loading file content: "+b.message)})};b.prototype._buildSingleSkeleton=function(b){this._totalCounter++;this.fileSkeleton.push(b);this.searchHelper&&!this._buildSkeletonOnly&&0===this._totalCounter%100&&this.searchName();b=new f;b.resolve(this._totalCounter);return b};b.prototype.constructor=b;return{SearchCrawler:b}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages orion/crawler/searchCrawler orion/contentTypes require orion/webui/littlelib orion/util orion/webui/dialog".split(" "),function(k,n,l,g,c,f,b){function e(b){this._init(b)}e.prototype=new b.Dialog;e.prototype.TEMPLATE='\x3cdiv role\x3d"search"\x3e\x3cdiv\x3e\x3clabel id\x3d"fileNameMessage" for\x3d"fileName"\x3e${Type the name of a file to open (? \x3d any character, * \x3d any string):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"fileName" type\x3d"text" class\x3d"setting-control" style\x3d"width:90%;"/\x3e\x3c/div\x3e\x3cdiv id\x3d"progress" style\x3d"padding: 2px 0 0; width: 100%;"\x3e\x3cimg src\x3d"'+
g.toUrl("../../../images/progress_running.gif")+'" class\x3d"progressPane_running_dialog" id\x3d"crawlingProgress"\x3e\x3c/img\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:250px; height:auto; overflow-y:auto;" aria-live\x3d"off"\x3e\x3c/div\x3e\x3cdiv id\x3d"statusbar"\x3e\x3c/div\x3e\x3c/div\x3e';e.prototype._init=function(b){this.title=b.title||k["Find File Named"];this.modal=!0;this.messages=k;this._searcher=b.searcher;this._progress=b.progress;this._onHide=b.onHide;this._contentTypeService=
new l.ContentTypeRegistry(this._searcher.registry);if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=b.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=b.initialText;this._message=b.message;this._nameSearch=!0;void 0!==b.nameSearch&&(this._nameSearch=b.nameSearch);this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(k["Missing required argument: fileService"]);
this._searchRenderer=b.searchRenderer;if(!this._searchRenderer||"function"!==typeof this._searchRenderer.makeRenderFunction)throw Error(k["Missing required argument: searchRenderer"]);this._initialize()};e.prototype._bindToDom=function(b){var e=this;e.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",k["FileName FolderName"]):this.$fileName.setAttribute("placeholder",k.Search);this.$fileName.addEventListener("input",function(a){e._time=+new Date;e._timeoutId&&
clearTimeout(e._timeoutId);e._timeoutId=setTimeout(e.checkSearch.bind(e),0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===c.KEY.ENTER){var b=c.$("a",e.$results);b&&(c.stop(a),(f.isMac?a.metaKey:a.ctrlKey)?window.open(b.href):(window.location.href=b.href,e.hide()))}},!1);b.addEventListener("keydown",function(a){var b,d,f;if(a.keyCode===c.KEY.DOWN||a.keyCode===c.KEY.UP)b=c.$$array("a",e.$results),d=document.activeElement,f=b.indexOf(d),a.keyCode===c.KEY.DOWN?0<=f?(d.classList.remove("treeIterationCursor"),
b=f<b.length-1?b[f+1]:b[0],b.focus(),b.classList.add("treeIterationCursor")):0<b.length&&(b=b[0],b.focus(),b.classList.add("treeIterationCursor")):0<=f?(d.classList.remove("treeIterationCursor"),d=e.$fileName,b=0<f?b[f-1]:d,b.focus(),0<f&&b.classList.add("treeIterationCursor")):0<b.length&&(b[b.length-1].focus(),b[b.length-1].classList.add("treeIterationCursor")),c.stop(a)});b.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(e._forceUseCrawler||!e._fileService.getService(e._searcher.getSearchLocation()).search){var a=
e._searchOnRoot?e._searcher.getSearchRootLocation():e._searcher.getChildrenLocation(),a=new n.SearchCrawler(e._searcher.registry,e._fileService,"",{searchOnName:!0,location:a});e._searcher.setCrawler(a);a.buildSkeleton(function(){e.$crawlingProgress.style.display="inline";e.$progress.appendChild(document.createTextNode(k["Building file skeleton..."]))},function(){e.$crawlingProgress.style.display="none";e.$progress.removeChild(e.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),
this.$fileNameMessage.appendChild(document.createTextNode(this._message)));this._initialText&&(this.$fileName.value=this._initialText,this.doSearch())};e.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var b=(new Date).getTime();b-this._time>this._searchDelay?(this._time=b,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};e.prototype._detectFolderKeyword=function(b){var c,a=b,h=null;if(this._nameSearch&&(c=/(\S+)\s*(.*)/,(b=c.exec(b))&&3===b.length))b[1]&&
(a=b[1]),b[2]&&(h=b[2]);return{keyword:a,folderKeyword:h}};e.prototype.doSearch=function(){var b=this.$fileName.value;if(b){var e=this._detectFolderKeyword(b),a=this._searcher.createSearchParams(e.keyword,this._nameSearch,this._searchOnRoot),h=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=h;var g=document.createElement("div");g.appendChild(document.createTextNode(this._nameSearch?k["Searching..."]:f.formatMessage(k["Searching for occurrences of"],
b)));c.empty(this.$results);this.$results.appendChild(g);this._searcher.search(a,e.folderKeyword,function(){h===this.currentSearch&&h.apply(null,arguments)}.bind(this))}};e.prototype.decorateResult=function(b){function e(b){0===b.button&&!b.ctrlKey&&!b.metaKey&&a.hide()}var a=this;b=c.$$array("a",b);for(var h=0;h<b.length;h++)b[h].addEventListener("click",e,!1)};e.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};e.prototype._afterHiding=function(){this._onHide&&this._onHide()};e.prototype.constructor=
e;return{OpenResourceDialog:e}});define("text!orion/banner/banner.html",[],function(){return'\x3cheader id\x3d"banner" role\x3d"banner"\x3e\n\t\x3c!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\x3e\n\n\t\x3cdiv id\x3d"staticBanner" class\x3d"layoutBlock topRowBanner"\x3e \x3c!-- primaryNav --\x3e\n\t\t\x3cdiv id\x3d"centralNavigationArea" style\x3d"position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"\x3e\x3c/div\x3e\n\n\t\t\x3c!-- Static "Home" link. TODO delete this --\x3e\n\t\t\x3ca id\x3d"home" class\x3d"layoutLeft "\x3e\x3c/a\x3e\n\n\t\t\x3c!-- Left banner component: hamburger --\x3e\n\t\t\x3cnav id\x3d"primaryNav" class\x3d"bannerLeftArea" style\x3d"z-index:2;" role\x3d"navigation"\x3e\n\t\t\t\t\x3cbutton class\x3d"centralNavigation commandSprite core-sprite-hamburger" type\x3d"button"id\x3d"centralNavigation"\x3e\x3c/button\x3e\n\t\t\x3c/nav\x3e\n\n\t\t\x3c!-- Middle banner component: Breadcrumb bar --\x3e\n\t\t\x3cdiv class\x3d"clear navigationBreadcrumb bannerMiddleArea" \x3e\n\t\t\t\x3cdiv id\x3d"location" class\x3d"currentLocation"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\n\t\t\x3c!-- Right banner component: user identity --\x3e\n\t\t\x3cdiv class\x3d"bannerRightArea" style\x3d"z-index:2;"\x3e\n\t\t\t\x3c!-- Global commands support. --\x3e\n\t\t\t\x3cdiv id\x3d"globalActions" class\x3d"spacingLeft layoutLeft"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- Search. TODO delete this --\x3e\n\t\t\t\x3cinput type\x3d"text" id\x3d"search" autocomplete\x3d"off" class\x3d"layoutLeft spacingLeft searchbox" role\x3d"search" style\x3d"display:none;"\x3e\n\t\t\t\x3cdiv id\x3d"searchOptions" class\x3d"layoutLeft" style\x3d"padding-top:1px;display:none;"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- User identity menu and Progress --\x3e\n\t\t\t\x3cdiv id\x3d"userMenu" class\x3d"spacingRight layoutRight" style\x3d"color:#ccc;line-height:16px;"\x3e\n\t\t\t\t\x3cdiv id\x3d"progressPane" class\x3d"progressWatch" tabindex\x3d"0" role\x3d"progressbar"\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchButton" class\x3d"watchButton"\x3e\x3c/div\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchBody" class\x3d"watchBody"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longMinute"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longHour"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\n\t\t\t\t\x3cdiv style\x3d"position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"\x3e\x3c/div\x3e\n\t\t\t\t\x3cspan id\x3d"userTrigger" tabindex\x3d"0" role\x3d"button" class\x3d"dropdownTrigger" style\x3d"z-index:2;"\x3e\n\t\t\t\t\x3c/span\x3e\n\t\t\t\t\x3cul id\x3d"userDropdown" class\x3d"dropdownMenu" role\x3d"menu"\x3e\x3c/ul\x3e\n\t\t\t\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\x3c/div\x3e\n\n\t\x3c!-- IDE notification messages go in here --\x3e\n\t\x3cdiv id\x3d"notificationArea" class\x3d"notificationHide"\x3e\n\t\t\x3cdiv class\x3d"layoutLeft" id\x3d"notifications" aria-live\x3d"assertive" aria-atomic\x3d"true"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"layoutRight"\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" type\x3d"button" id\x3d"closeNotifications"\x3e\x3c/span\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/header\x3e'});
define("text!orion/banner/footer.html",[],function(){return'\x3c!--\n\x3cfooter id\x3d"footerContent" class\x3d"layoutBlock footerLayout" role\x3d"contentinfo"\x3e\n\t\x3cdiv class\x3d"logoFooter commandSprite core-sprite-orion-logo"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"footerBlock"\x3e${Orion is in Beta. Please try it out but BEWARE your data may be lost.}\x3c/div\x3e\n\t\x3cdiv class\x3d"footerRightBlock"\x3e\n\t\t\x3cul\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"https://bugs.eclipse.org/bugs/enter_bug.cgi?product\x3dOrion\x26version\x3d5.0" target\x3d"_blank"\x3e${Report a Bug}\x3c/a\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/privacy.php" target\x3d"_blank"\x3e${Privacy Policy}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/termsofuse.php" target\x3d"_blank"\x3e${Terms of Use}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/copyright.php" target\x3d"_blank"\x3e${Copyright Agent}\x3c/a\x3e\x3c/li\x3e\n\t\t\x3c/ul\x3e\n\t\x3c/div\x3e\n\x3c/footer\x3e\n--\x3e'});
define("text!orion/banner/toolbar.html",[],function(){return'\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"pageActions"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"selectionTools"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"navActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutLeft" style\x3d"padding-left:7px;padding-right:7px;margin-top:2px;" id\x3d"filterBox" style\x3d"visibility: hidden;"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"settingsActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutRight status" id\x3d"statusPane" role\x3d"status" aria-live\x3d"off"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"pageNavigationActions"\x3e\x3c/ul\x3e'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(k,n){function l(g,c,f){if(g=n.node(g))this._parent=g;else throw Error("Parent node of dropdown menu not found");this.options=f=f||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=f.selectionClass;g=document.createElement("div");g.classList.add("dropdownMenu");g.classList.add("dropdownMenuOpen");g.id=this.navDropDownId;g.style.display="none";this._parent.appendChild(g);this._dropdownMenu=
g;if(c=n.node(c))this._triggerNode=c;else throw"Trigger node of dropdown menu not found";"hidden"===this._triggerNode.style.visibility&&(this._triggerNode.style.visibility="visible");f.noClick||(this._triggerNode.onclick=this.click.bind(this));this._dropdownMenu.addEventListener("keydown",function(b){b.keyCode===n.KEY.ESCAPE&&this.clearPanel()}.bind(this))}k.mixin(l.prototype,{click:function(){"none"===this._dropdownMenu.style.display?this.updateContent(this.getContentNode(),function(){n.setFramesEnabled(!1);
this._dropdownMenu.style.display="";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=n.addAutoDismiss([this._triggerNode,this._dropdownMenu],this.clearPanel.bind(this));if(this.options.onShow)this.options.onShow()}.bind(this)):this.clearPanel()},clearPanel:function(){if(this.isVisible()&&(this._dropdownMenu.style.display="none",n.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(g){this._dropdownMenu.innerHTML=g},getContentNode:function(){return this._dropdownMenu},updateContent:function(g,c){c()},_positionDropdown:function(){this._dropdownMenu.style.right="";var g=n.bounds(this._dropdownMenu),c=n.bounds(document.body);g.left+g.width>c.left+c.width&&(g=n.bounds(this._boundingNode(this._triggerNode)),c=n.bounds(this._triggerNode),this._dropdownMenu.style.right=g.width-(c.left-g.left+c.width)+"px")},_boundingNode:function(g){var c=window.getComputedStyle(g,
null);return null===c||"absolute"===c.getPropertyValue("position")||!g.parentNode||g===document.body?g:this._boundingNode(g.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},isVisible:function(){return"none"!==this._dropdownMenu.style.display&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){this._parent&&(n.setFramesEnabled(!0),n.empty(this._parent),this._parent=this.select=null)}});return l});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"Import local file...":"File System","Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}","Pasting ${0}":"Pasting ${0}",
"Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With",
"Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","Copy a file from a URL and optionally unzip it":"Copy a file from a URL and optionally unzip it","Unzip *.zip files:":"Unzip *.zip files:","Extracted from:":"Extracted from:","Did not drop ${0}.  Folder drop is not supported in this browser.":"Did not drop ${0}.  Folder drop is not supported in this browser.",
"You cannot copy files directly into the workspace.  Create a folder first.":"You cannot copy files directly into the workspace.  Create a folder first.","Unzip ${0}?":"Unzip ${0}?",NoFile:"Use the ${0} menu to create new files and folders. Click a file to start coding."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(k,n,l){function g(b,c,d){if(!b[c])throw c+k[" is not supported in this file system"];return b[c].apply(b,d)}function c(b,e,d,f){if(!b.readBlob)throw k["source file service does not support binary read"];if(!d.writeBlob)throw k["target file service does not support binary write"];if("/"!==e[e.length-1])return g(b,"readBlob",[e]).then(function(a){return g(d,"writeBlob",[f,a])});var a=f.substring(0,
f.length-1),h=decodeURIComponent(a.substring(a.lastIndexOf("/")+1)),a=a.substring(0,a.lastIndexOf("/")+1);return g(d,"createFolder",[a,h]).then(function(){},function(){}).then(function(){return g(b,"fetchChildren",[e]).then(function(a){for(var h=[],e=0;e<a.length;++e){var g=a[e].Location,k=g;a[e].Directory&&(k=g.substring(0,g.length-1));k=decodeURIComponent(k.substring(k.lastIndexOf("/")+1));k=f+encodeURIComponent(k);a[e].Directory&&(k+="/");h[e]=c(b,g,d,k)}return n.all(h)})})}function f(b,c){function d(a){var b=
new n;b.reject(k["No Matching FileService for location:"]+a);return b}var f=b.getServiceReferences("orion.core.file"),a=f;if(c)for(var a=[],h=0;h<f.length;++h)c(f[h])&&a.push(f[h]);for(var g=[],t=[],q=[],r=[],v={fetchChildren:function(){var a=new n;a.resolve(r);return a},createWorkspace:function(){var a=new n;a.reject(k["no file service"]);return a},loadWorkspaces:function(){var a=new n;a.reject(k["no file service"]);return a},loadWorkspace:function(a){var b=new n;window.setTimeout(function(){b.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:k["File Servers"],Location:"/",Children:r,ChildrenLocation:"/"})},100);return b},search:d,createProject:d,createFolder:d,createFile:d,deleteFile:d,moveFile:d,copyFile:d,read:d,write:d},f=0;f<a.length;++f)r[f]={Directory:!0,Length:0,LocalTimeStamp:0,Location:a[f].getProperty("top"),ChildrenLocation:a[f].getProperty("top"),Name:a[f].getProperty("Name")},h=a[f].getProperty("pattern")||a[f].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"^"!==h[0]&&(h=
"^"+h),g[f]=RegExp(h),t[f]=b.getService(a[f]),q[f]=a[f].getProperty("Name"),a[f].getProperty("NameKey")&&a[f].getProperty("nls")&&l.getMessageBundle(a[f].getProperty("nls")).then(function(b,d){r[b].Name=d[a[b].getProperty("NameKey")];q[b]=d[a[b].getProperty("NameKey")]}.bind(this,f));this._getServiceIndex=function(a){if("/"===a)return-1;if(!a||a.length&&0===a.length)return t[0]?0:-1;for(var b=0;b<g.length;++b)if(g[b].test(a))return b;throw k["No Matching FileService for location:"]+a;};this._getService=
function(a){a=this._getServiceIndex(a);return-1===a?v:t[a]};this._getServiceName=function(a){a=this._getServiceIndex(a);return-1===a?v.Name:q[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return-1===a?v.Location:r[a].Location}}f.prototype={getService:function(b){return this._getService(b)},fileServiceName:function(b){return this._getServiceName(b)},fileServiceRootURL:function(b){return this._getServiceRootURL(b)},fetchChildren:function(b){return g(this._getService(b),"fetchChildren",
arguments)},createWorkspace:function(b){return g(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return g(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(b){return g(this._getService(b),"loadWorkspace",arguments)},createProject:function(b,c,d,f){return g(this._getService(b),"createProject",arguments)},createFolder:function(b,c){return g(this._getService(b),"createFolder",arguments)},createFile:function(b,c){return g(this._getService(b),"createFile",
arguments)},deleteFile:function(b){return g(this._getService(b),"deleteFile",arguments)},moveFile:function(b,e,d){var f=this._getService(b),a=this._getService(e);if(f===a)return g(f,"moveFile",arguments);var h="/"===b[b.length-1],s=e;"/"!==s[s.length-1]&&(s+="/");if(d)s+=encodeURIComponent(d);else{var t=b;h&&(t=t.substring(0,t.length-1));s+=t.substring(t.lastIndexOf("/")+1)}h&&"/"!==s[s.length-1]&&(s+="/");return c(f,b,a,s).then(function(){return g(f,"deleteFile",[b])})},copyFile:function(b,e,d){var f=
this._getService(b),a=this._getService(e);if(f===a)return g(f,"copyFile",arguments);var h="/"===b[b.length-1],s=e;"/"!==s[s.length-1]&&(s+="/");if(d)s+=encodeURIComponent(d);else{var t=b;h&&(t=t.substring(0,t.length-1));s+=t.substring(t.lastIndexOf("/")+1)}h&&"/"!==s[s.length-1]&&(s+="/");return c(f,b,a,s)},read:function(b,c){return g(this._getService(b),"read",arguments)},readBlob:function(b){return g(this._getService(b),"readBlob",arguments)},write:function(b,c,d){return g(this._getService(b),"write",
arguments)},remoteImport:function(b,c){return g(this._getService(b),"remoteImport",arguments)},remoteExport:function(b,c){return g(this._getService(b),"remoteExport",arguments)},search:function(b){return g(this._getService(b.resource),"search",arguments)}};f.prototype.constructor=f;return{FileClient:f}});
define("orion/webui/SideMenu","orion/commands orion/objects orion/webui/littlelib orion/PageLinks orion/PageUtil orion/URITemplate orion/URL-shim orion/util".split(" "),function(k,n,l,g,c,f,b,e){function d(a,b){this.parentNode=l.node(a);this.contentNode=l.node(b);if(!this.parentNode)throw Error("Missing parentNode");this.menuitems=Object.create(null);this.categories=this.links=null;this.anchor=document.createElement("ul");this.anchor.classList.add("sideMenuList");this.parentNode.appendChild(this.anchor);
this.anchor.addEventListener("click",this._handleEvent.bind(this));this.anchor.addEventListener("touchstart",this._handleEvent.bind(this));this.anchor.addEventListener("focus",this._handleEvent.bind(this),!0);l.addAutoDismiss([this.anchor],this._expandMenu.bind(this,null))}function m(a){return!a.isRelatedLink}function a(a,b){var d=a.order,c=b.order;return d<c?-1:c<d?1:0}function h(a,b){var d=a.source.order,c=b.source.order,d="number"===typeof d?d:100,c="number"===typeof c?c:100;return d===c?a.textContent.localeCompare(b.textContent):
d<c?-1:1}var s=e.isTouch;n.mixin(d.prototype,{LOCAL_STORAGE_NAME:"sideMenuNavigation",OPEN_STATE:"open",CLOSED_STATE:"closed",DEFAULT_STATE:"open",SIDE_MENU_OPEN_WIDTH:"40px",TRANSITION_DURATION_MS:301,addMenuItem:function(a,b,d){var c=this.anchor;a=this.createListItem(a,b);d&&a.classList.add("sideMenuItemActive");c.appendChild(a);this.menuitems[b]=a},setSideMenu:function(){var a=this.getDisplayState(),b=this.parentNode;b&&(a===this.CLOSED_STATE&&(this.setPageContentLeft("0"),this._timeout&&(window.clearTimeout(this._timeout),
this._timeout=null),this._timeout=window.setTimeout(function(){b.style.display="none"},this.TRANSITION_DURATION_MS),b.classList.add("animating")),a===this.OPEN_STATE&&(this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),b.classList.remove("animating"),b.style.display="block",b.style.width=this.SIDE_MENU_OPEN_WIDTH,this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)))},setPageContentLeft:function(a){var b=this.contentNode;b&&(b.style.left=a)},toggleSideMenu:function(){var a=this.getDisplayState(),
b=this.contentNode;b&&b.classList.add("content-fixedHeight-animation");a=a===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;a===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,a);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];l.empty(this.anchor)},getMenuItems:function(){var a=this.menuitems;return Object.keys(a).map(function(b){return a[b]})},getMenuItem:function(a){return this.menuitems[a]},getDisplayState:function(){var a=
localStorage.getItem(this.LOCAL_STORAGE_NAME);a||(a=this.DEFAULT_STATE);return a},createListItem:function(a,b){var d=document.createElement("li");d.className=a;d.classList.add("sideMenuItem");d.categoryId=b;return d},setCategories:function(a){this.categories=a;this.links=Object.create(null)},setPageLinks:function(a){this.pageLinks=a;var b=this,d=a.createLinkElements();a.getAllLinks().forEach(function(a,c){var h=d[c];h.source=a;b._getLinksBin(a.category).push(h)});this._renderLinks()},setRelatedLinks:function(a,
b){this.relatedLinks=a;var d=this;Object.keys(this.links).forEach(function(a){var b=d._getLinksBin(a);d.links[a]=b.filter(m)});var c=document.createDocumentFragment();a.forEach(function(a){var b=a.relatedLink,h=d._getLinksBin(b.category);a=k.createCommandMenuItem(c,a.command,a.invocation);a.classList.remove("dropdownMenuItem");a.isRelatedLink=!0;a.source=b;h.push(a)});this._renderLinks(b)},_getLinksBin:function(a){if(a){var b=this.links;b[a]=b[a]||[];return b[a]}return[]},_sort:function(){var a=this.links;
Object.keys(a).forEach(function(b){a[b].sort(h)})},_renderCategories:function(){var b=this.categories,d=this,h=new URL(window.location.href),e=c.matchResourceParameters();e.OrionHome=g.getOrionHome();var m=!1;this.clearMenuItems();b.getCategoryIDs().map(function(a){return b.getCategory(a)}).sort(a).forEach(function(a){var b=d._getLinksBin(a.id);b.length&&(m?d.addMenuItem(a.imageClass,a.id,!1):(b=b.some(function(a){if(!a.source.uriTemplate)return!1;a=new f(a.source.uriTemplate);a=new URL(a.expand(e),
window.location);return a.protocol===h.protocol&&a.host===h.host&&a.hostname===h.hostname&&a.port===h.port&&a.pathname===h.pathname&&a.search===h.search?m=!0:!1}),d.addMenuItem(a.imageClass,a.id,b)))})},_renderLinks:function(a){a=a||[];this._sort();this._renderCategories();var b=this,d=window.location.href;Object.keys(this.menuitems).forEach(function(c){var h=b.getMenuItem(c);if(h){for(var e=b._getLinksBin(c).slice(),e=e.filter(function(b){var c=b.source;return 0<=a.indexOf(c.id)||!c.default&&!c.force&&
b.href===d?!1:!0}),e=e.filter(function(a){a=a.source;return!(1<e.length&&a.default&&!a.force)}),f=e.length-1;0<f;f--)e[f].href===e[f-1].href&&e.splice(f,1);if(e.length){h.appendChild(b._createCategoryElement(c,h,e[0]));var g=document.createElement("ul");g.className="sideMenuSubMenu";e.forEach(function(a){var b=document.createElement("li");b.className="sideMenuSubMenuItem";var d=document.createElement("a");d.href=a;d.className="sideMenuSubMenuItemLink";var c=document.createElement("span");c.innerHTML=
a.innerHTML;c.className="sideMenuSubMenuItemSpan";d.appendChild(c);b.appendChild(d);g.appendChild(b)});h.appendChild(g)}}})},_createCategoryElement:function(a,b,d){a=this.categories.getCategory(a);var c;s?(c=document.createElement("button"),c.type="button"):(c=document.createElement("a"),c.href=d.href);c.className+=a.imageClass;c.classList.add("submenu-trigger");c.tabIndex="0";b.classList.remove(a.imageClass);return c},_handleEvent:function(a){var b=a.target;a="focus"===a.type;if("A"!==b.tagName||
a)b.classList.contains("submenu-trigger")&&(s||a)&&this._expandMenu(l.$(".sideMenuSubMenu",b.parentNode))},_expandMenu:function(a){this.getMenuItems().forEach(function(b){b=l.$(".sideMenuSubMenu",b);a!==b&&b.classList.remove("expanded")});a&&a.classList.toggle("expanded")}});return d});
define("orion/globalCommands","i18n!orion/nls/messages require orion/commonHTMLFragments orion/keyBinding orion/EventTarget orion/commandRegistry orion/commands orion/parameterCollectors orion/extensionCommands orion/uiUtils orion/keyBinding orion/breadcrumbs orion/webui/littlelib orion/webui/splitter orion/webui/dropdown orion/webui/tooltip orion/contentTypes orion/URITemplate orion/keyAssist orion/PageUtil orion/widgets/themes/ThemePreferences orion/widgets/themes/container/ThemeData orion/Deferred orion/widgets/UserMenu orion/PageLinks orion/webui/dialogs/OpenResourceDialog text!orion/banner/banner.html text!orion/banner/footer.html text!orion/banner/toolbar.html orion/widgets/input/DropDownMenu orion/util orion/customGlobalCommands orion/fileClient orion/webui/SideMenu orion/objects".split(" "),function(k,
n,l,g,c,f,b,e,d,m,a,h,s,t,q,r,v,u,w,z,y,x,p,A,C,B,J,E,G,H,I,K,T,R,O){function M(a,b){if(a.getLabel)return a.getLabel();var d=new p;d.resolve(b.properties.name);return d}function P(a){s.node("progressPane").setAttribute("aria-label",k["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function U(a,b){var d=a.getServiceReferences("orion.core.auth");aa=[];var c=V.createMenuGenerator.apply(this,arguments);if(c)for(var p=0;p<
d.length;p++){var h=d[p],e=a.getService(h);M(e,h).then(function(a){e.getKey().then(function(b){aa.push(b);e.getUser().then(function(d){c.addUserItem(b,e,a,d)},function(d,p){c.addUserItem(b,e,a,p)});window.addEventListener("storage",function(d){L[b]!==localStorage.getItem(b)&&(L[b]=localStorage.getItem(b),e.getUser().then(function(d){c.addUserItem(b,e,a,d)},function(d){c.addUserItem(b,e,a)}))},!1)})})}}function X(a){return a}function W(a,c,h,e,f){function C(){if(t)return t;var b=a.getService("orion.core.contentTypeRegistry");
b||(b=new v.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));return b.getContentTypes().then(function(a){return t=a})}function A(a){for(var b={},d=a.getPropertyKeys(),c,p=0;p<d.length;p++)c=d[p],b[c]=a.getProperty(c);return b}function g(a,b){var d=null;a.some(function(a){return b===a.getProperty("id")?!!(d=a):!1});return d}function q(a){var d=a.command;return!d.visibleWhen||d.visibleWhen(c)?(a.invocation=new b.CommandInvocation(c,c,null,d,e),(new p).resolve(a)):"function"===
typeof f?(B||(B=f()),p.when(B,function(p){if(p&&c===Z&&(!d.visibleWhen||d.visibleWhen(p)))return a.invocation=new b.CommandInvocation(p,p,null,d,e),a})):(new p).resolve()}function m(a,d,c){return c?(new p).resolve({relatedLink:a,command:c}):d.then(function(d){return{relatedLink:a,command:new b.Command(d)}})}var s=arguments,t,B,k=a&&a.getServiceReferences("orion.page.link.related");if(k&&0!==k.length){var l=this;p.when(C(),function(){if(V.beforeGenerateRelatedLinks.apply(l,s)){var b=a.getServiceReferences("orion.navigate.command"),
c=[];k.forEach(function(p){var h=A(p);if(h.id){var f;if((h.nls&&h.nameKey||h.name)&&h.uriTemplate)f=d._createCommandOptions(h,p,a,t,!0),c.push(m(h,f,null));else if(f=g(b,h.id)){var C=A(f);p={};O.mixin(p,C,h);(h=e.findCommand(h.id))?c.push(m(p,null,h)):(f=d._createCommandOptions(C,f,a,t,!0),c.push(m(p,f,null)))}}});p.all(c,X).then(function(a){a.sort(function(a,b){return a.command.name.localeCompare(b.command.name)});return p.all(a.map(q),X).then(function(b){var d=[];b=b.filter(function(b,c){if(b)return!0;
d.push(a[c]);return!1});V.addRelatedLinkCommands.call(l,e,b,d,h);V.afterGenerateRelatedLinks.apply(l,s)})})}})}}function S(a){var b=s.node("globalActions");b&&(a.destroy(b),a.renderCommands(b.id,b,{},{},"tool"))}function Q(a){var b=window.getComputedStyle(a,null);return null===b||"absolute"===b.getPropertyValue("position")||!a.parentNode||a===document.body?a:Q(a.parentNode)}function F(a){var b={},d=null;"string"===typeof a&&(a=s.node(a));a||(a=s.node("pageActions"));for(var c=a;c&&c.classList;){if(c.classList.contains("toolComposite")){d=
c;break}c=c.parentNode}a.classList.contains("commandMarker")&&(b.commandNode=a);d&&(b.slideContainer=s.$(".slideParameters",d),b.parameterArea=s.$(".parameters",d),b.dismissArea=s.$(".parametersDismiss",d),b.notifications=s.$("#notificationArea",d),d.parentNode&&(b.toolbarTarget=s.$(".toolbarTarget",d.parentNode),b.toolbarTarget&&(a=s.bounds(b.toolbarTarget),c=s.bounds(Q(b.toolbarTarget.parentNode)),b.toolbarTargetY=a.top-c.top,b.toolbar=d)));return b}function D(a){if(a=a.slideContainer)if(a.style.left=
"",a.style.top="",a.classList.contains("slideContainerActive")){var b=s.bounds(a),d=s.bounds(a.parentNode);a.style.left=(d.width-b.width)/2+"px";a.style.top="0"}}f=function(a){var b=document.createElement("a");b.href=a;return b.href}(n.toUrl("auth/NotifyAuthentication.html"));var L={},N=null,V={createMenuGenerator:K.createMenuGenerator||function(a,b){if(s.node("userMenu")){var d=s.node("userDropdown"),c=new q.Dropdown({dropdown:d}),d=new A.UserMenu({dropdownNode:d,dropdown:c,serviceRegistry:a}),c=
s.node("userTrigger");new r.Tooltip({node:c,text:k.Options,position:["below","left"]});c=document.getElementById("userTrigger");c.className+=" imageSprite core-sprite-silhouette";d.setKeyAssist(b);return d}},beforeGenerateRelatedLinks:K.beforeGenerateRelatedLinks||function(a,b,d,c,p){return!0},addRelatedLinkCommands:K.addRelatedLinkCommands||function(a,b,d,c){this.sideMenu&&this.sideMenu.setRelatedLinks(b,c)},afterGenerateRelatedLinks:K.afterGenerateRelatedLinks||function(a,b,d,c,p){},afterSetPageTarget:K.afterSetPageTarget||
function(a){},generateNavigationMenu:K.generateNavigationMenu||function(a,b,d,c,p,h,e){if(a=s.node("sideMenu"))b=s.node("centralNavigation"),new r.Tooltip({node:b,text:k.CentralNavTooltip,position:["right"]}),N=this.sideMenu=new R(a,s.node("pageContent")),b.addEventListener("click",N.toggleSideMenu.bind(N)),(a=s.node("sideMenuToggle"))&&a.addEventListener("click",N.toggleSideMenu.bind(N))},afterGenerateNavigationMenu:K.afterGenerateNavigationMenu||function(a,b,d,c,p,h,e){},afterGenerateBanner:K.afterGenerateBanner||
function(a,b,d,c,p,h,e){}},aa=[],Z,da=[],$,fa=null,ea=null,ia=new c;return{generateBanner:function(a,d,c,h,f,A,q,m){function r(a){a.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";for(var b=s.$$array(".targetSelector"),d=0;d<b.length;d++)b[d].target=a}},{pid:"nav.config"})}(new y.ThemePreferences(h,new x.ThemeData)).apply();var v=s.node(a);if(!v)throw k["could not find banner parent, id was "]+a;var u=document.createRange();
u.selectNode(v);u=u.createContextualFragment(J);s.processTextNodes(u,k);v.firstChild?v.insertBefore(u,v.firstChild):v.appendChild(u);v=s.node("home");v.href=n.toUrl("edit/edit.html");v.setAttribute("aria-label",k["Orion Home"]);s.node("progressPane").src=b.NO_IMAGE;if(v=s.node("pageToolbar"))v.classList.add("toolbarLayout"),v.innerHTML=G+l.slideoutHTMLFragment("mainToolbar");(v=s.node("closeNotifications"))&&v.setAttribute("aria-label",k["Close notification"]);if(17>=I.isFirefox&&(v=s.node("staticBanner")))v.style.width=
"100%",v.style.MozBoxSizing="border-box";if(v=s.node("footer"))v.innerHTML=E,s.processTextNodes(v,k);c.setParameterCollector(new e.CommandParameterCollector(F,D));document.addEventListener("keydown",function(a){a.keyCode===s.KEY.ESCAPE&&(a=d.getService("orion.page.message"))&&a.setProgressMessage("")},!1);V.generateNavigationMenu.apply(this,arguments);V.afterGenerateNavigationMenu.apply(this,arguments);v=C.getCategoriesInfo(d);u=C.getPageLinksInfo(d,"orion.page.link");p.all([v,u]).then(function(a){if(N){var b=
a[1];N.setCategories(a[0]);N.setPageLinks(b);N.setSideMenu()}});if(v=s.$(".split")){var u=s.$(".sidePanelLayout"),z=s.$(".mainPanelLayout");u&&z&&(fa={side:u,main:z},fa.splitter=new t.Splitter({node:v,sidePanel:u,mainPanel:z,toggle:!0,closeByDefault:m}),v=new b.Command({name:k["Toggle side panel"],tooltip:k["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){fa.splitter.toggleSidePanel()}}),c.addCommand(v),c.registerCommandContribution("pageActions","orion.toggleSidePane",
1,null,!0,new g.KeyBinding("l",I.isMac?!1:!0,!0,!1,I.isMac?!0:!1)))}var H=!1,K=function(a,b){if(!H){var d=b.getService("orion.page.progress"),c=new B.OpenResourceDialog({searcher:a,progress:d,searchRenderer:a.defaultRenderer,onHide:function(){H=!1}});window.setTimeout(function(){H=!0;c.show()},0)}},v=new b.Command({name:k["Find File Named..."],tooltip:k["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(a){K(f,d)}});c.addCommand(v);c.registerCommandContribution("globalActions",
"orion.openResource",100,null,!0,new g.KeyBinding("f",!0,!0));v=new b.Command({name:k["Toggle banner and footer"],tooltip:k["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var a=s.node("banner"),b=s.node("footer"),d=s.node("sideMenu"),c=s.$(".content-fixedHeight"),p="hidden"===a.style.visibility;p?(a.style.visibility="visible",b.style.visibility="visible",c.classList.remove("content-fixedHeight-maximized"),d&&d.classList.remove("sideMenu-maximized")):(a.style.visibility=
"hidden",b.style.visibility="hidden",c.classList.add("content-fixedHeight-maximized"),d&&d.classList.add("sideMenu-maximized"));ia.dispatchEvent({type:"toggleTrim",maximized:!p});return!0}});c.addCommand(v);c.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new g.KeyBinding("m",!0,!0));v=new b.Command({name:k["System Configuration Details"],tooltip:k["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return n.toUrl("help/about.html")}});c.addCommand(v);
c.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new g.KeyBinding(112,!0,!0));v=new b.Command({name:k["Background Operations"],tooltip:k["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return n.toUrl("operations/list.html")}});c.addCommand(v);c.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new g.KeyBinding("o",!0,!0));ea=new w.KeyAssistPanel({commandRegistry:c});v=new b.Command({name:k["Show Keys"],
tooltip:k["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){ea.isVisible()?ea.hide():ea.show();return!0}});c.addCommand(v);c.registerCommandContribution("globalActions","orion.keyAssist",100,null,!0,new g.KeyBinding(191,!1,!0));S(c);U(d,v.callback);P(d);window.addEventListener("hashchange",function(){c.processURL(window.location.href)},!1);window.setTimeout(function(){r(d)},0);V.afterGenerateBanner.apply(this,arguments)},getToolbarElements:F,getMainSplitter:function(){return fa},
getKeyAssist:function(){return ea},getGlobalEventTarget:function(){return ia},layoutToolbarElements:D,setPageTarget:function(a){var b,d,c=a.breadcrumbRootName,p=a.serviceRegistry;a.target?(a.searchService&&a.searchService.setLocationByMetaData(a.target),a.fileService&&!a.breadcrumbTarget&&!a.staticBreadcrumb&&(d=(c?c+" ":"")+a.fileService.fileServiceName(a.target.Location),c=null),b=a.name||a.target.Name,Z=a.target,W.call(this,p,a.target,da,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||
(c=c||a.task||a.name),b=a.name,W.call(this,p,{NoTarget:""},da,a.commandService,a.makeAlternate));($=a.title)||($=b?b+" - "+a.task:a.task);window.document.title=$;V.afterSetPageTarget.apply(this,arguments);if(b=a.breadCrumbContainer?s.node(a.breadCrumbContainer):s.node("location"))if(s.empty(b),a.staticBreadcrumb)new h.BreadCrumbs({container:b,rootSegmentName:c});else{var e=p&&new T.FileClient(p),p=a.breadcrumbTarget||a.target,e=e&&p&&p.Location?e.fileServiceRootURL(p.Location):null;new h.BreadCrumbs({container:b,
resource:p,rootSegmentName:c,workspaceRootSegmentName:d,workspaceRootURL:e,makeFinalHref:a.makeBreadcrumFinalLink,makeHref:a.makeBreadcrumbLink})}},setDirtyIndicator:function(a){$&&("*"===$.charAt(0)&&!a&&($=$.substring(1)),a&&"*"!==$.charAt(0)&&($="*"+$),window.document.title=$);var b=s.node("dirty");b&&(b.textContent=a?"*":"")},setPageCommandExclusions:function(a){da=a},notifyAuthenticationSite:f}});
define("orion/outliner","i18n!orion/nls/messages orion/Deferred orion/webui/littlelib orion/uiUtils orion/section orion/explorers/explorer orion/commands orion/URITemplate orion/EventTarget orion/i18nUtil orion/edit/editorContext orion/keyBinding orion/globalCommands".split(" "),function(k,n,l,g,c,f,b,e,d,m,a,h,s){function t(a,b,d,c){this.explorer=b;this._init(a);this.title=d;this.selectionService=c}function q(a,b,d){this.registry=a;this.renderer=new t({checkbox:!1,treeTableClass:"outlineExplorer"},
this,d,b)}function r(a,b){this.items=a;this.root={children:a};this.root.outlinerId=b;this.idItemMap={}}function v(a){this._init(a)}function u(a){this._serviceRegistry=a.serviceRegistry;this._preferences=a.preferences;d.attach(this);this._serviceRegistration=this._serviceRegistry.registerService("orion.edit.outline",this);this._outlinePref=this._preferences.getPreferences("/edit/outline");this._provider=new n;this._providerResolved=!1;this.filteredProviders=[]}t.prototype=new f.SelectionRenderer;t.prototype.constructor=
t;t.prototype.getLabelColumnIndex=function(){return 0};t.prototype.getCellElement=function(a,b,d){if(b){var c=document.createElement("span"),p=document.createElement("span");a=document.createElement("span");d.appendChild(c);c.appendChild(p);c.appendChild(a);b.className&&(a.className+=b.className);b.children?this.getExpandImage(d,p):p.classList.add("outlineLeafIndent");d=document.createElement("span");if(b.labelPre||b.classNamePre)c=document.createElement("span"),d.appendChild(c),b.labelPre&&c.appendChild(document.createTextNode(b.labelPre)),
b.classNamePre&&(c.className+=b.classNamePre);b.label&&d.appendChild(document.createTextNode(b.label));if(b.labelPost||b.classNamePost)c=document.createElement("span"),d.appendChild(c),b.labelPost&&c.appendChild(document.createTextNode(b.labelPost)),b.classNamePost&&(c.className+=b.classNamePost);b.href?this._createLink(d,b.href,a):b.line||b.column||b.start?(c=(new e("#{,resource,params*}")).expand({resource:this.title,params:b}),this._createLink(d,c,a),b.outlineLink=c):a.appendChild(d)}};t.prototype._createLink=
function(a,b,d){var c=document.createElement("a");d.appendChild(c);c.classList.add("navlinkonpage");c.appendChild(a);this.selectionService?(c.style.cursor="pointer",c.addEventListener("click",function(a){this._followLink(a,b)}.bind(this),!1)):c.href=b;return c};t.prototype.performRowAction=function(a,b){this._followLink(a,b.outlineLink)};t.prototype._followLink=function(a,b){var d=this.selectionService;d&&(g.openInNewWindow(a)?g.followLink(b,a):d.setSelections(b))};q.prototype=new f.Explorer;q.prototype.constructor=
q;q.prototype.filterChanged=function(a){var b=this.getNavHandler(),d=null;if(a){var c="i",d=a.replace(/([.+^=!:${}()|\[\]\/\\])/g,"\\$1"),d=d.replace(/([*?])/g,".$1");/[A-Z]/.test(d)&&(c="");this._currentModifiedFilter=d=RegExp(d,c);this._previousUnmodifiedFilter?0!==a.indexOf(this._previousUnmodifiedFilter)&&this.expandAll():this.expandAll()}else this.expandAll(),this._currentModifiedFilter=null;b=b.getTopLevelNodes();for(c=0;c<b.length;c++)this._filterRecursively(b[c],d);this._previousUnmodifiedFilter=
a};q.prototype._filterRecursively=function(a,b){var d=this.getNavHandler(),c=this,p=d.getRowDiv(a),h=-1!==a.label.search(b);if(a.children&&d.isExpanded(a)){var e=!1;a.children.forEach(function(a){c._filterRecursively(a,b)&&(e=!0)});e||this.myTree.collapse(a)}var f=!b||e||h;b?(f?p.classList.remove("outlineRowHidden"):p.classList.add("outlineRowHidden"),h?p.classList.add("outlineRowMatchesFilter"):p.classList.remove("outlineRowMatchesFilter"),d.setIsNotSelectable(a,!h)):(p.classList.remove("outlineRowHidden"),
p.classList.remove("outlineRowMatchesFilter"),d.setIsNotSelectable(a,!1));return f};q.prototype.postUserExpand=function(a){this._currentModifiedFilter&&(a=this.getNavDict().getValue(a).model,this._expandRecursively(a),this._filterRecursively(a,this._currentModifiedFilter))};r.prototype.constructor=r;r.prototype.getRoot=function(a){a(this.root)};r.prototype.destroy=function(){};r.prototype.getId=function(a){if(a.outlinerId)return a.outlinerId;for(var b=a.label.replace(/[\\\/\.\:\-\_\s]/g,""),d=b,c=
0;this.idItemMap[d]&&this.idItemMap[d]!==a||l.node(d);)d=b+"["+c+"]",c+=1;this.idItemMap[d]=a;return a.outlinerId=d};r.prototype.getIdItemMap=function(){return this.idItemMap};r.prototype.getChildren=function(a,b){if(a.children){for(var d=0;d<a.children.length;d++)a.children[d].parent=a;b(a.children)}else b([])};r.prototype.doExpansions=function(a){for(var b=0;b<this.root.children.length;b++)this.root.children[b].children&&a.expand(this.root.children[b])};v.prototype={_init:function(a){var b=l.node(a.parent),
d=l.node(a.toolbar);if(!b)throw Error("no parent");if(!a.outlineService)throw Error("no outline service");this._parent=b;this._toolbar=d;this._serviceRegistry=a.serviceRegistry;this._contentTypeRegistry=a.contentTypeRegistry;this._outlineService=a.outlineService;this._commandService=a.commandService;this._selectionService=a.selectionService;this._inputManager=a.inputManager;this._sidebar=a.sidebar;var c=this;this._inputManager.addEventListener("InputChanged",function(a){c.setContentType(a.contentType,
a.location);c._editor!==a.editor&&(c._editor&&c._editor.removeEventListener("InputChanged",c._editorListener),c._editor=a.editor,c._editor&&c._editor.addEventListener("InputChanged",c._editorListener=c.generateOutline.bind(c)))});n.when(c._outlineService,function(a){a.addEventListener("outline",function(a){c.providerId=a.providerId;c._renderOutline(a.outline,a.title)})})},generateOutline:function(){this._isActive()&&(this._providerLookup||this._outlineService.emitOutline(this._inputManager))},setSelectedProvider:function(a){this.providerId=
a.getProperty("id");this.providerName=a.getProperty("name");this._outlineService.setProvider(a)},setOutlineProviders:function(a){var b=this.outlineProviders,d=this._isActive();this.outlineProviders=a;this._updateViewModes(b,this.outlineProviders);d&&this._selectNewProvider()},_renderOutline:function(a,b){var d=this._parent;l.empty(d);if(a=a instanceof Array?a:[a]){var c=new r(a);this.explorer=new q(this._serviceRegistry,this._selectionService,b);this.explorer.createTree(d,c,{selectionPolicy:"cursorOnly",
setFocus:!1});c.doExpansions(this.explorer.myTree)}},_selectNewProvider:function(){var a=this.outlineProviders,b=this,d=b._sidebar;a.every(function(a){return b.providerId!==a.getProperty("id")})&&((a=a[0])?d.setViewMode(this._viewModeId(a)):d.setViewMode(d.defaultViewMode))},_viewModeId:function(a){return"outline."+a.getProperty("id")},_updateViewModes:function(a,d){var c=this;a&&a.forEach(function(a){c._sidebar.removeViewMode(c._viewModeId(a))});d.forEach(function(a){c._sidebar.addViewMode(c._viewModeId(a),
{label:a.displayName||a.getProperty("name")||a.name+a.serviceId||"undefined",create:c.createViewMode.bind(c,a),destroy:c.destroyViewMode.bind(c,a)})});var e=c._sidebar;this._commandService.unregisterCommandContribution(this._toolbar.id,"orion.openOutline",null);if(d&&d[0]){var p=c._viewModeId(d[0]),f=new b.Command({name:"Open Outliner",id:"orion.openOutline",callback:function(){var a=s.getMainSplitter();a.splitter.isClosed()&&a.splitter.toggleSidePanel();e.getActiveViewModeId()!==p&&e.setViewMode(p);
c._filterInput&&(c._previousActiveElement=document.activeElement,c._filterInput.select())}});this._commandService.addCommand(f);this._commandService.registerCommandContribution(this._toolbar.id,"orion.openOutline",1,null,!0,new h.KeyBinding("o",!0));this._commandService.renderCommands(this._toolbar.id,this._toolbar,{},{},"tool")}e.renderViewModeMenu()},_isActive:function(){var a=this._sidebar.getActiveViewModeId();if(!a)return!1;var b=this;return this.outlineProviders&&this.outlineProviders.some(function(d){return a===
b._viewModeId(d)})},createViewMode:function(a){this.setSelectedProvider(a);this._createFilterInput();this.generateOutline()},destroyViewMode:function(a){this.explorer&&(this.explorer.destroy(),this.explorer=null)},_createFilterInput:function(){var a=document.createElement("input");a.classList.add("outlineFilter");a.placeholder=k.Filter;a.type="text";a.addEventListener("input",function(b){this._filterInputTimeout&&window.clearTimeout(this._filterInputTimeout);var d=this;this._filterInputTimeout=window.setTimeout(function(){d.explorer.filterChanged(a.value);
d._filterInputTimeout=null},200)}.bind(this));a.addEventListener("keydown",function(b){var d=null,c=null;b.keyCode===l.KEY.DOWN?(a.blur(),d=this.explorer.getNavHandler(),d.focus(),d.getTopLevelNodes()&&(c=d.getTopLevelNodes()[0],d.cursorOn(c,!1,!0),c.isNotSelectable&&d.iterate(!0,!1,!1,!0)),b.preventDefault&&b.preventDefault()):b.keyCode===l.KEY.ESCAPE&&this._previousActiveElement&&this._previousActiveElement.focus()}.bind(this),!1);this._toolbar.appendChild(a);this._filterInput=a},setContentType:function(a,
b){var d=this,c=this.filteredProviders=this._serviceRegistry.getServiceReferences("orion.edit.outliner").filter(function(c){var p=c.getProperty("contentType");c=c.getProperty("pattern");return p?p.some(function(b){return d._contentTypeRegistry.isExtensionOf(a,b)}):c&&RegExp(c).test(b)?!0:!1});this._providerLookup=!0;var p=c.map(function(a){if(a.getProperty("nameKey")&&a.getProperty("nls")){var b=new n;m.getMessageBundle(a.getProperty("nls")).then(function(a,b,d){a.displayName=d[a.getProperty("nameKey")];
b.resolve()}.bind(null,a,b),b.reject);return b}a.displayName=a.getProperty("name");return(new n).resolve()});n.all(p,function(a){return a}).then(function(){d._providerLookup=!1;d._outlineService.setOutlineProviders(c);d.setOutlineProviders(c);d.generateOutline()})}};v.prototype.constructor=v;u.prototype={setOutlineProviders:function(a){this.providers=a;var b=this;n.when(this._outlinePref,function(d){for(var c,p=0;p<a.length&&!(c=a[p],d.get("outlineProvider")===a[p].getProperty("id"));p++);c&&b.setProvider(c)})},
setProvider:function(a){this._providerResolved&&(this._provider=new n);this._provider.resolve(a);this._providerResolved=!0;var b=a.getProperty("id");b&&this._outlinePref.then(function(a){a.put("outlineProvider",b)})},getProvider:function(){return this._provider.promise},emitOutline:function(b){var d=this;n.when(this.getProvider(),function(c){var h=b.getEditor(),p=h.getTitle(),e=d._serviceRegistry,f=e.getService("orion.page.progress"),g=e.getService(c),q,s;if(q=g.computeOutline)h=b.getContentType(),
s=[a.getEditorContext(e),{contentType:h&&h.id}];else if(q=g.getOutline)s=[h.getText(),p];f.progress(q.apply(g,s),m.formatMessage(k.OutlineProgress,p,c.displayName)).then(function(a){a&&d.dispatchEvent({type:"outline",outline:a,title:p,providerId:c.getProperty("id")})})})}};u.prototype.constructor=u;return{Outliner:v,OutlineService:u}});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(k,n){var l;l=k.toUrl?(new URL(k.toUrl("workspace"),window.location.href)).href:(new URL("/",window.location.href)).href;return{makeRelative:function(g){if(!g)return g;var c=window.location.protocol+"//"+window.location.host;return 0===g.indexOf(c)?g.substring(c.length):g},isAtRoot:function(g){return!g?!1:"/workspace"===g?!0:0===(new URL(g,window.location.href)).href.indexOf(l)}}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages orion/Deferred orion/webui/littlelib orion/i18nUtil orion/fileUtils orion/explorers/explorer orion/EventTarget orion/objects orion/util".split(" "),function(k,n,l,g,c,f,b,e,d){function m(a,b,d,c,h,e){this.registry=a;this.root=b;this.fileClient=d;this.idPrefix=c||"";this.excludeFiles=!!h;this.excludeFolders=!!e}function a(a){b.attach(this);this.registry=a.serviceRegistry;this.treeRoot=a.treeRoot;this.selection=a.selection;this.fileClient=
a.fileClient;this.excludeFiles=a.excludeFiles;this.excludeFolders=a.excludeFolders;this.navHandlerFactory=a.navHandlerFactory;this.parentId=a.parentId;this.renderer=a.rendererFactory(this);this.dragAndDrop=a.dragAndDrop;this.setFocus=a.setFocus;this.myTree=this.model=null;this._hookedDrag=this.checkbox=!1;var d=a.modelEventDispatcher?a.modelEventDispatcher:new b;this.modelEventDispatcher=d;var c=this;this._modelListeners={};"copy copyMultiple create delete deleteMultiple import move moveMultiple".split(" ").forEach(function(a){d.addEventListener(a,
c._modelListeners[a]=c.modelHandler[a].bind(c))});this._clickListener=function(a){if("A"===a.target.tagName){for(a=a.target;a&&!a._item;)a=a.parentNode;if(a&&a._item)c.onLinkClick({type:"linkClick",item:a._item})}};(a=l.node(this.parentId))&&a.addEventListener("click",this._clickListener);var h=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";h.setTarget&&h.setTarget(a)}},
{pid:"nav.config"})}m.prototype=new f.ExplorerModel;e.mixin(m.prototype,{getRoot:function(a){a(this.root)},processParent:function(a,b){var d=a.Projects?[]:[a].concat(a.Parents||[]);if(this.excludeFiles||this.excludeFolders){var c=[],h;for(h in b)if(!(b[h].Directory?this.excludeFolders:this.excludeFiles))c.push(b[h]),b[h].parent=a,b[h].Parents||(b[h].Parents=d);b=c}else for(c in b)b[c].parent=a,b[c].Parents||(b[c].Parents=d);a.children=b;a.children.sort(function(a,b){var d=a.Directory;if(d!==b.Directory)return d?
-1:1;var d=a.Name&&a.Name.toLowerCase(),c=b.Name&&b.Name.toLowerCase();return d<c?-1:d>c?1:0});return b},getChildren:function(a,b){var d=this;if(a.children)b(a.children);else if(void 0!==a.Directory&&!1===a.Directory)b([]);else if(a.Children)b(d.processParent(a,a.Children));else if(a.Location){var c=null;this.registry&&(c=this.registry.getService("orion.page.progress"));(c?c.progress(this.fileClient.fetchChildren(a.ChildrenLocation),k["Fetching children of "]+a.Name):this.fileClient.fetchChildren(a.ChildrenLocation)).then(function(c){d.destroyed||
b(d.processParent(a,c))},function(){b([])})}else b([])},hasChildren:function(){var a=!1;this.root.Children&&(a=0<this.root.Children.length);return a}});m.prototype.constructor=m;var h,s;a.prototype=Object.create(f.Explorer.prototype);e.mixin(a.prototype,{destroy:function(){var a=this;Object.keys(this._modelListeners).forEach(function(b){a.modelEventDispatcher.removeEventListener(b,a._modelListeners[b])});var b=l.node(this.parentId);b&&b.removeEventListener("click",this._clickListener);f.Explorer.prototype.destroy.call(this)},
onLinkClick:function(a){this.dispatchEvent(a)},onModelCreate:function(a){return this.changedItem(a.parent,!0)},onModelCopy:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){a=(a=a.parent)||b.treeRoot;d[a.Location]=a});return n.all(Object.keys(d).map(function(a){return b.changedItem(d[a],!0)}))},onModelMove:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){var c=b.treeRoot;if((c.Location||c.ContentLocation)===a.oldValue.Location){var h=b.treeRoot;a=a.newValue;a=a.ChildrenLocation?
a:this.fileClient.read(a.ContentLocation,!0);return n.when(a,function(a){b.dispatchEvent({type:"rootMoved",oldValue:h,newValue:a});b.loadResourceList(a)})}c=(c=a.oldValue.parent)||b.treeRoot;d[c.Location]=c;c=(c=a.parent)||b.treeRoot;d[c.Location]=c;a.oldValue.Directory&&a.newValue&&b.isExpanded(a.oldValue)&&(d[a.newValue.Location]=a.newValue)});return n.all(Object.keys(d).map(function(a){return b.changedItem(d[a],!0)}))},onModelDelete:function(a){a=a.items||[a];var b=this,d=b.treeRoot,c;if(a.some(function(a){if(a.oldValue.Location===
(d.Location||d.ContentLocation)){if(a.oldValue.Location!==(a.parent.Location||a.parent.ContentLocation))c=a.parent;return!0}return!1}))return this.loadResourceList(c);var h={};a.forEach(function(a){a=a.parent;h[a.Location]=a});return n.all(Object.keys(h).map(function(a){return b.changedItem(h[a],!0)}))},modelHandler:{copy:function(a){if(!a.count)return this.onModelCopy(a)},copyMultiple:function(a){return this.onModelCopy(a)},create:function(a){return this.onModelCreate(a)},"delete":function(a){if(!a.count)return this.onModelDelete(a)},
deleteMultiple:function(a){return this.onModelDelete(a)},"import":function(a){return this.changedItem(a.target,!0)},move:function(a){if(!a.count)return this.onModelMove(a)},moveMultiple:function(a){return this.onModelMove(a)}},_makeDropTarget:function(a,b,e){if(this.dragAndDrop){var f=this,m=this.dragAndDrop,n=function(a){h=a.target};e&&(this._oldDragStart&&b.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=n);b.addEventListener("dragstart",n,!1);n=function(a){h=null};e&&
(this._oldDragEnd&&b.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=n);b.addEventListener("dragend",n,!1);n=function(a){b.classList.remove("dragOver");a.preventDefault();a.stopPropagation()};e&&(this._oldDragLeave&&b.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=n);b.addEventListener("dragleave",n,!1);n=function(a){if(h)s=a.dataTransfer.dropEffect=(d.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!d.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===
a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect="copy";b.classList.add("dragOver");l.stop(a)};e&&(this._oldDragEnter&&b.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=n);b.addEventListener("dragenter",n,!1);n=function(a){if(h)s=a.dataTransfer.dropEffect=(d.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!d.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect=
"copy";l.stop(a)};e&&!this._oldDragOver&&(b.addEventListener("dragover",n,!1),this._oldDragOver=n);var z=null,y=null;f.registry&&(z=f.registry.getService("orion.page.progress"),y=f.registry.getService("orion.page.message"));var x=function(a){if(y){var b=null,b="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;y.setProgressResult(b)}else window.console.log(a)},p=function(b,d,h,e,f,q,m){!h.Location&&h.fileMetadata&&(h=h.fileMetadata);d=d||"";if(b.isFile)c.isAtRoot(h.Location)?
x(k["You cannot copy files directly into the workspace.  Create a folder first."]):b.file(function(a){f(h,a,e,a.name.indexOf(".zip")===a.name.length-4&&window.confirm(g.formatMessage(k["Unzip ${0}?"],a.name)))});else if(b.isDirectory){var s=b.createReader(),l=function(a){s.readEntries(function(c){for(var h=0;h<c.length;h++)p(c[h],d+b.name+"/",a,e,f,q,!0)})};c.isAtRoot(h.Location)?(z?z.progress(q.createProject(h.ChildrenLocation,b.name),g.formatMessage(k["Creating ${0}"],b.name)):q.createProject(h.ChildrenLocation,
b.name)).then(function(a){e.loadResourceList(e.treeRoot.Path,!0);(z?z.progress(q.read(a.ContentLocation,!0),k["Loading "]+a.name):q.read(a.ContentLocation,!0)).then(function(a){l(a)},x)},x):(z?z.progress(q.createFolder(h.Location,b.name),g.formatMessage(k["Creating ${0}"],b.name)):q.createFolder(h.Location,b.name)).then(function(b){var d=e.modelEventDispatcher;m||d.dispatchEvent({type:"create",parent:a,newValue:b});l(b)},x)}},n=function(d){var e;b.classList.remove("dragOver");if(h){e=f.fileClient;
for(var B=h,J;B;){if(B._item){J=B._item;break}B=B.parentNode}if(!J)return;var r="copy"===s,B=r?e.copyFile:e.moveFile;(z?z.showWhile(B.apply(e,[J.Location,a.Location]),g.formatMessage(k[r?"Copying ${0}":"Moving ${0}"],J.Location)):B.apply(e,[J.Location,a.Location])).then(function(b){f.modelEventDispatcher.dispatchEvent({type:r?"copy":"move",oldValue:J,newValue:b,parent:a})},x)}else if(d.dataTransfer.items&&0<d.dataTransfer.items.length)for(e=0;e<d.dataTransfer.items.length;e++)B=null,"function"===
typeof d.dataTransfer.items[e].getAsEntry?B=d.dataTransfer.items[e].getAsEntry():"function"===typeof d.dataTransfer.items[e].webkitGetAsEntry&&(B=d.dataTransfer.items[e].webkitGetAsEntry()),B&&p(B,null,a,f,m,f.fileClient);else if(d.dataTransfer.files&&0<d.dataTransfer.files.length)for(e=0;e<d.dataTransfer.files.length;e++)B=d.dataTransfer.files[e],!B.size&&!B.type?x(g.formatMessage(k["Did not drop ${0}.  Folder drop is not supported in this browser."],B.name)):c.isAtRoot(a.Location)?x(k["You cannot copy files directly into the workspace.  Create a folder first."]):
m(a,B,f,B.name.indexOf(".zip")===B.name.length-4&&window.confirm(g.formatMessage(k["Unzip ${0}?"],B.name)));l.stop(d)};e&&(this._oldDrop&&b.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=n);b.addEventListener("drop",n,!1)}},createModel:function(){return new m(this.registry,this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders)},changedItem:function(a,b){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,b);var d=
this,c=new n;a.children=a.Children=null;this.model.getChildren(a,function(h){d.getNavHandler();d.myTree.refresh.bind(d.myTree)(a,h,b);c.resolve(h)});return c},showItem:function(a,b){var d=new n;if(!a||!this.model||!this.myTree||!this.myTree.showRoot&&a.Location===this.treeRoot.Location)return d.reject();var c=this.getRow(a);if(c)d.resolve(c._item||a);else return a.Parents&&0<a.Parents.length?(a.Parents[0].Parents=a.Parents.slice(1),this.expandItem(a.Parents[0],b).then(function(b){var d=this.getRow(a);
return!d?this.changedItem(b,!0).then(function(){var b=this.getRow(a);return b?b._item:(new n).reject()}.bind(this)):d._item||a}.bind(this))):void 0===b||b?this.reroot(a):d.reject();return d},expandItem:function(a,b){var d=new n;this.showItem(a,b).then(function(a){this.myTree.isExpanded(a)?d.resolve(a):this.myTree.expand(this.model.getId(a),function(){d.resolve(a)})}.bind(this),d.reject);return d},reveal:function(a,b){return this.showItem(a,b).then(function(a){var b=this.getNavHandler();b&&(b.cursorOn(a,
!0),b.setSelection(a));return a}.bind(this))},reroot:function(a){return(new n).reject()},isExpanded:function(a){a=this.model.getId(a);return this.renderer.tableTree.isExpanded(a)},getNameNode:function(a){if(a=this.model.getId(a))return l.node(a+"NameLink")},scopeUp:function(){},scopeDown:function(a){},loadResourceList:function(a,b,d){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);a=c.makeRelative(a);if(!b&&a===this._lastPath)return(new n).resolve(this.treeRoot);this._lastPath=a;
var h=this;return b||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),k["Loading "]+a).then(function(b){h.treeRoot.Path=a;"function"===typeof d&&d();h.dispatchEvent({type:"rootChanged",root:h.treeRoot});return(new n).resolve(h.treeRoot)},function(a){h.treeRoot.Path=null;h.dispatchEvent({type:"rootChanged",root:h.treeRoot});return(new n).reject(a)}):(new n).resolve(h.treeRoot)},load:function(a,b,d){var c=l.node(this.parentId),h=l.node("progress");h||(h=document.createElement("div"),
h.id="progress",l.empty(c),c.appendChild(h));l.empty(h);var e=setTimeout(function(){l.empty(h);h.appendChild(document.createTextNode(b))},500),f=this;return n.when(a,function(a){clearTimeout(e);if(!f.destroyed){f.treeRoot={};for(var b in a)f.treeRoot[b]=a[b];f.model=f.createModel();f.dragAndDrop&&(f._hookedDrag?f._makeDropTarget(f.treeRoot,c,!0):(a=(a=c&&("draggable"in c||"ondragstart"in c&&"ondrop"in c))&&!(!window.File||!window.FileList||!window.FileReader),f._hookedDrag=!0,a?f._makeDropTarget(f.treeRoot,
c,!0):(f.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser."))));var p=new n;f.createTree(f.parentId,f.model,{onComplete:function(a){p.resolve(a)},navHandlerFactory:f.navHandlerFactory,setFocus:"undefined"===typeof f.setFocus?!0:f.setFocus,selectionPolicy:f.renderer.selectionPolicy,onCollapse:function(a){if(f.getNavHandler())f.getNavHandler().onCollapse(a)}});return p.then(function(){if("function"===typeof d)try{d()}catch(a){f.registry&&f.registry.getService("orion.page.message").setErrorMessage(a)}if("function"===
typeof f.onchange)f.onchange(f.treeRoot);return f.treeRoot})}},function(a){clearTimeout(e);f.registry&&f.registry.getService("orion.page.message").setProgressResult(a);return(new n).reject(a)})},onchange:function(a){}});a.prototype.constructor=a;return{FileExplorer:a,FileModel:m}});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages orion/Deferred orion/explorers/explorer orion/explorers/navigationUtils orion/extensionCommands orion/objects orion/URITemplate orion/webui/littlelib".split(" "),function(k,n,l,g,c,f,b,e){function d(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function m(a,e,g,m,k,l,z,y,x){e=f.clone(e);var p;if(e.Directory)p=document.createElement("a"),
p.className="navlinkonpage",p.href=!a?h:(new b(a+"#{,resource,params*}")).expand({resource:e.ChildrenLocation}),e.Name&&p.appendChild(document.createTextNode(e.Name));else{k||(k=c.getOpenWithCommands(g));p=document.createElement("a");p.className="navlink targetSelector";l&&"object"===typeof l&&Object.keys(l).forEach(function(a){p[a]=l[a]});var A=null,C=null;if(A=y?y.holderDom:p)C=document.createElement("span"),C.className="core-sprite-file modelDecorationSprite thumbnail",A.appendChild(C);e.Name&&
p.appendChild(document.createTextNode(e.Name));var B=e.Location;z&&"object"===typeof z&&(e.params={},f.mixin(e.params,z));(a=c.getOpenWithCommand(g,e,k))&&(B=a.hrefCallback({items:e}));n.when(m.getFileContentType(e),function(a){if(A){var b=A,c=C;if(a){var h,f=a.imageClass,g=a.image;f?(h=document.createElement("span"),h.className+=f,h.classList.add("thumbnail")):g&&(h=document.createElement("img"),h.src=g,h.classList.add("thumbnail"));h&&b.replaceChild(h,c)}}p.href=B;x&&"function"===typeof x.updateFileNode&&
x.updateFileNode(e,p,d(a))})}p.addEventListener("click",function(){s=e}.bind(this),!1);return p}function a(a,b,d,c){this.explorer=b;this.commandService=d;this.contentTypeService=c;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var h=new b("#{,resource,params*}"),s;a.prototype=new l.SelectionRenderer;a.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};a.prototype.tableCallback=function(a){a.setAttribute("aria-label",k.Navigator);a.setAttribute("role",
"presentation")};a.prototype.rowCallback=function(a,b){a.setAttribute("role","treeitem")};a.prototype.emptyCallback=function(a){var b=document.createElement("tr"),d=document.createElement("td");d.colSpan=this.oneColumn?1:3;var c=document.createElement("div");c.classList.add("noFile");c.textContent=k.NoFile;var h=document.createElement("span");h.appendChild(document.createTextNode(k.File));e.processDOMNodes(c,[h]);d.appendChild(c);b.appendChild(d);a.appendChild(b)};a.prototype.getCellHeaderElement=
function(a){if(this.oneColumn&&0!==a)return null;switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};a.prototype.setTarget=function(a){this.target=a};a.prototype.getFolderImage=function(a){if(!this.showFolderImage)return null;a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};a.prototype.createFolderNode=function(a){var b;this.showFolderLinks?(b=m(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&
b.insertBefore(a,b.firstChild)):(b=document.createElement("span"),b.textContent=a.Name);return b};a.prototype.updateFileNode=function(a,b,d){};a.prototype.showFolderLinks=!0;a.prototype.getCellElement=function(a,b,d){switch(a){case 0:a=document.createElement("td");var h=document.createElement("span");h.id=d.id+"MainCol";h.setAttribute("role","presentation");a.appendChild(h);a.setAttribute("role","presentation");h.className="mainNavColumn";var e;b.Directory?(this.getExpandImage(d,h),e=this.createFolderNode(b),
h.appendChild(e),this.explorer._makeDropTarget(b,e),this.explorer._makeDropTarget(b,d)):(this.openWithCommands||(this.openWithCommands=c.getOpenWithCommands(this.commandService)),e=m("",b,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this),h.appendChild(e));e&&(e.id=d.id+"NameLink",1===e.nodeType&&(g.addNavGrid(this.explorer.getNavDict(),b,e),e.setAttribute("role","link"),e.setAttribute("tabindex","-1")));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,
h,b,this.explorer,"tool",null,!0);return a;case 1:if(this.oneColumn)return null;d=document.createElement("td");b.LocalTimeStamp&&(d.textContent=(new Date(b.LocalTimeStamp)).toLocaleString());return d;case 2:if(this.oneColumn)return null;d=document.createElement("td");!b.Directory&&"number"===typeof b.Length&&(b=parseInt(b.Length,10)/1024,d.textContent=Math.ceil(b).toLocaleString()+" KB");d.style.textAlign="right";return d}};a.prototype.constructor=a;return{NavigatorRenderer:a,isImage:d,getClickedItem:function(){return s},
createLink:m}});
define("orion/compare/compareUtils",["orion/URITemplate"],function(k){var n=n||{};n.compareUtils=n.compareUtils||{};n.compareUtils.lookUpMapper=function(k,g,c){for(var f=0,b=0;b<k.length;b++){var e=k[b][g];0===e&&(e=1);if(c>=f&&c<f+e)return{mapperIndex:b,startFrom:f};if(b===k.length-1)break;f+=k[b][g]}return{mapperIndex:k.length-1,startFrom:f}};n.compareUtils.lookUpLineIndex=function(k,g,c){if(0===c)return 0;for(var f=0,b=0;b<c;b++)f+=k[b][g];return f};n.compareUtils.updateMapper=function(k,g,c,f,
b){if(f!==b&&(0<f||0<b)){var e=n.compareUtils.lookUpMapper(k,g,c);if(!(0>e.mapperIndex)){if(0<f){var d=c-e.startFrom;for(c=e.mapperIndex;c<k.length;c++){d=k[c][g]-d;if(f<=d){k[c][g]-=f;break}k[c][g]-=d;f-=d;d=0}}0<b&&(k[e.mapperIndex][g]+=b)}}};n.compareUtils.overlapMapper=function(k,g,c,f,b){k=c+k[g]-1;k<c&&(k=c);b<f&&(b=f);return k<f||b<c?!1:!0};n.compareUtils.findFirstDiff=function(k,g,c,f){for(var b=0,e=null,d=0;d<k.length&&!(b>f)&&(!n.compareUtils.overlapMapper(k[d],g,b,c,f)||!(e={mapperIndex:d,
startFrom:b},0!==k[d][2]));d++)b+=k[d][g];return e};n.compareUtils.matchMapper=function(k,g,c,f){if(0===k.length)return c;var b=c+Math.round((f-c)/3),e=n.compareUtils.findFirstDiff(k,g,c,f),d=0===k[e.mapperIndex][g]?e.startFrom:e.startFrom+k[e.mapperIndex][g]-1,m=n.compareUtils.lookUpLineIndex(k,1-g,e.mapperIndex),a=e.startFrom-c;return 0===k[e.mapperIndex][2]?m-a:b>=e.startFrom&&b<=d?m-Math.round((f-c)/3):b<e.startFrom?m-a:(0===k[e.mapperIndex][1-g]?m:m+k[e.mapperIndex][1-g]-1)-(d-c)};n.compareUtils.getMapperLineCount=
function(k){for(var g=0,c=0;c<k.length;c++)g+=Math.max(k[c][0],k[c][1]);return g};n.compareUtils.getAnnotationIndex=function(k,g){for(var c=0;c<k.length;c++)if(k[c][0]===g)return c;return-1};n.compareUtils.getAnnotationMapperIndex=function(k,g){return k[g][1]};n.compareUtils.getAnnotationIndexByMapper=function(k,g){for(var c=0;c<k.length;c++)if(k[c][1]===g)return{current:c,prev:c-1,next:c+1};return{current:-1,prev:-1,next:-1}};n.compareUtils.isMapperConflict=function(k,g){return 0>g||!k[g][3]?!1:
1===k[g][3]};n.compareUtils.mergeDiffBlocks=function(k,g,c,f,b,e){for(var d=0;d<g.length;d++){var m=g[d][0],a=c[g[d][1]];if(0<a[0]){for(var h="",s=0;s<a[0];s++)h=h+f[a[2]-1+s].substring(b)+e;a=k.getLineCount();m>=a&&(m=k.getLineEnd(a-1),s=k.getLineEnd(a-1,!0),m===s?(k.setText(e,m,m),m=a):m=a-1);m=k.getLineStart(m);k.setText(h,m,m)}}};n.compareUtils.generateCompareHref=function(l,g){var c=require.toUrl("compare/compare.html");g.conflict||(g.conflict=void 0);g.readonly||(g.readonly=void 0);return(new k(c+
"#{,resource,params*}")).expand({resource:l,params:g})};n.compareUtils.generateCompareTreeHref=function(l,g){var c=require.toUrl("compare-tree/compare-tree.html");return(new k(c+"#{,resource,params*}")).expand({resource:l,params:g})};return n.compareUtils});
define("orion/webui/dialogs/DirectoryPrompterDialog","i18n!orion/widgets/nls/messages orion/webui/littlelib orion/webui/dialog orion/fileUtils orion/selection orion/explorers/navigationUtils orion/explorers/explorer orion/explorers/explorer-table".split(" "),function(k,n,l,g,c,f,b,e){function d(a,b){this.explorer=b;this._init(a)}function m(a){this._init(a)}d.prototype=new b.SelectionRenderer;d.prototype.constructor=d;d.prototype.getLabelColumnIndex=function(){return 0};d.prototype.getCellElement=
function(a,b,d){a=document.createElement("td");d.appendChild(a);var c=document.createElement("span");c.id=d.id+"navSpan";a.appendChild(c);c.className="mainNavColumn singleNavColumn";this.getExpandImage(d,c);c.appendChild(document.createTextNode(b.Name))};m.prototype=new l.Dialog;m.prototype.TEMPLATE='\x3cdiv id\x3d"message" style\x3d"width: 25em; padding-bottom: 5px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"directoryTree" class\x3d"explorerTreeClass" style\x3d"width:25em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"\x3e\x3c/div\x3e';
m.prototype._init=function(a){this.title=a.title||k["Choose a Folder"];this.modal=!0;this.buttons=[{text:k.OK,isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._fileClient=a.fileClient;this._serviceRegistry=a.serviceRegistry;this._message=a.message||"";this._func=a.func;this._initialize()};m.prototype._bindToDom=function(a){this.loadFolderList("/");this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";this.$directoryTree.focus()};
m.prototype.loadFolderList=function(a){a=g.makeRelative(a);this.selection=new c.Selection(this._serviceRegistry,"orion.directoryPrompter.selection");this.explorer=new e.FileExplorer({treeRoot:{children:[]},selection:this.selection,serviceRegistry:this._serviceRegistry,fileClient:this._fileClient,parentId:"directoryTree",excludeFiles:!0,rendererFactory:function(a){return new d({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"},a)}});this.explorer.loadResourceList(a,!0,null)};m.prototype.done=
function(){this.selection.getSelection(function(a){this.hide();this._func(a)}.bind(this))};m.prototype.constructor=m;return{DirectoryPrompterDialog:m}});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(k,n,l,g){function c(){}c.prototype={_initialize:function(c,b,e,d,m){this._tooltip=new g.Tooltip({node:c,hideDelay:m||0,afterShowing:this._afterShowingFunction(b).bind(this),afterHiding:e,trigger:d?d:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";c=document.createRange();c.selectNode(this.$parent);c=c.createContextualFragment(this.TEMPLATE);
this.messages&&l.processTextNodes(c,k);this.$parent.appendChild(c);var a=this._tooltip;this.$parent.addEventListener("keydown",function(b){b.keyCode===l.KEY.ESCAPE&&a.hide()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_bindElements:function(c){for(var b=0;b<c.childNodes.length;b++){var e=c.childNodes[b];e.id&&(this["$"+e.id]=e);this._bindElements(e)}},_afterShowingFunction:function(c){return function(){c&&c.bind(this)();if(!this.customFocus){var b=
l.firstTabbable(this.$parent);b&&b.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};c.prototype.constructor=c;return{PopupDialog:c}});
define("orion/webui/dialogs/SFTPConnectionDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/popupdialog","orion/webui/dialog"],function(k,n,l,g){function c(b,c){this.messages=k;this._initialize(b);this._notify=c}function f(b){this._init(b)}localStorage.getItem("orion.sftpConnections")||localStorage.setItem("orion.sftpConnections",JSON.stringify({identifier:"name",label:k.name,items:[]}));c.prototype=new l.PopupDialog;c.prototype.TEMPLATE='\x3cdiv\x3e\x3clabel for\x3d"sftpHost"\x3e${Remote host:}\x3c/label\x3e\x3cinput id\x3d"sftpHost" /\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPort"\x3e${Port:}\x3c/label\x3e\x3cinput id\x3d"sftpPort" /\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPath"\x3e${Remote path:}\x3c/label\x3e\x3cinput id\x3d"sftpPath" /\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpUser"\x3e${User name:}\x3c/label\x3e\x3cinput id\x3d"sftpUser" /\x3e\x3c/div\x3e\x3cdiv class\x3d"layoutBlock layoutRight"\x3e\x3cbutton id\x3d"addSftpConnection" class\x3d"dropdownTrigger orionButton commandButton"\x3e${Add}\x3c/button\x3e\x3c/div\x3e';
c.prototype._bindToDom=function(b){this.$addSftpConnection.addEventListener("click",function(){this._notify({name:this.$sftpUser.value+"@"+this.$sftpHost.value+":"+this.$sftpPort.value+this.$sftpPath.value});this.hide()}.bind(this),!1)};c.prototype.constructor=c;f.prototype=new g.Dialog;f.prototype.TEMPLATE='\x3cdiv\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPath"\x3e${Location:}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cselect id\x3d"sftpConnectionList" name\x3d"sftpConnectionList"\x3e\x3c/select\x3e\x3cbutton id\x3d"newSftpConnection" style\x3d"margin-left: 16px;" class\x3d"dropdownTrigger orionButton commandButton"\x3e${New}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv\x3e\x3clabel for\x3d"sftpPassword"\x3e${Password:}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"sftpPassword" type\x3d"password" /\x3e\x3c/div\x3e\x3cp\x3e${If the same file exists in both the source and destination:}\x3c/p\x3e\x3cinput type\x3d"radio" name\x3d"overwriteOption" id\x3d"overwriteCancel" checked value\x3d"overwriteCancel" /\x3e\x3clabel for\x3d"overwriteCancel"\x3e${Cancel the transfer}\x3c/label\x3e\x3cbr /\x3e\x3cinput type\x3d"radio" name\x3d"overwriteOption" id\x3d"overwriteAll" value\x3d"overwriteAll" /\x3e\x3clabel for\x3d"overwriteAll"\x3e${Always overwrite destination}\x3c/label\x3e\x3cbr /\x3e\x3cinput type\x3d"radio" name\x3d"overwriteOption" id\x3d"overwriteOlder" value\x3d"overWriteOlder" /\x3e\x3clabel for\x3d"overwriteOlder"\x3e${Overwrite if source is newer}\x3c/label\x3e\x3c/div\x3e';
f.prototype._init=function(b){this.title="SFTP Transfer";this.messages=k;this.modal=!0;this.buttons=[{text:k["Start Transfer"],callback:this.done.bind(this)}];this.sftpConnectionStoreData=JSON.parse(localStorage.getItem("orion.sftpConnections"));this._func=b.func;this._initialize()};f.prototype._bindToDom=function(b){this.$sftpConnectionList.style.minWidth="220px";this._popupDialog=new c(this.$newSftpConnection,this.onAddConnection.bind(this));this._addChildDialog(this._popupDialog);this._populateSelect()};
f.prototype._afterHiding=function(){this._popupDialog.hide()};f.prototype.done=function(){var b=this.$sftpConnectionList.value.split("@"),c,d,f;if(2===b.length)f=b[0],d=b[1];else if(3===b.length)f=b[0]+"@"+b[1],d=b[2];else{this.hide();return}var a=d.indexOf(":");0>=a&&(c=22);var h=d.indexOf("/");0>=h||(c?b=d.substring(0,h):(b=d.substring(0,a),c=d.substring(a+1,h)),d=d.substring(h),this._func(b,c,d,f,this.$sftpPassword.value,this._computeOverwriteValue()));this.hide()};f.prototype._computeOverwriteValue=
function(){return this.$overwriteCancel.checked?"no-overwrite":this.$overwriteOlder.checked?"overwrite-older":""};f.prototype._populateSelect=function(){n.empty(this.$sftpConnectionList);for(var b=0;b<this.sftpConnectionStoreData.items.length;b++){var c=this.sftpConnectionStoreData.items[b].name,d=document.createElement("option");d.appendChild(document.createTextNode(c));d.value=c;this.$sftpConnectionList.appendChild(d)}};f.prototype.onAddConnection=function(b){for(var c=!1,d=0;d<this.sftpConnectionStoreData.items.length;d++)if(this.sftpConnectionStoreData.items[d].name===
b.name){c=!0;break}c||(this.sftpConnectionStoreData.items.unshift(b),localStorage.setItem("orion.sftpConnections",JSON.stringify(this.sftpConnectionStoreData)),this._populateSelect(),this.$sftpConnectionList.value=b.name)};f.prototype.constructor=f;return{SFTPConnectionDialog:f}});
define("orion/webui/dialogs/ImportDialog",["i18n!orion/widgets/nls/messages","orion/webui/littlelib","orion/webui/dialog","orion/util"],function(k,n,l,g){function c(c){this._init(c)}c.prototype=new l.Dialog;c.prototype.TEMPLATE='\x3cdiv ondragover\x3d"event.preventDefault()"\x3e\x3cdiv class\x3d"uploadContainer" id\x3d"uploadContainer"\x3e\x3cdiv class\x3d"dottedOutline"\x3e\x3cdiv id\x3d"dragArea" class\x3d"floatingSection"\x3e\x3cdiv class\x3d"uploadInstruction"\x3e${Drag a file here}\x3c/div\x3e\x3cdiv class\x3d"uploadOptions"\x3e(\x3cinput style\x3d"height: 20px;" class\x3d"uploadOptionsItem" id\x3d"unzipCheckbox" checked\x3d"true" type\x3d"checkbox"\x3e\x3clabel style\x3d"line-height: 20px;" class\x3d"uploadOptionsItem" for\x3d"${id}_unzipCheckbox"\x3e${unzip zips}\x3c/label\x3e)\x3c/div\x3e\x3cdiv class\x3d"tipInstruction"\x3e${or if you prefer}\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"layoutBlock layoutRight"\x3e\x3cinput type\x3d"file" multiple name\x3d"selectedFile" id\x3d"selectedFile" class\x3d"uploadChooser" /\x3e\x3cspan id\x3d"uploadButton" role\x3d"button" class\x3d"commandButton disabled" tabindex\x3d"0"\x3e${Upload}\x3c/span\x3e\x3c/div\x3e\x3c/div\x3e';
c.prototype._init=function(c){this.title=k["Import a file or zip"];this.messages=k;this.modal=!0;this._importLocation=c.importLocation;this._func=c.func;this._initialize()};c.prototype._bindToDom=function(c){this.$uploadContainer.addEventListener("dragenter",this.dragEnter.bind(this),!1);this.$uploadContainer.addEventListener("dragover",this.dragOver.bind(this),!1);this.$uploadContainer.addEventListener("dragleave",this.dragLeave.bind(this),!1);this.$uploadContainer.addEventListener("drop",this.drop.bind(this),
!1);this.$selectedFile.addEventListener("change",this.checkUploadState.bind(this),!1);this.$uploadButton.addEventListener("click",this.uploadSelected.bind(this),!1)};c.prototype.handleReadyState=function(c,b){if(4===this.req.readyState){if(400===this.req.status){var e={};try{e=JSON.parse(this.req.responseText)}catch(d){}if(e.JsonData&&e.JsonData.ExistingFiles&&confirm(e.Message+"\nWould you like to retry the import with force overwriting?")){this.uploadFile.bind(this)(b,!0);return}}this.hide();this._func()}};
c.prototype.checkUploadState=function(c){this.$selectedFile.files&&0<this.$selectedFile.files.length?this.$uploadButton.classList.remove(this.DISABLED):this.$uploadButton.classList.add(this.DISABLED)};c.prototype.uploadFile=function(c,b){var e=this.$unzipCheckbox.checked&&c.name.indexOf(".zip")===c.name.length-4;this.req=new XMLHttpRequest;this.req.open("post",b?this._importLocation+(0<this._importLocation.indexOf("?")?"\x26force\x3dtrue":"?force\x3dtrue"):this._importLocation,!0);this.req.setRequestHeader("X-Requested-With",
"XMLHttpRequest");this.req.setRequestHeader("Slug",c.name);e||this.req.setRequestHeader("X-Xfer-Options","raw");this.req.setRequestHeader("Content-Type",c.type);this.req.onreadystatechange=function(b){this.handleReadyState.bind(this)(b,c)}.bind(this);this.req.send(c)};c.prototype.uploadSelected=function(c){if(!this.$uploadButton.classList.contains(this.DISABLED)&&this.$selectedFile.files&&0<this.$selectedFile.files.length)for(c=0;c<this.$selectedFile.files.length;c++)this.uploadFile(this.$selectedFile.files[c])};
c.prototype.dragEnter=function(c){if(!g.isIE&&("all"===c.dataTransfer.effectAllowed||"uninitialized"===c.dataTransfer.effectAllowed||0<=c.dataTransfer.effectAllowed.indexOf("copy")))c.dataTransfer.dropEffect="copy";n.stop(c)};c.prototype.dragLeave=function(c){n.stop(c)};c.prototype.dragOver=function(c){if(!g.isIE&&("all"===c.dataTransfer.effectAllowed||"uninitialized"===c.dataTransfer.effectAllowed||0<=c.dataTransfer.effectAllowed.indexOf("copy")))c.dataTransfer.dropEffect="copy";n.stop(c)};c.prototype.drop=
function(c){n.stop(c);c=c.dataTransfer.files;if(c.length&&0<c.length)for(var b=0;b<c.length;b++)this.uploadFile(c[b])};c.prototype.constructor=c;return{ImportDialog:c}});
define("orion/fileCommands","i18n!orion/navigate/nls/messages require orion/webui/littlelib orion/i18nUtil orion/uiUtils orion/fileUtils orion/commands orion/commandRegistry orion/extensionCommands orion/contentTypes orion/compare/compareUtils orion/Deferred orion/webui/dialogs/DirectoryPrompterDialog orion/webui/dialogs/SFTPConnectionDialog orion/webui/dialogs/ImportDialog orion/EventTarget".split(" "),function(k,n,l,g,c,f,b,e,d,m,a,h,s,t,q,r){function v(a){var b=J;b&&"function"===typeof b.dispatchEvent&&
b.dispatchEvent(a)}function u(a){A?A.setProgressResult(a):window.console.log(a)}function w(a,b,d,p,h){var e,f=!0,g=!1;(b=a.makeNewItemPlaceHolder(b,d,null,!0))?(a=b.refNode,e=b.tempNode,f=!1,g=!0):a=l.node(d);a?c.getUserText({id:d+"EditBox",refNode:a,hideRefNode:f,initialText:p,onComplete:function(a){a&&h(a)},onEditDestroy:function(){try{e&&e.parentNode&&e.parentNode.removeChild(e)}catch(a){}},isInitialValid:!0,insertAsChild:g}):(d=window.prompt(p))&&h(d)}function z(a){if(!a)return{};Array.isArray(a)&&
(a=1===a.length?a[0]:{});return a}function y(a,b,d,c,p,e){A=d;if(c){var g;g=f.isAtRoot(a.treeRoot.ChildrenLocation)?a.treeRoot:A.progress(b.loadWorkspace(a.treeRoot.Location),"Loading workspace");h.when(g,function(a){a=b.createProject(a.ChildrenLocation,c);e&&(a=d.showWhile(a,e));a.then(function(a){d.progress(b.read(a.ContentLocation,!0),"Reading metadata of newly created project "+c).then(function(a){p&&p(a);v({type:"create",parent:g,newValue:a})},u)},u)},u)}}var x={},p=!1,A=null,C=null,B;x.setExplorer=
function(a){B=a};var J;x.getModelEventDispatcher=function(){J||(J=new r);return J};x.uploadFile=function(a,b,d,c,p){this.req=new XMLHttpRequest;this.req.open("post",p?a.ImportLocation+(0<a.ImportLocation.indexOf("?")?"\x26force\x3dtrue":"?force\x3dtrue"):a.ImportLocation,!0);this.req.setRequestHeader("X-Requested-With","XMLHttpRequest");this.req.setRequestHeader("Slug",b.name);c||this.req.setRequestHeader("X-Xfer-Options","raw");this.req.setRequestHeader("Content-Type",b.type);this.req.onreadystatechange=
function(p){if(4===this.req.readyState){if(400===this.req.status){p={};try{p=JSON.parse(this.req.responseText)}catch(h){}if(p.JsonData&&p.JsonData.ExistingFiles&&(d&&d.serviceRegistry?d.serviceRegistry.getService("orion.page.dialog").confirm:confirm)(p.Message+"\nWould you like to retry the import with force overwriting?")){x.uploadFile(a,b,d,c,!0);return}}v({type:"create",parent:a,newValue:null})}}.bind(this);this.req.send(b)};x.updateNavTools=function(a,b,d,c,h,e,f){function g(a,d){(Array.isArray(h)?
h:[h]).forEach(function(c){var p=l.node(c);p&&(c=b._contributionsByScopeId[c],a=a||c&&c.localSelectionService||b.getSelectionService(),c&&a&&a.getSelections(function(a){b.destroy(p);a=!a||Array.isArray(a)&&!a.length;f&&a?b.renderCommands(p.id,p,d,B,"button"):b.renderCommands(p.id,p,null,B,"button")}))})}B=d;if(c){if(d=l.node(c))b.destroy(d);else throw Error("could not find toolbar "+c);C&&e.Location!==C&&(b.closeParameterCollector(),C=e.Location);b.renderCommands(d.id,d,e,B,"button")}h&&g(null,B?
B.treeRoot:null);if(!p){p=!0;var A=a.getService("orion.page.selection");A.addEventListener("selectionChanged",function(a){g(A,B?B.treeRoot:null)})}};var E=[],G=!1;x.getCutBuffer=function(){return G?E:null};x.isEqualToOrChildOf=function(a,b){return a.Location===b.Location?!0:-1!==a.Location.indexOf(b.Location)?a.parent===b.parent?!1:!0:!1};x.createFileCommands=function(d,p,C){function J(a){a=f.makeRelative(a);a=a.split("#");a=a[a.length-1];var b=a.indexOf("/?");0<b&&(a=a.substring(0,b+1));return a}
function r(a){if(!B||!B.isCommandsVisible())return!1;a=z(a);return a.Location&&f.isAtRoot(a.Location)}function n(a,b,c){a=Array.isArray(a)?a:[a];b=function(a){Array.isArray(a)||(a=[a]);var b=[],d=[],p=this;a.forEach(function(h){b.push((c?C.copyFile:C.moveFile).apply(C,[h.Location,p.path,h.Name]).then(function(b){d.push({oldValue:h,newValue:b,parent:p.item});Q({type:c?"copy":"move",oldValue:h,newValue:b,parent:p.item,count:a.length})},u))});h.all(b).then(function(){Q({type:c?"copyMultiple":"moveMultiple",
items:d})})};for(var p=[],e=0;e<a.length;e++)a[e].parent&&a[e].parent.Location&&(a[e].parent.stripped=a[e].parent.stripped||J(a[e].parent.Location),-1===p.indexOf(a[e].parent.stripped)&&p.push(a[e].parent.stripped)),a[e].Directory&&!c&&(a[e].stripped=a[e].stripped||J(a[e].Location),p.push(a[e].stripped));a=[];for(var f=[],q=B.treeRoot.Children||(B.treeRoot.Workspace?B.treeRoot.Workspace.Children:{}),e=0;e<q.length;e++){var m=q[e];m.stripped=m.stripped||(m.Directory?J(m.Location):null);m.stripped&&
-1===p.indexOf(m.stripped)&&f.push(m)}f.sort(function(a,b){return a.stripped<b.stripped?-1:a.stripped>b.stripped?1:0});for(e=0;e<f.length;e++){for(var p=f[e],q=p.Name,m=p.stripped.split("/").length+1,l=0;l<m-2;l++)q="  "+q;a.push({name:q,path:p.stripped,item:p,callback:b})}0<f.length&&a.push({});a.push({name:k["Choose folder..."],callback:function(a){(new s.DirectoryPrompterDialog({title:k["Choose a Folder"],serviceRegistry:d,fileClient:C,func:function(b){if(b&&b.Location){Array.isArray(a)||(a=[a]);
var d=[],p=[];a.forEach(function(h){var e=b.Location,f=h.Name||null,q=c?C.copyFile:C.moveFile,m=g.formatMessage(c?k["Copying ${0}"]:k["Moving ${0}"],h.Location);c&&h.parent&&h.parent.Location===e&&((f=window.prompt(g.formatMessage(k["Enter a new name for '${0}'"],h.Name),g.formatMessage(k["Copy of ${0}"],h.Name)))||(e=null));e&&(e=q.apply(C,[h.Location,b.Location,f]),d.push(A.showWhile(e,m).then(function(d){p.push({oldValue:h,newValue:d,parent:b});Q({type:c?"copy":"move",oldValue:h,newValue:d,parent:b,
count:a.length})},u)))});h.all(d).then(function(){Q({type:c?"copyMultiple":"moveMultiple",items:p})})}}})).show()}});return a}function M(a){return a.parent?{item:a,parent:a.parent}:a.Parents&&a.Parents[0]?{item:a,parent:a.Parents[0]}:C.loadWorkspace(C.fileServiceRootURL(a.Location)).then(function(b){return h.when(b.Children||C.fetchChildren(b)).then(function(d){b.Children=d;d=b.Children.some(function(b){return b.Location===a.Location?(a=b,!0):!1});return{item:a,parent:d?b:null}})})}function P(a){var b;
Array.isArray(a)||(a=[a]);a.some(function(a){a=a.Directory?a:a.parent;if(b){if(b.Location!==a.Location)return b=null,!0}else b=a;return!1});return b&&f.isAtRoot(b.Location)?null:b}function U(a){return!B||!B.isCommandsVisible()?!1:P(a)}function X(a,b){var d=a.Location;h.when(M(a),function(c){a=c.item;var p=c.parent;p&&p.Projects&&p.Projects.some(function(b){return b.Id===a.Id?(d=b.Location,!0):!1});c=C.moveFile(d,p.Location,b);A.showWhile(c,g.formatMessage(k["Renaming ${0}"],d)).then(function(b){a.parent||
(a.parent=p);Q({type:"move",oldValue:a,newValue:b,parent:p})},u)})}function W(a,b,d){var c=function(a){var d=0,c=b;for(a=a.filter(function(a){return 0===a.Name.indexOf(b)}).map(function(a){return a.Name});-1!==a.indexOf(c);)d++,c=b.concat(" (").concat(d).concat(")");return c};a.children?(a=c(a.children),d(a)):A.progress(C.fetchChildren(a.ChildrenLocation),k["Fetching children of "]+a.Name).then(function(a){a=c(a);d(a)},u)}function S(a,b,d){var c=function(a){if(a){var c=C[d?"createFolder":"createFile"](b.Location,
a);A.showWhile(c,g.formatMessage(k["Creating ${0}"],a)).then(function(a){Q({type:"create",parent:b,newValue:a})},u)}};W(b,a,function(a){w(B,b,B.getRow(b),a,function(a){c(a)})})}A=d.getService("orion.page.progress");var Q=v.bind(null),F=function(a){if(!B||!B.isCommandsVisible())return!1;var b=Array.isArray(a)?a:[a];if(0===b.length)return!1;for(var d=0;d<b.length;d++)if(a=b[d],!a.Location||a.Projects)return!1;return!0},D=new b.Command({name:k.Rename,tooltip:k["Rename the selected files or folders"],
imageClass:"core-sprite-rename",id:"eclipse.renameResource",visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:Array.isArray(a)?1===a.length&&a[0].Name:a.Location&&!a.Projects},parameters:new e.ParametersDescription(null,{},function(a){a=Array.isArray(a.items)?a.items:[a.items];var b=B.treeRoot;return a.some(function(a){return a===b})?[new e.CommandParameter("name","text",k["Name:"],b.Name)]:null}),callback:function(a){var b=z(a.items),d;if(a.parameters.hasParameters()&&null!==(d=a.parameters.valueFor("name")))X(b,
d);else a:{d=B.getNameNode(b);if(!d){if(!a)break a;d=a.domParent||a.domNode}a=d.id+"EditBox";l.node(a)||c.getUserText({id:a,refNode:d,hideRefNode:!0,initialText:b.Name,onComplete:X.bind(null,b),selectTo:b.Directory?"":"."})}}});p.addCommand(D);var L=new m.ContentTypeRegistry(d),D=new b.Command({name:k["Compare with each other"],tooltip:k["Compare the selected 2 files with each other"],id:"eclipse.compareWithEachOther",visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;if(Array.isArray(a))if(2===
a.length&&!a[0].Directory&&!a[1].Directory){var b=L.getFilenameContentType(a[0].Name);a=L.getFilenameContentType(a[1].Name);if(b&&("text/plain"===b["extends"]||"text/plain"===b.id)&&a&&("text/plain"===a["extends"]||"text/plain"===a.id))return!0}else if(2===a.length&&a[0].Directory&&a[1].Directory)return!0;return!1},hrefCallback:function(b){return b.items[0].Directory&&b.items[1].Directory?a.generateCompareTreeHref(b.items[0].Location,{compareTo:b.items[1].Location,readonly:!0}):a.generateCompareHref(b.items[0].Location,
{compareTo:b.items[1].Location,readonly:!1,readonlyRight:!1})}});p.addCommand(D);D=new b.Command({name:k["Compare with..."],tooltip:k["Compare the selected folder with a specified folder"],id:"eclipse.compareWith",visibleWhen:function(a){return!B||!B.isCommandsVisible()?!1:Array.isArray(a)&&1===a.length&&a[0].Directory?!0:!1},callback:function(b){(new s.DirectoryPrompterDialog({title:k["Choose a Folder"],serviceRegistry:d,fileClient:C,func:function(d){d&&d.Location&&(d=a.generateCompareTreeHref(b.items[0].Location,
{compareTo:d.Location,readonly:!0}),window.open(d))}})).show()}});p.addCommand(D);D=new b.Command({name:k.Delete,imageClass:"core-sprite-delete",id:"eclipse.deleteFile",visibleWhen:F,callback:function(a){var b=Array.isArray(a.items)?a.items:[a.items];a=1===b.length?g.formatMessage(k["Are you sure you want to delete '${0}'?"],b[0].Name):g.formatMessage(k["Are you sure you want to delete these ${0} items?"],b.length);d.getService("orion.page.dialog").confirm(a,function(a){if(a){var d=[];a=b.map(function(a){var c=
a.Location;return h.when(M(a),function(p){a=p.item;var e=p.parent;e&&e.Projects&&(c=null,e.Projects.some(function(b){return b.Id===a.Id?(c=b.Location,!0):!1}));"ProjectRoot"===a.type&&e.ProjectLocation&&(c=e.ProjectLocation);if(!c)return(new h).resolve();p=C.deleteFile(c);return A.showWhile(p,g.formatMessage(k["Deleting ${0}"],c)).then(function(){d.push({oldValue:a,newValue:null,parent:e});E=E.filter(function(b){return!x.isEqualToOrChildOf(b,a)});Q({type:"delete",oldValue:a,newValue:null,parent:e,
count:b.length})},u)})});h.all(a).then(function(){Q({type:"deleteMultiple",items:d})},u)}})}});p.addCommand(D);D=new b.Command({name:k["Export as zip"],tooltip:k["Create a zip file of the folder contents and download it"],imageClass:"core-sprite-exportzip",id:"eclipse.downloadFile",visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=z(a);return a.ExportLocation&&a.Directory},hrefCallback:function(a){return z(a.items).ExportLocation}});p.addCommand(D);var N=function(a,b){var d=P(a);if(!d||
!d.Location)d=B.treeRoot,d.Project&&(d=d.children[0]);return d},D=new b.Command({name:k["New File"],tooltip:k["Create a new file"],imageClass:"core-sprite-new_file",id:"eclipse.newFile",callback:function(a){a=N(a.items);S(k["New File"],a,!1)},visibleWhen:U});p.addCommand(D);var V=new b.Command({name:k["New Folder"],tooltip:k["Create a new folder"],imageClass:"core-sprite-new_folder",id:"eclipse.newFolder",callback:function(a){a=N(a.items);S(k["New Folder"],a,!0)},visibleWhen:function(a){return U(a)&&
!f.isAtRoot(a.Location)}});p.addCommand(V);D=new e.ParametersDescription([new e.CommandParameter("url","url",k["File URL:"],"URL"),new e.CommandParameter("unzip","boolean",k["Unzip *.zip files:"],!0)]);D=new b.Command({name:k["Import from HTTP..."],tooltip:k["Copy a file from a URL and optionally unzip it"],id:"orion.importZipURL",parameters:D,callback:function(a){var b=P(a.items),d=a.parameters&&a.parameters.valueFor("url");if(b&&d){var c=b.ImportLocation+(-1===b.ImportLocation.indexOf("?")?"?":
"\x26")+"source\x3d"+d;a=a.parameters&&a.parameters.valueFor("unzip")&&d.indexOf(".zip")===d.length-4?"":"raw";c=C.remoteImport(c,{OptionHeader:a});A.showWhile(c,g.formatMessage(k["Importing from ${0}"],d)).then(function(){Q({type:"import",target:b})})}},visibleWhen:U});p.addCommand(D);D=new b.Command({name:k["New Folder"],imageClass:"core-sprite-new_folder",tooltip:k["Create an empty folder"],description:k["Create an empty folder on the Orion server.  You can import, upload, or create content in the editor."],
id:"orion.new.project",callback:function(a){var b;P(a.items)?V.callback(a):(b=z(a.items),W(b,k["New Folder"],function(a){w(B,b,B.getRow(b),a,function(a){y(B,C,A,a)})}))},visibleWhen:r});p.addCommand(D);D=new b.Command({name:k["Link to Server"],tooltip:k["Link to existing content on the server"],description:k["Create a folder that links to an existing folder on the server."],imageClass:"core-sprite-link",id:"orion.new.linkProject",parameters:new e.ParametersDescription([new e.CommandParameter("name",
"text",k["Name:"],k["New Folder"]),new e.CommandParameter("url","url",k["Server path:"],"")]),callback:function(a){var b=function(a,b){if(a&&b){var d=C.createProject(B.treeRoot.ChildrenLocation,a,b,!0);A.showWhile(d,g.formatMessage(k["Linking to ${0}"],b)).then(function(a){v({type:"create",parent:B.treeRoot,newValue:a})},u)}};a.parameters&&a.parameters.valueFor("name")&&a.parameters.valueFor("url")?b(a.parameters.valueFor("name"),a.parameters.valueFor("url")):u(k["The name and server location were not specified."])},
visibleWhen:r});p.addCommand(D);D=new b.Command({name:k["Go Up"],tooltip:k["Move up to the parent folder"],imageClass:"core-sprite-go-up",id:"eclipse.upFolder",callback:function(a){"function"===typeof B.scopeUp&&B.scopeUp()},visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=B.treeRoot;return a.Parents||"Project"===a.type}});p.addCommand(D);D=new b.Command({name:k["Go Into"],tooltip:k["Move into the selected folder"],imageClass:"core-sprite-go-down",id:"eclipse.downFolder",callback:function(a){"function"===
typeof B.scopeDown&&B.scopeDown(a.items[0])},visibleWhen:function(a){if(!B||!B.isCommandsVisible()||"function"!==typeof B.scopeDown)return!1;a=z(a);return a.Directory&&a.Location!==B.treeRoot.Location}});p.addCommand(D);D=new b.Command({name:k["Import local file..."],tooltip:k["Copy files and folders from your local file system"],imageClass:"core-sprite-importzip",id:"orion.import",callback:function(a){var b=P(a.items);(new q.ImportDialog({importLocation:b.ImportLocation,func:function(){Q({type:"import",
target:b})}})).show()},visibleWhen:U});p.addCommand(D);D=new b.Command({name:k["SFTP from..."],tooltip:k["Copy files and folders from a specified SFTP connection"],imageClass:"core-sprite-transferin",id:"orion.importSFTP",callback:function(a){var b=P(a.items);(new t.SFTPConnectionDialog({func:function(a,d,c,p,h,e){d=C.remoteImport(b.ImportLocation,{OptionHeader:e?"sftp,"+e:"sftp",Host:a,Port:d,Path:c,UserName:p,Passphrase:h});A.showWhile(d,g.formatMessage(k["Importing from ${0}"],a)).then(function(a){Q({type:"import",
target:b});u(a)},u)}})).show()},visibleWhen:U});p.addCommand(D);D=new b.Command({name:k["SFTP to..."],tooltip:k["Copy files and folders to a specified SFTP location"],imageClass:"core-sprite-transferout",id:"eclipse.exportSFTPCommand",callback:function(a){var b=z(a.items);(new t.SFTPConnectionDialog({func:function(a,d,c,p,h,e){d=C.remoteExport(b.ExportLocation,{OptionHeader:e?"sftp,"+e:"sftp",Host:a,Port:d,Path:c,UserName:p,Passphrase:h});A.showWhile(d,g.formatMessage(k.Exporting,a)).then(u,u)}})).show()},
visibleWhen:function(a){if(!B||!B.isCommandsVisible())return!1;a=z(a);return a.ExportLocation&&a.Directory}});p.addCommand(D);D=new b.Command({name:k["Copy to"],tooltip:"Copy files and folders to a specified location",id:"eclipse.copyFile",choiceCallback:function(a,b){return n(a,b,!0)},visibleWhen:F});p.addCommand(D);D=new b.Command({name:k["Move to"],tooltip:k["Move files and folders to a new location"],id:"eclipse.moveFile",choiceCallback:function(a,b){return n(a,b,!1)},visibleWhen:F});p.addCommand(D);
var aa=function(a){var b=B.getNavHandler();G&&E.forEach(function(a){b.enableItem(a)});G=!1;E=a.items},D=new b.Command({name:k.Cut,id:"eclipse.cut",callback:function(a){var b=B.getNavHandler();aa(a);E.length&&(G=!0,E.forEach(function(a){b.disableItem(a)}))},visibleWhen:F});p.addCommand(D);F=new b.Command({name:k.Copy,id:"eclipse.copySelections",callback:aa,visibleWhen:F});p.addCommand(F);F=new b.Command({name:k.Paste,id:"eclipse.pasteSelections",visibleWhen:function(a){return!B||!B.isCommandsVisible()?
!1:U(a)},callback:function(a){var b=P(a.items);if(0<E.length&&b)if(f.isAtRoot(b.Location))u(k["Cannot paste into the root"]);else{var d=G?C.moveFile:C.copyFile,c=[],p=[];E.forEach(function(a){var h=a.Location,e=a.Name||null;if(h){var f=b.Location||b.ContentLocation,q=!1;if(a.parent&&a.parent.Location===f)q=!0;else{var m=b.Children||b.children;m&&(q=m.some(function(b){return b.Name===a.Name}))}q&&((e=window.prompt(g.formatMessage(k["Enter a new name for '${0}'"],a.Name),g.formatMessage(k["Copy of ${0}"],
a.Name)))||(h=null));if(h){var e=d.apply(C,[h,f,e]),s=G?"move":"copy";p.push(A.showWhile(e,g.formatMessage(k[G?"Moving ${0}":"Pasting ${0}"],h)).then(function(d){c.push({oldValue:a,newValue:d,parent:b});Q({type:s,oldValue:a,newValue:d,parent:b,count:E.length})},u))}}});h.all(p).then(function(){Q({type:G?"moveMultiple":"copyMultiple",items:c});if(G){var a=B.getNavHandler();E.forEach(function(b){a.enableItem(b)});E=[];G=!1}})}}});p.addCommand(F);return(new h).resolve()};x.createNewContentCommand=function(a,
d,c,p,h,g,C,A){p=c?[]:[new e.CommandParameter("folderName","text",k["Folder name:"],d),new e.CommandParameter("url","url",k["Extracted from:"],p),new e.CommandParameter("unzip","boolean",k["Unzip *.zip files:"],!0)];A=null;0<p.length&&(A=new e.ParametersDescription(p));return new b.Command({name:d,parameters:A,id:a,callback:function(a){if(c)window.open(c);else if(a.parameters&&a.parameters.valueFor("folderName")){var b=a.parameters.valueFor("folderName");y(h,g,C,b,function(b){a.parameters.clientCollect=
!0;a.commandRegistry.runCommand("orion.importZipURL",b,h,a.parameters)})}else w(h,a.items,a.domNode.id,d,function(b){y(h,g,C,b,function(b){a.commandRegistry.runCommand("orion.importZipURL",b,h,a.parameters)})})},visibleWhen:function(a){if(!h||!h.isCommandsVisible())return!1;a=z(a);return a.Location&&f.isAtRoot(a.Location)}})};return x});
define("orion/widgets/projects/ProjectOptionalParametersDialog",["orion/webui/littlelib","orion/webui/dialog"],function(k,n){function l(g){this._init(g)}l.prototype=new n.Dialog;l.prototype.TEMPLATE='\x3cdiv id\x3d"message" style\x3d"width: 25em; padding-bottom: 5px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"paramsArea"\x3e\x3ctable id\x3d"paramsTable"\x3e\x3c/table\x3e\x3c/div\x3e';l.prototype._init=function(g){this.title=g.title;this._data=g.data;this._idPrefix="ParamInput_";this.modal=!0;this.buttons=[{text:"OK",
isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._func=g.func;this._initialize()};l.prototype._bindToDom=function(g){this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";var c=!0;if(this._data.parameters)for(var f in this._data.parameters.parameterTable){g=this._data.parameters.parameterNamed(f);var b=document.createElement("tr"),e=document.createElement("td"),d=document.createElement("label");d["for"]=f;d.appendChild(document.createTextNode(g.label));
e.appendChild(d);b.appendChild(e);e=document.createElement("td");"textarea"===g.type?d=document.createElement("textarea"):(d=document.createElement("input"),d.type=g.type);d.value=this._data.parameters.valueFor(f);d.id=this._idPrefix+f;e.appendChild(d);b.appendChild(e);this.$paramsTable.appendChild(b);c&&(d.focus(),c=!1)}if(this._data.parameters._options.optionalParams)for(f=0;f<this._data.parameters._options.optionalParams.length;f++)g=this._data.parameters._options.optionalParams[f],b=document.createElement("tr"),
e=document.createElement("td"),d=document.createElement("label"),d["for"]=this._idPrefix+g.id,d.appendChild(document.createTextNode(g.name)),e.appendChild(d),b.appendChild(e),e=document.createElement("td"),"textarea"===g.type?d=document.createElement("textarea"):(d=document.createElement("input"),d.type=g.type),g.value&&(d.value=g.value),d.id=this._idPrefix+g.id,e.appendChild(d),b.appendChild(e),this.$paramsTable.appendChild(b)};l.prototype.done=function(){if(this._data.parameters)for(var g in this._data.parameters.parameterTable)this._data.parameters.setValue(g,
k.node(this._idPrefix+g).value);if(this._data.parameters._options.optionalParams)for(g=0;g<this._data.parameters._options.optionalParams.length;g++){var c=this._data.parameters._options.optionalParams[g];c.value=k.node(this._idPrefix+c.id).value}this.hide();k.empty(this.$paramsTable);this._func()};l.prototype.constructor=l;return{ProjectOptionalParametersDialog:l}});
define("orion/editor/i18n",{load:function(k,n,l,g){n.specified&&n.specified("orion/bootstrap")?n(["orion/i18n!"+k],function(c){l(c)}):l({})}});
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,n){var l={root:n},g;for(g in k)k.hasOwnProperty(g)&&"undefined"===typeof l[g]&&(l[g]=k[g]);return l});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(k,n){function l(){}function g(a,b,d){this.start=a;this.end=b;this._projectionModel=d;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function c(a,b){var d=a.lastIndexOf("."),d=a.substring(d+1),c={title:k[d],style:{styleClass:"annotation "+d},html:"\x3cdiv class\x3d'annotationHTML "+d+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+d}};b?c.lineStyle=
{styleClass:"annotationLine "+d}:c.rangeStyle={styleClass:"annotationRange "+d};l.registerType(a,c)}function f(){}function b(a,b){for(var d=a.length,c=-1,e;1<d-c;)e=Math.floor((d+c)/2),b<=a[e].start?d=e:c=e;return d}function e(a){this._annotations=[];var b=this;this._listener={onChanged:function(a){b._onChanged(a)}};this.setTextModel(a)}function d(a,b){this._view=a;this._annotationModel=b;var d=this;this._listener={onDestroy:function(a){d._onDestroy(a)},onLineStyle:function(a){d._onLineStyle(a)},
onChanged:function(a){d._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",this._listener.onLineStyle);b.addEventListener("Changed",this._listener.onChanged)}g.prototype={_expandedHTML:"\x3cdiv class\x3d'annotationHTML expanded'\x3e\x3c/div\x3e",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"\x3cdiv class\x3d'annotationHTML collapsed'\x3e\x3c/div\x3e",_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},_collapseImpl:function(a){if(this._collapse()){a&&this._forEachOverlaping(function(a){a.expanded||(a._expandImpl(!1),a._recollapse=!0)});a=this._projectionModel;
var b=a.getBaseModel();this._projection={annotation:this,start:b.getLineStart(b.getLineAtOffset(this.start)+1),end:b.getLineEnd(b.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},_expandImpl:function(a){this._expand()&&(this._projectionModel.removeProjection(this._projection),a&&this._forEachOverlaping(function(a){a._recollapse&&(a._collapseImpl(!1),a._recollapse=!1)}))},_forEachOverlaping:function(a){if(this._annotationModel)for(var b=this._annotationModel.getAnnotations(this.start,
this.end);b.hasNext();){var d=b.next();d!==this&&d.type===l.ANNOTATION_FOLDING&&a.call(this,d)}},collapse:function(){this._recollapse=!1;this._collapseImpl(!0)},expand:function(){this._recollapse=!1;this._expandImpl(!0)}};l.ANNOTATION_ERROR="orion.annotation.error";l.ANNOTATION_WARNING="orion.annotation.warning";l.ANNOTATION_TASK="orion.annotation.task";l.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";l.ANNOTATION_BOOKMARK="orion.annotation.bookmark";l.ANNOTATION_FOLDING="orion.annotation.folding";
l.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";l.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";l.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";l.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";l.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";l.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";l.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";l.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";
l.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";l.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";l.ANNOTATION_BLAME="orion.annotation.blame";l.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame";var m={};l.registerType=function(a,b){var d=b;"function"!==typeof d&&(d=function(a,b,d){this.start=a;this.end=b;void 0!==d&&(this.title=d)},d.prototype=b);d.prototype.type=a;m[a]=d;return a};l.createAnnotation=function(a,b,d,c){return new (this.getType(a))(b,d,c)};l.getType=
function(a){return m[a]};c(l.ANNOTATION_ERROR);c(l.ANNOTATION_WARNING);c(l.ANNOTATION_TASK);c(l.ANNOTATION_BREAKPOINT);c(l.ANNOTATION_BOOKMARK);c(l.ANNOTATION_CURRENT_BRACKET);c(l.ANNOTATION_MATCHING_BRACKET);c(l.ANNOTATION_CURRENT_SEARCH);c(l.ANNOTATION_MATCHING_SEARCH);c(l.ANNOTATION_READ_OCCURRENCE);c(l.ANNOTATION_WRITE_OCCURRENCE);c(l.ANNOTATION_SELECTED_LINKED_GROUP);c(l.ANNOTATION_CURRENT_LINKED_GROUP);c(l.ANNOTATION_LINKED_GROUP);c(l.ANNOTATION_CURRENT_LINE,!0);c(l.ANNOTATION_BLAME,!0);c(l.ANNOTATION_CURRENT_BLAME,
!0);l.registerType(l.ANNOTATION_FOLDING,g);f.addMixin=function(a){var b=f.prototype,d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d])};f.prototype={addAnnotationType:function(a,b){this._annotationTypes||(this._annotationTypes=[]);var d=b-1;void 0==b||!(0<=d&&d<this._annotationTypes.length)?this._annotationTypes.push(a):this._annotationTypes.splice(d,0,a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a)return b+
1;return 0},getAnnotationsByType:function(a,b,d){a=a.getAnnotations(b,d);for(d=[];a.hasNext();)b=a.next(),0!==this.getAnnotationTypePriority(b.type)&&d.push(b);var c=this;d.sort(function(a,b){return c.getAnnotationTypePriority(a.type)-c.getAnnotationTypePriority(b.type)});return d},isAnnotationTypeVisible:function(a){return 0!==this.getAnnotationTypePriority(a)},removeAnnotationType:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a){this._annotationTypes.splice(b,
1);break}}};e.prototype={addAnnotation:function(a){if(a){var d=this._annotations,c=b(d,a.start);d.splice(c,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,b){var d=this._annotations,c,e=0,f;f=void 0===a&&void 0===b?function(){return e<d.length?d[e++]:null}:function(){for(;e<d.length;){var c=d[e++];if(a===c.start||(a>c.start?a<c.end:c.start<b))return c;if(c.start>=b)break}return null};
c=f();return{next:function(){var a=c;a&&(c=f());return a},hasNext:function(){return null!==c}}},modifyAnnotation:function(a){if(a&&!(0>this._getAnnotationIndex(a)))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var b=this._annotations,d,c;if(a){d=[];for(c=b.length-1;0<=c;c--){var e=b[c];e.type===a&&(b.splice(c,1),d.splice(0,0,e),e._annotationModel=null)}}else d=b;this.onChanged({type:"Changed",removed:d,
added:[],changed:[]})},removeAnnotation:function(a){if(a){var b=this._getAnnotationIndex(a);0>b||(a._annotationModel=null,a={type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]},this.onChanged(a))}},replaceAnnotations:function(a,d){var c=this._annotations,e,f,g,m=[];if(a)for(e=a.length-1;0<=e;e--)g=a[e],f=this._getAnnotationIndex(g),0>f||(g._annotationModel=null,c.splice(f,1),m.splice(0,0,g));d||(d=[]);for(e=0;e<d.length;e++)g=d[e],f=b(c,g.start),g._annotationModel=this,c.splice(f,
0,g);this.onChanged({type:"Changed",removed:m,added:d,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_getAnnotationIndex:function(a){for(var d=this._annotations,c=b(d,a.start);c<d.length&&d[c].start===a.start;){if(d[c]===a)return c;c++}return-1},_onChanged:function(a){var b=a.start,d=a.addedCharCount,c=a.removedCharCount,e=this._annotations,f=
b+c;if(0<e.length){a={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a};d-=c;for(c=0;c<e.length;c++){var g=e[c];g.start>=f?(g._oldStart=g.start,g._oldEnd=g.end,g.start+=d,g.end+=d,a.changed.push(g)):g.end<=b||(g.start<b&&f<g.end?(g._oldStart=g.start,g._oldEnd=g.end,g.end+=d,a.changed.push(g)):(e.splice(c,1),a.removed.push(g),g._annotationModel=null,g.expand&&g.expand(),c--))}if(0<a.added.length||0<a.removed.length||0<a.changed.length)this.onChanged(a)}}};n.EventTarget.addMixin(e.prototype);
d.prototype={destroy:function(){var a=this._view;a&&(a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",this._listener.onLineStyle),this.view=null);(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass=a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?a.styleClass+(" "+b.styleClass):b.styleClass;var d;b.tagName&&!a.tagName&&(a.tagName=b.tagName);if(b.style)for(d in a.style||
(a.style={}),b.style)a.style[d]||(a.style[d]=b.style[d]);if(b.attributes)for(d in a.attributes||(a.attributes={}),b.attributes)a.attributes[d]||(a.attributes[d]=b.attributes[d])}return a},_mergeStyleRanges:function(a,d){a||(a=[]);for(var c,e=b(a,d.start);e<a.length&&d;e++){var f=a[e];if(d.end<=f.start)break;if(!(d.start>=f.end)){c=this._mergeStyle({},f.style);c=this._mergeStyle(c,d.style);var g=[];g.push(e,1);d.start<f.start&&g.push({start:d.start,end:f.start,style:d.style});d.start>f.start&&g.push({start:f.start,
end:d.start,style:f.style});g.push({start:Math.max(f.start,d.start),end:Math.min(f.end,d.end),style:c});d.end<f.end&&g.push({start:d.end,end:f.end,style:f.style});d=d.end>f.end?{start:f.end,end:d.end,style:d.style}:null;Array.prototype.splice.apply(a,g)}}d&&(c=this._mergeStyle({},d.style),a.splice(e,0,{start:d.start,end:d.end,style:c}));return a},_onAnnotationModelChanged:function(a){function b(a,d){f.getBaseModel&&(a=f.mapOffset(a,!0),d=f.mapOffset(d,!0));-1!==a&&-1!==d&&c.redrawRange(a,d)}function d(a,
c){for(var f=0;f<a.length;f++)if(e.isAnnotationTypeVisible(a[f].type)){var g=a[f];b(g.start,g.end);c&&void 0!==g._oldStart&&g._oldEnd&&b(g._oldStart,g._oldEnd)}}var c=this._view;if(c){var e=this,f=c.getModel();d(a.added);d(a.removed);d(a.changed,!0)}},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){var b=this._annotationModel,d=a.textView.getModel(),c=b.getTextModel(),e=a.lineStart,f=a.lineStart+a.lineText.length;c!==d&&(e=d.mapOffset(e),f=d.mapOffset(f));for(b=b.getAnnotations(e,
f);b.hasNext();)if(e=b.next(),this.isAnnotationTypeVisible(e.type)){if(e.rangeStyle){var f=e.start,g=e.end;c!==d&&(f=d.mapOffset(f,!0),g=d.mapOffset(g,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:f,end:g,style:e.rangeStyle})}e.lineStyle&&(a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,e.lineStyle))}}};f.addMixin(d.prototype);return{FoldingAnnotation:g,AnnotationType:l,AnnotationTypeList:f,AnnotationModel:e,AnnotationStyler:d}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate","orion/edit/editorContext"],function(k,n,l,g){function c(c,b){for(var e=b.getFileMetadata(),d=c.getServiceReferences("orion.edit.blamer"),g=0;g<d.length;g++){var a=d[g],h={};h.validationProperties=a.getProperty("validationProperties");h.forceSingleItem=!0;h=k._makeValidator(h,c);if(h.validationFunction.bind(h)(e))return c.getService(a)}return null}return{isVisible:function(f,b){return!!c(f,b)&&!!f.getService("orion.core.blame")},
getBlame:function(f,b){var e=c(f,b);if(e){var d=function(a){for(var b=n.getOrionHome(),d=0;d<a.length;d++){var c=a[d],e=new l(c.CommitLink),g={};g.OrionHome=b;c.CommitLink=e.expand(g)}f.getService("orion.core.blame")._setAnnotations(a)};if(e.computeBlame){var m={metadata:b.getFileMetadata()};e.computeBlame(g.getEditorContext(f),m).then(d)}else e.doBlame(b.getInput()).then(d)}}}});
define("orion/editorCommands","i18n!orion/edit/nls/messages orion/i18nUtil orion/webui/littlelib orion/webui/dialogs/OpenResourceDialog orion/widgets/input/DropDownMenu orion/Deferred orion/URITemplate orion/commands orion/keyBinding orion/commandRegistry orion/extensionCommands orion/contentTypes orion/searchUtils orion/PageUtil orion/PageLinks orion/editor/annotations orion/blamer orion/regex orion/util orion/edit/editorContext".split(" "),function(k,n,l,g,c,f,b,e,d,m,a,h,s,t,q,r,v,u,w,z){function y(a){var d=
new b(a.uriTemplate),c=a.params||{};c.OrionHome=c.OrionHome||q.getOrionHome();var d=d.expand(c),p=document.createElement("div"),e=document.createElement("iframe");e.id=a.id;e.name=a.id;e.type="text/html";e.sandbox="allow-scripts allow-same-origin";e.frameborder=void 0!==a.border?a.border:1;e.src=d;e.className="delegatedUI";a.width&&(p.style.width=a.width,e.style.width=a.width);a.height&&(p.style.height=a.height,e.style.height=a.height);e.style.visibility="hidden";null!==a.parent&&(a.parent||window.document.body).appendChild(p);
p.appendChild(e);e.style.left=a.left||(window.innerWidth-parseInt(e.clientWidth,10))/2+"px";e.style.top=a.top||(window.innerHeight-parseInt(e.clientHeight,10))/2+"px";e.style.visibility="";window.addEventListener("message",function I(b){if(b.source===e.contentWindow&&"string"===typeof b.data&&(b=JSON.parse(b.data),"orion.page.delegatedUI"===b.pageService&&b.source===a.id)){if(b.cancelled)a.cancelled&&a.cancelled();else if(b.result)a.done&&a.done(b.result);else if(b.Status||b.status)a.status&&a.status(b.Status||
b.status);window.removeEventListener("message",I,!1);p.parentNode&&p.parentNode.removeChild(p)}},!1);return p}function x(a){this.serviceRegistry=a.serviceRegistry;this.commandService=a.commandRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.toolbarId=a.toolbarId;this.saveToolbarId=a.saveToolbarId;this.editToolbarId=a.editToolbarId;this.pageNavId=a.navToolbarId;this.isReadOnly=a.readonly;this._localSearcher=a.textSearcher;this._searcher=a.searcher;this.editorSettings=a.editorSettings;
this.localSettings=a.localSettings}var p={},A=null;p.createDelegatedUI=y;x.prototype={generateSimpleEditorCommands:function(a,b){this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a,b));this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a)},generateEditorCommands:function(a){this.generateBaseEditorCommands(a);this.generateExtraEditorCommands(a)},generateBaseEditorCommands:function(a){this.isReadOnly||(this._generateUndoStackCommands(a),
this._generateSaveCommand(a),this._generateEditCommands(a))},generateExtraEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a)},_generateSettingsCommand:function(a){var b=this,p=new e.Command({imageClass:"core-sprite-wrench",tooltip:k.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return a.installed},callback:function(d){var e=p.settingsDropDown;if(!e||
e.isDestroyed())e=p.settingsDropDown=new c(d.domNode.parentNode,d.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){e.focus()},onHide:function(){a.focus()}}),e.updateContent=b.localSettings.show.bind(b.localSettings),d=e.getContentNode(),d.tabIndex=d.style.marginTop=0;e.click()}});this.commandService.addCommand(p);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new d.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(a){var b=
new e.Command({name:k.Undo,id:"orion.undo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().undo()}});this.commandService.addCommand(b);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.undo",400,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,new d.KeyBinding("z",!0));b=new e.Command({name:k.Redo,id:"orion.redo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().redo()}});
this.commandService.addCommand(b);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.redo",401,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,w.isMac?new d.KeyBinding("z",!0,!0):new d.KeyBinding("y",!0))},_generateSearchFilesCommand:function(a){var b=this;if(b._searcher){var c=!1,p=new e.Command({name:k.searchFiles,tooltip:k.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return a.installed},callback:function(d){if(!c){d=
a.getSelection();d=a.getText(d.start,d.end);var p=b.serviceRegistry.getService("orion.page.progress"),e=new g.OpenResourceDialog({searcher:b._searcher,progress:p,searchRenderer:b._searcher.defaultRenderer,nameSearch:!1,title:k.searchFiles,message:k.searchTerm,initialText:d,onHide:function(){c=!1;a.focus()}});window.setTimeout(function(){c=!0;e.show(l.node(b.toolbarId))},0)}}});this.commandService.addCommand(p);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.searchFiles",
1,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("h",!0))}},_generateSaveCommand:function(a,b){var c=this,p=b?b:"orion.save",h=new e.Command({name:k.Save,tooltip:k.saveFile,id:p,visibleWhen:function(){return!a.installed||c.inputManager.getReadOnly()?!1:!0},callback:function(a){c.inputManager.save();return!0}});this.commandService.addCommand(h);this.commandService.registerCommandContribution(this.saveToolbarId||this.toolbarId,p,1,this.saveToolbarId?
"orion.menuBarFileGroup/orion.saveGroup":null,!1,new d.KeyBinding("s",!0));a.getTextView&&a.getTextView()&&(a.getTextView().setKeyBinding(new d.KeyBinding("s",!0),"save"),a.getTextView().setAction("save",h.callback,h))},_generateGotoLineCommnand:function(a){var b=this,c=new m.ParametersDescription([new m.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var b=a.getModel().getLineAtOffset(a.getCaretOffset())+1;return[new m.CommandParameter("line","number","Line:",b.toString())]}),
c=new e.Command({name:k.gotoLine,tooltip:k.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return a.installed},parameters:c,callback:function(b){var d=a.getModel();b.parameters&&b.parameters.valueFor("line")?b=b.parameters.valueFor("line"):(b=d.getLineAtOffset(a.getCaretOffset()),(b=prompt(k.gotoLinePrompt,b+1))&&(b=parseInt(b,10)));if(b)a.onGotoLine(b-1,0)}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.gotoLine",
3,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("l",!w.isMac,!1,!1,w.isMac),new m.URLBinding("gotoLine","line"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("gotoLine",function(d){if(d)return a.onGotoLine(d.line-1,0,void 0,d.callback),!0;b.commandService.runCommand("orion.gotoLine");return!0},c)},_generateFindCommnand:function(a){var b=this,c=new m.ParametersDescription([new m.CommandParameter("find","text","Find:")],{clientCollect:!0},
function(){var d=a.getSelection(),c="";d.end>d.start&&(c=a.getModel().getText(d.start,d.end),b._localSearcher&&b._localSearcher.getOptions().regex&&(c=u.escape(c)));return[new m.CommandParameter("find","text","Find:",c)]}),c=new e.Command({name:k.Find,tooltip:k.Find,id:"orion.editor.find",visibleWhen:function(){return a.installed},parameters:c,callback:function(d){if(b._localSearcher){var c="",p=null,e=a.getSelection();e.end>e.start&&d.parameters.valueFor("useEditorSelection")?(c=a.getModel().getText(e.start,
e.end),b._localSearcher.getOptions().regex&&(c=u.escape(c))):d.parameters&&d.parameters.valueFor("find")&&(c=d.parameters.valueFor("find"),p=t.matchResourceParameters(),s.convertFindURLBinding(p));p?(b._localSearcher.setOptions({regex:p.regEx,caseInsensitive:!p.caseSensitive}),d={},p.atLine&&(d.start=a.getModel().getLineStart(p.atLine-1)),b._localSearcher.show({findString:c,replaceString:p.replaceWith}),b._localSearcher.find(!0,d)):b._localSearcher.show({findString:c});return!0}return!1}});this.commandService.addCommand(c);
this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.editor.find",0,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("f",!0),new m.URLBinding("find","find"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("find",function(a){if(a)return b._localSearcher.show(a),!0;b.commandService.runCommand("orion.editor.find",null,null,new m.ParametersDescription([new m.CommandParameter("useEditorSelection","text",
"","true")],{clientCollect:!0}));return!0},c)},_generateBlame:function(a){var b=this,c=new e.Command({name:k.Blame,tooltip:k.BlameTooltip,id:"orion.edit.blame",parameters:new m.ParametersDescription([new m.CommandParameter("blame","boolean")],{clientCollect:!0}),visibleWhen:function(){return!a.installed?!1:v.isVisible(b.serviceRegistry,b.inputManager)},callback:function(d){for(var c=!1,p=a.getAnnotationModel().getAnnotations();p.hasNext();)if(p.next().type===r.AnnotationType.ANNOTATION_BLAME){c=!0;
break}c=!c;d.parameters&&d.parameters.valueFor("blame")&&(c="true"===d.parameters.valueFor("blame"));c?v.getBlame(b.serviceRegistry,b.inputManager):a.showBlame([])}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",1,"orion.menuBarToolsGroup",!1,new d.KeyBinding("b",!0,!0),new m.URLBinding("blame","blame"))},_generateEditCommands:function(b){function c(a){if(!a)return null;var b=new d.KeyBinding;d.KeyBinding.apply(b,a);return b}function p(a,
b){!b&&a&&"undefined"!==typeof a.HTML&&delete a.HTML;var d=g.serviceRegistry.getService("orion.page.message");d?d.setProgressResult(a):window.console.log(a)}var g=this,q=this.toolbarId,m=this.serviceRegistry,s=m.getServiceReferences("orion.edit.command"),t=this.inputManager,r=m.getService("orion.page.progress"),v=function(a,d,c){var h=c.visibleWhen;c.visibleWhen=function(a){return!b.installed||g.inputManager.getReadOnly()?!1:!h||h(a)};c.callback=function(c){b=this;var e=b.getSelection?b.getSelection():
{start:0,end:0};c=b.getModel();var h=function(a){"object"===typeof a&&a?(a.text&&b.setText(a.text),a.selection&&(b.setSelection&&b.setSelection(a.selection.start,a.selection.end,!0),b.focus())):"string"===typeof a&&(b.setText(a,e.start,e.end,!0),b.setSelection&&b.setSelection(e.start,e.start+a.length),b.focus())},f;d.execute?(c={contentType:t.getContentType(),input:t.getInput()},f=z.getEditorContext(m),f.openDelegatedUI=y,f.setStatus=p,c=d.execute(f,c),f=null):(c=d.run(c.getText(e.start,e.end),c.getText(),
e,t.getInput()),f=function(b){if(b&&b.uriTemplate){var d={};d.uriTemplate=b.uriTemplate;d.params=t.getFileMetadata();d.id=a.id;d.width=b.width;d.height=b.height;d.done=h;d.status=p;y(d)}else b&&(b.Status||b.status)?p(b.Status||b.status):h(b)});r.showWhile(c,n.formatMessage(k.running,a.name)).then(f);return!0};c.callback=c.callback.bind(b);return new e.Command(c)};f.when(function(a){if(A)return A;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new h.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));
return b.getContentTypes().then(function(a){return A=a})}(this.serviceRegistry),function(){var d=[],p=100;s.forEach(function(e){var h=e.getProperty("editor");if(!h||!(b.id&&h!==b.id)){for(var f=g.serviceRegistry.getService(e),q={},h=e.getPropertyKeys(),m=0;m<h.length;m++)q[h[m]]=e.getProperty(h[m]);q.forceSingleItem=!0;e=a._createCommandOptions(q,e,g.serviceRegistry,A,!1,function(a){return t.getFileMetadata()});d.push(e);e.then(function(a){a=v(q,f,a);g.commandService.addCommand(a);g.commandService.registerCommandContribution(g.toolbarId,
a.id,p,"orion.menuBarToolsGroup",!1,c(q.key))});p++}});f.all(d,function(a){return{_error:a}}).then(function(a){if(a=t.getFileMetadata()){var d=l.node(q);d&&(g.commandService.destroy(d),g.commandService.renderCommands(d.id,d,a,b,"button"));if(d=l.node("pageNavigationActions"))g.commandService.destroy(d),g.commandService.renderCommands(d.id,d,b,b,"button")}})})}};p.EditorCommandFactory=x;return p});
define("orion/projectCommands","require i18n!orion/navigate/nls/messages orion/webui/littlelib orion/commands orion/Deferred orion/webui/dialogs/DirectoryPrompterDialog orion/commandRegistry orion/i18nUtil orion/webui/dialogs/ImportDialog orion/widgets/projects/ProjectOptionalParametersDialog orion/fileCommands orion/editorCommands orion/EventTarget orion/URITemplate orion/PageLinks orion/objects orion/preferences".split(" "),function(k,n,l,g,c,f,b,e,d,m,a,h,s,t,q,r,v){function u(a){if(!a)return{};
Array.isArray(a)&&(a=1===a.length?a[0]:{});return a}function w(a,d){if(!a)return null;for(var c=[],p=0;p<a.length;p++)c.push(new b.CommandParameter(a[p].id,a[p].type,a[p].name));return new b.ParametersDescription(c,{hasOptionalParameters:!!d,optionalParams:d})}function z(a,b,d){if(b.parameters&&b.parameters.optionsRequested)(new m.ProjectOptionalParametersDialog({title:d,data:b,func:function(){b.parameters.optionsRequested=!1;a(b)}.bind(this)})).show();else{d=b.oldParams||{};if(b.parameters)for(var c in b.parameters.parameterTable)d[c]=
b.parameters.valueFor(c);if(b.parameters&&b.parameters._options.optionalParams)for(var p=0;p<b.parameters._options.optionalParams.length;p++)c=b.parameters._options.optionalParams[p],d[c.id]=c.value;return d}}function y(a,b,d){!b&&a&&"undefined"!==typeof a.HTML&&delete a.HTML;a.Retry&&a.Retry.parameters?(a.forceShowMessage&&B.setProgressResult(a),d.data.parameters=w(a.Retry.parameters,a.Retry.optionalParameters),d.data.oldParams=d.oldParams,d.commandService.collectParameters(d.data)):(x(d.project.Name,
d.deployService,d.launchConfiguration),B.setProgressResult(a));a.ToSave&&B.showWhile(d.projectClient.saveProjectLaunchConfiguration(d.project,a.ToSave.ConfigurationName,d.deployService.id,a.ToSave.Parameters,a.ToSave.Url,a.ToSave.ManageUrl,a.ToSave.Path,a.ToSave.UrlTitle,a.ToSave.Type),"Saving configuration").then(function(a){x(d.project.Name,d.deployService,a);E&&E.dispatchEvent({type:"create",newValue:a})},d.errorHandler)}function x(a,b,d){var c;J&&(c=d?"orion.launchConfiguration.deploy."+d.ServiceId+
d.Name:"orion.project.deploy."+b.id,J.put(a,c));E&&E.dispatchEvent({type:"changedDefault",newValue:c})}function p(a,b){E&&b.launchConfiguration&&(b.launchConfiguration.status={State:"PROGRESS"},E.dispatchEvent({type:"changeState",newValue:b.launchConfiguration}));B.showWhile(b.deployService.deploy(b.project,a),b.deployService.name+" in progress",!0).then(function(d){if(d)if(d.UriTemplate){var c={};c.uriTemplate=d.UriTemplate;c.width=d.Width;c.height=d.Height;c.id=d.UriTemplateId||b.deployService.id;
b.oldParams=a.Params;c.done=function(a){y(a,null,b)};c.status=function(a){y(a,null,b)};h.createDelegatedUI(c)}else{if(b.launchConfiguration&&(d.State||d.CheckState))b.launchConfiguration.status=d,E&&E.dispatchEvent({type:"changeState",newValue:b.launchConfiguration});d.ToSave?B.showWhile(b.projectClient.saveProjectLaunchConfiguration(b.project,d.ToSave.ConfigurationName,b.deployService.id,d.ToSave.Parameters,d.ToSave.Url,d.ToSave.ManageUrl,d.ToSave.Path,d.ToSave.UrlTitle,d.ToSave.Type),"Saving configuration").then(function(a){x(b.project.Name,
b.deployService,a);E&&E.dispatchEvent({type:"create",newValue:a})},b.errorHandler):x(b.project.Name,b.deployService,b.launchConfiguration);d={Severity:"Info",HTML:!0};d.Message='Use \x3ca href\x3d"'+k.toUrl("edit/edit.html#"+b.project.ContentLocation)+'"\x3eProject\x3c/a\x3e page to view and manage the application.';B.setProgressResult(d)}},function(d){d.Retry&&d.Retry.parameters?(d.forceShowMessage&&b.errorHandler(d),b.data.parameters=w(d.Retry.parameters,d.Retry.optionalParameters),b.data.oldParams=
a.Params,b.commandService.collectParameters(b.data)):(b.errorHandler(d),x(b.project.Name,b.deployService,b.launchConfiguration))})}function A(a,b,d,c,p,e,h,f){var g;g=c.actionComment?f?c.actionComment.replace(/\$\{([^\}]+)\}/g,function(a,b){return f[b]}):c.actionComment:"Getting content from "+c.type;B.showWhile(c.initDependency(p,f,e),g).then(function(b){a.addProjectDependency(e,b).then(function(){G&&G.dispatchEvent({type:"create",newValue:b,project:e})},d)},function(a){a.Retry&&a.Retry.addParameters&&
(h.parameters=w(a.Retry.addParameters,a.Retry.optionalParameters),h.oldParams=f,b.collectParameters(h));d(a)})}var C={},B,J,E;C.getLaunchConfigurationDispatcher=function(){E||(E=new s);return E};C.getDefaultLaunchCommand=function(a){if(J)return J.get(a)};var G;C.getDependencyDispatcher=function(){G||(G=new s);return G};C.updateProjectNavCommands=function(a,b,d,c,e){function h(a){B?B.setProgressResult(a):window.console.log(a)}for(var f=0;f<b.length;f++)(function(b){var f=new g.Command({name:"Deploy to "+
b.Name,tooltip:"Deploy to "+b.Name,id:"orion.launchConfiguration.deploy."+b.ServiceId+b.Name,imageClass:"core-sprite-deploy",callback:function(f){var g=u(f.items);f.oldParams||(f.oldParams=b.Params);var A=z(arguments.callee,f,"Deploy "+g.Name);if(A){var C=r.clone(b);C.Params=A;c.getProjectDelpoyService(b.ServiceId,b.Type).then(function(A){A&&A.deploy&&e.loadWorkspace(g.Project.ContentLocation).then(function(e){p(C,{project:a.Project,deployService:A,data:f,errorHandler:h,projectClient:c,commandService:d,
launchConfiguration:b})})})}},visibleWhen:function(b){return!(void 0==f.showCommand||f.showCommand)?!1:u(b).Project===a.Project}});f.isLaunchProject=!0;d.addCommand(f)})(b[f])};C.createDependencyCommands=function(a,b,d,c,h){function f(a){B?B.setProgressResult(a):window.console.log(a)}function C(a){var d=new g.Command({name:a?"Start":"Stop",tooltip:a?"Start application":"Stop application",id:a?"orion.launchConfiguration.startApp":"orion.launchConfiguration.stopApp",imageClass:a?"core-sprite-start":
"core-sprite-stop",callback:function(d){var p=u(d.items);d.oldParams=p.Params;var e=z(arguments.callee,d,a?"Start application":"Stop application");e&&c.getProjectDelpoyService(p.ServiceId,p.Type).then(function(h){if(h&&(a?h.start:h.stop))E&&(p.status={State:"PROGRESS"},E.dispatchEvent({type:"changeState",newValue:p})),(a?h.start:h.stop)(e).then(function(a){p.status=a;E&&E.dispatchEvent({type:"changeState",newValue:p});a.ToSave&&B.showWhile(c.saveProjectLaunchConfiguration(p.project,a.ToSave.ConfigurationName,
h.id,a.ToSave.Parameters,a.ToSave.Url,a.ToSave.ManageUrl,a.ToSave.Path,a.ToSave.UrlTitle,a.ToSave.Type),"Saving configuration").then(function(a){x(p.project.Name,h,a);E&&E.dispatchEvent({type:"create",newValue:a})},f)},function(a){a.Retry?(d.parameters=w(a.Retry.parameters,a.Retry.optionalParameters),d.oldParams=e,b.collectParameters(d)):f(a)})})},visibleWhen:function(b){b=u(b);return b.ServiceId&&b.Name&&b.status&&(a?"STOPPED"===b.status.State:"STARTED"===b.status.State)}});b.addCommand(d)}B=a.getService("orion.page.progress");
a=new g.Command({name:"Connect",tooltip:"Fetch content",id:"orion.project.dependency.connect",callback:function(a){var d=u(a.items),p=z(arguments.callee,a,"Fetch content of "+d.Dependency.Name);if(p){var e=c.getProjectHandler(d.Dependency.Type);e.then?e.then(function(e){A(c,b,f,e,d.Dependency,d.Project,a,p)}):A(c,b,f,e,d.Dependency,d.Project,a,p)}},visibleWhen:function(a){if(!a.Dependency||!a.Project||!a.disconnected)return!1;if(h)for(var b=0;b<h.length;b++)if(h[b]===a.Dependency.Type)return!0;return!1}});
b.addCommand(a);a=new g.Command({name:"Disconnect from project",tooltip:"Do not treat this folder as a part of the project",imageClass:"core-sprite-delete",id:"orion.project.dependency.disconnect",callback:function(a){var b=u(a.items);B.progress(c.removeProjectDependency(b.Project,b.Dependency),e.formatMessage("Removing ${0} from project ${1}",b.Dependency.Name,b.Project.Name)).then(function(a){G&&G.dispatchEvent({type:"delete",oldValue:b.Dependency,project:b.Project})})},visibleWhen:function(a){return!a.Dependency||
!a.Project?!1:!0}});b.addCommand(a);a=new g.Command({name:"Check status",tooltip:"Check application status",id:"orion.launchConfiguration.checkStatus",callback:function(a){var d=u(a.items);if(a.parameters){var p=z(arguments.callee,a,"Check application state");p&&c.getProjectDelpoyService(d.ServiceId,d.Type).then(function(c){E&&(d.status={State:"PROGRESS"},E.dispatchEvent({type:"changeState",newValue:d}));c&&c.getState&&c.getState(p).then(function(a){d.status=a;E&&E.dispatchEvent({type:"changeState",
newValue:d});d.project&&d.project.children&&d.project.children.forEach(function(a){d.ServiceId&&d.Name&&d.parametersRequested&&a.ServiceId===d.ServiceId&&a.Name!==d.Name&&E&&(a.status={CheckState:!0},E.dispatchEvent({type:"changeState",newValue:a}))})},function(c){c.Retry?(a.parameters=w(c.Retry.parameters,c.Retry.optionalParameters),a.oldParams=p,b.collectParameters(a)):(f(c),d.status={error:c},E&&E.dispatchEvent({type:"changeState",newValue:d}))})})}else a.parameters=w(d.parametersRequested,d.optionalParameters),
a.oldParams=d.Params,b.collectParameters(a)},visibleWhen:function(a){a=u(a);return a.ServiceId&&a.Name&&a.parametersRequested}});b.addCommand(a);C(!0);C(!1);a=new g.Command({name:"Manage",tooltip:"Manage this application on remote server",id:"orion.launchConfiguration.manage",hrefCallback:function(a){var b=u(a.items);if(b.ManageUrl)return a=new t(b.ManageUrl),b=r.clone(b.Params),b.OrionHome=q.getOrionHome(),a=a.expand(b),a.indexOf("://")||(a="http://"+a),a},visibleWhen:function(a){return u(a).ManageUrl}});
b.addCommand(a);a=new g.Command({name:"Deploy",tooltip:"Deploy this application again",id:"orion.launchConfiguration.deploy",imageClass:"core-sprite-deploy",callback:function(a){var e=u(a.items);a.oldParams||(a.oldParams=e.Params);var h=z(arguments.callee,a,"Deploy "+e.Name);if(h){var g=r.clone(e);g.Params=h;c.getProjectDelpoyService(e.ServiceId,e.Type).then(function(h){h&&h.deploy&&d.loadWorkspace(e.project.ContentLocation).then(function(d){p(g,{project:e.project,deployService:h,data:a,errorHandler:f,
projectClient:c,commandService:b,launchConfiguration:e})})})}},visibleWhen:function(a){a=u(a);return a.ServiceId&&a.Name}});b.addCommand(a)};C.getAddDependencyCommands=function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];c.isAddDependency&&b.push(c)}return b};C.getCreateProjectCommands=function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];c.isCreateProject&&b.push(c)}return b};C.getDeployProjectCommands=function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];
c.isDeployProject&&b.push(c)}return b};C.getLaunchProjectCommands=function(a){var b=[],d;for(d in a._commandList){var c=a._commandList[d];c.isLaunchProject&&b.push(c)}return b};var H;C.setExplorer=function(a){H=a};C.createProjectCommands=function(e,h,q,m,k,s){function l(a){B?B.setProgressResult(a):window.console.log(a)}function t(b,d){var c=a.getModelEventDispatcher();d.ContentLocation?q.read(d.ContentLocation,!0).then(function(a){c.dispatchEvent({type:"create",parent:b,newValue:a})},function(){c.dispatchEvent({type:"create",
parent:b,newValue:null})}):c.dispatchEvent({type:"create",parent:b,newValue:null})}function r(a){return m.getProjectHandler(a).then(function(b){if(b.initDependency){var d={name:b.addDependencyName,id:"orion.project.adddependency."+a,tooltip:b.addDependencyTooltip,callback:function(a){var d=u(a.items).Project,p=z(arguments.callee,a,b.addDependencyTooltip);if(p){var e=new c;b.paramsToDependencyDescription(p).then(function(a){a&&a.Location?q.loadWorkspace(d.WorkspaceLocation).then(function(d){for(var p=
[],h=!1,f=0;f<d.Children.length&&!0!==h;f++){var g=b.getDependencyDescription(d.Children[f]);p.push(g);(function(b,d){d.then(function(b){b&&b.Location===a.Location&&(h=!0,e.resolve(b))})})(f,g)}c.all(p).then(function(){h||e.resolve()})},e.reject):e.resolve()},l);B.showWhile(e,"Searching your workspace for matching content").then(function(c){c?m.addProjectDependency(d,c).then(function(){G&&G.dispatchEvent({type:"create",newValue:c,project:d})},l):A(m,h,l,b,{},d,a,p)})}},visibleWhen:function(a){return!H||
!H.isCommandsVisible()?!1:"Project"===a.type||"Project"===H.treeRoot.type}};d.parameters=w(b.addParameters,b.optionalParameters);d=new g.Command(d);d.isAddDependency=!0;h.addCommand(d)}})}function y(a){return m.getProjectHandler(a).then(function(b){if(b.initProject){var d={name:b.addProjectName,id:"orion.project.createproject."+a,tooltip:b.addProjectTooltip,callback:function(a){var d=arguments.callee,c=u(a.items),p=z(d,a,b.addProjectTooltip);p&&(d=b.actionComment?p?b.actionComment.replace(/\$\{([^\}]+)\}/g,
function(a,b){return p[b]}):b.actionComment:"Getting content from "+b.type,B.showWhile(b.initProject(p,{WorkspaceLocation:c.Location}),d).then(function(a){t(c,a)},function(b){b.Retry&&b.Retry.addParameters&&(a.parameters=w(b.Retry.addParameters,b.Retry.optionalParameters),a.oldParams=p,h.collectParameters(a));l(b)}))},visibleWhen:function(a){if(!H||!H.isCommandsVisible())return!1;a=u(a);return a.Location}};d.parameters=w(b.addParameters,b.optionalParameters);d=new g.Command(d);d.isCreateProject=!0;
h.addCommand(d)}})}function E(a){var b,d={name:a.name,tootlip:a.tooltip,id:"orion.project.deploy."+a.id,callback:function(b){var d=H.selection.getSelections(),c=d&&0<d.length?u(d):H.treeRoot,d=c.Project,c=c.Location?c.Location.replace(d.ContentLocation,""):"",e=z(arguments.callee,b,a.tooltip);e&&p({Params:e,Path:c},{project:d,deployService:a,data:b,errorHandler:l,projectClient:m,commandService:h})},visibleWhen:function(d){if(!(void 0==b.showCommand||b.showCommand))return!1;d=H.treeRoot;return!d.Project||
!d.children||0===d.children.length?!1:m.matchesDeployService(d.children[0],a)}};d.parameters=w(a.parameters,a.optionalParameters);b=new g.Command(d);b.isDeployProject=!0;h.addCommand(b)}J||(new v.PreferencesService(e)).getPreferences("/deploy/project").then(function(a){J=a});B=e.getService("orion.page.progress");k=k||[];var x=new g.Command({name:"Associated Folder",tooltip:"Associate a folder from the workspace with this project.",id:"orion.project.addFolder",callback:function(a){var b=u(a.items).Project;
(new f.DirectoryPrompterDialog({title:n["Choose a Folder"],serviceRegistry:e,fileClient:q,func:function(a){q.read(a.Location,!0).then(function(a){function d(){var c="",p=a.Name;if(a.Parents&&0<a.Parents.length){for(var e=a.Parents.length-1;0<=e;e--)c+=a.Parents[e].Name,c+="/";p+=" ("+a.Parents[a.Parents.length-1].Name+")"}var c=c+a.Name,h={Name:p,Type:"file",Location:c};m.addProjectDependency(b,{Name:p,Type:"file",Location:c}).then(function(){G&&G.dispatchEvent({type:"create",newValue:h,project:b})},
l)}if(!a.Parents||0===a.Parents.length){for(var p=[],e=!1,h=0;h<k.length;h++){if(e)return;var f=m.getProjectHandler(k[h]).then(function(b){return b.getDependencyDescription(a)});p.push(f);f.then(function(a){a&&(e=!0,m.addProjectDependency(b,a).then(function(){G&&G.dispatchEvent({type:"create",newValue:a,project:b})},l))})}c.all(p).then(function(){e||d()})}else d()},l)}})).show()},visibleWhen:function(a){return!H||!H.isCommandsVisible()?!1:"Project"===a.type||"Project"===H.treeRoot.type}});x.isAddDependency=
!0;h.addCommand(x);x=new g.Command({name:"Convert to project",tooltip:"Convert this folder into a project",id:"orion.project.initProject",callback:function(a){var b=u(a.items);if(b){var d=function(){m.initProject(b.Location).then(function(a){q.read(b.Location,!0).then(function(a){H.changedItem(b,!0)},l);t(b,a)},l)};m.readProject(b).then(function(a){a?(B.setProgressResult({Message:"This folder is a project already.",Severity:"Warning"}),H.changedItem(b,!0)):d()},d)}},visibleWhen:function(a){if(!H||
!H.isCommandsVisible())return!1;if((a=u(a))&&(a.parent&&a.parent.Projects||a.Parents&&0===a.Parents.length)){if(a.children)for(var b=0;b<a.children.length;b++)if(a.children[b].Name&&!a.children[b].Directory&&"project.json"===a.children[b].Name.toLowerCase())return!1;return!0}return!1}});h.addCommand(x);for(var x=[],F=0;F<k.length;F++){var D=k[F];x.push(r(D));x.push(y(D))}F=new g.Command({name:"Readme File",tooltip:"Create a README.md file in this project",id:"orion.project.create.readme",callback:function(b){var d=
u(b.items);B.progress(q.createFile(d.Project.ContentLocation,"README.md"),"Creating README.md").then(function(b){function c(){a.getModelEventDispatcher().dispatchEvent({type:"create",parent:d,newValue:b})}d.Project?B.progress(q.write(b.Location,"# "+d.Project.Name),"Writing sample readme").then(function(){c()}):c()})},visibleWhen:function(a){if(!H||!H.isCommandsVisible())return!1;a=u(a);if(!a.Project||!a.Project.children||!a.Project.ContentLocation)return!1;for(var b=0;b<a.Project.children.length;b++)if(a.Project.children[b].Name&&
"readme.md"===a.Project.children[b].Name.toLowerCase())return!1;return!0}});h.addCommand(F);F=new g.Command({name:"Basic",tooltip:"Create an empty project.",id:"orion.project.create.basic",parameters:new b.ParametersDescription([new b.CommandParameter("name","text","Name: ")]),callback:function(a){var b=a.parameters.valueFor("name");b&&(a=u(a.items),q.loadWorkspace(q.fileServiceRootURL(a.Location)).then(function(a){B.progress(m.createProject(a.ChildrenLocation,{Name:b}),"Creating project "+b).then(function(b){t(a,
b)})}))},visibleWhen:function(a){if(!H||!H.isCommandsVisible())return!1;a=u(a);return!!a.Location}});F.isCreateProject=!0;h.addCommand(F);F=new g.Command({name:"File System",tooltip:"Create project from a local zipped file.",id:"orion.project.create.fromfile",parameters:new b.ParametersDescription([new b.CommandParameter("name","text","Name: ")]),callback:function(a){var b=a.parameters.valueFor("name");b&&(a=u(a.items),q.loadWorkspace(q.fileServiceRootURL(a.Location)).then(function(a){B.progress(m.createProject(a.ChildrenLocation,
{Name:b}),"Creating project "+b).then(function(b){B.progress(q.read(b.ContentLocation,!0)).then(function(c){(new d.ImportDialog({importLocation:c.ImportLocation,func:function(){t(a,b)}})).show()})})}))},visibleWhen:function(a){if(!H||!H.isCommandsVisible())return!1;a=u(a);return!!a.Location}});F.isCreateProject=!0;h.addCommand(F);F=new g.Command({name:"SFTP",tooltip:"Create a project from an SFTP site.",id:"orion.project.create.sftp",parameters:new b.ParametersDescription([new b.CommandParameter("name",
"text","Name:"),new b.CommandParameter("url","url","Url:")]),callback:function(a){var b=a.parameters.valueFor("name");if(b){var d=a.parameters.valueFor("url");d&&(a=u(a.items),q.loadWorkspace(q.fileServiceRootURL(a.Location)).then(function(a){B.progress(m.createProject(a.ChildrenLocation,{Name:b,ContentLocation:d}),"Creating project "+b).then(function(b){t(a,b)})}))}},visibleWhen:function(a){if(!H||!H.isCommandsVisible())return!1;a=u(a);return!!a.Location}});F.isCreateProject=!0;h.addCommand(F);C.createDependencyCommands(e,
h,q,m,k);if(s)for(F=0;F<s.length;F++){var L=s[F],D=new c;x.push(D);(function(a){m.getProjectDelpoyService(L).then(function(b){E(b);a.resolve()})})(D)}return c.all(x)};return C});define("text!orion/webui/dropdownseparator.html",[],function(){return'\x3cli class\x3d"dropdownSeparator"\x3e\x3cspan class\x3d"dropdownSeparator"\x3e\x3c/span\x3e\x3c/li\x3e'});
define("orion/webui/contextmenu","orion/webui/littlelib orion/webui/dropdown orion/objects orion/webui/tooltip i18n!orion/nls/messages text!orion/webui/dropdownseparator.html".split(" "),function(k,n,l,g,c,f){function b(b){b.skipTriggerEventListeners=!0;e.call(this,b);this._initialize(b)}var e=n.Dropdown;b.prototype=Object.create(e.prototype);l.mixin(b.prototype,{_initialize:function(b){this._dropdownNode.dropdown||(this._dropdownNode.dropdown=this);this._boundcontextmenuEventHandler=this._contextmenuEventHandler.bind(this);
this._boundContextMenuCloser=this._contextMenuCloser.bind(this);this._triggerNode.addEventListener("contextmenu",this._boundcontextmenuEventHandler,!0);window.addEventListener("contextmenu",this._boundContextMenuCloser,!1);this._triggerNode.addEventListener("click",this._boundContextMenuCloser,!1)},_contextMenuCloser:function(b){this.close(b)},_contextmenuEventHandler:function(b){this.open(b)?k.stop(b):this.close()}});b.prototype.constructor=b;b.prototype._positionDropdown=function(b){if(b){var c=
b.clientX;b=b.clientY;this._dropdownNode.style.position="fixed";this._dropdownNode.style.left=c+"px";this._dropdownNode.style.top=b+"px";var a=k.bounds(this._dropdownNode),h=a.width,a=a.height,f=k.bounds(document.body),h=c+h-(f.left+f.width);0<h&&(this._dropdownNode.style.left=Math.floor(c-h)+"px");c=b+a-(f.top+f.height);0<c&&(this._dropdownNode.style.top=Math.floor(b-c)+"px")}else e.prototype._positionDropdown.call(this)};b.prototype.destroy=function(){this._triggerNode.removeEventListener("contextmenu",
this._boundcontextmenuEventHandler,!0);this._triggerNode.removeEventListener("click",this._boundContextMenuCloser,!1);window.removeEventListener("contextmenu",this._boundContextMenuCloser,!1);this._dropdownNode.dropdown=null;e.prototype.destroy.call(this)};return{ContextMenu:b}});
define("orion/widgets/nav/common-nav","i18n!orion/edit/nls/messages orion/objects orion/webui/littlelib orion/explorers/explorer-table orion/explorers/navigatorRenderer orion/explorers/explorerNavHandler orion/keyBinding orion/fileCommands orion/projectCommands orion/extensionCommands orion/globalCommands orion/selection orion/URITemplate orion/PageUtil orion/Deferred orion/webui/contextmenu".split(" "),function(k,n,l,g,c,f,b,e,d,m,a,h,s,t,q,r){function v(b){b.setFocus=!1;b.cachePrefix=null;b.modelEventDispatcher=
e.getModelEventDispatcher();b.dragAndDrop=e.uploadFile;w.apply(this,arguments);this.preferences=b.preferences;this.commandRegistry=b.commandRegistry;this.editorInputManager=b.editorInputManager;this.progressService=b.progressService;this.sidebar=b.sidebar;var d=this.sidebarNavInputManager=b.sidebarNavInputManager;this.toolbarNode=b.toolbarNode;this.fileActionsScope="fileActions";this.editActionsScope="editActions";this.viewActionsScope="viewActions";this.toolsActionsScope="toolsActions";this.additionalActionsScope=
"extraActions";this._parentNode=l.node(this.parentId);this._sidebarContextMenuNode=document.createElement("ul");this._sidebarContextMenuNode.className="dropdownMenu";this._sidebarContextMenuNode.setAttribute("role","menu");this._sidebarContextMenuNode.id=this.parentId+"ContextMenu";this._parentNode.parentNode.insertBefore(this._sidebarContextMenuNode,this._parentNode);this.contextMenuActionsScope=this._sidebarContextMenuNode.id+"commonNavContextMenu";this.treeRoot={};var c=this;this.editorInputListener=
function(a){c.reveal(a.metadata)};this.editorInputManager.addEventListener("InputChanged",this.editorInputListener);d&&(d.reveal=function(a){c.reveal(a)});var f=this.modelEventDispatcher,g=this._modelListener=this.onFileModelChange.bind(this);["move","delete"].forEach(function(a){f.addEventListener(a,g)});this.selection=new h.Selection(this.registry,"commonNavFileSelection");this._selectionListener=function(a){c.updateCommands(a.selections);d&&c.sidebarNavInputManager.dispatchEvent(a)};this.selection.addEventListener("selectionChanged",
this._selectionListener);a.getMainSplitter().splitter.addEventListener("toggle",this._splitterToggleListener=function(a){this.updateCommands()}.bind(this));this.commandsRegistered=this.registerCommands();this._createContextMenu()}function u(){y.apply(this,arguments)}var w=g.FileExplorer,z=b.KeyBinding,y=c.NavigatorRenderer,x=new s("#{,resource,params*}");v.prototype=Object.create(w.prototype);n.mixin(v.prototype,{onLinkClick:function(a){w.prototype.onLinkClick.call(this,a);this.sidebarNavInputManager.dispatchEvent(a);
var b=this.getNavHandler();b&&a.item.Directory&&(a=a.item,b.cursorOn(a),b.setSelection(a,!1),a=b._modelIterator.cursor(),b.isExpandable(a)&&(b.isExpanded(a)?this.myTree.collapse(a):this.myTree.expand(a)))},onModelCreate:function(a){return w.prototype.onModelCreate.call(this,a).then(function(){this.sidebarNavInputManager.dispatchEvent(a)}.bind(this))},onFileModelChange:function(a){var b=a.oldValue;a=a.newValue;var d=this.editorInputManager.getFileMetadata();if(d){var c;[d].concat(d.Parents||[]).some(function(a){return b.Location===
a.Location?(c=b,!0):!1});c&&this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:b.parent.Location,newInput:c.Location===d.Location?a&&a.ChildrenLocation||a&&a.ContentLocation||a&&a.Location||null:null})}},createActionSections:function(){var a=this;[].forEach(function(b){if(!a[b]){var d=document.createElement("ul");d.id=b;d.classList.add("commandList");d.classList.add("layoutLeft");d.classList.add("pageActions");a.toolbarNode.appendChild(d);a[b]=d}})},destroy:function(){var b=
this,d=this.modelEventDispatcher;["move","delete"].forEach(function(a){d.removeEventListener(a,b._modelListener)});w.prototype.destroy.call(this);[].forEach(function(a){delete b[a]});this.editorInputManager.removeEventListener("InputChanged",this.editorInputListener);this.selection.removeEventListener("selectionChanged",this._selectionListener);var c=a.getMainSplitter();c&&c.splitter.removeEventListener("toggle",this._splitterToggleListener);this._contextMenu&&(this._contextMenu.destroy(),this._contextMenu=
null);this._sidebarContextMenuNode&&(this._parentNode.parentNode.removeChild(this._sidebarContextMenuNode),this._sidebarContextMenuNode=null)},display:function(a,b){return this.loadRoot(a,b).then(function(){this.updateCommands();return this.reveal(this.editorInputManager.getFileMetadata())}.bind(this))},loadRoot:function(a,b){a=a&&a.ChildrenLocation||a||"";return this.commandsRegistered.then(function(){return a&&"object"===typeof a?this.load(a):this.loadResourceList(a,b)}.bind(this))},scope:function(a){a=
a&&a.ChildrenLocation||a||"";var b=t.matchResourceParameters(),d=b.resource;delete b.resource;if(a){if(b.navigate===a)return;b.navigate=a}else delete b.navigate;window.location.href=x.expand({resource:d,params:b})},scopeUp:function(){var a;a=this.treeRoot;var b=a.Parents&&a.Parents[0];a=b?b.ChildrenLocation:this.fileClient.fileServiceRootURL(a.Location);this.scope(a)},scopeDown:function(a){this.scope(a.ChildrenLocation)},isCommandsVisible:function(){var b=a.getMainSplitter();return b?!b.splitter.isClosed():
!this.destroyed},registerCommands:function(){var a=this.commandRegistry,b=this.fileActionsScope,c=this.editActionsScope,e=this.viewActionsScope,h=this.contextMenuActionsScope,f=new z(113),g=new z(46),q=new z("x",!0),s=new z("c",!0),l=new z("v",!0),t=new z(38,!1,!1,!0),r=new z(40,!1,!1,!0);r.domScope=t.domScope=l.domScope=s.domScope=q.domScope=g.domScope=f.domScope="sidebar";r.scopeName=t.scopeName=l.scopeName=s.scopeName=q.scopeName=g.scopeName=f.scopeName=k.Navigator;a.registerCommandContribution(b,
"eclipse.newFile",1,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");a.registerCommandContribution(b,"eclipse.newFolder",2,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default",!1,null);a.registerCommandContribution(b,"orion.new.project",3,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");a.registerCommandContribution(b,"orion.new.linkProject",4,"orion.menuBarFileGroup/orion.newContentGroup/orion.new.default");a.registerCommandContribution(b,"orion.import",
1,"orion.menuBarFileGroup/orion.importGroup");a.registerCommandContribution(b,"orion.importZipURL",2,"orion.menuBarFileGroup/orion.importGroup");a.registerCommandContribution(b,"orion.importSFTP",3,"orion.menuBarFileGroup/orion.importGroup");a.registerCommandContribution(b,"eclipse.downloadFile",1,"orion.menuBarFileGroup/orion.exportGroup");a.registerCommandContribution(b,"eclipse.exportSFTPCommand",2,"orion.menuBarFileGroup/orion.exportGroup");a.registerCommandContribution(c,"eclipse.renameResource",
1,"orion.menuBarEditGroup/orion.renameGroup",!1,f);a.registerCommandContribution(c,"eclipse.cut",2,"orion.menuBarEditGroup/orion.clipboardGroup",!1,q);a.registerCommandContribution(c,"eclipse.copySelections",3,"orion.menuBarEditGroup/orion.clipboardGroup",!1,s);a.registerCommandContribution(c,"eclipse.pasteSelections",4,"orion.menuBarEditGroup/orion.clipboardGroup",!1,l);a.registerCommandContribution(c,"eclipse.deleteFile",5,"orion.menuBarEditGroup/orion.deleteGroup",!1,g);a.registerCommandContribution(c,
"eclipse.compareWith",6,"orion.menuBarEditGroup/orion.compareGroup");a.registerCommandContribution(c,"eclipse.compareWithEachOther",7,"orion.menuBarEditGroup/orion.compareGroup");a.registerCommandContribution(e,"eclipse.downFolder",1,"orion.menuBarViewGroup",!1,r);a.registerCommandContribution(e,"eclipse.upFolder",0,"orion.menuBarViewGroup",!1,t);a.addCommandGroup(h,"orion.commonNavContextMenuEditGroup",100,null,null,null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.New",0,k.New,"orion.commonNavContextMenuEditGroup",
null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.OpenWith",1001,k.OpenWith,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.Extensions",1002,k.OpenRelated,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.ImportGroup",1003,k.Import,"orion.commonNavContextMenuEditGroup",null,null,null,"dropdownSelection");a.addCommandGroup(h,"orion.ExportGroup",1004,k.Export,"orion.commonNavContextMenuEditGroup",
null,null,null,"dropdownSelection");a.registerCommandContribution(h,"eclipse.newFile",1,"orion.commonNavContextMenuEditGroup/orion.New");a.registerCommandContribution(h,"eclipse.newFolder",2,"orion.commonNavContextMenuEditGroup/orion.New",!1,null);a.registerCommandContribution(h,"orion.new.project",3,"orion.commonNavContextMenuEditGroup/orion.New");a.registerCommandContribution(h,"orion.new.linkProject",4,"orion.commonNavContextMenuEditGroup/orion.New");a.registerCommandContribution(h,"eclipse.renameResource",
1,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.cut",2,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.copySelections",3,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.pasteSelections",4,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.deleteFile",5,"orion.commonNavContextMenuEditGroup",!1);a.registerCommandContribution(h,"eclipse.compareWith",6,"orion.commonNavContextMenuEditGroup");
a.registerCommandContribution(h,"eclipse.compareWithEachOther",7,"orion.commonNavContextMenuEditGroup");a.registerCommandContribution(h,"orion.import",1,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");a.registerCommandContribution(h,"orion.importZipURL",2,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");a.registerCommandContribution(h,"orion.importSFTP",3,"orion.commonNavContextMenuEditGroup/orion.ImportGroup");a.registerCommandContribution(h,"eclipse.downloadFile",1,"orion.commonNavContextMenuEditGroup/orion.ExportGroup");
a.registerCommandContribution(h,"eclipse.exportSFTPCommand",2,"orion.commonNavContextMenuEditGroup/orion.ExportGroup");a.addCommandGroup(e,"eclipse.openWith",1E3,k.OpenWith,"orion.menuBarViewGroup",null,null,null,"dropdownSelection");a.addCommandGroup(e,"eclipse.fileCommandExtensions",1E3,k.OpenRelated,"orion.menuBarViewGroup");m.getOpenWithCommands(a).forEach(function(b){a.registerCommandContribution(e,b.id,1,"orion.menuBarViewGroup/eclipse.openWith");a.registerCommandContribution(h,b.id,1,"orion.commonNavContextMenuEditGroup/orion.OpenWith")});
m.getFileCommandIds().forEach(function(b){a.registerCommandContribution(e,b,1,"orion.menuBarViewGroup/eclipse.fileCommandExtensions");a.registerCommandContribution(h,b,1,"orion.commonNavContextMenuEditGroup/orion.Extensions")});return this.preferences.getPreferences("/common-nav").then(function(e){e=e.get("showNewProjectCommands");if(void 0===e||e){a.addCommandGroup(b,"orion.projectsNewGroup",100,k.Project,"orion.menuBarFileGroup/orion.newContentGroup");a.addCommandGroup(h,"orion.projectsNewGroup",
100,k.Project,"orion.commonNavContextMenuEditGroup/orion.New");var f=0;d.getCreateProjectCommands(a).forEach(function(d){a.registerCommandContribution(b,d.id,f,"orion.menuBarFileGroup/orion.newContentGroup/orion.projectsNewGroup");a.registerCommandContribution(h,d.id,f,"orion.commonNavContextMenuEditGroup/orion.New/orion.projectsNewGroup");f++});a.registerCommandContribution(c,"orion.project.initProject",0,"orion.menuBarEditGroup")}})},updateCommands:function(a){a=this.isCommandsVisible();this.createActionSections();
var b=this.commandRegistry,d=this.sidebar.menuBar;d.setActiveExplorer(this);d.updateCommands();b.registerSelectionService(this.contextMenuActionsScope,a?this.selection:null);this._sidebarContextMenuNode&&this._populateContextMenu(this._sidebarContextMenuNode)},_populateContextMenu:function(a){var b=this.selection.getSelections(),d=null;this.commandRegistry.destroy(a);if(!b||Array.isArray(b)&&!b.length)d=this.treeRoot;this.commandRegistry.renderCommands(this.contextMenuActionsScope,a,d,this,"menu")},
_createContextMenu:function(){var a=function(a){var b=this.getNavHandler(),d=this.getNavDict();a=a.event;var c=null;if(a.target){for(var p=a.target;this._parentNode.contains(p);){if("TR"===p.nodeName){c=d.getValue(p.id);break}p=p.parentNode}if(c&&!b.isDisabled(c.rowDomNode))-1===b.getSelection().indexOf(c.model)&&(b.cursorOn(c.model,!0,!1,!0),b.setSelection(c.model,!1,!0));else if(0<(void 0===a.offsetX?a.layerX:a.offsetX))this.selection.setSelections(null),b.refreshSelection(!0,!0)}}.bind(this),b=
new r.ContextMenu({dropdown:this._sidebarContextMenuNode,triggerNode:this._parentNode});b.addEventListener("triggered",a);this._contextMenu=b}});u.prototype=Object.create(y.prototype);n.mixin(u.prototype,{showFolderLinks:!0,oneColumn:!0,createFolderNode:function(a){var b=y.prototype.createFolderNode.call(this,a);this.showFolderLinks&&"A"===b.tagName?(b.href=x.expand({resource:a.Location}),b.classList.add("commonNavFolder")):b.classList.add("nav_fakelink");return b},rowCallback:function(a,b){y.prototype.rowCallback.call(this,
a,b);var d=e.getCutBuffer();d&&d.some(function(a){return e.isEqualToOrChildOf(b,a)})&&this.explorer.getNavHandler().disableItem(b)},emptyCallback:function(){}});return{CommonNavExplorer:v,CommonNavRenderer:u}});
define("orion/widgets/filesystem/filesystemSwitcher","i18n!orion/edit/nls/messages orion/objects orion/webui/littlelib orion/i18nUtil orion/commands orion/URL-shim".split(" "),function(k,n,l,g,c,f){function b(b){this.commandRegistry=b.commandRegistry;this.rootChangeListener=b.rootChangeListener;this.filesystemChangeDispatcher=b.filesystemChangeDispatcher;this.fileClient=b.fileClient;this.node=b.node;this.serviceRegistry=b.serviceRegistry;var d=this;this.listener=function(b){d.refresh(b.root)};this.rootChangeListener&&
this.rootChangeListener.addEventListener("rootChanged",this.listener);this.render()}n.mixin(b.prototype,{destroy:function(){this.rootChangeListener&&this.rootChangeListener.removeEventListener("rootChanged",this.listener);this.commandRegistry.destroy(this.node);l.empty(this.node);this.rootChangeListener=this.filesystemChangeDispatcher=this.listener=this.node=null},registerCommands:function(){if(!this.commandsRegistered){this.commandsRegistered=!0;var b=this.commandRegistry,d=this.serviceRegistry,
f=new c.Command({name:k.ChooseFS,imageClass:"core-sprite-openarrow",selectionClass:"dropdownSelection",tooltip:k.ChooseFSTooltip,id:"orion.nav.switchfs",visibleWhen:function(a){return 1<d.getServiceReferences("orion.core.file").length},choiceCallback:this._switchFsMenuCallback.bind(this)});b.addCommand(f);b.registerCommandContribution("orion.mininav","orion.nav.switchfs",1)}},_switchFsMenuCallback:function(b){var d=this;return this.serviceRegistry.getServiceReferences("orion.core.file").map(function(b){b=
b.getProperty("top");var a=d._fileServiceLabel(b,!0);return{checked:d.fileSystem===a,name:a,callback:d.setActiveFilesystem.bind(d,b)}})},render:function(){this.fsName=document.createElement("div");this.fsName.classList.add("filesystemName");this.fsName.classList.add("layoutLeft");this.menu=document.createElement("ul");this.menu.classList.add("filesystemSwitcher");this.menu.classList.add("commandList");this.menu.classList.add("layoutRight");this.menu.classList.add("pageActions");this.node.appendChild(this.fsName);
this.node.appendChild(this.menu);this.registerCommands();this.fsName.addEventListener("click",this._openMenu.bind(this))},_openMenu:function(b){if(b=l.$(".dropdownTrigger",this.menu)){var d=document.createEvent("MouseEvents");d.initEvent("click",!0,!0);b.dispatchEvent(d)}},_fileServiceHostname:function(b){b=this.fileClient.fileServiceRootURL(b);0===b.indexOf("filesystem:")&&(b=b.substr(11));var d=b;try{d=(new URL(b,window.location.href)).hostname}catch(c){}return d},_fileServiceLabel:function(b,d){var c=
this.fileClient.fileServiceName(b),a=this._fileServiceHostname(b);if(d)return g.formatMessage(k.FSTitle,c,a);var h=document.createDocumentFragment();h.textContent=k.FSTitle;l.processDOMNodes(h,[document.createTextNode(c),document.createTextNode(a)]);return h},refresh:function(b){var d=b;b.ChildrenLocation&&(d=b.ChildrenLocation);l.empty(this.fsName);this.fileSystem=this._fileServiceLabel(d,!0);this.fsName.appendChild(this._fileServiceLabel(d));this.commandRegistry.destroy(this.menu);this.commandRegistry.renderCommands("orion.mininav",
this.menu,{},"menu")},setActiveFilesystem:function(b){var d=b;b.ChildrenLocation&&(d=b.ChildrenLocation);b=this.fileClient.fileServiceRootURL(d);this.filesystemChangeDispatcher&&this.filesystemChangeDispatcher.dispatchEvent({type:"filesystemChanged",newInput:b})}});return{FilesystemSwitcher:b}});
define("orion/widgets/nav/mini-nav","i18n!orion/edit/nls/messages orion/objects orion/webui/littlelib orion/widgets/nav/common-nav orion/fileCommands orion/PageUtil orion/Deferred orion/widgets/filesystem/filesystemSwitcher orion/URL-shim".split(" "),function(k,n,l,g,c,f,b,e,d){function m(a){s.apply(this,arguments);var b=this.sidebarNavInputManager;if(b){var d=this;this.addEventListener("rootChanged",function(a){d.sidebarNavInputManager.dispatchEvent(a);d.sidebarNavInputManager.dispatchEvent({type:"InputChanged",
input:a.root.ChildrenLocation})});b.setInput=function(a){d.treeRoot&&d.treeRoot.ChildrenLocation!==a&&d.loadRoot(a).then(function(){d.updateCommands();var a=d.editorInputManager.getFileMetadata();d.reveal(a,!1)})}}}function a(){t.apply(this,arguments)}function h(a){this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebar=a.sidebar;
this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.lastRoot=this.explorer=this.fsToolbar=null;var b=this;this.sidebarNavInputManager.addEventListener("InputChanged",function(a){b.lastRoot=a.input})}var s=g.CommonNavExplorer,t=g.CommonNavRenderer;m.prototype=Object.create(s.prototype);n.mixin(m.prototype,{reroot:function(a){this.scope("");return this.loadRoot(this.fileClient.fileServiceRootURL(a.Location)).then(function(){return this.showItem(a,
!1)}.bind(this))}});a.prototype=Object.create(t.prototype);n.mixin(h.prototype,{label:k.Navigator,create:function(){var b=this;this.explorer=new m({preferences:this.preferences,commandRegistry:this.commandRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,sidebar:this.sidebar,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,rendererFactory:function(d){return new a({checkbox:!1,treeTableClass:"miniNavTreeTable",cachePrefix:"MiniNav"},d,b.commandRegistry,
b.contentTypeRegistry)},serviceRegistry:this.serviceRegistry,toolbarNode:this.toolbarNode});this.fsSwitcher=new e.FilesystemSwitcher({commandRegistry:this.commandRegistry,rootChangeListener:this.explorer,filesystemChangeDispatcher:this.explorer.sidebarNavInputManager,fileClient:this.fileClient,node:this.toolbarNode,serviceRegistry:this.serviceRegistry});var d=f.matchResourceParameters(),c=d.resource,d=d.navigate||this.lastRoot||this.fileClient.fileServiceRootURL(c||"");this.explorer.display(d)},destroy:function(){this.explorer&&
(this.explorer.destroy(),this.explorer=null);this.fsSwitcher&&this.fsSwitcher.destroy()}});return h});
define("orion/projectClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/extensionCommands"],function(k,n,l){function g(c){try{return c?JSON.parse(c):{}}catch(b){return{__TEXT__:String(c)}}}function c(c,b){this.serviceRegistry=c;this.fileClient=b;this.allProjectHandlersReferences=c.getServiceReferences("orion.project.handler");this.allProjectDeployReferences=c.getServiceReferences("orion.project.deploy");this._serviceRegistration=c.registerService("orion.project.client",this);this._launchConfigurationsDir=
"launchConfigurations"}c.prototype={_getProjectJsonData:function(c,b,e){for(var d=new n,m=0;m<b.length;m++)if("project.json"===b[m].Name)return this.fileClient.read(b[m].Location).then(function(a){var h=g(a);h.Name=h.Name||c.Name;h.ContentLocation=c.Location;h.WorkspaceLocation=e.Location;var k;e.Children.some(function(a){return a.Location===c.Location?(k=a.Id,!0):!1});e.Projects.some(function(a){return a.Id===k?(h.ProjectLocation=a.Location,!0):!1});h.ProjectJsonLocation=b[m].Location;d.resolve(h)},
function(a){d.reject(a)},function(a){d.progress(a)}),d;d.resolve(null);return d},readAllProjects:function(c){var b=new n;if(!c.Children)return b.resolve([]),b;for(var e=[],d=[],g=0;g<c.Children.length;g++){var a=new n;this.readProject(c.Children[g],c).then(a.resolve,function(a){this.resolve(null)}.bind(a));d.push(a);a.then(function(a){a&&e.push(a)})}n.all(d).then(function(){b.resolve(e)});return b},readProject:function(c,b){function e(a,b,c){if(a.Parents&&0<a.Parents.length){var e=a.Parents[a.Parents.length-
1];e.Children?d._getProjectJsonData.bind(d)(e,e.Children,b).then(c.resolve,c.reject,c.progress):e.ChildrenLocation?this.fileClient.fetchChildren(e.ChildrenLocation).then(function(a){d._getProjectJsonData.bind(d)(e,a,b).then(c.resolve,c.reject,c.progress)},c.reject,c.progress):c.resolve(null)}else a.Children?d._getProjectJsonData.bind(d)(a,a.Children,b).then(c.resolve,c.reject,c.progress):a.ChildrenLocation?this.fileClient.fetchChildren(a.ChildrenLocation).then(function(e){d._getProjectJsonData.bind(d)(a,
e,b).then(c.resolve,c.reject,c.progress)},c.reject,c.progress):c.resolve(null);return c}var d=this,g=new n;b?e.call(d,c,b,g):this.fileClient.loadWorkspace().then(function(a){e.call(d,c,a,g)});return g},initProject:function(c,b){var e=this,d=new n;this.fileClient.createFile(c,"project.json").then(function(g){b?e.fileClient.write(g.Location,JSON.stringify(b)).then(function(){d.resolve({ContentLocation:c,projectMetadata:b})},d.reject,d.progress):d.resolve({fileMetadata:g})},d.reject,d.progress);return d},
createProject:function(c,b){return this.fileClient.createProject(c,b.Name,b.ContentLocation,!0).then(function(c){delete b.Name;return this.initProject(c.ContentLocation,b)}.bind(this),function(b){return b},function(b){return b})},getDependencyFileMetadata:function(c,b){function e(a,b){this.fileClient.fetchChildren(a).then(function(a){for(var h=0;h<a.length;h++)if(a[h].Name===b[0]){1===b.length?d.resolve(a[h]):e.bind(g)(a[h].ChildrenLocation,b.splice(1,b.length-1));return}d.reject(c.Location+" could not be found in your workspace")},
function(a){d.reject(a)})}var d=new n,g=this;if("file"===c.Type){var a=c.Location.split("/");this.fileClient.loadWorkspace(b).then(function(b){for(var h=0;h<b.Children.length;h++)if(b.Children[h].Name===a[0]){1===a.length?d.resolve(b.Children[h]):e.bind(g)(b.Children[h].ChildrenLocation,a.splice(1,a.length-1));return}d.reject(c.Location+" could not be found in your workspace")},function(a){d.reject(a)})}else{var h=this.getProjectHandler(c.Type);if(null===h)return d.reject(c.Type+" is not supported."),
d;var k;h.validationProperties&&(k=l._makeValidator(h,this.serviceRegistry,[]));this.fileClient.loadWorkspace(b).then(function(a){for(var b=[],e=!1,g=0;g<a.Children.length&&!0!==e;g++)if(k&&k.validationFunction(a.Children[g])){var m=h.getDependencyDescription(a.Children[g]);b.push(m);(function(b,h){h.then(function(h){h&&h.Location===c.Location&&(e=!0,d.resolve(a.Children[b]))})})(g,m)}n.all(b).then(function(){e||d.reject(c.Name+" could not be found in your workspace")})},d.reject)}return d},addProjectDependency:function(c,
b){var e=new n;this.fileClient.fetchChildren(c.ContentLocation).then(function(d){for(var m=0;m<d.length;m++)if("project.json"===d[m].Name){this.fileClient.read(d[m].Location).then(function(a){try{var h=g(a);h.Dependencies||(h.Dependencies=[]);for(a=0;a<h.Dependencies.length;a++)if(h.Dependencies[a].Location===b.Location){e.resolve(h);return}h.Dependencies.push(b);this.fileClient.write(d[m].Location,JSON.stringify(h)).then(function(){h.ContentLocation=c.ContentLocation;h.Name=c.Name;e.resolve(h)},
e.reject);e.resolve(h)}catch(k){e.reject(k)}}.bind(this),e.reject,e.progress);break}}.bind(this),e.reject);return e},removeProjectDependency:function(c,b){var e=new n;this.fileClient.fetchChildren(c.ContentLocation).then(function(d){for(var m=0;m<d.length;m++)if("project.json"===d[m].Name){this.fileClient.read(d[m].Location).then(function(a){try{var h=g(a);h.Dependencies||(h.Dependencies=[]);for(var k=h.Dependencies.length-1;0<=k;k--)h.Dependencies[k].Location===b.Location&&h.Dependencies[k].Type===
b.Type&&h.Dependencies.splice(k,1);this.fileClient.write(d[m].Location,JSON.stringify(h)).then(function(){h.ContentLocation=c.ContentLocation;h.Name=c.Name;e.resolve(h)},e.reject)}catch(l){e.reject(l)}}.bind(this),e.reject,e.progress);break}}.bind(this),e.reject);return e},changeProjectProperties:function(c,b){function e(e){this.fileClient.read(e).then(function(a){try{var h=g(a),k;for(k in b)h[k]=b[k];this.fileClient.write(e,JSON.stringify(h)).then(function(){h.ContentLocation=c.ContentLocation;h.ProjectJsonLocation=
e;h.Name=c.Name;d.resolve(h)},d.reject)}catch(l){d.reject(l)}}.bind(this),d.reject)}if(b){var d=new n;c.ProjectJsonLocation&&e.bind(this)(c.ProjectJsonLocation);return d}},getProjectHandlerTypes:function(){for(var c=[],b=0;b<this.allProjectHandlersReferences.length;b++)c.push(this.allProjectHandlersReferences[b].getProperty("type"));return c},_getProjectDeployService:function(c){var b=this.serviceRegistry.getService(c);b.id=c.getProperty("id");b.name=c.getProperty("name");b.tooltip=c.getProperty("tooltip");
b.parameters=c.getProperty("parameters");b.optionalParameters=c.getProperty("optionalParameters");b.validationProperties=c.getProperty("validationProperties");b.logLocationTemplate=c.getProperty("logLocationTemplate");return b},matchesDeployService:function(c,b){return l._makeValidator(b,this.serviceRegistry,[]).validationFunction(c)},getProjectDeployTypes:function(){for(var c=this.allProjectDeployReferences.sort(function(b,c){var a=b.getProperty("priorityForDefault")||0,h=c.getProperty("priorityForDefault")||
0;return a>h?-1:a<h?1:0}),b=[],e=0;e<c.length;e++)b.push(c[e].getProperty("id"));return b},getProjectDelpoyService:function(c,b){for(var e=0;e<this.allProjectDeployReferences.length;e++)if(this.allProjectDeployReferences[e].getProperty("id")===c)return this._getProjectDeployService(this.allProjectDeployReferences[e]);if(b)for(e=0;e<this.allProjectDeployReferences.length;e++){var d=this.allProjectDeployReferences[e].getProperty("deployTypes");if(d&&d.some(function(d){return b===d}))return this._getProjectDeployService(this.allProjectDeployReferences[e])}},
_getProjectHandlerService:function(c){var b=this.serviceRegistry.getService(c);b.id=c.getProperty("id");b.addParameters=c.getProperty("addParameters")||c.getProperty("addParamethers");b.optionalParameters=c.getProperty("optionalParameters")||c.getProperty("optionalParamethers");b.addDependencyName=c.getProperty("addDependencyName");b.addDependencyTooltip=c.getProperty("addDependencyTooltip");b.type=c.getProperty("type");b.actionComment=c.getProperty("actionComment");b.addProjectName=c.getProperty("addProjectName");
b.addProjectTooltip=c.getProperty("addProjectTooltip");b.validationProperties=c.getProperty("validationProperties");return b},getProjectHandler:function(c){for(var b=0;b<this.allProjectHandlersReferences.length;b++)if(this.allProjectHandlersReferences[b].getProperty("type")===c)return this._getProjectHandlerService(this.allProjectHandlersReferences[b])},getMatchingProjectHandlers:function(c){for(var b=[],e=0;e<this.allProjectHandlersReferences.length;e++)l._makeValidator(this.allProjectHandlersReferences[e]._properties,
this.serviceRegistry,[]).validationFunction(c)&&b.push(this._getProjectHandlerService(this.allProjectHandlersReferences[e]));return b},_getLaunchConfigurationsDir:function(c,b){var e=new n;c.ContentLocation?this.fileClient.fetchChildren(c.ContentLocation).then(function(d){for(var g=0;g<d.length;g++)if(d[g].Name&&d[g].Name===this._launchConfigurationsDir)return e.resolve(d[g]),e;b?this.fileClient.createFolder(c.ContentLocation,this._launchConfigurationsDir).then(e.resolve,e.reject):e.resolve(null)}.bind(this),
e.reject):e.reject();return e},getProjectLaunchConfigurations:function(c){var b=new n;this._getLaunchConfigurationsDir(c).then(function(e){if(!e)return b.resolve([]),b;if(e.Children){for(var d=[],g=0;g<e.Children.length;g++){var a=new n;d.push(a);(function(a){this.fileClient.read(e.Children[g].Location).then(function(b){try{b=JSON.parse(b),b.Name=b.Name||e.Name.replace(".launch",""),b.project=c,a.resolve(b)}catch(d){console.error(d),a.resolve()}}.bind(this),function(b){console.error(b);a.resolve()})}).call(this,
a)}n.all(d).then(function(a){if(!a||!a.length)b.resolve([]);else{for(var d=a.length-1;0<=d;d--)a[d]||a.splice(d,1);b.resolve(a)}},b.reject)}else{var h=arguments.callee.bind(this);this.fileClient.fetchChildren(e.ChildrenLocation).then(function(a){e.Children=a;h(e)}.bind(this),b.reject)}}.bind(this),b.reject);return b},saveProjectLaunchConfiguration:function(c,b,e,d,g,a,h,k,l){var q=new n,r=b,r=r.replace(/\ /g," "),r=r.replace(/[^\w\d\s]/g,"");0>r.indexOf(".launch")&&(r+=".launch");var v={Name:b,ServiceId:e,
Params:d,Url:g,ManageUrl:a,Path:h};k&&(v.UrlTitle=k);l&&(v.Type=l);this._getLaunchConfigurationsDir(c,!0).then(function(a){if(a.Children){for(var b=0;b<a.Children.length;b++)if(a.Children[b].Name===r){this.fileClient.write(a.Children[b].Location,JSON.stringify(v)).then(function(){q.resolve(v)},q.reject);return}this.fileClient.createFile(a.Location,r).then(function(a){this.fileClient.write(a.Location,JSON.stringify(v)).then(function(){q.resolve(v)},q.reject)}.bind(this),q.reject)}else{var d=arguments.callee.bind(this);
this.fileClient.fetchChildren(a.ChildrenLocation).then(function(b){a.Children=b;d(a)}.bind(this),q.reject)}}.bind(this));return q}};c.prototype.constructor=c;return{ProjectClient:c}});
define("orion/widgets/nav/project-nav","i18n!orion/edit/nls/messages orion/commands orion/objects orion/webui/littlelib orion/explorers/explorer-table orion/widgets/nav/common-nav orion/projectCommands orion/PageUtil orion/URITemplate orion/Deferred orion/projectClient".split(" "),function(k,n,l,g,c,f,b,e,d,m,a){function h(a,b,d,c,h,e,f,g){this.projectClient=f;this.project=b;this.fileMetadata=g;u.apply(this,arguments)}function s(a){this.projectClient=a.projectClient;r.apply(this,arguments);var d=
this;this.dependenciesDisplatcher=b.getDependencyDispatcher();this.dependneciesListener=function(a){d.changedItem.call(d)};this._dependenciesEventTypes=["create","delete"];this._dependenciesEventTypes.forEach(function(a){d.dependenciesDisplatcher.addEventListener(a,d.dependneciesListener)})}function t(){v.apply(this,arguments)}function q(a){function b(a){d.lastCheckedLocation!==a.Location&&(d.lastCheckedLocation=a.Location,a&&a.Directory&&(a.parent&&a.parent.Projects||a.Parents&&0===a.Parents.length)&&
d.getProjectJson(a).then(function(b){b&&(d.showViewMode(!0),c.getActiveViewModeId()===d.id?d.explorer.display(a):(d.project=a,c.setViewMode(d.id)))}))}this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.parentNode=a.parentNode;this.sidebarNavInputManager=a.sidebarNavInputManager;this.toolbarNode=a.toolbarNode;this.serviceRegistry=a.serviceRegistry;this.projectClient=
this.serviceRegistry.getService("orion.project.client");this.sidebar=a.sidebar;this.explorer=null;var d=this,c=this.sidebar;this.editorInputManager.addEventListener("InputChanged",function(a){b(a.metadata)});this.sidebarNavInputManager.addEventListener("linkClick",function(a){b(a.item)});this.sidebarNavInputManager.addEventListener("selectionChanged",function(a){if(c.getActiveViewModeId()!==d.id){d.project=null;var b=a.selections&&0<a.selections.length?a.selections[0]:null;if(b){for(;b.parent&&b.parent.parent;)b=
b.parent;d.getProjectJson(b).then(function(a){d.project=b;d.showViewMode(!!a)})}else d.showViewMode(!1)}})}var r=f.CommonNavExplorer,v=f.CommonNavRenderer,u=c.FileModel,w=new d("#{,resource,params*}");h.prototype=Object.create(u.prototype);l.mixin(h.prototype,{processParent:function(a,b){var d=u.prototype.processParent.call(this,a,b);a.Project||(a.Project=this.project);for(var c=0;c<b.length;c++)b[c].Project=this.project;return d},getChildren:function(a,b){if(a.children)b(this.processParent(a,a.children));
else if("Project"===a.type){var d=[];this.fileMetadata.type="ProjectRoot";d.push(this.fileMetadata);m.all((a.Dependencies||[]).map(function(b){var c={Dependency:b,Project:a};d.push(c);return this.projectClient.getDependencyFileMetadata(b,a.WorkspaceLocation).then(function(a){l.mixin(c,a)},function(a){c.Directory=c.disconnected=!0})}.bind(this))).then(function(){this.processParent(a,d);d.splice(d.indexOf(this.fileMetadata),1);d.splice(0,0,this.fileMetadata);b(d)}.bind(this))}else return u.prototype.getChildren.call(this,
a,b)},getId:function(a){"Project"===a.type?a={Location:a.ContentLocation}:a.Dependency&&a.disconnected&&(a=a.Dependency);return u.prototype.getId.call(this,a)},hasChildren:function(){return!0}});s.prototype=Object.create(r.prototype);l.mixin(s.prototype,{onFileModelChange:function(a){var b=a.newValue;a.oldValue.ChildrenLocation===this.treeRoot.ContentLocation?this.sidebarNavInputManager.dispatchEvent({type:"editorInputMoved",parent:b?b.ChildrenLocation||b.ContentLocation:null,newInput:b?b.ChildrenLocation||
b.ContentLocation:null}):r.prototype.onFileModelChange.call(this,a)},display:function(a,b){if(a){this.fileMetadata=a;var d;a&&a.Parents&&0===a.Parents.length?d=a:a&&a.Parents&&(d=a.Parents[a.Parents.length-1]);if(b||!(d&&d.Location===this.projectLocation))return this.projectClient.readProject(a).then(function(c){this.projectLocation=d?d.Location:null;c.type="Project";c.Directory=!0;c.fileMetadata=a;return r.prototype.display.call(this,c,b).then(function(){return this.expandItem(a)}.bind(this))}.bind(this))}},
loadResourceList:function(a,b,d){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);this.treeRoot&&a===this.treeRoot.ContentLocation?this.display(this.fileMetadata,!0):this.scopeUp()},createModel:function(){return new h(this.registry,this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders,this.projectClient,this.fileMetadata)},reroot:function(a){this.scopeUp(a.Location);return(new m).reject()},createDefaultDeployCommand:function(){var a=this;this.deployCommand=
new n.Command({name:k.Deploy,tooltip:a.defaultDeployCommand?a.defaultDeployCommand.tooltip?a.defaultDeployCommand.tooltip:a.defaultDeployCommand.name:k.Deploy,id:"orion.project.deploy.default",visibleWhen:function(){return a.defaultDeployCommand&&a.defaultDeployCommand.visibleWhen.apply(a.defaultDeployCommand,arguments)},callback:function(b){return a.defaultDeployCommand.callback(b)}});var b=this.commandRegistry;b.addCommand(this.deployCommand);b.registerCommandContribution(this.additionalActionsScope,
this.deployCommand.id,0)},registerCommands:function(){return r.prototype.registerCommands.call(this).then(function(){var a=this.commandRegistry,d=this.fileActionsScope,c=this.additionalActionsScope;a.registerCommandContribution("dependencyCommands","orion.project.dependency.connect",1);a.registerCommandContribution("dependencyCommands","orion.project.dependency.disconnect",2);a.registerCommandContribution(d,"orion.project.create.readme",5,"orion.menuBarFileGroup/orion.newContentGroup");var p=0;a.addCommandGroup(d,
"orion.newDependency",6,k.Dependency,"orion.menuBarFileGroup/orion.newContentGroup");b.getAddDependencyCommands(a).forEach(function(b){a.registerCommandContribution(d,b.id,p++,"orion.menuBarFileGroup/orion.newContentGroup/orion.newDependency")});a.addCommandGroup(c,"orion.deployNavGroup",1E3,k["Deploy As"],null,null,null,k["Deploy As"],"dropdownSelection");if((this.deployCommands=b.getDeployProjectCommands(a))&&0<this.deployCommands.length)this.defaultDeployCommand=this.deployCommands[0],p=0,this.deployCommands.forEach(function(b){a.registerCommandContribution(c,
b.id,p++,"orion.deployNavGroup")});this.createDefaultDeployCommand()}.bind(this))},updateCommands:function(a){if(this.treeRoot&&this.treeRoot.Project&&"undefined"===typeof this.treeRoot.Project.launchConfigurations){this.treeRoot.Project.launchConfigurations=[];var d=function(a,d){var c;if(this.launchCommands)for(c=0;c<this.launchCommands.length;c++)this.commandRegistry.unregisterCommandContribution(this.additionalActionsScope,this.launchCommands[c]);this.treeRoot.Project.launchConfigurations=a;this.launchCommands=
[];b.updateProjectNavCommands(this.treeRoot,a,this.commandRegistry,this.projectClient,this.fileClient);var h;for(c=0;c<a.length;c++)h="orion.launchConfiguration.deploy."+a[c].ServiceId+a[c].Name,this.launchCommands.push(h),this.commandRegistry.registerCommandContribution(this.additionalActionsScope,h,c+1,"orion.deployNavGroup/orion.deployLaunchConfigurationGroup");if(c=b.getDefaultLaunchCommand(this.treeRoot.Project.Name))this.defaultDeployCommand=this.commandRegistry.findCommand(c)||this.deployCommands[0],
this.deployCommand.tooltip=this.defaultDeployCommand.tooltip?this.defaultDeployCommand.tooltip:this.defaultDeployCommand.name;r.prototype.updateCommands.apply(this,d)};this.projectClient.getProjectLaunchConfigurations(this.treeRoot.Project).then(function(c){d.apply(this,[c,a]);if(!this.launchConfigurationListener){var p=this;this.launchConfigurationDispatcher=b.getLaunchConfigurationDispatcher();this.launchConfigurationListener=function(c){if("changedDefault"===c.type){var h=b.getDefaultLaunchCommand(p.treeRoot.Project.Name);
h&&(p.defaultDeployCommand=p.commandRegistry.findCommand(h),p.deployCommand.tooltip=p.defaultDeployCommand.tooltip?p.defaultDeployCommand.tooltip:p.defaultDeployCommand.name,r.prototype.updateCommands.apply(p,a))}else p.selection.getSelections(function(a){if(c.oldValue)for(var b=0;b<p.treeRoot.Project.launchConfigurations.length;b++){var h=p.treeRoot.Project.launchConfigurations[b];if(h.Name===c.oldValue.Name&&h.ServiceId===c.oldValue.ServiceId){if(c.newValue){p.treeRoot.Project.launchConfigurations[b]=
c.newValue;d.apply(p,[p.treeRoot.Project.launchConfigurations,a]);return}p.treeRoot.Project.launchConfigurations[b].splice(b,1);break}}c.newValue&&p.treeRoot.Project.launchConfigurations.push(c.newValue);d.apply(p,[p.treeRoot.Project.launchConfigurations])})};this._launchConfigurationEventTypes=["create","delete","changedDefault"];this._launchConfigurationEventTypes.forEach(function(a){p.launchConfigurationDispatcher.addEventListener(a,p.launchConfigurationListener)})}}.bind(this),function(b){console.error(b);
r.prototype.updateCommands.apply(this,a)}.bind(this))}else r.prototype.updateCommands.apply(this,a)},scopeDown:!1,scopeUp:function(){var a=e.matchResourceParameters(),b=a.resource;delete a.navigate;delete a.resource;window.location.href=w.expand({resource:b,params:a});this.sidebar.setViewMode("nav")},changedItem:function(a,b){return!a||!this.model?this.display(this.fileMetadata,!0):a.Projects?(new m).resolve():r.prototype.changedItem.call(this,a,b)},destroy:function(){if(this.launchCommands)for(var a=
0;a<this.launchCommands.length;a++)this.commandRegistry.unregisterCommandContribution(this.additionalActionsScope,this.launchCommands[a],"orion.deployNavGroup/orion.deployLaunchConfigurationGroup");var b=this;this._dependenciesEventTypes.forEach(function(a){b.dependenciesDisplatcher.removeEventListener(a,b.dependneciesListener)});b.launchConfigurationListener&&this._launchConfigurationEventTypes.forEach(function(a){b.launchConfigurationDispatcher.removeEventListener(a,b.launchConfigurationListener)});
r.prototype.destroy.call(this)}});t.prototype=Object.create(v.prototype);l.mixin(t.prototype,{getCellElement:function(a,b,d){d=v.prototype.getCellElement.call(this,a,b,d);if((b.Dependency||"ProjectRoot"===b.type)&&0===a){d.className="ProjectRoot"===b.type?"projectNavColumn projectPrimaryNavColumn":"projectNavColumn";g.$(".mainNavColumn",d).classList.add("projectInformationNode");a=b.Dependency?b.Dependency.Name:b.Project?b.Project.Name:b.Name;var c=g.$("a",d);b.disconnected&&(a+=" "+k.disconnected,
c.removeAttribute("href"));g.empty(c);c.appendChild(document.createTextNode(a));b.Dependency&&(a=document.createElement("span"),a.className="mainNavColumn",a.style.cssFloat="right",this.explorer.commandRegistry.renderCommands("dependencyCommands",a,b,this,"tool"),d.appendChild(a))}return d}});l.mixin(q.prototype,{label:k.Project,id:"project",create:function(){var a=this;this.explorer=new s({preferences:this.preferences,commandRegistry:this.commandRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,
sidebar:this.sidebar,sidebarNavInputManager:this.sidebarNavInputManager,parentId:this.parentNode.id,projectClient:this.projectClient,rendererFactory:function(b){return new t({checkbox:!1,treeTableClass:"miniNavTreeTable",cachePrefix:"ProjectNav"},b,a.commandRegistry,a.contentTypeRegistry)},serviceRegistry:this.serviceRegistry,toolbarNode:this.toolbarNode});this.explorer.display(this.project);window.location.href=w.expand({resource:this.project.Location});this.sidebar.hideToolbar()},destroy:function(){this.explorer&&
this.explorer.destroy();this.explorer=null;this.sidebar.showToolbar()},getProjectJson:function(a){function b(a){for(var d=0;d<a.length;d++)if(!a[d].Directory&&"project.json"===a[d].Name)return a[d];return null}var d=new m;a.Children||a.children?d.resolve(b(a.Children||a.children)):a.ChildrenLocation&&this.fileClient.fetchChildren(a.ChildrenLocation).then(function(c){a.Children=c;d.resolve(b(c))});return d},showViewMode:function(a){var b=this.sidebar;!!b.getViewMode(this.id)!==a&&(a?b.addViewMode(this.id,
this):b.removeViewMode(this.id),b.renderViewModeMenu())}});return q});
define("orion/sidebar","orion/Deferred orion/objects orion/commands orion/outliner orion/webui/littlelib orion/PageUtil orion/widgets/nav/mini-nav orion/widgets/nav/project-nav orion/globalCommands i18n!orion/edit/nls/messages".split(" "),function(k,n,l,g,c,f,b,e,d,m){function a(a){this.params=a;this.preferences=a.preferences;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.fileClient=a.fileClient;this.editorInputManager=a.editorInputManager;this.outlineService=
a.outlineService;this.parentNode=c.node(a.parent);this.toolbarNode=c.node(a.toolbar);this.selection=a.selection;this.serviceRegistry=a.serviceRegistry;this.sidebarNavInputManager=a.sidebarNavInputManager;this.menuBar=a.menuBar;this.viewModes={};this.activeViewMode=null;this.switcherScope=a.switcherScope;this.switcherNode=null}n.mixin(a.prototype,{defaultViewMode:"nav",show:function(){if(!this.created){this.created=!0;var a=this.commandRegistry,f=this.contentTypeRegistry,k=this.fileClient,q=this.editorInputManager,
r=this.outlineService,n=this.parentNode,u=this.progressService,w=this.selection,z=this.serviceRegistry,y=this.toolbarNode,x=this.switcherNode=c.node(this.switcherScope),p=new l.Command({name:m.SidePanel,imageClass:"core-sprite-outline",selectionClass:"dropdownSelection",tooltip:m.SidePanelTooltip,id:"orion.sidebar.viewmode",visibleWhen:function(a){return(a=d.getMainSplitter())?!a.splitter.isClosed():!0},choiceCallback:this.viewModeMenuCallback.bind(this)});a.addCommand(p);a.registerCommandContribution(x.id,
"orion.sidebar.viewmode",2,"orion.menuBarViewGroup");this.addViewMode("nav",new b({commandRegistry:a,contentTypeRegistry:f,preferences:this.preferences,fileClient:k,editorInputManager:q,parentNode:n,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:z,toolbarNode:y,sidebar:this}));this.projectViewMode=new e({commandRegistry:a,contentTypeRegistry:f,preferences:this.preferences,fileClient:k,editorInputManager:q,parentNode:n,sidebarNavInputManager:this.sidebarNavInputManager,serviceRegistry:z,
toolbarNode:y,sidebar:this});this.outliner=new g.Outliner({parent:n,toolbar:y,serviceRegistry:z,contentTypeRegistry:f,preferences:this.preferences,outlineService:r,commandService:a,selectionService:w,inputManager:q,progressService:u,sidebar:this});this.setViewMode(this.defaultViewMode)}},showToolbar:function(){this.toolbarNode.style.display="block";this.parentNode.classList.remove("toolbarTarget-toolbarHidden")},hideToolbar:function(){this.toolbarNode.style.display="none";this.parentNode.classList.add("toolbarTarget-toolbarHidden")},
viewModeMenuCallback:function(){var a=this,b=this.getActiveViewModeId();return Object.keys(this.viewModes).map(function(d){var c=a.getViewMode(d);return{checked:d===b,name:c.label||d,callback:a.setViewMode.bind(a,d)}})},getActiveViewModeId:function(){return this.activeViewModeId},addViewMode:function(a,b){if(!a)throw Error("Invalid id: "+a);if(!b||"object"!==typeof b)throw Error("Invalid mode: "+b);Object.prototype.hasOwnProperty.call(this.viewModes,a)||(this.viewModes[a]=b)},removeViewMode:function(a){var b=
this.getViewMode(a);b&&"function"===typeof b.destroy&&b.destroy();delete this.viewModes[a]},getViewMode:function(a){return Object.prototype.hasOwnProperty.call(this.viewModes,a)?this.viewModes[a]:null},setViewMode:function(a){var b=this.activeViewMode;b&&"function"===typeof b.destroy&&b.destroy();this.toolbarNode&&this.commandRegistry.destroy(this.toolbarNode);c.empty(this.parentNode);this.activeViewModeId=(b=this.activeViewMode=this.getViewMode(a))?a:null;b&&"function"===typeof b.create&&b.create()},
renderViewModeMenu:function(){var a=this.switcherNode;this.commandRegistry.destroy(a);this.commandRegistry.renderCommands(a.id,a,null,this,"button")}});return a});
define("orion/inputManager","i18n!orion/edit/nls/messages orion/explorers/navigatorRenderer orion/i18nUtil orion/Deferred orion/EventTarget orion/objects orion/PageUtil".split(" "),function(k,n,l,g,c,f,b){function e(a){this._document=a.document||document;this._timeout=a.timeout;a="keypress keydown keyup mousemove mousedown mousemove".split(" ");for(var b=function(a){this._resetTimer()}.bind(this),d=0;d<a.length;d++)this._document.addEventListener(a[d],b,!0);c.attach(this)}function d(a,b){if(a){if(!b.Severity){var d=
b,c={Severity:"Error",Message:k.noResponse};if(0!==d.status)if(d.responseText){d=d.responseText;try{var e=JSON.parse(d);c.Severity=e.Severity||c.Severity;c.Message=e.Message||c.Message}catch(f){c.Message=d}}else try{c.Message=JSON.stringify(d)}catch(g){}b=c}a.setProgressResult(b)}else window.console.log(b)}function m(a){c.attach(this);this.serviceRegistry=a.serviceRegistry;this.statusService=a.statusService;this.fileClient=a.fileClient;this.progressService=a.progressService;this.contentTypeRegistry=
a.contentTypeRegistry;this.selection=a.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}e.prototype={_resetTimer:function(){var a=this._document.defaultView||this._document.parentWindow;this._timer&&(a.clearTimeout(this._timer),this._timer=null);-1!==this._timeout&&(this._timer=a.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout))},onIdle:function(a){return this.dispatchEvent(a)},setTimeout:function(a){this._timeout=
a;this._resetTimer()}};f.mixin(m.prototype,{_maybeLoadWorkspace:function(a){var b=this.fileClient;return a===b.fileServiceRootURL(a)?b.loadWorkspace(a).then(function(a){return a.Location}):(new g).resolve(a)},_read:function(a){var b=this.cachedMetadata||n.getClickedItem();if(b&&b.Location===a&&b.Parents&&b.Attributes&&b.ETag)return(new g).resolve(b);var d=this.fileClient,c=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(a).then(function(a){return d.read.apply(d,[a].concat(c))})},
load:function(){var a=this.getInput();if(a){var b=this.fileClient,c=this._parsedLocation.resource,e=this.progressService,f=function(a,b,d){return!e?a:e.progress(a,l.formatMessage(b,d))},m=this.getEditor();if(this._fileMetadata)!this._saving&&!this._fileMetadata.Directory&&!this._readonly&&f(b.read(c,!0),k.ReadingMetadata,a).then(function(d){this._fileMetadata&&this._fileMetadata.Location===d.Location&&this._fileMetadata.ETag!==d.ETag&&(this._fileMetadata=d,(!m.isDirty()||window.confirm(k.loadOutOfSync))&&
f(b.read(c),k.Reading,a).then(function(b){m.setInput(a,null,b);this._unsavedChanges=[]}.bind(this)))}.bind(this));else{var n=c;if(0===n.indexOf("/gitapi/commit/")){var u=n.indexOf("/file"),w=n.indexOf("?",u);-1===w&&(w=n.length);n=n.substring(u,w);this._readonly=!0}var z=window.setTimeout(function(){z=null;this.reportStatus(l.formatMessage(k.Fetching,a))}.bind(this),800),y=function(){this.reportStatus("");z&&window.clearTimeout(z)}.bind(this),x=function(a){y();var b=null;this.serviceRegistry?b=this.serviceRegistry.getService("orion.page.message"):
this.statusService&&(b=this.statusService);d(b,a);this._setNoInput()}.bind(this);this._acceptPatch=null;f(this._read(n,!0),k.ReadingMetadata,n).then(function(d){d?d.Directory?g.when(d.Children||f(b.fetchChildren(d.ChildrenLocation),k.Reading,a),function(b){y();d.Children=b;this._setInputContents(this._parsedLocation,a,b,d)}.bind(this),x):this._isText(d)?f(b.read(c,!1,!0),k.Reading,a).then(function(b){y();"string"!==typeof b&&(this._acceptPatch=b.acceptPatch,b=b.result);this._setInputContents(this._parsedLocation,
a,b,d)}.bind(this),x):f(b._getService(c).readBlob(c),k.Reading,a).then(function(b){y();this._setInputContents(this._parsedLocation,a,b,d)}.bind(this),x):x({responseText:l.formatMessage(k.ReadingMetadataError,n)})}.bind(this),x)}}},processParameters:function(a){var b=this.getEditor();b&&b.processParameters&&b.processParameters(a)},getAutoLoadEnabled:function(){return this._autoLoadEnabled},getAutoSaveEnabled:function(){return this._autoSaveEnabled},getEditor:function(){return this.editor},getInput:function(){return this._input},
getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var a=this._fileMetadata;return this._readonly||!a||a.Attributes&&a.Attributes.ReadOnly},getContentType:function(){return this._contentType},onFocus:function(a){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()},onChanging:function(a){if(this._getSaveDiffsEnabled()){var b=this._unsavedChanges.length,d=a.removedCharCount,c=a.start,e=a.start+d,f=
0;0===a.addedCharCount?f=-1:0===d&&(f=1);if(0<b&&f===this.previousChangeType){b=this._unsavedChanges[b-1];if(0===d&&c===b.end+b.text.length){b.text+=a.text;return}if(0===a.addedCharCount&&e===b.start){b.start=c;return}}this.previousChangeType=f;this._unsavedChanges.push({start:c,end:e,text:a.text})}},reportStatus:function(a){this.statusReporter?this.statusReporter(a):this.editor&&this.editor.reportStatus(a)},save:function(){function a(a){f===A.getInput()&&(A.getFileMetadata().ETag=a.ETag,c.setInput(f,
null,g,!0));A.reportStatus("");e&&p&&p.setProgressResult({Message:k.Saved,Severity:"Normal"});A.afterSave&&A.afterSave();A._saving=!1}function b(a){A.reportStatus("");d(p,a);A._saving=!1;A._errorSaving=!0}if(!this._saving){var c=this.getEditor();if(c&&c.isDirty()&&!this.getReadOnly()){var e=this._errorSaving;this._saving=!0;var f=this.getInput();this.reportStatus(k["Saving..."]);this.dispatchEvent({type:"Saving",inputManager:this});c.markClean();var g=c.getText(),m=g;if(this._getSaveDiffsEnabled()&&
!this._errorSaving){for(var n=this._unsavedChanges,w=0,z=0;z<n.length;z++)w+=n[z].text.length;g.length>w&&(m={diff:n})}this._unsavedChanges=[];this._errorSaving=!1;var n={ETag:this.getFileMetadata().ETag},y=this._parsedLocation.resource,m=this.fileClient.write(y,m,n),x=this.progressService,p=null;this.serviceRegistry&&(p=this.serviceRegistry.getService("orion.page.message"));x&&(m=x.progress(m,l.formatMessage(k.savingFile,f)));var A=this;m.then(a,function(d){412===d.status?window.confirm(k.saveOutOfSync)?
(d=A.fileClient.write(y,g),x&&(d=x.progress(d,l.formatMessage(k.savingFile,f))),d.then(a,b)):A._saving=!1:b(d)})}}},setAutoLoadEnabled:function(a){this._autoLoadEnabled=a},setAutoSaveTimeout:function(a){this._autoSaveEnabled=-1!==a;this._idle?this._idle.setTimeout(a):(this._idle=new e({document:document,timeout:a}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(a){this._contentType=a},setInput:function(a){if(!this._ignoreInput&&
(a||(a=b.hash()),"string"===typeof a)){var d=this.getEditor();a&&"#"!==a[0]&&(a="#"+a);var c=b.matchResourceParameters(a),e=this._parsedLocation||{};if(d&&d.isDirty()){var f=this._location;if(e.resource!==c.resource)if(this._autoSaveEnabled)this.save();else if(!window.confirm(k.confirmUnsavedChanges)){window.location.hash=f;return}}d=d&&e.editor!==c.editor;this._location=a;this._parsedLocation=c;this._ignoreInput=!0;this.selection&&this.selection.setSelections(a);this._ignoreInput=!1;(a=c.resource)?
a===this._input?d?(this.reportStatus(""),this._setInputContents(c,a,null,this._fileMetadata,this._isText(this._fileMetadata))):this.processParameters(c):(this._input=a,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(a){var b=a.lastIndexOf("/");-1!==b&&(a=a.substring(b+1));this._title=a},setSaveDiffsEnabled:function(a){this._saveDiffsEnabled=a},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&null!==this._acceptPatch&&-1!==this._acceptPatch.indexOf("application/json-patch")},
_isText:function(a){a=this.contentTypeRegistry.getFileContentType(a);if(!a)return!0;var b=this.contentTypeRegistry.getContentType("text/plain");return this.contentTypeRegistry.isExtensionOf(a,b)},_setNoInput:function(a){a?this.fileClient.loadWorkspace("").then(function(a){this._input=a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=this._fileMetadata=null,this.setContentType(null),this.dispatchEvent({type:"InputChanged",input:null}))},_setInputContents:function(a,
b,d,c,e){var f,g=!1;c?(this._fileMetadata=c,this.setTitle(c.Location||String(c)),this.setContentType(this.contentTypeRegistry.getFileContentType(c)),f=c.Name,g=c.Directory):(this._fileMetadata=null,this.setTitle(b),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),f=this.getTitle());var m=this.getEditor();this._focusListener&&(m&&m.getTextView&&m.getTextView()&&m.getTextView().removeEventListener("Focus",this._focusListener),this._focusListener=null);this._changingListener&&
(m&&m.getModel&&m.getModel()&&m.getModel().removeEventListener("Changing",this._changingListener),this._changingListener=null);c={type:"InputChanged",input:a,name:f,title:b,contentType:this.getContentType(),metadata:c,location:window.location,contents:d};this.dispatchEvent(c);this.editor=m=c.editor;g||(m&&m.getModel&&m.getModel()&&m.getModel().addEventListener("Changing",this._changingListener=this.onChanging.bind(this)),e||m.setInput(b,null,d),m&&m.getTextView&&m.getTextView()&&m.getTextView().addEventListener("Focus",
this._focusListener=this.onFocus.bind(this)),this._unsavedChanges=[],this.processParameters(a))}});return{handleError:d,InputManager:m}});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(k,n,l){function g(c,f){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(c);this.setLineDelimiter(f)}g.prototype={destroy:function(){},find:function(c){1<this._text.length&&(this._text=[this._text.join("")]);var f=c.string,b=c.regex,e=f,d="",g=c.caseInsensitive;if(e)if(b){if(f=n.parse(e))e=f.pattern,d=f.flags}else e=f.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26"),g&&(e=e.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var a=null,h;if(e){var f=c.reverse,k=c.wrap,b=c.wholeWord,l=c.start||0;c=c.end;var q=null!==c&&void 0!==c;-1===d.indexOf("g")&&(d+="g");-1===d.indexOf("m")&&(d+="m");g&&-1===d.indexOf("i")&&(d+="i");b&&(e="\\b"+e+"\\b");var r=this._text[0],v,u,w=0;q&&(g=l<c?l:c,r=r.substring(g,l<c?c:l),w=g);var z=RegExp(e,d);f?h=function(){var a=null;for(z.lastIndex=0;;){u=z.lastIndex;v=z.exec(r);if(u===z.lastIndex)return null;if(v){if(!(v.index+w<l)){if(!k||a)break;l=r.length+w}a={start:v.index+
w,end:z.lastIndex+w}}else break}a&&(l=a.start);return a}:(q||(z.lastIndex=l),h=function(){for(;;){u=z.lastIndex;v=z.exec(r);if(u===z.lastIndex)break;if(v)return{start:v.index+w,end:z.lastIndex+w};if(!(0!==u&&k))break}return null});a=h()}return{next:function(){var b=a;b&&(a=h());return b},hasNext:function(){return null!==a}}},getCharCount:function(){for(var c=0,f=0;f<this._text.length;f++)c+=this._text[f].length;return c},getLine:function(c,f){var b=this.getLineCount();if(!(0<=c&&c<b))return null;
var e=this._lineOffsets[c];if(c+1<b){b=this.getText(e,this._lineOffsets[c+1]);if(f)return b;for(var e=b.length,d;10===(d=b.charCodeAt(e-1))||13===d;)e--;return b.substring(0,e)}return this.getText(e)},getLineAtOffset:function(c){var f=this.getCharCount();if(!(0<=c&&c<=f))return-1;var b=this.getLineCount();if(c===f)return b-1;var e,d,g=this._lastLineIndex;if(0<=g&&g<b&&(e=this._lineOffsets[g],d=g+1<b?this._lineOffsets[g+1]:f,e<=c&&c<d))return g;for(var a=b,h=-1;1<a-h;)if(g=Math.floor((a+h)/2),e=this._lineOffsets[g],
d=g+1<b?this._lineOffsets[g+1]:f,c<=e)a=g;else if(c<d){a=g;break}else h=g;return this._lastLineIndex=a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(c,f){var b=this.getLineCount();if(!(0<=c&&c<b))return-1;if(c+1<b){b=this._lineOffsets[c+1];if(f)return b;for(var e=this.getText(Math.max(this._lineOffsets[c],b-2),b),d=e.length,g;10===(g=e.charCodeAt(d-1))||13===g;)d--;return b-(e.length-d)}return this.getCharCount()},
getLineStart:function(c){return!(0<=c&&c<this.getLineCount())?-1:this._lineOffsets[c]},getText:function(c,f){void 0===c&&(c=0);void 0===f&&(f=this.getCharCount());if(c===f)return"";for(var b=0,e=0,d;e<this._text.length;){d=this._text[e].length;if(c<=b+d)break;b+=d;e++}for(var g=b,a=e;e<this._text.length;){d=this._text[e].length;if(f<=b+d)break;b+=d;e++}if(a===e)return this._text[a].substring(c-g,f-b);g=this._text[a].substring(c-g);b=this._text[e].substring(0,f-b);return g+this._text.slice(a+1,e).join("")+
b},onChanging:function(c){return this.dispatchEvent(c)},onChanged:function(c){return this.dispatchEvent(c)},setLineDelimiter:function(c,f){"auto"===c&&(c=void 0,1<this.getLineCount()&&(c=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=c?c:l.platformDelimiter;if(f){var b=this.getLineCount();if(1<b){for(var e=Array(b),d=0;d<b;d++)e[d]=this.getLine(d);this.setText(e.join(this._lineDelimiter))}}},setText:function(c,f,b){void 0===c&&(c="");void 0===f&&(f=0);void 0===b&&(b=
this.getCharCount());if(!(f===b&&""===c)){for(var e=this.getLineAtOffset(f),d=this.getLineAtOffset(b),g=f,a=b-f,h=d-e,k=c.length,l=0,q=this.getLineCount(),r=0,n=0,u=0,w=[];;){-1!==r&&r<=u&&(r=c.indexOf("\r",u));-1!==n&&n<=u&&(n=c.indexOf("\n",u));if(-1===n&&-1===r)break;u=-1!==r&&-1!==n?r+1===n?n+1:(r<n?r:n)+1:-1!==r?r+1:n+1;w.push(f+u);l++}this.onChanging({type:"Changing",text:c,start:g,removedCharCount:a,addedCharCount:k,removedLineCount:h,addedLineCount:l});0===w.length&&(u=this.getLineStart(e),
d=d+1<q?this.getLineStart(d+1):this.getCharCount(),f!==u&&(c=this.getText(u,f)+c,f=u),b!==d&&(c+=this.getText(b,d),b=d));u=k-a;for(d=e+h+1;d<q;d++)this._lineOffsets[d]+=u;if(5E4>w.length)e=[e+1,h].concat(w),Array.prototype.splice.apply(this._lineOffsets,e);else{u=e+1;this._lineOffsets.splice(u,h);for(q=0;q<w.length;q+=5E4)e=[u,0].concat(w.slice(q,Math.min(w.length,q+5E4))),Array.prototype.splice.apply(this._lineOffsets,e),u+=5E4}for(u=q=0;u<this._text.length;){d=this._text[u].length;if(f<=q+d)break;
q+=d;u++}e=q;for(w=u;u<this._text.length;){d=this._text[u].length;if(b<=q+d)break;q+=d;u++}d=this._text[u];f=this._text[w].substring(0,f-e);b=d.substring(b-q);w=[w,u-w+1];f&&w.push(f);c&&w.push(c);b&&w.push(b);Array.prototype.splice.apply(this._text,w);0===this._text.length&&(this._text=[""]);this.onChanged({type:"Changed",start:g,removedCharCount:a,addedCharCount:k,removedLineCount:h,addedLineCount:l})}}};k.EventTarget.addMixin(g.prototype);return{TextModel:g}});
define("orion/editor/undoStack",[],function(){function k(g,c,f,b,e){this.model=g;this.offset=c;this.text=f;this.previousText=b;this.type=e}function n(g){this.owner=g;this.changes=[]}function l(g,c){this.size=void 0!==c?c:100;this.reset();var f=this;this._listener={onChanging:function(b){f._onChanging(b)},onDestroy:function(b){f._onDestroy(b)}};if(g.getModel){var b=g.getModel();b.getBaseModel&&(b=b.getBaseModel());this.model=b;this.setView(g)}else this.shared=!0,this.model=g;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(g,c){this._doUndoRedo(this.offset,this.previousText,this.text,g,c);return!0},redo:function(g,c){this._doUndoRedo(this.offset,this.text,this.previousText,g,c);return!0},merge:function(g,c,f,b,e){if(b===this.type){if(1===b&&g===
this.offset+this.text.length)return this.text+=c,!0;if(-1===b&&e===this.offset)return this.offset=g,this.previousText=f+this.previousText,!0;if(-1===b&&g===this.offset)return this.previousText+=f,!0}return!1},_doUndoRedo:function(g,c,f,b,e){this.model.setText(c,g,g+f.length);e&&b&&(f=b.getModel(),f!==this.model&&(g=f.mapOffset(g,!0)),b.setSelection(g,g+c.length))}};n.prototype={getRedoChanges:function(){for(var g=[],c=0;c<this.changes.length;c++)g=g.concat(this.changes[c].getRedoChanges());return g},
getUndoChanges:function(){for(var g=[],c=this.changes.length-1;0<=c;c--)g=g.concat(this.changes[c].getUndoChanges());return g},add:function(g){this.changes.push(g)},end:function(g){g&&(this.endSelection=g.getSelection(),this.endCaret=g.getCaretOffset());(g=this.owner)&&g.end&&g.end()},undo:function(g,c){1<this.changes.length&&g&&g.setRedraw(!1);for(var f=this.changes.length-1;0<=f;f--)this.changes[f].undo(g,!1);1<this.changes.length&&g&&g.setRedraw(!0);if(c&&g){var f=this.startSelection.start,b=this.startSelection.end;
g.setSelection(this.startCaret?f:b,this.startCaret?b:f)}(f=this.owner)&&f.undo&&f.undo();return 0<this.changes.length},redo:function(g,c){1<this.changes.length&&g&&g.setRedraw(!1);for(var f=0;f<this.changes.length;f++)this.changes[f].redo(g,!1);(1<this.changes.length,g)&&g.setRedraw(!0);if(c&&g){var f=this.endSelection.start,b=this.endSelection.end;g.setSelection(this.endCaret?f:b,this.endCaret?b:f)}(f=this.owner)&&f.redo&&f.redo();return 0<this.changes.length},merge:function(g,c,f,b,e){var d=this.changes.length;
return 0<d?this.changes[d-1].merge(g,c,f,b,e):!1},start:function(g){g&&(this.startSelection=g.getSelection(),this.startCaret=g.getCaretOffset());(g=this.owner)&&g.start&&g.start()}};l.prototype={destroy:function(){this._onDestroy()},add:function(g){this.compoundChange?this.compoundChange.add(g):(this.stack.splice(this.index,this.stack.length-this.index,g),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 0<this.index},canRedo:function(){return 0<this.stack.length-this.index},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 g=[],c=this.index;c<this.stack.length;c++)g=g.concat(this.stack[c].getRedoChanges());
return g},getUndoChanges:function(){this._commitUndo();for(var g=[],c=this.index;0<=c;c--)g=g.concat(this.stack[c].getUndoChanges());return g},undo:function(){this._commitUndo();var g;g=!1;this._ignoreUndo=!0;do{if(0>=this.index)break;g=this.stack[--this.index]}while(!(g=g.undo(this.view,!0)));this._ignoreUndo=!1;return g},redo:function(){this._commitUndo();var g;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;g=this.stack[this.index++]}while(!g.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(g){this.view!==g&&(this.view&&g.removeEventListener("Destroy",this._listener.onDestroy),(this.view=g)&&g.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(g){this._commitUndo();g=new n(g);this.add(g);this.compoundChange=g;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(g){(!g||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(g){if(!this._ignoreUndo){var c=g.text,f=g.start,b=g.addedCharCount,e=g.removedCharCount;g=f+e;var d=0;0===b&&1===e?d=-1:1===b&&0===e&&(d=1);b=this.stack.length;e=this.model.getText(f,g);(!(0<b&&this.index===b)||!this.stack[b-1].merge(f,c,e,d,g))&&this.add(new k(this.model,
f,c,e,d))}}};return{UndoStack:l}});
(function(){function k(a){this.tokens=[];this.tokens.links={};this.options=a||e.defaults;this.rules=d.normal;this.options.gfm&&(this.rules=this.options.tables?d.tables:d.gfm)}function n(a,b){this.options=b||e.defaults;this.links=a;this.rules=m.normal;if(!this.links)throw Error("Tokens array requires a `links` property.");this.options.gfm?this.rules=this.options.breaks?m.breaks:m.gfm:this.options.pedantic&&(this.rules=m.pedantic)}function l(a){this.tokens=[];this.token=null;this.options=a||e.defaults}
function g(a,b){return a.replace(!b?/&(?!#?\w+;)/g:/&/g,"\x26amp;").replace(/</g,"\x26lt;").replace(/>/g,"\x26gt;").replace(/"/g,"\x26quot;").replace(/'/g,"\x26#39;")}function c(a,b){a=a.source;b=b||"";return function t(d,c){if(!d)return RegExp(a,b);c=c.source||c;c=c.replace(/(^|[^\[])\^/g,"$1");a=a.replace(d,c);return t}}function f(){}function b(a){for(var b=1,d,c;b<arguments.length;b++)for(c in d=arguments[b],d)Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c]);return a}function e(a,d,c){if(c||
"function"===typeof d){c||(c=d,d=null);d&&(d=b({},e.defaults,d));var f=d.highlight,q,m,n=0;try{q=k.lex(a,d)}catch(u){return c(u)}m=q.length;var w=function(a){var b,p;!0!==a&&delete d.highlight;try{b=l.parse(q,d)}catch(e){p=e}d.highlight=f;return p?c(p):c(null,b)};if(!f||3>f.length)return w(!0);if(!m)return w();for(;n<q.length;n++)(function(a){return"code"!==a.type?--m||w():f(a.text,a.lang,function(b,d){if(null==d||d===a.text)return--m||w();a.text=d;a.escaped=!0;--m||w()})})(q[n])}else try{return d&&
(d=b({},e.defaults,d)),l.parse(k.lex(a,d),d)}catch(z){z.message+="\nPlease report this to https://github.com/chjj/marked.";if((d||e.defaults).silent)return"\x3cp\x3eAn error occured:\x3c/p\x3e\x3cpre\x3e"+g(z.message+"",!0)+"\x3c/pre\x3e";throw z;}}var d={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:f,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:f,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/,bullet:/(?:[*+-]|\d+\.)/,item:/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/};d.item=c(d.item,"gm")(/bull/g,d.bullet)();d.list=c(d.list)(/bull/g,d.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)();d._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|@)\\b";
d.html=c(d.html)("comment",/\x3c!--[\s\S]*?--\x3e/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,d._tag)();d.paragraph=c(d.paragraph)("hr",d.hr)("heading",d.heading)("lheading",d.lheading)("blockquote",d.blockquote)("tag","\x3c"+d._tag)("def",d.def)();d.normal=b({},d);d.gfm=b({},d.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});d.gfm.paragraph=c(d.paragraph)("(?!","(?!"+d.gfm.fences.source.replace("\\1","\\2")+"|")();
d.tables=b({},d.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});k.rules=d;k.lex=function(a,b){return(new k(b)).lex(a)};k.prototype.lex=function(a){a=a.replace(/\r\n|\r/g,"\n").replace(/\t/g,"    ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(a,!0)};k.prototype.token=function(a,b){a=a.replace(/^ +$/gm,"");for(var c,e,f,g,m,k,l;a;){if(f=this.rules.newline.exec(a))a=a.substring(f[0].length),
1<f[0].length&&this.tokens.push({type:"space"});if(f=this.rules.code.exec(a))a=a.substring(f[0].length),f=f[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:!this.options.pedantic?f.replace(/\n+$/,""):f});else if(f=this.rules.fences.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"code",lang:f[2],text:f[3]});else if(f=this.rules.heading.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"heading",depth:f[1].length,text:f[2]});else if(b&&(f=this.rules.nptable.exec(a))){a=
a.substring(f[0].length);m={type:"table",header:f[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/\n$/,"").split("\n")};for(k=0;k<m.align.length;k++)/^ *-+: *$/.test(m.align[k])?m.align[k]="right":/^ *:-+: *$/.test(m.align[k])?m.align[k]="center":/^ *:-+ *$/.test(m.align[k])?m.align[k]="left":m.align[k]=null;for(k=0;k<m.cells.length;k++)m.cells[k]=m.cells[k].split(/ *\| */);this.tokens.push(m)}else if(f=this.rules.lheading.exec(a))a=
a.substring(f[0].length),this.tokens.push({type:"heading",depth:"\x3d"===f[2]?1:2,text:f[1]});else if(f=this.rules.hr.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"hr"});else if(f=this.rules.blockquote.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"blockquote_start"}),f=f[0].replace(/^ *> ?/gm,""),this.token(f,b),this.tokens.push({type:"blockquote_end"});else if(f=this.rules.list.exec(a)){a=a.substring(f[0].length);g=f[2];this.tokens.push({type:"list_start",ordered:1<g.length});
f=f[0].match(this.rules.item);c=!1;l=f.length;for(k=0;k<l;k++)m=f[k],e=m.length,m=m.replace(/^ *([*+-]|\d+\.) +/,""),~m.indexOf("\n ")&&(e-=m.length,m=!this.options.pedantic?m.replace(RegExp("^ {1,"+e+"}","gm"),""):m.replace(/^ {1,4}/gm,"")),this.options.smartLists&&k!==l-1&&(e=d.bullet.exec(f[k+1])[0],g!==e&&!(1<g.length&&1<e.length)&&(a=f.slice(k+1).join("\n")+a,k=l-1)),e=c||/\n\n(?!\s*$)/.test(m),k!==l-1&&(c="\n"===m[m.length-1],e||(e=c)),this.tokens.push({type:e?"loose_item_start":"list_item_start"}),
this.token(m,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(f=this.rules.html.exec(a))a=a.substring(f[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:"pre"===f[1]||"script"===f[1],text:f[0]});else if(b&&(f=this.rules.def.exec(a)))a=a.substring(f[0].length),this.tokens.links[f[1].toLowerCase()]={href:f[2],title:f[3]};else if(b&&(f=this.rules.table.exec(a))){a=a.substring(f[0].length);m={type:"table",header:f[1].replace(/^ *| *\| *$/g,
"").split(/ *\| */),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:f[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(k=0;k<m.align.length;k++)/^ *-+: *$/.test(m.align[k])?m.align[k]="right":/^ *:-+: *$/.test(m.align[k])?m.align[k]="center":/^ *:-+ *$/.test(m.align[k])?m.align[k]="left":m.align[k]=null;for(k=0;k<m.cells.length;k++)m.cells[k]=m.cells[k].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(m)}else if(b&&(f=this.rules.paragraph.exec(a)))a=a.substring(f[0].length),
this.tokens.push({type:"paragraph",text:"\n"===f[1][f[1].length-1]?f[1].slice(0,-1):f[1]});else if(f=this.rules.text.exec(a))a=a.substring(f[0].length),this.tokens.push({type:"text",text:f[0]});else if(a)throw Error("Infinite loop on byte: "+a.charCodeAt(0));}return this.tokens};var m={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:f,tag:/^\x3c!--[\s\S]*?--\x3e|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,
nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:f,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/,_inside:/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,_href:/\s*<?([^\s]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/};m.link=c(m.link)("inside",m._inside)("href",m._href)();m.reflink=c(m.reflink)("inside",m._inside)();m.normal=b({},m);m.pedantic=b({},
m.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});m.gfm=b({},m.normal,{escape:c(m.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:c(m.text)("]|","~]|")("|","|https?://|")()});m.breaks=b({},m.gfm,{br:c(m.br)("{2,}","*")(),text:c(m.gfm.text)("{2,}","*")()});n.rules=m;n.output=function(a,b,d){return(new n(b,d)).output(a)};n.prototype.output=function(a){for(var b=
"",d,c;a;)if(c=this.rules.escape.exec(a))a=a.substring(c[0].length),b+=c[1];else if(c=this.rules.autolink.exec(a))a=a.substring(c[0].length),"@"===c[2]?(d=":"===c[1][6]?this.mangle(c[1].substring(7)):this.mangle(c[1]),c=this.mangle("mailto:")+d):c=d=g(c[1]),b+='\x3ca href\x3d"'+c+'"\x3e'+d+"\x3c/a\x3e";else if(c=this.rules.url.exec(a))a=a.substring(c[0].length),c=d=g(c[1]),b+='\x3ca href\x3d"'+c+'"\x3e'+d+"\x3c/a\x3e";else if(c=this.rules.tag.exec(a))a=a.substring(c[0].length),b+=this.options.sanitize?
g(c[0]):c[0];else if(c=this.rules.link.exec(a))a=a.substring(c[0].length),b+=this.outputLink(c,{href:c[2],title:c[3]});else if((c=this.rules.reflink.exec(a))||(c=this.rules.nolink.exec(a)))a=a.substring(c[0].length),d=(c[2]||c[1]).replace(/\s+/g," "),d=this.links[d.toLowerCase()],!d||!d.href?(b+=c[0][0],a=c[0].substring(1)+a):b+=this.outputLink(c,d);else if(c=this.rules.strong.exec(a))a=a.substring(c[0].length),b+="\x3cstrong\x3e"+this.output(c[2]||c[1])+"\x3c/strong\x3e";else if(c=this.rules.em.exec(a))a=
a.substring(c[0].length),b+="\x3cem\x3e"+this.output(c[2]||c[1])+"\x3c/em\x3e";else if(c=this.rules.code.exec(a))a=a.substring(c[0].length),b+="\x3ccode\x3e"+g(c[2],!0)+"\x3c/code\x3e";else if(c=this.rules.br.exec(a))a=a.substring(c[0].length),b+="\x3cbr\x3e";else if(c=this.rules.del.exec(a))a=a.substring(c[0].length),b+="\x3cdel\x3e"+this.output(c[1])+"\x3c/del\x3e";else if(c=this.rules.text.exec(a))a=a.substring(c[0].length),b+=g(this.smartypants(c[0]));else if(a)throw Error("Infinite loop on byte: "+
a.charCodeAt(0));return b};n.prototype.outputLink=function(a,b){return"!"!==a[0][0]?'\x3ca href\x3d"'+g(b.href)+'"'+(b.title?' title\x3d"'+g(b.title)+'"':"")+"\x3e"+this.output(a[1])+"\x3c/a\x3e":'\x3cimg src\x3d"'+g(b.href)+'" alt\x3d"'+g(a[1])+'"'+(b.title?' title\x3d"'+g(b.title)+'"':"")+"\x3e"};n.prototype.smartypants=function(a){return!this.options.smartypants?a:a.replace(/--/g,"\u2014").replace(/'([^']*)'/g,"\u2018$1\u2019").replace(/"([^"]*)"/g,"\u201c$1\u201d").replace(/\.{3}/g,"\u2026")};
n.prototype.mangle=function(a){for(var b="",d=a.length,c=0,e;c<d;c++)e=a.charCodeAt(c),0.5<Math.random()&&(e="x"+e.toString(16)),b+="\x26#"+e+";";return b};l.parse=function(a,b){return(new l(b)).parse(a)};l.prototype.parse=function(a){this.inline=new n(a.links,this.options);this.tokens=a.reverse();for(a="";this.next();)a+=this.tok();return a};l.prototype.next=function(){return this.token=this.tokens.pop()};l.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};l.prototype.parseText=
function(){for(var a=this.token.text;"text"===this.peek().type;)a+="\n"+this.next().text;return this.inline.output(a)};l.prototype.tok=function(){switch(this.token.type){case "space":return"";case "hr":return"\x3chr\x3e\n";case "heading":return"\x3ch"+this.token.depth+"\x3e"+this.inline.output(this.token.text)+"\x3c/h"+this.token.depth+"\x3e\n";case "code":if(this.options.highlight){var a=this.options.highlight(this.token.text,this.token.lang);null!=a&&a!==this.token.text&&(this.token.escaped=!0,
this.token.text=a)}this.token.escaped||(this.token.text=g(this.token.text,!0));return"\x3cpre\x3e\x3ccode"+(this.token.lang?' class\x3d"'+this.options.langPrefix+this.token.lang+'"':"")+"\x3e"+this.token.text+"\x3c/code\x3e\x3c/pre\x3e\n";case "table":var b,d,c,e,a="\x3cthead\x3e\n\x3ctr\x3e\n";for(d=0;d<this.token.header.length;d++)b=this.inline.output(this.token.header[d]),a+=this.token.align[d]?'\x3cth align\x3d"'+this.token.align[d]+'"\x3e'+b+"\x3c/th\x3e\n":"\x3cth\x3e"+b+"\x3c/th\x3e\n";a+=
"\x3c/tr\x3e\n\x3c/thead\x3e\n\x3ctbody\x3e\n";for(d=0;d<this.token.cells.length;d++){b=this.token.cells[d];a+="\x3ctr\x3e\n";for(e=0;e<b.length;e++)c=this.inline.output(b[e]),a+=this.token.align[e]?'\x3ctd align\x3d"'+this.token.align[e]+'"\x3e'+c+"\x3c/td\x3e\n":"\x3ctd\x3e"+c+"\x3c/td\x3e\n";a+="\x3c/tr\x3e\n"}return"\x3ctable\x3e\n"+(a+"\x3c/tbody\x3e\n")+"\x3c/table\x3e\n";case "blockquote_start":for(a="";"blockquote_end"!==this.next().type;)a+=this.tok();return"\x3cblockquote\x3e\n"+a+"\x3c/blockquote\x3e\n";
case "list_start":d=this.token.ordered?"ol":"ul";for(a="";"list_end"!==this.next().type;)a+=this.tok();return"\x3c"+d+"\x3e\n"+a+"\x3c/"+d+"\x3e\n";case "list_item_start":for(a="";"list_item_end"!==this.next().type;)a+="text"===this.token.type?this.parseText():this.tok();return"\x3cli\x3e"+a+"\x3c/li\x3e\n";case "loose_item_start":for(a="";"list_item_end"!==this.next().type;)a+=this.tok();return"\x3cli\x3e"+a+"\x3c/li\x3e\n";case "html":return!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):
this.token.text;case "paragraph":return"\x3cp\x3e"+this.inline.output(this.token.text)+"\x3c/p\x3e\n";case "text":return"\x3cp\x3e"+this.parseText()+"\x3c/p\x3e\n"}};f.exec=f;e.options=e.setOptions=function(a){b(e.defaults,a);return e};e.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1};e.Parser=l;e.parser=l.parse;e.Lexer=k;e.lexer=k.lex;e.InlineLexer=n;e.inlineLexer=n.output;e.parse=e;"object"===typeof exports?module.exports=
e:"function"===typeof define&&define.amd?define("marked/marked",[],function(){return e}):this.marked=e}).call(function(){return this||("undefined"!==typeof window?window:global)}());
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(k,n){function l(c){c&&(this._view=c,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function g(c){l.call(this,c)}l.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(c){for(var f=[],b=this._keyBindings,e=0;e<b.length;e++)b[e].actionID===c&&f.push(b[e].keyBinding);return f},getView:function(){return this._view},isActive:function(){return-1!==this._view.getKeyModes().indexOf(this)},match:function(c){if("keydown"===
c.type)switch(c.keyCode){case 16:case 17:case 18:case 91:return}for(var f=this._keyBindingIndex,b=this._matchingKeyBindings||this._keyBindings,e=[],d=0;d<b.length;d++){var g=b[d],a=g.keyBinding.match(c,f);if(!0===a)return this._keyBindingIndex=0,this._matchingKeyBindings=null,g.actionID;"number"===typeof a&&e.push(g)}if(0===e.length)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=e,"noop"},setKeyBinding:function(c,f){for(var b=this._keyBindings,
e=0;e<b.length;e++){var d=b[e];if(d.keyBinding.equals(c)){f?d.actionID=f:d.predefined?d.actionID="noop":b.splice(e,1);return}}f&&b.push({keyBinding:c,actionID:f})},setView:function(c){this._view=c}};g.prototype=new l;g.prototype.createKeyBindings=function(){var c=k.KeyBinding,f=[];f.push({actionID:"lineUp",keyBinding:new c(38),predefined:!0});f.push({actionID:"lineDown",keyBinding:new c(40),predefined:!0});f.push({actionID:"charPrevious",keyBinding:new c(37),predefined:!0});f.push({actionID:"charNext",
keyBinding:new c(39),predefined:!0});n.isMac?(f.push({actionID:"scrollPageUp",keyBinding:new c(33),predefined:!0}),f.push({actionID:"scrollPageDown",keyBinding:new c(34),predefined:!0}),f.push({actionID:"pageUp",keyBinding:new c(33,null,null,!0),predefined:!0}),f.push({actionID:"pageDown",keyBinding:new c(34,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new c(37,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(39,!0),predefined:!0}),f.push({actionID:"wordPrevious",
keyBinding:new c(37,null,null,!0),predefined:!0}),f.push({actionID:"wordNext",keyBinding:new c(39,null,null,!0),predefined:!0}),f.push({actionID:"scrollTextStart",keyBinding:new c(36),predefined:!0}),f.push({actionID:"scrollTextEnd",keyBinding:new c(35),predefined:!0}),f.push({actionID:"textStart",keyBinding:new c(38,!0),predefined:!0}),f.push({actionID:"textEnd",keyBinding:new c(40,!0),predefined:!0}),f.push({actionID:"scrollPageUp",keyBinding:new c(38,null,null,null,!0),predefined:!0}),f.push({actionID:"scrollPageDown",
keyBinding:new c(40,null,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new c(37,null,null,null,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(39,null,null,null,!0),predefined:!0}),f.push({actionID:"lineStart",keyBinding:new c(38,null,null,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(40,null,null,!0),predefined:!0})):(f.push({actionID:"pageUp",keyBinding:new c(33),predefined:!0}),f.push({actionID:"pageDown",keyBinding:new c(34),predefined:!0}),
f.push({actionID:"lineStart",keyBinding:new c(36),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c(35),predefined:!0}),f.push({actionID:"wordPrevious",keyBinding:new c(37,!0),predefined:!0}),f.push({actionID:"wordNext",keyBinding:new c(39,!0),predefined:!0}),f.push({actionID:"textStart",keyBinding:new c(36,!0),predefined:!0}),f.push({actionID:"textEnd",keyBinding:new c(35,!0),predefined:!0}));n.isFirefox&&n.isLinux&&(f.push({actionID:"lineUp",keyBinding:new c(38,!0),predefined:!0}),f.push({actionID:"lineDown",
keyBinding:new c(40,!0),predefined:!0}));n.isWindows&&(f.push({actionID:"scrollLineUp",keyBinding:new c(38,!0),predefined:!0}),f.push({actionID:"scrollLineDown",keyBinding:new c(40,!0),predefined:!0}));f.push({actionID:"selectLineUp",keyBinding:new c(38,null,!0),predefined:!0});f.push({actionID:"selectLineDown",keyBinding:new c(40,null,!0),predefined:!0});f.push({actionID:"selectCharPrevious",keyBinding:new c(37,null,!0),predefined:!0});f.push({actionID:"selectCharNext",keyBinding:new c(39,null,!0),
predefined:!0});f.push({actionID:"selectPageUp",keyBinding:new c(33,null,!0),predefined:!0});f.push({actionID:"selectPageDown",keyBinding:new c(34,null,!0),predefined:!0});n.isMac?(f.push({actionID:"selectLineStart",keyBinding:new c(37,!0,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(39,!0,!0),predefined:!0}),f.push({actionID:"selectWordPrevious",keyBinding:new c(37,null,!0,!0),predefined:!0}),f.push({actionID:"selectWordNext",keyBinding:new c(39,null,!0,!0),predefined:!0}),
f.push({actionID:"selectTextStart",keyBinding:new c(36,null,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new c(35,null,!0),predefined:!0}),f.push({actionID:"selectTextStart",keyBinding:new c(38,!0,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new c(40,!0,!0),predefined:!0}),f.push({actionID:"selectLineStart",keyBinding:new c(37,null,!0,null,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(39,null,!0,null,!0),predefined:!0}),f.push({actionID:"selectLineStart",
keyBinding:new c(38,null,!0,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(40,null,!0,!0),predefined:!0})):(n.isLinux&&(f.push({actionID:"selectWholeLineUp",keyBinding:new c(38,!0,!0),predefined:!0}),f.push({actionID:"selectWholeLineDown",keyBinding:new c(40,!0,!0),predefined:!0})),f.push({actionID:"selectLineStart",keyBinding:new c(36,null,!0),predefined:!0}),f.push({actionID:"selectLineEnd",keyBinding:new c(35,null,!0),predefined:!0}),f.push({actionID:"selectWordPrevious",
keyBinding:new c(37,!0,!0),predefined:!0}),f.push({actionID:"selectWordNext",keyBinding:new c(39,!0,!0),predefined:!0}),f.push({actionID:"selectTextStart",keyBinding:new c(36,!0,!0),predefined:!0}),f.push({actionID:"selectTextEnd",keyBinding:new c(35,!0,!0),predefined:!0}));f.push({actionID:"undo",keyBinding:new k.KeyBinding("z",!0),predefined:!0});n.isMac?f.push({actionID:"redo",keyBinding:new k.KeyBinding("z",!0,!0),predefined:!0}):f.push({actionID:"redo",keyBinding:new k.KeyBinding("y",!0),predefined:!0});
f.push({actionID:"deletePrevious",keyBinding:new c(8),predefined:!0});f.push({actionID:"deletePrevious",keyBinding:new c(8,null,!0),predefined:!0});f.push({actionID:"deleteNext",keyBinding:new c(46),predefined:!0});f.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0),predefined:!0});f.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0,!0),predefined:!0});f.push({actionID:"deleteWordNext",keyBinding:new c(46,!0),predefined:!0});f.push({actionID:"tab",keyBinding:new c(9),predefined:!0});
f.push({actionID:"shiftTab",keyBinding:new c(9,null,!0),predefined:!0});f.push({actionID:"enter",keyBinding:new c(13),predefined:!0});f.push({actionID:"enter",keyBinding:new c(13,null,!0),predefined:!0});f.push({actionID:"selectAll",keyBinding:new c("a",!0),predefined:!0});f.push({actionID:"toggleTabMode",keyBinding:new c("m",!0),predefined:!0});n.isMac&&(f.push({actionID:"deleteNext",keyBinding:new c(46,null,!0),predefined:!0}),f.push({actionID:"deleteWordPrevious",keyBinding:new c(8,null,null,!0),
predefined:!0}),f.push({actionID:"deleteWordNext",keyBinding:new c(46,null,null,!0),predefined:!0}));f.push({actionID:"toggleWrapMode",keyBinding:new k.KeyBinding("w",!0,!1,!0)});f.push({actionID:"toggleOverwriteMode",keyBinding:new k.KeyBinding(45)});if(!n.isFirefox){var b=n.isMac&&n.isChrome;f.push({actionID:"noop",keyBinding:new c("u",!b,!1,!1,b),predefined:!0});f.push({actionID:"noop",keyBinding:new c("i",!b,!1,!1,b),predefined:!0});f.push({actionID:"noop",keyBinding:new c("b",!b,!1,!1,b),predefined:!0})}n.isFirefox&&
(f.push({actionID:"copy",keyBinding:new c(45,!0),predefined:!0}),f.push({actionID:"paste",keyBinding:new c(45,null,!0),predefined:!0}),f.push({actionID:"cut",keyBinding:new c(46,null,!0),predefined:!0}));n.isMac&&(f.push({actionID:"lineStart",keyBinding:new c("a",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineEnd",keyBinding:new c("e",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineUp",keyBinding:new c("p",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"lineDown",keyBinding:new c("n",!1,!1,
!1,!0),predefined:!0}),f.push({actionID:"charPrevious",keyBinding:new c("b",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"charNext",keyBinding:new c("f",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deletePrevious",keyBinding:new c("h",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteNext",keyBinding:new c("d",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteLineEnd",keyBinding:new c("k",!1,!1,!1,!0),predefined:!0}),n.isFirefox?(f.push({actionID:"scrollPageDown",keyBinding:new c("v",!1,
!1,!1,!0),predefined:!0}),f.push({actionID:"deleteLineStart",keyBinding:new c("u",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"deleteWordPrevious",keyBinding:new c("w",!1,!1,!1,!0),predefined:!0})):(f.push({actionID:"pageDown",keyBinding:new c("v",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"centerLine",keyBinding:new c("l",!1,!1,!1,!0),predefined:!0}),f.push({actionID:"enterNoCursor",keyBinding:new c("o",!1,!1,!1,!0),predefined:!0})));return f};return{KeyMode:l,DefaultKeyMode:g}});
define("orion/editor/util",[],function(){return{contains:function(k,n){if(!n)return!1;if(!k.compareDocumentPosition){for(var l=n;l;){if(k===l)return!0;l=l.parentNode}return!1}return k===n||0!==(k.compareDocumentPosition(n)&16)},addEventListener:function(k,n,l,g){"function"===typeof k.addEventListener?k.addEventListener(n,l,!0===g):k.attachEvent("on"+n,l)},removeEventListener:function(k,n,l,g){"function"===typeof k.removeEventListener?k.removeEventListener(n,l,!0===g):k.detachEvent("on"+n,l)}}});
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,n,l,g,c,f,b){function e(a,d,c){if(c){d.className="";c=d.attributes;for(var e=c.length;0<e--;)(!b.isIE||9<=b.isIE||9>b.isIE&&c[e].specified)&&d.removeAttribute(c[e].name)}if(a){a.styleClass&&(d.className=a.styleClass);if(c=a.style)for(var h in c)c.hasOwnProperty(h)&&(d.style[h]=c[h]);if(a=a.attributes)for(var f in a)a.hasOwnProperty(f)&&
d.setAttribute(f,a[f])}}function d(a){return a instanceof Array?a.slice(0):a}function m(a,b){if(!a)return b;if(!b)return a;for(var d in b)b.hasOwnProperty(d)&&(a.hasOwnProperty(d)||(a[d]=b[d]));return a}function a(b,d){if(b===d)return!0;if(b&&!d||!b&&d||b&&b.constructor===String||d&&d.constructor===String)return!1;if(b instanceof Array||d instanceof Array){if(!(b instanceof Array&&d instanceof Array)||b.length!==d.length)return!1;for(var c=0;c<b.length;c++)if(!a(b[c],d[c]))return!1;return!0}if(!(b instanceof
Object)||!(d instanceof Object))return!1;for(c in b)if(b.hasOwnProperty(c)&&(!d.hasOwnProperty(c)||!a(b[c],d[c])))return!1;for(c in d)if(!b.hasOwnProperty(c))return!1;return!0}function h(a,b,d){for(var c=0,e=0,h=0,f=a.length;h<f;){-1!==c&&c<=h&&(c=a.indexOf("\r",h));-1!==e&&e<=h&&(e=a.indexOf("\n",h));var g=h,m;if(-1===e&&-1===c){b(a.substring(h));break}-1!==c&&-1!==e?c+1===e?(m=c,h=e+1):(m=c<e?c:e,h=(c<e?c:e)+1):-1!==c?(m=c,h=c+1):(m=e,h=e+1);b(a.substring(g,m));d()}}function s(a){var b,d,c,e,h=
a.ownerDocument.defaultView||a.ownerDocument.parentWindow;h.getComputedStyle?(a=h.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),d=a.getPropertyValue("padding-top"),c=a.getPropertyValue("padding-right"),e=a.getPropertyValue("padding-bottom")):a.currentStyle&&(b=a.currentStyle.paddingLeft,d=a.currentStyle.paddingTop,c=a.currentStyle.paddingRight,e=a.currentStyle.paddingBottom);return{left:parseInt(b,10)||0,top:parseInt(d,10)||0,right:parseInt(c,10)||0,bottom:parseInt(e,10)||0}}function t(a){var b,
d,c,e,h=a._trim;if(!h){var h=s(a),f=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;f.getComputedStyle?(e=f.getComputedStyle(a,null),b=e.getPropertyValue("border-left-width"),d=e.getPropertyValue("border-top-width"),c=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width")):a.currentStyle&&(b=a.currentStyle.borderLeftWidth,d=a.currentStyle.borderTopWidth,c=a.currentStyle.borderRightWidth,e=a.currentStyle.borderBottomWidth);b=parseInt(b,10)||0;d=parseInt(d,10)||
0;c=parseInt(c,10)||0;e=parseInt(e,10)||0;h.left+=b;h.top+=d;h.right+=c;h.bottom+=e;a._trim=h}return h}function q(a,b,d,c){function e(b){if(b.animationName===f){var d=b.target;"function"===typeof d.__DOMReady&&(a.defaultView||a.parentWindow).setTimeout(function(){d.__DOMReady()},0)}}function h(a,b){for(var d=["","-webkit-","-moz-","-ms-","-o-"],c="",e="body ."+a+" {\n",p=0;p<d.length;p++)c+="@"+d[p]+"keyframes "+b+" {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n",e+=d[p]+"animation-duration: 0.001s;\n"+
d[p]+"animation-name: "+b+";\n";return c+(e+"}")}d="_"+d+"DOMReady";b.className=b.className?b.className+" "+d:d;b.__DOMReady=c;c=d+"Style";if(!a.getElementById(c)){var f=d+"Animation";a.addEventListener("animationstart",e,!1);a.addEventListener("MSAnimationStart",e,!1);a.addEventListener("webkitAnimationStart",e,!1);b=a.createElement("style");b.id=c;c=a.getElementsByTagName("head")[0]||a.documentElement;b.appendChild(a.createTextNode(h(d,f)));c.insertBefore(b,c.firstChild)}}function r(a,b,d){this.start=
a;this.end=b;this.caret=d}function v(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function u(a,b,d){this.view=a;this.lineIndex=b;this._lineDiv=d}function w(a){this._init(a||{})}var z=f.addEventListener,y=f.removeEventListener,x=function(){function a(b){this.options=b}a.prototype.play=function(){var a="number"===typeof this.options.duration?this.options.duration:350,b=this.options.easing||this.defaultEasing,d=this.options.onAnimate||function(){},c=this.options.curve[0],
e=this.options.curve[1],p=e-c,h=-1,f,g=this;this.interval=this.options.window.setInterval(function(){h=-1===h?(new Date).getTime():h;var m=((new Date).getTime()-h)/a;1>m?(m=b(m),f=c+m*p,d(f)):(d(e),g.stop())},"number"===typeof this.options.rate?this.options.rate:20)};a.prototype.stop=function(){this.options.window.clearInterval(this.interval);(this.options.onEnd||function(){})()};a.prototype.defaultEasing=function(a){return Math.sin(a*(Math.PI/2))};return a}();r.prototype={clone:function(){return new r(this.start,
this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(a){this.caret?this.start=a:this.end=a;this.start>this.end&&(a=this.start,this.start=this.end,this.end=a,this.caret=!this.caret)},setCaret:function(a){this.end=this.start=a;this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},toString:function(){return"start\x3d"+this.start+" end\x3d"+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===
this.end},equals:function(a){return this.caret===a.caret&&this.start===a.start&&this.end===a.end}};v.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}};u.prototype={create:function(a,b){if(!this._lineDiv){var d=this._lineDiv=this._createLine(a,b,this.lineIndex);d._line=this;return d}},_createLine:function(d,c,h){var f=this.view,g=f._model,m=g.getLine(h),k=g.getLineStart(h),q={type:"LineStyle",textView:f,lineIndex:h,lineText:m,
lineStart:k};f.onLineStyle(q);var l=d.ownerDocument,g=c||b.createElement(l,"div");if(!c||!a(c.viewStyle,q.style))e(q.style,g,c),c&&(c._trim=null),g.viewStyle=q.style,g.setAttribute("role","presentation");g.lineIndex=h;if(c&&g.viewLineText===m&&a(q.ranges,g.viewRanges))return g;g.viewRanges=q.ranges;g.viewLineText=m;h=[];this._createRanges(q.ranges,m,0,m.length,k,{tabOffset:0,ranges:h});q=" ";!f._fullSelection&&9>b.isIE&&(q="\ufeff");f={text:q,style:f._metrics.largestFontStyle,ignoreChars:1};0===h.length||
!h[h.length-1].style||"div"!==h[h.length-1].style.tagName?h.push(f):h.splice(h.length-1,0,f);var s,r,n,t=q=0;if(b.isFirefox&&2E3<m.length){c&&(g.innerHTML="",c.lineWidth=void 0);c=l.createDocumentFragment();for(m=0;m<h.length;m++)f=h[m],k=f.text,s=f.style,s=this._createSpan(g,k,s,f.ignoreChars),c.appendChild(s);g.appendChild(c)}else{var y,x;if(c){if(r=c.modelChangedEvent)0===r.removedLineCount&&0===r.addedLineCount?(x=r.start-k,y=r.addedCharCount-r.removedCharCount):x=-1,c.modelChangedEvent=void 0;
r=c.firstChild}for(m=0;m<h.length;m++){f=h[m];k=f.text;q+=k.length;s=f.style;if(r)if(n=r.firstChild.data,l=r.viewStyle,n===k&&a(s,l)){t+=n.length;r._rectsCache=void 0;s=r=r.nextSibling;continue}else for(;r;){if(-1!==x){l=q;l>=x&&(l-=y);n=(n=r.firstChild.data)?n.length:0;if(t+n>l)break;t+=n}l=r.nextSibling;g.removeChild(r);r=l}s=this._createSpan(g,k,s,f.ignoreChars);r?g.insertBefore(s,r):g.appendChild(s);c&&(c.lineWidth=void 0)}if(c)for(y=s?s.nextSibling:null;y;)l=y.nextSibling,c.removeChild(y),y=
l}g.parentNode||d.appendChild(g);return g},_createRanges:function(b,d,c,e,h,f){if(!(c>e)){if(b)for(var g=0;g<b.length;g++){var m=b[g];if(!(m.end<h+c)){var k=Math.max(h+c,m.start)-h;if(k>e)break;var q=Math.min(h+e,m.end)-h;if(k<=q){k=Math.max(c,k);q=Math.min(e,q);c<k&&this._createRange(d,c,k,null,f);if(!m.style||!m.style.unmergeable)for(;g+1<b.length&&b[g+1].start-h===q&&a(m.style,b[g+1].style);)m=b[g+1],q=Math.min(h+e,m.end)-h,g++;this._createRange(d,k,q,m.style,f);c=q}}}c<e&&this._createRange(d,
c,e,null,f)}},_createRange:function(a,b,d,c,e){if(!(b>d)){var h=this.view._customTabSize;if(h&&8!==h)for(var f=a.indexOf("\t",b);-1!==f&&f<d;){b<f&&(b={text:a.substring(b,f),style:c},e.ranges.push(b),e.tabOffset+=b.text.length);b=h-e.tabOffset%h;if(0<b){for(var g="\u00a0",m=1;m<b;m++)g+=" ";b={text:g,style:c,ignoreChars:b-1};e.ranges.push(b);e.tabOffset+=b.text.length}b=f+1;if(b===d)return;f=a.indexOf("\t",b)}b<=d&&(b={text:a.substring(b,d),style:c},e.ranges.push(b),e.tabOffset+=b.text.length)}},
_createSpan:function(a,d,c,h){var f=this.view,g="span";c&&c.tagName&&(g=c.tagName.toLowerCase());var m="a"===g;m&&(this.hasLink=!0);m&&!f._linksVisible&&(g="span");m=a.ownerDocument;a=b.createElement(a.ownerDocument,g);a.appendChild(m.createTextNode(c&&c.text?c.text:d));c&&c.html?(a.innerHTML=c.html,a.ignore=!0):c&&c.node&&(a.appendChild(c.node),a.ignore=!0);e(c,a);if("a"===g){var k=f._getWindow();z(a,"click",function(a){return f._handleLinkClick(a?a:k.event)},!1)}a.viewStyle=c;h&&(a.ignoreChars=
h);return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,d){var c=this._ensureCreated(),e=this.view;if(void 0===a)return this._getLineBoundingClientRect(c,!0);var h=e._model,f=c.ownerDocument,g=this.lineIndex,m=null;if(a<h.getLineEnd(g)){var k=h.getLineStart(g);this.forEach(function(d){var h=d.firstChild,g=this._nodeLength(d);if(k+g>a){var A=a-k;if(1===h.length)m=new v(d.getBoundingClientRect());
else if(e._isRangeRects)g=f.createRange(),g.setStart(h,A),g.setEnd(h,A+1),m=new v(g.getBoundingClientRect());else if(b.isIE)g=f.body.createTextRange(),g.moveToElementText(d),g.collapse(),(h=0===A&&8===b.isIE)&&(A=1),g.moveEnd("character",A+1),g.moveStart("character",A),m=new v(g.getBoundingClientRect()),h&&(m.left=d.getClientRects()[0].left);else{var q=h.data;d.removeChild(h);d.appendChild(f.createTextNode(q.substring(0,A)));var l=b.createElement(f,"span");l.appendChild(f.createTextNode(q.substring(A,
A+1)));d.appendChild(l);d.appendChild(f.createTextNode(q.substring(A+1)));m=new v(l.getBoundingClientRect());d.innerHTML="";d.appendChild(h);this._createdDiv||(d=e._getSelection(),(k<=d.start&&d.start<k+g||k<=d.end&&d.end<k+g)&&e._updateDOMSelection())}b.isIE&&(A=c.ownerDocument.defaultView||c.ownerDocument.parentWindow,d=A.screen.logicalXDPI/A.screen.deviceXDPI,A=A.screen.logicalYDPI/A.screen.deviceYDPI,m.left*=d,m.right*=d,m.top*=A,m.bottom*=A);return!1}k+=g;return!0})}h=this.getBoundingClientRect();
m||(e._wrapMode?(g=this.getClientRects(),m=g[g.length-1],m.left=m.right,m.left+=h.left,m.top+=h.top,m.right+=h.left,m.bottom+=h.top):(m=new v(h),m.left=m.right));if(d||void 0===d)m.left-=h.left,m.top-=h.top,m.right-=h.left,m.bottom-=h.top;return m},forEach:function(a){for(var b=this._ensureCreated().firstChild;b;){var d=b.nextSibling;if(!b.ignore&&!a.call(this,b))break;b=d}},_getClientRects:function(a,b){var d,c,e,h;if(!a._rectsCache){d=a.getClientRects();c=Array(d.length);for(h=0;h<d.length;h++)e=
c[h]=new v(d[h]),e.left-=b.left,e.top-=b.top,e.right-=b.left,e.bottom-=b.top;a._rectsCache=c}d=a._rectsCache;c=[d.length];for(h=0;h<d.length;h++)c[h]=new v(d[h]);return c},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];var b=[],d=this._ensureCreated().getBoundingClientRect();this.forEach(function(a){a=this._getClientRects(a,d);for(var c=0;c<a.length;c++){var e=a[c],p,h;if(e.top!==e.bottom){var f=e.top+(e.bottom-e.top)/2;for(p=0;p<b.length&&!(h=b[p],h.top<=
f&&f<h.bottom);p++);p===b.length?b.push(e):(e.left<h.left&&(h.left=e.left),e.top<h.top&&(h.top=e.top),e.right>h.right&&(h.right=e.right),e.bottom>h.bottom&&(h.bottom=e.bottom))}}return!0});return void 0!==a?b[a]:b},_getLineBoundingClientRect:function(a,b){var d=new v(a.getBoundingClientRect());if(!this.view._wrapMode){d.right=d.left;for(var c=a.lastChild;c&&c.ignoreChars===c.firstChild.length;)c=c.previousSibling;c&&(c=c.getBoundingClientRect(),d.right=c.right+t(a).right)}b&&(c=t(a),d.left+=c.left,
d.right-=c.right);return d},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;var b=this.getClientRects();a=this.getBoundingClientRect(a);a=a.top+(a.bottom-a.top)/2;for(var d=0;d<b.length;d++)if(b[d].top<=a&&a<b[d].bottom)return d;return b.length-1},getLineStart:function(a){if(!this.view._wrapMode||0===a)return this.view._model.getLineStart(this.lineIndex);var b=this.getClientRects();return this.getOffset(b[a].left+
1,b[a].top+1)},_nodeLength:function(a){if(!a||a.ignore)return 0;var b=a.firstChild.length;a.ignoreChars&&(b-=a.ignoreChars);return b},getModelOffset:function(a,b){if(!a)return 0;var d=0;this.forEach(function(c){var e=c.firstChild;if(e===a)return c.ignoreChars&&(d-=c.ignoreChars),d+=b,!1;c.ignoreChars&&(d-=c.ignoreChars);d+=e.data.length;return!0});return Math.max(0,d)+this.view._model.getLineStart(this.lineIndex)},getNodeOffset:function(a){var b=0,d,c,e=this.view._model,h=e.getLineStart(this.lineIndex),
f=a-h,g=e.getLineEnd(this.lineIndex)-h;this.forEach(function(a){var e=a.firstChild,p=this._nodeLength(a);if(p+b>f||b+p>=g)return d=e,c=f-b,a.ignoreChars&&0<p&&c===p&&(c+=a.ignoreChars),!1;b+=p;return!0});return{node:d,offset:c}},getText:function(a){var b="",d=0;this.forEach(function(c){var e;if(c.ignoreChars){e=c.lastChild;for(var h=0,f=[],g=-1;e;){var m=e.data;if(m)for(var k=m.length-1;0<=k;k--){var q=m.substring(k,k+1);h<c.ignoreChars&&(" "===q||"\ufeff"===q)?h++:f.push("\u00a0"===q?"\t":q)}a===
e&&(g=f.length);e=e.previousSibling}f=f.reverse().join("");-1!==g&&(d=b.length+f.length-g);b+=f}else for(e=c.firstChild;e;)a===e&&(d=b.length),b+=e.data,e=e.nextSibling;return!0});return{text:b,offset:d}},getOffset:function(a,d){function c(e,C,k){var B=e.firstChild,r=s._nodeLength(e),n=q.ownerDocument,t=n.defaultView||n.parentWindow,y=b.isIE?t.screen.logicalXDPI/t.screen.deviceXDPI:1,x=b.isIE?t.screen.logicalYDPI/t.screen.deviceYDPI:1,v,u,w,t=k.left+l.left,z,I;if(b.isIE||h._isRangeRects){for(var n=
h._isRangeRects?n.createRange():n.body.createTextRange(),O=r,M=-1;1<O-M;){var P=Math.floor((O+M)/2);k=M+1;v=P===r-1&&e.ignoreChars?B.length:P+1;z=0===k&&8===b.isIE;h._isRangeRects?(n.setStart(B,k),n.setEnd(B,v)):(z&&(k=1),n.moveToElementText(e),n.move("character",k),n.moveEnd("character",v-k));I=n.getClientRects();for(var S=!1,U=0;U<I.length;U++)if(k=I[U],v=(z?t:k.left)*y-l.left,w=k.right*y-l.left,u=k.top*x-l.top,k=k.bottom*x-l.top,v<=a&&a<w&&(!h._wrapMode||u<=d&&d<k)){S=!0;break}S?O=P:M=P}C+=O;k=
O;v=O===r-1&&e.ignoreChars?B.length:Math.min(O+1,B.length);h._isRangeRects?(n.setStart(B,k),n.setEnd(B,v)):(n.moveToElementText(e),n.move("character",k),n.moveEnd("character",v-k));I=n.getClientRects();r=!1;0<I.length&&(k=I[0],v=(z?t:k.left)*y-l.left,w=k.right*y-l.left,r=a>v+(w-v)/2);e=C-m;B=f.getLine(g);y=B.charCodeAt(e);55296<=y&&56319>=y&&r?e<B.length&&(y=B.charCodeAt(e+1),56320<=y&&57343>=y&&(C+=1)):56320<=y&&57343>=y&&!r&&0<e&&(y=B.charCodeAt(e-1),55296<=y&&56319>=y&&(C-=1));r&&C++}else{y=[];
for(z=0;z<r;z++)y.push("\x3cspan\x3e"),z===r-1?y.push(B.data.substring(z)):y.push(B.data.substring(z,z+1)),y.push("\x3c/span\x3e");e.innerHTML=y.join("");for(y=e.firstChild;y;){k=y.getBoundingClientRect();v=k.left-l.left;w=k.right-l.left;if(v<=a&&a<w){a>v+(w-v)/2&&C++;break}C++;y=y.nextSibling}s._createdDiv||(e.innerHTML="",e.appendChild(B),e=h._getSelection(),(C<=e.start&&e.start<C+r||C<=e.end&&e.end<C+r)&&h._updateDOMSelection())}return C}function e(b){if(b.ignore)return null;b=s._getClientRects(b,
l);for(var c=0;c<b.length;c++){var f=b[c];if(f.left<=a&&a<f.right&&(!h._wrapMode||f.top<=d&&d<f.bottom))return f}return null}var h=this.view,f=h._model,g=this.lineIndex,m=f.getLineStart(g),k=f.getLineEnd(g);if(m===k)return m;var q=this._ensureCreated(),l=this.getBoundingClientRect(),s=this,r,n;if(h._wrapMode){r=this.getClientRects();d<r[0].top&&(d=r[0].top);for(var t=0;t<r.length&&!(n=r[t],n.top<=d&&d<n.bottom);t++);a<n.left&&(a=n.left);a>n.right&&(a=n.right-1)}else 0>a&&(a=0),a>l.right-l.left&&(a=
l.right-l.left);var y,x;if(this._lastHitChild&&this._lastHitChild.parentNode){if(y=this._lastHitOffset,x=this._lastHitChild,n=e(x),!n){r=y;for(var t=y+this._nodeLength(x),v=x.previousSibling,u=x.nextSibling;v||u;){if(v){r-=this._nodeLength(v);if(n=e(v)){x=v;y=r;break}v=v.previousSibling}if(u){if(n=e(u)){x=u;y=t;break}t+=this._nodeLength(u);u=u.nextSibling}}}}else y=m,this.forEach(function(a){x=a;if(n=e(x))return!1;y+=this._nodeLength(x);return!0});x&&n&&(this._lastHitChild=x,this._lastHitOffset=y,
y=c(x,y,n));return Math.min(k,Math.max(m,y))},getNextOffset:function(a,d){if("line"===d.unit){var c=this.view._model,e=c.getLineAtOffset(a);if(0<d.count)return d.count--,c.getLineEnd(e);d.count++;return c.getLineStart(e)}return"wordend"===d.unit||"wordWS"===d.unit||"wordendWS"===d.unit?this._getNextOffset_W3C(a,d):b.isIE?this._getNextOffset_IE(a,d):this._getNextOffset_W3C(a,d)},_getNextOffset_W3C:function(a,b){function d(a){return 33<=a&&47>=a||58<=a&&64>=a||91<=a&&94>=a||96===a||123<=a&&126>=a}function c(a){return 32===
a||9===a}var e=this.view._model,h=e.getLineAtOffset(a),f=e.getLine(h),g=e.getLineStart(h),e=e.getLineEnd(h),h=f.length,m=a-g,k,q=0>b.count?-1:1;if("word"===b.unit||"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit)for(var l,s,r;0!==b.count;){if(0<b.count){if(m===h)return e;k=f.charCodeAt(m);l=d(k);s=!l&&!c(k);for(m++;m<h;){k=f.charCodeAt(m);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){r=d(k);if("wordend"===b.unit){if(!r&&l)break}else if(r&&!l)break;k=!r&&!c(k)}else k=!c(k);if("wordend"===
b.unit||"wordendWS"===b.unit){if(!k&&s)break}else if(k&&!s)break;s=k;l=r;m++}}else{if(0===m)return g;m--;k=f.charCodeAt(m);l=d(k);for(s=!l&&!c(k);0<m;){k=f.charCodeAt(m-1);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){r=d(k);if("wordend"===b.unit){if(r&&!l)break}else if(!r&&l)break;k=!r&&!c(k)}else k=!c(k);if("wordend"===b.unit||"wordendWS"===b.unit){if(k&&!s)break}else if(!k&&s)break;s=k;l=r;m--}}b.count-=q}else for(;0!==b.count&&0<=m+q&&m+q<=h;)m+=q,k=f.charCodeAt(m),56320<=k&&57343>=k&&0<m&&(k=f.charCodeAt(m-
1),55296<=k&&56319>=k&&(m+=q)),b.count-=q;return g+m},_getNextOffset_IE:function(a,b){var d=this._ensureCreated(),c=this.view._model,e=this.lineIndex,h=0,f;f=c.getLineStart(e);var g=d.ownerDocument,m=0>b.count?-1:1;if(a===c.getLineEnd(e)){for(d=d.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(!d)return f;h=g.body.createTextRange();h.moveToElementText(d);f=h.text.length;h.moveEnd(b.unit,m);h=a+h.text.length-f}else if(a===f&&0>b.count)h=f;else for(d=d.firstChild;d;){c=this._nodeLength(d);
if(f+c>a){h=g.body.createTextRange();if(a===f&&0>b.count){for(f=d.previousSibling;f&&(!f.firstChild||!f.firstChild.length);)f=f.previousSibling;h.moveToElementText(f?f:d.previousSibling)}else h.moveToElementText(d),h.collapse(),h.moveEnd("character",a-f);f=h.text.length;h.moveEnd(b.unit,m);h=a+h.text.length-f;break}f=c+f;d=d.nextSibling}b.count-=m;return h},updateLinks:function(){var a=this._ensureCreated();if(this.hasLink){var b=this;this.forEach(function(d){var c=d.viewStyle;c&&c.tagName&&"a"===
c.tagName.toLowerCase()&&a.replaceChild(b._createSpan(a,d.firstChild.data,c),d);return!0})}},destroy:function(){var a=this._createdDiv;a&&(a.parentNode.removeChild(a),this._createdDiv=null)}};w.prototype={addKeyMode:function(a,b){var d=this._keyModes;void 0!==b?d.splice(b,0,a):d.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var d=this._rulers;if(void 0!==b){var c,e;for(e=c=0;c<d.length&&e<b;c++)a.getLocation()===d[c].getLocation()&&e++;d.splice(e,0,a);b=e}else d.push(a);
this._createRuler(a,b);this._update()},computeSize:function(){var a=0,d=0,c=this._model,e=this._clientDiv;if(!e)return{width:a,height:d};var h=e.style.width;b.isWebkit&&(e.style.width="0x7fffffffpx");for(var c=c.getLineCount(),f=0;f<c;f++){var g=this._getLine(f),m=g.getBoundingClientRect(),a=Math.max(a,m.right-m.left),d=d+(m.bottom-m.top);g.destroy()}b.isWebkit&&(e.style.width=h);e=this._getViewPadding();a+=e.right+e.left+this._metrics.scrollWidth;d+=e.bottom+e.top+this._metrics.scrollWidth;return{width:a,
height:d}},convert:function(a,b,d){if(this._clientDiv){var c=this._getScroll(),e=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect();"document"===b&&(void 0!==a.x&&(a.x+=-c.x+h.left+e.left),void 0!==a.y&&(a.y+=-c.y+h.top+e.top));"document"===d&&(void 0!==a.x&&(a.x+=c.x-h.left-e.left),void 0!==a.y&&(a.y+=c.y-h.top-e.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].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(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var b=[],d=this._actions,c;for(c in d)d.hasOwnProperty(c)&&(a||
!d[c].defaultHandler)&&b.push(c);return b},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},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 a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?
0:this._getScroll().x},getKeyBindings:function(a){for(var b=[],d=this._keyModes,c=0;c<d.length;c++)b=b.concat(d[c].getKeyBindings(a));return b},getKeyModes:function(){return this._keyModes.slice(0)},getLineHeight:function(a){return!this._clientDiv?0:this._getLineHeight(a)},getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var b=this._model;
a=Math.min(Math.max(0,a),b.getCharCount());var b=b.getLineAtOffset(a),d=this._getLine(b);a=d.getBoundingClientRect(a);d.destroy();d=a.left;b=this._getLinePixel(b)+a.top;return{x:d,y:b}},getNextOffset:function(a,b){var d=new r(a,a,!1);this._doMove(b,d);return d.getCaret()},getOptions:function(){var a;if(0===arguments.length)a=this._defaultOptions();else if(1===arguments.length){if(a=arguments[0],"string"===typeof a)return d(this["_"+a])}else{a={};for(var b in arguments)arguments.hasOwnProperty(b)&&
(a[arguments[b]]=void 0)}for(var c in a)a.hasOwnProperty(c)&&(a[c]=d(this["_"+c]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var d=this._getLineIndex(b),c=this._getLine(d),d=c.getOffset(a,b-this._getLinePixel(d));c.destroy();return d},getLineAtOffset:function(a){this.getModel().getLineAtOffset(a)},getLineStart:function(a){this.getModel().getLineStart(a)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var a=
this._getSelection();return{start:a.start,end:a.end}},getText:function(a,b){return this._model.getText(a,b)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,b,d){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(d))return!0;if(a.defaultHandler)return"boolean"===typeof a.defaultHandler(d)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},
onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},onDragOver:function(a){return this.dispatchEvent(a)},onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onKeyDown:function(a){return this.dispatchEvent(a)},
onKeyPress:function(a){return this.dispatchEvent(a)},onKeyUp:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},onModelChanging:function(a){return this.dispatchEvent(a)},onModify:function(a){return this.dispatchEvent(a)},onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},
onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},onFocus:function(a){return this.dispatchEvent(a)},onBlur:function(a){return this.dispatchEvent(a)},redraw:function(){if(!(0<this._redrawCount)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,b){if(!(0<this._redrawCount))for(var d=this.getRulers(),c=0;c<d.length;c++)this.redrawLines(a,b,d[c])},
redrawLines:function(a,b,d){if(!(0<this._redrawCount)&&(void 0===a&&(a=0),void 0===b&&(b=this._model.getLineCount()),a!==b)){var c=this._clientDiv;if(c){if(d)for(c=this._getRulerParent(d).firstChild;c&&c._ruler!==d;)c=c.nextSibling;d?c.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,b);if(!d||"page"===d.getOverview())for(c=c.firstChild;c;){var e=c.lineIndex;a<=e&&e<b&&(c.lineChanged=!0);c=c.nextSibling}!d&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<b&&(this._checkMaxLineIndex=
this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._queueUpdate()}}},redrawRange:function(a,b){if(!(0<this._redrawCount)){var d=this._model;void 0===a&&(a=0);void 0===b&&(b=d.getCharCount());var c=d.getLineAtOffset(a),d=d.getLineAtOffset(Math.max(a,b-1))+1;this.redrawLines(c,d)}},removeKeyMode:function(a){for(var b=this._keyModes,d=0;d<b.length;d++)if(b[d]===a){b.splice(d,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,d=0;d<b.length;d++)if(b[d]===
a){b.splice(d,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,d){if(a){var c=this._actions,e=c[a];e||(e=c[a]={});e.handler=b;void 0!==d&&(e.actionDescription=d)}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,d){var c=this._model.getCharCount();a=Math.max(0,Math.min(a,c));a=new r(a,a,!1);this._setSelection(a,void 0===b||b,!0,d)},setHorizontalPixel:function(a){this._clientDiv&&
(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?0===--this._redrawCount&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var b=this._model.getLineCount(),d=this._model.getCharCount(),c=a.getLineCount(),e=a.getCharCount(),h={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:d,
addedCharCount:e,removedLineCount:b,addedLineCount:c};this.onModelChanging(h);this._model=a;h={type:"ModelChanged",start:0,removedCharCount:d,addedCharCount:e,removedLineCount:b,addedLineCount:c};this.onModelChanged(h);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(b){var c=this._defaultOptions(),e;for(e in b)if(b.hasOwnProperty(e)){var h=b[e];if(!a(this["_"+
e],h)){var f=c[e]?c[e].update:null;f?f.call(this,h):this["_"+e]=d(h)}}},setSelection:function(a,b,d,c){var e=a>b;if(e){var h=a;a=b;b=h}h=this._model.getCharCount();a=Math.max(0,Math.min(a,h));b=Math.max(0,Math.min(b,h));a=new r(a,b,e);this._setSelection(a,void 0===d||d,!0,c)},setText:function(a,d,c){var e=void 0===d&&void 0===c;void 0===d&&(d=0);void 0===c&&(c=this._model.getCharCount());e&&(this._variableLineHeight=!1);this._modifyContent({text:a,start:d,end:c,_code:!0},!e);e&&(this._columnX=-1,
this._setSelection(new r(0,0,!1),!0),13>b.isFirefox&&this._fixCaret())},setTopIndex:function(a){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,a))-this._getScroll().y)},setTopPixel:function(a){this._clientDiv&&this._scrollView(0,Math.max(0,a)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(a,b){this._clientDiv&&((a||this._metrics.invalid)&&this._updateStyle(),void 0===b||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)){13>b.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var d=this._overlayDiv||this._clientDiv;9>b.isIE&&(d=this._viewDiv);for(var c=a.target?a.target:a.srcElement;c;){if(d===c)return;c=c.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){!this._ignoreEvent(a)&&
13>b.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1)},_handleBlur:function(a){this._cancelCheckSelection();if(!this._ignoreBlur){this._hasFocus=!1;if(9>b.isIE&&!this._getSelection().isEmpty()){a=this._rootDiv;var d=b.createElement(a.ownerDocument,"div");a.appendChild(d);a.removeChild(d)}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",a=this._getWindow(),d=this._selDiv1.ownerDocument,a.getSelection){d=a.getSelection();for(a=d.anchorNode;a;){if(a===this._clientDiv){0<d.rangeCount&&d.removeAllRanges();break}a=a.parentNode}}else if(d.selection){this._ignoreSelect=!1;for(a=d.selection.createRange().parentElement();a;){if(a===this._clientDiv){d.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},
_handleContextMenu:function(a){if(!this._ignoreEvent(a)){b.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var d=!1;this.isListening("ContextMenu")?(d=this._createMouseEvent("ContextMenu",a),d.screenX=a.screenX,d.screenY=a.screenY,this.onContextMenu(d),d=d.defaultPrevented):b.isMac&&b.isFirefox&&0===a.button&&(d=!0);if(d)return a.preventDefault&&a.preventDefault(),!1;this._contextMenuOpen=!0;b.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))}},_handleCopy:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)&&!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){this._ignoreEvent(a)||(this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime(),2!==this._clickCount&&(this._clickCount=2,this._handleMouse(a)))},
_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(13>b.isFirefox){var d=this;this._getWindow().setTimeout(function(){d._clientDiv.contentEditable=!0;d._clientDiv.draggable=!1;d._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&-1!==this._dragOffset)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&a.preventDefault(),!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",
a))},_handleDragEnd:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",a));13>b.isFirefox&&(this._fixCaret(),"none"===a.dataTransfer.dropEffect&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var d=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(d=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(b.isWebkit||d)return a.preventDefault&&
a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var d=!0;this.isListening("DragOver")&&(d=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(b.isWebkit||d)return d&&(a.dataTransfer.dropEffect="none"),a.preventDefault&&a.preventDefault(),!1}},_handleDragLeave:function(a){if(!this._ignoreEvent(a)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",a))},_handleDrop:function(a){if(!this._ignoreEvent(a)){this._dropTarget=
!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1}},_handleFocus:function(a){this._hasFocus=!0;b.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();this._cursorDiv&&(this._cursorDiv.style.display="block");this._selDiv1&&(a=this._highlightRGB,this._selDiv1.style.background=a,this._selDiv2.style.background=a,this._selDiv3.style.background=
a);if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var d=this._createKeyEvent("KeyDown",a);this.onKeyDown(d);if(d.defaultPrevented){b.isFirefox&&(this._keyDownPrevented=!0);a.preventDefault();return}}d=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:d=!0;break;default:this._setLinksVisible(!1)}if(229===a.keyCode){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;
d=!0;b.isSafari&&b.isMac&&a.ctrlKey&&(d=!1,a.keyCode=129);d&&this._startIME()}else d||this._commitIME();if((b.isMac||b.isLinux)&&4>b.isFirefox||12.16>b.isOpera)return this._keyDownEvent=a,!0;if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1}},_handleKeyPress:function(a){if(!this._ignoreEvent(a))if(this._keyDownPrevented)a.preventDefault&&(a.preventDefault(),a.stopPropagation()),this._keyDownPrevented=void 0;else{if(b.isMac&&
b.isWebkit&&(63232<=a.keyCode&&63487>=a.keyCode||13===a.keyCode||8===a.keyCode)||((b.isMac||b.isLinux)&&4>b.isFirefox||12.16>b.isOpera)&&this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var d=b.isMac?a.metaKey:a.ctrlKey;if(void 0!==a.charCode&&d)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(d=this._createKeyEvent("KeyPress",a),this.onKeyPress(d),d.defaultPrevented))a.preventDefault();else{if(this._doAction(a))return a.preventDefault?
(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1;d=!1;if(b.isMac){if(a.ctrlKey||a.metaKey)d=!0}else if(b.isFirefox){if(a.ctrlKey||a.altKey)d=!0}else a.ctrlKey^a.altKey&&(d=!0);if(!d&&(d=b.isOpera?a.which:void 0!==a.charCode?a.charCode:a.keyCode,31<d))return this._doContent(String.fromCharCode(d)),a.preventDefault&&a.preventDefault(),!1}}},_handleDocKeyUp:function(a){(b.isMac?a.metaKey:a.ctrlKey)||this._setLinksVisible(!1)},_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var b=
this._createKeyEvent("KeyUp",a);this.onKeyUp(b);if(b.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);13===a.keyCode&&this._commitIME()}},_handleLinkClick:function(a){if(!(b.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var d=this._getWindow(),c=!0,e=d;if(b.isIE||b.isFirefox&&!this._overlayDiv)e=this._clientDiv;if(this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var h=this;d.setTimeout(function(){h.focus();h._ignoreFocus=
!1},0)}1===this._clickCount?(c=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,(!b.isOpera||12.16<=b.isOpera)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return c},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if("A"!==(a.target||a.srcElement).tagName)this._setLinksVisible(!1);
else return;this._commitIME();var d=a.which;d||(4===a.button&&(d=2),2===a.button&&(d=3),1===a.button&&(d=1));var c=2!==d&&a.timeStamp?a.timeStamp:(new Date).getTime(),e=c-this._lastMouseTime,h=Math.abs(this._lastMouseX-a.clientX),f=Math.abs(this._lastMouseY-a.clientY),g=this._lastMouseButton===d;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=c;this._lastMouseButton=d;1===d&&(this._isMouseDown=!0,g&&e<=this._clickTime&&h<=this._clickDist&&f<=this._clickDist?this._clickCount++:
this._clickCount=1);if(this.isListening("MouseDown")&&(c=this._createMouseEvent("MouseDown",a),this.onMouseDown(c),c.defaultPrevented))a.preventDefault();else{if(1===d&&this._handleMouse(a)&&(9<=b.isIE||b.isOpera||b.isChrome||b.isSafari||b.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();b.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}}},_handleMouseOver:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",
a))},_handleMouseOut:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){if(!this._animation){var d=this._isClientDiv(a);if(this.isListening("MouseMove")&&d)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var c=this._linksVisible||this._lastMouseMoveX!==a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;
this._setLinksVisible(c&&!this._isMouseDown&&(b.isMac?a.metaKey:a.ctrlKey));if(!this._isW3CEvents){if(0===a.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===a.button&&0!==(this._clickCount&1)&&d)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){d=a.clientX;a=a.clientY;var e=this._getViewPadding(),h=this._viewDiv.getBoundingClientRect(),f=this._getClientWidth(),g=this._getClientHeight(),c=h.left+e.left,m=h.top+e.top,f=h.left+
e.left+f,e=h.top+e.top+g;a<m?this._doAutoScroll("up",d,a-m):a>e?this._doAutoScroll("down",d,a-e):d<c&&!this._wrapMode?this._doAutoScroll("left",d-c,a):d>f&&!this._wrapMode?this._doAutoScroll("right",d-f,a):(this._endAutoScroll(),this._setSelectionTo(d,a,!0))}}}},_isClientDiv:function(a){var b=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(b===a)return!0;a=a.parentNode}return!1},_createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=
!0}}},_createMouseEvent:function(a,b){var d=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:d.x,y:d.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var d=a.which?0===a.button:1===a.button;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||d&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",a));if(!this._linksVisible){if(d&&this._isMouseDown){if(-1!==this._dragOffset){var c=this._getSelection();
c.extend(this._dragOffset);c.collapse();this._setSelection(c,!0,!0);this._dragOffset=-1}this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null)}d&&b.isFirefox&&(this._updateDOMSelection(),a.preventDefault())}},_handleMouseWheel:function(a){var d=this._getLineHeight(),c=0,e=0;b.isIE||b.isOpera?e=-a.wheelDelta/40*d:b.isFirefox?"wheel"===a.type?a.deltaMode?(c=Math.max(-256,Math.min(256,a.deltaX))*d,e=Math.max(-256,Math.min(256,a.deltaY))*d):(c=a.deltaX,e=a.deltaY):(d=b.isMac?
3*a.detail:Math.max(-256,Math.min(256,a.detail))*d,a.axis===a.HORIZONTAL_AXIS?c=d:e=d):b.isMac?(e=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,c=0!==a.wheelDeltaX%120?1:40>e?40/(40-e):40,e=0!==a.wheelDeltaY%120?1:40>e?40/(40-e):40,c=Math.ceil(-a.wheelDeltaX/c),-1<c&&0>c&&(c=-1),0<c&&1>c&&(c=1),e=Math.ceil(-a.wheelDeltaY/e),-1<e&&0>e&&(e=-1),0<e&&1>e&&(e=1)):(c=-a.wheelDeltaX,e=8*(-a.wheelDeltaY/120)*d);if(b.isSafari||b.isChrome&&b.isMac){for(d=a.target;d&&void 0===d.lineIndex;)d=
d.parentNode;this._mouseWheelLine=d}d=this._getScroll();this._scrollView(c,e);c=this._getScroll();if(d.x!==c.x||d.y!==c.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(b.isIE){var d=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){d._updateDOMSelection();d._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(d){d=this._rootDiv.clientWidth;
var c=this._rootDiv.clientHeight;if(this._rootWidth!==d||this._rootHeight!==c)this._rootWidth!==d&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=d,this._rootHeight=c,d=9>b.isIE,c=this._calculateMetrics(),a(c,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=c,d=!0),d?this._queueUpdate():this._update()},_handleRulerEvent:function(a){for(var b=a.target?a.target:a.srcElement,d=b.lineIndex;b&&!b._ruler;)void 0===d&&void 0!==b.lineIndex&&
(d=b.lineIndex),b=b.parentNode;var c=b?b._ruler:null;if(void 0===d&&c&&"document"===c.getOverview()){var d=this._getClientHeight(),e=this._model.getLineCount(),h=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),d=Math.floor((a.clientY-f.top-this._metrics.scrollWidth)*e/(d+h.top+h.bottom-2*this._metrics.scrollWidth));0<=d&&d<e||(d=void 0)}if(c)switch(a.type){case "click":if(c.onClick)c.onClick(d,a);break;case "dblclick":if(c.onDblClick)c.onDblClick(d,a);break;case "mousemove":if(c.onMouseMove)c.onMouseMove(d,
a);break;case "mouseover":if(c.onMouseOver)c.onMouseOver(d,a);break;case "mouseout":if(c.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===b)return;e=e.parentNode}c.onMouseOut(d,a)}}},_handleScroll:function(){var a=this._getScroll(!1),b=this._hScroll,d=this._vScroll;if(b!==a.x||d!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(d===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:d},newValue:a})},_handleSelectStart:function(a){var b=this._contextMenuOpen;this._contextMenuOpen=
!1;if(b)this._checkSelectionChange=!0;else if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var d;d="DIV"===a.tagName?a:a.parentNode.parentNode;return!d._line?0:d._line.getModelOffset(a,b)}},_updateSelectionFromDOM:function(){if(!b.isOS&&!b.isAndroid&&!this._checkSelectionChange)return!1;var a=this._getWindow().getSelection(),d=this._getModelOffset(a.anchorNode,a.anchorOffset),c=this._getModelOffset(a.focusNode,a.focusOffset),e=this._getSelection();
if(void 0===d||void 0===c||e.start===d&&e.end===c)return!1;if(this._checkSelectionChange){var e=this._getLineNext(),h=this._getLinePrevious();if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===h.firstChild.firstChild&&0===a.focusOffset)return!1;if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===h.lastChild.firstChild||a.anchorNode===this._clientDiv&&a.focusNode===this._clientDiv)d=0,c=this.getModel().getCharCount()}this._setSelection(new r(d,c),
!1,!1);this._checkSelectionChange=!1;return!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){this._selPollTimer&&(this._getWindow().clearTimeout(this._selPollTimer),this._selPollTimer=null)},_pollSelectionChange:function(a){var b=this,d=this._getWindow();this._cancelPollSelectionChange();this._selPollTimer=d.setTimeout(function(){b._selPollTimer=null;b._clientDiv&&!b._updateSelectionFromDOM()&&
a&&b._pollSelectionChange(a)},100)},_handleSelectionChange:function(a){-1===this._imeOffset&&(b.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var b=this._getWindow().getSelection();if(b.anchorNode!==this._anchorNode||b.focusNode!==this._focusNode||b.anchorOffset!==this._anchorOffset||b.focusOffset!==this._focusOffset){for(var d=b.anchorNode;d&&void 0===d.lineIndex;)d=d.parentNode;if(d){var c=this._model,
e=d.lineIndex,h=c.getLine(e),f=h,g=0,c=c.getLineStart(e);0<b.rangeCount&&(b.getRangeAt(0).deleteContents(),e=d.ownerDocument.createTextNode(a.data),b.getRangeAt(0).insertNode(e),g=this._getDOMText(d,e),f=g.text,g=g.offset,e.parentNode.removeChild(e));d.lineRemoved=!0;for(d=0;h.charCodeAt(d)===f.charCodeAt(d)&&d<g;)d++;b=h.length-1;for(e=f.length-h.length;h.charCodeAt(b)===f.charCodeAt(b+e)&&b+e>=g+a.data.length;)b--;b++;h=f.substring(d,b+e);this._modifyContent({text:h,start:d+c,end:b+c,_ignoreDOMSelection:!0},
!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var d=this._getWindow();this._touchScrollTimer&&(this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",d.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null);var c=a.touches;if(1===c.length){var c=c[0],e=c.clientX,h=c.clientY;this._touchStartX=e;this._touchStartY=h;if(b.isAndroid&&(h<c.pageY-d.pageYOffset||e<c.pageX-d.pageXOffset))e=c.pageX-d.pageXOffset,h=c.pageY-
d.pageYOffset;d=this.convert({x:e,y:h},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(d.x,d.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=a.touches;if(1===b.length){b=b[0];this._touchCurrentX=b.clientX;this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&200>a.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var d=this,c=this._getWindow();this._touchScrollTimer=
c.setInterval(function(){var a=0,b=0;if(d._touching)a=d._touchStartX-d._touchCurrentX,b=d._touchStartY-d._touchCurrentY,d._touchSpeedX=a/10,d._touchSpeedY=b/10,d._touchStartX=d._touchCurrentX,d._touchStartY=d._touchCurrentY;else{if(0.1>Math.abs(d._touchSpeedX)&&0.1>Math.abs(d._touchSpeedY)){d._vScrollDiv.style.display="none";d._hScrollDiv.style.display="none";c.clearInterval(d._touchScrollTimer);d._touchScrollTimer=null;return}a=10*d._touchSpeedX;b=10*d._touchSpeedY;d._touchSpeedX*=0.95;d._touchSpeedY*=
0.95}d._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var b,d,c=this._keyModes;for(d=c.length-1;0<=d;d--)if(b=c[d],"function"===typeof b.match&&(b=b.match(a),void 0!==b))return this.invokeAction(b);return!1},_doMove:function(a,b){var d=this._model,c=b.getCaret(),e=d.getLineAtOffset(c);for(a.count||(a.count=1);0!==a.count;){var h=d.getLineStart(e);if(0>a.count&&c===h)if(0<e)"character"===
a.unit&&a.count++,e--,b.extend(d.getLineEnd(e));else break;else if(0<a.count&&c===d.getLineEnd(e))if(e+1<d.getLineCount())"character"===a.unit&&a.count--,e++,b.extend(d.getLineStart(e));else break;else{var f=!1;a.expandTab&&"character"===a.unit&&0===(c-h)%this._tabSize&&(h=d.getText(h,c),f=!/[^ ]/.test(h));f?(b.extend(c-this._tabSize),a.count+=0>a.count?1:-1):(h=this._getLine(e),b.extend(h.getNextOffset(c,a)),h.destroy())}c=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();
b.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,b));this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var d=this.getText(b.start,b.end);this._setSelection(b,!0);switch(a.type){case "lower":d=d.toLowerCase();break;case "capitalize":d=d.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<d.length;b++){var c=d[b],e=c.toLowerCase(),c=e!==
c?e:c.toUpperCase();a+=c}d=a;break;default:d=d.toUpperCase()}this._doContent(d);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var d=this._model,c=d.getLineAtOffset(b.end);b.end<d.getLineEnd(c)&&(d=this._getLine(c),b.extend(d.getNextOffset(b.getCaret(),{unit:"character",count:1})),d.destroy())}this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._setClipboardText(b,a)):!0},_doCursorNext:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.start=b.end:this._doMove(a,b);a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.end=b.start:(a.count||(a.count=1),a.count*=-1,this._doMove(a,b));a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._doContent(""),this._setClipboardText(b,a)):!0},_doDelete:function(a){var b=this._getSelection();b.isEmpty()&&this._doMove(a,b);this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doEnd:function(a){var b=this._getSelection(),d=this._model,c;if(a.ctrl)b.extend(d.getCharCount()),c=function(){};else{var e=b.getCaret(),h=d.getLineAtOffset(e);if(this._wrapMode){var f=this._getLine(h),e=f.getLineIndex(e),e=e===f.getLineCount()-1?d.getLineEnd(h):f.getLineStart(e+1)-1;f.destroy()}else a.count&&
0<a.count&&(h=Math.min(h+a.count-1,d.getLineCount()-1)),e=d.getLineEnd(h);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,c);return!0},_doEnter:function(a){var b=this._model,d=this._getSelection();this._doContent(b.getLineDelimiter());a&&a.noCursor&&(d.end=d.start,this._setSelection(d,!0));return!0},_doHome:function(a){var b=this._getSelection(),d=this._model,c;if(a.ctrl)b.extend(0),c=function(){};else{var e=b.getCaret(),h=d.getLineAtOffset(e);this._wrapMode?(d=this._getLine(h),e=d.getLineIndex(e),
e=d.getLineStart(e),d.destroy()):e=d.getLineStart(h);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,c);return!0},_doLineDown:function(a){var d=this._model,c=this._getSelection(),e=c.getCaret(),h=d.getLineAtOffset(e),f=this._getLine(h),g=this._columnX,m=1,k=!1;if(-1===g||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?d.getLineEnd(h+1):e,g=f.getBoundingClientRect(g).left;(e=f.getLineIndex(e))<f.getLineCount()-1?m=f.getClientRects(e+1).top+1:(e=d.getLineCount()-1,k=h===e,a.count&&0<a.count?
h=Math.min(h+a.count,e):h++);e=!1;if(k){if(a.select||b.isMac||b.isLinux)c.extend(d.getCharCount()),e=!0}else f.lineIndex!==h&&(f.destroy(),f=this._getLine(h)),c.extend(f.getOffset(g,m)),e=!0;e&&(a.select||c.collapse(),this._setSelection(c,!0,!0));this._columnX=g;f.destroy();return!0},_doLineUp:function(a){var d=this._model,c=this._getSelection(),e=c.getCaret(),h=d.getLineAtOffset(e),f=this._getLine(h),g=this._columnX,m=!1,k;if(-1===g||a.wholeLine||a.select&&b.isIE)g=a.wholeLine?d.getLineStart(h-1):
e,g=f.getBoundingClientRect(g).left;0<(e=f.getLineIndex(e))?k=f.getClientRects(e-1).top+1:(m=0===h,m||(a.count&&0<a.count?h=Math.max(h-a.count,0):h--,k=this._getLineHeight(h)-1));e=!1;if(m){if(a.select||b.isMac||b.isLinux)c.extend(0),e=!0}else f.lineIndex!==h&&(f.destroy(),f=this._getLine(h)),c.extend(f.getOffset(g,k)),e=!0;e&&(a.select||c.collapse(),this._setSelection(c,!0,!0));this._columnX=g;f.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var d=this,c=this._model,e=this._getSelection(),
h=e.getCaret(),f=c.getLineAtOffset(h),g=c.getLineCount(),m=this._getScroll(),c=this._getClientHeight(),k,q;if(this._lineHeight){k=this._columnX;m=this._getBoundsAtOffset(h);if(-1===k||a.select&&b.isIE)k=m.left;h=this._getLineIndex(m.top+c);q=this._getLine(h);f=this._getLinePixel(h);h=q.getOffset(k,m.top+c-f);c=q.getBoundingClientRect(h);q.destroy();e.extend(h);a.select||e.collapse();this._setSelection(e,!0,!0,function(){d._columnX=k},c.top+f-m.top);return!0}if(f<g-1){var l=this._getLineHeight(),s=
Math.min(g-f-1,Math.floor(c/l)),s=Math.max(1,s);k=this._columnX;if(-1===k||a.select&&b.isIE)q=this._getLine(f),k=q.getBoundingClientRect(h).left,q.destroy();q=this._getLine(f+s);e.extend(q.getOffset(k,0));q.destroy();a.select||e.collapse();a=g*l;h=m.y+s*l;h+c>a&&(h=a-c);this._setSelection(e,!0,!0,function(){d._columnX=k},h-m.y)}return!0},_doPageUp:function(a){var d=this,c=this._model,e=this._getSelection(),h=e.getCaret(),f=c.getLineAtOffset(h),g=this._getScroll(),m=this._getClientHeight(),k;if(this._lineHeight){k=
this._columnX;g=this._getBoundsAtOffset(h);if(-1===k||a.select&&b.isIE)k=g.left;h=this._getLineIndex(g.bottom-m);c=this._getLine(h);f=this._getLinePixel(h);h=c.getOffset(k,g.bottom-m-f);m=c.getBoundingClientRect(h);c.destroy();e.extend(h);a.select||e.collapse();this._setSelection(e,!0,!0,function(){d._columnX=k},m.top+f-g.top);return!0}if(0<f){var q=this._getLineHeight(),m=Math.max(1,Math.min(f,Math.floor(m/q)));k=this._columnX;if(-1===k||a.select&&b.isIE)c=this._getLine(f),k=c.getBoundingClientRect(h).left,
c.destroy();c=this._getLine(f-m);e.extend(c.getOffset(k,this._getLineHeight(f-m)-1));c.destroy();a.select||e.collapse();a=Math.max(0,g.y-m*q);this._setSelection(e,!0,!0,function(){d._columnX=k},a-g.y)}return!0},_doPaste:function(a){var d=this;return null!==this._getClipboardText(a,function(a){a&&(b.isLinux&&2===d._lastMouseButton&&(new Date).getTime()-d._lastMouseTime<=d._clickTime&&d._setSelectionTo(d._lastMouseX,d._lastMouseY),d._doContent(a))})},_doScroll:function(a){var b=a.type,d=this._model,
c=d.getLineCount();a=this._getClientHeight();var e=this._getLineHeight(),c=c*e,h=this._getScroll().y,f;switch(b){case "textStart":f=0;break;case "textEnd":f=c-a;break;case "pageDown":f=h+a;break;case "pageUp":f=h-a;break;case "lineDown":f=h+e;break;case "lineUp":f=h-e;break;case "centerLine":b=this._getSelection(),f=d.getLineAtOffset(b.start),d=(d.getLineAtOffset(b.end)-f+1)*e,f=f*e-a/2+d/2}void 0!==f&&(f=Math.min(Math.max(0,f),c-a),this._scrollViewAnimated(0,f-h,function(){}));return!0},_doSelectAll:function(a){a=
this._model;var b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(a){if(this._tabMode&&!this._readonly){a="\t";if(this._expandTab){var b=this._model;a=this._getSelection().getCaret();var d=b.getLineAtOffset(a),b=b.getLineStart(d);a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ")}this._doContent(a);return!0}},_doShiftTab:function(a){if(this._tabMode&&!this._readonly)return!0},_doOverwriteMode:function(a){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),
!0},_doTabMode:function(a){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(a){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=this._model,d=this._getSelection(),c=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),e=d.getCaret(),h=a.getLineCount(),f=a.getLineAtOffset(e),g;if("up"===this._autoScrollDir||"down"===this._autoScrollDir)e=this._autoScrollY/this._getLineHeight(),e=0>e?Math.floor(e):Math.ceil(e),g=Math.max(0,
Math.min(h-1,f+e));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)g=this._getLineIndex(c.y),f=this._getLine(f),c.x+=f.getBoundingClientRect(e,!1).left,f.destroy();0===g&&(b.isMac||b.isLinux)?d.extend(0):g===h-1&&(b.isMac||b.isLinux)?d.extend(a.getCharCount()):(f=this._getLine(g),d.extend(f.getOffset(c.x,c.y-this._getLinePixel(g))),f.destroy());this._setSelection(d,!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(),d=0;if(a){a=0;for(var c=(new Date).getTime(),e=0;d<b&&!(this._lineHeight[d]||(a++,e||(e=d),this._lineHeight[d]=this._calculateLineHeight(d)),d++,100<(new Date).getTime()-c););this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(d!==b){var h=this;this._calculateLHTimer=a.setTimeout(function(){h._calculateLHTimer=null;h._calculateLineHeightTimer(!0)},
0)}else this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(a){a=this._getLine(a);var b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,d=a.ownerDocument,c=b.createElement(d,"div");c.style.lineHeight="normal";var h={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(h);e(h.style,c);c.style.position="fixed";
c.style.left="-1000px";var f=b.createElement(d,"span");f.appendChild(d.createTextNode(" "));c.appendChild(f);var g=b.createElement(d,"span");g.style.fontStyle="italic";g.appendChild(d.createTextNode(" "));c.appendChild(g);var m=b.createElement(d,"span");m.style.fontWeight="bold";m.appendChild(d.createTextNode(" "));c.appendChild(m);h=b.createElement(d,"span");h.style.fontWeight="bold";h.style.fontStyle="italic";h.appendChild(d.createTextNode(" "));c.appendChild(h);a.appendChild(c);var k=c.getBoundingClientRect(),
f=f.getBoundingClientRect(),g=g.getBoundingClientRect(),m=m.getBoundingClientRect(),h=h.getBoundingClientRect(),f=f.bottom-f.top,g=g.bottom-g.top,m=m.bottom-m.top,q=h.bottom-h.top,l=0,h=0>=k.bottom-k.top,k=Math.max(1,k.bottom-k.top);g>f&&(l=1);m>g&&(l=2);q>m&&(l=3);var r;0!==l&&(r={style:{}},0!==(l&1)&&(r.style.fontStyle="italic"),0!==(l&2)&&(r.style.fontWeight="bold"));f=t(c);a.removeChild(c);q=s(this._viewDiv);c=b.createElement(d,"div");c.style.position="fixed";c.style.left="-1000px";c.style.paddingLeft=
q.left+"px";c.style.paddingTop=q.top+"px";c.style.paddingRight=q.right+"px";c.style.paddingBottom=q.bottom+"px";c.style.width="100px";c.style.height="100px";q=b.createElement(d,"div");q.style.width="100%";q.style.height="100%";c.appendChild(q);a.appendChild(c);l=c.getBoundingClientRect();g=q.getBoundingClientRect();m=0;this._singleMode||(c.style.overflow="hidden",q.style.height="200px",m=c.clientWidth,c.style.overflow="scroll",m-=c.clientWidth);a.removeChild(c);q={left:g.left-l.left,top:g.top-l.top,
right:l.right-g.right,bottom:l.bottom-g.bottom};g=l=0;if(!h&&(this._wrapOffset||this._marginOffset))c=b.createElement(d,"div"),c.style.position="fixed",c.style.left="-1000px",c.innerHTML=Array(this._wrapOffset+1+(b.isWebkit?0:1)).join(" "),a.appendChild(c),l=c.getBoundingClientRect(),l=Math.ceil(l.right-l.left),c.innerHTML=Array(this._marginOffset+1).join(" "),g=c.getBoundingClientRect(),g=Math.ceil(g.right-g.left),a.removeChild(c);return{lineHeight:k,largestFontStyle:r,lineTrim:f,viewPadding:q,scrollWidth:m,
wrapWidth:l,marginWidth:g,invalid:h}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var b=this._getSelection();if(b.isEmpty())return!1;"next"===a?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(){if(-1!==this._imeOffset){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,b=a.getLineAtOffset(this._imeOffset),d=a.getLineStart(b),c=this._getDOMText(this._getLineNode(b)).text,a=
a.getLine(b),d=this._imeOffset-d,a=d+c.length-a.length;d!==a&&(c=c.substring(d,a),this._doContent(c));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new l.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!1}))},actionDescription:{name:k.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(m(b,{select:!1}))},actionDescription:{name:k.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(m(b,
{select:!1,ctrl:!1}))},actionDescription:{name:k.lineStart}},lineEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!1,ctrl:!1}))},actionDescription:{name:k.lineEnd}},charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!1,unit:"character"}))},actionDescription:{name:k.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(m(b,{select:!1,unit:"character"}))},actionDescription:{name:k.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(m(b,
{select:!1}))},actionDescription:{name:k.pageUp}},pageDown:{defaultHandler:function(b){return a._doPageDown(m(b,{select:!1}))},actionDescription:{name:k.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(m(b,{type:"pageUp"}))},actionDescription:{name:k.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(m(b,{type:"pageDown"}))},actionDescription:{name:k.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(m(b,{type:"lineUp"}))},
actionDescription:{name:k.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(m(b,{type:"lineDown"}))},actionDescription:{name:k.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!1,unit:"word"}))},actionDescription:{name:k.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(m(b,{select:!1,unit:"word"}))},actionDescription:{name:k.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!1,
ctrl:!0}))},actionDescription:{name:k.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!1,ctrl:!0}))},actionDescription:{name:k.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(m(b,{type:"textStart"}))},actionDescription:{name:k.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(m(b,{type:"textEnd"}))},actionDescription:{name:k.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(m(b,{type:"centerLine"}))},
actionDescription:{name:k.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!0}))},actionDescription:{name:k.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(m(b,{select:!0}))},actionDescription:{name:k.selectLineDown}},selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(m(b,
{select:!0,wholeLine:!0}))},actionDescription:{name:k.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!0,ctrl:!1}))},actionDescription:{name:k.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(m(b,
{select:!0,unit:"character"}))},actionDescription:{name:k.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(m(b,{select:!0}))},actionDescription:{name:k.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(m(b,{select:!0}))},actionDescription:{name:k.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(m(b,
{select:!0,unit:"word"}))},actionDescription:{name:k.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!0,ctrl:!0}))},actionDescription:{name:k.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"character"}))},actionDescription:{name:k.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(m(b,
{unit:"character"}))},actionDescription:{name:k.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"word"}))},actionDescription:{name:k.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(m(b,{unit:"word"}))},actionDescription:{name:k.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"line"}))},actionDescription:{name:k.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(m(b,
{unit:"line"}))},actionDescription:{name:k.deleteLineEnd}},tab:{defaultHandler:function(b){return a._doTab()},actionDescription:{name:k.tab}},shiftTab:{defaultHandler:function(b){return a._doShiftTab()},actionDescription:{name:k.shiftTab}},enter:{defaultHandler:function(b){return a._doEnter()},actionDescription:{name:k.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(m(b,{noCursor:!0}))},actionDescription:{name:k.enterNoCursor}},selectAll:{defaultHandler:function(b){return a._doSelectAll()},
actionDescription:{name:k.selectAll}},copy:{defaultHandler:function(b){return a._doCopy()},actionDescription:{name:k.copy}},cut:{defaultHandler:function(b){return a._doCut()},actionDescription:{name:k.cut}},paste:{defaultHandler:function(b){return a._doPaste()},actionDescription:{name:k.paste}},uppercase:{defaultHandler:function(b){return a._doCase(m(b,{type:"upper"}))},actionDescription:{name:k.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(m(b,{type:"lower"}))},actionDescription:{name:k.lowercase}},
capitalize:{defaultHandler:function(b){return a._doCase(m(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:k.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(m(b,{type:"reverse"}))},actionDescription:{name:k.reversecase}},toggleOverwriteMode:{defaultHandler:function(b){return a._doOverwriteMode()},actionDescription:{name:k.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(b){return a._doTabMode()},actionDescription:{name:k.toggleTabMode}},toggleWrapMode:{defaultHandler:function(b){return a._doWrapMode()},
actionDescription:{name:k.toggleWrapMode}}}},_createRulerParent:function(a,d){var c=b.createElement(a,"div");c.className=d;c.tabIndex=-1;c.style.overflow="hidden";c.style.MozUserSelect="none";c.style.WebkitUserSelect="none";c.style.position="absolute";c.style.top="0px";c.style.bottom="0px";c.style.cursor="default";c.style.display="none";c.setAttribute("aria-hidden","true");this._rootDiv.appendChild(c);return c},_createRuler:function(a,d){if(this._clientDiv){var c=this._getRulerParent(a);if(c){if(c!==
this._marginDiv||this._marginOffset)c.style.display="block";var e=b.createElement(c.ownerDocument,"div");e._ruler=a;e.rulerChanged=!0;e.style.position="relative";e.style.cssFloat="left";e.style.styleFloat="left";e.style.outline="none";if(void 0===d||0>d||d>=c.children.length)c.appendChild(e);else{for(var h=c.firstChild;h&&0<d--;)h=h.nextSibling;c.insertBefore(e,h)}}}},_createView:function(){function a(){f._rootDiv&&(f.update(!0),f._metrics.invalid&&f._getWindow().setTimeout(function(){a()},100))}
if(!this._clientDiv){for(var d=this._parent;d.hasChildNodes();)d.removeChild(d.lastChild);var c=d.ownerDocument,e=b.createElement(c,"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");d.appendChild(e);this._leftDiv=this._createRulerParent(c,"textviewLeftRuler");d=b.createElement(c,"div");d.className="textviewScroll";this._viewDiv=
d;d.tabIndex=-1;d.style.position="absolute";d.style.top="0px";d.style.bottom="0px";d.style.borderWidth="0px";d.style.margin="0px";d.style.outline="none";d.style.background="transparent";b.isMac&&b.isWebkit&&(d.style.pointerEvents="none",d.style.zIndex="2");e.appendChild(d);var h=this._createRulerParent(c,"textviewRightRuler");this._rightDiv=h;h.style.right="0px";this._scrollDiv=h=b.createElement(c,"div");h.style.margin="0px";h.style.borderWidth="0px";h.style.padding="0px";d.appendChild(h);(this._marginDiv=
this._createRulerParent(c,"textviewMarginRuler")).style.zIndex="4";!b.isIE&&!b.isIOS&&(this._clipDiv=d=b.createElement(c,"div"),d.style.position="absolute",d.style.overflow="hidden",d.style.margin="0px",d.style.borderWidth="0px",d.style.padding="0px",d.style.background="transparent",e.appendChild(d),this._clipScrollDiv=h=b.createElement(c,"div"),h.style.position="absolute",h.style.height="1px",h.style.top="-1000px",h.style.background="transparent",d.appendChild(h));this._setFullSelection(this._fullSelection,
!0);d=b.createElement(c,"div");d.className="textviewContent";this._clientDiv=d;d.tabIndex=0;d.style.position="absolute";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.zIndex="1";d.style.WebkitUserSelect="text";d.setAttribute("spellcheck","false");if(b.isIOS||b.isAndroid)d.style.WebkitTapHighlightColor="transparent";(this._clipDiv||e).appendChild(d);if(b.isIOS||b.isAndroid)this._vScrollDiv=h=b.createElement(c,"div"),h.style.position="absolute",h.style.borderWidth=
"1px",h.style.borderColor="white",h.style.borderStyle="solid",h.style.borderRadius="4px",h.style.backgroundColor="black",h.style.opacity="0.5",h.style.margin="0px",h.style.padding="0px",h.style.outline="none",h.style.zIndex="3",h.style.width="8px",h.style.display="none",e.appendChild(h),this._hScrollDiv=h=b.createElement(c,"div"),h.style.position="absolute",h.style.borderWidth="1px",h.style.borderColor="white",h.style.borderStyle="solid",h.style.borderRadius="4px",h.style.backgroundColor="black",
h.style.opacity="0.5",h.style.margin="0px",h.style.padding="0px",h.style.outline="none",h.style.zIndex="3",h.style.height="8px",h.style.display="none",e.appendChild(h);b.isFirefox&&!d.setCapture&&(this._overlayDiv=h=b.createElement(c,"div"),h.style.position=d.style.position,h.style.borderWidth=d.style.borderWidth,h.style.margin=d.style.margin,h.style.padding=d.style.padding,h.style.cursor="text",h.style.zIndex="2",(this._clipDiv||e).appendChild(h));d.contentEditable="true";d.setAttribute("role","textbox");
d.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();d=this._rulers;for(h=0;h<d.length;h++)this._createRuler(d[h]);this._update();var f=this;q(c,e,"textview",a)}},_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 d=b.firstChild;d;){if(d._ruler===a){d._ruler=void 0;b.removeChild(d);if(0===b.children.length&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}d=d.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();
this._autoScrollTimerID&&(a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null);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,d){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=d;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 d=this._model;
d.getBaseModel&&(a=d.mapOffset(a),b=d.mapOffset(b),d=d.getBaseModel());return d.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var d=this._clientDiv.getBoundingClientRect();a.bottom>d.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a));a=b.getBoundingClientRect(a);var d=this._getLinePixel(b.lineIndex);a.top+=
d;a.bottom+=d;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,d){var c=this._model.getLineDelimiter(),e,f,g=this._getWindow(),m=g.clipboardData;!m&&a&&(m=a.clipboardData);if(m)return e=[],f=m.getData(b.isIE?"Text":"text/plain"),h(f,function(a){e.push(a)},function(){e.push(c)}),
f=e.join(""),d&&d(f),f;if(b.isFirefox){this._ignoreFocus=!0;var k=this._clipboardDiv,m=this._rootDiv.ownerDocument;k||(this._clipboardDiv=k=b.createElement(m,"div"),k.style.position="fixed",k.style.whiteSpace="pre",k.style.left="-1000px",this._rootDiv.appendChild(k));k.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";k.firstChild.focus();var q=this,l=function(){var a=q._getTextFromElement(k);k.innerHTML="";e=[];h(a,function(a){e.push(a)},function(){e.push(c)});return e.join("")},s=!1;this._ignorePaste=
!0;if(!b.isLinux||2!==this._lastMouseButton)try{s=m.execCommand("paste",!1,null)}catch(r){s=1<k.childNodes.length||k.firstChild&&0<k.firstChild.childNodes.length}this._ignorePaste=!1;if(!s){if(a)return g.setTimeout(function(){q.focus();(f=l())&&d&&d(f);q._ignoreFocus=!1},0),null;this.focus();this._ignoreFocus=!1;return""}this.focus();this._ignoreFocus=!1;(f=l())&&d&&d(f);return f}return""},_getDOMText:function(a,b){return a._line.getText(b)},_getTextFromElement:function(a){var b=a.ownerDocument,d=
b.defaultView;if(!d.getSelection)return a.innerText||a.textContent;b=b.createRange();b.selectNode(a);a=d.getSelection();var d=[],c;for(c=0;c<a.rangeCount;c++)d.push(a.getRangeAt(c));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);b=a.toString();a.removeAllRanges();for(c=0;c<d.length;c++)a.addRange(d[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 u(this,a)},_getLineHeight:function(a,b){if(void 0!==a&&this._lineHeight){var d=this._lineHeight[a];if(d)return d;if(b||void 0===b)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&&-1===a.lineIndex;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:
this._clientDiv.lastChild;a&&-1===a.lineIndex;)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(),d=-this._topIndexY+this._getScroll().y;if(a>b)for(;b<a;b++)d+=this._getLineHeight(b);else for(b-=1;b>=a;b--)d-=this._getLineHeight(b);return d}return this._getLineHeight()*a},_getLineIndex:function(a){var b,d=0,c=this._model.getLineCount();if(this._lineHeight){var d=this._getTopIndex(),e=-this._topIndexY+
this._getScroll().y;if(a!==e)if(a<e)for(;a<e&&0<d;)a+=this._getLineHeight(--d);else for(b=this._getLineHeight(d);a-b>=e&&d<c-1;)a-=b,b=this._getLineHeight(++d)}else b=this._getLineHeight(),d=Math.floor(a/b);return Math.max(0,Math.min(c-1,d))},_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){(void 0===a||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()){a=b.getBoundingClientRect();var d=this._getViewPadding(),c=this._viewDiv.getBoundingClientRect();a.top<c.top+d.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(b){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var d=this._handlers=[],c=this._clientDiv,e=this._viewDiv,h=this._rootDiv,f=this._overlayDiv||c,g=c.ownerDocument,m=this._getWindow(),k=b.isIE?g:m;d.push({target:m,type:"resize",handler:function(b){return a._handleResize(b?b:m.event)}});d.push({target:c,
type:"blur",handler:function(b){return a._handleBlur(b?b:m.event)}});d.push({target:c,type:"focus",handler:function(b){return a._handleFocus(b?b:m.event)}});d.push({target:e,type:"focus",handler:function(a){c.focus()}});d.push({target:e,type:"scroll",handler:function(b){return a._handleScroll(b?b:m.event)}});d.push({target:c,type:"textInput",handler:function(b){return a._handleTextInput(b?b:m.event)}});d.push({target:c,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:m.event)}});d.push({target:c,
type:"keypress",handler:function(b){return a._handleKeyPress(b?b:m.event)}});d.push({target:c,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:m.event)}});b.isIE&&d.push({target:g,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?b:m.event)}});d.push({target:c,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:m.event)}});d.push({target:c,type:"copy",handler:function(b){return a._handleCopy(b?b:m.event)}});d.push({target:c,type:"cut",handler:function(b){return a._handleCut(b?
b:m.event)}});d.push({target:c,type:"paste",handler:function(b){return a._handlePaste(b?b:m.event)}});d.push({target:g,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:m.event)}});if(b.isIOS||b.isAndroid)d.push({target:c,type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:m.event)}}),d.push({target:c,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:m.event)}}),d.push({target:c,type:"touchend",handler:function(b){return a._handleTouchEnd(b?
b:m.event)}});else{d.push({target:c,type:"selectstart",handler:function(b){return a._handleSelectStart(b?b:m.event)}});d.push({target:c,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:m.event)}});d.push({target:c,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:m.event)}});d.push({target:c,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:m.event)}});d.push({target:k,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:m.event)}});d.push({target:k,
type:"mousemove",handler:function(b){return a._handleMouseMove(b?b:m.event)}});d.push({target:h,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:m.event)}});d.push({target:h,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?b:m.event)}});d.push({target:f,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:m.event)}});d.push({target:f,type:"drag",handler:function(b){return a._handleDrag(b?b:m.event)}});d.push({target:f,type:"dragend",handler:function(b){return a._handleDragEnd(b?
b:m.event)}});d.push({target:f,type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:m.event)}});d.push({target:f,type:"dragover",handler:function(b){return a._handleDragOver(b?b:m.event)}});d.push({target:f,type:"dragleave",handler:function(b){return a._handleDragLeave(b?b:m.event)}});d.push({target:f,type:"drop",handler:function(b){return a._handleDrop(b?b:m.event)}});d.push({target:this._clientDiv,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?
b:m.event)}});this._clipDiv&&d.push({target:this._clipDiv,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:m.event)}});if(b.isFirefox&&(!b.isWindows||15<=b.isFirefox))(e=m.MutationObserver||m.MozMutationObserver)?(this._mutationObserver=new e(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(c,{subtree:!0,characterData:!0})):d.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?
b:m.event)}});this._overlayDiv&&(d.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:m.event)}}),d.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:m.event)}}),d.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:m.event)}}),d.push({target:this._overlayDiv,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:m.event)}}));this._isW3CEvents||d.push({target:this._clientDiv,
type:"dblclick",handler:function(b){return a._handleDblclick(b?b:m.event)}})}this._hookRulerEvents(this._leftDiv,d);this._hookRulerEvents(this._rightDiv,d);this._hookRulerEvents(this._marginDiv,d);for(e=0;e<d.length;e++)h=d[e],z(h.target,h.type,h.handler,h.capture)},_hookRulerEvents:function(a,d){if(a){var c=this,e=this._getWindow();b.isIE&&d.push({target:a,type:"selectstart",handler:function(){return!1}});d.push({target:a,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return c._handleMouseWheel(a?
a:e.event)}});d.push({target:a,type:"click",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"dblclick",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"mousemove",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"mouseover",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"mouseout",handler:function(a){c._handleRulerEvent(a?a:e.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 d=a.parent;"string"===typeof d&&(d=(a.document||document).getElementById(d));if(!d)throw"no parent";a.parent=d;a.model=a.model||new n.TextModel;var c=this._defaultOptions(),e;for(e in c)c.hasOwnProperty(e)&&(this["_"+e]=void 0!==a[e]?a[e]:c[e].value);this._keyModes=[];this._rulers=[];this._selection=new r(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=(!b.isIE||9<=b.isIE)&&"function"===typeof d.ownerDocument.createRange().getBoundingClientRect;this._isW3CEvents=d.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),!(null===a.text||void 0===a.text)){var d=this._model;try{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!0),d.setText(a.text,a.start,a.end)}finally{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}b&&(d=
this._getSelection(),d.setCaret(a.start+a.text.length),this._setSelection(d,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var b=a.start,d=a.addedCharCount,c=a.removedCharCount,e=a.addedLineCount,h=a.removedLineCount,f=this._getSelection();f.end>b&&(f.end>b&&f.start<b+c?f.setCaret(b+d):(f.start+=d-c,f.end+=d-c),this._setSelection(f,!1,!1));b=this._model.getLineAtOffset(b);for(d=this._getLineNext();d;)c=d.lineIndex,b<=
c&&c<=b+h&&(b===c&&!d.modelChangedEvent&&!d.lineRemoved?(d.modelChangedEvent=a,d.lineChanged=!0):(d.lineRemoved=!0,d.lineChanged=!1,d.modelChangedEvent=null)),c>b+h&&(d.lineIndex=c+e-h,d._line.lineIndex=d.lineIndex),d=this._getLineNext(d);this._lineHeight&&(a=[b,h].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<=b+h&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._update()},
_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==b)for(var d=a;d<b;d++)this._lineHeight[d]=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 r(0,0,!1),!1,!1);this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var a=this._clientDiv;if(a){for(a=a.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;13>b.isFirefox&&
this._fixCaret()}},_scrollViewAnimated:function(a,b,d){var c=this._getWindow();if(d&&this._scrollAnimation){var e=this;this._animation=new x({window:c,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);e._scrollView(0,a);b-=a},onEnd:function(){e._animation=null;e._scrollView(a,b);d&&c.setTimeout(d,0)}});this._animation.play()}else this._scrollView(a,b),d&&c.setTimeout(d,0)},_scrollView:function(a,b){this._ensureCaretVisible=!1;var d=this._viewDiv;a&&(d.scrollLeft+=
a);b&&(d.scrollTop+=b)},_setClipboardText:function(a,d){var c,e=this._getWindow(),f=e.clipboardData;!f&&d&&(f=d.clipboardData);if(f&&(c=[],h(a,function(a){c.push(a)},function(){c.push(b.platformDelimiter)}),f.setData(b.isIE?"Text":"text/plain",c.join(""))))return!0;var g=this._parent.ownerDocument,m=b.createElement(g,"pre");m.style.position="fixed";m.style.left="-1000px";h(a,function(a){m.appendChild(g.createTextNode(a))},function(){m.appendChild(b.createElement(g,"br"))});m.appendChild(g.createTextNode(" "));
this._clientDiv.appendChild(m);f=g.createRange();f.setStart(m.firstChild,0);f.setEndBefore(m.lastChild);var k=e.getSelection();0<k.rangeCount&&k.removeAllRanges();k.addRange(f);var q=this,f=function(){m&&m.parentNode===q._clientDiv&&q._clientDiv.removeChild(m);q._updateDOMSelection()},k=!1;this._ignoreCopy=!0;try{k=g.execCommand("copy",!1,null)}catch(l){}this._ignoreCopy=!1;if(!k&&d)return e.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(a,d,c,e,h){this._setDOMFullSelection(a,d,c,e);a=
a._line.getNodeOffset(d);c=c._line.getNodeOffset(e);e=this._getWindow();d=this._parent.ownerDocument;if(e.getSelection){var f=e.getSelection();e=d.createRange();e.setStart(a.node,a.offset);e.setEnd(c.node,c.offset);if(this._hasFocus&&(f.anchorNode!==a.node||f.anchorOffset!==a.offset||f.focusNode!==c.node||f.focusOffset!==c.offset||f.anchorNode!==c.node||f.anchorOffset!==c.offset||f.focusNode!==a.node||f.focusOffset!==a.offset))this._anchorNode=a.node,this._anchorOffset=a.offset,this._focusNode=c.node,
this._focusOffset=c.offset,this._ignoreSelect=!1,0<f.rangeCount&&f.removeAllRanges(),f.addRange(e),this._ignoreSelect=!0;this._cursorDiv&&(e=d.createRange(),h?(e.setStart(a.node,a.offset),e.setEnd(a.node,a.offset)):(e.setStart(c.node,c.offset),e.setEnd(c.node,c.offset)),h=e.getClientRects()[0],a=this._cursorDiv.parentNode,c=a.getBoundingClientRect(),h&&c&&(this._cursorDiv.style.top=h.top-c.top+a.scrollTop+"px",this._cursorDiv.style.left=h.left-c.left+a.scrollLeft+"px"))}else d.selection&&this._hasFocus&&
(h=d.body,e=b.createElement(d,"div"),h.appendChild(e),h.removeChild(e),e=h.createTextRange(),e.moveToElementText(a.node.parentNode),e.moveStart("character",a.offset),h=h.createTextRange(),h.moveToElementText(c.node.parentNode),h.moveStart("character",c.offset),e.setEndPoint("EndToStart",h),this._ignoreSelect=!1,e.select(),this._ignoreSelect=!0)},_setDOMFullSelection:function(a,b,d,c){if(this._selDiv1){var 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";if(!(a===d&&b===c)){var h=this._getViewPadding(),f=this._clientDiv.getBoundingClientRect(),g=this._viewDiv.getBoundingClientRect(),e=g.left+h.left,m=f.right,h=g.top+h.top,k=f.bottom,g=f=0;this._clipDiv?(g=this._clipDiv.getBoundingClientRect(),f=g.left-this._clipDiv.scrollLeft):(g=this._rootDiv.getBoundingClientRect(),f=g.left);g=g.top;this._ignoreDOMSelection=!0;var q=(new u(this,a.lineIndex,a)).getBoundingClientRect(b,
!1),l=q.left;b=(new u(this,d.lineIndex,d)).getBoundingClientRect(c,!1);var s=b.left;this._ignoreDOMSelection=!1;var r=this._selDiv1,l=Math.min(m,Math.max(e,l)),n=Math.min(k,Math.max(h,q.top)),t=m;c=Math.min(k,Math.max(h,q.bottom));r.style.left=l-f+"px";r.style.top=n-g+"px";r.style.width=Math.max(0,t-l)+"px";r.style.height=Math.max(0,c-n)+"px";a.lineIndex===d.lineIndex?(t=Math.min(s,m),r.style.width=Math.max(0,t-l)+"px"):(q=Math.min(k,Math.max(h,b.top)),s=Math.min(m,Math.max(e,s)),h=Math.min(k,Math.max(h,
b.bottom)),k=this._selDiv3,k.style.left=e-f+"px",k.style.top=q-g+"px",k.style.width=Math.max(0,s-e)+"px",k.style.height=Math.max(0,h-q)+"px",1<Math.abs(a.lineIndex-d.lineIndex)&&(a=this._selDiv2,a.style.left=e-f+"px",a.style.top=c-g+"px",a.style.width=Math.max(0,m-e)+"px",a.style.height=Math.max(0,q-c)+"px"))}}},_setGrab:function(a){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;b.isIE&&a&&(this._hadFocus=this._hasFocus);var d=this._clientDiv;d.contentEditable=!a;this._hadFocus&&!a&&d.focus();this._overlayDiv&&(this._overlayDiv.style.zIndex=a?"-1":"1");for(a=this._getLineNext();a;)a._line.updateLinks(),a=this._getLineNext(a);this._updateDOMSelection()}},_setSelection:function(a,b,d,c,e){if(a){this._columnX=-1;void 0===d&&(d=!0);var h=this._selection;this._selection=a;!1!==b&&this._showCaret(!1,c,
b,e);d&&this._updateDOMSelection();if(!h.equals(a))this.onSelection({type:"Selection",oldValue:{start:h.start,end:h.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,b,d,c){var e=this._model,h=this._getSelection();b=this.convert({x:a,y:b},"page","document");a=this._getLineIndex(b.y);if(1===this._clickCount){e=this._getLine(a);a=e.getOffset(b.x,b.y-this._getLinePixel(a));e.destroy();if(c&&!d&&h.start<=a&&a<h.end)return this._dragOffset=a,!1;h.extend(a);d||h.collapse()}else 0===
(this._clickCount&1)?(e=this._getLine(a),a=e.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(d=this._doubleClickSelection.start,c=e.getNextOffset(a,{unit:"wordend",count:1})):(d=e.getNextOffset(a,{unit:"word",count:-1}),c=this._doubleClickSelection.end):(d=e.getNextOffset(a,{unit:"word",count:-1}),c=e.getNextOffset(d,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?(c=e.getLineAtOffset(this._doubleClickSelection.start),a>=
c?(d=e.getLineStart(c),c=e.getLineEnd(a)):(d=e.getLineStart(a),c=e.getLineEnd(c))):(d=e.getLineStart(a),c=e.getLineEnd(a)),h.setCaret(d),h.extend(c);this._setSelection(h,!0,!0);return!0},_setFullSelection:function(a,d){this._fullSelection=a;b.isWebkit&&(this._fullSelection=!0);var c=this._clipDiv||this._rootDiv;if(c)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!b.isIOS){var e=c.ownerDocument;this._highlightRGB=b.isWebkit?"transparent":"Highlight";var h=b.createElement(e,"div");
this._selDiv1=h;h.style.position="absolute";h.style.borderWidth="0px";h.style.margin="0px";h.style.padding="0px";h.style.outline="none";h.style.background=this._highlightRGB;h.style.width="0px";h.style.height="0px";h.style.zIndex="0";c.appendChild(h);var f=b.createElement(e,"div");this._selDiv2=f;f.style.position="absolute";f.style.borderWidth="0px";f.style.margin="0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width="0px";f.style.height="0px";f.style.zIndex=
"0";c.appendChild(f);this._selDiv3=e=b.createElement(e,"div");e.style.position="absolute";e.style.borderWidth="0px";e.style.margin="0px";e.style.padding="0px";e.style.outline="none";e.style.background=this._highlightRGB;e.style.width="0px";e.style.height="0px";e.style.zIndex="0";c.appendChild(e);if(b.isFirefox&&b.isMac){c=this._getWindow().getComputedStyle(e,null).getPropertyValue("background-color");switch(c){case "rgb(119, 141, 168)":c="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":c="rgb(198, 198, 198)";
break;case "rgb(255, 193, 31)":c="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":c="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":c="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":c="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":c="rgb(232, 184, 255)";break;default:c="rgb(180, 213, 255)"}this._highlightRGB=c;h.style.background=c;f.style.background=c;e.style.background=c}d||this._updateDOMSelection()}}else this._selDiv1&&(c.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&
(c.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(c.removeChild(this._selDiv3),this._selDiv3=null)},_setBlockCursor:function(a){this._blockCursorVisible=a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=this._viewDiv,d=b.createElement(a.ownerDocument,"div");d.className="textviewBlockCursor";this._cursorDiv=
d;d.tabIndex=-1;d.style.zIndex="2";d.style.color="transparent";d.style.position="absolute";d.style.pointerEvents="none";d.innerHTML="\x26nbsp;";a.appendChild(d);this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(a,b){this._wrapOffset=
a;b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,d){this._tabSize=a;this._customTabSize=void 0;var c=this._clientDiv;b.isOpera?c&&(c.style.OTabSize=this._tabSize+""):537.1<=b.isWebkit?c&&(c.style.tabSize=this._tabSize+""):4<=b.isFirefox?c&&(c.style.MozTabSize=this._tabSize+
""):8!==this._tabSize&&(this._customTabSize=this._tabSize);d||(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 d="textview",c=this._theme.getThemeClass();c&&(d+=" "+c);this._themeClass&&c!==this._themeClass&&(d+=
" "+this._themeClass);this._rootDiv.className=d;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var d=this._clientDiv;this._wrapMode?(d.style.whiteSpace="pre-wrap",d.style.wordWrap="break-word"):(d.style.whiteSpace="pre",d.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,d,c){if(this._clientDiv){var e=this._model,h=this._getSelection(),f=this._getScroll(),g=h.getCaret(),m=h.start,
k=h.end,q=e.getLineAtOffset(m),l=e.getLineAtOffset(k),s=Math.max(Math.max(m,e.getLineStart(l)),k-1),e=this._getClientWidth(),r=this._getClientHeight(),n=e/4,t=this._getBoundsAtOffset(g===m?m:s),y=t.left,v=t.right,x=t.top,u=t.bottom,w=0,z="object"===typeof d;if((a||z)&&!h.isEmpty())t=this._getBoundsAtOffset(g===k?m:s),w=(t.bottom>u?t.bottom:u)-(t.top<x?t.top:x),a&&(t.top===x?g===m?v=y+Math.min(t.right-y,e):y=v-Math.min(v-t.left,e):g===m?u=x+Math.min(t.bottom-x,r):x=u-Math.min(u-t.top,r));a=0;y<f.x&&
(a=Math.min(y-f.x,-n));v>f.x+e&&(a=Math.max(v-f.x-e,n));h=0;x<f.y?h=x-f.y:u>f.y+r&&(h=u-f.y-r);c&&(0<c?0<h&&(h=Math.max(h,c)):0>h&&(h=Math.min(h,c)));c=z&&"always"===d.scrollPolicy;if(0!==a||0!==h||c)return z?(c=0<h,0===h&&(h=x-f.y),f=d.viewAnchor||"caret",x=d.selectionAnchor||"caret",d=Math.min(Math.max(0,d.viewAnchorOffset||0)),h="top"===f?h+Math.floor(c?(1-d)*r:-d*r):"bottom"===f?h+Math.floor(c?d*r:-(1-d)*r):"center"===f?h+Math.floor(c?r/2+d*r:r/2-(1-d)*r):h+Math.floor(c?d*r:-d*r),q!==l&&("top"===
x&&g!==m?h+=Math.floor(-w):"bottom"===x&&g!==k?h+=Math.floor(w):"center"===x&&(h+=Math.floor(w/2)))):0!==h&&"number"===typeof d&&(0>d&&(d=0),1<d&&(d=1),h+=Math.floor(0<h?d*r:-d*r)),this._scrollViewAnimated(a,h,b),r!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;b&&b();return!1}},_startIME:function(){if(-1===this._imeOffset){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];y(b.target,b.type,b.handler)}this._handlers=null;this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},_updateDOMSelection:function(){if(!(0<
this._redrawCount)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,d=b.getLineAtOffset(a.start),c=b.getLineAtOffset(a.end),e=this._getLineNext();if(e){var h=this._getLinePrevious(),f;d<e.lineIndex?(d=e,f=b.getLineStart(e.lineIndex)):d>h.lineIndex?(d=h,f=b.getLineStart(h.lineIndex)):(d=this._getLineNode(d),f=a.start);c<e.lineIndex?(c=e,b=b.getLineStart(e.lineIndex)):c>h.lineIndex?(c=h,b=b.getLineStart(h.lineIndex)):(c=this._getLineNode(c),b=a.end);this._setDOMSelection(d,
f,c,b,a.caret)}}},_update:function(a){if(!(0<this._redrawCount)){this._updateTimer&&(this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,a=!1);var d=this._clientDiv,c=this._viewDiv;if(d){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var e=this._model,h=this._getScroll(!1),f=this._getViewPadding(),g=e.getLineCount(),m=this._getLineHeight(),k=!1,q=!1,l=!1,s=this._metrics.scrollWidth;this._wrapMode&&(d.style.width=(this._metrics.wrapWidth||
this._getClientWidth())+"px");var r,n,t,y,x=0,v=0,w;if(this._lineHeight){for(;v<g;){w=this._getLineHeight(v);if(x+w>h.y)break;x+=w;v++}r=v;n=Math.max(0,r-1);t=e=h.y-x;0<r&&(e+=this._getLineHeight(r-1))}else y=Math.max(0,h.y)/m,r=Math.floor(y),n=Math.max(0,r-1),e=Math.round((y-n)*m),t=Math.round((y-r)*m);this._topIndexY=t;y=this._rootDiv;var z=y.clientWidth,F=y.clientHeight;if(a){m=0;this._leftDiv&&(r=this._leftDiv.getBoundingClientRect(),m=r.right-r.left);r=this._getClientWidth();y=this._getClientHeight();
q=r;for(this._wrapMode?this._metrics.wrapWidth&&(q=this._metrics.wrapWidth):q=Math.max(this._maxLineWidth,q);v<g;)w=this._getLineHeight(v,!1),x+=w,v++;g=x}else{y=this._getClientHeight();t=Math.min(r+Math.floor((y+t)/m),g-1);var h=Math.min(t+1,g-1),D;for(w=d.firstChild;w;){D=w.lineIndex;var L=w.nextSibling;if(!(n<=D&&D<=h)||w.lineRemoved||-1===w.lineIndex)this._mouseWheelLine===w?(w.style.display="none",w.lineIndex=-1):d.removeChild(w);w=L}w=this._getLineNext();var L=c.ownerDocument,N=L.createDocumentFragment();
for(D=n;D<=h;D++)!w||w.lineIndex>D?(new u(this,D)).create(N,null):(N.firstChild&&(d.insertBefore(N,w),N=L.createDocumentFragment()),w&&w.lineChanged&&(w=(new u(this,D)).create(N,w),w.lineChanged=!1),w=this._getLineNext(w));N.firstChild&&d.insertBefore(N,w);b.isWebkit&&!this._wrapMode&&(d.style.width="0x7fffffffpx");w=this._getLineNext();D=y+e;for(N=!1;w;)n=w.lineWidth,void 0===n&&(L=w._line.getBoundingClientRect(),n=w.lineWidth=Math.ceil(L.right-L.left),L=L.bottom-L.top,this._lineHeight?this._lineHeight[w.lineIndex]=
L:0!==m&&0!==L&&Math.ceil(m)!==Math.ceil(L)&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[w.lineIndex]=L)),this._lineHeight&&!N&&(D-=this._lineHeight[w.lineIndex],0>D&&(t=w.lineIndex,N=!0)),this._wrapMode||(n>=this._maxLineWidth&&(this._maxLineWidth=n,this._maxLineIndex=w.lineIndex),this._checkMaxLineIndex===w.lineIndex&&(this._checkMaxLineIndex=-1)),w.lineIndex===r&&(this._topChild=w),w.lineIndex===t&&(this._bottomChild=w),w=this._getLineNext(w);for(-1!==this._checkMaxLineIndex&&
(D=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=D&&D<g&&(m=new u(this,D),L=m.getBoundingClientRect(),n=L.right-L.left,n>=this._maxLineWidth&&(this._maxLineWidth=n,this._maxLineIndex=D),m.destroy()));v<g;)w=this._getLineHeight(v,v<=t),x+=w,v++;g=x;this._updateRuler(this._leftDiv,r,h,F);this._updateRuler(this._rightDiv,r,h,F);this._updateRuler(this._marginDiv,r,h,F);m=0;this._leftDiv&&(r=this._leftDiv.getBoundingClientRect(),m=r.right-r.left);h=0;this._rightDiv&&(h=this._rightDiv.getBoundingClientRect(),
h=h.right-h.left);c.style.left=m+"px";c.style.right=h+"px";h=this._scrollDiv;h.style.height=g+"px";r=this._getClientWidth();!this._singleMode&&!this._wrapMode&&(x=k=y,(v="scroll"===c.style.overflowX)?k+=s:x-=s,w=t=r,(n="scroll"===c.style.overflowY)?t+=s:w-=s,y=k,r=t,g>y&&(l=!0,r=w),this._maxLineWidth>r&&(q=!0,y=x,g>y&&(l=!0,r=w)),v!==q&&(c.style.overflowX=q?"scroll":"hidden"),n!==l&&(c.style.overflowY=l?"scroll":"hidden"),k=v!==q||n!==l);l=r;this._wrapMode?this._metrics.wrapWidth&&(l=this._metrics.wrapWidth):
l=Math.max(this._maxLineWidth,l);q=l;if((!b.isIE||9<=b.isIE)&&this._maxLineWidth>r)l+=f.right+f.left;h.style.width=l+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=l+"px");h=this._getScroll(!1)}this._vScrollDiv&&(l=y-8,x=Math.max(15,Math.ceil(Math.min(1,l/(g+f.top+f.bottom))*l)),this._vScrollDiv.style.left=m+r-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,h.y*l/g))+"px",this._vScrollDiv.style.height=x+"px");!this._wrapMode&&this._hScrollDiv&&(l=r-8,x=Math.max(15,Math.ceil(Math.min(1,
l/(this._maxLineWidth+f.left+f.right))*l)),this._hScrollDiv.style.left=m+Math.floor(Math.max(0,Math.floor(h.x*l/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=y-9+"px",this._hScrollDiv.style.width=x+"px");v=h.x;x=this._clipDiv;l=this._overlayDiv;if(t=this._marginDiv)t.style.left=-v+m+this._metrics.marginWidth+f.left+"px",t.style.bottom=("scroll"===c.style.overflowX?s:0)+"px";x?(x.scrollLeft=v,x.scrollTop=0,c=m+f.left,s=f.top,a=r,m=y,v=0,t=-e,0===h.x&&(c-=f.left,a+=f.left,v=f.left),h.x+r===
q&&(a+=f.right),0===h.y&&(s-=f.top,m+=f.top,t+=f.top),h.y+y===g&&(m+=f.bottom),x.style.left=c+"px",x.style.top=s+"px",x.style.right=z-a-c+"px",x.style.bottom=F-m-s+"px",d.style.left=v+"px",d.style.top=t+"px",d.style.width=q+"px",d.style.height=y+e+"px",l&&(l.style.left=d.style.left,l.style.top=d.style.top,l.style.width=d.style.width,l.style.height=d.style.height)):(c=v,s=e,z=v+r,F=e+y,0===c&&(c-=f.left),0===s&&(s-=f.top),z===q&&(z+=f.right),h.y+y===g&&(F+=f.bottom),d.style.clip="rect("+s+"px,"+z+
"px,"+F+"px,"+c+"px)",d.style.left=-v+m+f.left+"px",d.style.width=(this._wrapMode||b.isWebkit?q:r+v)+"px",a||(d.style.top=-e+f.top+"px",d.style.height=y+e+"px"),l&&(l.style.clip=d.style.clip,l.style.left=d.style.left,l.style.width=d.style.width,a||(l.style.top=d.style.top,l.style.height=d.style.height)));this._updateDOMSelection();k&&(d=this._ensureCaretVisible,this._ensureCaretVisible=!1,d&&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,d,c,h){if(a){var f=this._parent.ownerDocument,g=this._getLineHeight(),m=this._getViewPadding();for(a=a.firstChild;a;){var k=a._ruler,q=g,l=k.getOverview();"page"===l&&(q+=this._topIndexY);a.style.top=-q+"px";a.style.height=h+q+"px";a.rulerChanged&&e(k.getRulerStyle(),a);var s,r=a.firstChild;r?(s=r,r=r.nextSibling):(s=b.createElement(f,"div"),s.style.visibility="hidden",a.appendChild(s));var n;if(a.rulerChanged&&
s){q=-1;if(n=k.getWidestAnnotation())e(n.style,s),n.html&&(s.innerHTML=n.html);s.lineIndex=q;s.style.height=g+m.top+"px"}var t;if("page"===l){for(k=k.getAnnotations(d,c+1);r;)q=r.lineIndex,n=r.nextSibling,(!(d<=q&&q<=c)||r.lineChanged)&&a.removeChild(r),r=n;r=a.firstChild.nextSibling;t=f.createDocumentFragment();for(q=d;q<=c;q++)if(!r||r.lineIndex>q){s=b.createElement(f,"div");if(n=k[q])e(n.style,s),n.html&&(s.innerHTML=n.html),s.annotation=n;s.lineIndex=q;s.style.height=this._getLineHeight(q)+"px";
t.appendChild(s)}else t.firstChild&&(a.insertBefore(t,r),t=f.createDocumentFragment()),r&&(r=r.nextSibling);t.firstChild&&a.insertBefore(t,r)}else{n=this._getClientHeight();q=this._model.getLineCount();r=n+m.top+m.bottom-2*this._metrics.scrollWidth;l=g*q<r?g:r/q;if(a.rulerChanged){for(n=a.childNodes.length;1<n;)a.removeChild(a.lastChild),n--;k=k.getAnnotations(0,q);t=f.createDocumentFragment();for(var y in k)q=y>>>0,0>q||(s=b.createElement(f,"div"),n=k[y],e(n.style,s),s.style.position="absolute",
s.style.top=this._metrics.scrollWidth+g+Math.floor(q*l)+"px",n.html&&(s.innerHTML=n.html),s.annotation=n,s.lineIndex=q,t.appendChild(s));a.appendChild(t)}else if(a._oldTrackHeight!==r)for(s=a.firstChild?a.firstChild.nextSibling:null;s;)s.style.top=this._metrics.scrollWidth+g+Math.floor(s.lineIndex*l)+"px",s=s.nextSibling;a._oldTrackHeight=r}a.rulerChanged=!1;a=a.nextSibling}}},_updateStyleSheet:function(){var a="";b.isWebkit&&0<this._metrics.scrollWidth&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
b.isFirefox&&b.isMac&&this._highlightRGB&&"Highlight"!==this._highlightRGB&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var d=this._clientDiv.ownerDocument,c=d.getElementById("_textviewStyle");if(c)c.removeChild(c.firstChild),c.appendChild(d.createTextNode(a));else{c=b.createElement(d,"style");c.id="_textviewStyle";var e=d.getElementsByTagName("head")[0]||d.documentElement;c.appendChild(d.createTextNode(a));e.insertBefore(c,e.firstChild)}}},_updateStyle:function(a){!a&&
b.isIE&&(this._rootDiv.style.lineHeight="normal");var d=this._metrics=this._calculateMetrics();this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight());this._rootDiv.style.lineHeight=b.isIE?d.lineHeight-(d.lineTrim.top+d.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};g.EventTarget.addMixin(w.prototype);return{TextView:w}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(k,n){function l(g){this._model=g;this._projections=[];var c=this;this._listener={onChanged:function(f){c._onChanged(f)},onChanging:function(f){c._onChanging(f)}};g.addEventListener("postChanged",this._listener.onChanged);g.addEventListener("preChanging",this._listener.onChanging)}l.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(g){if(g){var c=this._model,f=this._projections;g._lineIndex=c.getLineAtOffset(g.start);g._lineCount=c.getLineAtOffset(g.end)-g._lineIndex;var b=g.text;b||(b="");g._model="string"===typeof b?new k.TextModel(b,c.getLineDelimiter()):b;var c=this.mapOffset(g.start,!0),b=g.end-g.start,e=g._lineCount,d=g._model.getCharCount(),m=g._model.getLineCount()-1,a={type:"Changing",text:g._model.getText(),
start:c,removedCharCount:b,addedCharCount:d,removedLineCount:e,addedLineCount:m};this.onChanging(a);a=this._binarySearch(f,g.start);f.splice(a,0,g);this.onChanged({type:"Changed",start:c,removedCharCount:b,addedCharCount:d,removedLineCount:e,addedLineCount:m})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(g,c){var f=this._projections,b=0,e,d;if(c){for(e=0;e<f.length;e++){d=f[e];if(d.start>g)break;if(d.end>g)return-1;b+=
d._model.getCharCount()-(d.end-d.start)}return g+b}for(e=0;e<f.length;e++){d=f[e];if(d.start>g-b)break;var m=d._model.getCharCount();if(d.start+m>g-b)return-1;b+=m-(d.end-d.start)}return g-b},removeProjection:function(g){var c,f=0;for(c=0;c<this._projections.length;c++){var b=this._projections[c];if(b===g){g=b;break}f+=b._model.getCharCount()-(b.end-b.start)}if(c<this._projections.length){var b=this._model,f=g.start+f,e=g.end-g.start,d=g._lineCount,m=g._model.getCharCount(),a=g._model.getLineCount()-
1;g={type:"Changing",text:b.getText(g.start,g.end),start:f,removedCharCount:m,addedCharCount:e,removedLineCount:a,addedLineCount:d};this.onChanging(g);this._projections.splice(c,1);this.onChanged({type:"Changed",start:f,removedCharCount:m,addedCharCount:e,removedLineCount:a,addedLineCount:d})}},_binarySearch:function(g,c){for(var f=g.length,b=-1,e;1<f-b;)e=Math.floor((f+b)/2),c<=g[e].start?f=e:b=e;return f},getCharCount:function(){for(var g=this._model.getCharCount(),c=this._projections,f=0;f<c.length;f++)var b=
c[f],g=g+(b._model.getCharCount()-(b.end-b.start));return g},getLine:function(g,c){if(0>g)return null;var f=this._model,b=this._projections,e=0,d=[],m=0,a,h,k;for(a=0;a<b.length;a++){k=b[a];if(k._lineIndex>=g-e)break;h=k._model.getLineCount()-1;if(k._lineIndex+h>=g-e){m=g-(k._lineIndex+e);if(m<h)return k._model.getLine(m,c);d.push(k._model.getLine(h))}m=k.end;e+=h-k._lineCount}for(m=Math.max(m,f.getLineStart(g-e));a<b.length;a++){k=b[a];if(k._lineIndex>g-e)break;d.push(f.getText(m,k.start));h=k._model.getLineCount()-
1;if(k._lineIndex+h>g-e)return d.push(k._model.getLine(0,c)),d.join("");d.push(k._model.getText());m=k.end;e+=h-k._lineCount}b=f.getLineEnd(g-e,c);m<b&&d.push(f.getText(m,b));return d.join("")},getLineAtOffset:function(g){for(var c=this._model,f=this._projections,b=0,e=0,d=0;d<f.length;d++){var m=f[d];if(m.start>g-b)break;var a=m._model.getCharCount();if(m.start+a>g-b){f=g-(m.start+b);e+=m._model.getLineAtOffset(f);b+=f;break}e+=m._model.getLineCount()-1-m._lineCount;b+=a-(m.end-m.start)}return c.getLineAtOffset(g-
b)+e},getLineCount:function(){for(var g=this._projections,c=this._model.getLineCount(),f=0;f<g.length;f++)var b=g[f],c=c+(b._model.getLineCount()-1-b._lineCount);return c},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(g,c){if(0>g)return-1;for(var f=this._model,b=this._projections,e=0,d=0,m=0;m<b.length;m++){var a=b[m];if(a._lineIndex>g-e)break;var h=a._model.getLineCount()-1;if(a._lineIndex+h>g-e)return a._model.getLineEnd(g-(a._lineIndex+e),c)+a.start+d;d+=
a._model.getCharCount()-(a.end-a.start);e+=h-a._lineCount}return f.getLineEnd(g-e,c)+d},getLineStart:function(g){if(0>g)return-1;for(var c=this._model,f=this._projections,b=0,e=0,d=0;d<f.length;d++){var m=f[d];if(m._lineIndex>=g-b)break;var a=m._model.getLineCount()-1;if(m._lineIndex+a>=g-b)return m._model.getLineStart(g-(m._lineIndex+b))+m.start+e;e+=m._model.getCharCount()-(m.end-m.start);b+=a-m._lineCount}return c.getLineStart(g-b)+e},getText:function(g,c){void 0===g&&(g=0);var f=this._model,b=
this._projections,e=0,d=[],m,a,h;for(m=0;m<b.length;m++){a=b[m];if(a.start>g-e)break;h=a._model.getCharCount();if(a.start+h>g-e){if(void 0!==c&&a.start+h>c-e)return a._model.getText(g-(a.start+e),c-(a.start+e));d.push(a._model.getText(g-(a.start+e)));g=a.end+e+h-(a.end-a.start)}e+=h-(a.end-a.start)}var k=g-e;if(void 0!==c){for(;m<b.length;m++){a=b[m];if(a.start>c-e)break;d.push(f.getText(k,a.start));h=a._model.getCharCount();if(a.start+h>c-e)return d.push(a._model.getText(0,c-(a.start+e))),d.join("");
d.push(a._model.getText());k=a.end;e+=h-(a.end-a.start)}d.push(f.getText(k,c-e))}else{for(;m<b.length;m++)a=b[m],d.push(f.getText(k,a.start)),d.push(a._model.getText()),k=a.end;d.push(f.getText(k))}return d.join("")},_onChanged:function(g){g=this._change;var c=g.baseStart,f=g.baseEnd,b,e,d=this._projections;for(b=0;b<d.length&&!(e=d[b],e.end>c);b++);var m=b;for(b=0;b<d.length&&!(e=d[b],e.start>=f);b++);var a=b,h=this._model,c=g.baseText.length-(f-c);for(b=a;b<d.length;b++)e=d[b],e.start+=c,e.end+=
c,e._lineIndex=h.getLineAtOffset(e.start);e=d.splice(m,a-m);for(b=0;b<e.length;b++)e[b].annotation&&e[b].annotation._expand();this.onChanged({type:"Changed",start:g.start,removedCharCount:g.removedCharCount,addedCharCount:g.addedCharCount,removedLineCount:g.removedLineCount,addedLineCount:g.addedLineCount});this._change=void 0},_onChanging:function(g){var c=!!this._change,f=this._change||{},b=g.start,e=b+g.removedCharCount;f.baseStart=b;f.baseEnd=e;f.baseText=g.text;f.addedLineCount=g.addedLineCount;
if(!c){this._change=f;f.text=g.text;var d=this._projections,m,a,h;g=function(b){for(m=a=0;a<d.length;a++){h=d[a];if(h.start>b)break;if(h.end>b)return-1;m+=h._model.getCharCount()-(h.end-h.start)}return b+m};f.start=g(b);-1===f.start&&(f.text=this._model.getText(h.start,b)+f.text,f.addedLineCount+=this._model.getLineAtOffset(b)-this._model.getLineAtOffset(h.start),f.start=h.start+m);f.end=g(e);-1===f.end&&(f.text+=this._model.getText(e,h.end),f.addedLineCount+=this._model.getLineAtOffset(h.end)-this._model.getLineAtOffset(e),
f.end=h.start+m)}f.addedCharCount=f.text.length;f.removedCharCount=f.end-f.start;f.removedLineCount=this.getLineAtOffset(f.end)-this.getLineAtOffset(f.start);this.onChanging({type:"Changing",text:f.text,start:f.start,removedCharCount:f.removedCharCount,addedCharCount:f.addedCharCount,removedLineCount:f.removedLineCount,addedLineCount:f.addedLineCount})},onChanging:function(g){return this.dispatchEvent(g)},onChanged:function(g){return this.dispatchEvent(g)},setLineDelimiter:function(g){this._model.setLineDelimiter(g)},
setText:function(g,c,f){function b(b){for(d=m=0;m<e.length;m++){a=e[m];if(a.start>b-d)break;var c=a._model.getCharCount();if(a.start+c>b-d)return-1;d+=c-(a.end-a.start)}return b-d}this._change={text:g||"",start:c||0,end:void 0===f?this.getCharCount():f};var e=this._projections,d,m,a,h,k;g=b(this._change.start);-1===g&&(h={projection:a,start:this._change.start-(a.start+d)},g=a.end);c=b(this._change.end);-1===c&&(k={projection:a,end:this._change.end-(a.start+d)},c=a.start);h&&k&&h.projection===k.projection?
a._model.setText(this._change.text,h.start,k.end):(this._model.setText(this._change.text,g,c),h&&(a=h.projection,a._model.setText("",h.start)),k&&(a=k.projection,a._model.setText("",0,k.end),a.start=a.end,a._lineCount=0));this._change=void 0}};n.EventTarget.addMixin(l.prototype);return{ProjectionTextModel:l}});
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,n,l,g,c,f){function b(b){this._view=b;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(b.getOptions("parent").ownerDocument)}b.getTooltip=function(c){c._tooltip||(c._tooltip=new b(c));return c._tooltip};b.prototype={_create:function(b){if(!this._tooltipDiv){var d=
this._tooltipDiv=f.createElement(b,"div");d.tabIndex=0;d.className="textviewTooltip";d.setAttribute("aria-live","assertive");d.setAttribute("aria-atomic","true");var g=this._tooltipContents=f.createElement(b,"div");d.appendChild(g);b.body.appendChild(d);var a=this;c.addEventListener(d,"mouseover",function(b){a._hideDelay&&(b=a._getWindow(),a._delayedHideTimeout&&(b.clearTimeout(a._delayedHideTimeout),a._delayedHideTimeout=null),a._hideTimeout&&(b.clearTimeout(a._hideTimeout),a._hideTimeout=null),
a._nextTarget=null)},!1);c.addEventListener(d,"mouseout",function(b){b=b.relatedTarget||b.toElement;!(b===d||a._hasFocus())&&(!b||!c.contains(d,b))&&a._hide()},!1);c.addEventListener(d,"keydown",function(b){27===b.keyCode&&a._hide()},!1);c.addEventListener(b,"mousedown",this._mouseDownHandler=function(b){a.isVisible()&&(c.contains(d,b.target||b.srcElement)||a._hide())},!0);this._view.addEventListener("Destroy",function(){a.destroy()});this._hide()}},_getWindow:function(){var b=this._tooltipDiv.ownerDocument;
return b.defaultView||b.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var b=this._tooltipDiv.parentNode;b&&b.removeChild(this._tooltipDiv);c.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var b=this._tooltipDiv;return!b?!1:c.contains(b,b.ownerDocument.activeElement)},hide:function(b){void 0===b&&(b=this._hideDelay);var d=this._getWindow();this._delayedHideTimeout&&(d.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null);var c=this;b?c._delayedHideTimeout=d.setTimeout(function(){c._delayedHideTimeout=null;c._hide();c.setTarget(c._nextTarget,0)},b):(c._hide(),c.setTarget(c._nextTarget,0))},_hide:function(){var b=this._tooltipDiv;b&&(this._hasFocus()&&this._view.focus(),this._contentsView&&(this._contentsView.destroy(),this._contentsView=null),this._tooltipContents&&(this._tooltipContents.innerHTML=""),b.style.visibility="hidden",b=this._getWindow(),this._showTimeout&&(b.clearTimeout(this._showTimeout),
this._showTimeout=null),this._delayedHideTimeout&&(b.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null),this._hideTimeout&&(b.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._fadeTimeout&&(b.clearInterval(this._fadeTimeout),this._fadeTimeout=null))},isVisible:function(){return this._tooltipDiv&&"visible"===this._tooltipDiv.style.visibility},setTarget:function(b,d,c){if(this.isVisible())this._hasFocus()||(this._nextTarget=b,this.hide(c));else if(this._target=b){var a=
this;b=a._getWindow();a._showTimeout&&(b.clearTimeout(a._showTimeout),a._showTimeout=null);0===d?a.show(!0):a._showTimeout=b.setTimeout(function(){a._showTimeout=null;a.show(!0)},d?d:a._showDelay)}},show:function(b){if(this._target){var d=this._target.getTooltipInfo();if(d){var c=this._tooltipDiv,a=this._tooltipContents;c.style.left=c.style.right=c.style.width=c.style.height=a.style.width=a.style.height="auto";var h=d.contents;h instanceof Array&&(h=this._getAnnotationContents(h));if("string"===typeof h)a.innerHTML=
h;else if(this._isNode(h))a.appendChild(h);else if(h instanceof g.ProjectionTextModel){var f=this._view,k=f.getOptions();k.wrapMode=!1;k.parent=a;var q=k.themeClass;q?((q=q.replace("tooltipTheme",""))&&(q=" "+q),q="tooltipTheme"+q):q="tooltipTheme";k.themeClass=q;k=this._contentsView=new n.TextView(k);k.addEventListener("LineStyle",function(a){f.onLineStyle(a)});k.setModel(h);h=k.computeSize();a.style.width=h.width+"px";a.style.height=h.height+"px";k.resize()}else return;a=c.ownerDocument.documentElement;
"right"===d.anchor?(h=a.clientWidth-d.x,c.style.right=h+"px"):(h=parseInt(this._getNodeStyle(c,"padding-left","0"),10),h+=parseInt(this._getNodeStyle(c,"border-left-width","0"),10),h=d.x-h,c.style.left=h+"px");c.style.maxWidth=a.clientWidth-h-10+"px";h=parseInt(this._getNodeStyle(c,"padding-top","0"),10);h+=parseInt(this._getNodeStyle(c,"border-top-width","0"),10);h=d.y-h;c.style.top=h+"px";c.style.maxHeight=a.clientHeight-h-10+"px";c.style.opacity="1";c.style.visibility="visible";if(b){var l=this,
v=this._getWindow();l._hideTimeout=v.setTimeout(function(){l._hideTimeout=null;var a=parseFloat(l._getNodeStyle(c,"opacity","1"));l._fadeTimeout=v.setInterval(function(){"visible"===c.style.visibility&&0<a?(a-=0.1,c.style.opacity=a):l._hide()},l._fadeDelay/10)},l._autoHideDelay)}}}},_getAnnotationContents:function(b){function d(a,b){var d=u.getLineStart(u.getLineAtOffset(a)),c=u.getLineEnd(u.getLineAtOffset(b),!0);return u.getText(d,c)}function m(a){var b=a.title,e=f.createElement(q,"div");e.className=
"tooltipRow";a.html&&(e.innerHTML=a.html,e.lastChild&&c.addEventListener(e.lastChild,"click",function(b){b=a.start;var d=a.end;v.getBaseModel&&(b=v.mapOffset(b,!0),d=v.mapOffset(d,!0));r.setSelection(b,d,1/3,function(){n._hide()})},!1),e.appendChild(q.createTextNode("\u00a0")));b||(b=d(a.start,a.end));"function"===typeof b&&(b=a.title());if("string"===typeof b){var h=f.createElement(q,"span");h.appendChild(q.createTextNode(b));b=h}e.appendChild(b);return e}for(var a,h=[],l=0;l<b.length;l++)a=b[l],
""!==a.title&&!a.groupAnnotation&&h.push(a);b=h;if(0===b.length)return null;var n=this,q=this._tooltipDiv.ownerDocument,r=this._view,v=r.getModel(),u=v.getBaseModel?v.getBaseModel():v;if(1===b.length){a=b[0];if(void 0!==a.title)return a=m(a),a.firstChild&&((b=a.firstChild.className)&&(b+=" "),a.firstChild.className=b+"single"),a;b=new g.ProjectionTextModel(u);h=u.getLineStart(u.getLineAtOffset(a.start));l=u.getCharCount();a.end!==l&&b.addProjection({start:a.end,end:l});0<h&&b.addProjection({start:0,
end:h});return b}h=f.createElement(q,"div");a=f.createElement(q,"em");a.appendChild(q.createTextNode(k.multipleAnnotations));h.appendChild(a);for(l=0;l<b.length;l++)a=b[l],(a=m(a))&&h.appendChild(a);return h},_getNodeStyle:function(b,d,c){var a;if(b&&(a=b.style[d],!a))if(b.currentStyle){for(a=0;-1!==(a=d.indexOf("-",a));)d=d.substring(0,a)+d.substring(a+1,a+2).toUpperCase()+d.substring(a+2);a=b.currentStyle[d]}else a=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(d):null;
return a||c},_isNode:function(b){return"object"===typeof Node?b instanceof Node:b&&"object"===typeof b&&"number"===typeof b.nodeType&&"string"===typeof b.nodeName}};return{Tooltip:b}});
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,n,l,g,c,f){function b(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 e(d){d=d||{};b.call(this,d);this._textViewFactory=d.textViewFactory;this._undoStackFactory=d.undoStackFactory;this._textDNDFactory=d.textDNDFactory;this._annotationFactory=d.annotationFactory;this._foldingRulerFactory=d.foldingRulerFactory;this._lineNumberRulerFactory=d.lineNumberRulerFactory;this._contentAssistFactory=d.contentAssistFactory;this._keyBindingFactory=d.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var d=g.AnnotationType;b.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(b){this.checkDirty()},reportStatus:function(b,a,d){this._statusReporter&&this._statusReporter(b,a,d)},resize:function(){},setDirty:function(b){this._dirty!==b&&(this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"}))},
_setModelText:function(b){this._model&&this._model.setText(b)},setInput:function(b,a,d,c){this._title=b;c||(a?this.reportStatus(a,"error"):null!==d&&void 0!==d&&"string"===typeof d&&this._setModelText(d),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:b,message:a,contents:d,contentsSaved:c})},setText:function(b,a,d){this.getModel().setText(b,a,d)},uninstall:function(){this.installed=!1}};n.EventTarget.addMixin(b.prototype);e.prototype=new b;
c.mixin(e.prototype,{destroy:function(){b.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 d=this._textView;b?d.addRuler(this._annotationRuler,0):d.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b,a){if(this._foldingRulerVisible!==b||a)if(this._foldingRulerVisible=
b,this._foldingRuler){var d=this._textView;d.getModel().getBaseModel&&(b?d.addRuler(this._foldingRuler):d.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(b,a){if(this._lineNumberRulerVisible!==b||a)if(this._lineNumberRulerVisible=b,this._lineNumberRuler){var d=this._textView;b?d.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):d.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b,a){if(this._overviewRulerVisible!==b||a)if(this._overviewRulerVisible=
b,this._overviewRuler){var d=this._textView;b?d.addRuler(this._overviewRuler):d.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var d=this._textView.getModel();d.getBaseModel&&(b=d.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();b.getBaseModel&&(a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end));return a},_expandOffset:function(b){var a=this._textView.getModel(),c=this._annotationModel;if(c&&a.getBaseModel)for(b=c.getAnnotations(b,b+1);b.hasNext();)a=b.next(),a.type===d.ANNOTATION_FOLDING&&a.expand&&a.expand()},setCaretOffset:function(b,a,d){var c=this._textView,e=c.getModel();e.getBaseModel&&(this._expandOffset(b),b=e.mapOffset(b,!0));c.setCaretOffset(b,a,d)},setText:function(b,a,d){var c=this._textView,
e=c.getModel();e.getBaseModel&&(void 0!==a&&(this._expandOffset(a),a=e.mapOffset(a,!0)),void 0!==d&&(this._expandOffset(d),d=e.mapOffset(d,!0)));c.setText(b,a,d)},setSelection:function(b,a,d,c){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=f.mapOffset(b,!0),a=f.mapOffset(a,!0));e.setSelection(b,a,d,c)},moveSelection:function(b,a,d,c){var e=this._textView;this.setSelection(b,a||b,1/3,function(){(void 0===c||c)&&e.focus();d&&d()})},_getTooltipInfo:function(b,
a){var d=this._textView,c=this.getAnnotationModel();if(!c)return null;var e=this._annotationStyler;if(!e)return null;var f=d.getOffsetAtLocation(b,a);if(-1===f)return null;f=this.mapOffset(f);e=e.getAnnotationsByType(c,f,f+1);c=[];for(f=0;f<e.length;f++)e[f].rangeStyle&&c.push(e[f]);if(0===c.length)return null;d=d.convert({x:b,y:a},"document","page");return{contents:c,anchor:"left",x:d.x+10,y:d.y+20}},_highlightCurrentLine:function(b,a){var c=this._annotationModel;if(c){var e=this._textView;if(!e.getOptions("singleMode")){var f=
e.getModel(),g=a?f.getLineAtOffset(a.start):-1,k=f.getLineAtOffset(b.start),e=b.start===b.end,l=!a||a.start===a.end,n=f.getLineStart(k),w=f.getLineEnd(k);f.getBaseModel&&(n=f.mapOffset(n),w=f.mapOffset(w));f=this._currentLineAnnotation;if(!(g===k&&l&&e&&f&&f.start===n&&f.end===w)){var g=f?[f]:null,z;e&&(f=d.createAnnotation(d.ANNOTATION_CURRENT_LINE,n,w),z=[f]);this._currentLineAnnotation=f;c.replaceAnnotations(g,z)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty());this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack));this._contentAssistFactory&&(this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist());var c=this,a=this._textView,e=this;this._listener={onModelChanged:function(a){e.checkDirty()},onMouseOver:function(a){e._listener.onMouseMove(a)},onMouseMove:function(b){var d=
l.Tooltip.getTooltip(a);d&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY)&&(e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY,d.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return e._getTooltipInfo(this.x,this.y)}}))},onMouseOut:function(b){var d=l.Tooltip.getTooltip(a);d&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY)&&(e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY,
d.setTarget(null))},onScroll:function(b){(b=l.Tooltip.getTooltip(a))&&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 f;if(f="function"===typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(c,this._undoStack,this._contentAssist))this._textActions=f.textActions,this._linkedMode=f.linkedMode,this._sourceCodeActions=f.sourceCodeActions}f=function(a,b){if(void 0!==a&&-1!==a){for(var e=this.getView().getModel(),h=this.getAnnotationModel(),f=c.mapOffset(e.getLineStart(a)),
e=c.mapOffset(e.getLineEnd(a)),g=h.getAnnotations(f,e),k=null;g.hasNext();){var q=g.next();if(q.type===d.ANNOTATION_BOOKMARK){k=q;break}}k?h.removeAnnotation(k):(k=d.createAnnotation(d.ANNOTATION_BOOKMARK,f,e),k.title=void 0,h.addAnnotation(k))}};if(this._annotationFactory){var g=a.getModel();g.getBaseModel&&(g=g.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(g))if(g=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))g.addAnnotationType(d.ANNOTATION_CURRENT_SEARCH),
g.addAnnotationType(d.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(d.ANNOTATION_ERROR),g.addAnnotationType(d.ANNOTATION_WARNING),g.addAnnotationType(d.ANNOTATION_MATCHING_BRACKET),g.addAnnotationType(d.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(d.ANNOTATION_CURRENT_LINE),g.addAnnotationType(d.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(d.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType(d.ANNOTATION_SELECTED_LINKED_GROUP),g.addAnnotationType(d.ANNOTATION_CURRENT_LINKED_GROUP),g.addAnnotationType(d.ANNOTATION_LINKED_GROUP),
g.addAnnotationType("orion.annotation.highlightError");var g=this._annotationFactory.createAnnotationRulers(this._annotationModel),k=this._annotationRuler=g.annotationRuler;k&&(k.onDblClick=f,k.setMultiAnnotationOverlay({html:"\x3cdiv class\x3d'annotationHTML overlay'\x3e\x3c/div\x3e"}),k.addAnnotationType(d.ANNOTATION_ERROR),k.addAnnotationType(d.ANNOTATION_WARNING),k.addAnnotationType(d.ANNOTATION_TASK),k.addAnnotationType(d.ANNOTATION_BOOKMARK));this.setAnnotationRulerVisible(this._annotationRulerVisible||
void 0===this._annotationRulerVisible,!0);if(k=this._overviewRuler=g.overviewRuler)k.addAnnotationType(d.ANNOTATION_CURRENT_SEARCH),k.addAnnotationType(d.ANNOTATION_MATCHING_SEARCH),k.addAnnotationType(d.ANNOTATION_READ_OCCURRENCE),k.addAnnotationType(d.ANNOTATION_WRITE_OCCURRENCE),k.addAnnotationType(d.ANNOTATION_CURRENT_BLAME),k.addAnnotationType(d.ANNOTATION_ERROR),k.addAnnotationType(d.ANNOTATION_WARNING),k.addAnnotationType(d.ANNOTATION_TASK),k.addAnnotationType(d.ANNOTATION_BOOKMARK),k.addAnnotationType(d.ANNOTATION_MATCHING_BRACKET),
k.addAnnotationType(d.ANNOTATION_CURRENT_BRACKET),k.addAnnotationType(d.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(d.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(d.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=f,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
void 0===this._lineNumberRulerVisible,!0));this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(d.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));this.dispatchEvent({type:"TextViewInstalled",textView:a});b.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var d=this._textView;d&&(d.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:d}),b.prototype.uninstall.call(this))},_updateCursorStatus:function(){for(var b=
this.getModel(),a=this.getCaretOffset(),d=b.getLineAtOffset(a),b=b.getLineStart(d),a=a-b,b=this.getKeyModes(),c=0;c<b.length;c++){var e=b[c];if(e.isActive()&&e.isStatusActive&&e.isStatusActive())return}this.reportStatus(f.formatMessage(k.lineColumn,d+1,a+1))},showAnnotations:function(b,a,c,e){var f=this._annotationModel;if(f){for(var g=[],k=[],l=f.getTextModel(),n=f.getAnnotations(),w;n.hasNext();)w=n.next(),-1!==a.indexOf(w.type)&&w.creatorID===this&&g.push(w);if(b)for(a=0;a<b.length;a++)if(w=b[a]){if(c)w=
c(w);else{var z;"number"===typeof w.line?(z=l.getLineStart(w.line-1),n=z+w.start-1,z=z+w.end-1):(n=w.start,z=w.end);var y=e(w);if(!y)continue;w=d.createAnnotation(y,n,z,w.description)}w.creatorID=this;k.push(w)}f.replaceAnnotations(g,k)}},showProblems:function(b){this.showAnnotations(b,[d.ANNOTATION_ERROR,d.ANNOTATION_WARNING,d.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return d.ANNOTATION_ERROR;case "warning":return d.ANNOTATION_WARNING;case "task":return d.ANNOTATION_TASK}return null})},
showOccurrences:function(b){this.showAnnotations(b,[d.ANNOTATION_READ_OCCURRENCE,d.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?d.ANNOTATION_READ_OCCURRENCE:d.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(b){var a=this._blameRGB,e=this.getTextView().getOptions("parent").ownerDocument;if(!a){var l=f.createElement(e,"div");l.className="annotation blame";e.body.appendChild(l);var n=(e.defaultView||e.parentWindow).getComputedStyle(l).getPropertyValue("background-color");l.parentNode.removeChild(l);
var l=n.indexOf("("),q=n.indexOf(")"),n=n.substring(l+1,q);this._blameRGB=a=n.split(",").slice(0,3)}var r=function(){var a=g.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},v=function(){var a=f.createElement(e,"div");a.className="tooltipTitle";var b=this.blame.Message.indexOf("\n");
-1===b&&(b=this.blame.Message.length);var d=f.createElement(e,"a");d.href=this.blame.CommitLink;d.appendChild(e.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(d);a.appendChild(f.createElement(e,"br"));a.appendChild(e.createTextNode(f.formatMessage(k.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},u=this.getModel();this.showAnnotations(b,[d.ANNOTATION_BLAME,d.ANNOTATION_CURRENT_BLAME],function(b){var e=u.getLineStart(b.Start-1),h=u.getLineEnd(b.End-1,!0),e=g.AnnotationType.createAnnotation(d.ANNOTATION_BLAME,
e,h,v),h=a.slice(0);h.push(b.Shade);e.style=c.mixin({},e.style);e.style.style=c.mixin({},e.style.style);e.style.style.backgroundColor="rgba("+h.join()+")";e.groupId=b.Name;e.groupType=d.ANNOTATION_CURRENT_BLAME;e.createGroupAnnotation=r;e.html='\x3cimg class\x3d"annotationHTML blame" src\x3d"'+b.AuthorImage+'"/\x3e';e.blame=b;return e})},showSelection:function(b,a,d,c,e){"number"===typeof b?("number"!==typeof a&&(a=b),this.moveSelection(b,a)):"number"===typeof d&&(b=this.getModel().getLineStart(d-
1),"number"===typeof c&&(b+=c),"number"!==typeof e&&(e=0),this.moveSelection(b,b+e))},_setModelText:function(b){this._textView&&(this._textView.setText(b),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(d,a,c,e,f){b.prototype.setInput.call(this,d,a,c,e);this._textView&&!e&&!f&&this._textView.focus()},onGotoLine:function(b,a,d,c){if(this._textView){var e=this.getModel();b=Math.max(0,Math.min(b,e.getLineCount()-1));var f=
e.getLineStart(b),g=0;void 0===d&&(d=0);"string"===typeof a?(b=e.getLine(b).indexOf(a),-1!==b&&(g=b,d=g+a.length)):(g=a,a=e.getLineEnd(b)-f,g=Math.min(g,a),d=Math.min(d,a));this.moveSelection(f+g,f+d,c)}}});return{BaseEditor:b,Editor:e}});
define("orion/markdownView","marked/marked orion/editor/editor orion/objects orion/webui/littlelib orion/URITemplate orion/section orion/URL-shim".split(" "),function(k,n,l,g,c,f){function b(a,b,d,c){return function(e,f){if(-1===f.href.indexOf(":"))try{var g;"filesystem:"===b.protocol?g={href:"filesystem:"+(new URL(f.href,b.pathname)).href}:(g=new URL(f.href,b),c&&(g.protocol="",g.host=""));if("!"!==e[0][0])f.href=h.expand({resource:g.href});else{if(d.readBlob){var k="_md_img_"+t++;d.readBlob(g.href).then(function(a){var b=
g.href.match(s);a=URL.createObjectURL(new Blob([a],{type:b?"image/"+b[1]:"image/png"}));document.getElementById(k).src=a;URL.revokeObjectURL(a)});return"\x3cimg id\x3d'"+k+"' src\x3d''\x3e"}f.href=g.href}}catch(m){console.log(m)}return a.call(this,e,f)}}function e(a,d,c){var e=k.InlineLexer.prototype.outputLink,h=new URL(d,window.location.href);k.InlineLexer.prototype.outputLink=b(e,h,c,-1===d.indexOf(":"));a=k(a,{sanitize:!0});k.InlineLexer.prototype.outputLink=e;return a}function d(a){this.fileClient=
a.fileClient;this.progress=a.progress;this.canHide=a.canHide;this._node=null}function m(a){this.id="orion.viewer.markdown";this.fileClient=a.fileClient;this.metadata=a.metadata;q.apply(this,arguments)}function a(a){this._parent=a.parent;this.fileClient=a.fileService;this.metadata=a.metadata;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progressService;this.model=a.model;this.undoStack=a.undoStack}var h=
new c("#{,resource,params*}"),s=/\.([0-9a-z]+)(?:[\?#]|$)/i,t=0;d.prototype={display:function(a,b,d,c){a.classList.add("orionMarkdown");a.innerHTML=e(b,d,c)},displayContents:function(a,b){var d=b.Location||b;g.empty(a);var c=document.createElement("div");(this.progress?this.progress.progress(this.fileClient.read(d),"Reading file "+(b.Name||d)):this.fileClient.read(d)).then(function(a){this.display.bind(this)(c,a,d,this.fileClient)}.bind(this));a.appendChild(c)},displayInFrame:function(a,b,d,c,e){a=
new f.Section(a,{id:"markdownSection",title:b.Name||e||"readme",headerClass:d,canHide:this.canHide});c&&(d=a.getTitleElement())&&d.classList.add(c);this.displayContents.call(this,a.getContentElement(),b)}};var q=n.BaseEditor;m.prototype=Object.create(q.prototype);l.mixin(m.prototype,{createMarked:function(a){return e(a,this.metadata.Location,this.fileClient)},install:function(){var a=this._rootDiv=document.createElement("div");a.style.width="100%";a.style.height="100%";var b=this._contentDiv=document.createElement("div");
b.classList.add("orionMarkdown");a.appendChild(b);g.node(this._domNode).appendChild(a);this._contentDiv.innerHTML=this.createMarked(this.getModel().getText());q.prototype.install.call(this)},setInput:function(a,b,d,c){q.prototype.setInput.call(this,a,b,d,c);!b&&!c&&(this._contentDiv.innerHTML=this.createMarked(d))},uninstall:function(){g.empty(this._domNode);q.prototype.uninstall.call(this)}});a.prototype={create:function(){this.editor=new m({domNode:this._parent,fileClient:this.fileClient,metadata:this.metadata,
model:this.model,undoStack:this.undoStack});this.editor.install()},destroy:function(){this.editor&&this.editor.destroy();this.editor=null}};return{MarkdownEditorView:a,MarkdownView:d}});
define("orion/projects/projectEditor","orion/URITemplate orion/webui/littlelib orion/Deferred orion/objects orion/projectCommands orion/commandRegistry orion/PageLinks orion/explorers/explorer orion/section".split(" "),function(k,n,l,g,c,f,b,e,d){function m(a){this.root=a}function a(a,b,d){this._init(a);this.projectEditor=b;this.explorer=d}function h(a){this.root=a}function s(a,b,d){this._init(a);this.projectEditor=b;this.explorer=d}function t(a,b){this.root=a;this.projectClient=b}function q(a,b,
d){this._init(a);this.projectEditor=b;this.explorer=d;this.commandService=a.commandRegistry;this.actionScopeId=a.actionScopeId}function r(a,b,d){this.root=a;this.launchConfigurations=b;this.projectClient=d}function v(a,b,d){this._init(a);this.projectEditor=b;this.explorer=d;this.commandService=a.commandRegistry;this.actionScopeId=a.actionScopeId;this.projectClient=a.projectClient}function u(a,b,d,c,h){e.Explorer.apply(this,arguments);this.actionScopeId=h;this.selectionActions="LaunchConfigurationExplorerSelectionActions";
this.actionsSections=[this.selectionActions]}function w(a){this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.progress=a.progress;this.preferences=a.preferences;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.commandRegistry=a.commandRegistry;this._node=null;this.dependencyActions="dependencyActions";this.launchConfigurationActions="launchConfigurationsActions";this.createCommands()}var z=new k("./edit.html#{,resource,params*}");m.prototype=new e.ExplorerModel;
m.prototype.constructor=m;m.prototype.getRoot=function(a){return a(this.root)};m.prototype.getChildren=function(a,b){a===this.root?b([{id:"Name",displayName:"Name",value:a.Name,no:1},{id:"Description",displayName:"Description",value:a.Description,no:2},{id:"Url",displayName:"Site",value:a.Url,href:a.Url,no:3}]):b([])};m.prototype.getId=function(a){return"ProjectInfo"+a.id};a.prototype=new e.SelectionRenderer;a.prototype.constructor=a;a.prototype.getCellHeaderElement=function(a){};a.prototype.getCellElement=
function(a,b,d){if(0===a)return a=document.createElement("td"),d=document.createElement("span"),d.className="discreetInputLabel",d.appendChild(document.createTextNode(b.displayName)),a.classList.add("discreetInputLabel"),a.appendChild(d),a.width="20%",a;if(1===a){if(b.href){a=document.createElement("td");a.style.verticalAlign="top";var c=document.createElement("input");c.style.visibility="hidden";var e=document.createElement("div");e.style.marginTop="-15px";e.title="Click to edit";e.className="discreetInput";
e.tabIndex=b.no;var h=document.createElement("a");h.href=b.value||"";h.appendChild(document.createTextNode(b.value||""));h.tabIndex=b.no+1;e.appendChild(h);e.title="Click to edit";e.onclick=function(a){e.style.visibility="hidden";h.style.visibility="hidden";c.style.visibility="";c.focus()}.bind(this.projectEditor);e.onfocus=e.onclick;e.onkeyup=function(a){if(a.keyCode===n.KEY.ENTER)e.onclick(a)}.bind(this.projectEditor);h.urlSelector=e;this.projectEditor._renderEditableFields(c,b.id,b.no,h);a.appendChild(c);
a.appendChild(e);return a}a=document.createElement("td");a.style.verticalAlign="top";d="Description"===b.id?document.createElement("textArea"):document.createElement("input");this.projectEditor._renderEditableFields(d,b.id,b.no,null);a.appendChild(d);return a}};h.prototype=new e.ExplorerModel;h.prototype.constructor=h;h.prototype.getRoot=function(a){return a(this.root)};h.prototype.getChildren=function(a,b){if(a===this.root){for(var d=0;d<a.Children.length;d++)a.Children[d].parent=a;b(a.Children)}else b([])};
h.prototype.getId=function(a){return"AdditionalInfo"+e.ExplorerModel.prototype.getId.call(this,{Location:a.parent.Name+a.Name})};s.prototype=new e.SelectionRenderer;s.prototype.constructor=s;s.prototype.getCellHeaderElement=function(a){if(0===a)return a=document.createElement("td"),a.colSpan=2,a.appendChild(document.createTextNode(this.explorer.model.root.Name)),a};s.prototype.getCellElement=function(a,d,c){if(0===a)return a=document.createElement("td"),c=document.createElement("span"),c.className=
"discreetInputLabel",c.appendChild(document.createTextNode(d.Name)),a.classList.add("discreetInputLabel"),a.appendChild(c),a.width="20%",a;if(1===a){a=document.createElement("td");if(d.Href){c=document.createElement("a");var e=new k(d.Href);c.href=e.expand({OrionHome:b.getOrionHome()});c.appendChild(document.createTextNode(d.Value||" "));a.appendChild(c)}else a.appendChild(document.createTextNode(d.Value||" "));return a}};t.prototype=new e.ExplorerModel;t.prototype.constructor=t;t.prototype.getRoot=
function(a){return a(this.root)};t.prototype.getChildren=function(a,b){if(a===this.root){var d=[];l.all((a.Dependencies||[]).map(function(b){var c={Dependency:b,Project:a};d.push(c);return this.projectClient.getDependencyFileMetadata(b,a.WorkspaceLocation).then(function(a){g.mixin(c,a)},function(a){c.Directory=c.disconnected=!0})}.bind(this))).then(function(){b(d)}.bind(this))}else b([])};t.prototype.getId=function(a){return e.ExplorerModel.prototype.getId.call(this,a.Dependency)};q.prototype=new e.SelectionRenderer;
q.prototype.constructor=q;q.prototype.getCellHeaderElement=function(a){};q.prototype.getCellElement=function(a,b,d){if(0===a)return a=document.createElement("td"),b.Location?(a.className="navColumnNoIcon",d=document.createElement("a"),d.href=z.expand({resource:b.Location}),d.appendChild(document.createTextNode(b.Dependency.Name)),a.appendChild(d)):(d=b.Dependency.Name,b.disconnected&&(d+=" (disconnected)"),a.appendChild(document.createTextNode(d))),a;if(1===a)return b=this.getActionsColumn(b,d,null,
null,!0),b.style.textAlign="right",b};r.prototype=new e.ExplorerModel;r.prototype.constructor=r;r.prototype.getRoot=function(a){return a(this.root)};r.prototype.getChildren=function(a,b){if(a===this.root)if(this.launchConfigurations){for(var d=0;d<this.launchConfigurations.length;d++)this.launchConfigurations[d].project=a;this.root.children=this.launchConfigurations;b(this.launchConfigurations)}else this.projectClient.getProjectLaunchConfigurations(a).then(function(d){for(var c=0;c<d.length;c++)d[c].project=
a;a.children=d;b(d)});else b([])};r.prototype.getId=function(a){return"LaunchConfiguration"+e.ExplorerModel.prototype.getId.call(this,{Location:a.Name})};v.prototype=new e.SelectionRenderer;v.prototype.constructor=v;v.prototype.getCellHeaderElement=function(a){};v.prototype.getCellElement=function(a,d,c){if(0===a){var e=document.createElement("td");d.Name&&(e.className="secondaryColumnLeft",e.appendChild(document.createTextNode(d.Name)));return e}if(1===a){e=document.createElement("td");if(d.Url){var h=
document.createElement("a");h.target="_new";h.href=0>d.Url.indexOf("://")?"http://"+d.Url:d.Url;h.title=d.Url;h.appendChild(document.createTextNode(d.UrlTitle||d.Params.Name||"View App"));e.appendChild(h)}return e}if(2===a)return e=document.createElement("td"),d.ServiceId&&this.projectClient.getProjectDelpoyService(d.ServiceId,d.Type).then(function(a){if(a)if(a.getLogLocationTemplate)a.getLogLocationTemplate(d).then(function(a){if(a){var c=document.createElement("a");c.target="_new";a=new k(a);var h=
g.clone(d.Params);g.mixin(h,{OrionHome:b.getOrionHome()});c.href=a.expand(h);c.appendChild(document.createTextNode("Logs"));e.appendChild(c)}});else if(a.logLocationTemplate){var c=document.createElement("a");c.target="_new";a=new k(a.logLocationTemplate);var h=g.clone(d.Params);g.mixin(h,{OrionHome:b.getOrionHome()});c.href=a.expand(h);c.appendChild(document.createTextNode("Logs"));e.appendChild(c)}}),e;if(3===a){e=document.createElement("td");e.classList.add("secondaryColumnRight");if(d.status&&
!0===d.status.CheckState)delete d.status;else if(d.status){if(d.status.error&&d.status.error.Retry)return d.parametersRequested=d.status.error.Retry.parameters,d.optionalParameters=d.status.error.Retry.optionalParameters,this.getActionsColumn(d,c,null,"secondaryColumnRight",!0);d.status.error?(h=document.createElement("span"),h.appendChild(document.createTextNode("Error")),h.title=d.status.error.Message):"STARTED"===d.status.State?(h=document.createElement("span"),h.className="imageSprite core-sprite-applicationrunning",
h.title=d.status.Message||"Started"):"STOPPED"===d.status.State?(h=document.createElement("span"),h.className="imageSprite core-sprite-applicationstopped",h.title=d.status.Message||"Stopped"):"NOT_DEPLOYED"===d.status.State?(h=document.createElement("span"),h.className="imageSprite core-sprite-applicationnotdeployed",h.title=d.status.Message||"Not deployed"):"PROGRESS"===d.status.State?(h=document.createElement("span"),h.className="imageSprite core-sprite-progress",h.title="Checking application state"):
(h=document.createElement("span"),h.appendChild(document.createTextNode("State unknown")),h.title=d.status.Message);e.appendChild(h);return e}d.ServiceId&&this.projectClient.getProjectDelpoyService(d.ServiceId,d.Type).then(function(b){b&&b.getState?(d.status={State:"PROGRESS"},e.innerHTML=this.getCellElement(a,d,c).innerHTML,b.getState(d.Params).then(function(b){d.status=b;var h=this.getCellElement(a,d,c);for(b=0;b<e.classList.length;b++)h.classList.toggle(e.classList[b],!0);var f=e.previousSibling;
c.replaceChild(h,e);h=this.getCellElement(a-1,d,c);for(b=0;b<f.classList.length;b++)h.classList.toggle(f.classList[b],!0);c.replaceChild(h,f)}.bind(this),function(b){d.status={error:b};var h=this.getCellElement(a,d,c);for(b=0;b<e.classList.length;b++)h.classList.toggle(e.classList[b],!0);var f=e.previousSibling;c.replaceChild(h,e);h=this.getCellElement(a-1,d,c);for(b=0;b<f.classList.length;b++)h.classList.toggle(f.classList[b],!0);c.replaceChild(h,f)}.bind(this))):e.appendChild(document.createTextNode("State unknown"))}.bind(this));
return e}};u.prototype=Object.create(e.Explorer.prototype);g.mixin(u.prototype,{registerCommands:function(){this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.manage",1);this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.deploy",2);this.commandService.registerCommandContribution(this.selectionActions,"orion.launchConfiguration.startApp",3);this.commandService.registerCommandContribution(this.selectionActions,
"orion.launchConfiguration.stopApp",4)},updateCommands:function(a){this.selectionActionsNode=n.node(this.selectionActions);n.empty(this.selectionActionsNode);this.commandService.renderCommands(this.selectionActions,this.selectionActionsNode,a,this,"tool");n.$$array(".commandLink",this.selectionActionsNode).forEach(function(a,b){a.target="_new"})},load:function(a,b,d,c){this.createTree(a,new r(b,d,c),{indent:"8px"});this.loaded()},constructor:u});w.prototype={createCommands:function(){this.launchConfigurationDispatcher=
c.getLaunchConfigurationDispatcher();this.dependenciesDisplatcher=c.getDependencyDispatcher();var a=this;this.launchConfigurationListener=function(b){a.launchConfigurationChanged.call(a,b)};this._launchConfigurationEventTypes=["create","delete","changeState"];this._launchConfigurationEventTypes.forEach(function(b){a.launchConfigurationDispatcher.addEventListener(b,a.launchConfigurationListener)});this.dependneciesListener=function(b){a.dependenciesChanged.call(a,b)};this._dependenciesEventTypes=["create",
"delete"];this._dependenciesEventTypes.forEach(function(b){a.dependenciesDisplatcher.addEventListener(b,a.dependneciesListener)});this.commandRegistry.registerCommandContribution(this.dependencyActions,"orion.project.dependency.connect",1);this.commandRegistry.registerCommandContribution(this.dependencyActions,"orion.project.dependency.disconnect",2);this.commandRegistry.registerCommandContribution(this.launchConfigurationActions,"orion.launchConfiguration.checkStatus",1)},changedItem:function(a){this.fileClient.read(this.parentFolder.Location,
!0).then(function(a){n.empty(this.node);this.displayContents(this.node,a)}.bind(this))},display:function(a,b){function d(a,b){b=b||{};a.forEach(function(a){var d;switch(a){case "projectInfo":d=document.createElement("span");this.node.appendChild(d);this.renderProjectInfo(d,b[a]);break;case "additionalInfo":d=document.createElement("span");this.node.appendChild(d);this.renderAdditionalProjectProperties(d);break;case "deployment":d=document.createElement("span");this.node.appendChild(d);this.renderLaunchConfigurations(d,
null,b[a]);break;case "dependencies":d=document.createElement("span"),d.id="projectDependenciesNode",this.node.appendChild(d),this.renderDependencies(d,b[a])}}.bind(this))}this.node=a;this.node.className="orionProject";this.projectData=b;var c=["projectInfo","additionalInfo","deployment","dependencies"];this.preferences.getPreferences("/sectionsOrder").then(function(a){c=a.get("projectView")||c;a=a.get("projectViewNames")||[];d.apply(this,[c,a])}.bind(this),function(a){d.apply(this,[c,{}]);window.console.error(a)}.bind(this))},
displayContents:function(a,b){this.parentFolder=b;this.projectClient.readProject(b).then(function(b){this.display.bind(this)(a,b)}.bind(this))},dependenciesChanged:function(a){var b=n.node("projectDependenciesNode");if(b){if(a.project.ContentLocation===this.projectData.ContentLocation)if("delete"===a.type){if(this.projectData.Dependencies&&a.oldValue)for(var d=0;d<this.projectData.Dependencies.length;d++)this.projectData.Dependencies[d].Location===a.oldValue.Location&&this.projectData.Dependencies.splice(d,
1)}else"create"===a.type&&this.projectData.Dependencies&&a.newValue&&this.projectData.Dependencies.push(a.newValue);n.empty(b);this.renderDependencies(b,this.dependenciesSectionName)}},_renderEditableFields:function(a,b,d,c){var e=function(d){var e={};e[b]=d.target.value;this.progress.progress(this.projectClient.changeProjectProperties(this.projectData,e),"Saving project "+this.projectData.Name).then(function(b){b&&(this.projectData=b,a.value=d.target.value,c&&(n.empty(c),c.appendChild(document.createTextNode(d.target.value)||
""),c.href=d.target.value,c.style.visibility="",c.urlSelector&&(c.urlSelector.style.visibility=""),a.style.visibility="hidden"))}.bind(this))}.bind(this);a.value=this.projectData[b]||"";a.title="Click to edit";a.className="discreetInput";a.tabIndex=String(d);a.onkeyup=function(d){d.keyCode===n.KEY.ENTER?"TEXTAREA"!==a.tagName.toUpperCase()&&a.blur():d.keyCode===n.KEY.ESCAPE&&(a.value=this.projectData[b]||"",a.blur())}.bind(this);a.onblur=function(a){e(a)}},renderProjectInfo:function(b,c){var h=new d.Section(b,
{id:"projectInfoSection",headerClass:["sectionTreeTableHeader"],title:c||"Project Information",canHide:!0}),f=document.createElement("div");f.id="projectInformationNode";var g=new a({checkbox:!1,treeTableClass:"sectionTreeTable",cachePrefix:"ProjectInfoExplorer"},this),g=new e.Explorer(this.serviceRegistry,null,g,this.commandRegistry);h.embedExplorer(g,f);g.createTree(f,new m(this.projectData),{noSelection:!0})},renderAdditionalProjectProperties:function(a){this.projectClient.getMatchingProjectHandlers(this.parentFolder).then(function(b){for(var c=
0;c<b.length;c++){var f=b[c];f&&f.getAdditionalProjectProperties&&this.progress.progress(f.getAdditionalProjectProperties(this.parentFolder,this.projectData),"Getting additional project information").then(function(b){if(b&&b.length&&0!==b.length)for(var c=0;c<b.length;c++){var f=b[c];if(f.Name){var g=new d.Section(a,{id:f.Name+"Section",headerClass:["sectionTreeTableHeader"],title:f.Name,canHide:!0}),k=document.createElement("div"),m=new s({treeTableClass:"sectionTreeTable",checkbox:!1},this),m=new e.Explorer(this.serviceRegistry,
null,m,this.commandRegistry);g.embedExplorer(m,k);m.createTree(k,new h(f),{noSelection:!0})}}}.bind(this))}}.bind(this))},renderDependencies:function(a,b){if(this.projectData.Dependencies&&0!==this.projectData.Dependencies.length){this.dependenciesSectionName=b||"Associated Content";var c=new d.Section(a,{id:"projectDependenciesSection",headerClass:["sectionTreeTableHeader"],title:this.dependenciesSectionName,canHide:!0}),h=document.createElement("div");h.id="dependenciesNode";var f=new q({checkbox:!1,
treeTableClass:"sectionTreeTable",commandRegistry:this.commandRegistry,actionScopeId:this.dependencyActions},this),f=new e.Explorer(this.serviceRegistry,null,f,this.commandRegistry);f.actionScopeId=this.dependencyActions;c.embedExplorer(f,h);f.createTree(h,new t(this.projectData,this.projectClient),{indent:"8px",noSelection:!0})}},renderLaunchConfigurations:function(a,b,c){this.configurationsParent=a;if(b){n.empty(this.configurationsParent);this.launchCofunctionSectionsTitle=c||"Deployment Information";
var e=new d.Section(a,{id:"projectLaunchConfigurationSection",headerClass:["sectionTreeTableHeader"],title:this.launchCofunctionSectionsTitle,canHide:!0}),h=document.createElement("div");h.id="launchConfigurationsNode";var f=new v({checkbox:!1,treeTableClass:"sectionTreeTable",commandRegistry:this.commandRegistry,actionScopeId:this.launchConfigurationActions,projectClient:this.projectClient},this),f=new u(this.serviceRegistry,null,f,this.commandRegistry,this.launchConfigurationActions);e.embedExplorer(f,
h);f.load(h,this.projectData,b,this.projectClient)}else this.projectClient.getProjectLaunchConfigurations(this.projectData).then(function(b){(this.configurations=b)&&0!==b.length&&this.renderLaunchConfigurations(a,b,c)}.bind(this))},launchConfigurationChanged:function(a){if(this.configurations&&("create"===a.type||"changeState"===a.type)&&a.newValue){for(var b=0;b<this.configurations.length;b++){var d=this.configurations[b];if(d.Name===a.newValue.Name&&d.ServiceId===a.newValue.ServiceId){this.configurations[b]=
a.newValue;this.renderLaunchConfigurations(this.configurationsParent,this.configurations,this.launchCofunctionSectionsTitle);return}}"create"===a.type&&(this.configurations.push(a.newValue),this.renderLaunchConfigurations(this.configurationsParent,this.configurations,this.launchCofunctionSectionsTitle))}},destroy:function(){var a=this;this._launchConfigurationEventTypes.forEach(function(b){a.launchConfigurationDispatcher.removeEventListener(b,a.launchConfigurationListener)});this._dependenciesEventTypes.forEach(function(b){a.dependenciesDisplatcher.removeEventListener(b,
a.dependneciesListener)})}};return{ProjectEditor:w}});
define("orion/projects/projectExplorer","i18n!orion/edit/nls/messages orion/Deferred orion/URITemplate orion/webui/littlelib orion/explorers/explorer orion/section".split(" "),function(k,n,l,g,c,f){function b(a){this._init(a)}function e(a,d,c,e){this.registry=d;this.selection=c;this.commandRegistry=e;this.parentId=a;this.renderer=new b({});this.renderer.explorer=this;this.myTree=null;this.newActionsScope=m;this.actionsSections=[this.newActionsScope];this._init()}var d=new l("../edit/edit.html#{,resource,params*}"),
m="newProjectActions";b.prototype=new c.SelectionRenderer;b.prototype.getCellHeaderElement=function(){return null};b.prototype.emptyCallback=function(a){var b=document.createElement("tr"),d=document.createElement("td");d.colSpan=this.oneColumn?1:3;var c=document.createElement("div");c.classList.add("noFile");c.textContent=k.NoProjects;var e=document.createElement("span");e.appendChild(document.createTextNode(k.File));g.processDOMNodes(c,[e]);d.appendChild(c);b.appendChild(d);a.appendChild(b)};b.prototype.getCellElement=
function(a,b,c){c=document.createElement("td");switch(a){case 0:return c.className="navColumnNoIcon",a=document.createElement("a"),a.appendChild(document.createTextNode(b.Name)),a.href=d.expand({resource:b.ContentLocation}),c.appendChild(a),c;case 1:return c.appendChild(document.createTextNode(!b.Description?" ":200<b.Description.length?b.Description.substring(0,180)+"...":b.Description)),c;case 2:return b.Url?(a=document.createElement("a"),a.appendChild(document.createTextNode(b.Url)),a.href=b.Url,
c.appendChild(a)):c.appendChild(document.createTextNode(" ")),c}return null};e.prototype=Object.create(c.Explorer.prototype);e.prototype._init=function(){var a=new f.Section(g.node(this.parentId),{id:"projectsSection",title:"Projects",canHide:!0}),b=document.createElement("div");b.id="projectsExplorer";a.embedExplorer(this,b)};e.prototype.loadProjects=function(a){this.model=new c.SimpleFlatModel(a,"orion.project.",function(a){if(a.ContentLocation)return a.ContentLocation.replace(/[\\\/]/g,"")});this.myTree=
this.createTree(this.parent,this.model,{indent:"8px",selectionPolicy:this.renderer.selectionPolicy});this.updateCommands()};return{ProjectExplorer:e,newActionsScope:m}});
define("orion/projects/projectView",["orion/projects/projectExplorer","orion/selection","orion/URITemplate","orion/webui/littlelib","orion/fileCommands"],function(k,n,l,g,c){function f(b){this.progress=b.progress;this.fileClient=b.fileClient;this.serviceRegistry=b.serviceRegistry;this.commandRegistry=b.commandRegistry;this.projectClient=this.serviceRegistry.getService("orion.project.client");this.modelEventDispatcher=c.getModelEventDispatcher();var d=this;this.modelListener=function(b){d.changedItemEvent.call(d,
b)};this._eventTypes=["copy","create","delete","import","move"];this._eventTypes.forEach(function(b){d.modelEventDispatcher.addEventListener(b,d.modelListener)})}var b=new l("#{,resource,params*}");f.prototype={display:function(b,d){d.classList.add("orionProject");this.projectExplorer=new k.ProjectExplorer(d,this.serviceRegistry,new n.Selection(this.serviceRegistry),this.commandRegistry);this.changedItem(b)},setCommandsVisible:function(b){this.projectExplorer&&this.projectExplorer.setCommandsVisible.call(this.projectExplorer,
b)},changedItemEvent:function(b){b.parent&&this.workspace&&b.parent.Location===this.workspace.Location&&this.projects&&this._handleChangedEvent(b.oldValue,b.newValue)},_handleChangedEvent:function(b,d){var c=this;if(b&&b.ContentLocation&&!b.Children&&!b.ChildrenLocation)this.fileClient.loadWorkspace(b.ContentLocation).then(function(a){c._handleChangedEvent(a,d)});else if(d&&d.ContentLocation&&!d.Children&&!d.ChildrenLocation)this.fileClient.loadWorkspace(d.ContentLocation).then(function(a){c._handleChangedEvent(b,
a)});else if(d)this.projectClient.readProject(d,this.workspace).then(function(a){if(b)for(var d=0;d<c.projects.length;d++){if(b.Location===c.projects[d].ContentLocation){a?c.projects[d]=a:c.projects.splice(d,1);c.projectExplorer.loadProjects(c.projects);break}}else a&&(c.projects.push(a),c.projectExplorer.loadProjects(c.projects))});else if(b)for(var a=0;a<c.projects.length;a++)if(b.Location===c.projects[a].ContentLocation){c.projects.splice(a,1);c.projectExplorer.loadProjects(c.projects);break}},
changedItem:function(c,d,f){var a=this;"created"===f&&c.ContentLocation?window.location=b.expand({resource:c.ContentLocation}):c?a.progress.progress(a.projectClient.readAllProjects(c),"Listing projects").then(function(b){a.workspace=c;a.projects=b;a.projectExplorer.loadProjects(b)}):a.progress.progress(a.fileClient.loadWorkspace(),"Getting workspace information").then(function(b){a.progress.progress(a.projectClient.readAllProjects(c),"Listing projects").then(function(d){a.workspace=b;a.projects=d;
a.projectExplorer.loadProjects(d)})})},destroy:function(){var b=this;this._eventTypes.forEach(function(d){b.modelEventDispatcher.removeEventListener(d,b.modelListener)})}};return{ProjectView:f}});
define("orion/folderView","i18n!orion/edit/nls/messages orion/globalCommands orion/explorers/explorer-table orion/explorers/navigatorRenderer orion/selection orion/fileCommands orion/markdownView orion/projects/projectEditor orion/PageUtil orion/URITemplate orion/webui/littlelib orion/objects orion/Deferred orion/projects/projectView orion/section".split(" "),function(k,n,l,g,c,f,b,e,d,m,a,h,s,t,q){function r(){z.apply(this,arguments)}function v(b){b.setFocus=!1;b.cachePrefix=null;b.dragAndDrop=f.uploadFile;
b.modelEventDispatcher=f.getModelEventDispatcher();b.rendererFactory=function(a){return new r({checkbox:!1,treeTableClass:"sectionTreeTable",cachePrefix:"FolderNavigator"},a,b.commandRegistry,b.contentTypeRegistry)};w.apply(this,arguments);this.menuBar=b.menuBar;this.serviceRegistry=b.serviceRegistry;this.fileClient=b.fileClient;this.commandRegistry=b.commandRegistry;this.contentTypeRegistry=b.contentTypeRegistry;this.editorInputManager=b.editorInputManager;this.readonly=b.readonly;this.breadCrumbMaker=
b.breadCrumbMaker;this.clickHandler=b.clickHandler;this.treeRoot={};this.parent=a.node(b.parentId)}function u(a){this._parent=a.parent;this._metadata=a.metadata;this.menuBar=a.menuBar;this.fileClient=a.fileService;this.progress=a.progressService;this.serviceRegistry=a.serviceRegistry;this.commandRegistry=a.commandRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.editorInputManager=a.inputManager;this.preferences=a.preferences;this.readonly=void 0===a.readonly?!1:a.readonly;this.showProjectView=
void 0===a.showProjectView?!0:a.showProjectView;this.showFolderNav=!0;this.editorView=a.editorView;this._maxEditorHeight=a.maxEditorHeight;this.imageView=a.imageView;this.breadCrumbMaker=a.breadCrumbMaker;this.clickHandler=a.clickHandler;this._init()}var w=l.FileExplorer,z=g.NavigatorRenderer,y=new m("#{,resource,params*}");r.prototype=Object.create(z.prototype);h.mixin(r.prototype,{showFolderImage:!0,createFolderNode:function(a){var b=g.NavigatorRenderer.prototype.createFolderNode.call(this,a);this.showFolderLinks&&
"A"===b.tagName&&(b.href=y.expand({resource:a.Location}));b.classList.add("folderNavFolder");b.classList.add("navlink");b.classList.add("targetSelector");b.classList.remove("navlinkonpage");this.explorer.readonly&&this.explorer.clickHandler&&(b.href="javascript:void(0)",b.addEventListener("click",function(){this.explorer.clickHandler(a.Location)}.bind(this),!1));return b},updateFileNode:function(a,b,d){g.NavigatorRenderer.prototype.updateFileNode.call(this,a,b,d);this.explorer.readonly&&"A"===b.tagName&&
(this.explorer.clickHandler?(b.href="javascript:void(0)",b.addEventListener("click",function(){this.explorer.clickHandler(a.Location)}.bind(this),!1)):b.href=y.expand({resource:a.Location}))},getCellHeaderElement:function(a){if(this.explorer.breadCrumbMaker)return null;if(0===a){a=document.createElement("th");a.colSpan=1;var b=this.explorer.treeRoot;a.appendChild(document.createTextNode(b.Parents?b.Name:this.explorer.fileClient.fileServiceName(b.Location)));return a}return null},emptyCallback:function(a){this.explorer.readonly||
g.NavigatorRenderer.prototype.emptyCallback.call(this,a)},getExpandImage:function(){return null}});v.prototype=Object.create(w.prototype);h.mixin(v.prototype,{loadRoot:function(a){a?this.load(a,"Loading "+a.Name).then(this.loaded.bind(this)):this.loadResourceList(d.matchResourceParameters().resource+"?depth\x3d1",!1).then(this.loaded.bind(this))},isCommandsVisible:function(){if(!this.selection)return!1;var a=n.getMainSplitter();return a?a.splitter.isClosed():!this.readonly},scope:function(a){window.location.href=
y.expand({resource:a})},scopeUp:function(){var a;a=this.treeRoot;var b=a.Parents&&a.Parents[0];a=b?b.ChildrenLocation:this.fileClient.fileServiceRootURL(a.Location);this.scope(a)},scopeDown:function(a){this.scope(a.ChildrenLocation)},registerCommands:function(){return(new s).resolve()},updateCommands:function(a){this.menuBar&&(this.menuBar.setActiveExplorer(this),this.menuBar.updateCommands())}});u.prototype={_init:function(){this.markdownView=new b.MarkdownView({fileClient:this.fileClient,canHide:!this.readonly,
progress:this.progress});this.showProjectView&&(this.projectEditor=new e.ProjectEditor({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry,preferences:this.preferences}),this.projectView=new t.ProjectView({fileClient:this.fileClient,progress:this.progress,serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry}));n.getMainSplitter()&&n.getMainSplitter().splitter.addEventListener("toggle",this._splitterToggleListener=
function(a){[this.markdownView,this.projectEditor,this.projectView,this.folderNavExplorer].forEach(function(b){b&&b.setCommandsVisible&&b.setCommandsVisible(a.closed)})}.bind(this))},_isCommandsVisible:function(){var a=n.getMainSplitter();return a?a.splitter.isClosed():!this.readonly},displayWorkspaceView:function(){this._node||(this._node=document.createElement("div"));this._parent.appendChild(this._node);if(this.showProjectView){var a=document.createElement("div");this._node.appendChild(a);this.projectView.display(this._metadata,
a);this.projectView.setCommandsVisible(this._isCommandsVisible())}},displayFolderView:function(b){function d(b,h){b.forEach(function(b){if("project"===b)c&&this.showProjectView&&(g=document.createElement("div"),this.projectEditor.displayContents(g,this._metadata),this._node.appendChild(g));else if("folderNav"===b){if(this.showFolderNav){var d=document.createElement("div");d.id="folderNavNode";b=new q.Section(this._node,{id:"folderNavSection",headerClass:["sectionTreeTableHeader"],title:h[b]||"Files",
canHide:!this.readonly});if(this.editorView){b.setContent(this.editorView.getParent());this.editorView.create();var f=this.editorView.editor.getTextView();f.getModel().addEventListener("Changed",this._editorViewModelChangedListener=function(a){a=f.getLineHeight()*f.getModel().getLineCount()+20;this._maxEditorHeight&&0<this._maxEditorHeight&&a>this._maxEditorHeight&&(a=this._maxEditorHeight);this.editorView.getParent().style.height=a+"px"}.bind(this));this.editor=this.editorView.editor}else this.imageView?
b.setContent(this.imageView.image):(this.folderNavExplorer=new v({parentId:d,view:this,readonly:this.readonly,menuBar:this.menuBar,breadCrumbMaker:this.breadCrumbMaker,clickHandler:this.clickHandler,serviceRegistry:this.serviceRegistry,fileClient:this.fileClient,editorInputManager:this.editorInputManager,commandRegistry:this.commandRegistry,contentTypeRegistry:this.contentTypeRegistry}),b.embedExplorer(this.folderNavExplorer),this.folderNavExplorer.setCommandsVisible(this._isCommandsVisible()),this.folderNavExplorer.loadRoot(this._metadata));
if(this.breadCrumbMaker&&(d=b.getTitleElement())){a.empty(d);var k=document.createElement("div");d.appendChild(k);this.breadCrumbMaker(k,b.getHeaderElement().offsetWidth-24)}}}else"readme"===b&&e&&(g=document.createElement("div"),this.markdownView.displayInFrame(g,e,["sectionTreeTableHeader"],null,h[b]),this._node.appendChild(g))}.bind(this))}b=b.Children;var c,e;if(b)for(var h=0;h<b.length;h++){var f=b[h];!f.Directory&&"project.json"===f.Name&&(c=f);!f.Directory&&f.Name&&"readme.md"===f.Name.toLowerCase()&&
(e=f)}var g;this._node||(this._node=document.createElement("div"));this._parent.appendChild(this._node);var k=["project","folderNav","readme"],m={};this.editorView?d.apply(this,[k,m]):this.preferences?this.preferences.getPreferences("/sectionsOrder").then(function(a){m=a.get("folderViewNames")||m;k=a.get("folderView")||k;d.apply(this,[k,m])}.bind(this),function(a){d.apply(this,[k,m]);window.console.error(a)}.bind(this)):d.apply(this,[k,m])},create:function(){this._metadata.Projects&&this.displayWorkspaceView();
this.editorView||this.imageView?this.displayFolderView(this._metadata):this._metadata.Children?this.displayFolderView(this._metadata):this._metadata.ChildrenLocation&&this.progress.progress(this.fileClient.fetchChildren(this._metadata.ChildrenLocation),"Fetching children of "+this._metadata.Name).then(function(a){this._metadata.Children=a;this.displayFolderView(this._metadata)}.bind(this))},destroy:function(){this.editorView&&(this.editorView.editor.getTextView().getModel().removeEventListener("Changed",
this._editorViewModelChangedListener),this.editorView.destroy(),this.editor=null);var a=n.getMainSplitter();a&&a.splitter.removeEventListener("toggle",this._splitterToggleListener);this.folderNavExplorer&&this.folderNavExplorer.destroy();this.folderNavExplorer=null;this._node&&this._node.parentNode&&this._node.parentNode.removeChild(this._node);this.projectView&&this.projectView.destroy();this.projectEditor&&this.projectEditor.destroy();this._node=null}};return{FolderView:u}});
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,n,l,g,c,f,b){function e(a){var b=a.getTextView();l.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(),h=b.mapOffset(a.start),b=b.mapOffset(a.end),e=e.getText(h,b);if((e=d._prefix.match(RegExp("^"+c.escape(e),"i")))&&0<e.length)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 d(a,b,d){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 c=this;this._listeners={onEditorFocus:function(a){c._removeCurrentAnnotation(a)}};this.setOptions(d)}}var m={};e.prototype=new l.KeyMode;f.mixin(e.prototype,{createKeyBindings:function(){var a=n.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 d=this._prefix;if(0===d.length)return!1;var c=this.editor,e=c.getModel(),e=a?this._success?b?this._start:c.getCaretOffset()+
1:0:this._success?b?this._start:c.getCaretOffset():e.getCharCount()-1;(d=c.getModel().find({string:d,start:e,reverse:!a,caseInsensitive:d.toLowerCase()===d}).next())?(b||(this._start=e),this._ignoreSelection=this._success=!0,c.moveSelection(a?d.start:d.end,a?d.end:d.start),this._ignoreSelection=!1):this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){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 0===a.length?(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=b.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
m.IncrementalFind=e;d.prototype={find:function(a,b,d){this.setOptions({reverse:!a});var c=this.getFindString(),e;b&&(c=b.findString||c,e=b.count);a=this.getOptions();this.setOptions(b);b=d?this._startOffset:this.getStartOffset();if((e=this._doFind(c,b,e))&&!d)this._startOffset=e.start;this.setOptions(a);this._hideAfterFind&&this.hide();return e},getStartOffset:function(){return void 0!==this._start?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;this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(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="",d=!1,c=this._editor.getModel().getLineDelimiter(),e=0;e<a.length;e++){var f=a.substring(e,e+1);if(d){switch(f){case "R":b+=c;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+f}d=!1}else"\\"===f?d=!0:b+=f}d&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,d=this._processReplaceString(this.getReplaceString()),c=b.getSelection().start;if(b=b.getModel().find({string:a,start:c,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,d),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var d=this._editor,c=d.getTextView();d.reportStatus(k.replaceAll);var e=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var g=0,m=0;;){var l=f._doFind(a,g,null,!0);if(!l)break;m++;1===m&&(c.setRedraw(!1),f.startUndo());f._doReplace(l.start,l.end,a,e);g=f.getStartOffset()}0<
m&&(f.endUndo(),c.setRedraw(!0));0<g?d.reportStatus(b.formatMessage(k.replacedMatches,m)):d.reportStatus(k.nothingReplaced,"error");f._replacingAll=!1},100)}},setOptions:function(a){if(a){if((!0===a.showAll||!1===a.showAll)&&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(g.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(!0===a.caseInsensitive||!1===a.caseInsensitive)this._caseInsensitive=
a.caseInsensitive;if(!0===a.wrap||!1===a.wrap)this._wrap=a.wrap;if(!0===a.wholeWord||!1===a.wholeWord)this._wholeWord=a.wholeWord;if(!0===a.incremental||!1===a.incremental)this._incremental=a.incremental;if(!0===a.regex||!1===a.regex)this._regex=a.regex;if(!0===a.findAfterReplace||!1===a.findAfterReplace)this._findAfterReplace=a.findAfterReplace;if(!0===a.hideAfterFind||!1===a.hideAfterFind)this._hideAfterFind=a.hideAfterFind;if(!0===a.reverse||!1===a.reverse)this._reverse=a.reverse;a.hasOwnProperty("findCallback")&&
(this._findCallback=a.findCallback);a.hasOwnProperty("start")&&(this._start=a.start);a.hasOwnProperty("end")&&(this._end=a.end)}},show:function(a){this._visible=!0;a&&(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,d){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:d?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,d,c){d=d||1;var e=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var f,m;if(this._regex)try{m=this._find(a,b,c)}catch(l){e.reportStatus(l.message,
"error");return}else m=this._find(a,b,c);for(a=0;a<d&&m.hasNext();a++)f=m.next();if(!this._replacingAll){f?this._editor.reportStatus(""):this._editor.reportStatus(k.notFound,"error");if(this.isVisible()){d=g.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(m=e.getAnnotationModel())m.removeAnnotations(d),f&&m.addAnnotation(g.AnnotationType.createAnnotation(d,f.start,f.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var n=this;this._timer=window.setTimeout(function(){n._markAllOccurrences();
n._timer=null},500)}}this._findCallback?this._findCallback(f):f&&e.moveSelection(f.start,f.end,null,!1)}return f},_doReplace:function(a,b,d,c){var e=this._editor;if(!this._regex||!(c=e.getText(a,b).replace(RegExp(d,this._caseInsensitive?"i":""),c),!c))e.setText(c,a,b),e.setSelection(a,a+c.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=g.AnnotationType.ANNOTATION_MATCHING_SEARCH,d=a.getAnnotations(),c=[],e;d.hasNext();){var f=d.next();f.type===b&&
c.push(f)}if(this.isVisible()){d=this.getFindString();d=this._editor.getModel().find({string:d,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(e=[];d.hasNext();)f=d.next(),e.push(g.AnnotationType.createAnnotation(b,f.start,f.end))}a.replaceAnnotations(c,e)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(g.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(g.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(a){(a=this._editor.getAnnotationModel())&&a.removeAnnotations(g.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};m.Find=d;return m});
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,n,l,g,c,f){function b(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 e(a,b,d,c){this.editor=a;this.undoStack=b;this.contentAssist=d;this.linkedMode=c;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var d=l.AnnotationType,m={};b.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){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;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.undo(),--b;return!0}return!1}.bind(this),
{name:k.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:k.redo});a.setKeyBinding(new n.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 n.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 n.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 n.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:k.incrementalFind});a.setKeyBinding(new n.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 n.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:k.moveLinesUp});a.setKeyBinding(new n.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:k.moveLinesDown});a.setKeyBinding(new n.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:k.copyLinesUp});a.setKeyBinding(new n.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:k.copyLinesDown});a.setKeyBinding(new n.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:k.deleteLines});a.setKeyBinding(new n.KeyBinding("l",!f.isMac,!1,!1,f.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:k.gotoLine});a.setKeyBinding(new n.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:k.nextAnnotation});a.setKeyBinding(new n.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:k.prevAnnotation});a.setKeyBinding(new n.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:k.expand});a.setKeyBinding(new n.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:k.collapse});a.setKeyBinding(new n.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:k.expandAll});a.setKeyBinding(new n.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:k.collapseAll});a.setKeyBinding(new n.KeyBinding("q",!f.isMac,!1,!1,f.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(),d=a.getSelection(),c=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),e=b.getLineStart(c),c=b.getLineEnd(d,!0),f=b.getLineCount(),g="",e=b.getText(e,c);d===f-1&&(e=(g=b.getLineDelimiter())+e);a.setText(e,c,c);a.setSelection(c+g.length,c+e.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),c=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-
1:d.end),c=b.getLineStart(c),e=b.getLineEnd(d,!0),f=b.getLineCount(),g="",e=b.getText(c,e);d===f-1&&(e+=g=b.getLineDelimiter());a.setText(e,c,c);a.setSelection(c,c+e.length-g.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=1;a&&a.count&&(d=a.count);var c=b.getSelection(),e=b.getModel(),f=e.getLineAtOffset(c.start);a=e.getLineStart(f);d=c.start!==c.end||1===d?e.getLineAtOffset(c.end>c.start?c.end-1:c.end):Math.min(f+d-1,e.getLineCount()-
1);d=e.getLineEnd(d,!0);b.setText("",a,d);return!0},expandAnnotation:function(a){var b=this.editor,d=b.getAnnotationModel();if(!d)return!0;var c=b.getModel(),e=b.getCaretOffset(),f=c.getLineAtOffset(e),e=c.getLineStart(f),f=c.getLineEnd(f,!0);c.getBaseModel&&(e=c.mapOffset(e),f=c.mapOffset(f),c.getBaseModel());for(var g,d=d.getAnnotations(e,f);!g&&d.hasNext();)c=d.next(),c.type===l.AnnotationType.ANNOTATION_FOLDING&&(g=c);g&&a!==g.expanded&&(a?g.expand():(b.setCaretOffset(g.start),g.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,d=b.getTextView(),b=b.getAnnotationModel();if(!b)return!0;var c=b.getAnnotations();for(d.setRedraw(!1);c.hasNext();)b=c.next(),b.type===l.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());d.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var d=a.getModel(),c=a.getSelection(),e=d.getLineAtOffset(c.start),f=d.getLineAtOffset(c.end>
c.start?c.end-1:c.end);if(e!==f){var g=[];g.push("");for(var k=e;k<=f;k++)g.push(d.getLine(k,!0));k=d.getLineStart(e);d=d.getLineEnd(f,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(g.join(b),k,d);a.setSelection(k===c.start?c.start:c.start+b.length,c.end+(f-e+1)*b.length);return!0}return!1}},gotoLastEdit:function(){"number"===typeof this._lastEditLocation&&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(),d=a.getSelection(),c=b.getLineAtOffset(d.start),e=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineCount();if(e===f-1)return!0;var c=b.getLineStart(c),d=b.getLineEnd(e,!0),g=b.getLineEnd(e+1,!0)-(d-c),k=0;e!==f-2?b=b.getText(c,d):(e=b.getLineEnd(e),
b=b.getText(e,d)+b.getText(c,e),k+=d-e);this.startUndo();a.setText("",c,d);a.setText(b,g,g);a.setSelection(g+k,g+k+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),c=b.getLineAtOffset(d.start);if(0===c)return!0;var e=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineCount(),d=b.getLineStart(c-1),g=b.getLineStart(c),k=b.getLineEnd(e,!0),m=b.getText(g,k),l=0;e===f-1&&(e=b.getLineEnd(c-
1),c=b.getLineEnd(c-1,!0),m+=b.getText(e,c),g=e,l=c-e);this.startUndo();a.setText("",g,k);a.setText(m,d,d);a.setSelection(d,d+m.length-l);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===d.ANNOTATION_MATCHING_BRACKET||a.type===d.ANNOTATION_CURRENT_BRACKET||!f.isAnnotationTypeVisible(a.type)}var c=this.editor,e=c.getAnnotationModel();if(!e)return!0;var f=c.getOverviewRuler()||c.getAnnotationStyler();if(!f)return!0;for(var k=c.getModel(),m=c.getCaretOffset(),
l=e.getAnnotations(a?m:0,a?k.getCharCount():m),n=null;l.hasNext();){var z=l.next();if(a){if(z.start<=m)continue}else if(z.start>=m)continue;if(!b(z)&&(n=z,a))break}if(n){for(var y=[n],l=e.getAnnotations(n.start,n.start);l.hasNext();)z=l.next(),z!==n&&!b(z)&&y.push(z);var x=c.getTextView(),p=k.getLineAtOffset(n.start),A=g.Tooltip.getTooltip(x);if(!A)return c.moveSelection(n.start),!0;c.moveSelection(n.start,n.start,function(){A.setTarget({getTooltipInfo:function(){var a=x.convert({x:x.getLocationAtOffset(n.start).x,
y:x.getLocationAtOffset(k.getLineStart(p)).y},"document","page");return{contents:y,x:a.x,y:a.y+Math.floor(1.33*x.getLineHeight(p))}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var d=a.getModel(),c=a.getSelection(),e=d.getLineAtOffset(c.start),f=d.getLineAtOffset(c.end>c.start?c.end-1:c.end),g=b.getOptions("tabSize"),k=Array(g+1).join(" "),m=[],l=b=0,n=e;n<=f;n++){var x=d.getLine(n,!0);if(d.getLineStart(n)!==
d.getLineEnd(n))if(0===x.indexOf("\t"))x=x.substring(1),b++;else if(0===x.indexOf(k))x=x.substring(g),b+=g;else return!0;n===e&&(l=b);m.push(x)}e=d.getLineStart(e);g=d.getLineEnd(f,!0);d=d.getLineStart(f);a.setText(m.join(""),e,g);f=e===c.start?c.start:c.start-l;c=Math.max(f,c.end-b+(c.end===d+1&&c.start!==c.end?1:0));a.setSelection(f,c);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};m.TextActions=
b;e.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 n.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:k.trimTrailingWhitespaces});a.setKeyBinding(new n.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:k.toggleLineComment});a.setKeyBinding(new n.KeyBinding(191,!0,!f.isMac,!1,f.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:k.addBlockComment});a.setKeyBinding(new n.KeyBinding(220,!0,!f.isMac,!1,f.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:k.removeBlockComment});a.setKeyBinding(new n.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new n.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new n.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c",
"\x3e")}.bind(this));a.setKeyBinding(new n.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new n.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new n.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",
function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new n.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new n.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new n.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",
function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new n.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 d=a.getSelection();if(d.start===d.end){for(var c=a.getModel(),e=c.getLineAtOffset(d.start),
f=c.getLine(e,!1),g=c.getLineStart(e),k=0,m=d.start-g,l;k<m&&(32===(l=f.charCodeAt(k))||9===l);)k++;var g=f.substring(0,k),b=b.getOptions("tabSize","expandTab"),n=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=c.getLineDelimiter(),x=/^[\s]*\/\*[\*]*[\s]*$/,p=/^[\s]*\*/,A=/\*\/[\s]*$/,C=f.substring(0,m),B=f.substring(m),J;if(this.smartIndentation&&123===f.charCodeAt(J=C.trimRight().length-1))return c=m-J-1,B=B.length-B.trimLeft().length,f=125===f.charCodeAt(m+B)?b+g+n+b+g:b+g+n,a.setText(f,d.start-
c,d.end+B),a.setCaretOffset(d.start+b.length+g.length+n.length-c),!0;if(this.autoCompleteComments&&!A.test(C)&&(x.test(C)||p.test(C))){if(x.exec(C)){f=b+g+" * ";f=A.test(B)?f+B.substring(0,B.length-2).trim():f+B.trim();if(c.getLineCount()===e+1||!p.test(c.getLine(e+1)))f+=b+g+" */";a.setText(f,d.start,d.end+B.length);a.setCaretOffset(d.start+b.length+g.length+3);return!0}if(p.exec(C))for(e-=1;0<=e;e--){k=c.getLine(e,!1);if(x.test(k))return A.test(B)||47===f.charCodeAt(m)?(f=b+g+"*"+B,g=d.start+b.length+
g.length+1):(f=b+g+"* "+B,g=d.start+b.length+g.length+2),a.setText(f,d.start,d.end+B.length),a.setCaretOffset(g),!0;if(!p.test(k))break}}else{if(A.test(C)&&32===g.charCodeAt(g.length-1))return f=b+g.substring(0,g.length-1),a.setText(f,d.start,d.end),a.setCaretOffset(d.start+f.length),!0;if(0<k){for(k=m;k<f.length&&(32===(l=f.charCodeAt(k++))||9===l);)d.end++;a.setText(c.getLineDelimiter()+g,d.start,d.end);return!0}}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),c=this._findEnclosingComment(b,d.start,d.end);if(void 0!==c.commentStart&&void 0!==c.commentEnd)return!0;b=b.getText(d.start,d.end);if(0===b.length)return!0;var c=b.length,b=b.replace(/\/\*|\*\//g,""),e=b.length;a.setText("/*"+b+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(e-c));return!0},autoPairBrackets:function(a,b){if("["===a&&!this.autoPairSquareBrackets||"{"===a&&!this.autoPairBraces||"("===a&&!this.autoPairParentheses||"\x3c"===a&&!this.autoPairAngleBrackets)return!1;
var d=this.editor;if(d.getTextView().getOptions("readonly"))return!1;var c=d.getSelection(),e=d.getModel(),f=d.getCaretOffset()===e.getCharCount()?"":e.getText(c.start,c.start+1).trim(),g=/^$|[)}\]>]/;return c.start===c.end&&g.test(f)?(d.setText(a+b,c.start,c.start),d.setCaretOffset(c.start+1),!0):c.start!==c.end?(e=e.getText(c.start,c.end),d.setText(a+e+b,c.start,c.end),d.setSelection(c.start+1,c.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;
if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),c=b.getModel(),e=b.getCaretOffset(),f=0===e?"":c.getText(d.start-1,d.start).trim(),g=e===c.getCharCount()?"":c.getText(d.start,d.start+1).trim(),e=/^"$|^'$/,k=/\w/,m=/^$|[)}\]>]/;if(d.start!==d.end){c=c.getText(d.start,d.end);if(e.test(c))return!1;b.setText(a+c+a,d.start,d.end);b.setSelection(d.start+1,d.end+1)}else{if(g!==a){if(f===a||e.test(g)||k.test(f)||!m.test(g))return!1;b.setText(a+a,d.start,d.start)}b.setCaretOffset(d.start+
1)}return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&0<a.positions.length&&this.linkedMode){for(var b=[],d=0;d<a.positions.length;++d)b[d]={positions:[{offset:a.positions[d].offset,length:a.positions[d].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&0<a.groups.length&&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 d=a.getModel(),c=a.getCaretOffset(),e=0===c?"":d.getText(b.start-1,b.start),d=c===d.getCharCount()?"":d.getText(b.start,b.start+1);("("===e&&")"===d||"["===e&&"]"===d||"{"===e&&"}"===d||"\x3c"===e&&"\x3e"===d||'"'===e&&'"'===d||"'"===e&&"'"===d)&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,d){var c=a.getLineAtOffset(b),
e=a.getLineAtOffset(d),f,g,k,m,l,n;for(f=c;0<=f&&!(g=a.getLine(f),k=f===c?b-a.getLineStart(c):g.length,m=g.lastIndexOf("/*",k),g=g.lastIndexOf("*/",k),g>m);f--)if(-1!==m){l=a.getLineStart(f)+m;break}for(f=e;f<a.getLineCount()&&!(g=a.getLine(f),k=f===e?d-a.getLineStart(e):0,m=g.indexOf("/*",k),g=g.indexOf("*/",k),-1!==m&&m<g);f++)if(-1!==g){n=a.getLineStart(f)+g;break}return{commentStart:l,commentEnd:n}},lineStart:function(){for(var a=this.editor,b=a.getModel(),d=a.getCaretOffset(),c=b.getLineAtOffset(d),
e=b.getLineStart(c),b=b.getLine(c),c=0;c<b.length;c++){var f=b.charCodeAt(c);if(!(32===f||9===f))break}c+=e;return d!==c?(a.setSelection(c,c),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),c=b.getText(d.start,d.end),e,f,g;for(g=0;g<c.length;g++)if("/*"===c.substring(g,g+2)){e=d.start+g;break}for(;g<c.length;g++)if("*/"===c.substring(g,g+2)){f=d.start+g;break}if(void 0!==e&&void 0!==f)a.setText(b.getText(e+
2,f),e,f+2),a.setSelection(e,f);else{c=this._findEnclosingComment(b,d.start,d.end);if(void 0===c.commentStart||void 0===c.commentEnd)return!0;b=b.getText(c.commentStart+2,c.commentEnd);a.setText(b,c.commentStart,c.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=this.lineComment||"//",d=a.getModel(),c=a.getSelection(),e=d.getLineAtOffset(c.start),f=d.getLineAtOffset(c.end>c.start?c.end-
1:c.end),g=!0,k=[],m,l,n=e;n<=f;n++)if(m=d.getLine(n,!0),k.push(m),!g||-1===(l=m.indexOf(b)))g=!1;else if(0!==l){var x;for(x=0;x<l;x++){var p=m.charCodeAt(x);if(!(32===p||9===p))break}g=x===l}p=b.length;n=d.getLineStart(e);x=d.getLineEnd(f,!0);if(g){for(g=0;g<k.length;g++)m=k[g],l=m.indexOf(b),k[g]=m.substring(0,l)+m.substring(l+p);b=k.join("");k=d.getLineStart(f);d=n===c.start?c.start:c.start-p;c=c.end-p*(f-e+1)+(c.end===k+1?p:0)}else k.splice(0,0,""),b=k.join(b),d=n===c.start?c.start:c.start+p,
c=c.end+p*(f-e+1);a.setText(b,n,x);a.setSelection(d,c);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),d=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var c=/(\s+$)/,e=b.getLineCount(),f=0;f<e;f++){var g=b.getLine(f),k=c.exec(g);if(k){var m=b.getLineStart(f),g=k[0].length,k=m+k.index;b.setText("",k,k+g);d.start>k&&(d.start=Math.max(k,d.start-g));d.start!==d.end&&d.end>k&&(d.end=Math.max(k,d.end-g))}}a.getUndoStack().endCompoundChange();
a.getTextView().setRedraw(!0);a.setSelection(d.start,d.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),c=b.getModel();return(b.getCaretOffset()===c.getCharCount()?"":c.getText(d.start,d.start+1))===a?(b.setCaretOffset(d.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},setAutoPairParentheses:function(a){this.autoPairParentheses=
a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setLineComment:function(a){this.lineComment=a},setSmartIndentation:function(a){this.smartIndentation=a}};m.SourceCodeActions=e;String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,
"")});String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")});return m});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(k,n,l,g){function c(b,a,d,c){this._location=a||"left";this._overview=d||"page";this._rulerStyle=c;this._view=null;var e=this;this._listener={onTextModelChanged:function(a){e._onTextModelChanged(a)},onAnnotationModelChanged:function(a){e._onAnnotationModelChanged(a)}};this.setAnnotationModel(b)}function f(b,a,d,e,f){c.call(this,b,a,"page",d);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function b(b,a,d){c.call(this,b,a,"page",d)}function e(b,a,d){c.call(this,b,a,"document",d)}function d(d,a,c){b.call(this,d,a,c)}c.prototype={getAnnotations:function(b,a){var d=this._annotationModel;if(!d)return[];var c=this._view.getModel(),e=c.getLineStart(b),f=c.getLineEnd(a-1),g=c;c.getBaseModel&&(g=c.getBaseModel(),e=c.mapOffset(e),f=c.mapOffset(f));for(var k=[],d=this.getAnnotationsByType(d,e,f),e=0;e<
d.length;e++)for(var f=d[e],l=g.getLineAtOffset(f.start),n=g.getLineAtOffset(Math.max(f.start,f.end-1)),z=l;z<=n;z++){var y=z;if(c!==g){y=g.getLineStart(z);y=c.mapOffset(y,!0);if(-1===y)continue;y=c.getLineAtOffset(y)}if(b<=y&&y<a){var x=this._mergeAnnotation(k[y],f,z-l,n-l+1);x&&(k[y]=x)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var p in k)k[p]._multiple&&(k[p].html+=this._multiAnnotationOverlay.html);return k},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,a){if(void 0!==b){var d=this._view,c=d.getModel(),e=c,f=c.getLineStart(b),g=f,k=f,n=this._annotationModel;if(n){d=d.getSelection();k=c.getLineEnd(b,!0);f<=d.start&&d.start<k&&(f=d.start);c.getBaseModel&&(f=c.mapOffset(f),
k=c.mapOffset(k),e=c.getBaseModel());for(var w,k=n.getAnnotations(f,k),n=null;!w&&k.hasNext();)d=k.next(),this.isAnnotationTypeVisible(d.type)&&(n=d,d.start<=f||(w=d));n&&void 0!==n.groupId&&(this._currentClickGroup=this._currentClickGroup===n.groupId?null:n.groupId,this._setCurrentGroup(b));w&&e.getLineAtOffset(w.start)===e.getLineAtOffset(f)?(f=w.start,k=w.end):k=f=g;c.getBaseModel&&(f=c.mapOffset(f,!0),k=c.mapOffset(k,!0))}(c=l.Tooltip.getTooltip(this._view))&&c.setTarget(null);this._view.setSelection(k,
f,1/3,function(){})}},onDblClick:function(b,a){},onMouseMove:function(b,a){var d=l.Tooltip.getTooltip(this._view);if(d&&!(d.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=b;var c=this;d.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(b,a){this._currentClickGroup||this._setCurrentGroup(-1);var d=l.Tooltip.getTooltip(this._view);
d&&d.setTarget(null)},_getTooltipInfo:function(b,a){if(void 0!==b){var d=this._view,c=d.getModel(),e=this._annotationModel,f=[];if(e){var f=c.getLineStart(b),g=c.getLineEnd(b);c.getBaseModel&&(f=c.mapOffset(f),g=c.mapOffset(g));f=this.getAnnotationsByType(e,f,g)}e=this._getTooltipContents(b,f);if(!e)return null;e={contents:e,anchor:this.getLocation()};f=d.getClientArea();"document"===this.getOverview()?f.y=d.convert({y:a},"view","document").y:f.y=d.getLocationAtOffset(c.getLineStart(b)).y;d.convert(f,
"document","page");e.x=f.x;e.y=f.y;"right"===e.anchor&&(e.x+=f.width);return e}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(e.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));-1!==f&&-1!==g&&d.redrawLines(c.getLineAtOffset(f),c.getLineAtOffset(Math.max(f,g-1))+1,e)}}var d=this._view;if(d){var c=d.getModel(),e=this,f=c.getLineCount();b.textModelChangedEvent?
(b=b.textModelChangedEvent.start,c.getBaseModel&&(b=c.mapOffset(b,!0)),b=c.getLineAtOffset(b),d.redrawLines(b,f,e)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,d,c){b||(b={});0===d&&(b.html&&a.html?(a.html!==b.html&&!b._multiple&&this._multiAnnotation&&(b.html=this._multiAnnotation.html),b._multiple=!0):b.html=a.html);b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass=b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?
b.styleClass+(" "+a.styleClass):a.styleClass;var d;if(a.style)for(d in b.style||(b.style={}),a.style)void 0===b.style[d]&&(b.style[d]=a.style[d]);if(a.attributes)for(d in b.attributes||(b.attributes={}),a.attributes)void 0===b.attributes[d]&&(b.attributes[d]=a.attributes[d])}return b},_setCurrentGroup:function(b){var a=this._annotationModel,d=null,c=a.getTextModel(),e,f=this._currentGroupAnnotation;if(-1!==b){var g=c.getLineStart(b),k=c.getLineEnd(b);c.getBaseModel&&(g=c.mapOffset(g),k=c.mapOffset(k));
for(e=a.getAnnotations(g,k);e.hasNext();)if(c=e.next(),this.isAnnotationTypeVisible(c.type)&&c.start<=g&&c.end>=k&&void 0!==c.groupId){d=c;break}if(f&&d&&f.groupId===d.groupId)return}this._currentGroupAnnotation=null;f&&a.removeAnnotations(f.groupType);if(d&&-1!==b){this._currentGroupAnnotation=d;e=a.getAnnotations();for(b=[];e.hasNext();)c=e.next(),delete c.groupAnnotation,c.groupId===d.groupId&&(c=c.createGroupAnnotation(),b.push(c));a.replaceAnnotations(null,b)}}};n.AnnotationTypeList.addMixin(c.prototype);
f.prototype=new c;f.prototype.getAnnotations=function(b,a){for(var d=c.prototype.getAnnotations.call(this,b,a),e=this._view.getModel(),f=b;f<a;f++){var g=f&1?this._oddStyle:this._evenStyle,k=f;e.getBaseModel&&(k=e.getLineStart(k),k=e.getBaseModel().getLineAtOffset(e.mapOffset(k)));d[f]||(d[f]={});d[f].html=this._firstLine+k+"";d[f].style||(d[f].style=g)}return d};f.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();return this.getAnnotations(b-1,b)[b-1]};f.prototype.setFirstLine=
function(b){this._firstLine=void 0!==b?b:1};f.prototype._onTextModelChanged=function(b){var a=b.start;b=this._view.getModel();var d=b.getBaseModel?b.getBaseModel().getLineCount():b.getLineCount(),d=(this._firstLine+d-1+"").length;this._numOfDigits!==d&&(this._numOfDigits=d,a=b.getLineAtOffset(a),this._view.redrawLines(a,b.getLineCount(),this))};b.prototype=new c;e.prototype=new c;e.prototype.getRulerStyle=function(){return this._mergeStyle({style:{lineHeight:"1px",fontSize:"1px"}},this._rulerStyle)};
e.prototype._getTooltipContents=function(b,a){if(0===a.length){var d=this._view.getModel(),e=b;d.getBaseModel&&(e=d.getLineStart(e),e=d.getBaseModel().getLineAtOffset(d.mapOffset(e)));return g.formatMessage(k.line,e+1)}return c.prototype._getTooltipContents.call(this,b,a)};e.prototype._mergeAnnotation=function(b,a,d,c){if(0===d)return b||(b={html:"\x26nbsp;",style:{style:{height:3*c+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle)),b};d.prototype=new b;d.prototype.onClick=function(b,a){if(void 0!==
b){var d=this._annotationModel;if(d){var c=this._view.getModel(),e=c.getLineStart(b),f=c.getLineEnd(b,!0);c.getBaseModel&&(e=c.mapOffset(e),f=c.mapOffset(f),c=c.getBaseModel());for(var g,d=d.getAnnotations(e,f);!g&&d.hasNext();)f=d.next(),this.isAnnotationTypeVisible(f.type)&&c.getLineAtOffset(f.start)===c.getLineAtOffset(e)&&(g=f);g&&((c=l.Tooltip.getTooltip(this._view))&&c.setTarget(null),g.expanded?g.collapse():g.expand())}}};d.prototype._getTooltipContents=function(d,a){if(0<a.length){var c=this._view.getModel(),
e=c.getLineStart(d);c.getBaseModel&&(e=c.mapOffset(e),c=c.getBaseModel());for(var e=c.getLineAtOffset(e),f=0;f<a.length;f++){var g=a[f];if(this.isAnnotationTypeVisible(g.type)&&c.getLineAtOffset(g.start)===e){if(a[f].expanded)break;return b.prototype._getTooltipContents.call(this,d,[g])}}}return null};d.prototype._onAnnotationModelChanged=function(d){function a(a){for(g=0;g<a.length;g++)if(f.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;e.getBaseModel&&(b=e.mapOffset(b,!0));-1!==b&&(l=Math.min(l,
e.getLineAtOffset(b)))}}if(d.textModelChangedEvent)b.prototype._onAnnotationModelChanged.call(this,d);else{var c=this._view;if(c){var e=c.getModel(),f=this,g,k=e.getLineCount(),l=k;a(d.added);a(d.removed);a(d.changed);d=c.getRulers();for(g=0;g<d.length;g++)c.redrawLines(l,k,d[g])}}};return{Ruler:c,AnnotationRuler:b,LineNumberRuler:f,OverviewRuler:e,FoldingRuler:d}});
define("orion/editor/textDND",["orion/util"],function(k){function n(k,g){this._view=k;this._undoStack=g;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var c=this;this._listener={onDragStart:function(f){c._onDragStart(f)},onDragEnd:function(f){c._onDragEnd(f)},onDragEnter:function(f){c._onDragEnter(f)},onDragOver:function(f){c._onDragOver(f)},onDrop:function(f){c._onDrop(f)},onDestroy:function(f){c._onDestroy(f)}};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)}n.prototype={destroy:function(){var k=this._view;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(k){this.destroy()},_onDragStart:function(k){var g=this._view,c=g.getSelection(),g=g.getModel();g.getBaseModel&&(c.start=g.mapOffset(c.start),c.end=g.mapOffset(c.end),g=g.getBaseModel());if(g=g.getText(c.start,c.end))this._dragSelection=c,k.event.dataTransfer.effectAllowed="copyMove",k.event.dataTransfer.setData("Text",g)},_onDragEnd:function(l){if(this._dragSelection){var g=
this._view,c=l.event.dataTransfer.dropEffect;if(!k.isFirefox&&("none"!==c||this._dropText))c=l.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(l="move"===c)&&g.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var c=this._dropText,f=this._dropOffset;l&&(f>=this._dragSelection.end?f-=this._dragSelection.end-this._dragSelection.start:f>=this._dragSelection.start&&(f=this._dragSelection.start));g.setText(c,f,f);g.setSelection(f,
f+c.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(k){this._onDragOver(k)},_onDragOver:function(l){var g=l.event.dataTransfer.types,c=!this._view.getOptions("readonly");c&&g&&(c=g.contains?g.contains("text/plain")||g.contains("Text"):-1!==g.indexOf("text/plain")||-1!==g.indexOf("Text"));c?k.isFirefox||(this._dropEffect=l.event.dataTransfer.dropEffect=(k.isMac?l.event.altKey:l.event.ctrlKey)?"copy":
"move"):l.event.dataTransfer.dropEffect="none"},_onDrop:function(l){var g=this._view,c=l.event.dataTransfer.getData("Text");c&&(k.isFirefox||(l.event.dataTransfer.dropEffect=this._dropEffect),l=g.getOffsetAtLocation(l.x,l.y),this._dragSelection?(this._dropOffset=l,this._dropText=c):(g.setText(c,l,l),g.setSelection(l,l+c.length)))}};return{TextDND:n}});
define("orion/editor/templates",[],function(){function k(k,g,c,f){this.prefix=k;this.description=g;this.template=c;this.name=f;this._parse()}function n(k,g){this._keywords=k||[];this._templates=[];this.addTemplates(g||[])}k.prototype={getProposal:function(k,g,c){k=g-k.length;g={};var f,b=void 0!==c.delimiter?c.delimiter:"\n";c.indentation&&(b+=c.indentation);var e=void 0!==c.tab?c.tab:"\t",d=0,m=this.variables,a=this.segments;c=[];for(var h=0;h<a.length;h++){var n=a[h],t=m[n];if(void 0!==t)switch(n){case "${tab}":n=
e;break;case "${delimiter}":n=b;break;case "${cursor}":n="";f=d;break;default:var q=g[n];q||(q=g[n]={data:t.data,positions:[]});n=t.substitution;q.data&&q.data.values&&(n=q.data.values[0]);q.positions.push({offset:k+d,length:n.length})}c.push(n);d+=n.length}var b=[],r;for(r in g)g.hasOwnProperty(r)&&b.push(g[r]);c=c.join("");void 0===f&&(f=c.length);return{proposal:c,name:this.name,description:this.description,groups:b,escapePosition:k+f,style:"noemphasis"}},match:function(k){return 0===this.prefix.indexOf(k)},
_parse:function(){var k=this.template,g=[],c={},f,b=0,k=k.replace(/\n/g,"${delimiter}"),k=k.replace(/\t/g,"${tab}");k.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(e,d,m){var a=e.substring(2,e.length-1);d=e;var h=a,n=null,t=h.indexOf(":");-1!==t&&(h=h.substring(0,t),d="${"+h+"}",n=JSON.parse(a.substring(t+1).replace("\\}","}").trim()));(a=c[d])||(a=c[d]={});a.substitution=h;n&&(a.data=n);(f=k.substring(b,m))&&g.push(f);g.push(d);b=m+e.length;return h});(f=k.substring(b,k.length))&&g.push(f);this.segments=
g;this.variables=c}};n.prototype={addTemplates:function(l){for(var g=this.getTemplates(),c=0;c<l.length;c++)g.push(new k(l[c].prefix,l[c].description,l[c].template,l[c].name))},computeProposals:function(k,g,c){var f=this.getPrefix(k,g,c),b=[];this.isValid(f,k,g,c)&&(b=b.concat(this.getTemplateProposals(f,g,c)),b=b.concat(this.getKeywordProposals(f)));return b},getKeywords:function(){return this._keywords},getKeywordProposals:function(k){var g=[],c=this.getKeywords();if(c){for(var f=0;f<c.length;f++)0===
c[f].indexOf(k)&&g.push({proposal:c[f].substring(k.length),description:c[f],style:"noemphasis_keyword"});0<g.length&&g.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return g},getPrefix:function(k,g,c){return c.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(k,g,c){for(var f=[],b=this.getTemplates(),e=0;e<b.length;e++){var d=b[e];d.match(k)&&(d=d.getProposal(k,g,c),this.removePrefix(k,d),f.push(d))}0<f.length&&
(f.sort(function(b,a){return b.name<a.name?-1:b.name>a.name?1:0}),f.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return f},removePrefix:function(k,g){if(!(g.overwrite=g.proposal.substring(0,k.length)!==k))g.proposal=g.proposal.substring(k.length)},isValid:function(k,g,c,f){return!0}};return{Template:k,TemplateContentAssist:n}});
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,n,l,g,c,f){function b(b,c,a){var e=b.getTextView();l.KeyMode.call(this,e);this.editor=b;this.undoStack=c;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(0<a.selectedGroupIndex?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(a){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),d=this.linkedModeModel,c,e;d;)if(c=this._getPositionChanged(d,b,b+a.removedCharCount),e=c.position,void 0===e||e.model!==d)this.exitLinkedMode(!1),d=this.linkedModeModel;else break;if(d){d=0;a=a.addedCharCount-a.removedCharCount;c=c.positions;for(var f,g=0;g<c.length;++g){f=c[g];e=f.position;var h=e.offset<=b&&b<=e.offset+e.length;h&&!f.ansestor?(e.offset+=d,
e.length+=a,d+=a):(e.offset+=d,f.ansestor&&h&&(e.length+=a));f.escape&&(f.model.escapePosition=e.offset)}this._updateAnnotations(c)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,d=b.mapOffset(a.start),c=this.editor.mapOffset(a.end),e=this.linkedModeModel,f,g;e;)if(f=this._getPositionChanged(e,d,c),g=f.position,void 0===g||g.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var h=this._compoundChange;h?h.owner.model===e&&h.owner.group===g.group||
(this.endUndo(),this.startUndo()):this.startUndo();e.selectedGroupIndex=g.group;var h=0,k=a.text.length-(c-d);f=f.positions;for(var m,d=d-g.position.offset,l=c-g.position.offset,n=0;n<f.length;++n)m=f[n],c=m.position,m.oldOffset=c.offset,m.model===e&&m.group===g.group?(c.offset+=h,c.length+=k,h+=k):(c.offset+=h,m.ansestor&&(c.length+=g.count*k)),m.escape&&(m.model.escapePosition=c.offset);this.ignoreVerify=!0;for(n=f.length-1;0<=n;n--)m=f[n],m.model===e&&m.group===g.group&&b.setText(a.text,m.oldOffset+
d,m.oldOffset+l);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var e={};b.prototype=new l.KeyMode;f.mixin(b.prototype,{createKeyBindings:function(){var b=n.KeyBinding,c=[];c.push({actionID:"linkedModeEnter",keyBinding:new b(13)});c.push({actionID:"linkedModeCancel",keyBinding:new b(27)});c.push({actionID:"linkedModeNextGroup",keyBinding:new b(9)});c.push({actionID:"linkedModePreviousGroup",keyBinding:new b(9,!1,!0)});return c},enterLinkedMode:function(b){if(!this.linkedModeModel){var c=
this.editor.getTextView();c.addKeyMode(this);c.addEventListener("Verify",this.linkedModeListener.onVerify);c.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(k.linkedModeEntered,null,!0)}this._sortedPositions=null;this.linkedModeModel&&(b.previousModel=this.linkedModeModel,b.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=b);this.linkedModeModel=
b;this.selectLinkedGroup(0)},exitLinkedMode:function(b){if(this.isActive()){this._compoundChange&&(this.endUndo(),this._compoundChange=null);this._sortedPositions=null;var c=this.linkedModeModel;this.linkedModeModel=c.previousModel;c.parentGroup=c.previousModel=void 0;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);b&&a.setCaretOffset(c.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var b=this,c=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:c,group:c.selectedGroupIndex,end:function(){b._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(b){var e=this.linkedModeModel;if(e){e.selectedGroupIndex=b;b=e.groups[b];var a=b.positions[0],f=this.editor;f.setSelection(a.offset,a.offset+a.length);if(e=this.contentAssist)e.offset=void 0,b.data&&"link"===b.data.type&&b.data.values?((this._groupContentAssistProvider=new c.TemplateContentAssist(b.data.values)).getPrefix=function(){var b=
f.getSelection();return b.start===b.end&&(b=f.getCaretOffset(),a.offset<=b&&b<=a.offset+a.length)?f.getText(a.offset,b):""},e.offset=a.offset,e.deactivate(),e.activate()):this._groupContentAssistProvider&&(this._groupContentAssistProvider=null,e.deactivate())}this._updateAnnotations()},_getModelPositions:function(b,c,a){for(var e=c.groups,f=0;f<e.length;f++)for(var g=e[f].positions,k=0;k<g.length;k++){var l=g[k];a&&(l={offset:l.offset+a,length:l.length});l={index:k,group:f,count:g.length,model:c,
position:l};b.push(l);c.nextModel&&c.nextModel.parentGroup===f&&(l.ansestor=!0,this._getModelPositions(b,c.nextModel,(a||0)+g[k].offset-g[0].offset))}},_getSortedPositions:function(b){var c=this._sortedPositions;if(!c){for(c=[];b.previousModel;)b=b.previousModel;for(this._getModelPositions(c,b);b;)void 0!==b.escapePosition&&c.push({escape:!0,model:b,position:{offset:b.escapePosition,length:0}}),b=b.nextModel;c.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=c}return c},
_getPositionChanged:function(b,c,a){var e;b=this._getSortedPositions(b);for(var f=b.length-1;0<=f;f--){var g=b[f].position;if(g.offset<=c&&a<=g.offset+g.length){e=b[f];break}}return{position:e,positions:b}},_updateAnnotations:function(b){var c=this.editor.getAnnotationModel();if(c){var a=[],e=[];c.getTextModel();for(var f=c.getAnnotations(),k;f.hasNext();)switch(k=f.next(),k.type){case g.AnnotationType.ANNOTATION_LINKED_GROUP:case g.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case g.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:a.push(k)}if(f=
this.linkedModeModel){b=b||this._getSortedPositions(f);for(var l=0;l<b.length;l++)if(k=b[l],k.model===f){var n=g.AnnotationType.ANNOTATION_LINKED_GROUP;k.group===f.selectedGroupIndex&&(n=0===k.index?g.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:g.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);k=k.position;k=g.AnnotationType.createAnnotation(n,k.offset,k.offset+k.length,"");e.push(k)}}c.replaceAnnotations(a,e)}}});e.LinkedMode=b;return e});
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,n,l,g,c,f){function b(){}function e(){}function d(){}function m(){}function a(){}function h(){}var s={};b.prototype={createKeyBindings:function(a,b,d,c){c=new k.TextActions(a,b,c);var e=new f.LinkedMode(a,b,d);a=new k.SourceCodeActions(a,b,d,e);return{textActions:c,linkedMode:e,sourceCodeActions:a}}};s.KeyBindingsFactory=
b;e.prototype={createUndoStack:function(a){a=a.getTextView();return new n.UndoStack(a,200)}};s.UndoFactory=e;d.prototype={createLineNumberRuler:function(a){return new l.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};s.LineNumberRulerFactory=d;m.prototype={createFoldingRuler:function(a){return new l.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};s.FoldingRulerFactory=m;a.prototype={createAnnotationModel:function(a){return new g.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new g.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new l.AnnotationRuler(a,"left",{styleClass:"ruler annotations"});a=new l.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};s.AnnotationFactory=a;h.prototype={createTextDND:function(a,b){return new c.TextDND(a.getTextView(),b)}};s.TextDNDFactory=h;return s});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(k,n,l,g){return g.mixin({},k,n,l)});
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,n,l,g,c,f,b,e,d){function m(a){this.textView=a;this.state=s.INACTIVE;this.resetProviderInfoArray();var b=this;this.contentAssistListener={onModelChanging:function(a){this._latestModelChangingEvent=a}.bind(this),onSelection:function(a){this.isDeactivatingChange(this._latestModelChangingEvent,
a)?this.setState(s.INACTIVE):this.isActive()&&(this.state===s.ACTIVE&&this.setState(s.FILTERING),this.filterProposals(a));this._latestModelChangingEvent=null}.bind(this),onScroll:function(a){this.setState(s.INACTIVE)}.bind(this)};a.setKeyBinding(e.isMac?new n.KeyBinding(" ",!1,!1,!1,!0):new n.KeyBinding(" ",!0),"contentAssist");a.setKeyBinding(e.isMac?new n.KeyBinding(" ",!1,!1,!0,!0):new n.KeyBinding(" ",!0,!1,!0),"contentAssist");a.setAction("contentAssist",function(){a.getOptions("readonly")||
b.activate();return!0},{name:k.contentAssist})}function a(a,b){var d=a.textView;l.KeyMode.call(this,d);this.contentAssist=a;this.widget=b;this.proposals=[];var c=this;this.contentAssist.addEventListener("ProposalsComputed",function(a){c.proposals=a.data.proposals;if(0===c.proposals.length)c.selectedIndex=-1,c.cancel();else{for(c.selectedIndex=0;c.proposals[c.selectedIndex]&&c.proposals[c.selectedIndex].unselectable;)c.selectedIndex++;if(c.proposals[c.selectedIndex]){if(c.widget){var b=!0;if(a.autoApply){for(a=
c.selectedIndex+1;c.proposals[a]&&c.proposals[a].unselectable;)a++;c.proposals[a]||(b=!1,c.contentAssist.apply(c.proposals[c.selectedIndex]))}b&&(c.widget.show(),c.widget.selectNode(c.selectedIndex))}}else c.selectedIndex=-1,c.cancel()}});d.setAction("contentAssistApply",function(){return this.enter()}.bind(this));d.setAction("contentAssistCancel",function(){return this.cancel()}.bind(this));d.setAction("contentAssistNextProposal",function(){return this.lineDown()}.bind(this));d.setAction("contentAssistPreviousProposal",
function(){return this.lineUp()}.bind(this));d.setAction("contentAssistNextPage",function(){return this.pageDown()}.bind(this));d.setAction("contentAssistPreviousPage",function(){return this.pageUp()}.bind(this));d.setAction("contentAssistHome",function(){this.widget&&this.widget.scrollIndex(0,!0);return this.lineDown(0)}.bind(this));d.setAction("contentAssistEnd",function(){return this.lineUp(this.proposals.length-1)}.bind(this));d.setAction("contentAssistTab",function(){return this.tab()}.bind(this));
this.widget&&(this.widget.setContentAssistMode(this),this.widget.createAccessible())}function h(a,d){this.contentAssist=a;this.textView=this.contentAssist.getTextView();this.isShowing=this.textViewListenerAdded=!1;var c=this.textView.getOptions("parent").ownerDocument;this.parentNode="string"===typeof d?c.getElementById(d):d;if(!this.parentNode){this.parentNode=e.createElement(c,"div");this.parentNode.className="contentassist";var f=c.getElementsByTagName("body")[0];if(f)f.appendChild(this.parentNode);
else throw Error("parentNode is required");}this.parentNode.addEventListener("scroll",this.onScroll.bind(this));var g=this;this.textViewListener={onMouseDown:function(a){(a.event.target||a.event.srcElement).parentElement!==g.parentNode&&g.contentAssist.deactivate()}};this.contentAssist.addEventListener("Deactivating",function(a){g.hide()});this.scrollListener=function(a){g.isShowing&&g.position()};b.addEventListener(c,"scroll",this.scrollListener)}var s={INACTIVE:1,ACTIVE:2,FILTERING:3},t={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"};m.prototype={apply:function(a){if(!a)return!1;var b=this.textView,d=b.getSelection(),c=this._initialCaretOffset,e=c,f=d=Math.max(d.start,d.end),g=b.getModel();g.getBaseModel&&(e=g.mapOffset(e),f=g.mapOffset(f),g=g.getBaseModel());a.overwrite&&
(c=this.getPrefixStart(g,e));e={proposal:a,start:e,end:f};this.setState(s.INACTIVE);b.setText("string"===typeof a?a:a.proposal,c,d);this.dispatchEvent({type:"ProposalApplied",data:e});return!0},activate:function(a,b){this.state===s.INACTIVE&&(this._autoTriggered=b?!0:!1,this.setState(s.ACTIVE,a))},deactivate:function(){this.setState(s.INACTIVE)},getTextView:function(){return this.textView},isActive:function(){return this.state===s.ACTIVE||this.state===s.FILTERING},isDeactivatingChange:function(a,
b){var d=!1;b.newValue.start<this._initialCaretOffset?d=!0:a&&(d=0<a.removedLineCount||0<a.addedLineCount);return d},setState:function(a,b){var d;a===s.ACTIVE?(this._filterText="",d="Activating",this._mode&&this._mode.setActive(!0)):a===s.INACTIVE&&(d="Deactivating",this._mode&&this._mode.setActive(!1),this._initialCaretOffset=-1,this._filterText="");d&&this.dispatchEvent({type:d,providerInfoArray:b});this.state=a;this.onStateChange(a)},setMode:function(a){this._mode=a},onStateChange:function(a){a===
s.INACTIVE?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):a===s.ACTIVE&&(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(),d=this.textView.getSelection(),d=Math.min(d.start,d.end);this._initialCaretOffset=Math.min(b,d);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 d=b;0<d&&/[A-Za-z0-9_]/.test(a.getText(d-1,d));)d--;return d},handleError:function(a){"undefined"!==typeof console&&(console.log("Error retrieving content assist proposals"),console.log(a&&a.stack))},_computeProposals:function(a){var b=this._providerInfoArray,d=this.textView,e=d.getSelection(),g=d.getModel(),h=a;g.getBaseModel&&(h=g.mapOffset(h),e.start=g.mapOffset(e.start),e.end=g.mapOffset(e.end),g=g.getBaseModel());a=g.getLine(g.getLineAtOffset(h));
for(var k=0;k<a.length&&/\s/.test(a.charAt(k));)k++;var k=a.substring(0,k),d=d.getOptions("tabSize","expandTab"),d=d.expandTab?Array(d.tabSize+1).join(" "):"\t",m={line:a,offset:h,prefix:g.getText(this.getPrefixStart(g,h),h),selection:e,delimiter:g.getLineDelimiter(),tab:d,indentation:k},l=this,b=b.map(function(a){a=a.provider;var b;try{var d,e;if(d=a.computeContentAssist){var k=l.editorContextProvider,q=k.getEditorContext();m=f.mixin(m,k.getOptions());e=d.apply(a,[q,m])}else if(d=a.getProposals||
a.computeProposals)e=d.apply(a,[g.getText(),h,m]);b=l.progress?l.progress.progress(e,"Generating content assist proposal"):e}catch(n){l.handleError(n)}return c.when(b)});return c.all(b,this.handleError)},filterProposals:function(a){a="";var b=0;if(this._latestModelChangingEvent){a=this._latestModelChangingEvent.text;if(b=this._latestModelChangingEvent.removedCharCount)this._filterText=this._filterText.substring(0,this._filterText.length-b);a&&(this._filterText=this._filterText.concat(a));a=this.textView.getModel();
a.getBaseModel&&(a=a.getBaseModel());a=this.getPrefixStart(a,this._initialCaretOffset);var d=this.textView.getText(a,this._initialCaretOffset),c=[];this._computedProposals.forEach(function(a){a=a.filter(function(a){if(t[a.style]===t.hr||t[a.style]===t.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(d+this._filterText)}return a.name||a.proposal?(b=!1,a.name&&(b=0===a.name.indexOf(d+this._filterText)),!b&&a.proposal&&
(b=0===a.proposal.indexOf(this._filterText)),b):"string"===typeof a?0===a.indexOf(this._filterText):!1},this);0<a.length&&c.push(a)},this);c=this._removeExtraUnselectableElements(c);a=this._flatten(c);this.dispatchEvent({type:"ProposalsComputed",data:{proposals:a},autoApply:!1})}},_removeExtraUnselectableElements:function(a){return a.map(function(a){return a.filter(function(b,d){var c=!0;if(t[b.style]===t.hr)0===d||a.length-1===d?c=!1:t.hr===t[a[d-1].style]&&(c=!1);else if(t[b.style]===t.noemphasis_title){var e=
a[d+1];e?t[e.style]===t.noemphasis_title&&(c=!1):c=!1}return c})})},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){a=a.map(function(a){return{provider:a,id:this._generateProviderId()}},
this);this.setProviderInfoArray(a)},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 d=a;if(Array.isArray(b)&&0<b.length){var d=b,c=a;b[0].style&&0===t[b[0].style].indexOf(t.noemphasis)&&(d=a,c=b);0<d.length&&d[d.length-1].style&&t.hr!==t[d[d.length-1].style]&&(d=d.concat({proposal:"",name:"",description:"---------------------------------",style:"hr",unselectable:!0}));d=d.concat(c)}return d},[])},_triggerListener:function(a){if(this._styleAccessor){var b=this.textView.getCaretOffset(),d=null,c=[];if(this._charTriggersInstalled){var e=this.textView.getText(b-1,b);this._providerInfoArray.forEach(function(a){var f=
a.charTriggers;if(f&&f.test(e)){var f=!1,g=a.excludedStyles;g&&(d||(d=this._styleAccessor.getStyles(b-1)),f=d.some(function(a){return g.test(a.style)}));f||c.push(a)}},this);0<c.length&&this.activate(c,!0)}}},_updateAutoTriggerListenerState:function(){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 this._autoTriggerEnabled&&this._charTriggersInstalled&&(this.textView.addEventListener("Modify",this._boundTriggerListener),this._triggerListenerInstalled=!0)}};g.EventTarget.addMixin(m.prototype);a.prototype=new l.KeyMode;f.mixin(a.prototype,{createKeyBindings:function(){var a=n.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(d.KEY.HOME)});b.push({actionID:"contentAssistEnd",keyBinding:new a(d.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,d){if(d){if(void 0===a&&(a=this.selectedIndex+1),a>=this.proposals.length){if(b)return!0;a=0}}else if(void 0===a&&(a=this.selectedIndex-1),0>a){if(b)return!0;
a=this.proposals.length-1}for(var c=a;this.proposals[a]&&this.proposals[a].unselectable;){if(d){if(a++,a>=this.proposals.length){if(b)return!0;a=0}}else if(a--,0>a){if(b)return!0;a=this.proposals.length-1}if(a===c){a=-1;break}}this.selectedIndex=a;this.widget&&this.widget.selectNode(a);return!0},pageUp:function(){if(this.widget){var a=this.widget.getTopIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!1),a=this.widget.getTopIndex());return 0===a?this.lineDown(a,!0):this.lineUp(a,!0)}return this.lineUp()},
pageDown:function(){if(this.widget){var a=this.widget.getBottomIndex();a===this.selectedIndex&&(this.widget.scrollIndex(a,!0),a=this.widget.getBottomIndex());return this.lineDown(a,!0)}return this.lineDown()},enter:function(){return this.contentAssist.apply(this.proposals[this.selectedIndex]||null)},tab:function(){return this.widget?(this.widget.parentNode.focus(),!0):!1}});h.prototype={onClick:function(a){a||(a=window.event);this.contentAssist.apply(this.getProposal(a.target||a.srcElement));this.textView.focus()},
onScroll:function(a){this.previousCloneNode&&!this.preserveCloneThroughScroll&&(this._removeCloneNode(),this.previousSelectedNode.classList.add(t.selected));this.preserveCloneThroughScroll=!1},createDiv:function(a,b,d){var c=b.ownerDocument,f=e.createElement(c,"div");f.id="contentoption"+d;f.setAttribute("role","option");f.className=t[a.style]?t[a.style]:t.dfault;"hr"===a.style?a=e.createElement(c,"hr"):(a=this._createDisplayNode(f,a,d),f.contentAssistProposalIndex=d);f.appendChild(a);b.appendChild(f)},
createAccessible:function(){var a=this._contentAssistMode,b=this;this.parentNode.addEventListener("keydown",function(c){c||(c=window.event);c.preventDefault&&c.preventDefault();return c.keyCode===d.KEY.ESCAPE?a.cancel():c.keyCode===d.KEY.UP?a.lineUp():c.keyCode===d.KEY.DOWN?a.lineDown():c.keyCode===d.KEY.ENTER?a.enter():c.keyCode===d.KEY.PAGEDOWN?a.pageDown():c.keyCode===d.KEY.PAGEUP?a.pageUp():c.keyCode===d.KEY.HOME?(b.scrollIndex(0,!0),a.lineDown(0)):c.keyCode===d.KEY.END?a.lineUp(a.getProposals().length-
1):!1})},_createDisplayNode:function(a,b,d){var c=null,e=null;if("string"===typeof b)e=b;else if(b.description&&"string"===typeof b.description)if(b.name&&"string"===typeof b.name){var f=this._createNameNode(b.name);f.contentAssistProposalIndex=d;c=document.createElement("span");c.appendChild(f);f=document.createTextNode(b.description);c.appendChild(f);a.setAttribute("title",b.name+b.description)}else e=b.description;else e=b.proposal;e&&(c=this._createNameNode(e),a.setAttribute("title",e));c.contentAssistProposalIndex=
d;return c},_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 d=a[b];if(d.offsetTop+d.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;this.previousSelectedNode&&(this.previousSelectedNode.classList.remove(t.selected),this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode());if(-1!==a){b=this.parentNode.childNodes[a];
b.classList.add(t.selected);this.parentNode.setAttribute("aria-activedescendant",b.id);b.focus();b.offsetTop<this.parentNode.scrollTop?(b.scrollIntoView(!0),this.preserveCloneThroughScroll=!0):b.offsetTop+b.offsetHeight>this.parentNode.scrollTop+this.parentNode.clientHeight&&(b.scrollIntoView(!1),this.preserveCloneThroughScroll=!0);var c=d.bounds(b.firstChild||b),e=d.bounds(this.parentNode);a=window.getComputedStyle(this.parentNode);var f=window.getComputedStyle(b),f=parseInt(a.paddingLeft)+parseInt(a.paddingRight)+
parseInt(f.paddingLeft)+parseInt(f.paddingRight);if(c.width>=e.width-f){f=parseInt(a.top);e=b.cloneNode(!0);e.classList.add("cloneProposal");e.style.top=f+b.offsetTop-this.parentNode.scrollTop+"px";e.style.left=a.left;e.setAttribute("id",e.id+"_clone");c=c.left+c.width-parseInt(document.documentElement.clientWidth);0<c&&(a=parseInt(a.left)-c,0>a&&(a=0),e.style.left=a+"px");a=document.createElement("div");a.id="clone_contentassist";a.classList.add("contentassist");a.classList.add("cloneWrapper");a.appendChild(e);
a.onclick=this.parentNode.onclick;this.parentNode.parentNode.insertBefore(a,this.parentNode);var g=function(a){a.contentAssistProposalIndex=b.contentAssistProposalIndex;if(a.hasChildNodes())for(var d=0;d<a.childNodes.length;d++)g(a.childNodes[d])};g(a);b.classList.remove(t.selected);this.previousCloneNode=a}}this.previousSelectedNode=b},setContentAssistMode:function(a){this._contentAssistMode=a},show:function(){var a=this._contentAssistMode.getProposals();if(0===a.length)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;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;this.textViewListenerAdded&&
(this.textView.removeEventListener("MouseDown",this.textViewListener.onMouseDown),this.textViewListenerAdded=!1);this.previousSelectedNode&&(this.previousSelectedNode=null,this.previousCloneNode&&this._removeCloneNode())},position:function(){var a=this.contentAssist,b=this.textView;if(void 0!==a.offset){var a=a.offset,d=b.getModel();d.getBaseModel&&(a=d.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;d=b.documentElement.clientWidth;a.y+this.parentNode.offsetHeight>b.documentElement.clientHeight&&(this.parentNode.style.top=a.y-this.parentNode.offsetHeight-this.textView.getLineHeight()+"px");a.x+this.parentNode.offsetWidth>d&&(this.parentNode.style.left=d-this.parentNode.offsetWidth+"px")},
_removeCloneNode:function(){this.parentNode.parentNode.contains(this.previousCloneNode)&&this.parentNode.parentNode.removeChild(this.previousCloneNode);this.previousCloneNode=null}};return{ContentAssist:m,ContentAssistMode:a,ContentAssistWidget:h}});
define("orion/editor/emacs",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(k,n,l,g){function c(c){n.KeyMode.call(this,c)}c.prototype=new n.KeyMode;c.prototype.createKeyBindings=function(){var c=[];c.push({actionID:"emacs-beginning-of-line",keyBinding:this._createStroke("a",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-end-of-line",keyBinding:this._createStroke("e",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-forward-char",keyBinding:this._createStroke("f",
!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-backward-char",keyBinding:this._createStroke("b",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-forward-word",keyBinding:this._createStroke("f",!1,!1,!0)});c.push({actionID:"emacs-backward-word",keyBinding:this._createStroke("b",!1,!1,!0)});c.push({actionID:"emacs-next-line",keyBinding:this._createStroke("n",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-previous-line",keyBinding:this._createStroke("p",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-beginning-of-buffer",
keyBinding:this._createStroke(188,!1,!0,!0)});c.push({actionID:"emacs-end-of-buffer",keyBinding:this._createStroke(190,!1,!0,!0)});c.push({actionID:"emacs-delete-backward-char",keyBinding:this._createStroke(46,!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-delete-char",keyBinding:this._createStroke("d",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-kill-line",keyBinding:this._createStroke("k",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-kill-word",keyBinding:this._createStroke("d",!1,!1,
!0)});c.push({actionID:"emacs-backward-kill-word",keyBinding:this._createStroke(46,!1,!1,!0)});c.push({actionID:"undo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("u")])});c.push({actionID:"redo",keyBinding:this._createSequence([this._createStroke("x",!0),this._createStroke("r")])});c.push({actionID:"emacs-scroll-up",keyBinding:this._createStroke("v",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-scroll-down",keyBinding:this._createStroke("v",!1,!1,!0)});c.push({actionID:"emacs-set-mark-command",
keyBinding:this._createStroke(" ",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-reset-mark-command",keyBinding:this._createStroke("g",!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-exchange-point-and-mark",keyBinding:this._createSequence([this._createStroke("x",!g.isMac,!1,!1,g.isMac),this._createStroke("x",!g.isMac,!1,!1,g.isMac)])});for(var b=0;9>=b;b++)c.push({actionID:"emacs-digit-argument-"+b,keyBinding:this._createStroke(48+b,!g.isMac,!1,!1,g.isMac)}),c.push({actionID:"emacs-digit-argument-"+
b,keyBinding:this._createStroke(48+b,!1,!1,!0)}),c.push({actionID:"emacs-digit-argument-"+b,keyBinding:this._createStroke(48+b,!g.isMac,!1,!0,g.isMac)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!g.isMac,!1,!1,g.isMac)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!1,!1,!0)});c.push({actionID:"emacs-negative-argument",keyBinding:this._createStroke(189,!g.isMac,!1,!0,g.isMac)});c.push({actionID:"emacs-uppercase",keyBinding:this._createStroke("u",
!1,!1,!0)});c.push({actionID:"emacs-lowercase",keyBinding:this._createStroke("l",!1,!1,!0)});c.push({actionID:"emacs-capitalize",keyBinding:this._createStroke("c",!1,!1,!0)});c.push({actionID:"contentAssist",keyBinding:this._createStroke(191,!1,!1,!0)});c.push({actionID:"find",keyBinding:this._createStroke("r",!1,!1,!0)});c.push({actionID:"incrementalFind",keyBinding:this._createStroke("s",!0)});c.push({actionID:"incrementalFindReverse",keyBinding:this._createStroke("r",!0)});c.push({actionID:"save",
keyBinding:this._createSequence([this._createStroke("x",!g.isMac,!1,!1,g.isMac),this._createStroke("s",!g.isMac,!1,!1,g.isMac)])});this._createActions(this.getView());return c};c.prototype._createStroke=function(c,b,e,d,g){c=new l.KeyStroke(c,b,e,d,g);c.scopeName=k.emacs;return c};c.prototype._createSequence=function(c){c=new l.KeySequence(c);c.scopeName=k.emacs;return c};c.prototype._getData=function(){var c={count:(this._argument||1)*(this._sign||1)};this._argument=0;this._sign=1;return c};c.prototype._moveCursor=
function(c){var b=this._getData();this._marker&&(b.select=!0);return this.getView().invokeAction(c,!1,b)};c.prototype._digitArgument=function(c){this._argument=10*(this._argument||0)+c;return!0};c.prototype._negativeArgument=function(){this._sign=-1*(this._sign||1);return!0};c.prototype._createActions=function(c){var b=this;c.setAction("emacs-beginning-of-line",function(){return b._moveCursor("lineStart")},{name:k.lineStart});c.setAction("emacs-end-of-line",function(){return b._moveCursor("lineEnd")},
{name:k.lineEnd});c.setAction("emacs-forward-char",function(){return b._moveCursor("charNext")},{name:k.charNext});c.setAction("emacs-backward-char",function(){return b._moveCursor("charPrevious")},{name:k.charPrevious});c.setAction("emacs-forward-word",function(){return b._moveCursor("wordNext")},{name:k.wordNext});c.setAction("emacs-backward-word",function(){return b._moveCursor("wordPrevious")},{name:k.wordPrevious});c.setAction("emacs-next-line",function(){return b._moveCursor("lineDown")},{name:k.lineDown});
c.setAction("emacs-previous-line",function(){return b._moveCursor("lineUp")},{name:k.lineUp});c.setAction("emacs-beginning-of-buffer",function(){return b._moveCursor("textStart")},{name:k.textStart});c.setAction("emacs-end-of-buffer",function(){return b._moveCursor("textEnd")},{name:k.textEnd});c.setAction("emacs-delete-backward-char",function(){return c.invokeAction("deletePrevious")},{name:k.deletePrevious});c.setAction("emacs-delete-char",function(){return c.invokeAction("deletePrevious")},{name:k.deletePrevious});
c.setAction("emacs-kill-line",function(){return c.invokeAction("deleteLineEnd")},{name:k.deleteLineEnd});c.setAction("emacs-kill-word",function(){return c.invokeAction("deleteWordNext")},{name:k.deleteWordNext});c.setAction("emacs-backward-kill-word",function(){return c.invokeAction("deleteWordPrevious")},{name:k.deleteWordPrevious});c.setAction("emacs-scroll-up",function(){return b._moveCursor("pageDown")},{name:k.pageDown});c.setAction("emacs-scroll-down",function(){return b._moveCursor("pageUp")},
{name:k.pageUp});c.setAction("emacs-set-mark-command",function(){var e=c.getCaretOffset();c.setCaretOffset(e);b._marker=e;return!0},{name:k.setMarkCommand});c.setAction("emacs-exchange-point-and-mark",function(){if(void 0!==b._marker){var e=c.getCaretOffset(),d=c.getSelection();if(d.end===e){var g=d.start;d.start=d.end;d.end=g}b._marker=e;c.setSelection(d.start,d.end)}return!0},{name:k.exchangeMarkPoint});c.setAction("emacs-reset-mark-command",function(){var e=c.getCaretOffset();c.setCaretOffset(e);
b._marker=void 0;return!0},{name:k.clearMark});c.setAction("emacs-digit-argument-0",function(){return b._digitArgument(0)},{name:g.formatMessage(k.digitArgument,"0")});c.setAction("emacs-digit-argument-1",function(){return b._digitArgument(1)},{name:g.formatMessage(k.digitArgument,"1")});c.setAction("emacs-digit-argument-2",function(){return b._digitArgument(2)},{name:g.formatMessage(k.digitArgument,"2")});c.setAction("emacs-digit-argument-3",function(){return b._digitArgument(3)},{name:g.formatMessage(k.digitArgument,
"3")});c.setAction("emacs-digit-argument-4",function(){return b._digitArgument(4)},{name:g.formatMessage(k.digitArgument,"4")});c.setAction("emacs-digit-argument-5",function(){return b._digitArgument(5)},{name:g.formatMessage(k.digitArgument,"5")});c.setAction("emacs-digit-argument-6",function(){return b._digitArgument(6)},{name:g.formatMessage(k.digitArgument,"6")});c.setAction("emacs-digit-argument-7",function(){return b._digitArgument(7)},{name:g.formatMessage(k.digitArgument,"7")});c.setAction("emacs-digit-argument-8",
function(){return b._digitArgument(8)},{name:g.formatMessage(k.digitArgument,"8")});c.setAction("emacs-digit-argument-9",function(){return b._digitArgument(9)},{name:g.formatMessage(k.digitArgument,"9")});c.setAction("emacs-negative-argument",function(){return b._negativeArgument()},{name:k.negativeArgument});c.setAction("emacs-uppercase",function(){var e=b._getData();e.unit="word";return c.invokeAction("uppercase",!1,e)},{name:k.uppercase});c.setAction("emacs-lowercase",function(){var e=b._getData();
e.unit="word";return c.invokeAction("lowercase",!1,e)},{name:k.lowercase});c.setAction("emacs-capitalize",function(){var e=b._getData();e.unit="word";return c.invokeAction("capitalize",!1,e)},{name:k.capitalize})};return{EmacsMode:c}});
define("orion/editor/vi",["i18n!orion/editor/nls/messages","orion/editor/keyModes","orion/keyBinding","orion/util"],function(k,n,l,g){function c(a,b){for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d])}function f(a,b,d,c,e,f,g){a=new l.KeyStroke(a,b,d,c,e,f);a.scopeName=g||k.vi;return a}function b(a,b){var d=new l.KeySequence(a);d.scopeName=b||k.vi;return d}function e(a,b,d){this.key=b;this.msg=d;this.number="";n.KeyMode.call(this,a);a&&this._createActions(a)}function d(a){var b=a.getView();this.viMode=
a;n.KeyMode.call(this,b);this._createActions(b)}function m(a,b,d,c){this.viMode=a;this.nextMode=b;e.call(this,a.getView(),d,c)}function a(a){var b=a.getView();n.KeyMode.call(this,b);this.viMode=a;this._createActions(b)}function h(b,d){e.call(this,b,"",k.vimove);this.insertMode=new a(this);this.changeMode=new m(this,this.insertMode,"c",k.vichange);this.deleteMode=new m(this,this,"d",k.videlete);this.yankMode=new m(this,this,"y",k.viyank);this.statusReporter=d}var s,t;e.prototype=new n.KeyMode;c(e.prototype,
{_msg:function(a){return{name:g.formatMessage(k[a],this.msg)}},createKeyBindings:function(){for(var a=[],b=this.key,b=b?"-"+b+"-":"-",d=0;9>=d;d++)a.push({actionID:"vi"+b+d,keyBinding:f(d+"",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi"+b+"Left",keyBinding:f("h",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Left",keyBinding:f("h",!0,!1,!1,!1)});a.push({actionID:"vi"+b+"Left",keyBinding:f(8)});a.push({actionID:"vi"+b+"Left",keyBinding:f(37)});a.push({actionID:"vi"+b+"Down",keyBinding:f("j",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Down",keyBinding:f(40)});a.push({actionID:"vi"+b+"Up",keyBinding:f("k",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Up",keyBinding:f(38)});a.push({actionID:"vi"+b+"Right",keyBinding:f("l",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"Right",keyBinding:f(39)});a.push({actionID:"vi"+b+"Right",keyBinding:f(32)});a.push({actionID:"vi"+b+"w",keyBinding:f("w",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"b",keyBinding:f("b",!1,!1,!1,!1,
"keypress")});a.push({actionID:"vi"+b+"W",keyBinding:f("W",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"B",keyBinding:f("B",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"e",keyBinding:f("e",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"E",keyBinding:f("E",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"$",keyBinding:f("$",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:f("^",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"^_",keyBinding:f("_",!1,!1,!1,!1,"keypress")});
a.push({actionID:"vi"+b+"+",keyBinding:f("+",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"+",keyBinding:f(13)});a.push({actionID:"vi"+b+"-",keyBinding:f("-",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"|",keyBinding:f("|",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"H",keyBinding:f("H",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"M",keyBinding:f("M",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"L",keyBinding:f("L",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"/",
keyBinding:f("/",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"?",keyBinding:f("?",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"n",keyBinding:f("n",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"N",keyBinding:f("N",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"f",keyBinding:f("f",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"F",keyBinding:f("F",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"t",keyBinding:f("t",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"T",keyBinding:f("T",
!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+",",keyBinding:f(",",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+";",keyBinding:f(";",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi"+b+"G",keyBinding:f("G",!1,!1,!1,!1,"keypress")});return a},_createActions:function(a){function b(d){d=a.getModel().getLine(d);for(var c=0,e=d.charCodeAt(c);32===e||9===e;)c++,e=d.charCodeAt(c);return c}function d(a,b){a&&e.getView().setCaretOffset(a.start);b.editDone&&b.editDone()}var c=this.key,c=c?"-"+c+"-":
"-",e=this;a.setAction("vi"+c+"0",function(){return e._storeNumber(0)});a.setAction("vi"+c+"1",function(){return e._storeNumber(1)});a.setAction("vi"+c+"2",function(){return e._storeNumber(2)});a.setAction("vi"+c+"3",function(){return e._storeNumber(3)});a.setAction("vi"+c+"4",function(){return e._storeNumber(4)});a.setAction("vi"+c+"5",function(){return e._storeNumber(5)});a.setAction("vi"+c+"6",function(){return e._storeNumber(6)});a.setAction("vi"+c+"7",function(){return e._storeNumber(7)});a.setAction("vi"+
c+"8",function(){return e._storeNumber(8)});a.setAction("vi"+c+"9",function(){return e._storeNumber(9)});a.setAction("vi"+c+"Left",function(){return e._invoke("charPrevious",{unit:"character"})},this._msg("viLeft"));a.setAction("vi"+c+"Right",function(){return e._invoke("charNext",{unit:"character"})},this._msg("viRight"));a.setAction("vi"+c+"Up",function(){return e._invoke("lineUp",{editLine:!0})},this._msg("viUp"));a.setAction("vi"+c+"Down",function(){return e._invoke("lineDown",{editLine:!0})},
this._msg("viDown"));a.setAction("vi"+c+"w",function(){return e._invoke("wordNext",{unit:"word"})},this._msg("viw"));a.setAction("vi"+c+"b",function(){return e._invoke("wordPrevious",{unit:"word"})},this._msg("vib"));a.setAction("vi"+c+"W",function(){return e._invoke("wordNext",{unit:"wordWS"})},this._msg("viW"));a.setAction("vi"+c+"B",function(){return e._invoke("wordPrevious",{unit:"wordWS"})},this._msg("viB"));a.setAction("vi"+c+"e",function(){e._invoke("charNext",{unit:"character"});e._invoke("wordNext",
{unit:"wordend"});e._invoke("charPrevious",{unit:"character"});return!0},this._msg("vie"));a.setAction("vi"+c+"E",function(){return e._invoke("wordNext",{unit:"wordendWS"})},this._msg("viE"));a.setAction("vi"+c+"$",function(){return e._invoke("lineEnd")},this._msg("vi$"));a.setAction("vi"+c+"^_",function(){return e._invoke(function(){var d=a.getModel(),c=a.getCaretOffset(),c=d.getLineAtOffset(c);a.setCaretOffset(d.getLineStart(c)+b(c))})},this._msg("vi^_"));a.setAction("vi"+c+"+",function(){return e._invoke(function(d){var c=
a.getModel(),e=a.getCaretOffset(),f=c.getLineCount()-1;d=Math.min(c.getLineAtOffset(e)+d.count,f);a.setCaretOffset(c.getLineStart(d)+b(d))},{editLine:!0})},this._msg("vi+"));a.setAction("vi"+c+"-",function(){return e._invoke(function(d){var c=a.getModel(),e=a.getCaretOffset();d=Math.max(c.getLineAtOffset(e)-d.count,0);a.setCaretOffset(c.getLineStart(d)+b(d))},{editLine:!0})},this._msg("vi-"));a.setAction("vi"+c+"|",function(){return e._invoke(function(b){var d=a.getModel(),c=a.getCaretOffset(),c=
d.getLineAtOffset(c);a.setCaretOffset(Math.min(d.getLineStart(c)+b.count-1,d.getLineEnd(c)))})},this._msg("vi|"));a.setAction("vi"+c+"H",function(){return e._invoke(function(b){b=a.getModel().getLineStart(a.getTopIndex(!0)+(b.count-1));a.setCaretOffset(b)},{editLine:!0})},this._msg("viH"));a.setAction("vi"+c+"M",function(){return e._invoke(function(b){b=Math.ceil((a.getBottomIndex(!0)-a.getTopIndex(!0))/2)+a.getTopIndex(!0);a.setCaretOffset(a.getModel().getLineStart(b))},{editLine:!0})},this._msg("viM"));
a.setAction("vi"+c+"L",function(){return e._invoke(function(b){a.setCaretOffset(a.getModel().getLineStart(a.getBottomIndex(!0)-(b.count-1)))},{editLine:!0})},this._msg("viL"));a.setAction("vi"+c+"/",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!1,findCallback:function(b){e._searchFwd=!0;d(b,a)}};return e._invoke("find",a)},this._msg("vi/"));a.setAction("vi"+c+"?",function(){var a={hideAfterFind:!0,incremental:!1,reverse:!0,findCallback:function(b){e._searchFwd=!1;d(b,a)}};return e._invoke("find",
a)},this._msg("vi?"));a.setAction("vi"+c+"n",function(){var b,c=a.getCaretOffset();e._searchFwd?(b="findNext",c++):b="findPrevious";var f={start:c,findCallback:function(a){d(a,f)}};return e._invoke(b,f)},this._msg("vin"));a.setAction("vi"+c+"N",function(){var b,c=a.getCaretOffset();e._searchFwd?b="findPrevious":(b="findNext",c++);var f={start:c,findCallback:function(a){d(a,f)}};return e._invoke(b,f)},this._msg("viN"));a.setAction("vi"+c+"f",function(){var b=a.getModel(),d=a.getCaretOffset();return e._findChar(d,
b.getLineEnd(b.getLineAtOffset(d)),!1,0)},this._msg("vif"));a.setAction("vi"+c+"F",function(){var b=a.getModel(),d=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(d)),d,!0,0)},this._msg("viF"));a.setAction("vi"+c+"t",function(){var b=a.getModel(),d=a.getCaretOffset();return e._findChar(d,b.getLineEnd(b.getLineAtOffset(d)),!1,-1)},this._msg("vit"));a.setAction("vi"+c+"T",function(){var b=a.getModel(),d=a.getCaretOffset();return e._findChar(b.getLineStart(b.getLineAtOffset(d)),
d,!0,1)},this._msg("viT"));a.setAction("vi"+c+",",function(){return e._findNextChar(e._charTempOptions.reverse)},this._msg("vi,"));a.setAction("vi"+c+";",function(){return e._findNextChar(!e._charTempOptions.reverse)},this._msg("vi;"));a.setAction("vi"+c+"G",function(){if(""===e.number){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());e.number=b.getLineCount()}return e._invoke(function(b){b=b||{};b.line=b.count;b.editLine=!0;b.callback=function(){b.editDone&&b.editDone()};a.invokeAction("gotoLine",
!1,b)})},this._msg("viG"))},_invoke:function(a,b){var d=this.getView();b=b||{};b.count=this._getCount();"function"===typeof a?a(b):d.invokeAction(a,!1,b);return!0},_getCount:function(){var a=1;""!==this.number&&(a=this.number>>0);this.number="";return a},_findChar:function(a,b,d,c){this._charTempOptions={};this._charTempOptions.start=a;this._charTempOptions.end=b;this._charTempOptions.hideAfterFind=!0;this._charTempOptions.incremental=!1;this._charTempOptions.reverse=d;this._charTempOptions.offset=
c;var e=this._charTempOptions,f=this;this._charTempOptions.findCallback=function(a){a&&f.getView().setCaretOffset(a.start+c);e.editDone&&e.editDone()};return this._invoke("find",this._charTempOptions)},_findNextChar:function(a){if(this._charTempOptions){var b=this.getView(),d={};d.hideAfterFind=this._charTempOptions.hideAfterFind;d.incremental=this._charTempOptions.incremental;d.reverse=this._charTempOptions.reverse;d.wrap=!1;var c=this;d.findCallback=function(a){a&&c.getView().setCaretOffset(a.start+
c._charTempOptions.offset);d.editDone&&d.editDone()};var e=b.getModel();if(a)return d.start=b.getCaretOffset()+1-this._charTempOptions.offset,d.end=e.getLineEnd(e.getLineAtOffset(d.start)),d.reverse=!1,this._invoke("findNext",d);d.start=b.getCaretOffset()-this._charTempOptions.offset;d.end=e.getLineStart(e.getLineAtOffset(d.start));d.reverse=!0;return this._invoke("findPrevious",d)}return!0},_storeNumber:function(a){var b=this;if(0===a&&!this.number)return this._invoke(function(){b.getView().invokeAction("lineStart",
!0)});this.number+=a;return!0}});d.prototype=new n.KeyMode;c(d.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-:-ESC",keyBinding:f(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-:-ESC",function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=n.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){this.number=a}});m.prototype=new e;c(m.prototype,
{createKeyBindings:function(){var a=e.prototype.createKeyBindings.call(this);a.push({actionID:"vi-"+this.key+"ESC",keyBinding:f(27),predefined:!0});a.push({actionID:"vi-"+this.key+"-"+this.key,keyBinding:f(this.key,!1,!1,!1,!1,"keypress")});return a},_invoke:function(a,b){b=b||{};var d=this.getView(),c=d.getCaretOffset(),f=c,g=d.getModel(),h=this;b.editDone=function(){var a=d.getCaretOffset();if(f>a){var e=f;f=a;a=e}b.editLine&&(f=g.getLineStart(g.getLineAtOffset(f)),a=g.getLineEnd(g.getLineAtOffset(a),
"c"===h.key?!1:!0));"y"===h.key?(s=d.getText(f,a),t=b.editLine,d.setCaretOffset(c)):d.setText("",f,a);d.removeKeyMode(h);d.addKeyMode(h.nextMode)};e.prototype._invoke.call(this,a,b);b.editDone();return!0},_getCount:function(){var a=1;""!==this.firstNumber&&(a=this.firstNumber>>0);var b=1;""!==this.number&&(b=this.number>>0);this.number=this.firstNumber="";return a*b},_createActions:function(a){e.prototype._createActions.call(this,a);var b=this;a.setAction("vi-"+b.key+"ESC",function(){a.removeKeyMode(b);
a.addKeyMode(b.viMode);return!0});a.setAction("vi-"+b.key+"-"+b.key,function(){return b._invoke("lineEnd",{editLine:!0})},this._msg("viycd"))},storeNumber:function(a){this.firstNumber=a},_modeAdded:function(){this.secondNumber=""},_modeRemoved:function(){this.number=this.firstNumber=this.command=""}});a.prototype=new n.KeyMode;c(a.prototype,{createKeyBindings:function(){var a=[];a.push({actionID:"vi-insert-ESC",keyBinding:f(27),predefined:!0});return a},_createActions:function(a){var b=this;a.setAction("vi-insert-ESC",
function(){a.removeKeyMode(b);a.addKeyMode(b.viMode);return!0})},match:function(a){var b=n.KeyMode.prototype.match.call(this,a);b||(b=this.getView().getKeyModes()[0].match(a));return b},storeNumber:function(a){}});h.prototype=new e;c(h.prototype,{createKeyBindings:function(){var a=e.prototype.createKeyBindings.call(this);a.push({actionID:"vi-ctrl-f",keyBinding:f("f",!0)});a.push({actionID:"vi-ctrl-b",keyBinding:f("b",!0)});a.push({actionID:"vi-ctrl-e",keyBinding:f("e",!0)});a.push({actionID:"vi-ctrl-y",
keyBinding:f("y",!0)});a.push({actionID:"statusLineMode",keyBinding:f(":",!1,!1,!1,!1,"keypress")});a.push({actionID:"vi-a",keyBinding:f("a",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-A",keyBinding:f("A",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-i",keyBinding:f("i",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-I",keyBinding:f("I",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-o",keyBinding:f("o",!1,!1,!1,!1,"keypress"),predefined:!0});
a.push({actionID:"vi-O",keyBinding:f("O",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-R",keyBinding:f("R",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-s",keyBinding:f("s",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-S",keyBinding:f("S",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-p",keyBinding:f("p",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-P",keyBinding:f("P",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-u",
keyBinding:f("u",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-c",keyBinding:f("c",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-d",keyBinding:f("d",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-y",keyBinding:f("y",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-~",keyBinding:f("~",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-x",keyBinding:f("x",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-X",keyBinding:f("X",
!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-C",keyBinding:f("C",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-D",keyBinding:f("D",!1,!1,!1,!1,"keypress"),predefined:!0});a.push({actionID:"vi-*",keyBinding:f("*",!1,!1,!1,!1,"keypress"),predefined:!0});return a},getKeyBindings:function(a){var d=n.KeyMode.prototype.getKeyBindings.call(this,a),d=d||[],c=this.changeMode.getKeyBindings(a),e;if(!this.changeMode.isActive())for(e=0;e<c.length;e++)c[e]=b([f("c",!1,!1,!1,!1,"keypress"),
c[e]]);d=d.concat(c);c=this.deleteMode.getKeyBindings(a);if(!this.deleteMode.isActive())for(e=0;e<c.length;e++)c[e]=b([f("d",!1,!1,!1,!1,"keypress"),c[e]]);d=d.concat(c);c=this.yankMode.getKeyBindings(a);if(!this.yankMode.isActive())for(e=0;e<c.length;e++)c[e]=b([f("y",!1,!1,!1,!1,"keypress"),c[e]]);return d.concat(c)},match:function(a){var b=n.KeyMode.prototype.match.call(this,a);!b&&"keypress"===a.type&&(b="noop");return b},_createActions:function(a){e.prototype._createActions.call(this,a);var b=
this;a.setAction("vi-ctrl-f",function(){return b._invoke("pageDown")},{name:k.pageDown});a.setAction("vi-ctrl-b",function(){return b._invoke("pageUp")},{name:k.pageUp});a.setAction("vi-ctrl-e",function(){return b._invoke("scrollLineDown")},{name:k.scrollLineDown});a.setAction("vi-ctrl-y",function(){return b._invoke("scrollLineUp")},{name:k.scrollLineUp});a.setAction("vi-a",function(){return b._toInsertMode("charNext")},{name:k.via});a.setAction("vi-A",function(){return b._toInsertMode("lineEnd")},
{name:k.viA});a.setAction("vi-i",function(){return b._toInsertMode("noop")},{name:k.vii});a.setAction("vi-I",function(){return b._toInsertMode("lineStart")},{name:k.viI});a.setAction("vi-O",function(){b._invoke("lineUp");b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:k.viO});a.setAction("vi-o",function(){b._invoke("lineEnd");b._toInsertMode("enter");return!0},{name:k.vio});a.setAction("vi-R",function(){return b._toInsertMode("toggleOverwriteMode")},{name:k.viR});a.setAction("vi-s",
function(){return b._toInsertMode("deleteNext",{unit:"char"})},{name:k.vis});a.setAction("vi-S",function(){return b._toInsertMode("deleteLines",{unit:"line"})},{name:k.viS});a.setAction("vi-p",function(){return b._invoke(function(){var a=b.getView(),d=a.getSelection();if(d.start===d.end){var c=a.getModel(),e=a.getCaretOffset();t?d.start=d.end=c.getLineEnd(c.getLineAtOffset(e),!0):(d.start++,d.end++)}a.setText(s,d.start,d.end)})},{name:k.vip});a.setAction("vi-P",function(){return b._invoke(function(){var a=
b.getView(),d=a.getSelection();if(d.start===d.end){var c=a.getModel(),e=a.getCaretOffset();t&&(d.start=d.end=c.getLineStart(c.getLineAtOffset(e)))}a.setText(s,d.start,d.end)})},{name:k.viP});a.setAction("vi-u",function(){return b._invoke("undo")},{name:k.Undo});a.setAction("vi-c",function(){a.removeKeyMode(b);a.addKeyMode(b.changeMode);b.changeMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-d",function(){a.removeKeyMode(b);a.addKeyMode(b.deleteMode);b.deleteMode.storeNumber(b.number);
b.number="";return!0});a.setAction("vi-y",function(){a.removeKeyMode(b);a.addKeyMode(b.yankMode);b.yankMode.storeNumber(b.number);b.number="";return!0});a.setAction("vi-~",function(){return b._invoke("reversecase")},{name:k.reversecase});a.setAction("vi-x",function(){return b._invoke("deleteNext")},{name:k.deleteNext});a.setAction("vi-X",function(){return b._invoke("deletePrevious")},{name:k.deletePrevious});a.setAction("vi-C",function(){return b._toInsertMode("deleteLineEnd")},{name:k.viC});a.setAction("vi-D",
function(){return b._invoke("deleteLineEnd")},{name:k.deleteLineEnd});a.setAction("vi-*",function(){var a=b.getView(),d=a.getCaretOffset(),d=a.getNextOffset(d+1,{count:-1,unit:"word"}),c=a.getNextOffset(d,{count:1,unit:"wordend"}),a=a.getText(d,c);b._searchFwd=!0;return b._invoke("find",{hideAfterFind:!0,incremental:!1,reverse:!1,findString:a})},{name:k.viStar})},_reportStatus:function(a){this.statusReporter&&this.statusReporter(a)},_toInsertMode:function(a,b){b=b||{};var d=1;""!==this.number&&(d=
this.number>>0);b.count=d;d=this.getView();this.insertMode.storeNumber(this.number);d.invokeAction(a,!1,b);d.removeKeyMode(this);d.addKeyMode(this.insertMode);this.number="";return!0},_modeAdded:function(){this.getView().setOptions({blockCursorVisible:!0})},_modeRemoved:function(){var a=this.getView();a.setOptions({blockCursorVisible:!1});a.removeKeyMode(this.insertMode);a.removeKeyMode(this.changeMode);a.removeKeyMode(this.deleteMode)}});return{VIMode:h}});
define("orion/editorPreferences",[],function(){function k(g,c){this._preferences=g;if(this._callback=c)var f=g.listenForChangedSettings(n,function(b){b.key===f&&c()}.bind(this))}var n="/editor/settings",l={autoSave:!1,autoSaveVisible:!0,autoSaveLocalVisible:!0,autoSaveTimeout:1E3,autoSaveTimeoutVisible:!0,themeVisible:!0,themeLocalVisible:!0,fontSizeVisible:!0,fontSizeLocalVisible:!0,autoLoad:!0,autoLoadVisible:!0,saveDiffs:!0,saveDiffsVisible:!0,contentAssistAutoTrigger:!0,contentAssistAutoTriggerVisible:!0,
showOccurrences:!1,showOccurrencesVisible:!0,autoPairParentheses:!0,autoPairParenthesesVisible:!0,autoPairBraces:!0,autoPairBracesVisible:!0,autoPairSquareBrackets:!0,autoPairSquareBracketsVisible:!0,autoPairAngleBrackets:!1,autoPairAngleBracketsVisible:!0,autoPairQuotations:!0,autoPairQuotationsVisible:!0,autoCompleteComments:!0,autoCompleteCommentsVisible:!0,smartIndentation:!0,smartIndentationVisible:!0,trimTrailingWhiteSpace:!1,trimTrailingWhiteSpaceVisible:!0,tabSize:4,tabSizeVisible:!0,expandTab:!1,
expandTabVisible:!0,scrollAnimation:!0,scrollAnimationVisible:!0,scrollAnimationTimeout:300,scrollAnimationTimeoutVisible:!0,annotationRuler:!0,annotationRulerVisible:!0,lineNumberRuler:!0,lineNumberRulerVisible:!0,foldingRuler:!0,foldingRulerVisible:!0,overviewRuler:!0,overviewRulerVisible:!0,showTabs:!1,showTabsVisible:!0,showSpaces:!1,showSpacesVisible:!0,wordWrap:!1,wordWrapVisible:!0,showMargin:!1,showMarginVisible:!0,marginOffset:80,marginOffsetVisible:!0,keyBindings:"Default",keyBindingsVisible:!0,
keyBindingsLocalVisible:!0};k.prototype={_initialize:function(g){g=g.get("editorSettings")||{};for(var c in l)g.hasOwnProperty(c)||(g[c]=l[c]);return g},getPrefs:function(g){this._preferences.getPreferences(n).then(function(c){c=this._initialize(c);"string"===typeof c&&(c=JSON.parse(c));g(c)}.bind(this))},setPrefs:function(g,c){this._preferences.getPreferences(n).then(function(f){f.put("editorSettings",g);g=this._initialize(f);c&&c(g);this._callback&&this._callback(g)}.bind(this))}};return{EditorPreferences:k}});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme"],function(k,n){function l(){}function g(){this.styles=[];var c=new l;c.name="Eclipse";c.annotationRuler="white";c.background="white";c.comment="green";c.keyword="#7f0055";c.text="darkSlateGray";c.string="blue";c.overviewRuler="white";c.lineNumberOdd="#444";c.lineNumberEven="#444";c.lineNumber="#444";c.currentLine="#EAF2FE";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=
b;this.styles.push(c);c=new l;c.name="Prospecto";c.annotationRuler="white";c.background="white";c.comment="#3C802C";c.keyword="#CC4C07";c.text="#333";c.string="#446FBD";c.overviewRuler="white";c.lineNumberOdd="silver";c.lineNumberEven="silver";c.lineNumber="silver";c.currentLine="#EAF2FE";c.tag="#CC4C07";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new l;c.name="Blue";c.annotationRuler="lavender";c.background="aliceBlue";c.comment="indigo";c.keyword="cornFlowerBlue";c.text=
"navy";c.string="cornFlowerBlue";c.overviewRuler="lavender";c.lineNumberOdd="darkSlateGray";c.lineNumberEven="darkSlateGray";c.lineNumber="darkSlateGray";c.currentLine="white";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new l;c.name="Ambience";c.annotationRuler="#3D3D3D";c.background="#202020";c.comment="mediumslateblue";c.keyword="cornFlowerBlue";c.text="darkseagreen";c.string="lightcoral";c.overviewRuler="white";c.lineNumberOdd="black";c.lineNumberEven=
"black";c.lineNumber="black";c.currentLine="lightcyan";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new l;c.name="Tierra";c.annotationRuler="moccasin";c.background="lemonchiffon";c.comment="darkseagreen";c.keyword="darkred";c.text="#555555";c.string="orangered";c.overviewRuler="moccasin";c.lineNumberOdd="chocolate";c.lineNumberEven="chocolate";c.lineNumber="chocolate";c.currentLine="#baa289";c.tag="darkred";c.attribute="cadetBlue";c.fontFamily=f;
c.fontSize=b;this.styles.push(c);c=new l;c.name="Nimbus";c.annotationRuler="#444";c.background="dimgray";c.comment="darkseagreen";c.keyword="darkorange";c.text="white";c.string="cornflowerblue";c.overviewRuler="#444";c.lineNumberOdd="#aaa";c.lineNumberEven="#aaa";c.lineNumber="#aaa";c.currentLine="#aabfbb";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new l;c.name="Adelante";c.annotationRuler="#E2D2B2";c.background="#F1E7C8";c.comment="#5D774E";c.keyword=
"#AF473B";c.text="dimgray";c.string="#DE5D3B";c.overviewRuler="#E2D2B2";c.lineNumberOdd="#AF473B";c.lineNumberEven="#AF473B";c.lineNumber="#AF473B";c.currentLine="#9e937b";c.tag="#AF473B";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c);c=new l;c.name="Raspberry Pi";c.annotationRuler="seashell";c.background="seashell";c.comment="#66B32F";c.keyword="#E73E36";c.text="dimgray";c.string="darkorange";c.overviewRuler="seashell";c.lineNumberOdd="#E73E36";c.lineNumberEven="#E73E36";
c.lineNumber="#E73E36";c.currentLine="#F5B1AE";c.tag="#E73E36";c.attribute="cadetBlue";c.fontFamily=f;c.fontSize=b;this.styles.push(c)}function c(){return this.styles}var f='"Consolas", "Monaco", "Vera Mono", "monospace"',b="10pt";g.prototype.styles=[];g.prototype.getStyles=c;g.prototype.fontSettable=!0;g.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected",version:"5.0"}};g.prototype.parseToXML=function(b){try{var d=
null;if(window.DOMParser){var d=(new DOMParser).parseFromString(b,"text/xml"),c=d.getElementsByTagName("parsererror");return!c||!c.length||!c[0].childNodes.length?d:null}d=new ActiveXObject("Microsoft.XMLDOM");d.async=!1;d.loadXML(b);return d}catch(a){}};g.prototype.selectFontSize=function(b){console.log("fontsize: "+b)};g.prototype.importTheme=function(b){console.log("import theme");console.log(b);var d=b.parameters.valueFor("name"),d=this.parseToXML(d),c=new l;c.name=d.getElementsByTagName("colorTheme")[0].attributes[1].value;
c.annotationRuler=d.getElementsByTagName("background")[0].attributes[0].value;c.background=d.getElementsByTagName("background")[0].attributes[0].value;c.comment=d.getElementsByTagName("singleLineComment")[0].attributes[0].value;c.keyword=d.getElementsByTagName("keyword")[0].attributes[0].value;c.text=d.getElementsByTagName("foreground")[0].attributes[0].value;c.string=d.getElementsByTagName("string")[0].attributes[0].value;c.overviewRuler=d.getElementsByTagName("background")[0].attributes[0].value;
c.lineNumberOdd=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.lineNumberEven=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.lineNumber=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.currentLine=d.getElementsByTagName("selectionBackground")[0].attributes[0].value;b.items.addTheme(c)};g.prototype.processSettings=function(b,d){var c=n.TextTheme.getTheme();c.setThemeClass("editorTheme",c.buildStyleSheet("editorTheme",b))};g.prototype.getViewData=function(){var b=
{top:10,left:10,width:400,height:350},d=b.left,c=b.top;b.shapes=[{type:"TEXT",name:k["Line Numbers"],label:"1",x:d+20,y:c+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:k.Background,x:d+46,y:c,width:290,height:b.height,family:"background",fill:"white"},{type:"TEXT",name:k.Strings,label:"'text/javascript'",x:d+134,y:c+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"\x3d",x:d+124,y:c+20,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"RECTANGLE",name:k["Current Line"],x:d+46,y:c+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:k["HTML Attribute"],label:"type",x:d+98,y:c+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:k["Overview Ruler"],x:d+336,y:c,width:14,height:b.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:k.Comments,label:"/* comment */",x:d+75,y:c+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},
{type:"TEXT",name:k["HTML Tag"],label:"\x3cscript",x:d+55,y:c+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3e",x:d+213,y:c+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Strings,label:"'Result'",x:d+164,y:c+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"multiply(a,b){",x:d+120,y:c+60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",
name:k.Keywords,label:"function",x:d+75,y:c+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Keywords,label:"var",x:d+95,y:c+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"output \x3d ",x:d+115,y:c+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:";",x:d+205,y:c+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Keywords,label:"var",x:d+
95,y:c+100,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"result \x3d a*b;",x:d+115,y:c+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Keywords,label:"return",x:d+95,y:c+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"output + result;",x:d+135,y:c+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"}",x:d+75,y:c+140,
fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3c/script\x3e",x:d+55,y:c+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3cstyle",x:d+55,y:c+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Attribute"],label:"type",x:d+95,y:c+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",name:k.Foreground,label:"\x3d",x:d+121,y:c+200,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k.Strings,label:"'text/css'",x:d+131,y:c+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k["HTML Tag"],label:"\x3e",x:d+180,y:c+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Class Name"],label:".some-class",x:d+75,y:c+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Class Name"],label:"{",x:d+145,y:c+220,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Attribute"],label:"color:",x:d+95,y:c+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Value"],label:"#123456",x:d+130,y:c+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Text"],label:";",x:d+180,y:c+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:k["CSS Class Name"],label:"}",x:d+75,y:c+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:k["HTML Tag"],label:"\x3c/style\x3e",x:d+55,y:c+280,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:k["Annotation Ruler"],x:d,y:c,width:46,height:b.height,family:"annotationRuler",fill:"white"}];for(var a=0;16>a;a++)b.shapes.push({type:"TEXT",name:k["Line Numbers"],label:a+1,x:d+20,y:c+20*a+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return b};return{ThemeData:g,getStyles:c}});
define("orion/widgets/input/TextField",["orion/objects","orion/webui/littlelib"],function(k,n){function l(g,c){k.mixin(this,g);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.textfield=n.$(".setting-control",this.node)}k.mixin(l.prototype,{templateString:'\x3cinput type\x3d"text" class\x3d"setting-control" name\x3d"myname"/\x3e',category:null,item:null,element:null,ui:null,show:function(){this.textfield.addEventListener("change",this.change.bind(this));this.postCreate()},
destroy:function(){this.node&&(n.empty(this.node),this.textfield=this.node=null)},setStorageItem:function(){},width:function(g){this.textfield.style.width=g},getValue:function(){return"integer"===this.inputType?parseInt(this.textfield.value,10):this.textfield.value},setValue:function(g){this.textfield.value=g},getSelection:function(){return this.getValue()},setSelection:function(g){this.setValue(g)},postCreate:function(){this.inputType&&"password"===this.inputType&&(this.textfield.type="password");
this.editmode&&"readonly"===this.editmode&&this.textfield.setAttribute("readonly","true")},change:function(){var g;this.selection&&this.selection.value&&(g=this.selection.value);this.setStorageItem(this.category,this.item,this.element,g,this.ui)}});return l});
define("orion/widgets/input/LabeledTextfield",["orion/objects","orion/webui/littlelib","orion/widgets/input/TextField"],function(k,n,l){function g(c,f){l.apply(this,arguments);this.mylabel=n.$(".setting-label",this.node)}k.mixin(g.prototype,l.prototype,{templateString:'\x3cdiv class\x3d"setting-property"\x3e\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cinput class\x3d"setting-control" type\x3d"text" /\x3e\x3c/label\x3e\x3c/div\x3e',destroy:function(){l.prototype.destroy.call(this);
this.mylabel&&(this.mylabel=null)},postCreate:function(){l.prototype.postCreate.call(this);this.mylabel.textContent=this.fieldlabel+":"}});return g});
define("orion/widgets/input/Checkbox",["orion/objects","orion/webui/littlelib"],function(k,n){function l(g,c){k.mixin(this,g);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.checkbox=n.$(".setting-control",this.node)}k.mixin(l.prototype,{templateString:'\x3clabel\x3e\x3cinput class\x3d"setting-control settingsCheckbox" type\x3d"checkbox"/\x3e\x3c/label\x3e',show:function(){this.checkbox.addEventListener("change",this.change.bind(this));this.postCreate()},destroy:function(){this.node&&
(n.empty(this.node),this.checkbox=this.node=null)},setStorageItem:function(){},isChecked:function(){return this.checkbox.checked},setChecked:function(g){this.checkbox.checked=g},getSelection:function(){return this.isChecked()},setSelection:function(g){this.setChecked(g)},change:function(){this.setStorageItem(this.checkbox.value)},postCreate:function(){this.checkbox.style.width="20px";this.editmode&&"readonly"===this.editmode&&this.checkbox.setAttribute("disabled","disabled")}});return l});
define("orion/widgets/input/LabeledCheckbox",["orion/objects","orion/webui/littlelib","orion/widgets/input/Checkbox"],function(k,n,l){function g(c,f){l.apply(this,arguments);this.mylabel=n.$(".setting-label",this.node)}k.mixin(g.prototype,l.prototype,{templateString:'\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cinput class\x3d"setting-control settingsCheckbox" type\x3d"checkbox"/\x3e\x3c/label\x3e',postCreate:function(){l.prototype.postCreate.call(this);this.mylabel.textContent=
this.fieldlabel+":"},destroy:function(){l.prototype.destroy.call(this);this.mylabel&&(this.mylabel=null)}});return g});
define("orion/widgets/input/Select",["orion/objects","orion/webui/littlelib"],function(k,n){function l(g,c){k.mixin(this,g);this.node=c||document.createElement("div");this.node.innerHTML=this.templateString;this.select=n.$(".setting-control",this.node)}k.mixin(l.prototype,{templateString:'\x3cselect class\x3d"setting-control" id\x3d"selection"\x3e\x3c/select\x3e',addOptions:function(g,c,f){c=document.createElement("option");c.value=g.value;c.appendChild(document.createTextNode("string"===typeof g.label?
g.label:g.value));g.selected&&(c.selected="selected");this.select.appendChild(c)},show:function(){this.postCreate()},postCreate:function(){this.options.forEach(this.addOptions.bind(this));this.select.addEventListener("change",this.change.bind(this))},destroy:function(){this.node&&(n.empty(this.node),this.node=this.select=null)},setStorageItem:function(){},getSelected:function(){return this.select.value},getSelectedIndex:function(){return this.select.selectedIndex},setSelectedIndex:function(g){this.select.selectedIndex=
g},getSelection:function(){return this.getSelected()},setSelection:function(g){for(var c=0;c<this.options.length;c++)if(this.options[c].value===g){this.setSelectedIndex(c);return}this.setSelectedIndex(0)},change:function(){var g=this.select.value;this.category?this.setStorageItem(this.category,this.item,this.element,g,this.ui):this.setStorageItem(g)}});return l});
define("orion/widgets/input/LabeledSelect",["orion/objects","orion/webui/littlelib","orion/widgets/input/Select"],function(k,n,l){function g(c,f){l.apply(this,arguments);this.mylabel=n.$(".setting-label",this.node)}k.mixin(g.prototype,l.prototype,{templateString:'\x3cdiv class\x3d"setting-property"\x3e\x3clabel\x3e\x3cspan class\x3d"setting-label"\x3e\x3c/span\x3e\x3cselect class\x3d"setting-control"\x3e\x3c/select\x3e\x3c/label\x3e\x3c/div\x3e',postCreate:function(){l.prototype.postCreate.call(this);
this.mylabel.textContent=this.fieldlabel+":"},destroy:function(){l.prototype.destroy.call(this);this.mylabel&&(this.mylabel=null)}});return g});
define("orion/widgets/settings/Subsection",[],function(){function k(k){var l=k.sectionName;this.parentNode=k.parentNode;this.children=k.children;k=document.createElement("section");k.classList.add("setting-row");k.setAttribute("role","region");k.setAttribute("aria-labelledby","Navigation-header");var g=document.createElement("h3");g.classList.add("setting-header");g.textContent=l;l=document.createElement("div");l.classList.add("setting-content");k.appendChild(g);k.appendChild(l);this.node=k;this.subsectionContent=
l}k.prototype.show=function(){this.parentNode&&this.parentNode.appendChild(this.node);if(this.children){var k=this;this.children.forEach(function(l){k.subsectionContent.appendChild(l.node);l.show()})}};return k});
define("orion/widgets/settings/EditorSettings","i18n!orion/settings/nls/messages orion/widgets/input/LabeledTextfield orion/widgets/input/LabeledCheckbox orion/widgets/input/LabeledSelect orion/section orion/widgets/settings/Subsection orion/commands orion/objects orion/webui/littlelib".split(" "),function(k,n,l,g,c,f,b,e,d){function m(a,b,c,e,f){if(!e.local){var g=document.createElement("span");g.classList.add(q);g.classList.add(f[b+"LocalVisible"]?r:v);g.title=k.localSettingsTooltip;g.addEventListener("click",
function(a){g.classList.contains(v)?(g.classList.add(r),g.classList.remove(v)):(g.classList.add(v),g.classList.remove(r))});b=d.$("label",a.node);b.parentNode.insertBefore(g,b)}return a}function a(a,b,d){return m(new l(b),a,this,b,d)}function h(a,b,d){b.inputType="integer";return m(new n(b),a,this,b,d)}function s(a,b){return!(this.min<=b[a]&&b[a]<=this.max)?k[a+"Invalid"]:""}function t(a,b){e.mixin(this,a);this.node=b}var q="setting-local-indicator",r="on",v="off",u={editorSettings:{keys:{keyBindings:{values:[{value:"",
label:k.Default},{value:"Emacs",label:"Emacs"},{value:"vi",label:"vi"}],create:function(a,b,d){var c=this.values;b.options=[];for(var e=0;e<c.length;e++){var f=c[e],h={value:f.value,label:f.label};f.value===d[a]&&(h.selected=!0);b.options.push(h)}return m(new g(b),a,this,b,d)}}},fileManagement:{autoSave:{create:a},autoSaveTimeout:{min:50,max:1E4,create:h,validate:s},autoLoad:{create:a},saveDiffs:{create:a},trimTrailingWhiteSpace:{create:a}},typing:{autoPairQuotations:{create:a},autoPairParentheses:{create:a},
autoPairBraces:{create:a},autoPairSquareBrackets:{create:a},autoPairAngleBrackets:{create:a},autoCompleteComments:{create:a},smartIndentation:{create:a}},tabs:{tabSize:{min:1,max:16,create:h,validate:s},expandTab:{create:a}},whitespaces:{showTabs:{create:a},showSpaces:{create:a}},wrapping:{wordWrap:{create:a},showMargin:{create:a},marginOffset:{min:10,max:200,create:h,validate:s}},smoothScrolling:{scrollAnimation:{create:a},scrollAnimationTimeout:{min:50,max:1E3,create:h,validate:s}},rulers:{annotationRuler:{create:a},
lineNumberRuler:{create:a},foldingRuler:{create:a},overviewRuler:{create:a}},languageTools:{showOccurrences:{create:a},contentAssistAutoTrigger:{create:a}}}};e.mixin(t.prototype,{templateString:'\x3cdiv class\x3d"sections"\x3e\x3c/div\x3e',commandTemplate:'\x3cdiv id\x3d"commandButtons"\x3e\x3cdiv id\x3d"editorCommands" class\x3d"layoutRight sectionActions"\x3e\x3c/div\x3e\x3c/div\x3e',createElements:function(){this.node.innerHTML=this.templateString;this.sections=d.$(".sections",this.node);this.createSections();
this.local?this.sections.classList.add("local"):(document.getElementById("pageActions").innerHTML=this.commandTemplate,this.createToolbar())},createSections:function(){var a=this.oldPrefs,b=[],e,h,m=this.themePreferences;if(!this.local&&this.editorThemeWidget)this.editorThemeSection=new c.Section(this.sections,{id:"editorThemeSettings",title:k.EditorThemes,canHide:!0,slideout:!0}),this.editorThemeWidget.renderData(this.editorThemeSection.getContentElement(),"INITIALIZE");else{var l=this.oldThemeStyles;
if(a.themeVisible&&(!this.local||a.themeLocalVisible)){var n=l.styles;e=[];for(var s=0;s<n.length;s++)h={value:n[s].name,label:n[s].name},n[s].name===l.style.name&&(h.selected=!0),e.push(h);b.push(e=this.themeSelect=new g({fieldlabel:k.Theme,options:e}));e.setStorageItem=function(a){m.setTheme(a)}}if(a.fontSizeVisible&&(!this.local||a.fontSizeLocalVisible)){l=l.style.fontSize;e=[];for(n=8;19>n;n++)h={value:n+"pt",label:n+"pt"},h.label===l&&(h.selected=!0),e.push(h);b.push(e=this.sizeSelect=new g({fieldlabel:k["Font Size"],
options:e}));e.setStorageItem=function(a){m.setFontSize(a)}}!this.local&&0<b.length&&(b=new f({sectionName:k.Theme,parentNode:this.editorThemeSection.getContentElement(),children:b}),b.show(),b=[])}var t,E;for(E in u)if(u.hasOwnProperty(E)){this.local||(t=new c.Section(this.sections,{id:E,title:k[E],canHide:!0,slideout:!0}),e=document.createElement("div"),e.classList.add("setting-info"),e.textContent=k.editorSettingsInfo,h=document.createElement("span"),h.classList.add(q),h.classList.add(r),l=document.createElement("span"),
l.classList.add(q),l.classList.add(v),n=document.createElement("span"),n.classList.add("core-sprite-wrench"),n.classList.add("icon-inline"),n.classList.add("imageSprite"),d.processDOMNodes(e,[h,l,n]),t.getContentElement().appendChild(e));for(var G in u[E])if(u[E].hasOwnProperty(G)){for(var H in u[E][G])if(a[H+"Visible"]&&(!this.local||a[H+"LocalVisible"]))h=u[E][G][H],e={},e.local=this.local,e.fieldlabel=k[H],b.push(h.widget=h.create(H,e,a));!this.local&&0<b.length&&(b=new f({sectionName:k[G],parentNode:t.getContentElement(),
children:b}),b.show(),b=[])}}this.local&&b.forEach(function(a){this.sections.appendChild(a.node);a.hasOwnProperty("setStorageItem")||(a.setStorageItem=this.update.bind(this));a.show()}.bind(this))},createToolbar:function(){var a=d.node("editorSettingsToolActionsArea"),c=new b.Command({name:k.Restore,tooltip:k["Restore default Editor Settings"],id:"orion.restoreeditorsettings",callback:function(a){this.restore(a.items)}.bind(this)});this.commandService.addCommand(c);this.commandService.registerCommandContribution("restoreEditorSettingCommand",
"orion.restoreeditorsettings",2);this.commandService.renderCommands("restoreEditorSettingCommand",a,this,this,"button");c=new b.Command({name:k.Update,tooltip:k["Update Editor Settings"],id:"orion.updateeditorsettings",callback:function(a){this.update(a.items)}.bind(this)});this.commandService.addCommand(c);this.commandService.registerCommandContribution("editorSettingCommand","orion.updateeditorsettings",1);this.commandService.renderCommands("editorSettingCommand",a,this,this,"button")},valueChanged:function(){var a=
{},b;for(b in this.oldPrefs)this.oldPrefs.hasOwnProperty(b)&&(a[b]=this.oldPrefs[b]);this.getValues(a);for(var d in a)if(a.hasOwnProperty(d)&&a[d]!==this.oldPrefs[d])return a},validate:function(a){var b="";this._forEach(function(d,c){return c.validate&&(b=c.validate(d,a))?!1:!0});return b},_progress:function(a,b){this.registry&&this.registry.getService("orion.page.message").setProgressResult({Message:a,Severity:b})},update:function(){var a=this.valueChanged();if(a){var b=this.validate(a);if(b){this._progress(b,
"Error");return}this.preferences.setPrefs(a,function(){this.setValues(this.oldPrefs=a);this._progress(k["Editor preferences updated"],"Normal")}.bind(this))}else this.setValues(this.oldPrefs);this.editor&&this.editor.focus()},restore:function(){this.preferences.setPrefs({},function(a){this._show(a);this._progress(k["Editor defaults restored"],"Normal")}.bind(this))},show:function(a,b){a&&(this.node=a);this.themePreferences.getTheme(function(a){this.preferences.getPrefs(function(d){this._show(d,a);
b&&b()}.bind(this))}.bind(this))},_show:function(a,b){b&&(this.oldThemeStyles=b);this.oldPrefs=a;this.createElements();this.setValues(a)},_forEach:function(a){for(var b in u)if(u.hasOwnProperty(b))for(var d in u[b])if(u[b].hasOwnProperty(d))for(var c in u[b][d])if(u[b][d].hasOwnProperty(c)){var e=u[b][d][c];if(e.widget&&!a(c,e))return}},getValues:function(a){this._forEach(function(b,c){a[b]=c.widget.getSelection();if(!this.local){var e=d.$("."+q,c.widget.node);a[b+"LocalVisible"]=e&&e.classList.contains(r)}return!0}.bind(this))},
setValues:function(a){this._forEach(function(b,c){c.widget.setSelection(a[b]);if(!this.local){var e=d.$("."+q,c.widget.node);e&&(a[b+"LocalVisible"]?(e.classList.add(r),e.classList.remove(v)):(e.classList.add(v),e.classList.remove(r)))}return!0}.bind(this))},destroy:function(){this.node&&(this.node=null);this.editorThemeWidget&&(this.editorThemeWidget.destroy(),this.editorThemeWidget=null)}});return t});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace All":"Replace All",
"Search ${0}":"Search ${0}","Type a keyword or wild card to search in ":"Type a keyword or wild card to search in ","Search failed.":"Search failed.","No matches found for ${0}":"No matches found for ${0}","Searching...":"Searching...","Resource has been changed by others.":"Resource has been changed by others.","Failed to write file.":"Failed to write file.",Results:"Results","Files ${0} of ${1} matching ${2}":"Files ${0} of ${1} matching ${2}","Replace ${0} with ${1} for files ${2} of ${3}":"Replace ${0} with ${1} for files ${2} of ${3}",
Location:"Location","Click to compare":"Click to compare",'Search again in this folder with "${0}"':'Search again in this folder with "${0}"',"Files replaced":"Files replaced",Status:"Status","${0} out of ${1}  matches replaced.":"${0} out of ${1}  matches replaced.","Replace all matches with...":"Replace all matches with...","Apply Changes":"Apply Changes","Replace all selected matches":"Replace all selected matches","Hide Compare":"Hide Compare","Hide compare view of changes":"Hide compare view of changes",
"Show Compare":"Show Compare","Show compare view of changes":"Show compare view of changes","Show All":"Show All","Show all the results in one page":"Show all the results in one page","\x3c Previous Page":"\x3c Previous Page","Show previous page of search result":"Show previous page of search result","Next Page \x3e":"Next Page \x3e","Show next page of search result":"Show next page of search result","Next result":"Next result","Previous result":"Previous result","Expand all results":"Expand all results",
"Collapse all results":"Collapse all results","Writing files...":"Writing files...","Preparing preview...":"Preparing preview...","Replaced File (${0})":"Replaced File (${0})","Original File (${0})":"Original File (${0})","Sort by Name":"Sort by Name","Compare changes":"Compare changes","Search Results":"Search Results","Replace All Matches":"Replace All Matches","No matches":"No matches",Rename:"Rename","My Saved Searches":"My Saved Searches","Save frequently used searches by choosing ${0} shown above.":"Save frequently used searches by choosing ${0} shown above.",
"Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.","Files that contain:":"Files that contain:",Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","Sort by":"Sort by","File name":"File name","Path name":"Path name",
Save:"Save","Type a name for the search":"Type a name for the search","Save the current search":"Save the current search","Type filter text":"Type filter text","Scope Search":"Scope Search","Open in Search page for this directory":"Open the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.","Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",
"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",root:"root",Scope:"Scope"});
define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(k){function n(l,g,c){k.attach(this);this._binderFunc=g;this.setInputField(l);(l=c?c.group:null)||(l=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=l+"__completion__";this._proposeFromStart=c?c.proposeFromStart:!1;this._extendedProvider=c?c.extendedProvider:null;this._serviceRegistry=c?c.serviceRegistry:null;this._onDelete=c?c.onDelete:null;this._deleteToolTips=
c?c.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];c=function(c){this._binderFunc&&this._binderFunc(function(b){this._bind(b);c.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",c);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:c});c=function(c){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",c);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:c});c=function(c){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",c);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:c})}n.prototype._removeListeners=function(k){k&&k.forEach(function(g){g.evtTarget.removeEventListener(g.type,g.handler,!1)})};n.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};n.prototype.hasValueOf=function(k){return this._dataList.some(function(g){return g.value===k})};n.prototype.setInputField=function(k){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=k;"string"===typeof this._inputField&&(this._inputField=document.getElementById(this._inputField));k=function(g){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):this._dismiss()}.bind(this);this._inputField.addEventListener("blur",k);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:k});k=function(g){this.onKeyDown(g)}.bind(this);this._inputField.addEventListener("keydown",k);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:k});k=function(g){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",k);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:k});k=function(g){this._dismissed&&this._binderFunc&&(this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(c){this._bind(c)}.bind(this)))}.bind(this);this._inputField.addEventListener("focus",k);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:k})};n.prototype.onKeyDown=function(k){if(this._dismissed)return!0;var g=k.charCode||k.keyCode;if(13===g){if(this._proposalList&&0<this._proposalList.length&&0<=this._proposalIndex&&
this._proposalIndex<this._proposalList.length)return k.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,k.ctrlKey),k.stopPropagation(),!1}else{if((40===g||38===g)&&this._proposalList&&0<this._proposalList.length)return k.preventDefault(),this._walk(40===g),k.stopPropagation(),!1;if(27===g)return k.preventDefault(),this._dismiss(),!1;if(46===g&&-1<this._proposalIndex&&this._onDelete)return k.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),k.stopPropagation(),!1}return!0};n.prototype._resetIndexAfterDeletion=function(){1>=this._proposalList.length?this._proposalIndex=-1:this._proposalIndex===this._proposalList.length-1&&(this._proposalIndex=this._proposalList.length-2)};n.prototype._bind=function(k){this._dataList=k};n.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};n.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
n.prototype._initUI=function(){(this._completionUIContainer=document.getElementById(this._getUIContainerID()))||(this._completionUIContainer=document.createElement("div"),this._completionUIContainer.id=this._getUIContainerID(),this._completionUIContainer.style.display="none",this._completionUIContainer.className="inputCompletionContainer",this._completionUIContainer.setAttribute("role","list"),this._completionUIContainer.setAttribute("aria-atomic","true"),this._completionUIContainer.setAttribute("aria-live",
"assertive"),document.body.appendChild(this._completionUIContainer));this._completionUIContainer.textContent="";(this._completionUL=document.getElementById(this._getUIProposalListId()))||(this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL");this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};n.prototype._createProposalLink=function(k,g,c,f){var b=document.createElement("a");
b.href=require.toUrl(g);b.appendChild(this._createBoldText(k,c,f));return b};n.prototype._createBoldText=function(k,g,c,f){if(0>g)return document.createTextNode(k);f=f?f:document.createElement("span");var b;0!==g&&(b=document.createTextNode(k.substring(0,g)),f.appendChild(b));var e=document.createElement("b");f.appendChild(e);b=document.createTextNode(k.substring(g,g+c));e.appendChild(b);g+c<k.length&&(b=document.createTextNode(k.substring(g+c)),f.appendChild(b));return f};n.prototype._proposeOnCategory=
function(k,g){if(0!==g.length){var c;if(k){c=document.createElement("li");c.className="inputCompletionLICategory";var f=document.createTextNode(k);c.appendChild(f);this._completionUL.appendChild(c)}g.forEach(function(b){c=document.createElement("li");c.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);c.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);c.className="inputCompletionLINormal";c.completionItem=b.item;var e;if("string"===typeof b.item.value){var d=
document.createElement("table");d.style.width="100%";d.style.tableLayout="fixed";d.style.borderSpacing="0";var f=document.createElement("tr");f.style.width=this._inputField.offsetWidth+"px";d.appendChild(f);var a=document.createElement("td");a.classList.add("inputCompletionLILeftTD");var g=this._createBoldText(b.item.value,b.boldIndex,b.boldLength);a.appendChild(g);a.style.overflow="hidden";f.appendChild(a);this._onDelete&&(e=document.createElement("button"),e.classList.add("inputCompletionDismissButton"),
e.classList.add("layoutRight"),e.classList.add("core-sprite-close"),e.classList.add("imageSprite"),e.style.display="none",e.style.margin="0 0 0",e.title=this._deleteToolTips,e.onclick=function(a){a.stopPropagation();this._onDelete(b.item.value,this);this._resetIndexAfterDeletion()}.bind(this),a=document.createElement("td"),a.classList.add("inputCompletionLIRightTD"),a.appendChild(e),f.appendChild(a));c.appendChild(d)}else b.item.value.name&&"link"===b.item.value.type&&c.appendChild(this._createProposalLink(b.item.value.name,
b.item.value.value,b.boldIndex,b.boldLength));this._completionUL.appendChild(c);this._proposalList.push({item:b.item,domNode:c,deleteBtn:e})}.bind(this))}};n.prototype._domNode2Index=function(k){if(this._proposalList)for(var g=0;g<this._proposalList.length;g++)if(this._proposalList[g].domNode===k)return g;return-1};n.prototype._highlight=function(k,g){var c=k,f,b=!1;isNaN(c)||(b=!0,this._proposalList&&0<=k&&k<this._proposalList.length?(c=this._proposalList[k].domNode,f=this._proposalList[k].deleteBtn):
c=null);c&&(c.className=g?"inputCompletionLISelected":"inputCompletionLINormal",f&&(f.style.display=g?"":"none"),g&&b&&(c.offsetTop<this._completionUIContainer.scrollTop?c.scrollIntoView(!0):c.offsetTop+c.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&c.scrollIntoView(!1)))};n.prototype._selectProposal=function(k,g){var c=k;isNaN(c)&&(c=this._domNode2Index(k));if(c!==this._proposalIndex||g)this._highlight(this._proposalIndex,!1),this._proposalIndex=c,
this._highlight(this._proposalIndex,!0)};n.prototype._dismiss=function(k,g){this._mouseDown||(this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,"string"===typeof k?(this._inputField.value=k,this._dismissing=!0,this._inputField.focus()):k&&k.name&&"link"===k.type&&(g?window.open(k.value):window.location.href=k.value),window.setTimeout(function(){this._completionUIContainer.style.display="none"}.bind(this),200))};n.prototype._show=function(){if(this._proposalList&&0<this._proposalList.length){for(var k=
0,g=0,c=this._inputField;c;)k+=c.offsetLeft,g+=c.offsetTop,c=c.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=g+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=k+"px";this._completionUIContainer.style.width=this._inputField.offsetWidth+"px";this._dismissed=this._mouseDown=!1}else this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,this._completionUIContainer.style.display="none"};n.prototype._walk=function(k){k=
this._proposalIndex+(k?1:-1);-1>k?k=this._proposalList.length-1:k>=this._proposalList.length&&(k=-1);this._selectProposal(k)};n.prototype._proposeOnList=function(k,g,c){var f="",b=[],e=g?g.length:0;k.forEach(function(d){if("category"===d.type)this._proposeOnCategory(f,b),f=d.label,b=[];else{var k=!0,a=-1;if(g&&c){var h;"string"===typeof d.value?h=d.value.toLowerCase():d.value.name&&(h=d.value.name.toLowerCase());a=h.indexOf(g);0>a?k=!1:this._proposeFromStart&&(k=0===a)}k&&b.push({item:d,boldIndex:a,
boldLength:e})}}.bind(this));this._proposeOnCategory(f,b)};n.prototype._proposeOn=function(k){this._completionUL.textContent="";var g=k?k.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,g,!0);this._extendedProvider&&g?this._extendedProvider(k,function(c){c&&c.forEach(function(c){this._proposeOnList(c.proposals,c.filterForMe?g:k,c.filterForMe)}.bind(this));this._show()}.bind(this),[]):this._show()};n.prototype.constructor=n;return{InputCompletion:n}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages orion/editor/find orion/commands orion/objects orion/searchUtils orion/inputCompletion/inputCompletion orion/webui/littlelib".split(" "),function(k,n,l,g,c,f,b){function e(b,c,a,e,f){n.Find.call(this,b,e,f);this._serviceRegistry=c;this._commandService=a}e.prototype=new n.Find;g.mixin(e.prototype,{getFindString:function(){var b=document.getElementById("localSearchFindWith");return!b?n.Find.prototype.getFindString.call(this):
b.value},getReplaceString:function(){var b=document.getElementById("localSearchReplaceWith");return!b?n.Find.prototype.getReplaceString(this):b.value},hide:function(){var b=this.isVisible();n.Find.prototype.hide.call(this);b&&this._commandService.closeParameterCollector()},show:function(b){n.Find.prototype.show.call(this,b);var c=b.findString;this._addRecentfind(c);b=b.replaceString;var a=document.getElementById("localSearchFindWith");a||(this._createActionTable(),a=document.getElementById("localSearchFindWith"));
c&&(a.value=c);b&&(document.getElementById("localSearchReplaceWith").value=b);window.setTimeout(function(){a.select();a.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw\x3d\x3d",this._replaceInfo.title=k["Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]):
(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAEAAACH5BAEAABIALAAAAAAHAAgAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAgsAPcpQzMJjbJ9xNAQQ6hwUqaHDws+3PeQoMN9DiUuzFRQ2ZiDyyYdHFhwYUAAOw\x3d\x3d",
this._replaceInfo.title=k["Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]);this._replaceInfo.style.display=""},_createActionTable:function(){var b=this;this._commandService.openParameterCollector("pageNavigationActions",function(c){var a=document.createElement("input");a.type="text";a.name=k["Find:"];a.className="parameterInput";a.id="localSearchFindWith";
a.placeholder=k["Find With"];a.oninput=function(a){return b._handleInput(a)};a.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(a);b._initCompletion(a);b._createButton(k.Next,c,function(){b._addRecentfind(b.getFindString());b.find(!0)});b._createButton(k.Previous,c,function(){b._addRecentfind(b.getFindString());b.find(!1)});var e=b._editor.getTextView().getOptions("readonly");if(!e){var f=document.createElement("input");f.type="text";f.name=k["ReplaceWith:"];f.className="parameterInput";
f.id="localSearchReplaceWith";f.placeholder=k["Replace With"];f.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(f);b._replaceInfo=b._createInfoImage(null,c,null);b._showReplaceInfo();b._createButton(k.Replace,c,function(){b.replace()});b._createButton(k["Replace All"],c,function(){b.replaceAll()})}f=document.createElement("div");c.appendChild(f);f.classList.add("findOptionsDiv");var g=l.createDropdownMenu(f,k.Options,null,"dismissButton",null,!0);g.menuButton.classList.add("parameterInlineButton");
l.createCheckedMenuItem(g.menu,k["Show all"],b._showAll,function(a){b.setOptions({showAll:a.target.checked});g.dropdown.close(!0)});l.createCheckedMenuItem(g.menu,k["Case sensitive"],!b._caseInsensitive,function(a){b.setOptions({caseInsensitive:!a.target.checked});g.dropdown.close(!0);b.find(!0)});l.createCheckedMenuItem(g.menu,k["Wrap search"],b._wrap,function(a){b.setOptions({wrap:a.target.checked});g.dropdown.close(!0)});l.createCheckedMenuItem(g.menu,k["Incremental search"],b._incremental,function(a){b.setOptions({incremental:a.target.checked});
g.dropdown.close(!0)});l.createCheckedMenuItem(g.menu,k["Whole Word"],b._wholeWord,function(a){b.setOptions({wholeWord:a.target.checked});g.dropdown.close(!0);b.find(!0)});b._regExBox=l.createCheckedMenuItem(g.menu,k["Regular expression"],b._regex,function(a){b.setOptions({regex:a.target.checked});g.dropdown.close(!0);b.find(!0);b._showReplaceInfo()});e||l.createCheckedMenuItem(g.menu,k["Find after replace"],b._findAfterReplace,function(a){b.setOptions({findAfterReplace:a.target.checked});g.dropdown.close(!0)});
return a},function(){b.hide()})},_storeRecentFind:function(b,c,a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){e.put("recentFind",b);c&&window.setTimeout(function(){c.dispatchEvent({type:"inputDataListChanged",deleting:a})}.bind(this),20)})},_addRecentfind:function(b){"string"===typeof b&&b&&(!this._completion||!this._completion.hasValueOf(b))&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var a;
c=c.get("recentFind");"string"===typeof c&&(c=JSON.parse(c));if(c){for(a in c)if(c[a].name===b)return;30<=c.length&&c.splice(29,c.length-30+1)}else c=[];c.splice(0,0,{name:b});this._storeRecentFind(c,this._completion)}.bind(this))},_removeRecentSearch:function(b,c){"string"===typeof b&&b&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var e;a=a.get("recentFind");"string"===typeof a&&(a=JSON.parse(a));if(a)for(e in a)if(a[e].name===b){a.splice(e,
1);this._storeRecentFind(a,c,!0);break}}.bind(this))},_initCompletion:function(b){if(this._completion)this._completion.setInputField(b);else{var c=function(a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get("recentFind");"string"===typeof b&&(b=JSON.parse(b));if(b){var d=[];b.forEach(function(a){d.push({type:"proposal",label:a.name,value:a.name})});a(d)}})}.bind(this);this._completion=new f.InputCompletion(b,c,{serviceRegistry:this._serviceRegistry,
group:"localSearch",onDelete:function(a,b){this._removeRecentSearch(a,b)}.bind(this),deleteToolTips:k["Click or use delete key to delete the search term"]})}},_createButton:function(d,c,a){var e=document.createElement("button");e.addEventListener("click",a.bind(this),!1);var f=this;e.addEventListener("keydown",function(a){a.keyCode===b.KEY.ESCAPE&&f.hide()});e.appendChild(document.createTextNode(d));e.className="dismissButton parameterInlineButton";c.appendChild(e)},_createInfoImage:function(b,c,
a){b=document.createElement("img");b.classList.add("replaceInfo");b.addEventListener("click",function(a){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);this._showReplaceInfo()}.bind(this));c.appendChild(b);return b},_handleInput:function(b){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(b){var c=(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&!b.shiftKey;return c&&70===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=
!0,!1):(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&75===b.keyCode||13===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this._addRecentfind(this.getFindString()),13===b.keyCode?this.find(this._reverse?b.shiftKey:!b.shiftKey):this.find(!b.shiftKey),!1):c&&82===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this.replace(),!1):27===b.keyCode?(this.hide(),!1):!0}});return{TextSearcher:e}});
define("orion/edit/dispatcher",["orion/edit/dispatcher"],function(){function k(k,l,g){this.serviceRegistry=k;this.editor=l;this.inputManager=g;this.contentTypeService=k.getService("orion.core.contentTypeRegistry");if(!this.contentTypeService)throw Error("Missing required service");this.serviceReferences={};var c=this;this.listener={onServiceAdded:function(f){c._onServiceAdded(f.serviceReference)},onServiceRemoved:function(f){c._onServiceRemoved(f.serviceReference)}};this.serviceRegistry.addEventListener("registered",
this.listener.onServiceAdded);this.serviceRegistry.addEventListener("unregistering",this.listener.onServiceRemoved);this._init()}k.prototype={_init:function(){var k=this;this.editor.getTextView()?this._wire(this.serviceRegistry):this.editor.addEventListener("TextViewInstalled",function(){k._wire(k.serviceRegistry)})},_wire:function(k){k=k.getServiceReferences("orion.edit.model");for(var l=0;l<k.length;l++)this._wireServiceReference(k[l])},_wireServiceReference:function(k){var l=k.getProperty("contentType");
if(void 0!==typeof l&&null!==l){var g=this;this.contentTypeService.isSomeExtensionOf(this.inputManager.getContentType(),l).then(function(c){c&&g._wireService(k,g.serviceRegistry.getService(k))})}},_wireService:function(k,l){for(var g=Object.keys(l),c=this.editor.getTextView(),f=0;f<g.length;f++){var b=g[f],e=l[b];"on"!==b.substr(0,2)||"function"!==typeof e||(b=b.substr(2),this._wireServiceMethod(k,l,e,c,b))}this._initService(l,c)},_wireServiceMethod:function(k,l,g,c,f){l=function(b){g(b).then()};
k=k.getProperty("service.id");this.serviceReferences[k]=this.serviceReferences[k]||[];this.serviceReferences[k].push([c,f,l]);c.addEventListener(f,l)},_onServiceRemoved:function(k){k=k.getProperty("service.id");var l=this.serviceReferences[k];if(l){for(var g=0;g<l.length;g++){var c=l[g];c[0].removeEventListener(c[1],c[2])}delete this.serviceReferences[k]}},_onServiceAdded:function(k){-1!==k.getProperty("objectClass").indexOf("orion.edit.model")&&this._wireServiceReference(k)},_initService:function(k,
l){var g=k.onModelChanging;if("function"===typeof g){var c=l.getModel(),f=c.getText(),c={type:"Changing",text:f,start:0,removedCharCount:0,addedCharCount:f.length,removedLineCount:0,addedLineCount:c.getLineCount()};g.call(k,c)}}};return{Dispatcher:k}});
define("orion/edit/typedefs",["orion/objects","orion/serviceTracker"],function(k,n){function l(g){this.props=Object.create(null);this.defs=Object.create(null);this.registration=null;var c=new n(g,"orion.core.typedef"),f=this;c.onServiceAdded=function(b){var c=b.getProperty("id"),d=b.getProperty("defs");if(!c||!d)throw Error("TypeDef registration missing required 'id' or 'defs' [service id: "+b.getProperty("service.id")+"]");var g={};b.getPropertyKeys().forEach(function(a){"defs"!==a&&"service.id"!==
a&&"service.names"!==a&&"objectClass"!==a&&(g[a]=b.getProperty(a))});f.props[c]=g;f.defs[c]=d;f._updateRegistration()};c.removedService=function(b){b=b.getProperty("id");delete f.props[b];delete f.defs[b];f._updateRegistration()};c.open();this.registration=g.registerService("orion.edit.context",{getTypeDef:this.getTypeDef.bind(this)},null);this._updateRegistration()}k.mixin(l.prototype,{_updateRegistration:function(){this.registration&&this.registration.setProperties({typeDefs:this.getAllProperties()})},
getTypeDef:function(g){return this.defs[g]||null},getProperties:function(g){return this.props[g]||null},getAllProperties:function(){return this.props}});return l});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},
doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\\x3c\\S*\\\x3e",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",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(k){var n="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:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",
end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},
{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+n.join("|")+")\\b",name:"keyword.control.js"}]});return{id:k[k.length-1].id,grammars:k,keywords:n}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(k){var n="abstract boolean break byte case catch char class continue default do double else extends false final finally float for if implements import instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try void volatile while".split(" ");k=k.grammars;k.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+
n.join("|")+")\\b",name:"keyword.control.java"}],repository:{string_singleQuote:{}}});return{id:k[k.length-1].id,grammars:k,keywords:n}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(k){var n="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:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},
{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+n.join("|")+")\\b",name:"keyword.control.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:n}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(k,n,l,g){function c(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function f(){c.call(this,null,!0)}function b(a){c.call(this,null,a)}function e(){c.call(this,null,!1)}function d(d,g,k){this.commentStart="/*";this.commentEnd="*/";var l=[];switch(g){case "java":l=a;break;
case "js":l=m;break;case "css":l=h}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new c(l,this.whitespacesVisible);this._firstScanner=new e;this._commentScanner=new b(this.whitespacesVisible);this._whitespaceScanner=new f;"css"===g&&(this._scanner.isCSS=!0,this._firstScanner.isCSS=!0);this.view=d;this.annotationModel=k;this._bracketAnnotations=void 0;var n=this;this._listener=
{onChanged:function(a){n._onModelChanged(a)},onDestroy:function(a){n._onDestroy(a)},onLineStyle:function(a){n._onLineStyle(a)},onMouseDown:function(a){n._onMouseDown(a)},onSelection:function(a){n._onSelection(a)}};g=d.getModel();g.getBaseModel&&(g=g.getBaseModel());g.addEventListener("Changed",this._listener.onChanged);d.addEventListener("MouseDown",this._listener.onMouseDown);d.addEventListener("Selection",this._listener.onSelection);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();d.redrawLines()}var m=n.keywords,a=l.keywords,h=g.keywords,s={styleClass:"comment"},t={styleClass:"comment"},q={styleClass:"comment block documentation"},r={styleClass:"keyword other documentation markup"},v={styleClass:"keyword other documentation task"},u={styleClass:"keyword other documentation tag"},w={styleClass:"string"},z={styleClass:"constant numeric"},y={styleClass:"keyword"},x={styleClass:"punctuation separator space",
unmergeable:!0},p={styleClass:"punctuation separator tab",unmergeable:!0},A={styleClass:"meta annotation currentLine"};c.prototype={getOffset:function(){return this.offset},getStartOffset:function(){return this.startOffset},getData:function(){return this.text.substring(this.startOffset,this.offset)},getDataLength:function(){return this.offset-this.startOffset},_default:function(a){switch(a){case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);
return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var b=this.isCSS,c=this.offset-1;if(!b&&48<=a&&57>=a){var d=b=!1,e=!1,f=a;do if(a=this._read(),46===a&&!b)b=!0;else if(101===a&&!d)b=d=!0,a=this._read(),45!==a&&this._unread(a);else if(120===a&&48===f&&2===this.offset-c)b=d=e=!0;else if(!(48<=a&&57>=a||e&&(65<=a&&70>=a||97<=a&&102>=a)))break;while(1);this._unread(a);return 3}if(97<=a&&122>=a||65<=a&&90>=a||95===a||45===a&&b){do a=this._read();while(97<=a&&
122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a||45===a&&b);this._unread(a);a=this.keywords;if(0<a.length){c=this.text.substring(c,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===c)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){-1!==a&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),b;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&47===a)for(;;)if(a=
this._read(),-1===a||10===a||13===a)return this._unread(a),6;if(42===a){a=this._read();b=7;for(42===a&&(b=8);;){for(;42===a;)if(a=this._read(),47===a)return b;if(-1===a)return this._unread(a),b;a=this._read()}}this._unread(a);return 1;case 39:for(b=4;;)switch(a=this._read(),a){case 39:return b;case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;case 34:for(b=4;;)switch(a=this._read(),a){case 34:return b;
case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};f.prototype=new c(null);f.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(32===a||9===a||-1===a));this._unread(a);
return 1}}};b.prototype=new c(null);b.prototype.setType=function(a){this._type=a};b.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);return 9;case 60:if(8===this._type){do a=this._read();while(!(62===a||-1===a));if(62===a)return 12}return 1;case 64:if(8===this._type){do a=this._read();while(97<=a&&122>=a||65<=a&&90>=
a||95===a||48<=a&&57>=a);this._unread(a);return 13}return 1;case 84:if(79===(a=this._read()))if(68===(a=this._read()))if(79===(a=this._read()))if(a=this._read(),!(97<=a&&122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(32===a||9===a||-1===a||60===a||64===a||84===a));this._unread(a);return 1}}};e.prototype=new c(null);e.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};d.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}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,
b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){this.detectHyperlinks=
a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;void 0===d&&(d=-1);for(void 0===e&&(e=a.length);1<e-d;)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},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();
if(a.getBaseModel){var b=this.annotationModel;if(b){b.removeAnnotations(k.AnnotationType.ANNOTATION_FOLDING);for(var c=[],d=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var g=e[f];(g=this._createFoldingAnnotation(a,d,g.start,g.end))&&c.push(g)}b.replaceAnnotations(null,c)}}}},_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)},_computeTasks:function(a,b,c){if(this.detectTasks){var d=
this.annotationModel;if(d){var e=this.view.getModel(),f=e;e.getBaseModel&&(f=e.getBaseModel());for(var g=d.getAnnotations(b,c),e=[],h=k.AnnotationType.ANNOTATION_TASK;g.hasNext();){var m=g.next();m.type===h&&e.push(m)}g=[];m=this._commentScanner;m.setText(f.getText(b,c));for(var l;l=m.nextToken();){var n=m.getStartOffset()+b;14===l&&(l=f.getLineEnd(f.getLineAtOffset(n)),6!==a&&(l=Math.min(l,c-this.commentEnd.length)),g.push(k.AnnotationType.createAnnotation(h,n,l,f.getText(n,l))))}d.replaceAnnotations(e,
g)}}},_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 A}return null},_getStyles:function(a,b,c){a.getBaseModel&&(c=a.mapOffset(c));for(var d=c+b.length,e=[],f=c,g=this.comments,h=this._binarySearch(g,c,!0);h<g.length&&!(g[h].start>=d);h++){var k=g[h].start,m=g[h].end;f<k&&this._parse(b.substring(f-c,k-c),f,e);var l=g[h].type,n;switch(l){case 8:n=q;break;case 7:n=t;break;case 5:n=w}f=Math.max(f,
k);k=Math.min(d,m);(8===l||7===l)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-c,k-c),f,e,n,l):5===l&&this.whitespacesVisible?this._parseString(b.substring(f-c,k-c),f,e,w):e.push({start:f,end:k,style:n});f=m}f<d&&this._parse(b.substring(f-c,d-c),f,e);if(a.getBaseModel)for(b=0;b<e.length;b++)c=e[b].end-e[b].start,e[b].start=a.mapOffset(e[b].start,!0),e[b].end=e[b].start+c;return e},_parse:function(a,b,c){var d=this._scanner;for(d.setText(a);a=d.nextToken();){var e=
d.getStartOffset()+b,f=null;switch(a){case 2:f=y;break;case 3:f=z;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(d.getData(),e,c,w);continue}else f=w;break;case 8:this._parseComment(d.getData(),e,c,q,a);continue;case 6:this._parseComment(d.getData(),e,c,s,a);continue;case 7:this._parseComment(d.getData(),e,c,t,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=x)}c.push({start:e,end:d.getOffset()+b,
style:f})}},_parseComment:function(a,b,c,d,e){var f=this._commentScanner;f.setText(a);for(f.setType(e);a=f.nextToken();){e=f.getStartOffset()+b;var g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=x);break;case 12:g=r;break;case 13:g=u;break;case 14:g=v;break;default:this.detectHyperlinks&&(g=this._detectHyperlinks(f.getData(),e,c,g))}g&&c.push({start:e,end:f.getOffset()+b,style:g})}},_parseString:function(a,b,c,d){var e=
this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,g=d;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=p);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=x)}g&&c.push({start:f,end:e.getOffset()+b,style:g})}},_detectHyperlinks:function(a,b,c,d){var e=null,f;if(0<(f=a.indexOf("://"))){for(var e=a,g=f;0<g;){f=e.charCodeAt(g-1);if(!(97<=f&&122>=f||65<=f&&90>=f||45===f||48<=f&&57>=f))break;g--}if(0<g&&(f="\"\"''(){}[]\x3c\x3e".indexOf(e.substring(g-
1,g)),-1!==f&&0===(f&1)&&-1!==(f=e.lastIndexOf("\"\"''(){}[]\x3c\x3e".substring(f+1,f+2))))){var h=f;f=this._clone(d);f.tagName="a";f.attributes={href:e.substring(g,h)};c.push({start:b,end:b+g,style:d});c.push({start:b+g,end:b+h,style:f});c.push({start:b+h,end:b+a.length,style:d});return null}}else 0===a.toLowerCase().indexOf("bug#")&&(e="https://bugs.eclipse.org/bugs/show_bug.cgi?id\x3d"+parseInt(a.substring(4),10));return e?(f=this._clone(d),f.tagName="a",f.attributes={href:e},f):d},_clone:function(a){if(!a)return a;
var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},_findComments:function(a,b){b=b||0;var c=this._firstScanner,d;c.setText(a);for(var e=[];d=c.nextToken();)(7===d||8===d||5===d)&&e.push({start:c.getStartOffset()+b,end:c.getOffset()+b,type:d}),(6===d||7===d||8===d)&&this._computeTasks(d,c.getStartOffset()+b,c.getOffset()+b);return e},_findMatchingBracket:function(a,b){var c="{}()[]\x3c\x3e",d=a.getText(b,b+1),e=c.indexOf(d,0);if(-1===e)return-1;var f;f=e&1?c.substring(e-1,e):c.substring(e+
1,e+2);for(var g=a.getLineAtOffset(b),c=a.getLine(g),h=a.getLineStart(g),k=a.getLineEnd(g),c=this._findBrackets(d,f,c,h,h,k),k=0;k<c.length;k++)if(h=0<=c[k]?1:-1,c[k]*h-1===b){var m=1;if(e&1){for(k--;0<=k;k--)if(h=0<=c[k]?1:-1,m+=h,0===m)return c[k]*h-1;for(g-=1;0<=g;){c=a.getLine(g);h=a.getLineStart(g);k=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,k);for(e=c.length-1;0<=e;e--)if(h=0<=c[e]?1:-1,m+=h,0===m)return c[e]*h-1;g--}}else{for(k++;k<c.length;k++)if(h=0<=c[k]?1:-1,m+=h,0===m)return c[k]*
h-1;g+=1;for(e=a.getLineCount();g<e;){c=a.getLine(g);h=a.getLineStart(g);k=a.getLineEnd(g);c=this._findBrackets(d,f,c,h,h,k);for(k=0;k<c.length;k++)if(h=0<=c[k]?1:-1,m+=h,0===m)return c[k]*h-1;g++}}break}return-1},_findBrackets:function(a,b,c,d,e,f){var g=[];a=a.charCodeAt(0);b=b.charCodeAt(0);for(var h=e,k=this._scanner,m,l=this.comments,n=this._binarySearch(l,e,!0);n<l.length&&!(l[n].start>=f);n++){m=l[n].start;var p=l[n].end;if(h<m)for(k.setText(c.substring(h-e,m-e));m=k.nextToken();)m===a?g.push(k.getStartOffset()+
h-e+d+1):m===b&&g.push(-(k.getStartOffset()+h-e+d+1));h=p}if(h<f)for(k.setText(c.substring(h-e,f-e));m=k.nextToken();)m===a?g.push(k.getStartOffset()+h-e+d+1):m===b&&g.push(-(k.getStartOffset()+h-e+d+1));return g},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){a.textView===this.view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var b=a.oldValue,c=a.newValue,d=this.view;a=d.getModel();var 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,m;if(c.start===c.end&&0<(m=d.getCaretOffset()))m-=1,a.getBaseModel&&(m=a.mapOffset(m),a=a.getBaseModel()),a=this._findMatchingBracket(a,m),-1!==a&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),
k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,m,m+1)]);this._bracketAnnotations=h;this.annotationModel.replaceAnnotations(b,h)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(0<d){var e=d-1,f=c;c.getBaseModel&&(e=c.mapOffset(e),f=c.getBaseModel());e=this._findMatchingBracket(f,e);-1!==e&&(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,d=a.addedCharCount-c,e=this.view;a=e.getModel();var f=a.getBaseModel?a.getBaseModel():a,c=b+c,g=f.getCharCount(),h=this.comments.length,m=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(this.comments,m,!0),n=this._binarySearch(this.comments,c,!1,l-1,h);l<h&&this.comments[l].start<=m&&m<this.comments[l].end?(m=this.comments[l].start,m>b&&(m+=d)):m=l===h&&0<h&&g-d===this.comments[h-1].end?this.comments[h-1].start:m;var p;n<h?(p=this.comments[n].end,p>b&&(p+=d),
n+=1):(n=h,p=g);for(var g=f.getText(m,p),q,g=this._findComments(g,m),h=l;h<this.comments.length;h++)q=this.comments[h],q.start>b&&(q.start+=d),q.start>b&&(q.end+=d);var s=n-l!==g.length;if(!s)for(h=0;h<g.length;h++){q=this.comments[l+h];var y=g[h];if(q.start!==y.start||q.end!==y.end||q.type!==y.type){s=!0;break}}h=[l,n-l].concat(g);Array.prototype.splice.apply(this.comments,h);s&&(h=m,q=p,a!==f&&(h=a.mapOffset(h,!0),q=a.mapOffset(q,!0)),e.redrawRange(h,q));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=
this.annotationModel;l=e.getAnnotations(m,p);m=[];for(p=[];l.hasNext();)if(q=l.next(),q.type===k.AnnotationType.ANNOTATION_FOLDING){p.push(q);for(h=0;h<g.length&&!(q.start===g[h].start&&q.end===g[h].end);h++);h===g.length?(m.push(q),q.expand()):(h=q.start,n=q.end,h>b&&(h-=d),n>b&&(n-=d),h<=b&&b<n&&h<=c&&c<n&&(h=f.getLineAtOffset(q.start),n=f.getLineAtOffset(q.end),h!==n?q.expanded||q.expand():e.removeAnnotation(q)))}b=[];for(h=0;h<g.length;h++){q=g[h];for(d=0;d<p.length&&!(p[d].start===q.start&&p[d].end===
q.end);d++);d===p.length&&(q=this._createFoldingAnnotation(a,f,q.start,q.end))&&b.push(q)}e.replaceAnnotations(m,b)}}};return{TextStyler:d}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(k){function n(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 l(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=
{};d&&(this._initPatterns(),this._subBlocks=w(d,d.getText(this.start,this.end),this,this.start))}function g(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 n(c,d);this._accessor=new g(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 l({start:0,contentStart:0,end:d,contentEnd:d},null,this,c);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(d=[],z(this._rootBlock,c,d),b.replaceAnnotations([],d));a.redrawLines()}var f={styleClass:"meta annotation currentLine"},b=/$/,e=/\\(\d)/g,d=/^\(\?i\)\s*/,m=/(.*)(?:[\r\n]|$)/g,a={regex:/[ ]/g,style:{styleClass:"punctuation separator space",unmergeable:!0}},h={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},s=function(a,b,c,d){var e=c,f=
a.lastIndex;m.lastIndex=c;c=m.exec(b);var g,h;a.lastIndex=0;if(c){for(h=c.index;0<=--h&&!(g=b.charAt(h),"\n"===g||"\r"===g););g=b.substring(h+1,c.index+c[1].length);a.lastIndex=h=c.index-h-1}for(;c&&c.index<b.length;){var k;if(d){var l=a.lastIndex;a.test(g)&&(a.lastIndex=l,k=a.exec(g))}else k=a.exec(g);if(k)return k.index+=e,k.index-=h,a.lastIndex=f,k;h=0;e+=c[0].length;if(c=m.exec(b))g=c[1],a.lastIndex=0}a.lastIndex=f;return null},t=function(a,b){var c=a.toString();e.lastIndex=0;if(!e.test(c))return a;
e.lastIndex=0;for(var d=e.exec(c);d;)c=c.replace(d[0],b[d[1]]||""),e.lastIndex=0,d=e.exec(c);return RegExp(c.substring(1,c.length-1-1),"g")},q=function(a,b,c,d){if(b=s(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)}},r=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 h=c+e;d.push({start:h,end:h+a[f].length,style:g.name})}e+=a[f].length}},v=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})},u=function(a,c,d,e,f){if(a&&(d=d.getLinePatterns())){var g=[];d.forEach(function(b){var c=b.regex||b.regexBegin;c.oldLastIndex=c.lastIndex;(c=s(c,a,0))&&g.push({result:c,pattern:b})});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;0<g.length;){var k=g[0];g.splice(0,1);if(!(k.result.index<h)){var m=k.result.index,l,n=[];if(k.pattern.regex){h=k.result;l=m+h[0].length;l={start:c+m,end:c+l,style:k.pattern.pattern.name};if(!f){k.pattern.pattern.captures&&r(h,k.pattern.pattern.captures,c+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 u={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,u)}}v(l,n,e)}else h=k.pattern.regexEnd,h=t(h,k.result),(h=s(h,a,k.result.index+k.result[0].length))||(b.lastIndex=0,h=b.exec(a)),l=h.index+h[0].length,e.push({start:c+m,end:c+l,style:k.pattern.pattern.name});h=h.index+h[0].length}q(k,a,g,h)}d.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},w=function(a,c,d,e){if(!c)return[];var f=[],g=[];d.getBlockPatterns().forEach(function(a){var b=
s(a.regexBegin||a.regex,c,0);b&&g.push({result:b,pattern:a})}.bind(this));if(!g.length)return f;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;0<g.length;){var k=g[0];g.splice(0,1);if(!(k.result.index<h)){var h=e+k.result.index,m=k.result.index,n=null,r=k.pattern.regexEnd;if(r){var m=m+k.result[0].length,u=k.pattern,v=t(r,k.result);v!==r&&(u={pattern:u.pattern,regexBegin:u.regexBegin,regexEnd:v},
r=v);for(v=m;!n;){(v=s(r,c,v))||(b.lastIndex=0,v=b.exec(c));var w=new l({start:h,end:e+v.index+v[0].length,contentStart:e+m,contentEnd:e+v.index},u,d.getStyler(),a,d),z=w.getBlocks();if(!z.length||z[z.length-1].end<=v.index+e)n=w;v=v.index+v[0].length}}else n=new l({start:h,end:h+k.result[0].length,contentStart:h,contentEnd:h+k.result[0].length},k.pattern,d.getStyler(),a,d);f.push(n);h=n.end-e}q(k,c,g,h)}return f},z=function(a,b,c){if(a.getAnnotationModel()){var d=k.AnnotationType.ANNOTATION_TASK;
if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&0===a.pattern.pattern.name.indexOf("comment")){var e=[];u(b.getText(a.contentStart,a.end),a.contentStart,a,e,!0);for(var f=0;f<e.length;f++)"meta.annotation.task.todo"===e[f].style&&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){z(a,b,c)}.bind(this))}};n.prototype={getPatterns:function(a){a?(a="string"===typeof a?a:a.qualifiedId,a+="#"):a=this._rootId+
"#"+this._NO_ID;var b=[0],c={},d=RegExp("^"+a+"[^#]+$");this._patterns.forEach(function(a){d.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,c):(a.index=b[0]++,c[a.id]=a))}.bind(this));var e=[];Object.keys(c).forEach(function(a){e.push(c[a])});return e},_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=0===e?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):-1===e?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");this._patterns.forEach(function(a){d.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,c):c[a.id]||(a.index=b[0]++,
c[a.id]=a))}.bind(this))},_NO_ID:"NoID"};l.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=[];r(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()},getPatterns:function(){return this.getLinePatterns()},
getStyler:function(){return this._styler},isRenderingWhitespace:function(){return this._styler._isRenderingWhitespace()},_initPatterns:function(){if(this.pattern&&this.pattern.pattern._linePatterns)this._linePatterns=this.pattern.pattern._linePatterns,this._blockPatterns=this.pattern.pattern._blockPatterns,this._enclosurePatterns=this.pattern.pattern._enclosurePatterns;else{var a=function(a){a="string"===typeof a?a:a.match;var b=d.exec(a),c="g";b&&(a=a.substring(b[0].length),c+="i");return RegExp(a,
c)},b=-1,c=0;this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(d){var e;if(d.match&&!d.begin&&!d.end){if(e={regex:a(d.match),pattern:d},this._linePatterns.push(e),d.name&&0===d.name.indexOf("punctuation.section")&&(-1!==d.name.indexOf(".begin")||-1!==d.name.indexOf(".end")))this._enclosurePatterns[d.name]=e}else!d.match&&d.begin&&d.end&&(b=c,e={regexBegin:a(d.begin),regexEnd:a(d.end),pattern:d},this._linePatterns.push(e));c++}.bind(this));this._blockPatterns=
this._linePatterns.slice(0,b+1);this.pattern&&(this.pattern.pattern._enclosurePatterns=this._enclosurePatterns,this.pattern.pattern._linePatterns=this._linePatterns,this.pattern.pattern._blockPatterns=this._blockPatterns)}}};g.prototype={getPatterns:function(a){return this._styler.getPatterns(a)},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}},getPatterns:function(a){return this._findBlock(this._rootBlock,a).getPatterns()},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=[];u(f,c.getLineStart(e),d,g);for(e=0;e<g.length&&!(a<g[e].start);e++)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){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||
this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,c,d,e){var f;void 0===d&&(d=-1);for(void 0===e&&(e=a.length);1<e-d;)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=[],k=e,m=c.getBlocks(),l=this._binarySearch(m,e,!0);l<m.length&&!(m[l].start>=f);l++){var n=m[l].start,q=m[l].end;k<n&&(u(d.substring(k-e,n-e),k,c,h),h.forEach(function(c){0===c.style.indexOf(a.pattern.name)?g.push(c.start+1):0===c.style.indexOf(b.pattern.name)&&g.push(-(c.start+
1))}),h=[]);k=q}k<f&&(u(d.substring(k-e,f-e),k,c,h),h.forEach(function(c){0===c.style.indexOf(a.pattern.name)?g.push(c.start+1):0===c.style.indexOf(b.pattern.name)&&g.push(-(c.start+1))}));return g},_findMatchingBracket:function(a,b,c){for(var d=a.getLineAtOffset(c),e=a.getLineEnd(d),f=a.getText(c,e),g,h=b.getEnclosurePatterns(),k=Object.keys(h),m=0;m<k.length;m++){var l=h[k[m]],n=s(l.regex,f,0);if(n&&0===n.index){g=l;break}}if(!g)return-1;f=!1;-1!==g.pattern.name.indexOf(".begin")?(f=!0,m=g.pattern.name.replace(".begin",
".end")):m=g.pattern.name.replace(".end",".begin");h=h[m];if(!h)return-1;k=a.getLine(d);l=a.getLineStart(d);e=this._findBrackets(g,h,b,k,l,e);for(m=0;m<e.length;m++)if(k=0<=e[m]?1:-1,e[m]*k-1===c){c=1;if(f){for(m++;m<e.length;m++)if(k=0<=e[m]?1:-1,c+=k,0===c)return e[m]*k-1;d+=1;for(m=a.getLineCount();d<m;){k=a.getLine(d);l=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,k,l,e);for(f=0;f<e.length;f++)if(k=0<=e[f]?1:-1,c+=k,0===c)return e[f]*k-1;d++}}else{for(m--;0<=m;m--)if(k=0<=e[m]?
1:-1,c+=k,0===c)return e[m]*k-1;for(d-=1;0<=d;){k=a.getLine(d);l=a.getLineStart(d);e=a.getLineEnd(d);e=this._findBrackets(g,h,b,k,l,e);for(m=e.length-1;0<=m;m--)if(k=0<=e[m]?1:-1,c+=k,0===c)return e[m]*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 f}return null},_getPatternManager:function(){return this.patternManager},
_getStyles:function(a,b,c,d){b.getBaseModel&&(d=b.mapOffset(d));for(var e=d+c.length,f=[],g=d,h=a.getBlocks(),k=this._binarySearch(h,d,!0);k<h.length&&!(h[k].start>=e);k++){var m=h[k].start,l=h[k].end;g<m&&u(c.substring(g-d,m-d),g,a,f);var n=Math.max(g,m);if(n===m&&h[k].pattern.regexBegin){var q=s(h[k].pattern.regexBegin,c.substring(n-d),0);if(q){var t=h[k].pattern.pattern.beginCaptures||h[k].pattern.pattern.captures;t?r(q,t,n,f):f.push({start:n,end:n+q[0].length,style:h[k].pattern.pattern.name});
n+=q[0].length}}var m=Math.min(e,l),v=[];if(m===l&&h[k].pattern.regexEnd&&(g=c.substring(m-g-(h[k].end-h[k].contentEnd)),q=s(h[k].pattern.regexEnd,g,0)))(t=h[k].pattern.pattern.endCaptures||h[k].pattern.pattern.captures)?r(q,t,m-q[0].length,v):h[k].pattern.pattern.name&&v.push({start:m-q[0].length,end:m,style:h[k].pattern.pattern.name}),m-=q[0].length;var g=this._getStyles(h[k],b,c.substring(n-d,m-d),n),w=h[k].pattern.pattern.contentName||h[k].pattern.pattern.name;if(w){var z=n;g.forEach(function(a){a.start-
z&&f.push({start:z,end:a.start,style:w});f.push(a);z=a.end});m-z&&f.push({start:z,end:m,style:w})}else f=f.concat(g);f=f.concat(v);g=l}g<e&&u(c.substring(g-d,e-d),g,a,f);if(b.getBaseModel)for(a=0;a<f.length;a++)c=f[a].end-f[a].start,f[a].start=b.mapOffset(f[a].start,!0),f[a].end=f[a].start+c;return f},_isRenderingWhitespace:function(){return this.whitespacesVisible&&(this.tabsVisible||this.spacesVisible)},_onDestroy:function(a){this.destroy()},_onLineStyle:function(b){b.textView===this.view&&(b.style=
this._getLineStyle(b.lineIndex));b.ranges=this._getStyles(this._rootBlock,b.textView.getModel(),b.lineText,b.lineStart);b.ranges.forEach(function(a){a.style&&(a.style={styleClass:a.style.replace(/\./g," ")})});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(a,b.ranges,b.lineText,b.lineStart),this.tabsVisible&&this._spliceStyles(h,b.ranges,b.lineText,b.lineStart))},_onSelection:function(a){var b=a.oldValue,c=a.newValue,d=this.view;a=d.getModel();var 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,m;if(c.start===c.end&&0<(m=d.getCaretOffset()))m-=1,a.getBaseModel&&(m=a.mapOffset(m),a=a.getBaseModel()),c=this._findBlock(this._rootBlock,m),a=this._findMatchingBracket(a,c,m),-1!==a&&(h=[k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,
a+1),k.AnnotationType.createAnnotation(k.AnnotationType.ANNOTATION_CURRENT_BRACKET,m,m+1)]);this._bracketAnnotations=h;this.annotationModel.replaceAnnotations(b,h)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,c=b.getModel(),d=b.getOffsetAtLocation(a.x,a.y);if(0<d){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);-1!==e&&(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;var d=this.view,e=d.getModel(),f=e.getBaseModel?e.getBaseModel():e,c=b+c,g=f.getCharCount(),h=this._rootBlock.getBlocks(),m=h.length,l=f.getLineStart(f.getLineAtOffset(b)),n=this._binarySearch(h,l,!0),q=this._binarySearch(h,c,!1,n-1,m),s;n<m&&h[n].start<=l&&l<h[n].end?(s=h[n].start,s>b&&(s+=a)):s=n===m&&0<m&&g-a===h[m-1].end?h[m-1].start:l;var t;do q<m?(t=h[q].end,t>b&&(t+=a),q+=1):
(q=m,t=g),l=f.getText(s,t),l=w(f,l,this._rootBlock,s);while(l.length&&h.length&&q<m&&l[l.length-1].pattern.pattern.id!==h[q-1].pattern.pattern.id);for(g=n;g<h.length;g++)m=h[g],m.start>b&&m.adjustStart(a),m.start>b&&m.adjustEnd(a);var r=q-n!==l.length;if(!r)for(g=0;g<l.length;g++){var m=h[n+g],u=l[g];if(m.start!==u.start||m.end!==u.end||m.type!==u.type){r=!0;break}}g=[n,q-n].concat(l);Array.prototype.splice.apply(h,g);r&&(g=s,m=t,e!==f&&(g=e.mapOffset(g,!0),m=e.mapOffset(m,!0)),d.redrawRange(g,m));
if(this.annotationModel){d=[];h=[];n=[];s=this.annotationModel.getAnnotations(s,t);for(t=this.foldingEnabled&&f!==e;s.hasNext();)if(m=s.next(),t&&m.type===k.AnnotationType.ANNOTATION_FOLDING){n.push(m);for(g=0;g<l.length&&!(m.start===l[g].start&&m.end===l[g].end);g++);g===l.length?(d.push(m),m.expand()):(g=m.start,q=m.end,g>b&&(g-=a),q>b&&(q-=a),g<=b&&b<q&&g<=c&&c<q&&(g=f.getLineAtOffset(m.start),q=f.getLineAtOffset(m.end),g!==q?m.expanded||m.expand():this.annotationModel.removeAnnotation(m)));for(g=
0;g<l.length;g++){m=l[g];for(q=0;q<n.length&&!(n[q].start===m.start&&n[q].end===m.end);q++);q===n.length&&(m=this._createFoldingAnnotation(e,f,m.start,m.end))&&h.push(m)}}else m.type===k.AnnotationType.ANNOTATION_TASK&&d.push(m);if(this.detectTasks)for(g=0;g<l.length;g++)z(l[g],f,h);this.annotationModel.replaceAnnotations(d,h)}},_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&&!(g<b[f].end);)f++;var h={start:g,end:g+1,style:a.style};if(f<
b.length&&b[f].start<=g){var k={start:g+1,end:b[f].end,style:b[f].style};b[f].end=g;b.splice(f+1,0,k);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/textMateStyler",["orion/regex"],function(k){function n(c){var f;if(c instanceof Array){f=Array(c.length);for(var b=0;b<c.length;b++)f[b]=n(c[b])}else for(b in f={},c)if(Object.prototype.hasOwnProperty.call(c,b)){var e=c[b];f[b]="object"===typeof e&&null!==e?n(e):e}return f}function l(c,f,b){this.initialize(c);this.grammar=n(f);this.externalGrammars=b?n(b):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var g={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(c){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(c){return"\x3d"===c[1]?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(c){return"atomic group"}}],toRegExp:function(c){function f(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var b="",e;c=g.processGlobalFlag("x",c,function(b){for(var a="",c=!1,d=b.length,e=0;e<d;){var f=b.charAt(e);if(!c&&"#"===f)for(;e<d&&"\r"!==f&&"\n"!==f;)f=b.charAt(++e);
else if(!c&&/\s/.test(f))for(;e<d&&/\s/.test(f);)f=b.charAt(++e);else"\\"===f?(a+=f,/\s/.test(b.charAt(e+1))||(a+=b.charAt(e+1),e+=1)):("["===f?c=!0:"]"===f&&(c=!1),a+=f),e+=1}return a});c=g.processGlobalFlag("i",c,function(c){b+="i";return c});for(e=0;e<this.unsupported.length;e++){var d;(d=this.unsupported[e].regex.exec(c))&&f(this.unsupported[e].func(d),d)}return RegExp(c,b)},processGlobalFlag:function(c,f,b){var e="(?"+c+")";c="(?"+c+":";if(f.substring(0,e.length)===e)return b(f.substring(e.length));
if(f.substring(0,c.length)===c){for(var e=0,d=f.length,g=-1,a=0;a<d&&-1===g;a++)switch(f.charAt(a)){case "\\":a++;break;case "(":e++;break;case ")":e--,0===e&&(g=a)}e=g;if(e<f.length-1)throw Error("Only a "+c+") group that encloses the entire regex is supported in: "+f);return b(f.substring(c.length,e))}return f},hasBackReference:function(c){return/\\\d+/.test(c.source)},getSubstitutedRegex:function(c,f,b){b="undefined"===typeof b?!0:!1;c=c.source.split(/(\\\d+)/g);for(var e=[],d=0;d<c.length;d++){var g=
c[d],a=/\\(\d+)/.exec(g);a?(g=f[a[1]]||"",e.push(b?k.escape(g):g)):e.push(g)}return RegExp(e.join(""))},groupify:function(c,f){for(var b=c.source,e=b.length,d=[],g=0,a=[],h=1,k=1,l=[],n={},r={},v=0;v<e;v++){var u=d[d.length-1],w=b.charAt(v);switch(w){case "(":4===u&&(d.pop(),l.push(")"),a[a.length-1].end=v);var z=v+2<e?b.charAt(v+1)+""+b.charAt(v+2):null;if("?:"===z||"?\x3d"===z||"?!"===z){var y;"?:"===z?y=1:(y=3,g++);d.push(y);a.push({start:v,end:-1,type:y});l.push(w);l.push(z);v+=z.length}else d.push(2),
a.push({start:v,end:-1,type:2,oldNum:h,num:k}),l.push(w),0===g&&(r[k]=null),n[h]=k,h++,k++;break;case ")":u=d.pop();3===u&&g--;a[a.length-1].end=v;l.push(w);break;case "*":case "+":case "?":case "}":var x=w,p=b.charAt(v-1),z=v-1;if("}"===w){for(y=v-1;"{"!==b.charAt(y)&&0<=y;y--);p=b.charAt(y-1);z=y-1;x=b.substring(y,v+1)}y=a[a.length-1];if(")"===p&&(2===y.type||4===y.type)){l.splice(y.start,0,"(");l.push(x);l.push(")");w={start:y.start,end:l.length-1,type:4,num:y.num};for(p=0;p<a.length;p++)if(u=
a[p],(2===u.type||4===u.type)&&u.start>=y.start&&u.end<=z)u.start+=1,u.end+=1,u.num+=1,2===u.type&&(n[u.oldNum]=u.num);a.push(w);k++;break}default:"|"!==w&&2!==u&&4!==u&&0===g&&(d.push(4),a.push({start:v,end:-1,type:4,num:k}),l.push("("),r[k]=null,k++),l.push(w),"\\"===w&&(w=b.charAt(v+1),l.push(w),v+=1)}}for(;d.length;)d.pop(),l.push(")");b=RegExp(l.join(""));e={};f=f||n;for(var A in f)f.hasOwnProperty(A)&&(e[A]="\\"+f[A]);b=this.getSubstitutedRegex(b,e,!1);return[b,n,r]},complexCaptures:function(c){if(!c)return!1;
for(var f in c)if(c.hasOwnProperty(f)&&"0"!==f)return!0;return!1}};l.prototype={initialize:function(c){this.textView=c;this.textView.stylerOptions=this;var f=this;this._listener={onModelChanged:function(b){f.onModelChanged(b)},onDestroy:function(b){f.onDestroy(b)},onLineStyle:function(b){f.onLineStyle(b)},onStorage:function(b){f.onStorage(b)}};c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Destroy",this._listener.onDestroy);c.addEventListener("LineStyle",this._listener.onLineStyle);
c.redrawLines()},onDestroy:function(c){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanged",this._listener.onModelChanged),this.textView.removeEventListener("Destroy",this._listener.onDestroy),this.textView.removeEventListener("LineStyle",this._listener.onLineStyle),this.textView=null);this._listener=this._tree=this._styles=this.grammar=null},preprocess:function(c){for(c=[c];0!==c.length;){var f=c.pop();if(!f._resolvedRule||!f._typedRule)if(f._resolvedRule=
this._resolve(f),f._typedRule=this._createTypedRule(f),this.addStyles(f.name),this.addStyles(f.contentName),this.addStylesForCaptures(f.captures),this.addStylesForCaptures(f.beginCaptures),this.addStylesForCaptures(f.endCaptures),f._resolvedRule!==f&&c.push(f._resolvedRule),f.patterns)for(var b=0;b<f.patterns.length;b++)c.push(f.patterns[b])}},addStyles:function(c){if(c&&!this._styles[c]){this._styles[c]=[];for(var f=c.split("."),b=0;b<f.length;b++)this._styles[c].push(f.slice(0,b+1).join("-"))}},
addStylesForCaptures:function(c){for(var f in c)c.hasOwnProperty(f)&&this.addStyles(c[f].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=g.toRegExp(c.begin);this.endRegex=g.toRegExp(c.end);this.subrules=c.patterns||[];this.endRegexHasBackRef=g.hasBackReference(this.endRegex);var b=g.complexCaptures(c.captures);c=g.complexCaptures(c.beginCaptures)||
g.complexCaptures(c.endCaptures);if(this.isComplex=b||c)b=g.groupify(this.beginRegex),this.beginRegex=b[0],this.beginOld2New=b[1],this.beginConsuming=b[2],b=g.groupify(this.endRegex,this.beginOld2New),this.endRegex=b[0],this.endOld2New=b[1],this.endConsuming=b[2]}c.prototype.valueOf=function(){return this.beginRegex};return c}(),MatchRule:function(){function c(c){this.rule=c;this.matchRegex=g.toRegExp(c.match);if(this.isComplex=g.complexCaptures(c.captures))c=g.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 f=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(f=this.grammar.repository&&this.grammar.repository[c.substring(1)],!f)throw Error("Couldn't find included rule "+
c+" in grammar repository");}else if("$self"===c)f=this.grammar;else{if("$base"===c)throw Error('Include "$base" is not supported');f=this._allGrammars[c];if(!f)for(var b=0;b<this.externalGrammars.length;b++){var e=this.externalGrammars[b];if(e.scopeName===c){this.preprocess(e);f=this._allGrammars[c]=e;break}}}}return f},ContainerNode:function(){function c(c,b){this.parent=c;this.rule=b;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,b,e){this.parent=c;this.rule=b;this.children=[];this.setStart(e);this.endMatch=this.end=null;this.endRegexSubstituted=b.endRegexHasBackRef?g.getSubstitutedRegex(b.endRegex,e):null}c.prototype.addChild=function(c){this.children.push(c)};c.prototype.getIndexInParent=function(c){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&&"object"===typeof c?(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\x3d"+this.start+".."+this.end+"}"};return c}(),push:function(c,f){if(f)for(var b=f.length;0<
b;)c.push(f[--b])},exec:function(c,f,b){if(f=c.exec(f))f.index+=b;c.lastIndex=0;return f},afterMatch:function(c){return c.index+c[0].length},getEndMatch:function(c,f,b){if(c instanceof this.BeginEndNode){var e=c.rule;c=c.endRegexSubstituted||e.endRegex;return!c?null:this.exec(c,f,b)}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 f=c.addedCharCount,
b=c.removedCharCount;c=c.start;if(this._tree){var e=this.textView.getModel(),d=e.getCharCount(),e=e.getLineEnd(e.getLineAtOffset(c)-1),g=this.getFirstDamaged(e,e),e=-1===e?0:e,f=g?this.parse(g,!0,e,c,f,b):d;this.textView.redrawRange(e,f)}else this.initialParse()},getFirstDamaged:function(c,f){if(0>c)return this._tree;for(var b=[this._tree],e=null;b.length;){var d=b.pop();if(!d.parent||this.isDamaged(d,c,f)){d instanceof this.BeginEndNode&&(e=d);for(var g=0;g<d.children.length;g++)b.push(d.children[g])}}return e||
this._tree},isDamaged:function(c,f,b){return c.start<=b&&c.end>f},parse:function(c,f,b,e,d,g){var a=this.textView.getModel(),h=a.getLineStart(a.getLineCount()-1),k=a.getCharCount(),l=this.getInitialExpected(c,b),n=-1;f&&(c.repaired=!0,c.endNeedsUpdate=!0,n=(n=c.children[c.children.length-1])?a.getLineEnd(a.getLineAtOffset(n.end+(d-g))):-1,e=a.getLineEnd(a.getLineAtOffset(e+g)),n=Math.max(n,e));n=-1===n?k:n;e=l;for(var r=c,v=!1,u=b,w=-1;r&&(!f||u<n);){var z=this.getNextMatch(a,r,u);z||(u=u>=h?k:a.getLineStart(a.getLineAtOffset(u)+
1));var y=z&&z.match,x=z&&z.rule,p=z&&z.isEnd;if(z&&z.isSub)u=this.afterMatch(y),x instanceof this.BeginEndRule&&(v=!0,f&&x===e.rule&&r===e.parent?(r=e,r.setStart(y),r.repaired=!0,r.endNeedsUpdate=!0,e=this.getNextExpected(e,"begin")):(f&&(this.prune(r,e),f=!1),y=new this.BeginEndNode(r,x,y),r.addChild(y),r=y));else if(p||u===k)r instanceof this.BeginEndNode&&(y?(v=!0,w=Math.max(w,r.end),r.setEnd(y),u=this.afterMatch(y),f&&r===e&&r.parent===e.parent?(r.repaired=!0,delete r.endNeedsUpdate,e=this.getNextExpected(e,
"end")):f&&(this.prune(r,e),f=!1)):(r.setEnd(k),delete r.endNeedsUpdate)),r=r.parent;f&&u>=n&&!v&&(this.prune(c,l),f=!1)}this.removeUnrepairedChildren(c,f,b);this.cleanup(f,c,b,n,k,d,g);return f?Math.max(w,u):u},removeUnrepairedChildren:function(c,f,b){if(f){f=c.children;for(var e=-1,d=0;d<f.length;d++){var g=f[d];if(!g.repaired&&this.isDamaged(g,b,Number.MAX_VALUE)){e=d;break}}-1!==e&&(c.children.length=e)}},cleanup:function(c,f,b,e,d,g,a){if(c){c=g-a;d=this.getIntersecting(e-c+1,d);f=this.getIntersecting(b,
e);for(b=0;b<d.length;b++)e=d[b],!e.repaired&&e instanceof this.BeginEndNode&&(e.shiftEnd(c),e.shiftStart(c));for(b=0;b<f.length;b++)e=f[b],e.repaired&&e.endNeedsUpdate&&e.shiftEnd(c),delete e.endNeedsUpdate,delete e.repaired}else{f=this.getIntersecting(b,e);for(b=0;b<f.length;b++)delete f[b].repaired}},getNextMatch:function(c,f,b,e){var d=c.getLineAtOffset(b),d=c.getLineEnd(d),g=c.getText(b,d),a=[],h=[];c=[];d=[];for(this.push(a,f.rule.subrules);a.length;){var k=a.length?a.pop():null,k=k&&k._resolvedRule._typedRule;
if(k instanceof this.ContainerRule&&-1===h.indexOf(k))h.push(k),this.push(a,k.subrules);else if(!k||!e||k.matchRegex){var l=k&&this.exec(k.matchRegex||k.beginRegex,g,b);l&&(c.push(l),d.push(k))}}a=Number.MAX_VALUE;h=-1;for(k=0;k<c.length;k++)l=c[k],l.index<a&&(a=l.index,h=k);if(!e&&(b=this.getEndMatch(f,g,b)))if(e=f.rule.applyEndPatternLast,-1===h||b.index<a||!e&&b.index===a)return{isEnd:!0,rule:f.rule,match:b};return-1===h?null:{isSub:!0,rule:d[h],match:c[h]}},getInitialExpected:function(c,f){var b,
e;if(c===this._tree)for(b=0;b<c.children.length;b++){if(e=c.children[b],e.start>=f)return e}else if(c instanceof this.BeginEndNode&&c.endMatch){var d=c.endMatch.index;for(b=0;b<c.children.length&&!(e=c.children[b],e.start>=f);b++);if(e&&e.start<d)return e}return c},getNextExpected:function(c,f){if("begin"===f){var b=c.children[0];return b?b:c}if("end"===f&&(b=c.parent)){var e=b.children[b.children.indexOf(c)+1];return e?e:b}return null},prune:function(c,f){f.parent===c?c.children.length=f.getIndexInParent():
c instanceof this.BeginEndNode&&(c.endMatch=null,c.end=null);c.parent&&(c.parent.children.length=c.getIndexInParent()+1)},onLineStyle:function(c){this._tree||this.initialParse();var f=c.lineStart,b=this.textView.getModel(),e=b.getLineEnd(c.lineIndex),d=b.getLineEnd(b.getLineAtOffset(f)-1),d=this.getFirstDamaged(d,d),f=this.getLineScope(b,d,f,e);c.ranges=this.toStyleRanges(f);c.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(c,f,b,e){for(var d=b,g=this.getInitialExpected(f,
b),a=[],h=[];f&&d<e;){var k=this.getNextMatch(c,f,d);if(!k)break;var l=k&&k.match,n=k&&k.rule,r=k&&k.isSub,k=k&&k.isEnd;l.index!==d&&h.push({start:d,end:l.index,node:f});r?(d=this.afterMatch(l),n instanceof this.BeginEndRule?(this.addBeginScope(a,l,n),f=g,g=this.getNextExpected(g,"begin")):this.addMatchScope(a,l,n)):k&&(d=this.afterMatch(l),this.addEndScope(a,l,n),g=this.getNextExpected(g,"end"),f=f.parent)}d<e&&h.push({start:d,end:e,node:f});c=this.getInheritedLineScope(h,b,e);return a.concat(c)},
getInheritedLineScope:function(c,f,b){f=[];for(b=0;b<c.length;b++)for(var e=c[b],d=e.node;d;){var g=d.rule.rule,a=g.name;if(g=g.contentName||a){this.addScopeRange(f,e.start,e.end,g);break}d=d.parent}return f},addBeginScope:function(c,f,b){var e=b.rule;this.addCapturesScope(c,f,e.beginCaptures||e.captures,b.isComplex,b.beginOld2New,b.beginConsuming)},addEndScope:function(c,f,b){var e=b.rule;this.addCapturesScope(c,f,e.endCaptures||e.captures,b.isComplex,b.endOld2New,b.endConsuming)},addMatchScope:function(c,
f,b){var e=b.rule,d=e.name;(e=e.captures)?this.addCapturesScope(c,f,e,b.isComplex,b.matchOld2New,b.matchConsuming):this.addScope(c,f,d)},addScope:function(c,f,b){b&&c.push({start:f.index,end:this.afterMatch(f),scope:b})},addScopeRange:function(c,f,b,e){e&&c.push({start:f,end:b,scope:e})},addCapturesScope:function(c,f,b,e,d,g){if(b)if(e){e={1:0};for(var a=0,h=1;void 0!==f[h];h++)void 0!==g[h]&&(a+=f[h].length),void 0!==f[h+1]&&(e[h+1]=a);g=f.index;for(a=1;b[a];a++){var h=b[a].name,k=d[a],l=g+e[k];
"undefined"!==typeof f[k]&&this.addScopeRange(c,l,l+f[k].length,h)}}else this.addScope(c,f,b[0]&&b[0].name)},getIntersecting:function(c,f){for(var b=[],e=this._tree?[this._tree]:[];e.length;){var d=e.pop(),g=!1;d instanceof this.ContainerNode?g=!0:this.isDamaged(d,c,f)&&(g=!0,b.push(d));if(g)for(var g=d.children.length,a=0;a<g;a++)e.push(d.children[a])}return b.reverse()},toStyleRanges:function(c){for(var f=[],b=0;b<c.length;b++){var e=c[b],d=this._styles[e.scope];if(!d)throw Error("styles not found for "+
e.scope);d=d.join(" ");f.push({start:e.start,end:e.end,style:{styleClass:d}})}return f}};return{RegexUtil:g,TextMateStyler:l}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(k,n){function l(b){return-1!==b.getProperty("objectClass").indexOf(c)&&"highlighter"===b.getProperty("type")}function g(b,c,d){this.initialize(b,c,d);this.lineStyles=[]}var c="orion.edit.highlighter",f=c+" service must be an event emitter";n.AnnotationType.registerType("orion.annotation.highlightError",{title:k.syntaxError,html:"\x3cdiv class\x3d'annotationHTML error'\x3e\x3c/div\x3e",rangeStyle:{styleClass:"annotationRange error"}});
g.prototype={initialize:function(b,e,d){this.textView=b;this.serviceRegistry=e;this.annotationModel=d;this.services=[];var f=this;this.listener={onModelChanging:function(a){f.onModelChanging(a)},onModelChanged:function(a){f.onModelChanged(a)},onDestroy:function(a){f.onDestroy(a)},onLineStyle:function(a){f.onLineStyle(a)},onStyleReady:function(a){f.onStyleReady(a)},onServiceAdded:function(a){f.onServiceAdded(a.serviceReference,f.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){f.onServiceRemoved(a.serviceReference,
f.serviceRegistry.getService(a.serviceReference))}};b.addEventListener("ModelChanging",this.listener.onModelChanging);b.addEventListener("ModelChanged",this.listener.onModelChanged);b.addEventListener("Destroy",this.listener.onDestroy);b.addEventListener("LineStyle",this.listener.onLineStyle);e.addEventListener("registered",this.listener.onServiceAdded);e.addEventListener("unregistering",this.listener.onServiceRemoved);b=e.getServiceReferences(c);for(d=0;d<b.length;d++){var a=b[d];l(a)&&this.addServiceListener(e.getService(a))}},
onDestroy:function(b){this.destroy()},destroy:function(){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 b=0;b<this.services.length;b++)this.removeServiceListener(this.services[b]);this.services=
null}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(b){this.startLine=this.textView.getModel().getLineAtOffset(b.start)},onModelChanged:function(b){var c=this.startLine;(b.addedLineCount||b.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[c,b.removedLineCount].concat(this._getEmptyStyle(b.addedLineCount)))},
onStyleReady:function(b){var c=b.lineStyles||b.style;b=Number.MAX_VALUE;var d=-1,f=this.textView.getModel(),a;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(this.lineStyles[a]=c[a],b=Math.min(b,a),d=Math.max(d,a));b=Math.max(b,0);d=Math.min(d,f.getLineCount());if(c=this.annotationModel){for(var g=c.getAnnotations(f.getLineStart(b),f.getLineEnd(d)),k=[];g.hasNext();){var l=g.next();"orion.annotation.highlightError"===l.type&&k.push(l)}g=[];for(l=b;l<=d;l++){a=l;var q=this.lineStyles[a],q=q&&
q.errors;a=f.getLineStart(a);if(q)for(var r=0;r<q.length;r++){var v=q[r];g.push(n.AnnotationType.createAnnotation("orion.annotation.highlightError",v.start+a,v.end+a))}}c.replaceAnnotations(k,g)}this.textView.redrawLines(b,d+1)},onLineStyle:function(b){var c=this.lineStyles[b.lineIndex];if(c)if(c.ranges){for(var c=c.ranges,d=b.lineStart,f=c.length,a=[],g=0;g<f;g++){var k=c[g];a.push({start:k.start+d,end:k.end+d,style:k.style})}b.ranges=a}else c.style&&(b.style=c.style)},_getEmptyStyle:function(b){for(var c=
[],d=0;d<b;d++)c.push(null);return c},setContentType:function(b){this.contentType=b;if(this.services)for(b=0;b<this.services.length;b++){var c=this.services[b];if(c.setContentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(c.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):c.setContentType(this.contentType)}}},onServiceAdded:function(b,c){l(b)&&this.addServiceListener(c)},onServiceRemoved:function(b,
c){-1!==this.services.indexOf(c)&&this.removeServiceListener(c)},addServiceListener:function(b){if("function"===typeof b.addEventListener){if(b.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(b),b.setContentType&&this.contentType){var c=this.serviceRegistry.getService("orion.page.progress");c?c.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}else"undefined"!==
typeof console&&console.log(Error(f))},removeServiceListener:function(b){"function"===typeof b.removeEventListener?(b.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),b=this.services.indexOf(b),-1!==b&&this.services.splice(b,1)):"undefined"!==typeof console&&console.log(Error(f))}};return g});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(k,n,l,g,c){function f(b,f,a,h,s,t,q){function r(b,d){var e=b.getProperty("contentType")||b.getProperty("contentTypes"),g=b.getProperty("fileTypes");return e?c.when(f.isSomeExtensionOf(a,e)).then(function(a){return a?b:null}):d&&g&&-1!==g.indexOf(d)?(e=new c,e.resolve(b),e):null}function v(a){var b=null;switch(a&&a.id){case "application/javascript":case "application/json":b=
new k.TextStyler(h,"js",s);break;case "text/x-java-source":b=new k.TextStyler(h,"java",s);break;case "text/css":b=new k.TextStyler(h,"css",s)}return b}if(!e){var u=v(a);if(u)return t=new c,t.resolve(u),t}e&&!this.orionGrammars&&(this.orionGrammars={});u=t&&t.split(".").pop().toLowerCase();t=b.getServiceReferences("orion.edit.highlighter");for(var w=[],z=[],y=0;y<t.length;y++){var x=t[y],p=x.getProperty("type");"grammar"===p||!e&&"undefined"===typeof p?w.push(x.getProperty("grammar")):"highlighter"!==
p&&(p=x.getProperty("id"))&&!this.orionGrammars[p]&&(this.orionGrammars[p]={id:p,contentTypes:x.getProperty("contentTypes"),patterns:x.getProperty("patterns"),repository:x.getProperty("repository")});(x=r(x,u))&&z.push(x)}return c.all(z,function(a){return{_error:a}}).then(function(c){for(var f,k=c.length-1;0<=k;k--){var m=c[k];if(m&&!m._error&&(q||"highlighter"!==m.getProperty("type"))){f=m;break}}var p;if(f)if(c=f.getProperty("type"),"highlighter"===c)p=new g(h,b,s),p.setContentType(a);else if("grammar"===
c||!e&&"undefined"===typeof c)f=f.getProperty("grammar"),p=new l.TextMateStyler(h,f,w);else if(e){p=[];for(var r in this.orionGrammars)p.push(this.orionGrammars[r]);p=new n.TextStyler(h,s,p,f.getProperty("id"))}return p})}function b(b,c){this.serviceRegistry=b;this.contentTypeService=c;this.styler=null}var e=1;b.prototype={setup:function(b,c,a,e,g){g="undefined"===typeof g?!0:g;this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null);var k=this;return f(this.serviceRegistry,this.contentTypeService?
this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),b,c,a,e,g).then(function(a){return k.styler=a})},getStyler:function(){return this.styler}};return{createStyler:f,SyntaxHighlighter:b}});
define("orion/markOccurrences",["orion/edit/editorContext","orion/Deferred"],function(k,n){function l(g,c,f){this.registry=g;this.inputManager=c;this.editor=f}l.prototype={setOccurrencesVisible:function(g){this.occurrencesVisible!==g&&((this.occurrencesVisible=g)||this.editor.showOccurrences([]))},findOccurrences:function(){function g(b,c,a){function e(a,b,c){a=b.getProperty("contentType");return f.isSomeExtensionOf(c,a).then(function(a){return a?b:null})}for(var f=b.getService("orion.core.contentTypeRegistry"),
g=b.getServiceReferences("orion.edit.occurrences"),k=[],l=0;l<g.length;l++){var v=g[l],u=v.getProperty("pattern");v.getProperty("contentType")?k.push(e(b,v,c)):u&&RegExp(u).test(a)&&(u=new n,u.resolve(v),k.push(u))}return n.all(k,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}var c,f=this,b=f.registry.getService("orion.edit.occurrences"),e=function(d){c&&window.clearTimeout(c);f.occurrencesVisible&&(c=window.setTimeout(function(){c=
null;var d={selection:f.editor.getSelection(),contentType:f.inputManager.getContentType().id};b.computeOccurrences(k.getEditorContext(f.registry),d).then(function(a){f.editor.showOccurrences(a)})},500))};f.inputManager.addEventListener("InputChanged",function(b){var k=f.editor.getTextView();k&&(k.removeEventListener("Selection",e),g(f.registry,b.contentType,b.title).then(function(a){!a||0===a.length?c&&window.clearTimeout(c):k.addEventListener("Selection",e)}))})}};return{MarkOccurrences:l}});
define("orion/syntaxchecker",["orion/Deferred","orion/edit/editorContext"],function(k,n){return{SyntaxChecker:function(){function l(c,f){this.registry=c;this.editor=f}function g(c,f,b){c=Math.max(c,f);return Math.min(c,b)}l.prototype={checkSyntax:function(c,f,b,e){function d(a,b){function c(a,b,e){a=b.getProperty("contentType");return d.isSomeExtensionOf(e,a).then(function(a){return a?b:null})}for(var d=a.getService("orion.core.contentTypeRegistry"),e=a.getServiceReferences("orion.edit.validator"),
g=[],m=0;m<e.length;m++){var l=e[m],n=l.getProperty("pattern");l.getProperty("contentType")?g.push(c(a,l,b)):n&&RegExp(n).test(f)&&(n=new k,n.resolve(l),g.push(n))}return k.all(g,function(a){return{_error:a}}).then(function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d&&!d._error&&b.push(d)}return b})}if(c&&!b){var g=this,a=this.registry;d(a,c).then(function(b){var d=function(a){return a&&(a.problems||a.errors)||[]},l=a.getService("orion.page.progress");b=b.map(function(b){b=a.getService(b);var g;
b.computeProblems?(g={contentType:c.id,title:f},g=b.computeProblems(n.getEditorContext(a),g)):b.checkSyntax&&(g=b.checkSyntax(f,e));return l.progress(g,"Validating "+f).then(d)});k.all(b,function(a){return{_error:a}}).then(function(b){for(var c=[],d=0;d<b.length;d++){var e=b[d];e._error||(g._fixup(e),c=c.concat(e))}a.getService("orion.core.marker")._setProblems(c)})})}},_fixup:function(c){for(var f=this.editor.getModel(),b=0;b<c.length;b++){var e=c[b];e.description=e.description||e.reason;e.severity=
e.severity||"error";e.start="number"===typeof e.start?e.start:e.character;if("number"===typeof e.line){var d=f.getLine(e.line-1,!1).length;e.start=g(e.start,1,d-1);e.end="number"===typeof e.end?e.end:-1;e.end=g(e.end,e.start+1,d)}else if(d=f.getCharCount(),e.start=g(e.start,0,d),e.end="number"===typeof e.end?e.end:-1,e.end=g(e.end,e.start,d),e.end===d&&1<f.getLineCount()&&d===f.getLineStart(f.getLineCount()-1)){var k=f.getLineCount()-2,d=f.getLineStart(k),k=f.getLineEnd(k);d===k?e.start=e.end=k:(e.start=
k-1,e.end=k)}}}};return l}()}});
define("orion/editorView","i18n!orion/edit/nls/messages orion/editor/editor orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/editorFeatures orion/editor/contentAssist orion/editor/emacs orion/editor/vi orion/editorPreferences orion/widgets/themes/ThemePreferences orion/widgets/themes/editor/ThemeData orion/widgets/settings/EditorSettings orion/searchAndReplace/textSearcher orion/editorCommands orion/globalCommands orion/edit/dispatcher orion/edit/editorContext orion/edit/typedefs orion/highlight orion/markOccurrences orion/syntaxchecker orion/keyBinding orion/uiUtils orion/util orion/objects".split(" "),function(k,
n,l,g,c,f,b,e,d,m,a,h,s,t,q,r,v,u,w,z,y,x,p,A,C,B){function J(a){this._parent=a.parent;this.renderToolbars=a.renderToolbars;this.serviceRegistry=a.serviceRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.progress=a.progress;this.statusService=a.statusService;this.fileClient=a.fileService;this.inputManager=a.inputManager;this.preferences=a.preferences;this.readonly=a.readonly;this.searcher=a.searcher;this.statusReporter=a.statusReporter;this.model=
a.model;this.undoStack=a.undoStack;this.syntaxHighlighter=new z.SyntaxHighlighter(this.serviceRegistry);this.typeDefRegistry=new w(this.serviceRegistry);(a=r.getKeyAssist())&&a.addProvider(this);var b=r.getMainSplitter();b&&b.splitter.addEventListener("resize",function(a){this.editor&&a.node===b.main&&this.editor.resize()}.bind(this));r.getGlobalEventTarget().addEventListener("toggleTrim",function(a){this.editor&&this.editor.resize()}.bind(this));this.settings={};this._init()}J.prototype={updateKeyMode:function(a,
b){this.emacs&&b.removeKeyMode(this.emacs);this.vi&&b.removeKeyMode(this.vi);"Emacs"===a.keyBindings?(this.emacs||(this.emacs=new e.EmacsMode(b)),b.addKeyMode(this.emacs)):"vi"===a.keyBindings&&(this.vi||(this.vi=new d.VIMode(b,this.statusReporter)),b.addKeyMode(this.vi))},getParent:function(){return this._parent},updateSourceCodeActions:function(a,b){b&&(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))},updateViewOptions:function(a){var b=0;a.showMargin&&(b=a.marginOffset,"number"!==typeof b&&(b=a.marginOffset=parseInt(b,10)));var c=0;a.wordWrap&&(c=b);return{readonly:this.readonly||this.inputManager.getReadOnly(),tabSize:a.tabSize||4,expandTab:a.expandTab,wrapMode:a.wordWrap,wrapOffset:c,marginOffset:b,scrollAnimation:a.scrollAnimation?a.scrollAnimationTimeout:
0}},updateSettings:function(a){this.settings=a;var b=this.editor,c=this.inputManager;c.setAutoLoadEnabled(a.autoLoad);c.setAutoSaveTimeout(a.autoSave?a.autoSaveTimeout:-1);c.setSaveDiffsEnabled(a.saveDiffs);this.updateStyler(a);var d=b.getTextView();d&&(this.updateKeyMode(a,d),d.setOptions(this.updateViewOptions(a)));this.updateSourceCodeActions(a,b.getSourceCodeActions());b.setAnnotationRulerVisible(a.annotationRuler);b.setLineNumberRulerVisible(a.lineNumberRuler);b.setFoldingRulerVisible(a.foldingRuler);
b.setOverviewRulerVisible(a.overviewRuler);this.renderToolbars&&this.renderToolbars(c.getFileMetadata());this.markOccurrences.setOccurrencesVisible(a.showOccurrences);b.getContentAssist()&&b.getContentAssist().setAutoTriggerEnabled(a.contentAssistAutoTrigger)},updateStyler:function(a){var b=this.syntaxHighlighter.getStyler();b&&(b.setTabsVisible&&b.setTabsVisible(a.showTabs),b.setSpacesVisible&&b.setSpacesVisible(a.showSpaces))},showKeyBindings:function(a){var b=this.editor;if(b&&b.getTextView&&b.getTextView()){var c=
b.getTextView(),d=c.getActions(!0).filter(function(a){return(a=c.getActionDescription(a))&&a.name});d.sort(function(a,b){return c.getActionDescription(a).name.localeCompare(c.getActionDescription(b).name)});a.createHeader(k.Editor);for(var e=function(a){return function(){c.focus();return c.invokeAction(a)}},b={},f,g=0;g<d.length;g++)for(var h=d[g],l=c.getActionDescription(h),m=c.getKeyBindings(h),n=0;n<m.length;n++){f=m[n];var p=A.getUserKeyString(f);f.scopeName?(b[f.scopeName]||(b[f.scopeName]=[]),
b[f.scopeName].push({bindingString:p,name:l.name,execute:e(h)})):a.createItem(p,l.name,e(h))}for(var q in b)if(b[q].length){a.createHeader(q);for(d=0;d<b[q].length;d++)f=b[q][d],a.createItem(f.bindingString,f.name,f.execute)}}},_init:function(){var d=null;this.preferences&&(d=this.editorPreferences=new m.EditorPreferences(this.preferences,function(a){a?this.updateSettings(a):d.getPrefs(this.updateSettings.bind(this))}.bind(this)));var e=null;this.preferences&&(e=new a.ThemePreferences(this.preferences,
new h.ThemeData),e.apply());var r,w=this,z=this._parent,A=this.readonly,J=this.commandRegistry,O=this.serviceRegistry,M=this.fileClient,P=this.inputManager,U=this.searcher,X=this.progress,W=this.contentTypeRegistry,S=function(a,b,c){var d=P.getContentType(),e=a.getTitle();a=O.getServiceReferences("orion.edit.contentAssist").concat(O.getServiceReferences("orion.edit.contentassist"));(c=c&&c.providerInfoArray)||(c=a.map(function(a){var b=a.getProperty("contentType"),c=a.getProperty("pattern");if(b&&
W.isSomeExtensionOf(d,b)||c&&RegExp(c).test(e)){var b=O.getService(a),c=a.getProperty("service.id").toString(),f=a.getProperty("charTriggers");a=a.getProperty("excludedStyles");f&&(f=RegExp(f));a&&(a=RegExp(a));return{provider:b,id:c,charTriggers:f,excludedStyles:a}}return null}).filter(function(a){return!!a}));var f={};Object.keys(u).forEach(function(a){"function"===typeof u[a]&&(f[a]=u[a].bind(null,O))});b.setEditorContextProvider(f);b.setProviderInfoArray(c);b.setAutoTriggerEnabled(w.settings.contentAssistAutoTrigger);
b.setProgress(X);b.setStyleAccessor(w.getStyleAccessor())},Q=A?null:{createContentAssistMode:function(a){var c=new b.ContentAssist(a.getTextView());c.addEventListener("Activating",S.bind(null,a,c));var d=new b.ContentAssistWidget(c,"contentassist"),d=new b.ContentAssistMode(c,d);c.setMode(d);S(a,c);c.computeProposals();return d}},F=this.editor=new n.Editor({textViewFactory:function(){var a=w.updateViewOptions(w.settings);B.mixin(a,{parent:z,model:new c.ProjectionTextModel(w.model||new g.TextModel),
wrappable:!0});return new l.TextView(a)},undoStackFactory:w.undoStack?{createUndoStack:function(a){w.undoStack.setView(a.getTextView());return w.undoStack}}:new f.UndoFactory,textDNDFactory:new f.TextDNDFactory,annotationFactory:new f.AnnotationFactory,foldingRulerFactory:new f.FoldingRulerFactory,lineNumberRulerFactory:new f.LineNumberRulerFactory,contentAssistFactory:Q,keyBindingFactory:function(a,b,c,e){b=new t.TextSearcher(a,O,J,c);c=(new f.KeyBindingsFactory).createKeyBindings(a,c,e,b);w.updateSourceCodeActions(w.settings,
c.sourceCodeActions);(new q.EditorCommandFactory({serviceRegistry:O,commandRegistry:J,fileClient:M,inputManager:P,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",readonly:A,navToolbarId:"pageNavigationActions",textSearcher:b,searcher:U,editorSettings:function(){return w.settings},localSettings:r})).generateEditorCommands(a);var g=a.getTextView();if(a=J.findCommand("orion.keyAssist"))g.setKeyBinding(new p.KeyStroke(191,!1,!0,!C.isMac,C.isMac),a.id),g.setAction(a.id,
a.callback,a);g.setAction("toggleWrapMode",function(){g.invokeAction("toggleWrapMode",!0);var a=g.getOptions("wrapMode");w.settings.wordWrap=a;d&&d.setPrefs(w.settings);return!0});w.vi=w.emacs=null;w.updateKeyMode(w.settings,g);return c},statusReporter:this.statusReporter,domNode:z});F.id="orion.editor";F.processParameters=function(a){for(var b=["start","end","line","offset","length"],c=0;c<b.length;c++){var d=b[c];a[d]&&(a[d]=parseInt(a[d],10))}this.showSelection(a.start,a.end,a.line,a.offset,a.length)};
this.dispatcher=new v.Dispatcher(this.serviceRegistry,F,P);e&&d&&(r=new s({local:!0,editor:F,themePreferences:e,preferences:d}));P.addEventListener("InputChanged",function(a){var b=F.getTextView();b&&(b.setOptions(this.updateViewOptions(this.settings)),this.syntaxHighlighter.setup(a.contentType,F.getTextView(),F.getAnnotationModel(),a.title,!0).then(function(){this.updateStyler(this.settings);F.getContentAssist()&&S(F,F.getContentAssist())}.bind(this)))}.bind(this));P.addEventListener("Saving",function(a){w.settings.trimTrailingWhiteSpace&&
F.getTextView().invokeAction("trimTrailingWhitespaces")});(e=O.getService("orion.core.marker"))&&e.addEventListener("problemsChanged",function(a){F.showProblems(a.problems)});(e=O.getService("orion.core.blame"))&&e.addEventListener("blameChanged",function(a){F.showBlame(a.blameInfo)});e=this.markOccurrences=new y.MarkOccurrences(O,P,F);e.setOccurrencesVisible(this.settings.occurrencesVisible);e.findOccurrences();var D=new x.SyntaxChecker(O,F);F.addEventListener("InputChanged",function(a){D.checkSyntax(P.getContentType(),
a.title,a.message,a.contents);P.getReadOnly()&&F.reportStatus(k.readonly,"error")});var L={};"getCaretOffset setCaretOffset getSelection setSelection getText setText getLineAtOffset getLineStart".split(" ").forEach(function(a){L[a]=F[a].bind(F)});O.registerService("orion.edit.context",L,null);this.editorPreferences&&this.editorPreferences.getPrefs(this.updateSettings.bind(this))},create:function(){this.editor.install()},destroy:function(){this.editor.uninstall()},getStyleAccessor:function(){var a=
null,b=this.syntaxHighlighter.getStyler();b&&b.getStyleAccessor&&(a=b.getStyleAccessor());return a}};return{EditorView:J}});
define("orion/editorPluginView","orion/editor/editor orion/commands orion/editorCommands orion/objects orion/webui/littlelib orion/PageLinks orion/URITemplate".split(" "),function(k,n,l,g,c,f,b){function e(a){m.apply(this,arguments);this.editorService=a.editorService;this.id=this.editorService.getProperty("id");this.metadata=a.metadata;this.serviceRegistry=a.serviceRegistry;this.pluginRegistry=a.pluginRegistry;this.statusService=a.statusService;this.inputManager=a.inputManager}function d(a){this._parent=
a.parent;this.serviceRegistry=a.serviceRegistry;this.pluginRegistry=a.pluginRegistry;this.contentTypeRegistry=a.contentTypeRegistry;this.commandRegistry=a.commandRegistry;this.statusService=a.statusService;this.progressService=a.progressService;this.editorService=a.editorService;this.metadata=a.metadata;this.inputManager=a.inputManager;this.readonly=a.readonly;this.model=a.model;this.undoStack=a.undoStack}var m=k.BaseEditor;e.prototype=Object.create(m.prototype);g.mixin(e.prototype,{_getPlugin:function(){return this.pluginRegistry.getPlugin(this.editorService._properties.__plugin__)},
_load:function(){for(var a=this.serviceRegistry,b=a.getServiceReferences("orion.edit.editor"),c=0;c<b.length;c++)b[c].getProperty("id")===this.id&&(this.editorService=b[c]);b=a.getService(this.editorService);b.setBlob&&b.setBlob(new Blob([this._contents],{type:this.inputManager.getContentType().id}));b.setTextModel&&(a=a.getService(a.getServiceReferences("orion.edit.model.context")[0]),a.processKey=function(a){n.processKey(a)},b.setTextModel(a));if(b.registerKeys){var d=n.getKeyBindings(),e=[];Object.keys(d).forEach(function(a){a=
d[a].keyBinding;e.push({keyCode:a.keyCode,mod1:a.mod1,mod2:a.mod2,mod3:a.mod3,mod4:a.mod4})});b.registerKeys(e)}},install:function(){var a=c.node(this._domNode),b=this._rootDiv=document.createElement("div");b.style.width="100%";b.style.height="100%";b.style.overflow="hidden";var d=this;this._getPlugin().setParent(b).then(function(){d._load()},function(a){var b=d.statusService;if(b){var c=a.responseText;if(c)try{a=JSON.parse(c)}catch(e){a={Severity:"Error",Message:c}}b.setProgressResult(a)}else window.console.log(a)});
a.appendChild(b);m.prototype.install.call(this)},onChanged:function(a){m.prototype.onChanged.call(this,a);var b=this.serviceRegistry.getService(this.editorService);if(b&&b.onChanged)b.onChanged(a)},setInput:function(a,b,c,d){"string"!==typeof c&&(this._contents=c);m.prototype.setInput.call(this,a,b,c,d)},uninstall:function(){this._getPlugin().setParent(null);c.empty(this._domNode);m.prototype.uninstall.call(this)}});d.prototype={create:function(){this.editor=new e({domNode:this._parent,model:this.model,
undoStack:this.undoStack,serviceRegistry:this.serviceRegistry,pluginRegistry:this.pluginRegistry,editorService:this.editorService,statusService:this.statusService,inputManager:this.inputManager,metadata:this.metadata});this.editor.install();(new l.EditorCommandFactory({serviceRegistry:this.serviceRegistry,commandRegistry:this.commandRegistry,inputManager:this.inputManager,readonly:this.readonly,toolbarId:"toolsActions",saveToolbarId:"fileActions",editToolbarId:"editActions",navToolbarId:"pageNavigationActions"})).generateBaseEditorCommands(this.editor)},
destroy:function(){this.editor&&this.editor.destroy();this.editor=null}};return{PluginEditorView:d,PluginEditor:e}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(k){return{detectValidURL:function(n){for(var l=/\[([^\]]*)\]\(([^\)]+)\)/g,g=l.exec(n),c=[],f=0;g;){if(3===g.length&&0<g[2].length){var b=new URL(g[2]);":"!==b.protocol&&k.validateURLScheme(b.href)&&(g.index>f&&c.push({segmentStr:n.substring(f,g.index)}),c.push({segmentStr:0<g[1].length?g[1]:g[2],urlStr:g[2]}),f=g.index+g[0].length)}g=l.exec(n)}if(0===f)return null;f<n.length-1&&c.push({segmentStr:n.substring(f)});return c},processURLSegments:function(k,
l){l.forEach(function(g){if(g.urlStr){var c=document.createElement("a");c.href=g.urlStr;c.appendChild(document.createTextNode(g.segmentStr))}else c=document.createElement("span"),c.textContent=g.segmentStr;k.appendChild(c)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(k,n,l,g){function c(b,c,d,f,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.message",this);this._operationsClient=c;this.notificationContainerDomId=a;this.domId=d;this.progressDomId=f||d;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var f;c.prototype={_init:function(){var b=n.node("closeNotifications");if(b&&
!this._hookedClose){b.style.cursor="pointer";this._hookedClose=!0;var c=n.node(this.notificationContainerDomId);n.addAutoDismiss([c],function(){this._clickToDisMiss&&this.close()}.bind(this));b.addEventListener("click",function(){this.close()}.bind(this));c.addEventListener("click",function(b){b&&b.target&&"a"===b.target.nodeName.toLowerCase()&&(b=n.$$("a",c))&&b.length&&1===b.length&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var b=n.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&b?(b.innerHTML="",b.classList.remove("cancelButton"),b.classList.add("dismissButton"),b.classList.add("core-sprite-close"),b.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){this._notifierElements||(this._notifierElements=l.getToolbarElements(this.notificationContainerDomId));return this._notifierElements},setMessage:function(b,c,d){this._init();this.currentMessage=b;var f=n.node(this.domId);
if("boolean"===typeof d){var a=f.getAttribute("aria-live");f.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){b===this.currentMessage&&(n.empty(f),f.appendChild(document.createTextNode(b)),window.setTimeout(function(){f.setAttribute("aria-live",a)},100))}.bind(this),100)}else n.empty(f),f.appendChild(document.createTextNode(b));"number"===typeof c&&window.setTimeout(function(){b===this.currentMessage&&(n.empty(f),f.appendChild(document.createTextNode("")))}.bind(this),c)},setErrorMessage:function(b){this._clickToDisMiss=
!0;this.currentMessage=b;this._init();var c=b.responseText||b.message||b;if("string"===typeof c)try{c=JSON.parse(c)}catch(d){}b=c.Message||c;var f="red";if(c.Severity)switch(c.Severity){case "Warning":f="#FFCC00";break;case "Error":f="red";break;case "Info":case "Ok":f="green"}c=document.createElement("span");c.style.color=f;c.appendChild(document.createTextNode(b));b=n.node(this.domId);n.empty(b);b.appendChild(c)},setProgressMessage:function(b){this._clickToDisMiss=!1;this._init();this.currentMessage=
b;var c=document.createElement("span");c.classList.add("progressIcon");var d=n.node(this.progressDomId);n.empty(d);d.appendChild(c);d.appendChild(document.createTextNode(b));c=n.node(this.notificationContainerDomId);c.classList.remove("notificationHide");if(b&&0<b.length)c.classList.add("progressNormal"),c.classList.add("notificationShow");else{if(this._progressMonitors&&0<this._progressMonitors.length)return this._renderOngoingMonitors();c.classList.remove("notificationShow");c.classList.add("notificationHide")}},
setCancelFunction:function(b){this._cancelFunc=b},setProgressResult:function(b,c){this._clickToDisMiss=!1;this._cancelMsg=c;this.currentMessage=b;var d=b.responseText||b;if("string"===typeof d)try{d=JSON.parse(d)}catch(f){}this._init();var a=d.Message||d.toString(),h=k.UnknownError,l="core-sprite-information",t="progressNormal",q=document.createElement("span");q.classList.add("imageSprite");q.classList.add("progressIcon");var r=[];if(d.Severity)switch(d.Severity){case "Warning":h=k.UnknownWarning;
l="core-sprite-warning";t="progressWarning";r.push("progressInfo");r.push("progressError");r.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":l="core-sprite-error";t="progressError";r.push("progressWarning");r.push("progressInfo");r.push("progressNormal");this._clickToDisMiss=!0;break;default:t="progressNormal",r.push("progressWarning"),r.push("progressError"),r.push("progressNormal")}r.push("notificationHide");q.classList.add(l);var v=n.node(this.progressDomId),l=n.node(this.notificationContainerDomId);
n.empty(v);v.appendChild(q);a===Object.prototype.toString()&&(a=h);d.HTML?(d=document.createElement("span"),d.innerHTML=a,v.appendChild(d)):((h=g.detectValidURL(a))?(a=document.createDocumentFragment(),g.processURLSegments(a,h),Array.prototype.forEach.call(n.$$("a",a),function(a){a.target="_blank"})):("Warning"!==d.Severity&&"Error"!==d.Severity&&!c&&(this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3)),
a=document.createTextNode(a)),v.appendChild(a));if(t&&this.progressDomId!==this.domId){l.classList.add(t);for(t=0;t<r.length;t++)l.classList.remove(r[t])}l.classList.add("notificationShow");if(r=n.node("closeNotifications"))this._cancelMsg?(r.classList.add("cancelButton"),r.classList.remove("dismissButton"),r.classList.remove("core-sprite-close"),r.classList.remove("imageSprite"),r.innerHTML=this._cancelMsg):(r.innerHTML="",r.classList.remove("cancelButton"),r.classList.add("dismissButton"),r.classList.add("core-sprite-close"),
r.classList.add("imageSprite"))},showWhile:function(b,c){var d=this;if(c){d.setProgressMessage(c);var f=function(){c===d.currentMessage&&d.setProgressMessage("")};b.then(f,f)}return b},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(b,c){return new f(this,++this._lastProgressId,b,c)},_renderOngoingMonitors:function(){if(0<this._progressMonitors.length){var b="",c=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(c||(b+=", "),b+=this._progressMonitors[d].status,
c=!1);this.setProgressMessage(b)}else this.setProgressMessage("")},_beginProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._renderOngoingMonitors()},_doneProgressMonitor:function(b){delete this._progressMonitors[b.progressId];this._progressMonitors.length--;b.status?this.setProgressResult(b.status):this._renderOngoingMonitors()}};c.prototype.constructor=
c;f=function(b,c,d,f){this.statusService=b;this.progressId=c;if(d){this.deferred=d;this.begin(f);var a=this;d.then(function(b,c){a.done.bind(a)()},function(b,c){a.done.bind(a)()})}};f.prototype.begin=function(b){this.status=b;this.statusService._beginProgressMonitor(this)};f.prototype.done=function(b){this.status=b;this.statusService._doneProgressMonitor(this)};f.prototype.worked=function(b){this.status=b;this.statusService._workedProgressMonitor(this)};f.prototype.constructor=f;return{StatusReportingService:c,
ProgressMonitor:f}});
define("orion/operations/nls/root/messages",{More:"More","No Matching OperationService for location:":"No Matching OperationService for location:","No operations services registered.":"No operations services registered.","could not find toolbar ":"could not find toolbar ","Remove Completed":"Remove Completed","Remove all completed operations":"Remove all completed operations",Remove:"Remove","Remove operations from the operations list.":"Remove operations from the operations list.",Cancel:"Cancel",
"Cancel operations from the operations list.":"Cancel operations from the operations list.","Operation resulted in a warning.":"Operation resulted in a warning.","Operation resulted in an error.":"Operation resulted in an error.","Operation is running.":"Operation is running.","Operation is canceled.":"Operation is canceled.","Operation failed.":"Operation failed.",Name:"Name",Actions:"Actions",Status:"Status",Scheduled:"Scheduled"});
define("orion/operations/nls/messages",["orion/i18n!orion/operations/nls/messages","orion/operations/nls/root/messages"],function(k,n){var l={root:n};Object.keys(k).forEach(function(g){"undefined"===typeof l[g]&&(l[g]=k[g])});return l});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(k,n,l,g){var c={};(function(){var f=!1;c.updateNavTools=function(b,c,d,g,a,h){var n=l.node(g);if(n)c.destroy(n);else throw k["could not find toolbar "]+g;c.renderCommands(g,n,h,d,"button");if(a&&(g=l.node(a)))c.destroy(g),c.renderCommands(a,g,null,d,"button");f||(f=!0,b.getService("orion.page.selection").addEventListener("selectionChanged",function(b){var f=l.node(a);
f&&(c.destroy(f),c.renderCommands(a,f,b.selections,d,"button"))}))};c.createOperationsCommands=function(b,c,d){function f(a){return!a.operation||!a.operation.type?!1:"loadstart"===a.operation.type||"progress"===a.operation.type}var a=new g.Command({name:k["Remove Completed"],tooltip:k["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(a){d.removeCompletedOperations().then(function(a){c.loadOperations.bind(c)()})},visibleWhen:function(a){return!0}});b.addCommand(a);
a=new g.Command({name:k.Remove,tooltip:k["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var b=0;b<a.length;b++){var f=a[b];d.removeOperation.bind(d)(f.Location).then(function(){c.loadOperations.bind(c)()},function(){c.loadOperations.bind(c)()})}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return!f(a);for(var b in a)if(f(a[b]))return!1;return!0}});b.addCommand(a);
a=new g.Command({name:k.Cancel,tooltip:k["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var b=0;b<a.length;b++){var c=a[b];c.deferred&&c.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return f(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var b in a)if(!f(a[b])||!a[b].operation||!a[b].operation.cancelable)return!1;return!0}});b.addCommand(a)}})();
return c});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(k,n,l,g,c){function f(b){this._options=b}f.prototype=new g.PopupDialog;f.prototype.TEMPLATE='\x3ctable style\x3d"width: 360px;"\x3e\x3ctr\x3e\x3ctd\x3e\x3ch2\x3eRecent operations\x3c/h2\x3e\x3c/td\x3e\x3ctd style\x3d"text-align: right;"\x3e\x3ca id\x3d"allOperationsLink" class\x3d"navlinkonpage"\x3eAll Operations\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cdiv id\x3d"operationsExist"\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"myOperationsListEmpty"\x3eNo operations running on this page.\x3c/div\x3e\x3ctable id\x3d"myOperationsList" style\x3d"display: none;"\x3e\x3c/table\x3e\x3c/div\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"operationsDontExist"\x3eNo operations running.\x3c/div\x3e';f.prototype._init=
function(b){this._myOperations=[];this._operationsDeferreds=[];this._commandService=b.commandRegistry;c.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(b.triggerNode)};f.prototype._bindToDom=function(b){this.$allOperationsLink.href=n.toUrl("operations/list.html");this._setOperationsVisibility()};f.prototype.setOperations=function(b,c){this._myOperations||this._init(this._options);
this._myOperations=[];this._operationsDeferreds=[];if(b)for(var d in b)this._myOperations.push(b[d]),this._operationsDeferreds.push(c[d]);this._renderOperations()};f.prototype.parseProgressResult=function(b){if(!b)return{};b=b.responseText||b;try{b=JSON.parse(b)}catch(c){}var d={Message:b.Message||b,Severity:b.Severity};b.DetailedMessage&&b.DetailedMessage!==d.Message&&(d.DetailedMessage=b.DetailedMessage);return d};f.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};f.prototype._renderOperationsTable=function(b,c,d){l.empty(b);for(var f=0;f<c.length;f++){var a=c[f],g=document.createElement("tr"),n=document.createElement("td");n.style.paddingLeft="5px";n.style.paddingRight="5px";n.textContent=a.Name;g.appendChild(n);var t=document.createElement("div");n.appendChild(t);n=document.createElement("span");n.style.paddingRight="5px";n.classList.add("imageSprite");switch(a.type){case "Warning":n.classList.add("core-sprite-warning");
n.setAttribute("aria-label",k["Operation resulted in a warning."]);break;case "error":n.classList.add("core-sprite-error");n.setAttribute("aria-label",k["Operation resulted in an error."]);break;case "loadstart":case "progress":n.classList.add("core-sprite-start");n.setAttribute("aria-label",k["Operation is running."]);break;case "abort":n.classList.add("core-sprite-stop");n.setAttribute("aria-label",k["Operation is canceled."]);break;case "load":case "loadend":n.classList.add("core-sprite-ok"),n.setAttribute("aria-label",
"Operation ok.")}t.appendChild(n);n=document.createElement("span");n.classList.add("operationStatus");n.textContent=a.Name;t.appendChild(n);if(a.error){var q=a.error.Message||a.error;a.error.DetailedMessage&&""!==a.error.DetailedMessage&&(q+=": "+a.error.DetailedMessage);n.textContent=q;n.classList.remove("operationStatus");n.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",t,{operation:a,deferred:d[f]},this,"tool");b.appendChild(g)}this._setOperationsVisibility()};
f.prototype._setOperationsVisibility=function(){this.$myOperationsList.style.display=0<this._myOperations.length?"":"none";this.$myOperationsListEmpty.style.display=0<this._myOperations.length?"none":"";this.$operationsDontExist.style.display=0<this._myOperations.length?"none":"";this.$operationsExist.style.display=0<this._myOperations.length?"":"none"};f.prototype.constructor=f;return{OperationsDialog:f}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(k,n,l,g,c){function f(b,d){if(!this._progressPane){this._progressPane=g.node(b);this._operationsDialog=new c.OperationsDialog({triggerNode:this._progressPane,commandRegistry:d});var f=this;this._progressPane.addEventListener("keydown",function(a){(" "===a.charOrCode||a.keyCode===g.KEY.ENTER)&&f._operationsDialog.show()});this._progressPane.addEventListener("click",
function(a){f._operationsDialog.show()});this._operationsDialog.setOperations(null,null)}}function b(b,c,f,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.progress",this);this._commandRegistry=f;this._operationsClient=c;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=a}f.prototype={_switchIconTo:function(b){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);
this._lastIconClass=b;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(b,c){var f={},a;for(a in b)b[a].progressMonitor||(f[a]=b[a]);if(this._isEmpty(f))this._switchIconTo("progressPane_empty"),this._progressPane.title=k.Operations,this._progressPane.alt=k.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var g="";for(a in f){var l=f[a];if(l.type&&("loadstart"===l.type||"progress"===l.type)){g=
"running";break}}""===g&&null!=this._lastOperation&&this._lastOperation.type&&"error"===this._lastOperation.type&&"error"==g;switch(g){case "running":this._progressPane.title=k["Operations running"];this._progressPane.alt=k["Operations running"];this._progressPane.setAttribute("aria-valuetext",k["Operations running"]);this._switchIconTo("running");break;case "warning":this._progressPane.title=k["Some operations finished with warning"];this._progressPane.alt=k["Some operations finished with warning"];
this._progressPane.setAttribute("aria-valuetext",k["Some operations finished with warning"]);this._switchIconTo("warning");break;case "error":this._progressPane.title=k["Some operations finished with error"];this._progressPane.alt=k["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",k["Some operations finished with error"]);this._switchIconTo("error");break;default:this._progressPane.title=k.Operations,this._progressPane.alt=k.Operations,this._progressPane.hasAttribute("aria-valuetext")&&
this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_empty")}}this._operationsDialog.setOperations(f,c)},_isEmpty:function(b){for(var c in b)return!1;return!0}};f.prototype.constructor=f;b.prototype={init:function(b){this._progressMonitorClass||(this._progressMonitorTool=new f(b,this._commandRegistry))},progress:function(b,c,f){var a=this,g=this._operationsIndex++;!f&&this._progressMonitorClass&&(f=new this._progressMonitorClass,f.begin(c));b.then(function(k){a._operations[g]&&
(k=a._operations[g],c&&(k.Name=c),a._lastOperation=k,k.type="loadend",f&&(k.progressMonitor=f),a.writeOperation.bind(a)(g,k,b),k.Location||a._removeOperationFromTheList.bind(a)(g))},function(k){if(a._operations[g]){var l=a._operations[g];c&&(l.Name=c);f&&(l.progressMonitor=f);a._lastOperation=l;l.type=k.canceled?"abort":"error";l.error=k;a.writeOperation.bind(a)(g,l,b);l.Location||a._removeOperationFromTheList.bind(a)(g)}},function(k){c&&(k.Name=c);f&&(k.progressMonitor=f);a.writeOperation.bind(a)(g,
k,b)});return b},removeOperation:function(b){for(var c in this._operations)if(this._operations[c].Location&&this._operations[c].Location===b){this._removeOperationFromTheList(c);break}this._operationsClient.removeOperation.bind(this._operationsClient)(b)},_removeOperationFromTheList:function(b){var c=this._operations[b].progressMonitor;delete this._operations[b];delete this._operationDeferrds[b];c?c.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},
removeCompletedOperations:function(){for(var b in this._operations){var c=this._operations[b];c.type&&"loadstart"!==c.type&&"progress"!==c.type&&((c=this._operations[b].progressMonitor)&&c.done(),delete this._operations[b],delete this._operationDeferrds[b])}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(b){this._serviceRegistry.getService("orion.page.message").setProgressResult(b)},showWhile:function(b,c,f){c&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(c);
var a=this;b.then(function(b){a._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(b){f?a._serviceRegistry.getService("orion.page.message").setProgressMessage(""):a.setProgressResult.bind(a)(b);return b});return this.progress(b,c)},writeOperation:function(b,c,f){this._operations[b]=c;this._operationDeferrds[b]=f;c.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(a){a.put(c.Location,{Name:c.Name,expires:c.expires})});
c.progressMonitor?c.progressMonitor.progress(c.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};b.prototype.constructor=b;return{ProgressService:b}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(k,n){function l(b,c,d){return b[c].apply(b,d)}function g(b){this._location=b}function c(){var b=new n;b.reject(k["No Matching OperationService for location:"]+this._location);return b}function f(b){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=b.getService("orion.core.preference");for(var c=b.getServiceReferences("orion.core.operation"),
d=0;d<c.length;d++){var f=b.getService(c[d]);this._services[d]=f;f=c[d].getProperty("pattern")||".*";"^"!==f[0]&&(f="^"+f);this._patterns[d]=RegExp(f)}this._getService=function(a){if(!a)return this._services[0];for(var b=0;b<this._patterns.length;++b)if(this._patterns[b].test(a))return this._services[b];this._operations.remove(a);return new g(a)}}g.prototype={getOperation:c,getOperations:c,removeCompletedOperations:c,removeOperation:c,cancelOperation:c};g.prototype.constructor=g;f.prototype={getOperations:function(){var b=
new n;if(this._operations)return b.resolve(this._operations),b;var c=this;this._preferenceService.getPreferences("/operations").then(function(d){c._operations=d;b.resolve(c._operations)});return b},getOperation:function(b){return l(this._getService(b),"getOperation",arguments)},removeCompletedOperations:function(){for(var b=[],c=this,d=0;d<this._services.length;d++){var f=this._patterns[d],a=new n;b[d]=a.promise;l(this._services[d],"removeCompletedOperations").then(function(a){return function(b){Array.isArray(b)&&
c.getOperations.bind(c)().then(function(c){for(var d=c.keys(),e=0;e<d.length;e++){var g=d[e];f.test(g)&&0>b.indexOf(g)&&c.remove(g)}a.resolve()})}}(a),function(a){return function(b){a.reject(b)}}(a))}return n.all(b)},removeOperation:function(b){var c=this;return l(this._getService(b),"removeOperation",arguments).then(function(d){c.getOperations.bind(c)().then(function(c){c.remove(b)})},function(b){return b},function(b){return b})}};f.prototype.constructor=f;return{OperationsClient:f}});
define("orion/dialogs",[],function(){function k(k){this._serviceRegistry=k;this._serviceRegistration=k.registerService("orion.page.dialog",this)}k.prototype={confirm:function(k,l){l(window.confirm(k))},openFiles:function(k){}};k.prototype.constructor=k;return{DialogService:k}});
define("orion/searchClient","i18n!orion/search/nls/messages require orion/webui/littlelib orion/i18nUtil orion/searchUtils orion/crawler/searchCrawler orion/explorers/navigatorRenderer orion/extensionCommands orion/Deferred".split(" "),function(k,n,l,g,c,f,b,e,d){function m(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function a(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new m(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}m.prototype.makeRenderFunction=function(a,f,m,q,r){var v=this.serviceRegistry,u=this.commandRegistry;this.openWithCommands=this.openWithCommands||e.createOpenWithCommands(v,a,u);var w=this;return function(e,v,x,p){d.when(w.openWithCommands,function(d){if(x)l.empty(f),d=document.createElement("div"),d.appendChild(document.createTextNode(k["Search failed."])),f.appendChild(d),"function"===typeof q&&q(f);else{var w=
function(){function a(b,c){var d=c.folderName?c.folderName:c.path,e=document.createElement("span");e.id=d.replace(/[^a-zA-Z0-9_\.:\-]/g,"");e.appendChild(document.createTextNode(" - "+d+" "));b.appendChild(e)}var b={};return function(c,d){var e=d.name;if(b.hasOwnProperty(e)){a(c,d);var f=b[e];"function"===typeof f&&(b[e]=null,f())}else b[e]=function(){a(c,d)}}}(),B=!1;l.empty(f);if(e&&0<e.length){var J=document.createElement("table");J.setAttribute("role","presentation");for(var E=0;E<e.length;E++){var G=
e[E],H;B||(B=!0,m&&(H=J.insertRow(0).insertCell(0),H.textContent=m));H=J.insertRow(-1).insertCell(0);H.colspan=2;r&&r(H);var I={Name:G.name,Directory:G.directory,Location:G.path||G.location},K=null;"number"===typeof G.LineNumber&&(K={},K.line=G.LineNumber);if(p&&p.keyword&&!p.nameSearch){var T=c.generateSearchHelper(p),K=K||{};K.find=T.inFileQuery.searchStr;K.regEx=T.inFileQuery.wildCard?!0:void 0}I=b.createLink(n.toUrl("edit/edit.html"),I,u,a,d,{"aria-describedby":(G.folderName?G.folderName:G.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},K);G.LineNumber&&I.appendChild(document.createTextNode(" (Line "+G.LineNumber+")"));H.appendChild(I);w(H,G)}f.appendChild(J);"function"===typeof q&&q(f)}!B&&v&&(d=g.formatMessage(k["No matches found for ${0}"],v),l.empty(f),f.appendChild(document.createTextNode(d)),"function"===typeof q&&q(f))}})}};a.prototype={search:function(a,b,d){var e=function(a){for(var d=[],e=0;e<a.response.docs.length;e++){var f=a.response.docs[e],g=f.Location,h=c.path2FolderName(f.Path?
f.Path:f.Location,f.Name),k=h?h:g;(b?0<=k.indexOf(b):1)&&d.push({name:f.Name,path:g,folderName:h,directory:f.Directory,lineNumber:f.LineNumber})}return d};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){d(e(b),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(b){var c=a.keyword,c=c.substring(c.indexOf("}")+1),c=c.substring(c.indexOf(":")+1);d(e(b),c,null,a)},function(a){d(null,
null,a,null)})}catch(g){"string"===typeof g&&-1<g.indexOf("search")&&this._crawler?this._crawler.searchName(a,function(b){d(e(b),null,null,a)}):"string"===typeof g&&-1<g.indexOf("search")&&!a.nameSearch?(new f.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){d(e(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(g)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,b){console.error(a);l.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var c="",d=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&0<a.Parents.length?d="last"===b.index?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(d=a);d?(this.setLocationbyURL(d.Location),c=d.Name,this._childrenLocation=d.ChildrenLocation):a&&(this.setLocationbyURL(this._searchRootLocation),
c=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation);d=l.node("search");c||(c="");if(d&&d.placeholder){d.value="";var e=g.formatMessage(k["Search ${0}"],c);d.placeholder=30<e.length?e.substring(0,27)+"...":g.formatMessage(k["Search ${0}"],c)}d&&d.title&&(d.title=k["Type a keyword or wild card to search in "]+c)},setLocationbyURL:function(a){this._searchLocation=a},setRootLocationbyURL:function(a){this._searchRootLocation=a},setChildrenLocationbyURL:function(a){this._childrenLocation=
a},getSearchLocation:function(){return this._searchLocation?this._searchLocation:this._fileService.fileServiceRootURL()},getSearchRootLocation:function(){return this._searchRootLocation?this._searchRootLocation:this._fileService.fileServiceRootURL()},getChildrenLocation:function(){return this._childrenLocation?this._childrenLocation:this._fileService.fileServiceRootURL()},createSearchParams:function(a,b,c,d){c=c?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:c,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:c,sort:d&&d.sort?d.sort:"Path asc",rows:d&&d.rows?d.rows:40,start:0,caseSensitive:d?d.caseSensitive:void 0,regEx:d?d.regEx:void 0,fileType:d?d.fileType:void 0,keyword:a,replace:d?d.replace:void 0}}};a.prototype.constructor=a;return{Searcher:a}});
define("orion/problems",["orion/EventTarget"],function(k){function n(l){this._serviceRegistry=l;k.attach(this);this._serviceRegistration=l.registerService("orion.core.marker",this)}n.prototype={_setProblems:function(k){this.problems=k;this.dispatchEvent({type:"problemsChanged",problems:k})}};n.prototype.constructor=n;return{ProblemService:n}});
define("orion/blameAnnotations",["orion/EventTarget"],function(k){function n(l){this._serviceRegistry=l;k.attach(this);this._serviceRegistration=l.registerService("orion.core.blame",this)}n.prototype={_setAnnotations:function(k){this.blameInfo=k;this.dispatchEvent({type:"blameChanged",blameInfo:k})}};n.prototype.constructor=n;return{BlameService:n}});
define("edit/setup","i18n!orion/edit/nls/messages orion/sidebar orion/inputManager orion/globalCommands orion/editor/textModel orion/editor/undoStack orion/folderView orion/editorView orion/editorPluginView orion/markdownView orion/commandRegistry orion/contentTypes orion/fileClient orion/fileCommands orion/selection orion/status orion/progress orion/operationsClient orion/outliner orion/dialogs orion/extensionCommands orion/projectCommands orion/searchClient orion/problems orion/blameAnnotations orion/Deferred orion/EventTarget orion/URITemplate orion/i18nUtil orion/PageUtil orion/objects orion/webui/littlelib orion/projectClient".split(" "),function(k,
n,l,g,c,f,b,e,d,m,a,h,s,t,q,r,v,u,w,z,y,x,p,A,C,B,J,E,G,H,I,K,T){function R(a){this.parentNode=a.parentNode;this.commandRegistry=a.commandRegistry;this.serviceRegistry=a.serviceRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.parentNode=a.parentNode;this.fileActionsScope="fileActions";this.editActionsScope="editActions";this.viewActionsScope="viewActions";this.toolsActionsScope="toolsActions";this.additionalActionsScope="extraActions";this.createActionSections()}B={};R.prototype=
{};I.mixin(R.prototype,{createActionSections:function(){var a=this;[this.fileActionsScope,this.editActionsScope,this.viewActionsScope,this.toolsActionsScope,this.additionalActionsScope].reverse().forEach(function(b){if(!a[b]){var c=document.createElement("ul");c.id=b;c.classList.add("commandList");c.classList.add("layoutLeft");c.classList.add("pageActions");b===a.additionalActionsScope&&c.classList.add("extraActions");a.parentNode.insertBefore(c,a.parentNode.firstChild);a[b]=c}});var b=this.commandRegistry,
c=this.fileActionsScope,d=this.editActionsScope,e=this.viewActionsScope,f=this.toolsActionsScope;b.addCommandGroup(c,"orion.menuBarFileGroup",1E3,k.File,null,k.noActions,null,null,"dropdownSelection");b.addCommandGroup(d,"orion.menuBarEditGroup",100,k.Edit,null,k.noActions,null,null,"dropdownSelection");b.addCommandGroup(e,"orion.menuBarViewGroup",100,k.View,null,k.noActions,null,null,"dropdownSelection");b.addCommandGroup(f,"orion.menuBarToolsGroup",100,k.Tools,null,null,null,null,"dropdownSelection");
b.addCommandGroup(c,"orion.newContentGroup",0,k.New,"orion.menuBarFileGroup",null,null,null,"dropdownSelection");b.addCommandGroup(c,"orion.importGroup",100,k.Import,"orion.menuBarFileGroup",null,null,null,"dropdownSelection");b.addCommandGroup(c,"orion.exportGroup",1001,k.Export,"orion.menuBarFileGroup",null,null,null,"dropdownSelection")},createCommands:function(){var a=this.serviceRegistry,b=this.commandRegistry,c=this.fileClient;return t.createFileCommands(a,b,c).then(function(){return y.createFileCommands(a,
null,"all",!0,b).then(function(){var d=a.getService("orion.project.client");return d.getProjectHandlerTypes().then(function(e){return d.getProjectDeployTypes().then(function(f){return x.createProjectCommands(a,b,c,d,e,f)},function(f){return x.createProjectCommands(a,b,c,d,e)})})})})},setActiveExplorer:function(a){this.explorer=a},updateCommands:function(){var a=this.explorer,b,c,d;a&&(b=a.isCommandsVisible(),c=a.selection,d=a.treeRoot);var e=this.inputManager.getFileMetadata(),f=this.commandRegistry,
g=this.serviceRegistry;f.registerSelectionService(this.fileActionsScope,b?c:null);f.registerSelectionService(this.editActionsScope,b?c:null);f.registerSelectionService(this.viewActionsScope,b?c:null);t.setExplorer(a);x.setExplorer(a);t.updateNavTools(g,f,a,null,[this.fileActionsScope,this.editActionsScope,this.viewActionsScope],d,!0);f.destroy(this.toolsActionsScope);f.renderCommands(this.toolsActionsScope,this.toolsActionsScope,e,a,"tool");f.destroy(this.additionalActionsScope);f.renderCommands(this.additionalActionsScope,
this.additionalActionsScope,d,a,"button")}});B.setUpEditor=function(t,y,x,B){function X(a){Y!==a&&(Y&&Y.addEventListener("DirtyChanged",na),(Y=a)&&Y.addEventListener("DirtyChanged",na=function(a){g.setDirtyIndicator(Y.isDirty())}))}function W(a){ha.updateCommands();var b=K.node("pageActions");b&&(D.destroy(b),a&&D.renderCommands(b.id,b,a,Y,"button"));if(b=K.node("pageNavigationActions"))D.destroy(b),a&&D.renderCommands(b.id,b,a,Y,"button");if(b=K.node("settingsActions"))D.destroy(b),a&&D.renderCommands(b.id,
b,a,Y,"button")}function S(a,b,c){"progress"===b?L.setProgressMessage(a):"error"===b?L.setErrorMessage(a):L.setMessage(a,null,c)}function Q(a,c){var e=null;if(c&&a){var f=I.mixin({input:a,metadata:c},ma);if(c.Directory)e=new b.FolderView(f);else{var g=a.editor;if(!g||"orion.editor"===g)e=oa;else if("orion.viewer.markdown"===g)e=new m.MarkdownEditorView(f);else for(var h=t.getServiceReferences("orion.edit.editor"),k=0;k<h.length;k++)if(h[k].getProperty("id")===g){f.editorService=h[k];e=new d.PluginEditorView(f);
break}}}ga!==e&&(D.closeParameterCollector(),ga&&ga.destroy(),(ga=e)&&ga.create());return ga}var F,D,L,N,V,aa,Z,da;(function(){F=new q.Selection(t);var b=new u.OperationsClient(t);L=new r.StatusReportingService(t,b,"statusPane","notifications","notificationArea");new z.DialogService(t);D=new a.CommandRegistry({selection:F});aa=new v.ProgressService(t,b,D);new A.ProblemService(t);N=new w.OutlineService({serviceRegistry:t,preferences:x});V=new h.ContentTypeRegistry(t);Z=new s.FileClient(t);new T.ProjectClient(t,
Z);da=new p.Searcher({serviceRegistry:t,commandService:D,fileService:Z});new C.BlameService(t)})();var $=K.node("sidebar"),fa=K.node("sidebarToolbar"),ea=K.node("pageToolbar"),ia=K.node("editor");g.generateBanner("orion-editor",t,D,x,da,null,null,!1);var Y,na,ba,ca,oa,ja,ha,la=new E("#{,resource,params*}"),qa=function(a,b,c){b=c?c.Location:Z.fileServiceRootURL(b);a.href=la.expand({resource:b});c&&(b=ba.getFileMetadata())&&b.Location===c.Location&&a.addEventListener("click",function(){ca.reveal(c)})},
ga,ma,ka=new c.TextModel,ra=new f.UndoStack(ka,500),pa={};["getText","setText"].forEach(function(a){pa[a]=ka[a].bind(ka)});t.registerService("orion.edit.model.context",pa,null);ba=new l.InputManager({serviceRegistry:t,fileClient:Z,progressService:aa,statusReporter:S,selection:F,contentTypeRegistry:V});ba.addEventListener("InputChanged",function(a){var b=a.metadata,c=Q(a.input,b);X(c?c.editor:null);a.editor=Y;W(b);var c=a.name,d=b;if(null===a.input||void 0===a.input)c=ja?ja.Name:"",d=ja;g.setPageCommandExclusions(["orion.editFromMetadata"]);
g.setPageTarget({task:"Editor",name:c,target:d,makeAlternate:function(){if(b&&b.parent)return b.parent;if(b&&b.Parents&&0<b.Parents.length)return aa.progress(Z.read(b.Parents[0].Location,!0),G.formatMessage(k.ReadingMetadata,b.Parents[0].Location))},makeBreadcrumbLink:qa,makeBreadcrumFinalLink:!0,serviceRegistry:t,commandService:D,searchService:da,fileService:Z});Y&&g.setDirtyIndicator(Y.isDirty());D.processURL(window.location.href)});ha=new R({parentNode:ea,fileClient:Z,inputManager:ba,commandRegistry:D,
serviceRegistry:t});ha.createCommands().then(function(){function a(){J.attach(this)}ma={parent:ia,model:ka,menuBar:ha,undoStack:ra,serviceRegistry:t,pluginRegistry:y,commandRegistry:D,contentTypeRegistry:V,renderToolbars:W,inputManager:ba,readonly:B,preferences:x,searcher:da,selection:F,fileService:Z,statusReporter:S,statusService:L,progressService:aa};oa=new e.EditorView(ma);ca=new a;var b=new n({commandRegistry:D,contentTypeRegistry:V,editorInputManager:ba,preferences:x,fileClient:Z,outlineService:N,
parent:$,progressService:aa,selection:F,serviceRegistry:t,sidebarNavInputManager:ca,switcherScope:"viewActions",menuBar:ha,toolbar:fa});a.prototype.processHash=function(){var a=H.matchResourceParameters().navigate;"string"===typeof a&&this.setInput&&"nav"===b.getActiveViewModeId()&&this.setInput(a)};b.show();ca.addEventListener("rootChanged",function(a){ja=a.root});var c=function(a){window.location=la.expand({resource:a.newInput||a.parent||""})};ca.addEventListener("filesystemChanged",c);ca.addEventListener("editorInputMoved",
c);ca.addEventListener("create",function(a){a.newValue&&(window.location=la.expand({resource:a.newValue.Location}))});F.addEventListener("selectionChanged",function(a){ba.setInput(a.selection)});window.addEventListener("hashchange",function(){ba.setInput(H.hash());ca.processHash(H.hash())});ba.setInput(H.hash());ca.processHash(H.hash())});window.onbeforeunload=function(){if(Y&&Y.isDirty())return ba.getAutoSaveEnabled()?(ba.save(),k.unsavedAutoSaveChanges):k.unsavedChanges}};return B});
define("built-edit.js",["orion/browserCompatibility","orion/bootstrap","edit/setup"],function(k,n,l){n.startup().then(function(g){l.setUpEditor(g.serviceRegistry,g.pluginRegistry,g.preferences,!1)})});
//@ sourceMappingURL=built-edit.js.map