/*******************************************************************************
 * @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) 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). 
 * 
 ******************************************************************************/

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

/*

 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) 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). 


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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation
*/
(function(b,a){typeof define==="function"&&define.amd?define("orion/Deferred",a):typeof exports==="object"?module.exports=a():(b.orion=b.orion||{},b.orion.Deferred=a())})(this,function(){function b(){for(var a;a=d.shift();)a();k=!1}function a(a){d.push(a);k||(k=!0,setTimeout(b,0))}function i(a){return function(){a.apply(void 0,arguments)}}function j(){function b(){for(var e;e=n.shift();){var c=e.deferred,a=o==="fulfilled"?"resolve":"reject";if(typeof e[a]==="function")try{var h=(0,e[a])(l),j=h&&(typeof h===
"object"||typeof h==="function")&&h.then;if(typeof j==="function")if(h===c.promise)c.reject(new TypeError);else{var k=h.cancel;typeof k==="function"?c._protected(d).parentCancel=k.bind(h):delete c._protected(d).parentCancel;j.call(h,i(c.resolve),i(c.reject),i(c.progress))}else c.resolve(h)}catch(p){c.reject(p)}else c[a](l)}}function k(e){delete c.parentCancel;o="rejected";l=e;n.length&&a(b)}function s(e){function d(f){return function(e){i||(i=!0,f(e))}}var i=!1;delete c.parentCancel;try{var m=e&&
(typeof e==="object"||typeof e==="function")&&e.then;if(typeof m==="function")if(e===h)k(new TypeError);else{o="assumed";var u=e&&e.cancel;if(typeof u!=="function"){var q=new j,e=q.promise;try{m(q.resolve,q.reject,q.progress)}catch(r){q.reject(r)}u=e.cancel;m=e.then}l=e;m.call(e,d(s),d(k));c.parentCancel=u.bind(e)}else o="fulfilled",l=e,n.length&&a(b)}catch(f){d(k)(f)}}function m(){var e=c.parentCancel;if(e)delete c.parentCancel,e();else if(!o)e=Error("Cancel"),e.name="Cancel",k(e)}var l,o,n=[],h=
this,c={};Object.defineProperty(this,"_protected",{value:function(e){if(e!==d)throw Error("protected");return c}});this.resolve=function(e){o||s(e);return h};this.reject=function(e){o||k(e);return h};this.progress=function(e){o||n.forEach(function(c){if(c.progress)try{c.progress(e)}catch(l){}});return h.promise};this.cancel=function(){c.parentCancel?setTimeout(m,0):m();return h};this.then=function(e,c,l){e={resolve:e,reject:c,progress:l,deferred:new j};n.push(e);e.deferred._protected(d).parentCancel=
h.promise.cancel.bind(h);(o==="fulfilled"||o==="rejected")&&a(b);return e.deferred.promise};this.promise={then:h.then,cancel:h.cancel}}var d=[],k=!1;j.all=function(a,d){function b(c,e){n||(o[c]=e,--l===0&&h.resolve(o))}function i(c,e){if(!n){if(d)try{b(c,d(e));return}catch(a){e=a}h.reject(e)}}var l=a.length,o=[],n=!1,h=new j;h.then(void 0,function(){n=!0;a.forEach(function(c){c.cancel&&c.cancel()})});l===0?h.resolve(o):a.forEach(function(c,e){c.then(b.bind(void 0,e),i.bind(void 0,e))});return h.promise};
j.when=function(a,d,b,i){var l;if(!(a&&typeof a.then==="function"))l=new j,l.resolve(a),a=l.promise;return a.then(d,b,i)};return j});
define("orion/PageUtil",[],function(){var b=/^http[s]?/i;return{hash:function(){var a=window.location.href.split("#")[1];return a?"#"+a:""},matchResourceParameters:function(a){var a=a||window.location.toString(),b={resource:""},j=a.indexOf("#");if(j!==-1&&(a=a.substring(j+1),a.length!==0)){a=a.split(",");b.resource=decodeURIComponent(a[0]);for(j=1;j<a.length;j++){var d=/([^=]*)(=?)(.*)/.exec(a[j]),k=decodeURIComponent(d[1]||""),d=decodeURIComponent(d[3]||"");k!==""&&k!=="resource"&&(b[k]=d)}}return b},
validateURLScheme:function(a,i){var j=a;if(a.indexOf("://")===-1){var d=document.createElement("a");d.href=a;j=d.href}d=!1;return(d=i?i.some(function(a){return RegExp("^"+a+":","i").test(j)}):b.test(j))?a:(console.log("Illegal URL Scheme: '"+a+"'"),"")}}});
define("orion/URITemplate",[],function(){function b(a){this._text=a}function a(a){return a.replace("%25","%")}function i(l,b){if(b==="U")return encodeURIComponent(l).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if(b==="U+R")return encodeURI(l).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(m,a);if(b==="U+R-,")return encodeURI(l).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+b);}function j(a,b,d){for(var h=
[],c=0;c<a.length;c++)typeof a[c]!=="undefined"&&h.push(i(a[c],b));return h.join(d)}function d(a,b,d,h){for(var c=Object.keys(a),e=[],j=0;j<c.length;j++)typeof a[c[j]]!=="undefined"&&e.push(i(c[j],b)+d+i(a[c[j]],b));return e.join(h)}function k(a){if(a.length===0)throw Error("Invalid Expression: 0 length expression");(this._operator=t[a[0]])?a=a.substring(1):this._operator=t.NUL;for(var b=[],d=a.split(","),h=0;h<d.length;h++){var c=d[h].match(s);if(c===null)throw Error("Bad VarSpec: "+a);b.push({name:c[1],
explode:!!c[2],prefix:c[3]?parseInt(c[3],10):-1})}this._varSpecList=b}function p(a){for(var d=[],i=0,h=a.indexOf("{",i);h!==-1;){d.push(new b(a.substring(i,h)));i=a.indexOf("}",h+1);if(i===-1)throw Error("Invalid template: "+a);d.push(new k(a.substring(h+1,i)));i+=1;h=a.indexOf("{",i)}d.push(new b(a.substring(i)));this._templateComponents=d}var t={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"&",named:!0,ifemp:"=",allow:"U"},"&":{first:"&",sep:"&",named:!0,ifemp:"=",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},s=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,m=/%25[0-9A-F][0-9A-F]/g;b.prototype={expand:function(){return encodeURI(this._text)}};
k.prototype={expand:function(a){for(var b=[],n=0;n<this._varSpecList.length;n++){var h=this._varSpecList[n],c=h.name,e=a[c],k=typeof e;if(k!=="undefined"&&e!==null){var m=b.length===0?this._operator.first:this._operator.sep;if(k==="string")this._operator.named&&(m+=i(c,"U+R"),m+=e.length===0?this._operator.ifemp:"="),h.prefix!==-1&&h.prefix<e.length&&(e=e.substring(0,h.prefix)),m+=i(e,this._operator.allow);else if(Array.isArray(e))h.explode?m+=j(e,this._operator.allow,this._operator.sep):(this._operator.named&&
(m+=i(c,"U+R"),m+=e.length===0?this._operator.ifemp:"="),m+=j(e,this._operator.allow,","));else if(k==="object")h.explode?m+=d(e,this._operator.allow,"=",this._operator.sep):(this._operator.named&&(m+=i(c,"U+R"),m+=Object.keys(e).length===0?this._operator.ifemp:"="),m+=d(e,this._operator.allow,",",","));else throw Error("bad param type: "+c+" : "+k);b.push(m)}}return b.join("")}};p.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 p});
define("orion/i18nUtil",["require","orion/Deferred"],function(b,a){function i(a){if(a=localStorage.getItem("orion/messageBundle/"+a))if(a=JSON.parse(a),a._expires&&a._expires>(new Date).getTime())return delete a._expires,a;return null}var j={};return{getMessageBundle:function(d){function k(){b(["i18n!"+d],function(a){if(a){var b=d;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+b,JSON.stringify(a));delete a._expires}p.resolve(a)})}if(j[d])return j[d];var p=new a;j[d]=
p;var t=i(d);if(t)return p.resolve(t),p;try{b([d],k)}catch(s){b(["orion/i18n!"+d],k)}return p},formatMessage:function(a){var b=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,d){return b[(d<<0)+1]})}}});
(function(){function b(g){if(typeof g!=="string")throw new TypeError;}function a(g){return g?g.split("&"):[]}function i(g){return g.length===0?"":g.join("&")}function j(g){var a=/([^=]*)(?:=?)(.*)/.exec(g),g=a[1]?decodeURIComponent(a[1]):"",a=a[2]?decodeURIComponent(a[2]):"";return[g,a]}function d(g){var a=encodeURIComponent(g[0]);g[1]&&(a+="="+encodeURIComponent(g[1]));return a}function k(g,b){var f="",c=[],e=0;return{next:function(){if(f!==g.query)f=g.query,c=a(f);if(e<c.length){var d=j(c[e++]);
switch(b){case "keys":return d[0];case "values":return d[1];case "keys+values":return[d[0],d[1]];default:throw new TypeError;}}throw y;}}}function p(g){Object.defineProperty(this,"_url",{get:function(){return g._url}})}function t(g){var a=[];g.split("/").forEach(function(g){g===".."?a.pop():g!=="."&&a.push(g)});return a.join("/")}function s(g){return g.replace(/\s/g,function(g){return"%"+g.charCodeAt(0).toString(16)})}function m(g,a){if(typeof g!=="string")throw new TypeError;var g=s(g),b=h.exec(g);
if(!b)return null;var f={};f.scheme=b[1]||"";if(f.scheme&&!e.test(f.scheme))return null;var d=b[2];if(d&&(d=c.exec(d),f.userinfo=d[1],f.host=d[2],f.port=d[3],f.port&&!x.test(f.port)))return null;f.path=b[3];f.query=b[4];f.fragment=b[5];if(!f.scheme&&a&&(f.scheme=a.scheme,!f.host&&a.host))f.userinfo=a.userinfo,f.host=a.host,f.port=a.port,f.pathRelative=!0;if(f.pathRelative)if(f.path){if(f.path[0]!=="/")b=/^(.*\/)[^\/]*$/.exec(a.path)[1]||"/",f.path=b+f.path}else f.path=a.path;if(f.scheme)f.scheme=
f.scheme.toLowerCase();if(f.port)f.port=/[1-9]\d*$/.exec(f.port)[0];if(f.host&&f.path)f.path=t(f.path);return f}function l(g,a){var f;if(a){a=a.href||a;f=m(a);if(!f||!f.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:f})}f=m(g,f);if(!f)throw new SyntaxError;Object.defineProperty(this,"_input",{value:g,writable:!0});Object.defineProperty(this,"_url",{value:f,writable:!0});var b=new p(this);Object.defineProperty(this,"query",{get:function(){return this._url?b:null},enumerable:!0})}
try{var o;if(typeof window.URL==="function"&&window.URL.length!==0&&(o=new window.URL("http://www.w3.org?q")).protocol==="http:"&&o.query)return}catch(n){}var h=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,c=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,e=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,x=/^\d*$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,w=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,u=/^([^?#\s]*)$/,q=/^([^\s]*)$/,r=/^\S*$/,f=/([^:]*):?(.*)/,y=typeof StopIteration!=="undefined"?
StopIteration:Error("Stop Iteration"),z={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(p.prototype,{get:{value:function(g){b(g);var f;a(this._url.query).some(function(a){a=j(a);if(a[0]===g)return f=a[1],!0});return f},enumerable:!0},set:{value:function(g,f){b(g);b(f);var c=a(this._url.query);c.some(function(a,b){var e=j(a);if(e[0]===g)return e[1]=f,c[b]=d(e),!0})||c.push(d([g,f]));this._url.query=i(c)},enumerable:!0},has:{value:function(g){b(g);
return a(this._url.query).some(function(a){if(j(a)[0]===g)return!0})},enumerable:!0},"delete":{value:function(g){b(g);var f=a(this._url.query),c=f.filter(function(a){return j(a)[0]!==g});return c.length!==f.length?(this._url.query=i(c),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(g,a){if(typeof g!=="function")throw new TypeError;var f=k(this._url,"keys+values");try{for(;;){var b=f.next();g.call(a,b[1],b[0],this)}}catch(c){if(c!==y)throw c;
}},enumerable:!0},keys:{value:function(){return k(this._url,"keys")},enumerable:!0},values:{value:function(){return k(this._url,"values")},enumerable:!0},items:{value:function(){return k(this._url,"keys+values")}},size:{get:function(){return a(this._url.query).length},enumerable:!0},getAll:{value:function(g){b(g);var f=[];a(this._url.query).forEach(function(a){a=j(a);a[0]===g&&f.push(a[1])});return f},enumerable:!0},append:{value:function(g,f){b(g);b(f);var c=a(this._url.query);c.push(d([g,f]));this._url.query=
i(c)},enumerable:!0}});Object.defineProperties(l.prototype,{href:{get:function(){var g;if(this._url){g=this._url;var a=g.scheme?g.scheme+":":"";g.host&&(a+="//",g.userinfo&&(a+=g.userinfo+"@"),a+=g.host,g.port&&(a+=":"+g.port));a+=g.path;g.query&&(a+="?"+g.query);g.fragment&&(a+="#"+g.fragment);g=a}else g=this._input;return g},set:function(a){b(a);this._input=a;this._url=m(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){b(a);if(this._url&&(a=a.slice(-1)===":"?a.substring(0,a.length-1):a,e.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){b(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=f.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){b(a);if(this._url){var c=
f.exec(this._userinfo),a=[encodeURIComponent(a||"")];c[2]&&a.push(c[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=f.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){b(a);if(this._url){var c=[f.exec(this._userinfo)[1]||""];a&&c.push(encodeURIComponent(a));this._userinfo=c.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){b(a);if(this._url&&(a=w.exec(a)))this._url.host=a[1],this._url.port=/[1-9]\d*$/.exec(a[2])[0]},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){b(a);if(this._url&&v.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===z[this.protocol]&&(a="");return a},set:function(a){b(a);if(this._url&&x.exec(a))this._url.port=/[1-9]\d*$/.exec(a)[0]},enumerable:!0},pathname:{get:function(){return this._url?
this._url.path:""},set:function(a){b(a);if(this._url&&u.exec(a))this._url.host&&a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?t(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){b(a);if(this._url&&(a&&a[0]==="?"&&(a=a.substring(1)),q.exec(a)))this._url.query=a},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){b(a);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),r.exec(a)))this._url.fragment=
a},enumerable:!0}});window.URL&&window.URL.createObjectURL&&(Object.defineProperty(l,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(l,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),enumerable:!1}));window.URL=l})();define("orion/URL-shim",function(){});
define("orion/PageLinks","require,orion/Deferred,orion/PageUtil,orion/URITemplate,orion/i18nUtil,orion/URL-shim".split(","),function(b,a,i,j,d){function k(){return(new URL(b.toUrl("orion/../"),window.location.href)).href.slice(0,-1)}function p(b,p){var m=b.getServiceReferences(p||"orion.page.link"),l=i.matchResourceParameters(window.location.href),o={OrionHome:k(),Location:l.resource},n=[];m.forEach(function(b){var c={};b.getPropertyKeys().forEach(function(a){c[a]=b.getProperty(a)});if(c.uriTemplate&&
c.nls&&(c.name||c.nameKey)){var e=new a;d.getMessageBundle(c.nls).then(function(a){var b=(new j(c.uriTemplate)).expand(o),b=i.validateURLScheme(b);c.href=b;c.textContent=c.nameKey?a[c.nameKey]:c.name;e.resolve(c)});n.push(e)}else if(c.uriTemplate&&c.name){var k=(new j(c.uriTemplate)).expand(o),k=i.validateURLScheme(k);c.href=k;c.textContent=c.name;n.push((new a).resolve(c))}});return a.all(n)}return{createPageLinks:function(a,b){return p(a,b).then(function(a){a.sort(function(a,b){var d=a.textContent&&
a.textContent.toLowerCase(),h=b.textContent&&b.textContent.toLowerCase();return d<h?-1:d>h?1:0});return a.map(function(a){var b=a.href,a=a.textContent,d=document.createElement("a");d.href=b;d.target="_self";d.classList.add("targetSelector");d.textContent=a;return d})})},getPageLinksInfo:p,getOrionHome:k}});
(function(b,a){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],a):typeof exports==="object"?module.exports=a(require("orion/Deferred")):(b.orion=b.orion||{},b.orion.PluginProvider=a(b.orion.Deferred))})(this,function(b){function a(a,b){this.__objectId=a;this.__methods=b}return function(i){function j(a){h&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),h===self?h.postMessage(a):h.postMessage(a,"*"))}function d(){var a=[];Object.keys(q).forEach(function(b){var c=
q[b];a.push({serviceId:b,names:c.names,methods:c.methods,properties:c.properties})});return{headers:o||{},services:a}}function k(a,b){if(b&&b instanceof XMLHttpRequest){var c,g;try{c=b.status,g=b.statusText}catch(d){c=0,g=""}return{status:c||0,statusText:g}}return b}function p(a){var b=a?JSON.parse(JSON.stringify(a,k)):a;if(a instanceof Error)b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name;return b}function t(f){if(!h)return(new b).reject(Error("plugin not connected"));f.id=String(c++);
var d=new b;w[f.id]=d;d.then(null,function(a){n&&a instanceof Error&&a.name==="Cancel"&&r({requestId:f.id,method:"cancel",params:a.message?[a.message]:[]})});var i=Object.prototype.toString;f.params.forEach(function(b,c){if(i.call(b)==="[object Object]"&&!(b instanceof a)){var h,j;for(h in b)i.call(b[h])==="[object Function]"&&(j=j||[],j.push(h));if(j){var k=e++;u[k]=b;h=function(){delete u[k]};d.then(h,h);f.params[c]=new a(k,j)}}});r(f);return d.promise}function s(a,b){a||a===0?r({id:a,result:null,
error:b}):console.log(b)}function m(a,b,c,d){d.forEach(function(a,b){if(a&&typeof a.__objectId!=="undefined"){var f={};a.__methods.forEach(function(b){f[b]=function(){return t({objectId:a.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});d[b]=f}});var e=typeof a===void 0?null:{id:a,result:null,error:null};try{var h=c.apply(b,d);if(e)h&&typeof h.then==="function"?(v[a]=h,h.then(function(b){delete v[a];e.result=b;r(e)},function(b){if(v[a])delete v[a],e.error=p(b),r(e)},function(){r({responseId:a,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(e.result=h,r(e))}catch(i){if(e)e.error=p(i),r(e)}}function l(a){if(a.source===h){a=typeof a.data!=="string"?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,c=a.params||[];if("serviceId"in a){var d=q[a.serviceId];d||s(a.id,"service not found");d=d.implementation;b in d?m(a.id,d,d[b],c):s(a.id,"method not found")}else if("objectId"in a){var e=u[a.objectId];e||s(a.id,"object not found");!b in e?m(a.id,e,e[b],c):s(a.id,"method not found")}else if("requestId"in
a){var i=v[a.requestId];i&&b==="cancel"&&i.cancel&&i.cancel.apply(i,c)}else if("responseId"in a){var j=w[a.responseId];j&&b==="progress"&&j.progress&&j.progress.apply(j,c)}else throw Error("Bad method: "+a.method);}else{var k=w[String(a.id)];delete w[String(a.id)];a.error?k.reject(a.error):k.resolve(a.result)}}catch(l){console.log("Plugin._messageHandler "+l)}}}var o=i,n=!1,h=null,c=0,e=0,x=0,v={},w={},u={},q={},r=j;this.updateHeaders=function(a){if(n)throw Error("Cannot update headers. Plugin Provider is connected");
o=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(n)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=null,e=[];for(d in b)typeof b[d]==="function"&&e.push(d);q[x++]={names:a,methods:e,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,b){if(!n){if(typeof window==="undefined")h=self;else if(window!==window.parent)h=window.parent;else if(window.opener!==null)h=window.opener;else{b&&
b("No valid plugin target");return}addEventListener("message",l,!1);var c={method:"plugin",params:[d()]};j(c);n=!0}a&&a()};this.disconnect=function(){n&&(removeEventListener("message",l),h=null,n=!1)}}});
define('built-pageLinksPlugin.js',["require","orion/PageLinks","orion/plugin","orion/URITemplate"],function(b,a,i,j){var d={},i=new i({name:"Orion Page Links",version:"1.0",description:"This plugin provides the top-level page links for Orion."});i.registerService("orion.page.link",null,{nameKey:"Editor",nls:"orion/nls/messages",tooltip:"Edit code",uriTemplate:"{+OrionHome}/edit/edit.html"});i.registerService("orion.page.link",d,{nameKey:"Sites",id:"orion.sites",nls:"orion/nls/messages",uriTemplate:"{+OrionHome}/sites/sites.html"});
i.registerService("orion.page.link",d,{nameKey:"Shell",id:"orion.shell",nls:"orion/nls/messages",uriTemplate:"{+OrionHome}/shell/shellPage.html"});i.registerService("orion.page.link",d,{nameKey:"Search",id:"orion.Search",nls:"orion/nls/messages",uriTemplate:"{+OrionHome}/search/search.html"});i.registerService("orion.page.link.related",null,{id:"orion.editFromMetadata",nameKey:"Editor",nls:"orion/nls/messages",tooltip:"Open Editor page",validationProperties:[{source:"ChildrenLocation|ContentLocation",
variableName:"EditorLocation",replacements:[{pattern:"\\?depth=1$",replacement:""}]}],uriTemplate:"{+OrionHome}/edit/edit.html#{,EditorLocation},navigate={,EditorLocation}?depth=1"});i.registerService("orion.page.link.user",null,{id:"orion.help",nameKey:"Help",nls:"orion/widgets/nls/messages",uriTemplate:b.toUrl("help/index.jsp"),category:0});i.registerService("orion.page.link.user",null,{id:"orion.settings",nameKey:"Settings",nls:"orion/widgets/nls/messages",uriTemplate:"{+OrionHome}/settings/settings.html",
category:1});b=document.createElement("a");b.href="./contentTemplates/helloWorld.zip";d=document.createElement("a");d.href="./contentTemplates/pluginHelloWorld.zip";i.registerService("orion.core.content",null,{id:"orion.content.html5",nameKey:"Sample HTML5 Site",nls:"orion/nls/messages",descriptionKey:"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.",contentURITemplate:b.href});i.registerService("orion.core.content",null,{id:"orion.content.plugin",nameKey:"Sample Orion Plugin",
nls:"orion/nls/messages",descriptionKey:"Generate a sample plugin for integrating with Orion.",contentURITemplate:d.href});i.registerService("orion.core.setting",null,{settings:[{pid:"nav.config",nls:"orion/settings/nls/messages",nameKey:"Navigation",category:"general",categoryKey:"General",properties:[{id:"links.newtab",nameKey:"Links",type:"boolean",defaultValue:!1,options:[{value:!0,labelKey:"Open in new tab"},{value:!1,labelKey:"Open in same tab"}]}]}]});i.registerService("orion.core.getplugins",
null,{uri:decodeURIComponent((new j("http://orion-plugins.googlecode.com/git/index.html#?target={InstallTarget}&version={Version}&OrionHome={OrionHome}")).expand({Version:"4.0",InstallTarget:a.getOrionHome()+"/settings/settings.html",OrionHome:a.getOrionHome()}))});i.registerService("orion.page.getstarted",null,{data:[{label:"Add",image:"../images/add.png",secondaryImage:"../images/add-large-dulled.png",alt:"Add Content",media:"../media/Create.gif"},{label:"Modify",image:"../images/modify.png",secondaryImage:"../images/gear-large-dulled.png",
alt:"Modify Content",media:"../media/Modify.gif"},{label:"Manage",image:"../images/manage.png",secondaryImage:"../images/hamburger-large-dulled.png",alt:"Manage Content",media:"../media/Manage.gif"}]});i.connect()});