/*

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

 Contributors:
     IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 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
 RequireJS i18n 2.0.2 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 Available via the MIT or new BSD license.
 see: http://github.com/requirejs/i18n for details

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