ah-resque-ui
Version:
A resque administration website for actionhero
1 lines • 36.8 kB
JavaScript
!function(e,t,n,o){t[e]=n.call(t);for(var r=0;r<o.length;r++)o[r](t[e]);"undefined"!=typeof module&&module.exports?module.exports=t[e]:"function"==typeof define&&define.amd&&define(function(){return t[e]})}("Primus",this||{},function(){return function o(r,i,s){function c(t,e){if(!i[t]){if(!r[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(a)return a(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=i[t]={exports:{}},r[t][0].call(n.exports,function(e){return c(r[t][1][e]||e)},n,n.exports,o,r,i,s)}return i[t].exports}for(var a="function"==typeof require&&require,e=0;e<s.length;e++)c(s[e]);return c}({1:[function(e,t,n){"use strict";t.exports=function(o,i){var s=/[, ]+/;function r(e,t){if(i[e]){if("string"==typeof i[e]&&(i[e]=i[e].split(s)),"function"==typeof i[e])return i[e].call(t);for(var n,o,r=0;r<i[e].length;r++)"function"==(n=typeof(o=i[e][r]))?o.call(t):"string"==n&&"function"==typeof t[o]&&t[o]()}}return i=i||{},"string"==typeof(o=o||[])&&(o=o.split(s)),function(){var e,t=this,n=0;if(null===t[o[0]])return!1;for(r("before",t);n<o.length;n++)t[e=o[n]]&&("function"==typeof t[e].destroy&&t[e].destroy(),t[e]=null);return t.emit&&t.emit("destroy"),r("after",t),!0}}},{}],2:[function(e,t,n){"use strict";t.exports=function(){for(var o,r=this,e=0,t=arguments.length,i=new Array(t);e<t;e++)i[e]=arguments[e];return"function"!=typeof i[i.length-1]?function(){for(var e=0,t=arguments.length,n=new Array(t);e<t;e++)n[e]=arguments[e];return r.emit.apply(r,i.concat(n))}:(o=i.pop(),function(){for(var e=0,t=arguments.length,n=new Array(t+1);e<t;e++)n[e+1]=arguments[e];return n[0]=function(e,t){if(e)return r.emit("error",e);n=void 0===t?n.slice(1):null===t?[]:t,r.emit.apply(r,i.concat(n))},o.apply(r,n),!0})}},{}],3:[function(e,t,n){"use strict";var o=Object.prototype.hasOwnProperty,h="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,o,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");r=new i(n,o||e,r),t=h?h+t:t;return e._events[t]?e._events[t].fn?e._events[t]=[e._events[t],r]:e._events[t].push(r):(e._events[t]=r,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function c(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(h=!1)),c.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)o.call(e,t)&&n.push(h?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},c.prototype.listeners=function(e){var t=this._events[h?h+e:e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,o=t.length,r=new Array(o);n<o;n++)r[n]=t[n].fn;return r},c.prototype.listenerCount=function(e){e=this._events[h?h+e:e];return e?e.fn?1:e.length:0},c.prototype.emit=function(e,t,n,o,r,i){var s=h?h+e:e;if(!this._events[s])return!1;var c,a=this._events[s],u=arguments.length;if(a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),u){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,n),!0;case 4:return a.fn.call(a.context,t,n,o),!0;case 5:return a.fn.call(a.context,t,n,o,r),!0;case 6:return a.fn.call(a.context,t,n,o,r,i),!0}for(p=1,c=new Array(u-1);p<u;p++)c[p-1]=arguments[p];a.fn.apply(a.context,c)}else for(var f,l=a.length,p=0;p<l;p++)switch(a[p].once&&this.removeListener(e,a[p].fn,void 0,!0),u){case 1:a[p].fn.call(a[p].context);break;case 2:a[p].fn.call(a[p].context,t);break;case 3:a[p].fn.call(a[p].context,t,n);break;case 4:a[p].fn.call(a[p].context,t,n,o);break;default:if(!c)for(f=1,c=new Array(u-1);f<u;f++)c[f-1]=arguments[f];a[p].fn.apply(a[p].context,c)}return!0},c.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,o){e=h?h+e:e;if(!this._events[e])return this;if(!t)return a(this,e),this;var r=this._events[e];if(r.fn)r.fn!==t||o&&!r.once||n&&r.context!==n||a(this,e);else{for(var i=0,s=[],c=r.length;i<c;i++)(r[i].fn!==t||o&&!r[i].once||n&&r[i].context!==n)&&s.push(r[i]);s.length?this._events[e]=1===s.length?s[0]:s:a(this,e)}return this},c.prototype.removeAllListeners=function(e){return e?this._events[e=h?h+e:e]&&a(this,e):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=h,c.EventEmitter=c,void 0!==t&&(t.exports=c)},{}],4:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){var n;t&&(e.super_=t,(n=function(){}).prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e)}},{}],5:[function(e,t,n){"use strict";var r=new RegExp("^((?:\\d+)?\\.?\\d+) *("+["milliseconds?","msecs?","ms","seconds?","secs?","s","minutes?","mins?","m","hours?","hrs?","h","days?","d","weeks?","wks?","w","years?","yrs?","y"].join("|")+")?$","i");t.exports=function(e){var t,n,o=typeof e;if("number"==o)return e;if("string"!=o||"0"===e||!e)return 0;if(+e)return+e;if(1e4<e.length||!(n=r.exec(e)))return 0;switch(t=parseFloat(n[1]),n[2].toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 31536e6*t;case"weeks":case"week":case"wks":case"wk":case"w":return 6048e5*t;case"days":case"day":case"d":return 864e5*t;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*t;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*t;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*t;default:return t}}},{}],6:[function(e,t,n){"use strict";t.exports=function(e){var t,n=0;function o(){return n||(n=1,t=e.apply(this,arguments),e=null),t}return o.displayName=e.displayName||e.name||o.displayName||o.name,o}},{}],7:[function(e,t,n){var o,r,t=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function c(t){if(o===setTimeout)return setTimeout(t,0);if((o===i||!o)&&setTimeout)return o=setTimeout,setTimeout(t,0);try{return o(t,0)}catch(e){try{return o.call(null,t,0)}catch(e){return o.call(this,t,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:i}catch(e){o=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,u=[],f=!1,l=-1;function p(){f&&a&&(f=!1,a.length?u=a.concat(u):l=-1,u.length&&h())}function h(){if(!f){var e=c(p);f=!0;for(var t=u.length;t;){for(a=u,u=[];++l<t;)a&&a[l].run();l=-1,t=u.length}a=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function d(){}t.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new m(e,t)),1!==u.length||f||c(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=d,t.addListener=d,t.once=d,t.off=d,t.removeListener=d,t.removeAllListeners=d,t.emit=d,t.prependListener=d,t.prependOnceListener=d,t.listeners=function(e){return[]},t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},{}],8:[function(e,t,n){"use strict";var i=Object.prototype.hasOwnProperty;function s(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function c(e){try{return encodeURIComponent(e)}catch(e){return null}}n.stringify=function(e,t){var n,o,r=[];for(o in"string"!=typeof(t=t||"")&&(t="?"),e)i.call(e,o)&&((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=c(o),n=c(n),null!==o&&null!==n&&r.push(o+"="+n));return r.length?t+r.join("&"):""},n.parse=function(e){for(var t=/([^=?#&]+)=?([^&]*)/g,n={};r=t.exec(e);){var o=s(r[1]),r=s(r[2]);null===o||null===r||o in n||(n[o]=r)}return n}},{}],9:[function(e,t,n){"use strict";var o=e("eventemitter3"),r=e("millisecond"),i=e("demolish"),s=e("tick-tock"),c=e("one-time");function a(e,t,n){return r((e in n?n:e in t?t:u)[e])}function u(e){var t=this;if(!(t instanceof u))return new u(e);e=e||{},t.attempt=null,t._fn=null,t["reconnect timeout"]=a("reconnect timeout",t,e),t.retries=a("retries",t,e),t.factor=a("factor",t,e),t.max=a("max",t,e),t.min=a("min",t,e),t.timers=new s(t)}((u.prototype=new o).constructor=u)["reconnect timeout"]="30 seconds",u.max=1/0,u.min="500 ms",u.retries=10,u.factor=2,u.prototype.reconnect=function(){var n=this;return n.backoff(function(e,t){return t.duration=+new Date-t.start,e?n.emit("reconnect failed",e,t):void n.emit("reconnected",t)},n.attempt)},u.prototype.backoff=function(n,o){var r=this;return(o=o||r.attempt||{}).backoff?r:(o["reconnect timeout"]=a("reconnect timeout",r,o),o.retries=a("retries",r,o),o.factor=a("factor",r,o),o.max=a("max",r,o),o.min=a("min",r,o),o.start=+o.start||+new Date,o.duration=+o.duration||0,o.attempt=+o.attempt||0,o.attempt===o.retries?n.call(r,new Error("Unable to recover"),o):(o.backoff=!0,o.attempt++,(r.attempt=o).scheduled=1!==o.attempt?Math.min(Math.round((Math.random()+1)*o.min*Math.pow(o.factor,o.attempt-1)),o.max):o.min,r.timers.setTimeout("reconnect",function(){o.duration=+new Date-o.start,o.backoff=!1,r.timers.clear("reconnect, timeout");var t=r._fn=c(function(e){return r.reset(),e?r.backoff(n,o):void n.call(r,void 0,o)});r.emit("reconnect",o,t),r.timers.setTimeout("timeout",function(){var e=new Error("Failed to reconnect in a timely manner");o.duration=+new Date-o.start,r.emit("reconnect timeout",e,o),t(e)},o["reconnect timeout"])},o.scheduled),r.emit("reconnect scheduled",o)),r)},u.prototype.reconnecting=function(){return!!this.attempt},u.prototype.reconnected=function(e){return this._fn&&this._fn(e),this},u.prototype.reset=function(){return this._fn=this.attempt=null,this.timers.clear("reconnect, timeout"),this},u.prototype.destroy=i("timers attempt _fn"),t.exports=u},{demolish:1,eventemitter3:10,millisecond:5,"one-time":6,"tick-tock":12}],10:[function(e,t,n){"use strict";var h="function"!=typeof Object.create&&"~";function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(){}r.prototype._events=void 0,r.prototype.listeners=function(e,t){var n=this._events&&this._events[h?h+e:e];if(t)return!!n;if(!n)return[];if(n.fn)return[n.fn];for(var o=0,r=n.length,i=new Array(r);o<r;o++)i[o]=n[o].fn;return i},r.prototype.emit=function(e,t,n,o,r,i){var s=h?h+e:e;if(!this._events||!this._events[s])return!1;var c,a=this._events[s],u=arguments.length;if("function"==typeof a.fn){switch(a.once&&this.removeListener(e,a.fn,void 0,!0),u){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,t),!0;case 3:return a.fn.call(a.context,t,n),!0;case 4:return a.fn.call(a.context,t,n,o),!0;case 5:return a.fn.call(a.context,t,n,o,r),!0;case 6:return a.fn.call(a.context,t,n,o,r,i),!0}for(p=1,c=new Array(u-1);p<u;p++)c[p-1]=arguments[p];a.fn.apply(a.context,c)}else for(var f,l=a.length,p=0;p<l;p++)switch(a[p].once&&this.removeListener(e,a[p].fn,void 0,!0),u){case 1:a[p].fn.call(a[p].context);break;case 2:a[p].fn.call(a[p].context,t);break;case 3:a[p].fn.call(a[p].context,t,n);break;default:if(!c)for(f=1,c=new Array(u-1);f<u;f++)c[f-1]=arguments[f];a[p].fn.apply(a[p].context,c)}return!0},r.prototype.on=function(e,t,n){n=new o(t,n||this),e=h?h+e:e;return this._events||(this._events=h?{}:Object.create(null)),this._events[e]?this._events[e].fn?this._events[e]=[this._events[e],n]:this._events[e].push(n):this._events[e]=n,this},r.prototype.once=function(e,t,n){n=new o(t,n||this,!0),e=h?h+e:e;return this._events||(this._events=h?{}:Object.create(null)),this._events[e]?this._events[e].fn?this._events[e]=[this._events[e],n]:this._events[e].push(n):this._events[e]=n,this},r.prototype.removeListener=function(e,t,n,o){e=h?h+e:e;if(!this._events||!this._events[e])return this;var r=this._events[e],i=[];if(t)if(r.fn)(r.fn!==t||o&&!r.once||n&&r.context!==n)&&i.push(r);else for(var s=0,c=r.length;s<c;s++)(r[s].fn!==t||o&&!r[s].once||n&&r[s].context!==n)&&i.push(r[s]);return i.length?this._events[e]=1===i.length?i[0]:i:delete this._events[e],this},r.prototype.removeAllListeners=function(e){return this._events&&(e?delete this._events[h?h+e:e]:this._events=h?{}:Object.create(null)),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prototype.setMaxListeners=function(){return this},r.prefixed=h,void 0!==t&&(t.exports=r)},{}],11:[function(e,t,n){"use strict";t.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},{}],12:[function(e,f,t){!function(r,n){!function(){"use strict";var i=Object.prototype.hasOwnProperty,s=e("millisecond");function c(e,t,n,o){this.start=+new Date,this.duration=n,this.clear=t,this.timer=e,this.fns=[o]}function a(e){clearTimeout(e)}function u(e){clearInterval(e)}function o(e){n(e)}function t(e){if(!(this instanceof t))return new t(e);this.timers={},this.context=e||this}c.prototype.remaining=function(){return this.duration-this.taken()},c.prototype.taken=function(){return+new Date-this.start},t.prototype.tock=function(o,r){var i=this;return function(){if(o in i.timers){var e=i.timers[o].fns.slice(),t=e.length,n=0;for(r?i.clear(o):i.start=+new Date;n<t;n++)e[n].call(i.context)}}},t.prototype.setTimeout=function(e,t,n){var o,r=this;return r.timers[e]?r.timers[e].fns.push(t):(o=s(n),r.timers[e]=new c(setTimeout(r.tock(e,!0),s(n)),a,o,t)),r},t.prototype.setInterval=function(e,t,n){var o,r=this;return r.timers[e]?r.timers[e].fns.push(t):(o=s(n),r.timers[e]=new c(setInterval(r.tock(e),s(n)),u,o,t)),r},t.prototype.setImmediate=function(e,t){var n=this;return"function"!=typeof r?n.setTimeout(e,t,0):(n.timers[e]?n.timers[e].fns.push(t):n.timers[e]=new c(r(n.tock(e,!0)),o,0,t),n)},t.prototype.active=function(e){return e in this.timers},t.prototype.clear=function(){var e,t,n,o=arguments.length?arguments:[],r=this;if(!(o=1===o.length&&"string"==typeof o[0]?o[0].split(/[, ]+/):o).length)for(e in r.timers)i.call(r.timers,e)&&o.push(e);for(t=0,n=o.length;t<n;t++)(e=r.timers[o[t]])&&(e.clear(e.timer),e.fns=e.timer=e.clear=null,delete r.timers[o[t]]);return r},t.prototype.adjust=function(e,t){var n=s(t),o=this.timers[e];return o&&(t=o.clear===u,o.clear(o.timer),o.start=+new Date,o.duration=n,o.timer=(t?setInterval:setTimeout)(this.tock(e,!t),n)),this},t.prototype.end=t.prototype.destroy=function(){return!!this.context&&(this.clear(),!(this.context=this.timers=null))},t.Timer=c,f.exports=t}.call(this)}.call(this,e("timers").setImmediate,e("timers").clearImmediate)},{millisecond:5,timers:13}],13:[function(a,e,u){!function(n,c){!function(){var o=a("process/browser.js").nextTick,e=Function.prototype.apply,r=Array.prototype.slice,i={},s=0;function t(e,t){this._id=e,this._clearFn=t}u.setTimeout=function(){return new t(e.call(setTimeout,window,arguments),clearTimeout)},u.setInterval=function(){return new t(e.call(setInterval,window,arguments),clearInterval)},u.clearTimeout=u.clearInterval=function(e){e.close()},t.prototype.unref=t.prototype.ref=function(){},t.prototype.close=function(){this._clearFn.call(window,this._id)},u.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},u.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},u._unrefActive=u.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},u.setImmediate="function"==typeof n?n:function(e){var t=s++,n=!(arguments.length<2)&&r.call(arguments,1);return i[t]=!0,o(function(){i[t]&&(n?e.apply(null,n):e.call(null),u.clearImmediate(t))}),t},u.clearImmediate="function"==typeof c?c:function(e){delete i[e]}}.call(this)}.call(this,a("timers").setImmediate,a("timers").clearImmediate)},{"process/browser.js":7,timers:13}],14:[function(e,o,t){!function(s){!function(){"use strict";var p=e("requires-port"),h=e("querystringify"),r=/^[A-Za-z][A-Za-z0-9+-.]*:[\\/]+/,t=/^([a-z][a-z0-9.+-]*:)?([\\/]{1,})?([\S\s]*)/i,n=new RegExp("^[\\x09\\x0A\\x0B\\x0C\\x0D\\x20\\xA0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF]+");function m(e){return(e||"").toString().replace(n,"")}var d=[["#","hash"],["?","query"],function(e){return e.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],i={hash:1,query:1};function y(e){var t,n="undefined"!=typeof window?window:void 0!==s?s:"undefined"!=typeof self?self:{},n=n.location||{},o={},n=typeof(e=e||n);if("blob:"===e.protocol)o=new g(unescape(e.pathname),{});else if("string"==n)for(t in o=new g(e,{}),i)delete o[t];else if("object"==n){for(t in e)t in i||(o[t]=e[t]);void 0===o.slashes&&(o.slashes=r.test(e.href))}return o}function v(e){e=m(e);e=t.exec(e);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!(e[2]&&2<=e[2].length),rest:e[2]&&1===e[2].length?"/"+e[3]:e[3]}}function g(e,t,n){if(e=m(e),!(this instanceof g))return new g(e,t,n);var o,r,i,s,c,a=d.slice(),u=typeof t,f=this,l=0;for("object"!=u&&"string"!=u&&(n=t,t=null),n&&"function"!=typeof n&&(n=h.parse),t=y(t),o=!(u=v(e||"")).protocol&&!u.slashes,f.slashes=u.slashes||o&&t.slashes,f.protocol=u.protocol||t.protocol||"",e=u.rest,u.slashes||(a[3]=[/(.*)/,"pathname"]);l<a.length;l++)"function"!=typeof(i=a[l])?(r=i[0],c=i[1],r!=r?f[c]=e:"string"==typeof r?~(s=e.indexOf(r))&&(e="number"==typeof i[2]?(f[c]=e.slice(0,s),e.slice(s+i[2])):(f[c]=e.slice(s),e.slice(0,s))):(s=r.exec(e))&&(f[c]=s[1],e=e.slice(0,s.index)),f[c]=f[c]||o&&i[3]&&t[c]||"",i[4]&&(f[c]=f[c].toLowerCase())):e=i(e);n&&(f.query=n(f.query)),o&&t.slashes&&"/"!==f.pathname.charAt(0)&&(""!==f.pathname||""!==t.pathname)&&(f.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),o=n.length,e=n[o-1],r=!1,i=0;o--;)"."===n[o]?n.splice(o,1):".."===n[o]?(n.splice(o,1),i++):i&&(0===o&&(r=!0),n.splice(o,1),i--);return r&&n.unshift(""),"."!==e&&".."!==e||n.push(""),n.join("/")}(f.pathname,t.pathname)),"/"!==f.pathname.charAt(0)&&f.hostname&&(f.pathname="/"+f.pathname),p(f.port,f.protocol)||(f.host=f.hostname,f.port=""),f.username=f.password="",f.auth&&(i=f.auth.split(":"),f.username=i[0]||"",f.password=i[1]||""),f.origin=f.protocol&&f.host&&"file:"!==f.protocol?f.protocol+"//"+f.host:"null",f.href=f.toString()}g.prototype={set:function(e,t,n){var o,r=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(n||h.parse)(t)),r[e]=t;break;case"port":r[e]=t,p(t,r.protocol)?t&&(r.host=r.hostname+":"+t):(r.host=r.hostname,r[e]="");break;case"hostname":r[e]=t,r.port&&(t+=":"+r.port),r.host=t;break;case"host":r[e]=t,/:\d+$/.test(t)?(t=t.split(":"),r.port=t.pop(),r.hostname=t.join(":")):(r.hostname=t,r.port="");break;case"protocol":r.protocol=t.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":t?(o="pathname"===e?"/":"#",r[e]=t.charAt(0)!==o?o+t:t):r[e]=t;break;default:r[e]=t}for(var i=0;i<d.length;i++){var s=d[i];s[4]&&(r[s[1]]=r[s[1]].toLowerCase())}return r.origin=r.protocol&&r.host&&"file:"!==r.protocol?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(e){e&&"function"==typeof e||(e=h.stringify);var t=this,n=t.protocol;return n&&":"!==n.charAt(n.length-1)&&(n+=":"),n+=t.slashes?"//":"",t.username&&(n+=t.username,t.password&&(n+=":"+t.password),n+="@"),n+=t.host+t.pathname,(e="object"==typeof t.query?e(t.query):t.query)&&(n+="?"!==e.charAt(0)?"?"+e:e),t.hash&&(n+=t.hash),n}},g.extractProtocol=v,g.location=y,g.trimLeft=m,g.qs=h,o.exports=g}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{querystringify:8,"requires-port":11}],15:[function(e,t,n){"use strict";var o,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,s={},c=0,a=0;function u(e){for(var t="";t=r[e%i]+t,0<(e=Math.floor(e/i)););return t}function f(){var e=u(+new Date);return e!==o?(c=0,o=e):e+"."+u(c++)}for(;a<i;a++)s[r[a]]=a;f.encode=u,f.decode=function(e){var t=0;for(a=0;a<e.length;a++)t=t*i+s[e.charAt(a)];return t},t.exports=f},{}],16:[function(t,e,n){"use strict";var o,r=t("eventemitter3"),i=t("tick-tock"),s=t("recovery"),c=t("querystringify"),a=t("inherits"),u=t("demolish"),f=t("yeast"),l=/\u2028/g,p=/\u2029/g;function h(e,t){if(!(e instanceof m)){t=new Error("Primus#"+t+"'s context should called with a Primus instance");if("function"!=typeof e.listeners||!e.listeners("error").length)throw t;e.emit("error",t)}}try{o=location.origin||location.protocol+"//"+location.host}catch(e){o="http://127.0.0.1"}function m(e,t){if(!(this instanceof m))return new m(e,t);if(m.Stream.call(this),"function"!=typeof this.client)return this.critical(new Error("The client library has not been compiled correctly, see https://github.com/primus/primus#client-library for more details"));if("object"==typeof e?e=(t=e).url||t.uri||o:t=t||{},"ping"in t||"pong"in t)return this.critical(new Error("The `ping` and `pong` options have been removed"));var n=this;t.queueSize="queueSize"in t?t.queueSize:1/0,t.timeout="timeout"in t?t.timeout:1e4,t.reconnect="reconnect"in t?t.reconnect:{},t.pingTimeout="pingTimeout"in t?t.pingTimeout:45e3,t.strategy="strategy"in t?t.strategy:[],t.transport="transport"in t?t.transport:{},n.buffer=[],n.writable=!0,n.readable=!0,n.url=n.parse(e||o),n.readyState=m.CLOSED,n.options=t,n.timers=new i(this),n.socket=null,n.disconnect=!1,n.transport=t.transport,n.transformers={outgoing:[],incoming:[]},n.recovery=new s(t.reconnect),"string"==typeof t.strategy&&(t.strategy=t.strategy.split(/\s?,\s?/g)),!1===t.strategy?t.strategy=[]:t.strategy.length||(t.strategy.push("disconnect","online"),this.authorization||t.strategy.push("timeout")),t.strategy=t.strategy.join(",").toLowerCase(),"websockets"in t&&(n.AVOID_WEBSOCKETS=!t.websockets),"network"in t&&(n.NETWORK_EVENTS=t.network),t.manual||n.timers.setTimeout("open",function(){n.timers.clear("open"),n.open()},0),n.initialise(t)}m.requires=m.require=function(e){if("function"==typeof t)return t(e)};try{m.Stream=m.requires("stream")}catch(e){}m.Stream||(m.Stream=r),a(m,m.Stream),m.OPENING=1,m.CLOSED=2,m.OPEN=3,m.prototype.AVOID_WEBSOCKETS=!1,m.prototype.NETWORK_EVENTS=!1,m.prototype.online=!0;try{(m.prototype.NETWORK_EVENTS="onLine"in navigator&&(window.addEventListener||document.body.attachEvent))&&(navigator.onLine||(m.prototype.online=!1))}catch(e){}m.prototype.ark={},m.prototype.emits=t("emits"),m.prototype.plugin=function(e){if(h(this,"plugin"),e)return this.ark[e];var t={};for(e in this.ark)t[e]=this.ark[e];return t},m.prototype.reserved=function(e){return/^(incoming|outgoing)::/.test(e)||e in this.reserved.events},m.prototype.reserved.events={"reconnect scheduled":1,"reconnect timeout":1,readyStateChange:1,"reconnect failed":1,reconnected:1,reconnect:1,offline:1,timeout:1,destroy:1,online:1,error:1,close:1,open:1,data:1,end:1},m.prototype.initialise=function(e){var t,r=this;for(t in r.recovery.on("reconnected",r.emits("reconnected")).on("reconnect failed",r.emits("reconnect failed",function(e){r.emit("end"),e()})).on("reconnect timeout",r.emits("reconnect timeout")).on("reconnect scheduled",r.emits("reconnect scheduled")).on("reconnect",r.emits("reconnect",function(e){r.emit("outgoing::reconnect"),e()})),r.on("outgoing::open",function(){var e=r.readyState;r.readyState=m.OPENING,e!==r.readyState&&r.emit("readyStateChange","opening")}),r.on("incoming::open",function(){var e=r.readyState;if(r.recovery.reconnecting()&&r.recovery.reconnected(),r.writable=!0,r.readable=!0,r.online||(r.online=!0,r.emit("online")),r.readyState=m.OPEN,e!==r.readyState&&r.emit("readyStateChange","open"),r.heartbeat(),r.buffer.length){var t=r.buffer.slice(),n=t.length,o=0;for(r.buffer.length=0;o<n;o++)r._write(t[o])}r.emit("open")}),r.on("incoming::ping",function(e){r.online=!0,r.heartbeat(),r.emit("outgoing::pong",e),r._write("primus::pong::"+e)}),r.on("incoming::error",function(e){var t=r.timers.active("connect"),n=e;if("string"==typeof e)n=new Error(e);else if(!(e instanceof Error)&&"object"==typeof e)for(var o in n=new Error(e.message||e.reason),e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);if(r.recovery.reconnecting())return r.recovery.reconnected(n);r.listeners("error").length&&r.emit("error",n),t&&(~r.options.strategy.indexOf("timeout")?r.recovery.reconnect():r.end())}),r.on("incoming::data",function(n){r.decoder(n,function(e,t){return e?r.listeners("error").length&&r.emit("error",e):void(r.protocol(t)||r.transforms(r,r,"incoming",t,n))})}),r.on("incoming::end",function(){var e=r.readyState;return r.disconnect?(r.disconnect=!1,r.end()):(r.readyState=m.CLOSED,e!==r.readyState&&r.emit("readyStateChange","end"),r.timers.active("connect")&&r.end(),e!==m.OPEN?!!r.recovery.reconnecting()&&r.recovery.reconnect():(this.writable=!1,this.readable=!1,this.timers.clear(),r.emit("close"),~r.options.strategy.indexOf("disconnect")?r.recovery.reconnect():(r.emit("outgoing::end"),void r.emit("end"))))}),r.client(),r.ark)r.ark[t].call(r,r,e);return r.NETWORK_EVENTS&&(r.offlineHandler=function(){r.online&&(r.online=!1,r.emit("offline"),r.end(),r.recovery.reset())},r.onlineHandler=function(){r.online||(r.online=!0,r.emit("online"),~r.options.strategy.indexOf("online")&&r.recovery.reconnect())},window.addEventListener?(window.addEventListener("offline",r.offlineHandler,!1),window.addEventListener("online",r.onlineHandler,!1)):document.body.attachEvent&&(document.body.attachEvent("onoffline",r.offlineHandler),document.body.attachEvent("ononline",r.onlineHandler))),r},m.prototype.protocol=function(e){if("string"!=typeof e||0!==e.indexOf("primus::"))return!1;var t=e.indexOf(":",8),n=e.slice(t+2);switch(e.slice(8,t)){case"ping":this.emit("incoming::ping",+n);break;case"server":"close"===n&&(this.disconnect=!0);break;case"id":this.emit("incoming::id",n);break;default:return!1}return!0},m.prototype.transforms=function(e,i,t,n,o){var s={data:n},c=e.transformers[t];return function n(o,r){var e=c[o++];return e?1===e.length?!1===e.call(i,s)?void 0:n(o,r):void e.call(i,s,function(e,t){return e?i.emit("error",e):void(!1!==t&&n(o,r))}):r()}(0,function(){return"incoming"===t?i.emit("data",s.data,o):void i._write(s.data)}),this},m.prototype.id=function(e){return this.socket&&this.socket.id?e(this.socket.id):(this._write("primus::id::"),this.once("incoming::id",e))},m.prototype.open=function(){return h(this,"open"),!this.recovery.reconnecting()&&this.options.timeout&&this.timeout(),this.emit("outgoing::open"),this},m.prototype.write=function(e){return h(this,"write"),this.transforms(this,this,"outgoing",e),!0},m.prototype._write=function(e){var n=this;return m.OPEN!==n.readyState?(this.buffer.length===this.options.queueSize&&this.buffer.splice(0,1),this.buffer.push(e),!1):(n.encoder(e,function(e,t){return e?n.listeners("error").length&&n.emit("error",e):("string"==typeof t&&~(t=~t.indexOf("\u2028")?t.replace(l,"\\u2028"):t).indexOf("\u2029")&&(t=t.replace(p,"\\u2029")),void n.emit("outgoing::data",t))}),!0)},m.prototype.heartbeat=function(){return this.options.pingTimeout&&(this.timers.clear("heartbeat"),this.timers.setTimeout("heartbeat",function(){this.online&&(this.online=!1,this.emit("offline"),this.emit("incoming::end"))},this.options.pingTimeout)),this},m.prototype.timeout=function(){var e=this;function t(){e.removeListener("error",t).removeListener("open",t).removeListener("end",t).timers.clear("connect")}return e.timers.setTimeout("connect",function(){t(),e.readyState===m.OPEN||e.recovery.reconnecting()||(e.emit("timeout"),~e.options.strategy.indexOf("timeout")?e.recovery.reconnect():e.end())},e.options.timeout),e.on("error",t).on("open",t).on("end",t)},m.prototype.end=function(e){if(h(this,"end"),this.readyState===m.CLOSED&&!this.timers.active("connect")&&!this.timers.active("open"))return this.recovery.reconnecting()&&(this.recovery.reset(),this.emit("end")),this;void 0!==e&&this.write(e),this.writable=!1,this.readable=!1;e=this.readyState;return this.readyState=m.CLOSED,e!==this.readyState&&this.emit("readyStateChange","end"),this.timers.clear(),this.emit("outgoing::end"),this.emit("close"),this.emit("end"),this},m.prototype.destroy=u("url timers options recovery socket transport transformers",{before:"end",after:["removeAllListeners",function(){this.NETWORK_EVENTS&&(window.addEventListener?(window.removeEventListener("offline",this.offlineHandler),window.removeEventListener("online",this.onlineHandler)):document.body.attachEvent&&(document.body.detachEvent("onoffline",this.offlineHandler),document.body.detachEvent("ononline",this.onlineHandler)))}]}),m.prototype.clone=function(e){return this.merge({},e)},m.prototype.merge=function(e){for(var t,n,o=1;o<arguments.length;o++)for(t in n=arguments[o])Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e},m.prototype.parse=t("url-parse"),m.prototype.querystring=c.parse,m.prototype.querystringify=c.stringify,m.prototype.uri=function(e){var t=this.url,n=[],o=!1;e.query&&(o=!0),(e=e||{}).protocol="protocol"in e?e.protocol:"http:",e.query=!(!t.query||!o)&&t.query.slice(1),e.secure="secure"in e?e.secure:"https:"===t.protocol||"wss:"===t.protocol,e.auth=("auth"in e?e:t).auth,e.pathname=("pathname"in e?e:this).pathname,e.port="port"in e?+e.port:+t.port||(e.secure?443:80);var r=this.querystring(e.query||"");return r._primuscb=f(),e.query=this.querystringify(r),this.emit("outgoing::url",e),n.push(e.secure?e.protocol.replace(":","s:"):e.protocol,""),n.push(e.auth?e.auth+"@"+t.host:t.host),e.pathname&&n.push(e.pathname.slice(1)),o?n[n.length-1]+="?"+e.query:delete e.query,e.object?e:n.join("/")},m.prototype.transform=function(e,t){return h(this,"transform"),e in this.transformers?(this.transformers[e].push(t),this):this.critical(new Error("Invalid transformer type"))},m.prototype.critical=function(e){if(this.emit("error",e))return this;throw e},m.connect=function(e,t){return new m(e,t)},m.EventEmitter=r,m.prototype.client=function(){var t,n=this,o=function(){if("undefined"!=typeof WebSocket)return WebSocket;if("undefined"!=typeof MozWebSocket)return MozWebSocket;try{return m.requires("ws")}catch(e){}}();if(!o)return n.critical(new Error("Missing required `ws` module. Please run `npm install --save ws`"));n.on("outgoing::open",function(){n.emit("outgoing::end");try{var e={protocol:"ws+unix:"===n.url.protocol?"ws+unix:":"ws:",query:!0};3===o.length?("ws+unix:"===e.protocol&&(e.pathname="/"+n.url.hostname+n.url.pathname+":"+n.pathname),n.socket=t=new o(n.uri(e),[],n.transport)):(n.socket=t=new o(n.uri(e)),t.binaryType="arraybuffer")}catch(e){return n.emit("error",e)}t.onopen=n.emits("incoming::open"),t.onerror=n.emits("incoming::error"),t.onclose=n.emits("incoming::end"),t.onmessage=n.emits("incoming::data",function(e,t){e(void 0,t.data)})}),n.on("outgoing::data",function(e){if(t&&t.readyState===o.OPEN)try{t.send(e)}catch(e){n.emit("incoming::error",e)}}),n.on("outgoing::reconnect",function(){n.emit("outgoing::open")}),n.on("outgoing::end",function(){t&&(t.onerror=t.onopen=t.onclose=t.onmessage=function(){},t.close(),t=null)})},m.prototype.authorization=!1,m.prototype.pathname="/primus",m.prototype.encoder=function(e,t){var n;try{e=JSON.stringify(e)}catch(e){n=e}t(n,e)},m.prototype.decoder=function(e,t){var n;if("string"!=typeof e)return t(n,e);try{e=JSON.parse(e)}catch(e){n=e}t(n,e)},m.prototype.version="8.0.3","undefined"!=typeof document&&"undefined"!=typeof navigator&&(document.addEventListener&&document.addEventListener("keydown",function(e){27===e.keyCode&&e.preventDefault&&e.preventDefault()},!1),r=+[(r=(c=(navigator.userAgent||"").toLowerCase()).match(/.+(?:rv|it|ra|ie)[/: ](\d+)\.(\d+)(?:\.(\d+))?/)||[])[1],r[2]].join("."),!~c.indexOf("chrome")&&~c.indexOf("safari")&&r<534.54&&(m.prototype.AVOID_WEBSOCKETS=!0)),e.exports=m},{demolish:1,emits:2,eventemitter3:3,inherits:4,querystringify:8,recovery:9,"tick-tock":12,"url-parse":14,yeast:15}]},{},[16])(16)},[]),function(e){var t,n,o=function(e,t){var n,o=this;for(n in o.callbacks={},o.id=null,o.events={},o.rooms=[],o.state="disconnected",o.options=o.defaults(),e)o.options[n]=e[n];t&&(o.externalClient=!0,o.client=t)};"undefined"==typeof Primus?(t=require("util"),n=require("events").EventEmitter,t.inherits(o,n)):o.prototype=new Primus.EventEmitter,o.prototype.defaults=function(){return{apiPath:"/api",cookieKey:"sessionID",url:window.location.origin}},o.prototype.connect=function(t){var n=this;n.messageId=n.messageId||0,n.client&&!0!==n.externalClient?(n.client.end(),n.client.removeAllListeners(),delete n.client,n.client=Primus.connect(n.urlWithSession(),n.options)):n.client&&!0===n.externalClient?(n.client.end(),n.client.open()):n.client=Primus.connect(n.urlWithSession(),n.options),n.client.once("open",function(){n.configure(function(e){n.state="connected",n.emit("connected"),"function"==typeof t&&t(null,e)})}),n.client.on("error",function(e){n.emit("error",e)}),n.client.on("reconnect",function(){n.state="connected",n.emit("reconnect")}),n.client.on("reconnecting",function(){n.emit("reconnecting"),n.state="reconnecting",n.emit("disconnected")}),n.client.on("timeout",function(){n.state="timeout",n.emit("timeout")}),n.client.on("close",function(){"disconnected"!==n.state&&(n.state="disconnected",n.emit("disconnected"))}),n.client.on("end",function(){"disconnected"!==n.state&&(n.state="disconnected",n.emit("disconnected"))}),n.client.on("data",function(e){n.handleMessage(e)})},o.prototype.urlWithSession=function(){var e,t=this,n=t.options.url;return t.options.cookieKey&&0<t.options.cookieKey.length&&((e=t.getCookie(t.options.cookieKey))&&0<e.length&&(n+="?"+t.options.cookieKey+"="+e)),n},o.prototype.getCookie=function(e){if("undefined"!=typeof document&&document.cookie){e=document.cookie.match(new RegExp(e+"=([^;]+)"));return e?e[1]:void 0}},o.prototype.configure=function(t){var n=this;n.rooms.forEach(function(e){n.send({event:"roomAdd",room:e})}),n.detailsView(function(e){return n.id=e.data.id,n.fingerprint=e.data.fingerprint,n.rooms=e.data.rooms,t(e)})},o.prototype.send=function(e,t){var n=this;n.messageId++,e.messageId=e.params?e.params.messageId||e.messageId||n.messageId:e.messageId||n.messageId,"function"==typeof t&&(n.callbacks[e.messageId]=t),n.client.write(e)},o.prototype.handleMessage=function(e){var t=this;t.emit("message",e);var n=e.messageId;"response"===e.context?("function"==typeof t.callbacks[n]&&t.callbacks[n](e),delete t.callbacks[n]):"user"===e.context?t.emit("say",e):"alert"===e.context?t.emit("alert",e):e.welcome&&"api"===e.context?(t.welcomeMessage=e.welcome,t.emit("welcome",e)):"api"===e.context&&t.emit("api",e)},o.prototype.action=function(e,t,n){n||"function"!=typeof t||(n=t,t=null),(t=t||{}).action=e,"connected"!==this.state?this.actionWeb(t,n):this.actionWebSocket(t,n)},o.prototype.actionWeb=function(e,n){var o=new XMLHttpRequest;o.onreadystatechange=function(){var t;if(4===o.readyState){if(200===o.status)t=JSON.parse(o.responseText);else try{t=JSON.parse(o.responseText)}catch(e){t={error:{statusText:o.statusText,responseText:o.responseText}}}n(t)}};var t=(e.httpMethod||"POST").toUpperCase(),r=this.options.url+this.options.apiPath+"?action="+e.action;if("GET"===t)for(var i in e)~["action","httpMethod"].indexOf(i)||(r+="&"+i+"="+e[i]);o.open(t,r,!0),o.setRequestHeader("Content-Type","application/json"),o.send(JSON.stringify(e))},o.prototype.actionWebSocket=function(e,t){this.send({event:"action",params:e},t)},o.prototype.say=function(e,t,n){this.send({event:"say",room:e,message:t},n)},o.prototype.file=function(e,t){this.send({event:"file",file:e},t)},o.prototype.detailsView=function(e){this.send({event:"detailsView"},e)},o.prototype.roomView=function(e,t){this.send({event:"roomView",room:e},t)},o.prototype.roomAdd=function(e,t){var n=this;n.send({event:"roomAdd",room:e},function(e){n.configure(function(){"function"==typeof t&&t(e)})})},o.prototype.roomLeave=function(e,t){var n=this,o=n.rooms.indexOf(e);-1<o&&n.rooms.splice(o,1),this.send({event:"roomLeave",room:e},function(e){n.configure(function(){"function"==typeof t&&t(e)})})},o.prototype.documentation=function(e){this.send({event:"documentation"},e)},o.prototype.disconnect=function(){this.state="disconnected",this.client.end(),this.emit("disconnected")},e.ActionheroWebsocketClient=o=o,e.ActionheroWebsocketClient=o}("undefined"==typeof exports?window:exports);