(function(b,g){"function"===typeof define&&define.amd?define("orion/Deferred",g):"object"===typeof exports?module.exports=g():(b.orion=b.orion||{},b.orion.Deferred=g())})(this,function(){function b(){for(var a;a=c.shift();)a();d=!1}function g(a){c.push(a);d||(d=!0,e())}function k(a){return function(f){a(f)}}function h(){function a(){for(var a;a=p.shift();){var f=a.deferred,d="fulfilled"===e?"resolve":"reject";a=a[d];if("function"===typeof a)try{var b=a(c),u=b&&("object"===typeof b||"function"===typeof b)&&
b.then;if("function"===typeof u)if(b===f.promise)f.reject(new TypeError);else{var g=b.cancel;"function"===typeof g?f._parentCancel=g.bind(b):delete f._parentCancel;u.call(b,k(f.resolve),k(f.reject),k(f.progress))}else f.resolve(b)}catch(l){f.reject(l)}else f[d](c)}}function f(f){delete l._parentCancel;e="rejected";c=f;p.length&&g(a)}function d(b){function r(a){return function(b){(!e||"assumed"===e)&&a(b)}}delete l._parentCancel;try{var k=b&&("object"===typeof b||"function"===typeof b)&&b.then;if("function"===
typeof k)if(b===l)f(new TypeError);else{e="assumed";var w=b&&b.cancel;if("function"!==typeof w){var t=new h;b=t.promise;try{k(t.resolve,t.reject,t.progress)}catch(y){t.reject(y)}w=b.cancel;k=b.then}c=b;k.call(b,r(d),r(f));l._parentCancel=w.bind(b)}else e="fulfilled",c=b,p.length&&g(a)}catch(s){r(f)(s)}}function b(){var a=l._parentCancel;a?(delete l._parentCancel,a()):e||(a=Error("Cancel"),a.name="Cancel",f(a))}var c,e,p=[],l=this;this.resolve=function(a){e||d(a);return l};this.reject=function(a){e||
f(a);return l};this.progress=function(a){e||p.forEach(function(b){if(b.progress)try{b.progress(a)}catch(f){}});return l.promise};this.cancel=function(){l._parentCancel?setTimeout(b,0):b();return l};this.then=function(b,f,d){var c=new h;c._parentCancel=l.promise.cancel;p.push({resolve:b,reject:f,progress:d,deferred:c});("fulfilled"===e||"rejected"===e)&&g(a);return c.promise};this.promise={then:l.then,cancel:l.cancel}}var c=[],d=!1,e=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var a=
process.nextTick;return function(){a(b)}}if("function"===typeof MutationObserver){var f=document.createElement("div");(new MutationObserver(b)).observe(f,{attributes:!0});return function(){f.setAttribute("class","_tick")}}return function(){setTimeout(b,0)}}();h.all=function(a,b){function d(a,b){k||(g[a]=b,0===--e&&l.resolve(g))}function c(a,e){if(!k){if(b)try{d(a,b(e));return}catch(g){e=g}l.reject(e)}}var e=a.length,g=[],k=!1,l=new h;l.then(void 0,function(){k=!0;a.forEach(function(a){a.cancel&&a.cancel()})});
0===e?l.resolve(g):a.forEach(function(a,b){a.then(d.bind(void 0,b),c.bind(void 0,b))});return l.promise};h.when=function(a,b,d,c){var e;a&&"function"===typeof a.then||(e=new h,e.resolve(a),a=e.promise);return a.then(b,d,c)};return h});
define("orion/xhr",["orion/Deferred"],function(b){function g(b,g,c,d){var e="undefined"!==typeof c.response?c.response:c.responseText,a;try{a=c.status}catch(f){a=0}b={args:g,response:e,responseText:"string"===typeof e?e:null,status:a,url:b,xhr:c};"undefined"!==typeof d&&(b.error=d);return b}return function(k,h,c){c=c||{};var d=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,e=new b,a=c.headers||{},f=c.log||!1,u;"undefined"===typeof a["X-Requested-With"]&&(a["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof c.data&&("POST"===k||"PUT"===k))u=c.data;var r=!1,v=!1;e.promise.then(void 0,function(a){r=!0;!v&&a instanceof Error&&"Cancel"===a.name&&d.abort()});d.onabort=function(){v=!0;if(!r){var a=Error("Cancel");a.name="Cancel";e.reject(a)}};d.onload=function(){var a=g(h,c,d);200<=d.status&&400>d.status?e.resolve(a):(e.reject(a),f&&"undefined"!==typeof console&&console.log(Error(d.statusText)))};d.onerror=function(){var a=g(h,c,d);e.reject(a);f&&"undefined"!==typeof console&&console.log(Error(d.statusText))};
d.onprogress=function(a){a.xhr=d;e.progress(a)};try{d.open(k,h,!0);"string"===typeof c.responseType&&(d.responseType=c.responseType);if("number"===typeof c.timeout)if("number"===typeof d.timeout)d.timeout=c.timeout,d.addEventListener("timeout",function(a){e.reject(g(h,c,d,"Timeout exceeded"))});else{var q=setTimeout(function(){e.reject(g(h,c,d,"Timeout exceeded"))},c.timeout);e.promise.then(clearTimeout.bind(null,q),clearTimeout.bind(null,q))}Object.keys(a).forEach(function(b){d.setRequestHeader(b,
a[b])});d.send(u||null)}catch(p){e.reject(g(h,c,d,p))}return e.promise}});
(function(b,g){"function"===typeof define&&define.amd?define("orion/plugin",["orion/Deferred"],g):"object"===typeof exports?module.exports=g(require("orion/Deferred")):(b.orion=b.orion||{},b.orion.PluginProvider=g(b.orion.Deferred))})(this,function(b){function g(b,g){this.__objectId=b;this.__methods=g}return function(k){function h(a){p&&("undefined"===typeof ArrayBuffer&&(a=JSON.stringify(a)),p===self?p.postMessage(a):p.postMessage(a,"*"))}function c(){var a=[];Object.keys(y).forEach(function(b){var f=
y[b];a.push({serviceId:b,names:f.names,methods:f.methods,properties:f.properties})});return{headers:v||{},services:a}}function d(a,b){if(b&&b instanceof XMLHttpRequest){var f,d;try{f=b.status,d=b.statusText}catch(m){f=0,d=""}return{status:f||0,statusText:d}}return b}function e(a){var b=a?JSON.parse(JSON.stringify(a,d)):a;a instanceof Error&&(b.__isError=!0,b.message=b.message||a.message,b.name=b.name||a.name);return b}function a(a){if(!p)return(new b).reject(Error("plugin not connected"));a.id=String(l++);
var f=new b;w[a.id]=f;f.then(null,function(b){q&&b instanceof Error&&"Cancel"===b.name&&s({requestId:a.id,method:"cancel",params:b.message?[b.message]:[]})});var d=Object.prototype.toString;a.params.forEach(function(b,m){if("[object Object]"===d.call(b)&&!(b instanceof g)){var n,e;for(n in b)"[object Function]"===d.call(b[n])&&(e=e||[],e.push(n));if(e){var C=B++;t[C]=b;n=function(){delete t[C]};f.then(n,n);a.params[m]=new g(C,e)}}});s(a);return f.promise}function f(a,b){a||0===a?s({id:a,result:null,
error:b}):console.log(b)}function u(b,f,d,c){c.forEach(function(m,b){if(m&&"undefined"!==typeof m.__objectId){var n={};m.__methods.forEach(function(b){n[b]=function(){return a({objectId:m.__objectId,method:b,params:Array.prototype.slice.call(arguments)})}});c[b]=n}});var m=void 0===typeof b?null:{id:b,result:null,error:null};try{var n=d.apply(f,c);m&&(n&&"function"===typeof n.then?(x[b]=n,n.then(function(a){delete x[b];m.result=a;s(m)},function(a){x[b]&&(delete x[b],m.error=e(a),s(m))},function(){s({responseId:b,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(m.result=n,s(m)))}catch(g){m&&(m.error=e(g),s(m))}}function r(a){if(!(a.source!==p&&"undefined"!==typeof window)){a="string"!==typeof a.data?a.data:JSON.parse(a.data);try{if(a.method){var b=a.method,d=a.params||[];if("serviceId"in a){var e=y[a.serviceId];e||f(a.id,"service not found");e=e.implementation;b in e?u(a.id,e,e[b],d):f(a.id,"method not found")}else if("objectId"in a){var m=t[a.objectId];m||f(a.id,"object not found");!b in
m?u(a.id,m,m[b],d):f(a.id,"method not found")}else if("requestId"in a){var n=x[a.requestId];n&&"cancel"===b&&n.cancel&&n.cancel.apply(n,d)}else if("responseId"in a){var c=w[a.responseId];c&&"progress"===b&&c.progress&&c.progress.apply(c,d)}else throw Error("Bad method: "+a.method);}else{var g=w[String(a.id)];delete w[String(a.id)];a.error?g.reject(a.error):g.resolve(a.result)}}catch(h){console.log("Plugin._messageHandler "+h)}}}var v=k,q=!1,p=null,l=0,B=0,z=0,x={},w={},t={},y={},s=h;this.updateHeaders=
function(a){if(q)throw Error("Cannot update headers. Plugin Provider is connected");v=a};this.registerServiceProvider=this.registerService=function(a,b,f){if(q)throw Error("Cannot register service. Plugin Provider is connected");"string"===typeof a?a=[a]:Array.isArray(a)||(a=[]);var d=null,m=[];for(d in b)"function"===typeof b[d]&&m.push(d);y[z++]={names:a,methods:m,implementation:b,properties:f||{},listeners:{}}};this.connect=function(a,b){if(!q){if("undefined"===typeof window)p=self;else if(window!==
window.parent)p=window.parent;else if(null!==window.opener)p=window.opener;else{b&&b("No valid plugin target");return}addEventListener("message",r,!1);var f={method:"plugin",params:[c()]};h(f);q=!0}a&&a()};this.disconnect=function(){q&&(removeEventListener("message",r),p=null,q=!1)}}});
define("orion/operation",["orion/xhr","orion/Deferred"],function(b,g){function k(c,d,e,a){b("GET",c,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(f){f=f.response?JSON.parse(f.response):null;d.progress(f);!f.type||"loadstart"===f.type||"progress"===f.type?setTimeout(function(){k(c,d,e,a)},2E3):("error"===f.type||"abort"===f.type?d.reject(a?a(f):f.Result):d.resolve(e?e(f):f.Result.JsonData),f.Location||b("DELETE",c,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(a){var b=a;if(void 0!==
a.responseText){b=a.responseText;try{b=JSON.parse(a.responseText)}catch(e){}}void 0!==b.Message?(b.HttpCode=void 0===b.HttpCode?a.status:b.HttpCode,b.Severity=void 0===b.Severity?"Error":b.Severity,d.reject(b)):d.reject({Severity:"Error",Message:b,HttpCode:a.status})})}function h(c,d){d.then(null,function(d){d instanceof Error&&"Cancel"===d.name&&b("PUT",c,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(b,d,e){var a=new g;h(b,a);k(b,a,d,e);return a}}});
(function(){function b(a){if("string"!==typeof a)throw new TypeError;}function g(a){return a?a.split("\x26"):[]}function k(a){return 0===a.length?"":a.join("\x26")}function h(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+="\x3d"+encodeURIComponent(a[1]));return b}function d(a,b){var d="",f=[],e=0;return{next:function(){d!==a.query&&(d=a.query,f=g(d));if(e<f.length){var c=
h(f[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 D;}}}function e(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function a(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function f(a){var b=[];a.split("/").forEach(function(a){".."===a?b.pop():"."!==a&&b.push(a)});return b.join("/")}function u(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function r(b,d){if("string"!==
typeof b)throw new TypeError;b=u(b);var e=l.exec(b);if(!e)return null;var c={};c.scheme=e[1]||"";if(c.scheme&&!z.test(c.scheme))return null;var g=e[2];if(g&&(g=B.exec(g),c.userinfo=g[1],c.host=g[2],c.port=g[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=a(c.port));c.host&&c.path&&(c.path=f(c.path));return c}function v(a,b){var c;if(b){b=b.href||b;c=r(b);if(!c||!c.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:c})}c=r(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 e(this);Object.defineProperty(this,"query",{get:function(){return this._url?
d:null},enumerable:!0})}try{var q;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(q=new window.URL("http://www.w3.org?q")).protocol&&q.query)return}catch(p){}var l=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,B=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,z=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,x=/^\d*$/,w=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,t=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,y=/^([^?#\s]*)$/,s=/^([^\s]*)$/,E=/^\S*$/,A=/([^:]*):?(.*)/,D="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),F={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(e.prototype,{get:{value:function(a){b(a);var c;g(this._url.query).some(function(b){b=h(b);if(b[0]===a)return c=b[1],!0});return c},enumerable:!0},set:{value:function(a,d){b(a);b(d);var f=g(this._url.query);f.some(function(b,e){var g=h(b);if(g[0]===a)return g[1]=d,f[e]=c(g),!0})||f.push(c([a,d]));this._url.query=k(f)},enumerable:!0},has:{value:function(a){b(a);
return g(this._url.query).some(function(b){if(h(b)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){b(a);var c=g(this._url.query),d=c.filter(function(b){return h(b)[0]!==a});return d.length!==c.length?(this._url.query=k(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 c=d(this._url,"keys+values");try{for(;;){var f=c.next();a.call(b,f[1],f[0],this)}}catch(e){if(e!==D)throw e;
}},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 g(this._url.query).length},enumerable:!0},getAll:{value:function(a){b(a);var c=[];g(this._url.query).forEach(function(b){b=h(b);b[0]===a&&c.push(b[1])});return c},enumerable:!0},append:{value:function(a,d){b(a);b(d);var f=g(this._url.query);f.push(c([a,d]));this._url.query=
k(f)},enumerable:!0}});Object.defineProperties(v.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){b(a);this._input=a;this._url=r(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,""===a||z.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){b(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=A.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){b(a);if(this._url){var c=
A.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=A.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){b(a);if(this._url){var c=[A.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(c){b(c);if(this._url&&(c=t.exec(c)))this._url.host=c[1],this._url.port=a(c[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){b(a);this._url&&w.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===F[this.protocol]&&(a="");return a},set:function(c){b(c);this._url&&x.exec(c)&&(this._url.port=a(c))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){b(a);
this._url&&y.exec(a)&&(this._url.host&&a&&"/"!==a[0]&&(a="/"+a),this._url.path=a?f(a):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){b(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),s.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);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),E.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((q=window.URL||window.webkitURL)&&q.createObjectURL)Object.defineProperty(v,"createObjectURL",{value:q.createObjectURL.bind(q),enumerable:!1}),Object.defineProperty(v,"revokeObjectURL",{value:q.revokeObjectURL.bind(q),enumerable:!1});window.URL=v})();define("orion/URL-shim",[],function(){});
define("domReady",[],function(){function b(){if(!e){e=!0;c&&clearInterval(c);var b=f;if(e&&b.length){f=[];var d;for(d=0;d<b.length;d+=1)b[d](a)}}}function g(b){e?b(a):f.push(b);return g}var k,h,c,d="undefined"!==typeof window&&window.document,e=!d,a=d?document:null,f=[];if(d){if(document.addEventListener)document.addEventListener("DOMContentLoaded",b,!1),window.addEventListener("load",b,!1);else if(window.attachEvent){window.attachEvent("onload",b);h=document.createElement("div");try{k=null===window.frameElement}catch(u){}h.doScroll&&
k&&window.external&&(c=setInterval(function(){try{h.doScroll(),b()}catch(a){}},30))}"complete"===document.readyState&&b()}g.version="2.0.1";g.load=function(a,b,c,d){d.isBuild?c(null):g(c)};return g});
define("built-taskPlugin.js","orion/xhr orion/plugin orion/operation orion/Deferred orion/URL-shim domReady!".split(" "),function(b,g,k,h){function c(a){a&&"object"===typeof a&&Object.keys(a).forEach(function(b){var e=a[b];-1!==b.indexOf("Location")?(d.href=e,a[b]=d.href):c(e)});return a}var d=document.createElement("a");d.href="../mixloginstatic/LoginWindow.html";g=new g({name:"Orion Task Management Service",version:"1.0",description:"This plugin provides access to the tasks a user is currently running or ran recently, and provides management of those tasks.",
login:d.href});d.href="../task";var e=function(a){try{if(window.location.host===parent.location.host&&window.location.protocol===parent.location.protocol)return a.substring(parent.location.href.indexOf(parent.location.host)+parent.location.host.length)}catch(b){}return a}(d.href);g.registerService("orion.core.operation",{getOperations:function(a){var d=new URL(e,window.location);a&&"object"===typeof a&&Object.keys(a).forEach(function(b){d.query.set(b,a[b])});return b("GET",d.href,{headers:{"Orion-Version":"1"},
timeout:a.Longpolling?7E4:15E3}).then(function(a){a=a.response?JSON.parse(a.response):null;c(a);return a})},getOperation:function(a){return k.handle(a)},removeCompletedOperations:function(){return b("DELETE",e,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=a.response?JSON.parse(a.response):null;c(a);return a})},removeOperation:function(a){var d=new h;b("DELETE",a,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=a.response?JSON.parse(a.response):null;c(a);d.resolve(a)},
function(a){var b=a;if(a.responseText){b=a.responseText;try{b=JSON.parse(a.responseText)}catch(c){}}b.Message?d.reject(b):d.reject({Severity:"Error",Message:b})});return d}},{name:"Tasks",pattern:e});g.connect()});
//@ sourceMappingURL=built-taskPlugin.js.map