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

/*

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

 Contributors: IBM Corporation - initial API and implementation

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

 Contributors:
 IBM Corporation - initial API and implementation

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

 Copyright (c) 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
*/
(function(e,f){typeof define==="function"&&define.amd?define("orion/Deferred",f):typeof exports==="object"?module.exports=f():(e.orion=e.orion||{},e.orion.Deferred=f())})(this,function(){function e(){for(var d;d=k.shift()||i.shift();)d();g=!1}function f(d,b){(b?i:k).push(d);g||(g=!0,b?setTimeout(e,0):e())}function m(d){return function(){d.apply(null,arguments)}}function l(){}function c(){var d=Error("Cancel");d.name="Cancel";return d}function d(){function e(){for(var h;h=j.shift();){var d=h.deferred,
c=a==="resolved"?"resolve":"reject";if(typeof h[c]==="function")try{var f=h[c](b);f&&typeof f.then==="function"?(d.cancel=f.cancel||l,f.then(m(d.resolve),m(d.reject),d.progress)):d.resolve(f)}catch(g){d.reject(g)}else d[c](b)}}var b,a,j=[],h=this;this.reject=function(d){a||(a="rejected",b=d,j.length&&f(e));return h.promise};this.resolve=function(d){a||(a="resolved",b=d,j.length&&f(e));return h.promise};this.progress=function(b){a||j.forEach(function(a){a.progress&&a.progress(b)});return h.promise};
this.cancel=function(){a||h.reject(c())};this.then=function(b,c,g){var b={resolve:b,reject:c,progress:g,deferred:new d},i=b.deferred,k=!1,l=function(){k||(k=!0,f(function(){var a=i.cancel===l?h.cancel:i.cancel;typeof a==="function"&&a()},!0))};i.cancel=l;j.push(b);a&&f(e,!0);return i.promise};this.promise=Object.create(Object.prototype,{then:{value:h.then},cancel:{get:function(){return h.cancel},set:function(a){h.cancel=a}}})}var k=[],i=[],g=!1;d.all=function(c,b){function a(a,b){e||(f[a]=b,--h===
0&&g.resolve(f))}function j(j,h){if(!e){if(b)try{a(j,b(h));return}catch(d){h=d}g.reject(h)}}var h=c.length,f=[],e=!1,g=new d;g.then(null,function(){e=!0;c.forEach(function(a){a.cancel&&a.cancel()})});h===0?g.resolve(f):c.forEach(function(b,h){b.then(a.bind(null,h),j.bind(null,h))});return g.promise};d.when=function(c,b,a,j){var h;if(!(c&&typeof c.then==="function"))h=new d,h.resolve(c),c=h.promise;return c.then(b,a,j)};return d});
(function(){var e=this;if(!e.define)e.define=function(f){e.orion=e.orion||{};e.orion.PluginProvider=f();e.eclipse=e.orion;delete e.define}})();
define("orion/plugin",[],function(){return function(e){function f(a){b&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),b===self?b.postMessage(a):b.postMessage(a,"*"))}function m(a,b){if(b&&b instanceof XMLHttpRequest){var h,d;try{h=b.status,d=b.statusText}catch(c){h=0,d=""}return{status:h||0,statusText:d}}return b}function l(a){var b=a?JSON.parse(JSON.stringify(a,m)):a;if(a instanceof Error)b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name;return b}function c(a){return function(b){g&&
f({serviceId:a,method:"dispatchEvent",params:[b]})}}function d(a){if(a.source===b){var j=typeof a.data!=="string"?a.data:JSON.parse(a.data);if(typeof j.cancel==="string"){var h=n[j.id];h&&(delete n[j.id],h.cancel&&h.cancel(j.cancel))}else{var a=j.serviceId,d=j.method,e=j.params,g=i[a],k=g.implementation,m=k[d];d==="addEventListener"?(d=e[0],g.listeners[d]=g.listeners[d]||c(a),e=[d,g.listeners[d]]):d==="removeEventListener"&&(d=e[0],e=[d,g.listeners[d]],delete g.listeners[d]);var o={id:j.id,result:null,
error:null};try{(h=m.apply(k,e))&&typeof h.then==="function"?(n[j.id]=h,h.then(function(a){delete n[j.id];o.result=a;f(o)},function(a){if(n[j.id])delete n[j.id],o.error=l(a),f(o)},function(){f({requestId:j.id,method:"progress",params:Array.prototype.slice.call(arguments)})})):(o.result=h,f(o))}catch(q){o.error=l(q),f(o)}}}}var k=e,i=[],g=!1,n={},b=null;this.updateHeaders=function(a){if(g)throw Error("Cannot update headers. Plugin Provider is connected");k=a};this.registerServiceProvider=this.registerService=
function(a,b,d){if(g)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var c=null,e=[];for(c in b)typeof b[c]==="function"&&e.push(c);i[i.length]={names:a,methods:e,implementation:b,properties:d||{},listeners:{}}};this.connect=function(a,j){if(!g){if(typeof window==="undefined")b=self;else if(window!==window.parent)b=window.parent;else if(window.opener!==null)b=window.opener;else{j&&j("No valid plugin target");return}addEventListener("message",
d,!1);for(var h=[],c=0;c<i.length;c++)h.push({serviceId:c,names:i[c].names,methods:i[c].methods,properties:i[c].properties});f({method:"plugin",params:[{headers:k||{},services:h}]});g=!0}a&&a()};this.disconnect=function(){g&&(removeEventListener("message",d),b=null,g=!1)}}});
define("orion/xhr",["orion/Deferred"],function(e){function f(e,f,c,d){var k=typeof c.response!=="undefined"?c.response:c.responseText,i;try{i=c.status}catch(g){i=0}e={args:f,response:k,responseText:typeof k==="string"?k:null,status:i,url:e,xhr:c};if(typeof d!=="undefined")e.error=d;return e}return function(m,l,c){var c=c||{},d=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,k=new e,i=c.headers||{},g=c.log||!1,n;typeof i["X-Requested-With"]==="undefined"&&(i["X-Requested-With"]="XMLHttpRequest");
if(typeof c.data!=="undefined"&&(m==="POST"||m==="PUT"))n=c.data;d.onprogress=function(a){a.xhr=d;k.progress(a)};d.onreadystatechange=function(){if(d.readyState===4){var a=f(l,c,d),b=d.status;200<=b&&b<400?k.resolve(a):(g&&typeof console!=="undefined"&&console.log(Error(d.statusText)),k.reject(a))}};try{d.open(m,l,!0);if(typeof c.responseType==="string")d.responseType=c.responseType;if(typeof c.timeout==="number")if(typeof d.timeout==="number")d.timeout=c.timeout,d.addEventListener("timeout",function(){k.reject(f(l,
c,d,"Timeout exceeded"))});else{var b=setTimeout(function(){k.reject(f(l,c,d,"Timeout exceeded"))},c.timeout);k.then(clearTimeout.bind(null,b),clearTimeout.bind(null,b))}Object.keys(i).forEach(function(a){d.setRequestHeader(a,i[a])});d.send(n)}catch(a){k.reject(f(l,c,d,a))}return k.promise}});
(function(){function e(a){if(typeof a!=="string")throw new TypeError;}function f(a){return a?a.split("&"):[]}function m(a){return a.length===0?"":a.join("&")}function l(a){var b=/([^=]*)(?:=?)(.*)/.exec(a),a=b[1]?decodeURIComponent(b[1]):"",b=b[2]?decodeURIComponent(b[2]):"";return[a,b]}function c(a){var b=encodeURIComponent(a[0]);a[1]&&(b+="="+encodeURIComponent(a[1]));return b}function d(a,b){var d="",j=[],h=0;return{next:function(){if(d!==a.query)d=a.query,j=f(d);if(h<j.length){var c=l(j[h++]);
switch(b){case "keys":return c[0];case "values":return c[1];case "keys+values":return[c[0],c[1]];default:throw new TypeError;}}throw t;}}}function k(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function i(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 n(a,b){if(typeof a!=="string")throw new TypeError;var a=g(a),d=j.exec(a);
if(!d)return null;var c={};c.scheme=d[1]||"";if(c.scheme&&!r.test(c.scheme))return null;var e=d[2];if(e&&(e=h.exec(e),c.userinfo=e[1],c.host=e[2],c.port=e[3],c.port&&!s.test(c.port)))return null;c.path=d[3];c.query=d[4];c.fragment=d[5];if(!c.scheme&&b&&(c.scheme=b.scheme,!c.host&&b.host))c.userinfo=b.userinfo,c.host=b.host,c.port=b.port,c.pathRelative=!0;if(c.pathRelative)if(c.path){if(c.path[0]!=="/")d=/^(.*\/)[^\/]*$/.exec(b.path)[1]||"/",c.path=d+c.path}else c.path=b.path;if(c.scheme)c.scheme=
c.scheme.toLowerCase();if(c.port)c.port=/[1-9]\d*$/.exec(c.port)[0];if(c.host&&c.path)c.path=i(c.path);return c}function b(a,b){var c;if(b){b=b.href||b;c=n(b);if(!c||!c.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:c})}c=n(a,c);if(!c)throw new SyntaxError;Object.defineProperty(this,"_input",{value:a,writable:!0});Object.defineProperty(this,"_url",{value:c,writable:!0});var d=new k(this);Object.defineProperty(this,"query",{get:function(){return this._url?d:null},enumerable:!0})}
try{if(typeof window.URL==="function"&&window.URL.length!==0&&(new window.URL("http://www.w3.org")).protocol==="http:")return}catch(a){}var j=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,h=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,r=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,s=/^\d*$/,u=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,v=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,w=/^([^?#\s]*)$/,o=/^([^\s]*)$/,q=/^\S*$/,p=/([^:]*):?(.*)/,t=typeof StopIteration!=="undefined"?StopIteration:
Error("Stop Iteration"),x={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(k.prototype,{get:{value:function(a){e(a);var b;f(this._url.query).some(function(c){c=l(c);if(c[0]===a)return b=c[1],!0});return b},enumerable:!0},set:{value:function(a,b){e(a);e(b);var d=f(this._url.query);d.some(function(j,h){var e=l(j);if(e[0]===a)return e[1]=b,d[h]=c(e),!0})||d.push(c([a,b]));this._url.query=m(d)},enumerable:!0},has:{value:function(a){e(a);return f(this._url.query).some(function(b){if(l(b)[0]===
a)return!0})},enumerable:!0},"delete":{value:function(a){e(a);var b=f(this._url.query),c=b.filter(function(b){return l(b)[0]!==a});return c.length!==b.length?(this._url.query=m(c),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,b){if(typeof a!=="function")throw new TypeError;var c=d(this._url,"keys+values");try{for(;;){var j=c.next();a.call(b,j[1],j[0],this)}}catch(h){if(h!==t)throw h;}},enumerable:!0},keys:{value:function(){return d(this._url,
"keys")},enumerable:!0},values:{value:function(){return d(this._url,"values")},enumerable:!0},items:{value:function(){return d(this._url,"keys+values")}},size:{get:function(){return f(this._url.query).length},enumerable:!0},getAll:{value:function(a){e(a);var b=[];f(this._url.query).forEach(function(c){c=l(c);c[0]===a&&b.push(c[1])});return b},enumerable:!0},append:{value:function(a,b){e(a);e(b);var d=f(this._url.query);d.push(c([a,b]));this._url.query=m(d)},enumerable:!0}});Object.defineProperties(b.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=n(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,r.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){e(a);if(this._url)this._url.userinfo=a}},username:{get:function(){if(!this._url)return"";var a=p.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){e(a);if(this._url){var b=p.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=p.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){e(a);if(this._url){var b=[p.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},set:function(a){e(a);if(this._url&&(a=v.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){e(a);if(this._url&&u.exec(a))this._url.host=a},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===x[this.protocol]&&(a="");return a},set:function(a){e(a);if(this._url&&s.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){e(a);if(this._url&&w.exec(a))this._url.host&&
a&&a[0]!=="/"&&(a="/"+a),this._url.path=a?i(a):""},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){e(a);if(this._url&&(a&&a[0]==="?"&&(a=a.substring(1)),o.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);if(this._url&&(a&&a[0]==="#"&&(a=a.substring(1)),q.exec(a)))this._url.fragment=a},enumerable:!0}});window.URL&&window.URL.createObjectURL&&
(Object.defineProperty(b,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(b,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),enumerable:!1}));window.URL=b})();define("orion/URL-shim",function(){});
define("orion/operation",["orion/xhr","orion/Deferred"],function(e,f){function m(c,d,f,i){e("GET",c,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(g){g=g.response?JSON.parse(g.response):null;d.progress(g);!g.type||g.type==="loadstart"||g.type==="progress"?setTimeout(function(){m(c,d,f,i)},2E3):(g.type==="error"||g.type==="abort"?d.reject(i?i(g):g.Result):d.resolve(f?f(g):g.Result.JsonData),g.Location||e("DELETE",c,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(c){var e=c;if(c.responseText!==
void 0){e=c.responseText;try{e=JSON.parse(c.responseText)}catch(b){}}e.Message!==void 0?(e.HttpCode=e.HttpCode===void 0?c.status:e.HttpCode,e.Severity=e.Severity===void 0?"Error":e.Severity,d.reject(e)):d.reject({Severity:"Error",Message:e,HttpCode:c.status})})}function l(c,d){d.then(null,function(d){d instanceof Error&&d.name==="Cancel"&&e("PUT",c,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(c,d,e){var i=new f;l(c,i);m(c,i,d,e);return i}}});
define("plugins/filePlugin/fileImpl",["orion/Deferred","orion/xhr","orion/URL-shim","orion/operation"],function(e,f,m,l){function c(b){b&&typeof b==="object"&&Object.keys(b).forEach(function(a){var d=b[a];a.indexOf("Location")!==-1?(n.href=d,b[a]=n.href):c(d)});return b}function d(){return f.apply(null,Array.prototype.slice.call(arguments)).then(function(b){if(b.xhr&&b.xhr.status===202){var b=b.response?JSON.parse(b.response):null,a=new e;l.handle(b.Location,function(a){return a.Result}).then(a.resolve,
a.reject,a.progress);return a}return b.then(function(a){return a.response?JSON.parse(a.response):null})})}function k(b){var a;a=b.keyword;for(var c="",d=0;d<a.length;d++){var e=a.charAt(d);'+-&|!(){}[]^"~:\\'.indexOf(e)>=0&&(c+="\\");c+=e}a=c;c=b.sort;b.nameSearch?(d=/\*$/.test(b.keyword)?"":"*",a="NameLower:"+a+d):b.fileType&&b.fileType!=="*.*"?a!==""?(a.indexOf(" ")>=0&&(a='"'+a+'"'),a=encodeURIComponent(a)+"+NameLower:*."+b.fileType):(a="NameLower:*."+b.fileType,c=c.replace("Path","NameLower")):
a=a.indexOf(" ")>=0?encodeURIComponent('"'+a+'"'):encodeURIComponent(a);return"?sort="+c+"&rows="+b.rows+"&start="+b.start+"&q="+a+"+Location:"+b.resource+"*"}function i(b,a){this.fileBase=b;this.makeAbsolute=(this.workspaceBase=a)&&a.indexOf("://")!==-1}function g(b,a,c,d){var f=new e,g=new XMLHttpRequest;try{g.open(b,a),c&&Object.keys(c).forEach(function(a){g.setRequestHeader(a,c[a])}),g.responseType="arraybuffer",g.send(d),g.onload=function(){f.resolve({status:g.status,statusText:g.statusText,
headers:g.getAllResponseHeaders(),response:g.response})}}catch(i){f.reject(i)}return f}var n=document.createElement("a");i.prototype={fetchChildren:function(b){if(b===this.fileBase)return this.loadWorkspace(b).then(function(a){return a.Children||[]});b.indexOf("?depth=")===-1&&(b+="?depth=1");return f("GET",b,{headers:{"Orion-Version":"1","Content-Type":"charset=UTF-8"},timeout:15E3}).then(function(a){return(a.response?JSON.parse(a.response):{}).Children||[]}).then(function(a){this.makeAbsolute&&
c(a);return a}.bind(this))},_createWorkspace:function(b){return f("POST",this.workspaceBase,{headers:{"Orion-Version":"1",Slug:b},timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):{}})},loadWorkspaces:function(){return f("GET",this.workspaceBase,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){return(b.response?JSON.parse(b.response):{}).Workspaces}).then(function(b){this.makeAbsolute&&c(b);return b}.bind(this))},loadWorkspace:function(b){b===this.fileBase&&(b=
null);return f("GET",b?b:this.workspaceBase,{headers:{"Orion-Version":"1"},timeout:15E3,log:!1}).then(function(a){a=a.response?JSON.parse(a.response):{};return b?a:a.Workspaces.length>0?this.loadWorkspace(a.Workspaces[0].Location):this._createWorkspace("Orion Content")}.bind(this)).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},createProject:function(b,a,d,e){if(b){a={Name:a};if(d)a.ContentLocation=d;if(e)a.CreateIfDoesntExist=e;return f("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json;charset=UTF-8"},
timeout:15E3,data:JSON.stringify(a)}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))}else console.error("url is undefined, make sure you're signed in before creating a project")},createFolder:function(b,a){return f("POST",b,{headers:{"Orion-Version":"1","X-Create-Options":"no-overwrite",Slug:a,"Content-Type":"application/json;charset=UTF-8"},data:JSON.stringify({Name:a,LocalTimeStamp:"0",Directory:"true"}),timeout:15E3}).then(function(a){return a.response?
JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},createFile:function(b,a){return f("POST",b,{headers:{"Orion-Version":"1","X-Create-Options":"no-overwrite",Slug:a,"Content-Type":"application/json;charset=UTF-8"},data:JSON.stringify({Name:a,LocalTimeStamp:"0",Directory:"false"}),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},deleteFile:function(b){return f("DELETE",
b,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},moveFile:function(b,a,d){return this._doCopyMove(b,a,!0,d).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},copyFile:function(b,a,d){return this._doCopyMove(b,a,!1,d).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},_doCopyMove:function(b,a,c,d){d||(d=b.split("/"),d=d.pop()||d.pop());return f("POST",
a,{headers:{"Orion-Version":"1",Slug:d,"X-Create-Options":"no-overwrite,"+(c?"move":"copy"),"Content-Type":"application/json;charset=UTF-8"},data:JSON.stringify({Location:b,Name:d}),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null})},read:function(b,a){var d=new URL(b,window.location);a&&d.query.set("parts","meta");return f("GET",d.href,{timeout:15E3,headers:{"Orion-Version":"1"},log:!1}).then(function(b){return a?b.response?JSON.parse(b.response):null:b.response}).then(function(a){this.makeAbsolute&&
c(a);return a}.bind(this))},write:function(b,a,d){var e={"Orion-Version":"1","Content-Type":"text/plain;charset=UTF-8"};if(d&&d.ETag)e["If-Match"]=d.ETag;d={timeout:15E3,headers:e,data:a,log:!1};if(typeof a!=="string")a.sourceLocation?(d.query={source:a.sourceLocation},d.data=null):d.query={parts:"meta"};return f("PUT",b,d).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},remoteImport:function(b,a){var e={"Orion-Version":"1"};
if(a.OptionHeader)e["X-Xfer-Options"]=a.OptionHeader,delete a.OptionHeader;return d("POST",b,{headers:e,data:JSON.stringify(a),timeout:15E3}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},remoteExport:function(b,a){var e={"Orion-Version":"1"};if(a.OptionHeader)e["X-Xfer-Options"]=a.OptionHeader,delete a.OptionHeader;return d("POST",b,{headers:e,data:JSON.stringify(a),timeout:15E3}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))},search:function(b){b=k(b);return f("GET",
this.fileBase+"/../filesearch"+b,{headers:{Accept:"application/json","Orion-Version":"1"},timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):{}}).then(function(a){this.makeAbsolute&&c(a);return a}.bind(this))}};if(window.Blob)i.prototype.readBlob=function(b){return g("GET",b).then(function(a){return a.response})},i.prototype.writeBlob=function(b,a,c){var d={};if(c&&c.ETag)d["If-Match"]=c.ETag;return g("PUT",b,d,a)};return i});
define("domReady",[],function(){function e(){if(!k){k=!0;c&&clearInterval(c);var b=g;if(k&&b.length){g=[];var a;for(a=0;a<b.length;a+=1)b[a](i)}}}function f(b){k?b(i):g.push(b);return f}var m,l,c,d=typeof window!=="undefined"&&window.document,k=!d,i=d?document:null,g=[];if(d){if(document.addEventListener)document.addEventListener("DOMContentLoaded",e,!1),window.addEventListener("load",e,!1);else if(window.attachEvent){window.attachEvent("onload",e);l=document.createElement("div");try{m=window.frameElement===
null}catch(n){}l.doScroll&&m&&window.external&&(c=setInterval(function(){try{l.doScroll(),e()}catch(b){}},30))}document.readyState==="complete"&&e()}f.version="2.0.1";f.load=function(b,a,c,d){d.isBuild?c(null):f(c)};return f});
define('built-fileClientPlugin.js',["orion/Deferred","orion/plugin","plugins/filePlugin/fileImpl","domReady!"],function(e,f,m){function l(d){if(c)try{if(window.location.host===parent.location.host&&window.location.protocol===parent.location.protocol)return d.substring(parent.location.href.indexOf(parent.location.host)+parent.location.host.length);else c=!1}catch(e){c=!1}return d}var c=!0,d=document.createElement("a");d.href="../mixloginstatic/LoginWindow.html";f=new f({name:"Orion File Service",version:"1.0",
description:"This plugin provides file access to a user's workspace.",login:d.href});d.href="../file";e=l(d.href);d.href="../workspace";var k=l(d.href);d.href="..";d=l(d.href);m=new m(e,k);f.registerService("orion.core.file",m,{Name:"Orion Content",NameKey:"Orion Content",nls:"orion/navigate/nls/messages",top:e,pattern:d});f.connect()});