text: /*! hellojs v1.7.1 | (c) 2012-2015 Andrew Dodson | MIT https://adodson.com/hello.js/LICENSE */
  Object.create||(Object.create=function(){function e(){}return function(t){if(1!=arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return e.prototype=t,new e}}()),Object.keys||(Object.keys=function(e,t,n){n=[];for(t in e)n.hasOwnProperty.call(e,t)&&n.push(t);return n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(e){if(void 0===this||null===this)throw new TypeError;var t=Object(this),n=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var r=arguments.length>=2?arguments[1]:void 0,o=0;n>o;o++)o in t&&e.call(r,t[o],o,t);return this}),Array.prototype.filter||(Array.prototype.filter=function(e,t){var n=[];return this.forEach(function(r,o,i){e.call(t||void 0,r,o,i)&&n.push(r)}),n}),Array.prototype.map||(Array.prototype.map=function(e,t){var n=[];return this.forEach(function(r,o,i){n.push(e.call(t||void 0,r,o,i))}),n}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),"object"!=typeof window||"object"!=typeof window.location||window.location.assign||(window.location.assign=function(e){window.location=e}),Function.prototype.bind||(Function.prototype.bind=function(e){function t(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var n=[].slice,r=n.call(arguments,1),o=this,i=function(){return o.apply(this instanceof t?this:e||window,r.concat(n.call(arguments)))};return t.prototype=this.prototype,i.prototype=new t,i});var hello=function(e){return hello.use(e)};hello.utils={extend:function(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(e instanceof Object&&t instanceof Object&&e!==t)for(var n in t)e[n]=hello.utils.extend(e[n],t[n]);else e=t}),e}},hello.utils.extend(hello,{settings:{redirect_uri:window.location.href.split("#")[0],response_type:"token",display:"popup",state:"",oauth_proxy:"https://auth-server.herokuapp.com/proxy",timeout:2e4,popup:{resizeable:!0,scrollbars:1},default_service:null,force:null,page_uri:window.location.href},services:{},use:function(e){var t=Object.create(this);return t.settings=Object.create(this.settings),e&&(t.settings.default_service=e),t.utils.Event.call(t),t},init:function(e,t){var n=this.utils;if(!e)return this.services;for(var r in e)e.hasOwnProperty(r)&&"object"!=typeof e[r]&&(e[r]={id:e[r]});n.extend(this.services,e);for(r in this.services)this.services.hasOwnProperty(r)&&(this.services[r].scope=this.services[r].scope||{});return t&&(n.extend(this.settings,t),"redirect_uri"in t&&(this.settings.redirect_uri=n.url(t.redirect_uri).href)),this},login:function(){function e(e,t){hello.emit(e,t)}function t(e){return e}function n(e){return!!e}var r,o=this,i=o.utils,s=i.error,a=i.Promise(),c=i.args({network:"s",options:"o",callback:"f"},arguments),l=c.options=i.merge(o.settings,c.options||{});if(l.popup=i.merge(o.settings.popup,c.options.popup||{}),c.network=c.network||o.settings.default_service,a.proxy.then(c.callback,c.callback),a.proxy.then(e.bind(this,"auth.login auth"),e.bind(this,"auth.failed auth")),"string"!=typeof c.network||!(c.network in o.services))return a.reject(s("invalid_network","The provided network was not recognized"));var u=o.services[c.network],f=i.globalEvent(function(e){var t;t=e?JSON.parse(e):s("cancelled","The authentication was not completed"),t.error?a.reject(t):(i.store(t.network,t),a.fulfill({network:t.network,authResponse:t}))}),p=i.url(l.redirect_uri).href,d=u.oauth.response_type||l.response_type;/\bcode\b/.test(d)&&!u.oauth.grant&&(d=d.replace(/\bcode\b/,"token")),c.qs={client_id:encodeURIComponent(u.id),response_type:encodeURIComponent(d),redirect_uri:encodeURIComponent(p),display:l.display,scope:"basic",state:{client_id:u.id,network:c.network,display:l.display,callback:f,state:l.state,redirect_uri:p}};var h=i.store(c.network),m=(l.scope||"").toString()+","+c.qs.scope;if(h&&"scope"in h&&h.scope instanceof String&&(m+=","+h.scope),m=m.split(/[,\s]+/),m=i.unique(m).filter(n),c.qs.state.scope=m.join(","),m=m.map(function(e){if(e in u.scope)return u.scope[e];for(var t in o.services){var n=o.services[t].scope;if(n&&e in n)return""}return e}),m=m.join(",").split(/[,\s]+/),m=i.unique(m).filter(n),c.qs.scope=m.join(u.scope_delim||","),l.force===!1&&h&&"access_token"in h&&h.access_token&&"expires"in h&&h.expires>(new Date).getTime()/1e3){var y=i.diff(h.scope||[],c.qs.state.scope||[]);if(0===y.length)return a.fulfill({unchanged:!0,network:c.network,authResponse:h}),a}if("page"===l.display&&l.page_uri&&(c.qs.state.page_uri=i.url(l.page_uri).href),"login"in u&&"function"==typeof u.login&&u.login(c),(!/\btoken\b/.test(d)||parseInt(u.oauth.version,10)<2||"none"===l.display&&u.oauth.grant&&h&&h.refresh_token)&&(c.qs.state.oauth=u.oauth,c.qs.state.oauth_proxy=l.oauth_proxy),c.qs.state=encodeURIComponent(JSON.stringify(c.qs.state)),1===parseInt(u.oauth.version,10)?r=i.qs(l.oauth_proxy,c.qs,t):"none"===l.display&&u.oauth.grant&&h&&h.refresh_token?(c.qs.refresh_token=h.refresh_token,r=i.qs(l.oauth_proxy,c.qs,t)):r=i.qs(u.oauth.auth,c.qs,t),"none"===l.display)i.iframe(r);else if("popup"===l.display)var v=i.popup(r,p,l.popup),g=setInterval(function(){if((!v||v.closed)&&(clearInterval(g),!a.state)){var e=s("cancelled","Login has been cancelled");v||(e=s("blocked","Popup was blocked")),e.network=c.network,a.reject(e)}},100);else window.location=r;return a.proxy},logout:function(){function e(e,t){hello.emit(e,t)}var t=this,n=t.utils,r=n.error,o=n.Promise(),i=n.args({name:"s",options:"o",callback:"f"},arguments);if(i.options=i.options||{},o.proxy.then(i.callback,i.callback),o.proxy.then(e.bind(this,"auth.logout auth"),e.bind(this,"error")),i.name=i.name||this.settings.default_service,!i.name||i.name in t.services)if(i.name&&n.store(i.name)){var s=function(e){n.store(i.name,""),o.fulfill(hello.utils.merge({network:i.name},e||{}))},a={};if(i.options.force){var c=t.services[i.name].logout;if(c)if("function"==typeof c&&(c=c(s)),"string"==typeof c)n.iframe(c),a.force=null,a.message="Logout success on providers site was indeterminate";else if(void 0===c)return o.proxy}s(a)}else o.reject(r("invalid_session","There was no session to remove"));else o.reject(r("invalid_network","The network was unrecognized"));return o.proxy},getAuthResponse:function(e){return e=e||this.settings.default_service,e&&e in this.services?this.utils.store(e)||null:null},events:{}}),hello.utils.extend(hello.utils,{error:function(e,t){return{error:{code:e,message:t}}},qs:function(e,t,n){if(t){var r;for(var o in t)if(e.indexOf(o)>-1){var i="[\\?\\&]"+o+"=[^\\&]*";r=new RegExp(i),e=e.replace(r,"")}}return e+(this.isEmpty(t)?"":(e.indexOf("?")>-1?"&":"?")+this.param(t,n))},param:function(e,t){var n,r,o={};if("string"==typeof e){if(t=t||decodeURIComponent,r=e.replace(/^[\#\?]/,"").match(/([^=\/\&]+)=([^\&]+)/g))for(var i=0;i<r.length;i++)n=r[i].match(/([^=]+)=(.*)/),o[n[1]]=t(n[2]);return o}t=t||encodeURIComponent;var s=e;o=[];for(var a in s)s.hasOwnProperty(a)&&s.hasOwnProperty(a)&&o.push([a,"?"===s[a]?"?":t(s[a])].join("="));return o.join("&")},store:function(e){function t(){var t={};try{t=JSON.parse(e.getItem("hello"))||{}}catch(n){}return t}function n(t){e.setItem("hello",JSON.stringify(t))}var r=[e,window.sessionStorage],o=0;for(e=r[o++];e;)try{e.setItem(o,o),e.removeItem(o);break}catch(i){e=r[o++]}return e||(e={getItem:function(e){e+="=";for(var t=document.cookie.split(";"),n=0;n<t.length;n++){var r=t[n].replace(/(^\s+|\s+$)/,"");if(r&&0===r.indexOf(e))return r.substr(e.length)}return null},setItem:function(e,t){document.cookie=e+"="+t}}),function(e,r,o){var i=t();if(e&&void 0===r)return i[e]||null;if(e&&null===r)try{delete i[e]}catch(s){i[e]=null}else{if(!e)return i;i[e]=r}return n(i),i||null}}(window.localStorage),append:function(e,t,n){var r="string"==typeof e?document.createElement(e):e;if("object"==typeof t)if("tagName"in t)n=t;else for(var o in t)if(t.hasOwnProperty(o))if("object"==typeof t[o])for(var i in t[o])t[o].hasOwnProperty(i)&&(r[o][i]=t[o][i]);else"html"===o?r.innerHTML=t[o]:/^on/.test(o)?r[o]=t[o]:r.setAttribute(o,t[o]);return"body"===n?!function s(){document.body?document.body.appendChild(r):setTimeout(s,16)}():"object"==typeof n?n.appendChild(r):"string"==typeof n&&document.getElementsByTagName(n)[0].appendChild(r),r},iframe:function(e){this.append("iframe",{src:e,style:{position:"absolute",left:"-1000px",bottom:0,height:"1px",width:"1px"}},"body")},merge:function(){var e=Array.prototype.slice.call(arguments);return e.unshift({}),this.extend.apply(null,e)},args:function(e,t){var n={},r=0,o=null,i=null;for(i in e)if(e.hasOwnProperty(i))break;if(1===t.length&&"object"==typeof t[0]&&"o!"!=e[i])for(i in t[0])if(e.hasOwnProperty(i)&&i in e)return t[0];for(i in e)if(e.hasOwnProperty(i))if(o=typeof t[r],"function"==typeof e[i]&&e[i].test(t[r])||"string"==typeof e[i]&&(e[i].indexOf("s")>-1&&"string"===o||e[i].indexOf("o")>-1&&"object"===o||e[i].indexOf("i")>-1&&"number"===o||e[i].indexOf("a")>-1&&"object"===o||e[i].indexOf("f")>-1&&"function"===o))n[i]=t[r++];else if("string"==typeof e[i]&&e[i].indexOf("!")>-1)return!1;return n},url:function(e){if(e){if(window.URL&&URL instanceof Function&&0!==URL.length)return new URL(e,window.location);var t=document.createElement("a");return t.href=e,t}return window.location},diff:function(e,t){return t.filter(function(t){return-1===e.indexOf(t)})},unique:function(e){return Array.isArray(e)?e.filter(function(t,n){return e.indexOf(t)===n}):[]},isEmpty:function(e){if(!e)return!0;if(Array.isArray(e))return!e.length;if("object"==typeof e)for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},Promise:function(){var e=0,t=1,n=2,r=function(t){return this instanceof r?(this.id="Thenable/1.0.6",this.state=e,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},void("function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this)))):new r(t)};r.prototype={fulfill:function(e){return o(this,t,"fulfillValue",e)},reject:function(e){return o(this,n,"rejectReason",e)},then:function(e,t){var n=this,o=new r;return n.onFulfilled.push(a(e,o,"fulfill")),n.onRejected.push(a(t,o,"reject")),i(n),o.proxy}};var o=function(t,n,r,o){return t.state===e&&(t.state=n,t[r]=o,i(t)),t},i=function(e){e.state===t?s(e,"onFulfilled",e.fulfillValue):e.state===n&&s(e,"onRejected",e.rejectReason)},s=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var o=function(){for(var e=0;e<r.length;e++)r[e](n)};"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick(o):"function"==typeof setImmediate?setImmediate(o):setTimeout(o,0)}},a=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var o;try{o=e(r)}catch(i){return void t.reject(i)}c(t,o)}}},c=function(e,t){if(e===t||e.proxy===t)return void e.reject(new TypeError("cannot resolve promise with itself"));var n;if("object"==typeof t&&null!==t||"function"==typeof t)try{n=t.then}catch(r){return void e.reject(r)}if("function"!=typeof n)e.fulfill(t);else{var o=!1;try{n.call(t,function(n){o||(o=!0,n===t?e.reject(new TypeError("circular thenable chain")):c(e,n))},function(t){o||(o=!0,e.reject(t))})}catch(r){o||e.reject(r)}}};return r}(),Event:function(){var e=/[\s\,]+/;return this.parent={events:this.events,findEvents:this.findEvents,parent:this.parent,utils:this.utils},this.events={},this.on=function(t,n){if(n&&"function"==typeof n)for(var r=t.split(e),o=0;o<r.length;o++)this.events[r[o]]=[n].concat(this.events[r[o]]||[]);return this},this.off=function(e,t){return this.findEvents(e,function(e,n){t&&this.events[e][n]!==t||(this.events[e][n]=null)}),this},this.emit=function(e){var t=Array.prototype.slice.call(arguments,1);t.push(e);for(var n=function(n,r){t[t.length-1]="*"===n?e:n,this.events[n][r].apply(this,t)},r=this;r&&r.findEvents;)r.findEvents(e+",*",n),r=r.parent;return this},this.emitAfter=function(){var e=this,t=arguments;return setTimeout(function(){e.emit.apply(e,t)},0),this},this.findEvents=function(t,n){var r=t.split(e);for(var o in this.events)if(this.events.hasOwnProperty(o)&&r.indexOf(o)>-1)for(var i=0;i<this.events[o].length;i++)this.events[o][i]&&n.call(this,o,i)},this},globalEvent:function(e,t){return t=t||"_hellojs_"+parseInt(1e12*Math.random(),10).toString(36),window[t]=function(){try{bool=e.apply(this,arguments)}catch(n){console.error(n)}if(bool)try{delete window[t]}catch(n){}},t},popup:function(e,t,n){n.width=n.width||500,n.height=n.height||550;var r=document.documentElement,o=void 0!==window.screenLeft?window.screenLeft:screen.left,i=void 0!==window.screenTop?window.screenTop:screen.top,s=screen.width||window.innerWidth||r.clientWidth,a=screen.height||window.innerHeight||r.clientHeight;n.left=parseInt((s-n.width)/2,10)+o,n.top=parseInt((a-n.height)/2,10)+i;var c=[];Object.keys(n).forEach(function(e){var t=n[e];c.push(e+(null!==t?"="+t:""))});var l=function(e){var n=window.open(e,"_blank",c.join(","));if(n&&n.addEventListener){var r=hello.utils.url(t),o=r.origin||r.protocol+"//"+r.hostname;n.addEventListener("loadstart",function(e){var t=e.url;if(0===t.indexOf(o)){var r=hello.utils.url(t),i={location:{assign:function(e){n.addEventListener("exit",function(){setTimeout(function(){l(e)},1e3)})},search:r.search,hash:r.hash,href:r.href},close:function(){n.close&&n.close()}};hello.utils.responseHandler(i,window),i.close()}})}return n&&n.focus&&n.focus(),n};return-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")&&(e=t+"#oauth_redirect="+encodeURIComponent(encodeURIComponent(e))),l(e)},responseHandler:function(e,t){function n(e,t,n){if(i.store(e.network,e),!("display"in e&&"page"===e.display)){if(n){var o=e.callback;try{delete e.callback}catch(s){}if(i.store(e.network,e),o in n){var a=JSON.stringify(e);try{n[o](a)}catch(s){}}}r()}}function r(){try{e.close()}catch(t){}e.addEventListener&&e.addEventListener("load",function(){e.close()})}var o,i=this,s=e.location;if(o=i.param(s.search),o&&o.state&&(o.code||o.oauth_token)){var a=JSON.parse(o.state);o.redirect_uri=a.redirect_uri||s.href.replace(/[\?\#].*$/,"");var c=a.oauth_proxy+"?"+i.param(o);return void s.assign(c)}if(o=i.merge(i.param(s.search||""),i.param(s.hash||"")),o&&"state"in o){try{var l=JSON.parse(o.state);i.extend(o,l)}catch(u){console.error("Could not decode state parameter")}if("access_token"in o&&o.access_token&&o.network)o.expires_in&&0!==parseInt(o.expires_in,10)||(o.expires_in=0),o.expires_in=parseInt(o.expires_in,10),o.expires=(new Date).getTime()/1e3+(o.expires_in||31536e3),n(o,e,t);else if("error"in o&&o.error&&o.network)o.error={code:o.error,message:o.error_message||o.error_description},n(o,e,t);else if(o.callback&&o.callback in t){var f="result"in o&&o.result?JSON.parse(o.result):!1;t[o.callback](f),r()}o.page_uri&&s.assign(o.page_uri)}else if("oauth_redirect"in o)return void s.assign(decodeURIComponent(o.oauth_redirect))}}),hello.utils.Event.call(hello),hello.utils.responseHandler(window,window.opener||window.parent),function(e){var t={},n={};e.on("auth.login, auth.logout",function(n){n&&"object"==typeof n&&n.network&&(t[n.network]=e.utils.store(n.network)||{})}),function r(){var o=(new Date).getTime()/1e3,i=function(t){e.emit("auth."+t,{network:s,authResponse:a})};for(var s in e.services)if(e.services.hasOwnProperty(s)){if(!e.services[s].id)continue;var a=e.utils.store(s)||{},c=e.services[s],l=t[s]||{};if(a&&"callback"in a){var u=a.callback;try{delete a.callback}catch(f){}e.utils.store(s,a);try{window[u](a)}catch(f){}}if(a&&"expires"in a&&a.expires<o){var p=c.refresh||a.refresh_token;!p||s in n&&!(n[s]<o)?p||s in n||(i("expired"),n[s]=!0):(e.emit("notice",s+" has expired trying to resignin"),e.login(s,{display:"none",force:!1}),n[s]=o+600);continue}if(l.access_token===a.access_token&&l.expires===a.expires)continue;!a.access_token&&l.access_token?i("logout"):a.access_token&&!l.access_token?i("login"):a.expires!==l.expires&&i("update"),t[s]=a,s in n&&delete n[s]}setTimeout(r,1e3)}()}(hello),hello.api=function(){function e(e){e=e.replace(/\@\{([a-z\_\-]+)(\|.*?)?\}/gi,function(e,t,n){var s=n?n.replace(/^\|/,""):"";return t in i.query?(s=i.query[t],delete i.query[t]):n||o.reject(r("missing_attribute","The attribute "+t+" is missing from the request")),s}),e.match(/^https?:\/\//)||(e=l.base+e),i.url=e,n.request(i,function(e,t){if(e===!0?e={success:!0}:e||(e={}),"delete"===i.method&&(e=!e||n.isEmpty(e)?{success:!0}:e),l.wrap&&(i.path in l.wrap||"default"in l.wrap)){var r=i.path in l.wrap?i.path:"default",s=((new Date).getTime(),l.wrap[r](e,t,i));s&&(e=s)}e&&"paging"in e&&e.paging.next&&("?"===e.paging.next[0]?e.paging.next=i.path+e.paging.next:e.paging.next+="#"+i.path),!e||"error"in e?o.reject(e):o.fulfill(e)})}var t=this,n=t.utils,r=n.error,o=n.Promise(),i=n.args({path:"s!",query:"o",method:"s",data:"o",timeout:"i",callback:"f"},arguments);i.method=(i.method||"get").toLowerCase(),i.headers=i.headers||{},i.query=i.query||{},("get"===i.method||"delete"===i.method)&&(n.extend(i.query,i.data),i.data={});var s=i.data=i.data||{};if(o.then(i.callback,i.callback),!i.path)return o.reject(r("invalid_path","Missing the path parameter from the request"));i.path=i.path.replace(/^\/+/,"");var a=(i.path.split(/[\/\:]/,2)||[])[0].toLowerCase();if(a in t.services){i.network=a;var c=new RegExp("^"+a+":?/?");i.path=i.path.replace(c,"")}i.network=t.settings.default_service=i.network||t.settings.default_service;var l=t.services[i.network];if(!l)return o.reject(r("invalid_network","Could not match the service requested: "+i.network));if(i.method in l&&i.path in l[i.method]&&l[i.method][i.path]===!1)return o.reject(r("invalid_path","The provided path is not available on the selected network"));i.oauth_proxy||(i.oauth_proxy=t.settings.oauth_proxy),"proxy"in i||(i.proxy=i.oauth_proxy&&l.oauth&&1===parseInt(l.oauth.version,10)),"timeout"in i||(i.timeout=t.settings.timeout);var u=t.getAuthResponse(i.network);u&&u.access_token&&(i.query.access_token=u.access_token);var f,p=i.path;i.options=n.clone(i.query),i.data=n.clone(s);var d=l[{"delete":"del"}[i.method]||i.method]||{};if("get"===i.method){var h=p.split(/[\?#]/)[1];h&&(n.extend(i.query,n.param(h)),p=p.replace(/\?.*?(#|$)/,"$1"))}return(f=p.match(/#(.+)/,""))?(p=p.split("#")[0],i.path=f[1]):p in d?(i.path=p,p=d[p]):"default"in d&&(p=d["default"]),i.redirect_uri=t.settings.redirect_uri,i.oauth=l.oauth,i.xhr=l.xhr,i.jsonp=l.jsonp,i.form=l.form,"function"==typeof p?p(i,e):e(p),o.proxy},hello.utils.extend(hello.utils,{request:function(e,t){function n(e,t){var n;e.oauth&&1===parseInt(e.oauth.version,10)&&(n=e.query.access_token,delete e.query.access_token,e.proxy=!0),!e.data||"get"!==e.method&&"delete"!==e.method||(r.extend(e.query,e.data),e.data=null);var o=r.qs(e.url,e.query);e.proxy&&(o=r.qs(e.oauth_proxy,{path:o,access_token:n||"",then:e.proxy_response_type||("get"===e.method.toLowerCase()?"redirect":"proxy"),method:e.method.toLowerCase(),suppress_response_codes:!0})),t(o)}var r=this,o=r.error;if(r.isEmpty(e.data)||"FileList"in window||!r.hasBinary(e.data)||(e.xhr=!1,e.jsonp=!1),"withCredentials"in new XMLHttpRequest&&(!("xhr"in e)||e.xhr&&("function"!=typeof e.xhr||e.xhr(e,e.query))))return void n(e,function(n){var o=r.xhr(e.method,n,e.headers,e.data,t);o.onprogress=e.onprogress||null,o.upload&&e.onuploadprogress&&(o.upload.onprogress=e.onuploadprogress)});var i=e.query;if(e.query=r.clone(e.query),e.callbackID=r.globalEvent(),e.jsonp!==!1){if(e.query.callback=e.callbackID,"function"==typeof e.jsonp&&e.jsonp(e,e.query),"get"===e.method)return void n(e,function(n){r.jsonp(n,t,e.callbackID,e.timeout)});e.query=i}if(e.form!==!1){e.query.redirect_uri=e.redirect_uri,e.query.state=JSON.stringify({callback:e.callbackID});var s;if("function"==typeof e.form&&(s=e.form(e,e.query)),"post"===e.method&&s!==!1)return void n(e,function(n){r.post(n,e.data,s,t,e.callbackID,e.timeout)})}t(o("invalid_request","There was no mechanism for handling this request"))},domInstance:function(e,t){var n="HTML"+(e||"").replace(/^[a-z]/,function(e){return e.toUpperCase()})+"Element";return t?window[n]?t instanceof window[n]:window.Element?t instanceof window.Element&&(!e||t.tagName&&t.tagName.toLowerCase()===e):!(t instanceof Object||t instanceof Array||t instanceof String||t instanceof Number)&&t.tagName&&t.tagName.toLowerCase()===e:!1},clone:function(e){if(null===e||"object"!=typeof e||e instanceof Date||"nodeName"in e||this.isBinary(e))return e;if(Array.isArray(e))return e.map(this.clone);var t={};for(var n in e)t[n]=this.clone(e[n]);return t},xhr:function(e,t,n,r,o){function i(e){for(var t,n={},r=/([a-z\-]+):\s?(.*);?/gi;t=r.exec(e);)n[t[1]]=t[2];return n}var s=new XMLHttpRequest,a=this.error,c=!1;"blob"===e&&(c=e,e="GET"),e=e.toUpperCase(),s.onload=function(t){var n=s.response;try{n=JSON.parse(s.responseText)}catch(r){401===s.status&&(n=a("access_denied",s.statusText))}var c=i(s.getAllResponseHeaders());c.statusCode=s.status,o(n||("GET"===e?a("empty_response","Could not get resource"):{}),c)},s.onerror=function(e){var t=s.responseText;try{t=JSON.parse(s.responseText)}catch(n){}o(t||a("access_denied","Could not get resource"))};var l;if("GET"===e||"DELETE"===e)r=null;else if(!(!r||"string"==typeof r||r instanceof FormData||r instanceof File||r instanceof Blob)){var u=new FormData;for(l in r)r.hasOwnProperty(l)&&(r[l]instanceof HTMLInputElement?"files"in r[l]&&r[l].files.length>0&&u.append(l,r[l].files[0]):r[l]instanceof Blob?u.append(l,r[l],r.name):u.append(l,r[l]));r=u}if(s.open(e,t,!0),c&&("responseType"in s?s.responseType=c:s.overrideMimeType("text/plain; charset=x-user-defined")),n)for(l in n)s.setRequestHeader(l,n[l]);return s.send(r),s},jsonp:function(e,t,n,r){var o,i=this,s=i.error,a=0,c=document.getElementsByTagName("head")[0],l=s("server_error","server_error"),u=function(){a++||window.setTimeout(function(){t(l),c.removeChild(f)},0)};n=i.globalEvent(function(e){return l=e,!0},n),e=e.replace(new RegExp("=\\?(&|$)"),"="+n+"$1");var f=i.append("script",{id:n,name:n,src:e,async:!0,onload:u,onerror:u,onreadystatechange:function(){/loaded|complete/i.test(this.readyState)&&u()}});window.navigator.userAgent.toLowerCase().indexOf("opera")>-1&&(o=i.append("script",{text:"document.getElementById('"+callbackId+"').onerror();"}),f.async=!1),r&&window.setTimeout(function(){l=s("timeout","timeout"),u()},r),c.appendChild(f),o&&c.appendChild(o)},post:function(e,t,n,r,o,i){var s,a=this,c=a.error,l=document,u=null,f=[],p=0,d=null,h=0,m=function(e){h++||r(e)};a.globalEvent(m,o);var y;try{y=l.createElement('<iframe name="'+o+'">')}catch(v){y=l.createElement("iframe")}if(y.name=o,y.id=o,y.style.display="none",n&&n.callbackonload&&(y.onload=function(){m({response:"posted",message:"Content was posted"})}),i&&setTimeout(function(){m(c("timeout","The post operation timed out"))},i),l.body.appendChild(y),a.domInstance("form",t)){for(u=t.form,p=0;p<u.elements.length;p++)u.elements[p]!==t&&u.elements[p].setAttribute("disabled",!0);t=u}if(a.domInstance("form",t))for(u=t,p=0;p<u.elements.length;p++)u.elements[p].disabled||"file"!==u.elements[p].type||(u.encoding=u.enctype="multipart/form-data",u.elements[p].setAttribute("name","file"));else{for(d in t)t.hasOwnProperty(d)&&a.domInstance("input",t[d])&&"file"===t[d].type&&(u=t[d].form,u.encoding=u.enctype="multipart/form-data");u||(u=l.createElement("form"),l.body.appendChild(u),s=u);var g;for(d in t)if(t.hasOwnProperty(d)){var w=a.domInstance("input",t[d])||a.domInstance("textArea",t[d])||a.domInstance("select",t[d]);if(w&&t[d].form===u)w&&t[d].name!==d&&(t[d].setAttribute("name",d),t[d].name=d);else{var b=u.elements[d];if(g)for(b instanceof NodeList||(b=[b]),p=0;p<b.length;p++)b[p].parentNode.removeChild(b[p]);g=l.createElement("input"),g.setAttribute("type","hidden"),g.setAttribute("name",d),g.value=w?t[d].value:a.domInstance(null,t[d])?t[d].innerHTML||t[d].innerText:t[d],u.appendChild(g)}}for(p=0;p<u.elements.length;p++)g=u.elements[p],g.name in t||g.getAttribute("disabled")===!0||(g.setAttribute("disabled",!0),f.push(g))}u.setAttribute("method","POST"),u.setAttribute("target",o),u.target=o,u.setAttribute("action",e),setTimeout(function(){u.submit(),setTimeout(function(){try{s&&s.parentNode.removeChild(s)}catch(e){try{console.error("HelloJS: could not remove iframe")}catch(t){}}for(var n=0;n<f.length;n++)f[n]&&(f[n].setAttribute("disabled",!1),f[n].disabled=!1)},0)},100)},hasBinary:function(e){for(var t in e)if(e.hasOwnProperty(t)&&this.isBinary(e[t]))return!0;return!1},isBinary:function(e){return e instanceof Object&&(this.domInstance("input",e)&&"file"===e.type||"FileList"in window&&e instanceof window.FileList||"File"in window&&e instanceof window.File||"Blob"in window&&e instanceof window.Blob)},toBlob:function(e){var t=/^data\:([^;,]+(\;charset=[^;,]+)?)(\;base64)?,/i,n=e.match(t);if(!n)return e;for(var r=atob(e.replace(t,"")),o=[],i=0;i<r.length;i++)o.push(r.charCodeAt(i));return new Blob([new Uint8Array(o)],{type:n[1]})}}),function(e){var t=e.api,n=e.utils;n.extend(n,{dataToJSON:function(e){var t=this,n=window,r=e.data;if(t.domInstance("form",r)?r=t.nodeListToJSON(r.elements):"NodeList"in n&&r instanceof NodeList?r=t.nodeListToJSON(r):t.domInstance("input",r)&&(r=t.nodeListToJSON([r])),("File"in n&&r instanceof n.File||"Blob"in n&&r instanceof n.Blob||"FileList"in n&&r instanceof n.FileList)&&(r={file:r}),!("FormData"in n&&r instanceof n.FormData))for(var o in r)if(r.hasOwnProperty(o))if("FileList"in n&&r[o]instanceof n.FileList)1===r[o].length&&(r[o]=r[o][0]);else{if(t.domInstance("input",r[o])&&"file"===r[o].type)continue;t.domInstance("input",r[o])||t.domInstance("select",r[o])||t.domInstance("textArea",r[o])?r[o]=r[o].value:t.domInstance(null,r[o])&&(r[o]=r[o].innerHTML||r[o].innerText)}return e.data=r,r},nodeListToJSON:function(e){for(var t={},n=0;n<e.length;n++){var r=e[n];!r.disabled&&r.name&&(t[r.name]="file"===r.type?r:r.value||r.innerHTML)}return t}}),e.api=function(){var e=n.args({path:"s!",method:"s",data:"o",timeout:"i",callback:"f"},arguments);return e.data&&n.dataToJSON(e),t.call(this,e)}}(hello),"function"==typeof define&&define.amd&&define(function(){return hello}),"object"==typeof module&&module.exports&&(module.exports=hello);