/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License v1.0
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors: IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2012, 2014 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 ******************************************************************************/

/**
 * @license RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/domReady for details
 */

/*

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made
 available under the terms of the Eclipse Public License v1.0
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2010, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012, 2014 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/domReady for details

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation
*/
(function(f,b){typeof define==="function"&&define.amd?define("orion/Deferred",b):typeof exports==="object"?module.exports=b():(f.orion=f.orion||{},f.orion.Deferred=b())})(this,function(){function f(){for(var j;j=g.shift();)j();k=!1}function b(j){g.push(j);k||(k=!0,setTimeout(f,0))}function l(j){return function(){j.apply(void 0,arguments)}}function i(){function j(){for(var a;a=n.shift();){var d=a.deferred,e=h==="fulfilled"?"resolve":"reject";if(typeof a[e]==="function")try{var o=(0,a[e])(c),m=o&&(typeof o===
"object"||typeof o==="function")&&o.then;if(typeof m==="function")if(o===d.promise)d.reject(new TypeError);else{var j=o.cancel;typeof j==="function"?d._protected(g).parentCancel=j.bind(o):delete d._protected(g).parentCancel;m.call(o,l(d.resolve),l(d.reject),l(d.progress))}else d.resolve(o)}catch(b){d.reject(b)}else d[e](c)}}function d(a){delete o.parentCancel;h="rejected";c=a;n.length&&b(j)}function e(a){function g(a){return function(c){f||(f=!0,a(c))}}var f=!1;delete o.parentCancel;try{var k=a&&
(typeof a==="object"||typeof a==="function")&&a.then;if(typeof k==="function")if(a===m)d(new TypeError);else{h="assumed";var l=a&&a.cancel;if(typeof l!=="function"){var r=new i,a=r.promise;try{k(r.resolve,r.reject,r.progress)}catch(s){r.reject(s)}l=a.cancel;k=a.then}c=a;k.call(a,g(e),g(d));o.parentCancel=l.bind(a)}else h="fulfilled",c=a,n.length&&b(j)}catch(y){g(d)(y)}}function a(){var a=o.parentCancel;if(a)delete o.parentCancel,a();else if(!h)a=Error("Cancel"),a.name="Cancel",d(a)}var c,h,n=[],m=
this,o={};Object.defineProperty(this,"_protected",{value:function(a){if(a!==g)throw Error("protected");return o}});this.resolve=function(a){h||e(a);return m};this.reject=function(a){h||d(a);return m};this.progress=function(a){h||n.forEach(function(c){if(c.progress)try{c.progress(a)}catch(h){}});return m.promise};this.cancel=function(){o.parentCancel?setTimeout(a,0):a();return m};this.then=function(a,c,d){a={resolve:a,reject:c,progress:d,deferred:new i};n.push(a);a.deferred._protected(g).parentCancel=
m.promise.cancel.bind(m);(h==="fulfilled"||h==="rejected")&&b(j);return a.deferred.promise};this.promise={then:m.then,cancel:m.cancel}}var g=[],k=!1;i.all=function(j,d){function e(a,d){b||(h[a]=d,--c===0&&m.resolve(h))}function a(a,c){if(!b){if(d)try{e(a,d(c));return}catch(h){c=h}m.reject(c)}}var c=j.length,h=[],b=!1,m=new i;m.then(void 0,function(){b=!0;j.forEach(function(a){a.cancel&&a.cancel()})});c===0?m.resolve(h):j.forEach(function(c,h){c.then(e.bind(void 0,h),a.bind(void 0,h))});return m.promise};
i.when=function(j,d,e,a){var c;if(!(j&&typeof j.then==="function"))c=new i,c.resolve(j),j=c.promise;return j.then(d,e,a)};return i});
define("orion/xhr",["orion/Deferred"],function(f){function b(b,i,g,f){var j=typeof g.response!=="undefined"?g.response:g.responseText,d;try{d=g.status}catch(e){d=0}b={args:i,response:j,responseText:typeof j==="string"?j:null,status:d,url:b,xhr:g};if(typeof f!=="undefined")b.error=f;return b}return function(l,i,g){var g=g||{},k=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,j=new f,d=g.headers||{},e=g.log||!1,a;typeof d["X-Requested-With"]==="undefined"&&(d["X-Requested-With"]="XMLHttpRequest");
if(typeof g.data!=="undefined"&&(l==="POST"||l==="PUT"))a=g.data;var c=!1,h=!1;j.promise.then(void 0,function(a){c=!0;!h&&a instanceof Error&&a.name==="Cancel"&&k.abort()});k.onabort=function(){h=!0;if(!c){var a=Error("Cancel");a.name="Cancel";j.reject(a)}};k.onload=function(){var a=b(i,g,k);200<=k.status&&k.status<400?j.resolve(a):(j.reject(a),e&&typeof console!=="undefined"&&console.log(Error(k.statusText)))};k.onerror=function(){var a=b(i,g,k);j.reject(a);e&&typeof console!=="undefined"&&console.log(Error(k.statusText))};
k.onprogress=function(a){a.xhr=k;j.progress(a)};try{k.open(l,i,!0);if(typeof g.responseType==="string")k.responseType=g.responseType;if(typeof g.timeout==="number")if(typeof k.timeout==="number")k.timeout=g.timeout,k.addEventListener("timeout",function(){j.reject(b(i,g,k,"Timeout exceeded"))});else{var n=setTimeout(function(){j.reject(b(i,g,k,"Timeout exceeded"))},g.timeout);j.promise.then(clearTimeout.bind(null,n),clearTimeout.bind(null,n))}Object.keys(d).forEach(function(a){k.setRequestHeader(a,
d[a])});k.send(a||null)}catch(m){j.reject(b(i,g,k,m))}return j.promise}});
(function(f,b){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],b):typeof exports==="object"?module.exports=b(require("orion/Deferred")):(f.orion=f.orion||{},f.orion.PluginProvider=b(f.orion.Deferred))})(this,function(f){function b(b,f){this.__objectId=b;this.__methods=f}return function(l){function i(a){m&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),m===self?m.postMessage(a):m.postMessage(a,"*"))}function g(){var a=[];Object.keys(r).forEach(function(c){var h=
r[c];a.push({serviceId:c,names:h.names,methods:h.methods,properties:h.properties})});return{headers:h||{},services:a}}function k(a,c){if(c&&c instanceof XMLHttpRequest){var h,d;try{h=c.status,d=c.statusText}catch(q){h=0,d=""}return{status:h||0,statusText:d}}return c}function j(a){var c=a?JSON.parse(JSON.stringify(a,k)):a;if(a instanceof Error)c.__isError=!0,c.message=c.message||a.message,c.name=c.name||a.name;return c}function d(a){if(!m)return(new f).reject(Error("plugin not connected"));a.id=String(o++);
var c=new f;t[a.id]=c;c.then(null,function(c){n&&c instanceof Error&&c.name==="Cancel"&&s({requestId:a.id,method:"cancel",params:c.message?[c.message]:[]})});var h=Object.prototype.toString;a.params.forEach(function(d,q){if(h.call(d)==="[object Object]"&&!(d instanceof b)){var e,m;for(e in d)h.call(d[e])==="[object Function]"&&(m=m||[],m.push(e));if(m){var j=x++;u[j]=d;e=function(){delete u[j]};c.then(e,e);a.params[q]=new b(j,m)}}});s(a);return c.promise}function e(a,c){a||a===0?s({id:a,result:null,
error:c}):console.log(c)}function a(a,c,h,e){e.forEach(function(a,c){if(a&&typeof a.__objectId!=="undefined"){var h={};a.__methods.forEach(function(c){h[c]=function(){return d({objectId:a.__objectId,method:c,params:Array.prototype.slice.call(arguments)})}});e[c]=h}});var q=typeof a===void 0?null:{id:a,result:null,error:null};try{var m=h.apply(c,e);if(q)m&&typeof m.then==="function"?(p[a]=m,m.then(function(c){delete p[a];q.result=c;s(q)},function(c){if(p[a])delete p[a],q.error=j(c),s(q)},function(){s({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(q.result=m,s(q))}catch(b){if(q)q.error=j(b),s(q)}}function c(c){if(c.source===m){c=typeof c.data!=="string"?c.data:JSON.parse(c.data);try{if(c.method){var h=c.method,d=c.params||[];if("serviceId"in c){var b=r[c.serviceId];b||e(c.id,"service not found");b=b.implementation;h in b?a(c.id,b,b[h],d):e(c.id,"method not found")}else if("objectId"in c){var q=u[c.objectId];q||e(c.id,"object not found");!h in q?a(c.id,q,q[h],d):e(c.id,"method not found")}else if("requestId"in
c){var j=p[c.requestId];j&&h==="cancel"&&j.cancel&&j.cancel.apply(j,d)}else if("responseId"in c){var g=t[c.responseId];g&&h==="progress"&&g.progress&&g.progress.apply(g,d)}else throw Error("Bad method: "+c.method);}else{var o=t[String(c.id)];delete t[String(c.id)];c.error?o.reject(c.error):o.resolve(c.result)}}catch(n){console.log("Plugin._messageHandler "+n)}}}var h=l,n=!1,m=null,o=0,x=0,v=0,p={},t={},u={},r={},s=i;this.updateHeaders=function(a){if(n)throw Error("Cannot update headers. Plugin Provider is connected");
h=a};this.registerServiceProvider=this.registerService=function(a,c,h){if(n)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=null,q=[];for(d in c)typeof c[d]==="function"&&q.push(d);r[v++]={names:a,methods:q,implementation:c,properties:h||{},listeners:{}}};this.connect=function(a,h){if(!n){if(typeof window==="undefined")m=self;else if(window!==window.parent)m=window.parent;else if(window.opener!==null)m=window.opener;else{h&&
h("No valid plugin target");return}addEventListener("message",c,!1);var d={method:"plugin",params:[g()]};i(d);n=!0}a&&a()};this.disconnect=function(){n&&(removeEventListener("message",c),m=null,n=!1)}}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(f,b){function l(b,i,j,d){f("GET",b,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(e){e=e.response?JSON.parse(e.response):null;i.progress(e);!e.type||e.type==="loadstart"||e.type==="progress"?setTimeout(function(){l(b,i,j,d)},2E3):(e.type==="error"||e.type==="abort"?i.reject(d?d(e):e.Result):i.resolve(j?j(e):e.Result.JsonData),e.Location||f("DELETE",b,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(d){var a=d;if(d.responseText!==
void 0){a=d.responseText;try{a=JSON.parse(d.responseText)}catch(c){}}a.Message!==void 0?(a.HttpCode=a.HttpCode===void 0?d.status:a.HttpCode,a.Severity=a.Severity===void 0?"Error":a.Severity,i.reject(a)):i.reject({Severity:"Error",Message:a,HttpCode:d.status})})}function i(b,i){i.then(null,function(j){j instanceof Error&&j.name==="Cancel"&&f("PUT",b,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(g,f,j){var d=new b;i(g,d);l(g,d,f,j);return d}}});
define("orion/cfui/cFClient",["require","orion/xhr","orion/Deferred","orion/operation"],function(f,b,l,i){var g=g||{};g.CFService=function(){function g(b){if(b)this._serviceRegistry=b,this._serviceRegistration=b.registerService("orion.cf.service",this)}g.prototype={_getServiceResponse:function(b,d){var e=d.response?JSON.parse(d.response):null;if(d.xhr&&d.xhr.status===202){var a=i.handle(e.Location);a.then(function(a){try{b.resolve(JSON.parse(a))}catch(h){b.resolve(a)}},function(a){a.failedOperation=
e.Location;b.reject(a)},b.progress);b.then(null,function(c){a.reject(c)})}else b.resolve(e)},_handleServiceResponseError:function(b,d){b.reject(this._translateResponseToStatus(d))},_translateResponseToStatus:function(b){var d;try{d=JSON.parse(b.responseText)}catch(e){d={Message:messages["Problem while performing the action"]}}d.HttpCode=b.status;return d},_xhrV1:function(g,d,e){var a=this,c=new l;b(g,d,{headers:{"CF-Version":"1","Content-Type":"application/json; charset=UTF-8"},timeout:15E3,handleAs:"json",
data:JSON.stringify(e)}).then(function(h){a._getServiceResponse(c,h)},function(h){a._handleServiceResponseError(c,h)});return c},setTarget:function(b,d,e){b={Url:b};if(d)b.Org=d;if(e)b.Space=e;return this._xhrV1("POST",f.toUrl("cfapi/target"),b)},login:function(b,d,e){var a={};if(b)a.Url=b;if(d)a.Username=d,a.Password=e;return this._xhrV1("POST",f.toUrl("cfapi/target"),a)},logout:function(){return this._xhrV1("DELETE",f.toUrl("cfapi/target"))},getLogs:function(b,d,e,a){d||(new l).reject("Application name not set");
d=f.toUrl("cfapi/logs/"+d);e&&(d+="/"+e);a&&(d+="/"+a);b&&(d+="?Target="+JSON.stringify(b));return this._xhrV1("GET",d)},getTarget:function(){return this._xhrV1("GET",f.toUrl("cfapi/target"))},getInfo:function(){return this._xhrV1("GET",f.toUrl("cfapi/info"))},pushApp:function(b,d,e){d={Name:d,ContentLocation:e};if(b)d.Target=b;return this._xhrV1("PUT",f.toUrl("cfapi/apps"),d)},getApp:function(b,d,e){var a=f.toUrl("cfapi/apps");d?a+="?Name="+d:location&&(a+="?ContentLocation="+e);b&&(a+="&Target="+
JSON.stringify(b));return this._xhrV1("GET",a)},getApps:function(){return this._xhrV1("GET",f.toUrl("cfapi/apps"))},startApp:function(b,d,e){d={Name:d,ContentLocation:e,State:"Started"};if(b)d.Target=b;return this._xhrV1("PUT",f.toUrl("cfapi/apps"),d)},stopApp:function(b,d,e){d={Name:d,ContentLocation:e,State:"Stopped"};if(b)d.Target=b;return this._xhrV1("PUT",f.toUrl("cfapi/apps"),d)}};return g}();return g});
define("orion/EventTarget",[],function(){function f(){this._namedListeners={}}f.prototype={dispatchEvent:function(b){if(!b.type)throw Error("unspecified type");var f=this._namedListeners[b.type];f&&f.forEach(function(f){try{typeof f==="function"?f(b):f.handleEvent(b)}catch(g){typeof console!=="undefined"&&console.log(g)}});return!b.defaultPrevented},addEventListener:function(b,f){if(typeof f==="function"||f.handleEvent)this._namedListeners[b]=this._namedListeners[b]||[],this._namedListeners[b].push(f)},
removeEventListener:function(b,f){var i=this._namedListeners[b];if(i)for(var g=0;g<i.length;g++)if(i[g]===f){i.length===1?delete this._namedListeners[b]:i.splice(g,1);break}}};f.prototype.constructor=f;f.attach=function(b){var l=new f;b.dispatchEvent=l.dispatchEvent.bind(l);b.addEventListener=l.addEventListener.bind(l);b.removeEventListener=l.removeEventListener.bind(l)};return f});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(f,b){function l(d,b,a){this._properties=a||{};this._properties["service.id"]=d;this._properties.objectClass=b;this._properties["service.names"]=b}function i(d,b,a){this._serviceId=d;this._serviceReference=b;this._internalRegistry=a}function g(d,b){function a(a){return function(){var c;try{if(!b())throw Error("Service was unregistered");var m=d[a].apply(d,Array.prototype.slice.call(arguments));if(m&&typeof m.then==="function")return m;
else c=new f,c.resolve(m)}catch(g){c=new f,c.reject(g)}return c.promise}}for(var c in d)typeof d[c]==="function"&&(this[c]=a(c))}function k(d,b){this.type=d;this.serviceReference=b}function j(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new b;var d=this;this._internalRegistry={isRegistered:function(b){return d._entries[b]?!0:!1},unregisterService:function(b){var a=d._entries[b];if(!a)throw Error("Service has already been unregistered: "+b);var c=a.reference;d._serviceEventTarget.dispatchEvent(new k("unregistering",
c));d._entries[b]=null;c.getProperty("objectClass").forEach(function(a){for(var b=d._namedReferences[a],e=0;e<b.length;e++)if(b[e]===c){b.length===1?delete d._namedReferences[a]:b.splice(e,1);break}})},modifyService:function(b){var a=d._entries[b];if(!a)throw Error("Service not found while trying to send modified event: "+b);d._serviceEventTarget.dispatchEvent(new k("modified",a.reference))}}}l.prototype={getPropertyKeys:function(){var b=[],e;for(e in this._properties)this._properties.hasOwnProperty(e)&&
b.push(e);return b},getProperty:function(b){return this._properties[b]}};l.prototype.constructor=l;i.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 e=this._serviceReference._properties;this._serviceReference._properties=b||{};b["service.id"]=this._serviceId;
b.objectClass=e.objectClass;b["service.names"]=e["service.names"];this._internalRegistry.modifyService(this._serviceId)}};i.prototype.constructor=i;j.prototype={getService:function(b){var e;if(typeof b==="string")(b=this._namedReferences[b])&&b.some(function(a){e=this._entries[a.getProperty("service.id")].service;return!!e},this);else if(b=this._entries[b.getProperty("service.id")])e=b.service;return e||null},getServiceReferences:function(b){if(b)return this._namedReferences[b]?this._namedReferences[b]:
[];var e=[];this._entries.forEach(function(a){a&&e.push(a.reference)});return e},registerService:function(b,e,a){if(typeof e==="undefined"||e===null)throw Error("invalid service");typeof b==="string"?b=[b]:Array.isArray(b)||(b=[]);var c=this._entries.length,h=new l(c,b,a),f=this._namedReferences;b.forEach(function(a){f[a]=f[a]||[];f[a].push(h)});b=new g(e,this._internalRegistry.isRegistered.bind(null,c));this._entries.push({reference:h,service:b});b=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new k("registered",
h));return new i(c,h,b)},addEventListener:function(b,e){this._serviceEventTarget.addEventListener(b,e)},removeEventListener:function(b,e){this._serviceEventTarget.removeEventListener(b,e)}};j.prototype.constructor=j;return{ServiceRegistry:j}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(f,b,l){function i(a,c){this._name=a;this._providers=c;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function g(a,c){return{get:function(b,d){if(c===0)return null;var e=localStorage.getItem(a+b);if(e===null)return null;e=JSON.parse(e);return d||c===-1||e._expires&&e._expires>(new Date).getTime()?(delete e._expires,e):null},set:function(b,d){if(c!==0){if(c!==-1)d._expires=(new Date).getTime()+
1E3*c;if(Object.keys(d).length===0)localStorage.removeItem(a+b);else{var e=JSON.stringify(d);localStorage.setItem(a+b,e);delete d._expires}}},remove:function(c){localStorage.removeItem(a+c)}}}function k(a){this._currentPromises={};this._cache=new g("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var c=a.getServiceReferences("orion.core.preference.provider");if(c.length>0)this._service=a.getService(c[0])}return!!this._service}}function j(a){this._location=
a;this._currentPromise=null;this._cache=new g("/orion/preferences/default",3600)}function d(){this._cache=new g("/orion/preferences/local",-1)}function e(a,c){this._userProvider=new k(a);this._localProvider=new d;c=c||"defaults.pref";c.indexOf("://")===-1&&(c=f.toUrl(c));this._defaultsProvider=new j(c);this._serviceRegistration=a.registerService("orion.core.preference",this)}i.prototype={_flush:function(){for(var a=[],c=0;c<this._stores.length;++c){var h=this._stores[c];this._dirty.indexOf(h)!==-1&&
a.push(this._providers[c].put(this._name,h));if(this._pendingDeletes[c]&&this._pendingDeletes[c].length>0){for(h=0;h<this._pendingDeletes[c].length;h++)a.push(this._providers[c].remove(this._name,this._pendingDeletes[c][h]));delete this._pendingDeletes[c]}}this._dirty=[];return b.all(a)},_scheduleFlush:function(a){a&&this._dirty.indexOf(a)===-1&&this._dirty.push(a);if(!this._flushPending)this._flushPending=!0,window.setTimeout(function(){if(this._flushPending)this._flushPending=!1,this._flush()}.bind(this),
0)},_getCached:function(){if(!this._cached){this._cached={};for(var a=0;a<this._stores.length;++a){var c=this._stores[a],b;for(b in c)c.hasOwnProperty(b)&&typeof this._cached[b]==="undefined"&&(this._cached[b]=c[b])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(a){return this._getCached()[a]},put:function(a,c){if(this._stores.length!==0){var b=this._stores[0];if(b[a]!==c)b[a]=c,this._cached=null,this._scheduleFlush(b)}},remove:function(a){for(var c=0;c<
this._stores.length;++c){var b=this._stores[c];if(b.hasOwnProperty(a))return delete b[a],this._pendingDeletes[c]||(this._pendingDeletes[c]=[]),this._pendingDeletes[c].push(a),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var a=0;a<this._stores.length;++a)this._stores[a]={},this._scheduleFlush(this._stores[a]);this._cached=null},sync:function(a){if(this._flushPending)return this._flushPending=!1,this._flush();for(var c=this,h=[],d=0;d<this._providers.length;++d)h.push(this._providers[d].get(this._name,
a).then(function(a){return function(b){c._stores[a]=b}}(d)));return b.all(h).then(function(){c._cached=null;c._getCached()})},flush:function(){this._flush()}};k.prototype={get:function(a,c){if(this._currentPromises[a])return this._currentPromises[a];var h=new b,d=null;c?this._cache.remove(a):d=this._cache.get(a);if(d!==null)h.resolve(d);else{this._currentPromises[a]=h;var e=this;this._service.get(a).then(function(c){e._cache.set(a,c);delete e._currentPromises[a];h.resolve(c)},function(c){c.status===
404?(c={},e._cache.set(a,c),delete e._currentPromises[a],h.resolve(c)):(delete e._currentPromises[a],h.resolve(e._cache.get(a,!0)||{}))})}return h},put:function(a,c){this._cache.set(a,c);return this._service.put(a,c)},remove:function(a,c){var b=this._cache.get(a);delete b[c];this._cache.set(a,b);return this._service.remove(a,c)}};j.prototype={get:function(a,c){if(this._currentPromise)return this._currentPromise;var h=new b,d=null;c?this._cache.remove(a):d=this._cache.get(a);if(d!==null)h.resolve(d);
else{this._currentPromise=h;var e=this;l("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(c){c=JSON.parse(c.response);e._cache.set(a,c[a]||{});e._currentPromise=null;h.resolve(c[a]||{})},function(c){c.xhr.status===401||c.xhr.status===404?(e._cache.set(a,{}),e._currentPromise=null,h.resolve({})):(e._currentPromise=null,c=e._cache.get(a,!0),c!==null?h.resolve(c[a]||{}):h.resolve({}))})}return h},put:function(){var a=new b;a.resolve();return a},remove:function(a,c){var b=
this._cache.get(a);delete b[c];this.put(a,b)}};d.prototype={get:function(a){var c=new b,a=this._cache.get(a);a!==null?c.resolve(a):c.resolve({});return c},put:function(a,c){var h=new b;this._cache.set(a,c);h.resolve();return h},remove:function(a,c){var b=this._cache.get(a);delete b[c];this.put(a,b)}};e.DEFAULT_SCOPE=1;e.LOCAL_SCOPE=2;e.USER_SCOPE=4;e.prototype={listenForChangedSettings:function(a,c,b){if(!c||typeof c!=="number"||c>7||c<1)b=c,c=e.DEFAULT_SCOPE|e.LOCAL_SCOPE|e.USER_SCOPE;window.addEventListener("storage",
b,!1);if((e.USER_SCOPE&c)!==0)return"/orion/preferences/user"+a;else if((e.LOCAL_SCOPE&c)!==0)return"/orion/preferences/local"+a;return"/orion/preferences/default"+a},getPreferences:function(a,c){if(!c||typeof c!=="number"||c>7||c<1)c=e.DEFAULT_SCOPE|e.LOCAL_SCOPE|e.USER_SCOPE;var b=[];e.USER_SCOPE&c&&this._userProvider.available()&&b.push(this._userProvider);e.LOCAL_SCOPE&c&&b.push(this._localProvider);e.DEFAULT_SCOPE&c&&b.push(this._defaultsProvider);var d=new i(a,b);return d.sync().then(function(){return d})},
getSetting:function(a,c,b){for(var d,e=0;e<a.length;e++)if(a[e].label===c)for(var g=0;g<a[e].data.length;g++)if(a[e].data[g].label===b){d=a[e].data[g].value;break}return d}};return{PreferencesService:e}});
define("orion/URITemplate",[],function(){function f(a){this._text=a}function b(a){return a.replace("%25","%")}function l(c,d){if(d==="U")return encodeURIComponent(c).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if(d==="U+R")return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(a,b);if(d==="U+R-,")return encodeURI(c).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+d);}function i(a,b,d){for(var e=
[],g=0;g<a.length;g++)typeof a[g]!=="undefined"&&e.push(l(a[g],b));return e.join(d)}function g(a,b,d,e){for(var g=Object.keys(a),f=[],i=0;i<g.length;i++)typeof a[g[i]]!=="undefined"&&f.push(l(g[i],b)+d+l(a[g[i]],b));return f.join(e)}function k(a){if(a.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=d[a[0]])?a=a.substring(1):this._operator=d.NUL;for(var b=[],g=a.split(","),f=0;f<g.length;f++){var i=g[f].match(e);if(i===null)throw Error("Bad VarSpec: "+a);b.push({name:i[1],
explode:!!i[2],prefix:i[3]?parseInt(i[3],10):-1})}this._varSpecList=b}function j(a){for(var b=[],d=0,e=a.indexOf("{",d);e!==-1;){b.push(new f(a.substring(d,e)));d=a.indexOf("}",e+1);if(d===-1)throw Error("Invalid template: "+a);b.push(new k(a.substring(e+1,d)));d+=1;e=a.indexOf("{",d)}b.push(new f(a.substring(d)));this._templateComponents=b}var d={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:"&",named:!0,ifemp:"=",allow:"U"},"&":{first:"&",sep:"&",named:!0,ifemp:"=",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},e=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,a=/%25[0-9A-F][0-9A-F]/g;f.prototype={expand:function(){return encodeURI(this._text)}};
k.prototype={expand:function(a){for(var b=[],d=0;d<this._varSpecList.length;d++){var e=this._varSpecList[d],f=e.name,j=a[f],k=typeof j;if(k!=="undefined"&&j!==null){var p=b.length===0?this._operator.first:this._operator.sep;if(k==="string")this._operator.named&&(p+=l(f,"U+R"),p+=j.length===0?this._operator.ifemp:"="),e.prefix!==-1&&e.prefix<j.length&&(j=j.substring(0,e.prefix)),p+=l(j,this._operator.allow);else if(Array.isArray(j)){if(j.length===0)continue;e.explode?p+=i(j,this._operator.allow,this._operator.sep):
(e=i(j,this._operator.allow,","),this._operator.named&&(p+=l(f,"U+R"),p+=e.length===0?this._operator.ifemp:"="),p+=e)}else if(k==="object"){if(Object.keys(j).length===0)continue;e.explode?p+=g(j,this._operator.allow,"=",this._operator.sep):(e=g(j,this._operator.allow,",",","),this._operator.named&&(p+=l(f,"U+R"),p+=e.length===0?this._operator.ifemp:"="),p+=e)}else throw Error("bad param type: "+f+" : "+k);b.push(p)}}return b.join("")}};j.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 j});
define("orion/PageUtil",[],function(){var f=/^http[s]?/i;return{hash:function(){var b=window.location.href.split("#")[1];return b?"#"+b:""},matchResourceParameters:function(b){var b=b||window.location.toString(),f={resource:""},i=b.indexOf("#");if(i!==-1&&(b=b.substring(i+1),b.length!==0)){b=b.split(",");f.resource=decodeURIComponent(b[0]);for(i=1;i<b.length;i++){var g=/([^=]*)(=?)(.*)/.exec(b[i]),k=decodeURIComponent(g[1]||""),g=decodeURIComponent(g[3]||"");k!==""&&k!=="resource"&&(f[k]=g)}}return f},
validateURLScheme:function(b,l){var i=b;if(b.indexOf("://")===-1){var g=document.createElement("a");g.href=b;i=g.href}g=!1;return(g=l?l.some(function(b){return RegExp("^"+b+":","i").test(i)}):f.test(i))?b:(console.log("Illegal URL Scheme: '"+b+"'"),"")}}});
define("orion/i18nUtil",["require","orion/Deferred"],function(f,b){function l(b){if(b=localStorage.getItem("orion/messageBundle/"+b))if(b=JSON.parse(b),b._expires&&b._expires>(new Date).getTime())return delete b._expires,b;return null}var i={};return{getMessageBundle:function(g){function k(a){a?f(["i18n!"+g],function(a){if(a){var b=g;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+b,JSON.stringify(a));delete a._expires}d.resolve(a)}):j(Error(g))}function j(a){d.reject(a)}
if(i[g])return i[g];var d=new b;i[g]=d;var e=l(g);if(e)return d.resolve(e),d;try{f([g],k,j)}catch(a){f(["orion/i18n!"+g],k,j)}return d},formatMessage:function(b){var f=arguments;return b.replace(/\$\{([^\}]+)\}/g,function(b,d){return f[(d<<0)+1]})}}});
define("orion/objects",[],function(){function f(b){for(var f=1;f<arguments.length;f++){var i=arguments[f],g;for(g in i)Object.prototype.hasOwnProperty.call(i,g)&&(b[g]=i[g])}return b}return{clone:function(b){if(Array.isArray(b))return Array.prototype.slice.call(b);var l=Object.create(Object.getPrototypeOf(b));f(l,b);return l},mixin:f,toArray:function(b){return Array.isArray(b)?b:[b]}}});
(function(){function f(a){if(typeof a!=="string")throw new TypeError;}function b(a){return a?a.split("&"):[]}function l(a){return a.length===0?"":a.join("&")}function i(a){var b=/([^=]*)(?:=?)(.*)/.exec(a),a=b[1]?decodeURIComponent(b[1]):"",b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function g(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="="+encodeURIComponent(a[1]));return b}function k(a,c){var d="",e=[],h=0;return{next:function(){if(d!==a.query)d=a.query,e=b(d);if(h<e.length){var f=i(e[h++]);
switch(c){case "keys":return f[0];case "values":return f[1];case "keys+values":return[f[0],f[1]];default:throw new TypeError;}}throw z;}}}function j(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function d(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function e(a){var b=[];a.split("/").forEach(function(a){a===".."?b.pop():a!=="."&&b.push(a)});return b.join("/")}function a(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function c(b,c){if(typeof b!==
"string")throw new TypeError;var b=a(b),h=o.exec(b);if(!h)return null;var f={};f.scheme=h[1]||"";if(f.scheme&&!v.test(f.scheme))return null;var g=h[2];if(g&&(g=x.exec(g),f.userinfo=g[1],f.host=g[2],f.port=g[3],f.port&&!p.test(f.port)))return null;f.path=h[3];f.query=h[4];f.fragment=h[5];if(!f.scheme&&c&&(f.scheme=c.scheme,!f.host&&c.host))f.userinfo=c.userinfo,f.host=c.host,f.port=c.port,f.pathRelative=!0;if(f.pathRelative)if(f.path){if(f.path[0]!=="/")h=/^(.*\/)[^\/]*$/.exec(c.path)[1]||"/",f.path=
h+f.path}else f.path=c.path;if(f.scheme)f.scheme=f.scheme.toLowerCase();if(f.port)f.port=d(f.port);if(f.host&&f.path)f.path=e(f.path);return f}function h(a,b){var d;if(b){b=b.href||b;d=c(b);if(!d||!d.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:d})}d=c(a,d);if(!d)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:d,writable:!0});var e=new j(this);Object.defineProperty(this,"query",{get:function(){return this._url?
e:null},enumerable:!0})}try{var n;if(typeof window.URL==="function"&&window.URL.length!==0&&(n=new window.URL("http://www.w3.org?q")).protocol==="http:"&&n.query)return}catch(m){}var o=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,x=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,v=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,p=/^\d*$/,t=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,u=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,r=/^([^?#\s]*)$/,s=/^([^\s]*)$/,y=/^\S*$/,w=/([^:]*):?(.*)/,z=typeof StopIteration!==
"undefined"?StopIteration:Error("Stop Iteration"),A={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(j.prototype,{get:{value:function(a){f(a);var c;b(this._url.query).some(function(b){b=i(b);if(b[0]===a)return c=b[1],!0});return c},enumerable:!0},set:{value:function(a,c){f(a);f(c);var d=b(this._url.query);d.some(function(b,e){var f=i(b);if(f[0]===a)return f[1]=c,d[e]=g(f),!0})||d.push(g([a,c]));this._url.query=l(d)},enumerable:!0},has:{value:function(a){f(a);
return b(this._url.query).some(function(b){if(i(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){f(a);var c=b(this._url.query),d=c.filter(function(b){return i(b)[0]!==a});return d.length!==c.length?(this._url.query=l(d),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if(typeof a!=="function")throw new TypeError;var c=k(this._url,"keys+values");try{for(;;){var d=c.next();a.call(b,d[1],d[0],this)}}catch(e){if(e!==z)throw e;
}},enumerable:!0},keys:{value:function(){return k(this._url,"keys")},enumerable:!0},values:{value:function(){return k(this._url,"values")},enumerable:!0},items:{value:function(){return k(this._url,"keys+values")}},size:{get:function(){return b(this._url.query).length},enumerable:!0},getAll:{value:function(a){f(a);var c=[];b(this._url.query).forEach(function(b){b=i(b);b[0]===a&&c.push(b[1])});return c},enumerable:!0},append:{value:function(a,c){f(a);f(c);var d=b(this._url.query);d.push(g([a,c]));this._url.query=
l(d)},enumerable:!0}});Object.defineProperties(h.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var b=a.scheme?a.scheme+":":"";a.host&&(b+="//",a.userinfo&&(b+=a.userinfo+"@"),b+=a.host,a.port&&(b+=":"+a.port));b+=a.path;a.query&&(b+="?"+a.query);a.fragment&&(b+="#"+a.fragment);a=b}else a=this._input;return a},set:function(a){f(a);this._input=a;this._url=c(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){f(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){f(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=w.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){f(a);if(this._url){var b=
w.exec(this._userinfo),a=[encodeURIComponent(a||"")];b[2]&&a.push(b[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=w.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){f(a);if(this._url){var b=[w.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.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){f(a);if(this._url&&(a=u.exec(a)))this._url.host=a[1],this._url.port=d(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){f(a);if(this._url&&t.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===A[this.protocol]&&(a="");return a},set:function(a){f(a);if(this._url&&p.exec(a))this._url.port=d(a)},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){f(a);
if(this._url&&r.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?e(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){f(a);if(this._url&&(a&&a[0]==="?"&&(a=a.substring(1)),s.exec(a)))this._url.query=a},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){f(a);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),y.exec(a)))this._url.fragment=a},enumerable:!0}});
if((n=window.URL||window.webkitURL)&&n.createObjectURL)Object.defineProperty(h,"createObjectURL",{value:n.createObjectURL.bind(n),enumerable:!1}),Object.defineProperty(h,"revokeObjectURL",{value:n.revokeObjectURL.bind(n),enumerable:!1});window.URL=h})();define("orion/URL-shim",function(){});
define("orion/PageLinks","require,orion/Deferred,orion/PageUtil,orion/URITemplate,orion/i18nUtil,orion/objects,orion/URL-shim".split(","),function(f,b,l,i,g,k){function j(){return f.toUrl?(new URL(f.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(c){c!=="objectClass"&&c!=="service.names"&&c!=="service.id"&&c!=="__plugin__"&&(b[c]=a.getProperty(c))});return b}function e(a){return g.getMessageBundle(a.nls).then(function(b){a.textContent=
a.nameKey?b[a.nameKey]:a.name;return a},function(){a.textContent=a.nameKey||a.name;return a})}function a(a,c){var f=a.getServiceReferences(c||"orion.page.link"),h=l.matchResourceParameters(window.location.href),g={OrionHome:j(),Location:h.resource},k=[];f.forEach(function(a){a=d(a);if(a.uriTemplate&&(a.nls||a.name)){var c=(new i(a.uriTemplate)).expand(g),c=l.validateURLScheme(c);a.href=c;a.nls?k.push(e(a)):(a.textContent=a.name,k.push((new b).resolve(a)))}});return b.all(k)}function c(a){var b=this.categories=
Object.create(null);a.forEach(function(a){b[a.id]=a})}function h(a){this.allPageLinks=a;this.allPageLinks.sort(n)}function n(a,b){var c=a.textContent&&a.textContent.toLowerCase(),d=b.textContent&&b.textContent.toLowerCase();return c<d?-1:c>d?1:0}var m;k.mixin(c.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});k.mixin(h.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var b=a.href,a=
a.textContent,c=document.createElement("a");c.href=b;c.target="_self";c.classList.add("targetSelector");c.textContent=a;return c})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(a){var f;return!m?(f=[],a.getServiceReferences("orion.page.link.category").forEach(function(a){a=d(a);if(a.id&&(a.name||a.nameKey))a.nls?f.push(e(a)):(a.textContent=a.name,f.push((new b).resolve(a)))}),b.all(f).then(function(a){return m=new c(a)})):(new b).resolve(m)},getPageLinksInfo:function(b,
c){return a(b,c).then(function(a){return new h(a)})},getOrionHome:j}});
define("domReady",[],function(){function f(){if(!j){j=!0;g&&clearInterval(g);var a=e;if(j&&a.length){e=[];var b;for(b=0;b<a.length;b+=1)a[b](d)}}}function b(a){j?a(d):e.push(a);return b}var l,i,g,k=typeof window!=="undefined"&&window.document,j=!k,d=k?document:null,e=[];if(k){if(document.addEventListener)document.addEventListener("DOMContentLoaded",f,!1),window.addEventListener("load",f,!1);else if(window.attachEvent){window.attachEvent("onload",f);i=document.createElement("div");try{l=window.frameElement===
null}catch(a){}i.doScroll&&l&&window.external&&(g=setInterval(function(){try{i.doScroll(),f()}catch(a){}},30))}document.readyState==="complete"&&f()}b.version="2.0.1";b.load=function(a,d,e,f){f.isBuild?e(null):b(e)};return b});
define('built-cFPlugin.js',"require,orion/xhr,orion/Deferred,orion/plugin,orion/cfui/cFClient,orion/serviceregistry,orion/preferences,orion/URITemplate,orion/PageLinks,domReady!".split(","),function(f,b,l,i,g,k){function j(a){this.location=a}function d(a){var b="\n"+a.name+": ",d=a.runningInstances,e=a.instances;d||(d=0);b+=d/e*100+"%\n\tplatform: ";b+="\n\tusage: "+a.memory+"M x ";b+=d+" instance(s)";b+="\n\turls:";a.urls&&a.urls.forEach(function(a){b+="\n\t\t["+a+"](http://"+a+")"});return b}
var f=document.createElement("a"),i=new i({name:"Cloud Foundry",version:"1.0",description:"This plugin integrates with Cloud Foundry."}),e=new g.CFService,g=new k.ServiceRegistry;f.href="../../prefs/user";k=f.href;j.prototype={get:function(a){return b("GET",this.location+a,{headers:{"Orion-Version":"1"},timeout:15E3,log:!1}).then(function(a){return a.response?JSON.parse(a.response):null})},put:function(a,c){return b("PUT",this.location+a,{data:JSON.stringify(c),headers:{"Orion-Version":"1"},contentType:"application/json;charset=UTF-8",
timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null})},remove:function(a,c){return b("DELETE",this.location+a+"?key="+c,{headers:{"Orion-Version":"1"},contentType:"application/json;charset=UTF-8",timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null})}};k=new j(k);g.registerService("orion.core.preference.provider",k,{});i.registerService("orion.core.setting",null,{settings:[{pid:"org.eclipse.orion.client.cf.settings",name:"Settings",category:"Cloud",
properties:[{id:"targetUrl",name:"API Url",type:"string",defaultValue:""},{id:"manageUrl",name:"Manage Url",type:"string",defaultValue:""}]}]});i.registerServiceProvider("orion.shell.command",null,{name:"cfo",description:"Commands for interacting with a Cloud Foundry compatible target"});i.registerServiceProvider("orion.shell.command",{callback:function(a){return a.url?e.setTarget(a.url,a.org,a.space).then(function(a){return a?"target: "+a.Url:"Target not set"}):e.getTarget().then(function(a){return"target: "+
a.Url})}},{name:"cfo target",description:"Set or display the target cloud, organization, and space",parameters:[{name:"url",type:"string",description:"Target URL to switch to",defaultValue:null},{name:"org",type:"string",description:"Organization",defaultValue:null},{name:"space",type:"string",description:"Space",defaultValue:null}]});i.registerServiceProvider("orion.shell.command",{callback:function(){return e.getInfo().then(function(a){var b=a.description+"\nversion: "+a.version+"\nsupport: "+a.support;
a.user&&(b+="\n\nuser: "+a.user);return b})}},{name:"cfo info",description:"Display information on the current target, user, etc."});i.registerServiceProvider("orion.shell.command",{callback:function(a){return e.login(null,a.username,a.password,a.org,a.space).then(function(){return"Logged in"})}},{name:"cfo login",description:"Log user in",parameters:[{name:"username",type:"string",description:"Username",defaultValue:null},{name:"password",type:"string",description:"Password",defaultValue:null},{name:"org",
type:"string",description:"Organization",defaultValue:null},{name:"space",type:"string",description:"Space",defaultValue:null}]});i.registerServiceProvider("orion.shell.command",{callback:function(){return e.logout().then(function(){return"Logged out"})}},{name:"cfo logout",description:"Log user out"});i.registerServiceProvider("orion.shell.command",{callback:function(){return e.getApps().then(function(a){a=a.apps;if(!a||a.length===0)return"No applications.";var b="\nname\tstate\tinstances\tmemory\tdisk\turls\n";
a.forEach(function(a){var d=b,e=a.name,f="\n"+e+"\t";e.length<=4&&(f+="\t");f+=a.state+"\t";(e=a.runningInstances)||(e=0);f+=e+" x "+a.memory+"M\t";a=a.urls[0];f+="\t["+a+"](http://"+a+")";b=d+f});return b})}},{name:"cfo apps",description:"List all apps in the target space"});i.registerServiceProvider("orion.shell.command",{callback:function(a,b){return e.getApp(null,a.app,b.cwd).then(function(a){return!a?"Application not found":d(a)})}},{name:"cfo app",description:"Display health and status for app",
parameters:[{name:"app",type:"string",description:"Application to show information for",defaultValue:null}]});i.registerServiceProvider("orion.shell.command",{callback:function(a,b){return e.pushApp(null,a.app,decodeURIComponent(b.cwd)).then(function(a){if(!a||!a.applications)return"Application not found";var b="";a.applications.forEach(function(a){var c=a.uris[0];b+="\nApplication "+a.name+" ready at: ["+c+"](http://"+c+")"});return b})}},{name:"cfo push",description:"Push a new app or sync changes to an existing app",
parameters:[{name:"app",type:"string",description:"Application to push",defaultValue:null}]});i.registerServiceProvider("orion.shell.command",{callback:function(a,b){return e.startApp(null,a.app,b.cwd).then(function(a){if(!a||!a.entity)return"Application not found";a=a.entity;return a.state==="STARTED"?"Application "+a.name+" started":"Problems while starting application "+a.name})}},{name:"cfo start",description:"Start an application",parameters:[{name:"app",type:"string",description:"Application to start",
defaultValue:null}]});i.registerServiceProvider("orion.shell.command",{callback:function(a,b){return e.stopApp(null,a.app,b.cwd).then(function(a){if(!a||!a.entity)return"Application not found";a=a.entity;return a.state==="STOPPED"?"Application "+a.name+" stopped":"Problems while stopping application "+a.name})}},{name:"cfo stop",description:"Stop an application",parameters:[{name:"app",type:"string",description:"Application to stop",defaultValue:null}]});i.connect()});