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