/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2010, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2010-2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/**
 * @license RequireJS domReady 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/requirejs for details
 */
/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/
/*

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors: IBM Corporation - initial API and implementation

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

 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
*/
(function(h,n){typeof define==="function"&&define.amd?define("orion/Deferred",[],n):typeof exports==="object"?module.exports=n():(h.orion=h.orion||{},h.orion.Deferred=n())})(this,function(){function h(){for(var a;a=l.shift()||c.shift();)a();f=!1}function n(a,b){(b?c:l).push(a);f||(f=!0,b?setTimeout(h,0):h())}function j(a){return function(){a.apply(null,arguments)}}function m(){}function k(){var a=Error("Cancel");a.name="Cancel";return a}function i(){function a(){for(var a;a=g.shift();){var e=a.deferred,
c=d==="resolved"?"resolve":"reject";if(typeof a[c]==="function")try{var f=a[c](b);f&&typeof f.then==="function"?(e.cancel=f.cancel||m,f.then(j(e.resolve),j(e.reject),e.progress)):e.resolve(f)}catch(v){e.reject(v)}else e[c](b)}}var b,d,g=[],e=this;this.reject=function(f){d||(d="rejected",b=f,g.length&&n(a));return e.promise};this.resolve=function(f){d||(d="resolved",b=f,g.length&&n(a));return e.promise};this.progress=function(a){d||g.forEach(function(b){b.progress&&b.progress(a)});return e.promise};
this.cancel=function(){d||e.reject(k())};this.then=function(b,e,f){var b={resolve:b,reject:e,progress:f,deferred:new i},c=b.deferred,v=this.cancel.bind(this),w=function(){n(function(){(c.cancel===w?v:c.cancel)()},!0)};c.cancel=w;e=c.promise;e.cancel=function(){c.cancel()};g.push(b);d&&n(a,!0);return e};this.promise={then:this.then,cancel:this.cancel}}var l=[],c=[],f=!1;i.all=function(a,b){function d(a,b){c||(f[a]=b,--e===0&&h.resolve(f))}function g(a,g){if(!c){if(b)try{d(a,b(g));return}catch(e){g=
e}h.reject(g)}}var e=a.length,f=[],c=!1,h=new i;h.then(null,function(){c=!0;a.forEach(function(a){a.cancel&&a.cancel()})});e===0?h.resolve(f):a.forEach(function(a,b){a.then(d.bind(null,b),g.bind(null,b))});return h.promise};i.when=function(a,b,d,g){var e;if(!(a&&typeof a.then==="function"))e=new i,e.resolve(a),a=e.promise;return a.then(b,d,g)};return i});
define("orion/EventTarget",[],function(){function h(){this._namedListeners={}}h.prototype={dispatchEvent:function(h){if(!h.type)throw Error("unspecified type");var j=this._namedListeners[h.type];j&&j.forEach(function(j){try{typeof j==="function"?j(h):j.handleEvent(h)}catch(k){typeof console!=="undefined"&&console.log(k)}});return!h.defaultPrevented},addEventListener:function(h,j){if(typeof j==="function"||j.handleEvent)this._namedListeners[h]=this._namedListeners[h]||[],this._namedListeners[h].push(j)},
removeEventListener:function(h,j){var m=this._namedListeners[h];if(m)for(var k=0;k<m.length;k++)if(m[k]===j){m.length===1?delete this._namedListeners[h]:m.splice(k,1);break}}};h.prototype.constructor=h;h.attach=function(n){var j=new h;n.dispatchEvent=j.dispatchEvent.bind(j);n.addEventListener=j.addEventListener.bind(j);n.removeEventListener=j.removeEventListener.bind(j)};return h});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(h,n){function j(c,f,a){this._properties=a||{};this._properties["service.id"]=c;this._properties.objectClass=f;this._properties["service.names"]=f}function m(c,f,a){this._serviceId=c;this._serviceReference=f;this._internalRegistry=a}function k(c,f){function a(a){return function(){var b;try{if(!f())throw Error("Service was unregistered");var e=c[a].apply(c,Array.prototype.slice.call(arguments));if(e&&typeof e.then==="function")return e;
else b=new h,b.resolve(e)}catch(D){b=new h,b.reject(D)}return b.promise}}for(var b in c)typeof c[b]==="function"&&(this[b]=a(b))}function i(c,f){this.type=c;this.serviceReference=f}function l(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new n;var c=this;this._internalRegistry={isRegistered:function(f){return c._entries[f]?!0:!1},unregisterService:function(f){var a=c._entries[f];if(!a)throw Error("already unregistered");var b=a.reference;c._serviceEventTarget.dispatchEvent(new i("unregistering",
b));c._entries[f]=null;b.getProperty("objectClass").forEach(function(a){for(var g=c._namedReferences[a],e=0;e<g.length;e++)if(g[e]===b){g.length===1?delete c._namedReferences[a]:g.splice(e,1);break}})},modifyService:function(f){f=c._entries[f];if(!f)throw Error("already unregistered");c._serviceEventTarget.dispatchEvent(new i("modified",f.reference))}}}j.prototype={getPropertyKeys:function(){var c=[],f;for(f in this._properties)this._properties.hasOwnProperty(f)&&c.push(f);return c},getProperty:function(c){return this._properties[c]}};
j.prototype.constructor=j;m.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("already unregistered");return this._serviceReference},setProperties:function(c){var f=this._serviceReference._properties;this._serviceReference._properties=c||{};c["service.id"]=this._serviceId;c.objectClass=f.objectClass;c["service.names"]=f["service.names"];this._internalRegistry.modifyService(this._serviceId)}};
m.prototype.constructor=m;l.prototype={getService:function(c){var f;if(typeof c==="string")(c=this._namedReferences[c])&&c.some(function(a){f=this._entries[a.getProperty("service.id")].service;return!!f},this);else if(c=this._entries[c.getProperty("service.id")])f=c.service;return f||null},getServiceReferences:function(c){if(c)return this._namedReferences[c]?this._namedReferences[c]:[];var f=[];this._entries.forEach(function(a){a&&f.push(a.reference)});return f},registerService:function(c,f,a){if(typeof f===
"undefined"||f===null)throw Error("invalid service");typeof c==="string"?c=[c]:Array.isArray(c)||(c=[]);var b=this._entries.length,d=new j(b,c,a),g=this._namedReferences;c.forEach(function(a){g[a]=g[a]||[];g[a].push(d)});c=new k(f,this._internalRegistry.isRegistered.bind(null,b));this._entries.push({reference:d,service:c});c=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new i("registered",d));return new m(b,d,c)},addEventListener:function(c,f){this._serviceEventTarget.addEventListener(c,
f)},removeEventListener:function(c,f){this._serviceEventTarget.removeEventListener(c,f)}};l.prototype.constructor=l;return{ServiceRegistry:l}});
define("orion/xhr",["orion/Deferred"],function(h){function n(h,m,k,i){var l=typeof k.response!=="undefined"?k.response:k.responseText,c;try{c=k.status}catch(f){c=0}h={args:m,response:l,responseText:typeof l==="string"?l:null,status:c,url:h,xhr:k};if(typeof i!=="undefined")h.error=i;return h}return function(j,m,k){var k=k||{},i=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,l=new h,c=k.headers||{},f=k.log||!1,a;typeof c["X-Requested-With"]==="undefined"&&(c["X-Requested-With"]="XMLHttpRequest");
if(typeof k.data!=="undefined"&&(j==="POST"||j==="PUT"))a=k.data;if(typeof k.responseType==="string")i.responseType=k.responseType;i.onprogress=function(a){a.xhr=i;l.progress(a)};i.onreadystatechange=function(){if(i.readyState===4){var a=n(m,k,i),b=i.status;200<=b&&b<400?l.resolve(a):(f&&typeof console!=="undefined"&&console.log(Error(i.statusText)),l.reject(a))}};try{i.open(j,m,!0);if(typeof k.timeout==="number")if(typeof i.timeout==="number")i.timeout=k.timeout,i.addEventListener("timeout",function(){l.reject(n(m,
k,i,"Timeout exceeded"))});else{var b=setTimeout(function(){l.reject(n(m,k,i,"Timeout exceeded"))},k.timeout);l.then(clearTimeout.bind(null,b),clearTimeout.bind(null,b))}Object.keys(c).forEach(function(a){i.setRequestHeader(a,c[a])});i.send(a)}catch(d){l.reject(n(m,k,i,d))}return l.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(h,n,j){function m(a,b){this._name=a;this._providers=b;this._flushPending=!1;this._cached=null;this._stores=[];this._dirty=[]}function k(a,b){return{get:function(d,g){if(b===0)return null;var e=localStorage.getItem(a+d);if(e===null)return null;e=JSON.parse(e);return g||b===-1||e._expires&&e._expires>(new Date).getTime()?(delete e._expires,e):null},set:function(d,g){if(b!==0){if(b!==-1)g._expires=(new Date).getTime()+1E3*b;
if(Object.keys(g).length===0)localStorage.removeItem(a+d);else{var e=JSON.stringify(g);localStorage.setItem(a+d,e);delete g._expires}}},remove:function(b){localStorage.removeItem(a+b)}}}function i(a){this._currentPromises={};this._cache=new k("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var b=a.getServiceReferences("orion.core.preference.provider");if(b.length>0)this._service=a.getService(b[0])}return!!this._service}}function l(a){this._location=
a;this._currentPromise=null;this._cache=new k("/orion/preferences/default",3600)}function c(){this._cache=new k("/orion/preferences/local",-1)}function f(a,b){this._userProvider=new i(a);this._localProvider=new c;b=b||"defaults.pref";b.indexOf("://")===-1&&(b=h.toUrl(b));this._defaultsProvider=new l(b);this._serviceRegistration=a.registerService("orion.core.preference",this)}m.prototype={_flush:function(){for(var a=[],b=0;b<this._stores.length;++b){var d=this._stores[b];this._dirty.indexOf(d)!==-1&&
a.push(this._providers[b].put(this._name,d))}this._dirty=[];return n.all(a)},_scheduleFlush:function(a){this._dirty.indexOf(a)===-1&&this._dirty.push(a);if(!this._flushPending)this._flushPending=!0,window.setTimeout(function(){if(this._flushPending)this._flushPending=!1,this._flush()}.bind(this),0)},_getCached:function(){if(!this._cached){this._cached={};for(var a=0;a<this._stores.length;++a){var b=this._stores[a],d;for(d in b)b.hasOwnProperty(d)&&typeof this._cached[d]==="undefined"&&(this._cached[d]=
b[d])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(a){return this._getCached()[a]},put:function(a,b){if(this._stores.length!==0){var d=this._stores[0];if(d[a]!==b)d[a]=b,this._cached=null,this._scheduleFlush(d)}},remove:function(a){for(var b=0;b<this._stores.length;++b){var d=this._stores[b];if(d.hasOwnProperty(a))return delete d[a],this._cached=null,this._scheduleFlush(d),!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=[],g=0;g<this._providers.length;++g)d.push(this._providers[g].get(this._name,a).then(function(a){return function(g){b._stores[a]=g}}(g)));return n.all(d).then(function(){b._cached=null;b._getCached()})},flush:function(){this._flush()}};i.prototype={get:function(a,b){if(this._currentPromises[a])return this._currentPromises[a];var d=new n,g=null;
b?this._cache.remove(a):g=this._cache.get(a);if(g!==null)d.resolve(g);else{this._currentPromises[a]=d;var e=this;this._service.get(a).then(function(b){e._cache.set(a,b);delete e._currentPromises[a];d.resolve(b)},function(b){b.status===404?(b={},e._cache.set(a,b),delete e._currentPromises[a],d.resolve(b)):(delete e._currentPromises[a],d.resolve(e._cache.get(a,!0)||{}))})}return d},put:function(a,b){this._cache.set(a,b);return this._service.put(a,b)}};l.prototype={get:function(a,b){if(this._currentPromise)return this._currentPromise;
var d=new n,g=null;b?this._cache.remove(a):g=this._cache.get(a);if(g!==null)d.resolve(g);else{this._currentPromise=d;var e=this;j("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){b=JSON.parse(b.response);e._cache.set(a,b[a]||{});e._currentPromise=null;d.resolve(b[a]||{})},function(b){b.xhr.status===401||b.xhr.status===404?(e._cache.set(a,{}),e._currentPromise=null,d.resolve({})):(e._currentPromise=null,b=e._cache.get(a,!0),b!==null?d.resolve(b[a]||{}):d.resolve({}))})}return d},
put:function(){var a=new n;a.resolve();return a}};c.prototype={get:function(a){var b=new n,a=this._cache.get(a);a!==null?b.resolve(a):b.resolve({});return b},put:function(a,b){var d=new n;this._cache.set(a,b);d.resolve();return d}};f.DEFAULT_SCOPE=1;f.LOCAL_SCOPE=2;f.USER_SCOPE=4;f.prototype={listenForChangedSettings:function(a){window.addEventListener("storage",a,!1);return"/orion/preferences/local/settings"},getPreferences:function(a,b){if(!b||typeof b!=="number"||b>7||b<1)b=f.DEFAULT_SCOPE|f.LOCAL_SCOPE|
f.USER_SCOPE;var d=[];f.USER_SCOPE&b&&this._userProvider.available()&&d.push(this._userProvider);f.LOCAL_SCOPE&b&&d.push(this._localProvider);f.DEFAULT_SCOPE&b&&d.push(this._defaultsProvider);var g=new m(a,d);return g.sync().then(function(){return g})},getSetting:function(a,b,d){for(var g,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===d){g=a[e].data[f].value;break}return g}};return{PreferencesService:f}});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget"],function(h,n){function j(f,a){var b=Object.keys(f),d=Object.keys(a);if(b.length!==d.length)return!1;b.sort();d.sort();for(var g=0,e=b.length;g<e;g++){var c=b[g];if(c!==d[g])return!1;var h=f[c],c=a[c];if(h!==c&&JSON.stringify(h)!==JSON.stringify(c))return!1}return!0}function m(c){if(c.indexOf("://")===-1){var a=document.createElement("a");a.href=c;return a.href}return c}function k(c){var a=null;return{key:function(b){return(a=a||
Object.keys(c))[b]},getItem:function(a){return c[a]},setItem:function(b,d){c[b]=d;a=null},removeItem:function(b){delete c[b];a=null},clear:function(){(a=a||Object.keys(c)).forEach(function(a){delete c[a]}.bind(this));a=null}}}function i(c,a){return{type:c,plugin:a}}function l(c,a,b){function d(a,c,g){if(!r)return(new h).reject(Error("plugin not connected"));var e=E++,d=new h;d.then(null,function(a){o==="active"&&a instanceof Error&&a.name==="Cancel"&&b.postMessage({id:e,cancel:a.message||"Cancel"},
r)});B[String(e)]=d;b.postMessage({id:e,serviceId:a,method:c,params:g},r);return d.promise}function g(a){var b={};if(a.methods&&(a.methods.forEach(function(c){b[c]=function(){var b=Array.prototype.slice.call(arguments);return o==="active"?d(a.serviceId,c,b):p.start({"transient":!0}).then(function(){return d(a.serviceId,c,b)})}}),b.addEventListener&&b.removeEventListener)){var c=new n;b.dispatchEvent=c.dispatchEvent.bind(c);var g=b.addEventListener;b.addEventListener=function(a,b){c._namedListeners[a]||
g(a);c.addEventListener(a,b)};var e=b.removeEventListener;b.removeEventListener=function(a,b){c.removeEventListener(a,b);c._namedListeners[a]&&e(a)}}return b}function e(a){var b=JSON.parse(JSON.stringify(a.properties));b.__plugin__=c;a=a.names||a.type||[];Array.isArray(a)||(a=[a]);b.objectClass=a;return b}function k(a){var c=g(a),d=e(a),d=b.registerService(a.names||a.type,c,d);q[a.serviceId]={registration:d,proxy:c}}function m(){b.persist(c,{created:v,headers:w,services:x,autostart:t,lastModified:y})}
function l(a){var c;try{if(a.method)if("manifest"===a.method||"plugin"===a.method){var g=a.params[0];C({headers:g.headers,services:g.services}).then(function(){s.resolve(p)})}else if("dispatchEvent"===a.method){var e=q[a.serviceId].proxy;e.dispatchEvent.apply(e,a.params)}else if("progress"===a.method)c=B[String(a.requestId)],c.progress.apply(c,a.params);else if("timeout"===a.method)s&&s.reject(a.error);else throw Error("Bad response method: "+a.method);else if(c=B[String(a.id)],delete B[String(a.id)],
a.error){var d=b.handleServiceError(p,a.error);c.reject(d)}else c.resolve(a.result)}catch(f){console.log("Plugin._responseHandler "+f)}}var p=this,a=a||{},v=a.created||(new Date).getTime(),w=a.headers||{},x=a.services||[],t=a.autostart,y=a.lastModified||0,o="installed",u,s,r,q={},E=0,B={},C;this._persist=m;this._resolve=function(){o="resolved";b.dispatchEvent(new i("resolved",p))};this._getAutostart=function(){return t};this._getCreated=function(){return v};this.getLocation=function(){return c};this.getHeaders=
function(){return JSON.parse(JSON.stringify(w))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return y};this.getServiceReferences=function(){var a=[];Object.keys(q).forEach(function(b){a.push(q[b].registration.getReference())});return a};this.getState=function(){return o};this.start=function(a){if(o==="uninstalled")return(new h).reject(Error("Plugin is uninstalled"));
if(u)return u.promise.then(this.start.bind(this,a));if(o==="active")return(new h).resolve();if(!a||!a["transient"]){var g=a&&a.lazy?"lazy":"started";g!==t&&(t=g,m())}g=b.getState();if(g!=="starting"&&g!=="active")return a["transient"]?(new h).reject(Error("start transient error")):(new h).resolve();if(o==="installed")try{this._resolve()}catch(e){return(new h).reject(e)}o==="resolved"&&x.forEach(function(a){k(a)});if(a&&a.lazy)return o!=="starting"&&(o="starting",b.dispatchEvent(new i("lazy activation",
p))),(new h).resolve();var d=new h;u=d;o="starting";b.dispatchEvent(new i("starting",p));s=new h;r=b.connect(c,l);s.then(function(){s=null;o="active";b.dispatchEvent(new i("started",p));u=null;d.resolve()},function(){s=null;o="stopping";b.dispatchEvent(new i("stopping",p));Object.keys(q).forEach(function(a){q[a].registration.unregister();delete q[a]});b.disconnect(r);r=null;o="resolved";u=null;b.dispatchEvent(new i("stopped",p));d.reject(Error("plugin activation error"))});return d.promise};this.stop=
function(a){if(o==="uninstalled")return(new h).reject(Error("Plugin is uninstalled"));if(u)return u.promise.then(this.stop.bind(this,a));if((!a||!a["transient"])&&"stopped"!==t)t="stopped",m();if(o!=="active"&&o!=="starting")return(new h).resolve();u=a=new h;o="stopping";b.dispatchEvent(new i("stopping",p));Object.keys(q).forEach(function(a){q[a].registration.unregister();delete q[a]});r&&(b.disconnect(r),r=null);o="resolved";u=null;b.dispatchEvent(new i("stopped",p));a.resolve();return a.promise};
C=function(a){if(o==="uninstalled")return(new h).reject(Error("Plugin is uninstalled"));if(!a)return y===0&&(y=(new Date).getTime(),m()),b.loadManifest(c).then(C);var g=w,d=x,v=t;w=a.headers||{};x=a.services||{};t=a.autostart||t;a.lastModified?y=a.lastModified:(y=(new Date).getTime(),m());if(j(w,g)&&j(x,d)&&t===v)return(new h).resolve();if(o==="active"||o==="starting"){var n=[];Object.keys(x).forEach(function(a){var b=x[a];n.push(a);var c=q[a];if(c){if(j(b.methods,Object.keys(c.proxy))){var a=e(b),
g=c.registration.getReference(),d={};g.getPropertyKeys().forEach(function(a){d[a]=g.getProperty(a)});j(a,d)||c.registration.setProperties(a);return}c.registration.unregister();delete q[a]}k(b)});Object.keys(q).forEach(function(a){n.indexOf(a)===-1&&(q[a].registration.unregister(),delete q[a])})}o==="active"&&(b.disconnect(r),s=new h,r=b.connect(c,l),s.then(function(){s=null},function(){s=null;o="stopping";b.dispatchEvent(new i("stopping"),p);Object.keys(q).forEach(function(a){q[a].registration.unregister();
delete q[a]});b.disconnect(r);r=null;o="resolved";b.dispatchEvent(new i("stopped",p))}));return(new h).resolve()};this.update=function(a){return C(a).then(function(){b.dispatchEvent(new i("updated",p))})};this.uninstall=function(){if(o==="uninstalled")return(new h).reject(Error("Plugin is uninstalled"));if(o==="active"||o==="starting"||o==="stopping")return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));b.removePlugin(this);o="uninstalled";b.dispatchEvent(new i("uninstalled",
p));return(new h).resolve()}}var c=/^http[s]?/i;return{Plugin:l,PluginRegistry:function(f,a){function b(a){var b=a.source;j.some(function(c){if(b===c.target){if(typeof c.useStructuredClone==="undefined")c.useStructuredClone=typeof a.data!=="string";c.handler(c.useStructuredClone?a.data:JSON.parse(a.data));return!0}})}var a=a||{},d=a.storage||localStorage;d.getItem||(d=k(d));var g="installed",e=[],j=[],z=new n,A={},p={registerService:f.registerService.bind(f),connect:function(b,c,g){function d(a){a=
Error(a);a.name="timeout";c({method:"timeout",error:a})}var e={handler:c,url:b},f=setTimeout(d.bind(null,"Load timeout for: "+b),g||15E3),h=document.createElement("iframe");h.name=b+"_"+(new Date).getTime();if(!a.visible)h.style.display="none",h.style.visibility="hidden";h.src=b;h.onload=function(){clearTimeout(f);setTimeout(d.bind(null,"Plugin handshake timeout for: "+b),5E3)};h.sandbox="allow-scripts allow-same-origin";document.body.appendChild(h);e.target=h.contentWindow;e.close=function(){h&&
(document.body.removeChild(h),h=null)};j.push(e);return e},disconnect:function(a){for(var b=0;b<j.length;b++)if(a===j[b]){j.splice(b,1);try{a.close()}catch(c){}break}},removePlugin:function(a){for(var b=0;b<e.length;b++)if(a===e[b]){e.splice(b,1);break}d.removeItem("plugin."+a.getLocation())},persist:function(a,b){d.setItem("plugin."+a,JSON.stringify(b))},postMessage:function(a,b){b.target.postMessage(b.useStructuredClone?a:JSON.stringify(a),b.url)},dispatchEvent:function(a){try{z.dispatchEvent(a)}catch(b){console&&
console.log("PluginRegistry.dispatchEvent "+b)}},loadManifest:function(a){var b=new h,c=p.connect(a,function(a){c&&a.method&&("manifest"===a.method||"plugin"===a.method?(a=a.params[0],p.disconnect(c),c=null,b.resolve(a)):"timeout"===a.method&&(p.disconnect(c),c=null,b.reject(a.error)))});return b.promise},getState:function(){return g},handleServiceError:function(a,b){if(b&&b.status===401){var g=a.getHeaders(),d=a.getName()||a.getLocation(),e=document.createElement("span");e.appendChild(document.createTextNode("Authentication required for: "+
d+"."));if(g.login)e.appendChild(document.createTextNode(" ")),d=document.createElement("a"),d.target="_blank",d.textContent="Login",d.href=g.login,c.test(d.href)?(e.appendChild(d),e.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+g.login);return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(e)}}if(b.__isError){var f=b,b=Error(f.message);Object.keys(f).forEach(function(a){b[a]=f[a]});delete b.__isError}return b}};this.getLocation=
function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=p.getState;this.init=function(){if(!(g==="starting"||g==="active"||g==="stopping")){addEventListener("message",b,!1);for(var c=[],f=0,h=d.length;f<h;f++)c.push(d.key(f));c.forEach(function(a){if(a.indexOf("plugin.")===0){var b=a.substring(7),a=JSON.parse(d.getItem(a));a.created&&e.push(new l(b,a,p))}});
e.sort(function(a,b){return a._getCreated()<b._getCreated()?-1:1});a.plugins&&Object.keys(a.plugins).forEach(function(b){b=m(b);if(!this.getPlugin(b)){var c=a.plugins[b],c=typeof c==="object"||{};c.autostart=c.autostart||a.defaultAutostart||"lazy";e.push(new l(b,c,p))}}.bind(this));g="starting"}};this.start=function(){g!=="starting"&&this.init();if(g!=="starting")return(new h).reject("Cannot start framework. Framework is already "+g+".");var a=[],b=(new Date).getTime();e.forEach(function(c){var d=
c._getAutostart();c.getLastModified()===0?a.push(c.update().then(function(){if("started"===d)return c.start({"transient":!0});if("lazy"===d)return c.start({lazy:!0,"transient":!0});c._resolve()})):"started"===d?a.push(c.start({"transient":!0})):"lazy"===d?(a.push(c.start({lazy:!0,"transient":!0})),b>c.getLastModified()+864E5&&c.update()):c._resolve()});return h.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){g="active"})};this.stop=function(){if(g!=="starting"&&g!=="active")return(new h).reject("Cannot stop registry. Registry is already "+
g+".");g="stopping";var a=[];e.forEach(function(b){a.push(b.stop({"transient":!0}))});return h.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){removeEventListener("message",b);g="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new h).reject("Cannot uninstall registry")};this.installPlugin=function(a,b){var a=m(a),c=this.getPlugin(a);if(c)return(new h).resolve(c);if(A[a])return A[a];if(b)return c=new l(a,b,p),e.push(c),
c._persist(),p.dispatchEvent(new i("installed",c)),(new h).resolve(c);var d=p.loadManifest(a).then(function(b){c=new l(a,b,p);e.push(c);c._persist();delete A[a];p.dispatchEvent(new i("installed",c));return c},function(b){delete A[a];throw b;});return A[a]=d};this.getPlugins=function(){return e.slice()};this.getPlugin=function(a){var b=null,a=m(a);e.some(function(c){if(a===c.getLocation())return b=c,!0});return b};this.addEventListener=z.addEventListener.bind(z);this.removeEventListener=z.removeEventListener.bind(z);
this.resolvePlugins=function(){var a=!0;e.forEach(function(b){a=a&&b._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function h(h,k){function i(a){var b=a.getProperty("service.id"),d=this.addingService(a);d&&(c[b]=a,f[b]=d)}function l(a){var b=a.getProperty("service.id"),d=f[b];delete c[b];delete f[b];this.removedService(a,d)}this.serviceRegistry=h;var c={},f={},a=n,b,d;this.close=function(){if(a!==j)throw"Already closed";a=n;h.removeEventListener("registered",b);h.removeEventListener("unregistering",d);d=b=null;var c=this;this.getServiceReferences().forEach(function(a){l.call(c,
a)});if(typeof this.onClose==="function")this.onClose()};this.getServiceReferences=function(){return c.length?Object.keys(c).map(function(a){return c[a]}):null};this.open=function(){if(a!==n)throw"Already open";a=j;var c=this;b=function(a){if(a.serviceReference.getProperty("objectClass").indexOf(k)!==-1&&(i.call(c,a.serviceReference),typeof c.onServiceAdded==="function"))return c.onServiceAdded(a.serviceReference,c.serviceRegistry.getService(a.serviceReference))};d=function(a){a.serviceReference.getProperty("objectClass").indexOf(k)!==
-1&&l.call(c,a.serviceReference)};h.addEventListener("registered",b);h.addEventListener("unregistering",d);h.getServiceReferences(k).forEach(function(a){i.call(c,a)});if(typeof this.onOpen==="function")this.onOpen()}}var n=0,j=1;h.prototype={addingService:function(h){return this.serviceRegistry.getService(h)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(){}};return h});
define("orion/config",["orion/Deferred","orion/serviceTracker"],function(h,n){var j,m,k,i,l,c="pid";j=function(a,b,d){function g(a,c,d){c.forEach(function(g,e){try{var f=a[e].getProperty("__plugin__"),h=f&&b.getPlugin(f);(!f||h&&h.getState()==="active")&&c[e].updated(d)}catch(i){typeof console!=="undefined"&&console.log(i)}})}n.call(this,a,"orion.cm.managedservice");var e={},f={},i=function(b){var g=[];b.plugin.getServiceReferences().forEach(function(b){if(b.getProperty("objectClass").indexOf("orion.cm.managedservice")!==
-1){var e=b.getProperty(c),b=a.getService(b);e&&b&&(e=(e=d._find(e))&&e.getProperties(),g.push(b.updated(e)))}});return h.all(g)};this.addingService=function(b){var d=b.getProperty(c),g=a.getService(b);if(!d||!g)return null;e[d]||(e[d]=[]);f[d]||(f[d]=[]);e[d].push(b);f[d].push(g);return g};this.onServiceAdded=function(a,b){var e=a.getProperty(c),e=d._find(e);g([a],[b],e&&e.getProperties())};this.onOpen=function(){b.addEventListener("started",i)};this.onClose=function(){b.removeEventListener("started",
i)};this.notifyUpdated=function(a){var b=a.getPid();g(e[b]||[],f[b]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();g(e[a]||[],f[a]||[],null)};this.removedService=function(a,b){var d=a.getProperty(c),g=e[d],h=f[d];g.length>1?g.splice(g.indexOf(a),1):delete e[d];h.length>1?h.splice(h.indexOf(b),1):delete f[d]}};m=function(){function a(a,c,g){this.store=new k(this,g);this.configAdmin=new i(this,this.store);this.tracker=new j(a,c,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(c){a.tracker.open();return c})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();i=function(){function a(a,c){this.factory=a;this.store=c}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var f="/cm/configurations";
k=function(){function a(a,d){this.factory=a;this.prefsService=d;this.configs=Object.create(null);this.pref=null;var g=this;this.initPromise=this.prefsService.getPreferences(f).then(function(a){g.pref=a;a.keys().forEach(function(b){if(!g.configs[b]){var d=a.get(b);typeof d==="object"&&d!==null&&Object.keys(d).length>0&&(d[c]=b,g.configs[b]=new l(g.factory,g,d))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var c=this._find(a);
c||(c=new l(this.factory,this,a),this.configs[a]=c);return c},list:function(){var a=this,c=[];this.pref.keys().forEach(function(g){(g=a._find(g))&&g.getProperties()!==null&&c.push(g)});return c},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,c){this.pref.put(a,c.getProperties(!0)||{})}};return a}();l=function(){function a(a){for(var b={},c=Object.keys(a),f=0;f<c.length;f++){var h=c[f],i=a[h];b[h]=i instanceof Array?i.slice():i}return b}function b(b,g,e){this.factory=
b;this.store=g;if(e!==null&&typeof e==="object")this.pid=e[c],b=a(e),delete b[c],this.properties=b;else if(typeof e==="string")this.pid=e,this.properties=null;else throw Error("Invalid pid/properties "+e);}b.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(b){this._checkRemoved();var g=null;if(this.properties&&(g=a(this.properties),!b))g[c]=this.pid;return g},remove:function(){this._checkRemoved();
this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=!0},update:function(b){this._checkRemoved();b=a(b);delete b[c];this.properties=b;this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return b}();return{ConfigurationAdminFactory:m}});
define("orion/bootstrap","require,orion/Deferred,orion/serviceregistry,orion/preferences,orion/pluginregistry,orion/config".split(","),function(h,n,j,m,k,i){var l;return{startup:function(){if(l)return l;l=new n;var c=window.serviceRegistry=new j.ServiceRegistry,f=new m.PreferencesService(c);return f.getPreferences("/plugins").then(function(a){var b={plugins:{}};a.keys().forEach(function(c){var d=h.toUrl(c);b.plugins[d]=a[c]});var d=window.pluginRegistry=new k.PluginRegistry(c,b);return d.start().then(function(){if(c.getServiceReferences("orion.core.preference.provider").length>
0)return f.getPreferences("/plugins",f.USER_SCOPE).then(function(a){var b=[];a.keys().forEach(function(a){a=h.toUrl(a);d.getPlugin(a)||b.push(d.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return n.all(b,function(a){console.log(a)})})}).then(function(){return(new i.ConfigurationAdminFactory(c,d,f)).getConfigurationAdmin().then(c.registerService.bind(c,"orion.cm.configadmin"))}).then(function(){var a=c.getService("orion.core.auth");
if(a){var b=a.getUser().then(function(b){if(b)localStorage.setItem("lastLogin",(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){window.location=a})}),d=localStorage.getItem("lastLogin");if(!d||d<(new Date).getTime()-9E5)return b}}).then(function(){var a={serviceRegistry:c,preferences:f,pluginRegistry:d};l.resolve(a);return a})})}}});
define("domReady",[],function(){function h(a){for(var b=0,c;c=a[b];b++)c(l)}function n(){var b=c,d=f;i&&(b.length&&(c=[],h(b)),a.resourcesDone&&d.length&&(f=[],h(d)))}function j(){i||(i=!0,d&&clearInterval(d),n())}function m(a){i?a(l):c.push(a);return m}var k=typeof window!=="undefined"&&window.document,i=!k,l=k?document:null,c=[],f=[],a=requirejs||require||{},b=a.resourcesReady,d;if("resourcesReady"in a)a.resourcesReady=function(a){b&&b(a);a&&n()};k&&(document.addEventListener?(document.addEventListener("DOMContentLoaded",
j,!1),window.addEventListener("load",j,!1)):window.attachEvent&&(window.attachEvent("onload",j),self===self.top&&(d=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),j())}catch(a){}},30))),document.readyState==="complete"&&j());m.withResources=function(b){i&&a.resourcesDone?b(l):f.push(b);return m};m.version="1.0.0";m.load=function(a,b,c,d){d.isBuild?c(null):m(c)};return m});
define("index",["orion/bootstrap","domReady!"],function(h){h.startup().then(function(){window.location="navigate/table.html"})});