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