/*******************************************************************************
 * @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). 
 *
 * 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 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) 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) 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 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) 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
*/
(function(k,d){typeof define==="function"&&define.amd?define("orion/Deferred",[],d):typeof exports==="object"?module.exports=d():(k.orion=k.orion||{},k.orion.Deferred=d())})(this,function(){function k(){for(var h;h=i.shift()||b.shift();)h();a=!1}function d(h,g){(g?b:i).push(h);a||(a=!0,g?setTimeout(k,0):k())}function f(a){return function(){a.apply(null,arguments)}}function m(){}function j(){var a=Error("Cancel");a.name="Cancel";return a}function c(){function a(){for(var h;h=e.shift();){var l=h.deferred,
c=n==="resolved"?"resolve":"reject";if(typeof h[c]==="function")try{var d=h[c](b);d&&typeof d.then==="function"?(l.cancel=d.cancel||m,d.then(f(l.resolve),f(l.reject),l.progress)):l.resolve(d)}catch(j){l.reject(j)}else l[c](b)}}var b,n,e=[],l=this;this.reject=function(p){n||(n="rejected",b=p,e.length&&d(a));return l.promise};this.resolve=function(p){n||(n="resolved",b=p,e.length&&d(a));return l.promise};this.progress=function(a){n||e.forEach(function(e){e.progress&&e.progress(a)});return l.promise};
this.cancel=function(){n||l.reject(j())};this.then=function(b,l,g){var b={resolve:b,reject:l,progress:g,deferred:new c},f=b.deferred,j=this.cancel.bind(this),i=function(){d(function(){(f.cancel===i?j:f.cancel)()},!0)};f.cancel=i;l=f.promise;l.cancel=function(){f.cancel()};e.push(b);n&&d(a,!0);return l};this.promise={then:this.then,cancel:this.cancel}}var i=[],b=[],a=!1;c.all=function(a,b){function n(e,a){d||(p[e]=a,--l===0&&f.resolve(p))}function e(e,a){if(!d){if(b)try{n(e,b(a));return}catch(l){a=
l}f.reject(a)}}var l=a.length,p=[],d=!1,f=new c;f.then(null,function(){d=!0;a.forEach(function(e){e.cancel&&e.cancel()})});l===0?f.resolve(p):a.forEach(function(a,b){a.then(n.bind(null,b),e.bind(null,b))});return f.promise};c.when=function(a,b,n,e){var l;if(!(a&&typeof a.then==="function"))l=new c,l.resolve(a),a=l.promise;return a.then(b,n,e)};return c});(function(){var k=this;if(!k.define)k.define=function(d){k.orion=k.orion||{};k.orion.PluginProvider=d();k.eclipse=k.orion;delete k.define}})();
define("orion/plugin",[],function(){return function(k){function d(a){g&&(typeof ArrayBuffer==="undefined"&&(a=JSON.stringify(a)),g===self?g.postMessage(a):g.postMessage(a,"*"))}function f(a,e){return e&&e instanceof XMLHttpRequest?{status:e.status,statusText:e.statusText}:e}function m(a){var e=a?JSON.parse(JSON.stringify(a,f)):a;if(a instanceof Error)e.__isError=!0,e.message=e.message||a.message,e.name=e.name||a.name;return e}function j(b){return function(e){a&&d({serviceId:b,method:"dispatchEvent",
params:[e]})}}function c(a){if(a.source===g){var e=typeof a.data!=="string"?a.data:JSON.parse(a.data);if(typeof e.cancel==="string"){var l=h[e.id];l&&(delete h[e.id],l.cancel&&l.cancel(e.cancel))}else{var a=e.serviceId,c=e.method,f=e.params,i=b[a],k=i.implementation,q=k[c];c==="addEventListener"?(c=f[0],i.listeners[c]=i.listeners[c]||j(a),f=[c,i.listeners[c]]):c==="removeEventListener"&&(c=f[0],f=[c,i.listeners[c]],delete i.listeners[c]);var o={id:e.id,result:null,error:null};try{(l=q.apply(k,f))&&
typeof l.then==="function"?(h[e.id]=l,l.then(function(a){delete h[e.id];o.result=a;d(o)},function(a){if(h[e.id])delete h[e.id],o.error=m(a),d(o)},function(){d({requestId:e.id,method:"progress",params:Array.prototype.slice.call(arguments)})})):(o.result=l,d(o))}catch(r){o.error=m(r),d(o)}}}}var i=k,b=[],a=!1,h={},g=null;this.updateHeaders=function(b){if(a)throw Error("Cannot update headers. Plugin Provider is connected");i=b};this.registerServiceProvider=this.registerService=function(c,e,l){if(a)throw Error("Cannot register service. Plugin Provider is connected");
typeof c==="string"?c=[c]:Array.isArray(c)||(c=[]);var h=null,g=[];for(h in e)typeof e[h]==="function"&&g.push(h);b[b.length]={names:c,methods:g,implementation:e,properties:l||{},listeners:{}}};this.connect=function(h,e){if(!a){if(typeof window==="undefined")g=self;else if(window!==window.parent)g=window.parent;else if(window.opener!==null)g=window.opener;else{e&&e("No valid plugin target");return}addEventListener("message",c,!1);for(var l=[],f=0;f<b.length;f++)l.push({serviceId:f,names:b[f].names,
methods:b[f].methods,properties:b[f].properties});d({method:"plugin",params:[{headers:i||{},services:l}]});a=!0}h&&h()};this.disconnect=function(){a&&(removeEventListener("message",c),g=null,a=!1)}}});
define("orion/xhr",["orion/Deferred"],function(k){function d(f,d,j,c){var i=typeof j.response!=="undefined"?j.response:j.responseText,b;try{b=j.status}catch(a){b=0}f={args:d,response:i,responseText:typeof i==="string"?i:null,status:b,url:f,xhr:j};if(typeof c!=="undefined")f.error=c;return f}return function(f,m,j){var j=j||{},c=arguments.length>3&&arguments[3]?arguments[3]:new XMLHttpRequest,i=new k,b=j.headers||{},a=j.log||!1,h;typeof b["X-Requested-With"]==="undefined"&&(b["X-Requested-With"]="XMLHttpRequest");
if(typeof j.data!=="undefined"&&(f==="POST"||f==="PUT"))h=j.data;if(typeof j.responseType==="string")c.responseType=j.responseType;c.onprogress=function(e){e.xhr=c;i.progress(e)};c.onreadystatechange=function(){if(c.readyState===4){var e=d(m,j,c),b=c.status;200<=b&&b<400?i.resolve(e):(a&&typeof console!=="undefined"&&console.log(Error(c.statusText)),i.reject(e))}};try{c.open(f,m,!0);if(typeof j.timeout==="number")if(typeof c.timeout==="number")c.timeout=j.timeout,c.addEventListener("timeout",function(){i.reject(d(m,
j,c,"Timeout exceeded"))});else{var g=setTimeout(function(){i.reject(d(m,j,c,"Timeout exceeded"))},j.timeout);i.then(clearTimeout.bind(null,g),clearTimeout.bind(null,g))}Object.keys(b).forEach(function(e){c.setRequestHeader(e,b[e])});c.send(h)}catch(n){i.reject(d(m,j,c,n))}return i.promise}});
(function(){function k(e){return e?e.slice(1).split("&"):[]}function d(e){return e.length===0?"":"?"+e.join("&")}function f(e){var a=/([^=]*)(?:=?)(.*)/.exec(e),e=a[1]?decodeURIComponent(a[1]):"",a=a[2]?decodeURIComponent(a[2]):"";return[e,a]}function m(e){var a=encodeURIComponent(e[0]);e[1]&&(a+="="+encodeURIComponent(e[1]));return a}function j(a,b){var c="",h=[],g=0;return{next:function(){if(c!==a.search)c=a.search,h=k(c);if(g<h.length){var d=f(h[g++]);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 n;}}}function c(a){if(typeof a!=="string")throw new TypeError;}function i(a){var b=a.protocol;return!b||b===":"||b==="http:"&&!a.hostname?!1:!0}function b(a){Object.defineProperty(this,"_anchor",{value:a})}function a(a,c){a=a||"";if(typeof a!=="string")throw new TypeError("url");c=c?c.href||c:"";if(typeof c!=="string")throw new TypeError("base");Object.defineProperty(this,"_input",{value:a,writable:!0});var h=document.implementation.createHTMLDocument("");
if(c){var g=h.createElement("a");g.href=c;if(g.protocol.length<2||!g.host)throw Error("InvalidStateError");var f=h.createElement("base");f.href=g.href;h.head.appendChild(f)}var d=h.createElement("a");d.href=a;h.body.appendChild(d);Object.defineProperty(this,"_urlAnchor",{value:d});var j=new b(d);Object.defineProperty(this,"query",{get:function(){return i(d)?j:null},enumerable:!0})}try{if(typeof window.URL==="function"&&window.URL.length!==0&&(new window.URL("http://www.w3.org")).protocol==="http:")return}catch(h){}var g=
/([^:]*):?(.*)/,n=typeof StopIteration!=="undefined"?StopIteration:Error("Stop Iteration");Object.defineProperties(b.prototype,{get:{value:function(a){c(a);var b;k(this._anchor.search).some(function(c){c=f(c);if(c[0]===a)return b=c[1],!0});return b},enumerable:!0},set:{value:function(a,b){c(a);c(b);var h=k(this._anchor.search);h.some(function(c,g){var d=f(c);if(d[0]===a)return d[1]=b,h[g]=m(d),!0})||h.push(m([a,b]));this._anchor.search=d(h)},enumerable:!0},has:{value:function(a){c(a);return k(this._anchor.search).some(function(b){if(f(b)[0]===
a)return!0})},enumerable:!0},"delete":{value:function(a){c(a);var b=k(this._anchor.search),h=b.filter(function(b){return f(b)[0]!==a});return h.length!==b.length?(this._anchor.search=d(h),!0):!1},enumerable:!0},clear:{value:function(){this._anchor.search=""},enumerable:!0},forEach:{value:function(a,b){if(typeof a!=="function")throw new TypeError;var c=j(this._anchor,"keys+values");try{for(;;){var h=c.next();a.call(b,h[1],h[0],this)}}catch(g){if(g!==n)throw g;}},enumerable:!0},keys:{value:function(){return j(this._anchor,
"keys")},enumerable:!0},values:{value:function(){return j(this._anchor,"values")},enumerable:!0},items:{value:function(){return j(this._anchor,"keys+values")}},size:{get:function(){return k(this._anchor.search).length},enumerable:!0},getAll:{value:function(a){c(a);var b=[];k(this._anchor.search).forEach(function(c){c=f(c);c[0]===a&&b.push(c[1])});return b},enumerable:!0},append:{value:function(a,b){c(a);c(b);var h=k(this._anchor.search);h.push(m([a,b]));this._anchor.search=d(h)},enumerable:!0}});
Object.defineProperties(a.prototype,{href:{get:function(){return i(this._urlAnchor)?this._urlAnchor.href:this._input},set:function(a){c(a);this._input=a;this._urlAnchor.href=a},enumerable:!0},origin:{get:function(){return i(this._urlAnchor)?this._urlAnchor.protocol+"//"+this._urlAnchor.host:""},enumerable:!0},protocol:{get:function(){return i(this._urlAnchor)?this._urlAnchor.protocol:":"},set:function(a){c(a);this._urlAnchor.protocol=a},enumerable:!0},_userinfo:{get:function(){return!i(this._urlAnchor)?
"":RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host).exec(this._urlAnchor.href)[2]||""},set:function(a){c(a);this._urlAnchor.href=this._urlAnchor.href.replace(RegExp("^"+this._urlAnchor.protocol+"(\\/\\/)(?:([^@]*)?@)?"+this._urlAnchor.host),this._urlAnchor.protocol+"//"+(a?a+"@":"")+this._urlAnchor.host)}},username:{get:function(){if(!i(this._urlAnchor))return"";var a=g.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){c(a);var b=g.exec(this._userinfo),
a=[encodeURIComponent(a||"")];b[2]&&a.push(b[2]);this._userinfo=a.join(":")},enumerable:!0},password:{get:function(){if(!i(this._urlAnchor))return"";var a=g.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){c(a);var b=[g.exec(this._userinfo)[1]||""];a&&b.push(encodeURIComponent(a));this._userinfo=b.join(":")},enumerable:!0},host:{get:function(){return i(this._urlAnchor)?this._urlAnchor.host:""},set:function(a){c(a);this._urlAnchor.host=a},enumerable:!0},hostname:{get:function(){return i(this._urlAnchor)?
this._urlAnchor.hostname:""},set:function(a){c(a);this._urlAnchor.hostname=a},enumerable:!0},port:{get:function(){return i(this._urlAnchor)?this._urlAnchor.port:""},set:function(a){c(a);this._urlAnchor.port=a},enumerable:!0},pathname:{get:function(){return i(this._urlAnchor)?this._urlAnchor.pathname:""},set:function(a){c(a);this._urlAnchor.pathname=a},enumerable:!0},search:{get:function(){return i(this._urlAnchor)?this._urlAnchor.search:""},set:function(a){c(a);this._urlAnchor.search=a},enumerable:!0},
hash:{get:function(){return i(this._urlAnchor)?this._urlAnchor.hash:""},set:function(a){c(a);this._urlAnchor.hash=a},enumerable:!0}});window.URL&&window.URL.createObjectURL&&(Object.defineProperty(a,"createObjectURL",{value:window.URL.createObjectURL.bind(window.URL),enumerable:!1}),Object.defineProperty(a,"revokeObjectURL",{value:window.URL.revokeObjectURL.bind(window.URL),enumerable:!1}));window.URL=a})();define("orion/URL-shim",function(){});
define("plugins/filePlugin/fileImpl",["orion/Deferred","orion/xhr","orion/URL-shim"],function(k,d){function f(b){b&&typeof b==="object"&&Object.keys(b).forEach(function(a){var c=b[a];a.indexOf("Location")!==-1?(i.href=c,b[a]=i.href):f(c)});return b}function m(b){var a;a=b.keyword;for(var c="",g=0;g<a.length;g++){var d=a.charAt(g);'+-&|!(){}[]^"~:\\'.indexOf(d)>=0&&(c+="\\");c+=d}a=c;c=b.sort;b.nameSearch?(g=/\*$/.test(b.keyword)?"":"*",a="NameLower:"+a+g):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);g=b.resource;d=g.indexOf("/file");d>0&&(g=g.substring(d));return"?sort="+c+"&rows="+b.rows+"&start="+b.start+"&q="+a+"+Location:"+g+"*"}function j(b,a){this.fileBase=b;this.makeAbsolute=(this.workspaceBase=a)&&a.indexOf("://")!==-1}function c(b,a,c,g){var d=new k,e=new XMLHttpRequest;try{e.open(b,
a),c&&Object.keys(c).forEach(function(a){e.setRequestHeader(a,c[a])}),e.responseType="arraybuffer",e.send(g),e.onload=function(){d.resolve({status:e.status,statusText:e.statusText,headers:e.getAllResponseHeaders(),response:e.response})}}catch(f){d.reject(f)}return d}var i=document.createElement("a");j.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 d("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&&f(a);return a}.bind(this))},_createWorkspace:function(b){return d("POST",this.workspaceBase,{headers:{"Orion-Version":"1",Slug:b},timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):{}})},loadWorkspaces:function(){return d("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&&f(b);return b}.bind(this))},loadWorkspace:function(b){b===this.fileBase&&(b=null);return d("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&&f(a);return a}.bind(this))},createProject:function(b,
a,c,g){if(b){a={Name:a};if(c)a.ContentLocation=c;if(g)a.CreateIfDoesntExist=g;return d("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&&f(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 d("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&&f(a);return a}.bind(this))},createFile:function(b,a){return d("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&&f(a);return a}.bind(this))},deleteFile:function(b){return d("DELETE",b,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&f(a);return a}.bind(this))},moveFile:function(b,a,c){return this._doCopyMove(b,a,!0,c).then(function(a){this.makeAbsolute&&f(a);return a}.bind(this))},
copyFile:function(b,a,c){return this._doCopyMove(b,a,!1,c).then(function(a){this.makeAbsolute&&f(a);return a}.bind(this))},_doCopyMove:function(b,a,c,g){g||(g=b.split("/"),g=g.pop()||g.pop());return d("POST",a,{headers:{"Orion-Version":"1",Slug:g,"X-Create-Options":"no-overwrite,"+(c?"move":"copy"),"Content-Type":"application/json;charset=UTF-8"},data:JSON.stringify({Location:b,Name:g}),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null})},read:function(b,a){var c=new URL(b,
window.location);a&&c.query.set("parts","meta");return d("GET",c.href,{timeout:5E3,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&&f(a);return a}.bind(this))},write:function(b,a,c){var g={"Orion-Version":"1","Content-Type":"text/plain;charset=UTF-8"};if(c&&c.ETag)g["If-Match"]=c.ETag;c={timeout:5E3,headers:g,data:a,log:!1};if(typeof a!=="string")a.sourceLocation?(c.query={source:a.sourceLocation},
c.data=null):c.query={parts:"meta"};return d("PUT",b,c).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&f(a);return a}.bind(this))},remoteImport:function(b,a){var c={"Orion-Version":"1"};if(a.OptionHeader)c["X-Xfer-Options"]=a.OptionHeader;return d("POST",b,{headers:c,data:JSON.stringify(a),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&f(a);return a}.bind(this))},remoteExport:function(b,
a){var c={"Orion-Version":"1"};if(a.OptionHeader)c["X-Xfer-Options"]=a.OptionHeader;return d("POST",b,{headers:c,data:JSON.stringify(a),timeout:15E3}).then(function(a){return a.response?JSON.parse(a.response):null}).then(function(a){this.makeAbsolute&&f(a);return a}.bind(this))},search:function(b){b=m(b);return d("GET","/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&&
f(a);return a}.bind(this))}};if(window.Blob)j.prototype.readBlob=function(b){return c("GET",b).then(function(a){return a.response})},j.prototype.writeBlob=function(b,a,d){var f={};if(d&&d.ETag)f["If-Match"]=d.ETag;return c("PUT",b,f,a)};return j});
define("domReady",[],function(){function k(a){for(var b=0,c;c=a[b];b++)c(i)}function d(){var e=b,d=a;c&&(e.length&&(b=[],k(e)),h.resourcesDone&&d.length&&(a=[],k(d)))}function f(){c||(c=!0,n&&clearInterval(n),d())}function m(a){c?a(i):b.push(a);return m}var j=typeof window!=="undefined"&&window.document,c=!j,i=j?document:null,b=[],a=[],h=requirejs||require||{},g=h.resourcesReady,n;if("resourcesReady"in h)h.resourcesReady=function(a){g&&g(a);a&&d()};j&&(document.addEventListener?(document.addEventListener("DOMContentLoaded",
f,!1),window.addEventListener("load",f,!1)):window.attachEvent&&(window.attachEvent("onload",f),self===self.top&&(n=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),f())}catch(a){}},30))),document.readyState==="complete"&&f());m.withResources=function(b){c&&h.resourcesDone?b(i):a.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("plugins/fileClientPlugin",["orion/Deferred","orion/plugin","plugins/filePlugin/fileImpl","domReady!"],function(k,d,f){function m(b){if(j)try{if(window.location.host===parent.location.host&&window.location.protocol===parent.location.protocol)return b.substring(parent.location.href.indexOf(parent.location.host)+parent.location.host.length);else j=!1}catch(a){j=!1}return b}var j=!0,c=document.createElement("a");c.href="../mixloginstatic/LoginWindow.html";d=new d({name:"Orion File Service",version:"1.0",
description:"This plugin provides file access to a user's workspace.",login:c.href});c.href="../file";k=m(c.href);c.href="../workspace";var i=m(c.href);c.href="..";c=m(c.href);f=new f(k,i);d.registerService("orion.core.file",f,{Name:"Orion Content",NameKey:"Orion Content",nls:"orion/navigate/nls/messages",top:k,pattern:c});d.connect()});