@skilltree/skills-client-js
Version:
SkillTree Client Lib - Native JS Lib
6 lines • 129 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).SkillsClient={})}(this,function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,i={exports:{}},o=i.exports;
/*!
* js-logger - http://github.com/jonnyreeves/js-logger
* Jonny Reeves, http://jonnyreeves.co.uk/
* js-logger may be freely distributed under the MIT license.
*/var s,a,c,l,u,h,d=(r||(r=1,function(e){!function(t){var n,r={VERSION:"1.6.1"},i={},o=function(e,t){return function(){return t.apply(e,arguments)}},s=function(){var e,t,n=arguments,r=n[0];for(t=1;t<n.length;t++)for(e in n[t])!(e in r)&&n[t].hasOwnProperty(e)&&(r[e]=n[t][e]);return r},a=function(e,t){return{value:e,name:t}};r.TRACE=a(1,"TRACE"),r.DEBUG=a(2,"DEBUG"),r.INFO=a(3,"INFO"),r.TIME=a(4,"TIME"),r.WARN=a(5,"WARN"),r.ERROR=a(8,"ERROR"),r.OFF=a(99,"OFF");var c=function(e){this.context=e,this.setLevel(e.filterLevel),this.log=this.info};c.prototype={setLevel:function(e){e&&"value"in e&&(this.context.filterLevel=e)},getLevel:function(){return this.context.filterLevel},enabledFor:function(e){var t=this.context.filterLevel;return e.value>=t.value},trace:function(){this.invoke(r.TRACE,arguments)},debug:function(){this.invoke(r.DEBUG,arguments)},info:function(){this.invoke(r.INFO,arguments)},warn:function(){this.invoke(r.WARN,arguments)},error:function(){this.invoke(r.ERROR,arguments)},time:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"start"])},timeEnd:function(e){"string"==typeof e&&e.length>0&&this.invoke(r.TIME,[e,"end"])},invoke:function(e,t){n&&this.enabledFor(e)&&n(t,s({level:e},this.context))}};var l,u=new c({filterLevel:r.OFF});(l=r).enabledFor=o(u,u.enabledFor),l.trace=o(u,u.trace),l.debug=o(u,u.debug),l.time=o(u,u.time),l.timeEnd=o(u,u.timeEnd),l.info=o(u,u.info),l.warn=o(u,u.warn),l.error=o(u,u.error),l.log=l.info,r.setHandler=function(e){n=e},r.setLevel=function(e){for(var t in u.setLevel(e),i)i.hasOwnProperty(t)&&i[t].setLevel(e)},r.getLevel=function(){return u.getLevel()},r.get=function(e){return i[e]||(i[e]=new c(s({name:e},u.context)))},r.createDefaultHandler=function(e){(e=e||{}).formatter=e.formatter||function(e,t){t.name&&e.unshift("["+t.name+"]")};var t={},n=function(e,t){Function.prototype.apply.call(e,console,t)};return"undefined"==typeof console?function(){}:function(i,o){i=Array.prototype.slice.call(i);var s,a=console.log;o.level===r.TIME?(s=(o.name?"["+o.name+"] ":"")+i[0],"start"===i[1]?console.time?console.time(s):t[s]=(new Date).getTime():console.timeEnd?console.timeEnd(s):n(a,[s+": "+((new Date).getTime()-t[s])+"ms"])):(o.level===r.WARN&&console.warn?a=console.warn:o.level===r.ERROR&&console.error?a=console.error:o.level===r.INFO&&console.info?a=console.info:o.level===r.DEBUG&&console.debug?a=console.debug:o.level===r.TRACE&&console.trace&&(a=console.trace),e.formatter(i,o),n(a,i))}},r.useDefaults=function(e){r.setLevel(e&&e.defaultLevel||r.DEBUG),r.setHandler(r.createDefaultHandler(e))},r.setDefaults=r.useDefaults,e.exports?e.exports=r:(r._prevLogger=t.Logger,r.noConflict=function(){return t.Logger=r._prevLogger,r},t.Logger=r)}(o)}(i)),i.exports),p=n(d),f={exports:{}},m={};function g(){if(c)return a;c=1;var e=(s||(s=1,t.crypto&&t.crypto.getRandomValues?m.randomBytes=function(e){var n=new Uint8Array(e);return t.crypto.getRandomValues(n),n}:m.randomBytes=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t}),m),n="abcdefghijklmnopqrstuvwxyz012345";return a={string:function(t){for(var r=e.randomBytes(t),i=[],o=0;o<t;o++)i.push(n.substr(r[o]%32,1));return i.join("")},number:function(e){return Math.floor(Math.random()*e)},numberString:function(e){var t=(""+(e-1)).length;return(new Array(t+1).join("0")+this.number(e)).slice(-t)}}}function y(){return l||(l=1,function(e){var n=g(),r={},i=!1,o=t.chrome&&t.chrome.app&&t.chrome.app.runtime;e.exports={attachEvent:function(e,n){void 0!==t.addEventListener?t.addEventListener(e,n,!1):t.document&&t.attachEvent&&(t.document.attachEvent("on"+e,n),t.attachEvent("on"+e,n))},detachEvent:function(e,n){void 0!==t.addEventListener?t.removeEventListener(e,n,!1):t.document&&t.detachEvent&&(t.document.detachEvent("on"+e,n),t.detachEvent("on"+e,n))},unloadAdd:function(e){if(o)return null;var t=n.string(8);return r[t]=e,i&&setTimeout(this.triggerUnloadCallbacks,0),t},unloadDel:function(e){e in r&&delete r[e]},triggerUnloadCallbacks:function(){for(var e in r)r[e](),delete r[e]}};o||e.exports.attachEvent("unload",function(){i||(i=!0,e.exports.triggerUnloadCallbacks())})}(f)),f.exports}var b,v,w,S,_,k={};function E(){if(w)return v;w=1;var e=h?u:(h=1,u=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}),n=function(){if(b)return k;b=1;var e=Object.prototype.hasOwnProperty;function t(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function n(e){try{return encodeURIComponent(e)}catch(e){return null}}return k.stringify=function(t,r){r=r||"";var i,o,s=[];for(o in"string"!=typeof r&&(r="?"),t)if(e.call(t,o)){if((i=t[o])||null!=i&&!isNaN(i)||(i=""),o=n(o),i=n(i),null===o||null===i)continue;s.push(o+"="+i)}return s.length?r+s.join("&"):""},k.parse=function(e){for(var n,r=/([^=?#&]+)=?([^&]*)/g,i={};n=r.exec(e);){var o=t(n[1]),s=t(n[2]);null===o||null===s||o in i||(i[o]=s)}return i},k}(),r=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,i=/[\n\r\t]/g,o=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/:\d+$/,a=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,c=/^[a-zA-Z]:/;function l(e){return(e||"").toString().replace(r,"")}var d=[["#","hash"],["?","query"],function(e,t){return m(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],p={hash:1,query:1};function f(e){var n,r=("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{}).location||{},i={},s=typeof(e=e||r);if("blob:"===e.protocol)i=new y(unescape(e.pathname),{});else if("string"===s)for(n in i=new y(e,{}),p)delete i[n];else if("object"===s){for(n in e)n in p||(i[n]=e[n]);void 0===i.slashes&&(i.slashes=o.test(e.href))}return i}function m(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function g(e,t){e=(e=l(e)).replace(i,""),t=t||{};var n,r=a.exec(e),o=r[1]?r[1].toLowerCase():"",s=!!r[2],c=!!r[3],u=0;return s?c?(n=r[2]+r[3]+r[4],u=r[2].length+r[3].length):(n=r[2]+r[4],u=r[2].length):c?(n=r[3]+r[4],u=r[3].length):n=r[4],"file:"===o?u>=2&&(n=n.slice(2)):m(o)?n=r[4]:o?s&&(n=n.slice(2)):u>=2&&m(t.protocol)&&(n=r[4]),{protocol:o,slashes:s||m(o),slashesCount:u,rest:n}}function y(t,r,o){if(t=(t=l(t)).replace(i,""),!(this instanceof y))return new y(t,r,o);var s,a,u,h,p,b,v=d.slice(),w=typeof r,S=this,_=0;for("object"!==w&&"string"!==w&&(o=r,r=null),o&&"function"!=typeof o&&(o=n.parse),s=!(a=g(t||"",r=f(r))).protocol&&!a.slashes,S.slashes=a.slashes||s&&r.slashes,S.protocol=a.protocol||r.protocol||"",t=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||c.test(t))||!a.slashes&&(a.protocol||a.slashesCount<2||!m(S.protocol)))&&(v[3]=[/(.*)/,"pathname"]);_<v.length;_++)"function"!=typeof(h=v[_])?(u=h[0],b=h[1],u!=u?S[b]=t:"string"==typeof u?~(p="@"===u?t.lastIndexOf(u):t.indexOf(u))&&("number"==typeof h[2]?(S[b]=t.slice(0,p),t=t.slice(p+h[2])):(S[b]=t.slice(p),t=t.slice(0,p))):(p=u.exec(t))&&(S[b]=p[1],t=t.slice(0,p.index)),S[b]=S[b]||s&&h[3]&&r[b]||"",h[4]&&(S[b]=S[b].toLowerCase())):t=h(t,S);o&&(S.query=o(S.query)),s&&r.slashes&&"/"!==S.pathname.charAt(0)&&(""!==S.pathname||""!==r.pathname)&&(S.pathname=function(e,t){if(""===e)return t;for(var n=(t||"/").split("/").slice(0,-1).concat(e.split("/")),r=n.length,i=n[r-1],o=!1,s=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),s++):s&&(0===r&&(o=!0),n.splice(r,1),s--);return o&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(S.pathname,r.pathname)),"/"!==S.pathname.charAt(0)&&m(S.protocol)&&(S.pathname="/"+S.pathname),e(S.port,S.protocol)||(S.host=S.hostname,S.port=""),S.username=S.password="",S.auth&&(~(p=S.auth.indexOf(":"))?(S.username=S.auth.slice(0,p),S.username=encodeURIComponent(decodeURIComponent(S.username)),S.password=S.auth.slice(p+1),S.password=encodeURIComponent(decodeURIComponent(S.password))):S.username=encodeURIComponent(decodeURIComponent(S.auth)),S.auth=S.password?S.username+":"+S.password:S.username),S.origin="file:"!==S.protocol&&m(S.protocol)&&S.host?S.protocol+"//"+S.host:"null",S.href=S.toString()}return y.prototype={set:function(t,r,i){var o=this;switch(t){case"query":"string"==typeof r&&r.length&&(r=(i||n.parse)(r)),o[t]=r;break;case"port":o[t]=r,e(r,o.protocol)?r&&(o.host=o.hostname+":"+r):(o.host=o.hostname,o[t]="");break;case"hostname":o[t]=r,o.port&&(r+=":"+o.port),o.host=r;break;case"host":o[t]=r,s.test(r)?(r=r.split(":"),o.port=r.pop(),o.hostname=r.join(":")):(o.hostname=r,o.port="");break;case"protocol":o.protocol=r.toLowerCase(),o.slashes=!i;break;case"pathname":case"hash":if(r){var a="pathname"===t?"/":"#";o[t]=r.charAt(0)!==a?a+r:r}else o[t]=r;break;case"username":case"password":o[t]=encodeURIComponent(r);break;case"auth":var c=r.indexOf(":");~c?(o.username=r.slice(0,c),o.username=encodeURIComponent(decodeURIComponent(o.username)),o.password=r.slice(c+1),o.password=encodeURIComponent(decodeURIComponent(o.password))):o.username=encodeURIComponent(decodeURIComponent(r))}for(var l=0;l<d.length;l++){var u=d[l];u[4]&&(o[u[1]]=o[u[1]].toLowerCase())}return o.auth=o.password?o.username+":"+o.password:o.username,o.origin="file:"!==o.protocol&&m(o.protocol)&&o.host?o.protocol+"//"+o.host:"null",o.href=o.toString(),o},toString:function(e){e&&"function"==typeof e||(e=n.stringify);var t,r=this,i=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var a=o+(r.protocol&&r.slashes||m(r.protocol)?"//":"");return r.username?(a+=r.username,r.password&&(a+=":"+r.password),a+="@"):r.password?(a+=":"+r.password,a+="@"):"file:"!==r.protocol&&m(r.protocol)&&!i&&"/"!==r.pathname&&(a+="@"),(":"===i[i.length-1]||s.test(r.hostname)&&!r.port)&&(i+=":"),a+=i+r.pathname,(t="object"==typeof r.query?e(r.query):r.query)&&(a+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(a+=r.hash),a}},y.extractProtocol=g,y.location=f,y.trimLeft=l,y.qs=n,v=y}function C(){if(_)return S;_=1;var e=E();return S={getOrigin:function(t){if(!t)return null;var n=new e(t);if("file:"===n.protocol)return null;var r=n.port;return r||(r="https:"===n.protocol?"443":"80"),n.protocol+"//"+n.hostname+":"+r},isOriginEqual:function(e,t){return this.getOrigin(e)===this.getOrigin(t)},isSchemeEqual:function(e,t){return e.split(":")[0]===t.split(":")[0]},addPath:function(e,t){var n=e.split("?");return n[0]+t+(n[1]?"?"+n[1]:"")},addQuery:function(e,t){return e+(-1===e.indexOf("?")?"?"+t:"&"+t)},isLoopbackAddr:function(e){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^\[::1\]$/.test(e)}}}var O,T={exports:{}};function R(){return O||(O=1,"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){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}),T.exports}var x,A,I,N={};function L(){if(A)return x;function e(){this._listeners={}}return A=1,e.prototype.addEventListener=function(e,t){e in this._listeners||(this._listeners[e]=[]);var n=this._listeners[e];-1===n.indexOf(t)&&(n=n.concat([t])),this._listeners[e]=n},e.prototype.removeEventListener=function(e,t){var n=this._listeners[e];if(n){var r=n.indexOf(t);-1===r||(n.length>1?this._listeners[e]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[e])}},e.prototype.dispatchEvent=function(){var e=arguments[0],t=e.type,n=1===arguments.length?[e]:Array.apply(null,arguments);if(this["on"+t]&&this["on"+t].apply(this,n),t in this._listeners)for(var r=this._listeners[t],i=0;i<r.length;i++)r[i].apply(this,n)},x=e}function U(){if(I)return N;I=1;var e=R(),t=L();function n(){t.call(this)}return e(n,t),n.prototype.removeAllListeners=function(e){e?delete this._listeners[e]:this._listeners={}},n.prototype.once=function(e,t){var n=this,r=!1;this.on(e,function i(){n.removeListener(e,i),r||(r=!0,t.apply(this,arguments))})},n.prototype.emit=function(){var e=arguments[0],t=this._listeners[e];if(t){for(var n=arguments.length,r=new Array(n-1),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=0;o<t.length;o++)t[o].apply(this,r)}},n.prototype.on=n.prototype.addListener=t.prototype.addEventListener,n.prototype.removeListener=t.prototype.removeEventListener,N.EventEmitter=n,N}var j,P,D,B,$,F,H,M,W,q,V,J,z,G,K,X,Q,Z,Y,ee,te,ne,re,ie,oe,se,ae,ce,le,ue,he,de,pe,fe,me,ge={exports:{}};function ye(){if(D)return P;D=1;var e=y(),n=C(),r=R(),i=U().EventEmitter,o=function(){if(j)return ge.exports;j=1;var e=t.WebSocket||t.MozWebSocket;return ge.exports=e?function(t){return new e(t)}:void 0,ge.exports}();function s(t,r,a){if(!s.enabled())throw new Error("Transport created when disabled");i.call(this);var c=this,l=n.addPath(t,"/websocket");l="https"===l.slice(0,5)?"wss"+l.slice(5):"ws"+l.slice(4),this.url=l,this.ws=new o(this.url,[],a),this.ws.onmessage=function(e){e.data,c.emit("message",e.data)},this.unloadRef=e.unloadAdd(function(){c.ws.close()}),this.ws.onclose=function(e){e.code,e.reason,c.emit("close",e.code,e.reason),c._cleanup()},this.ws.onerror=function(e){c.emit("close",1006,"WebSocket connection broken"),c._cleanup()}}return r(s,i),s.prototype.send=function(e){var t="["+e+"]";this.ws.send(t)},s.prototype.close=function(){var e=this.ws;this._cleanup(),e&&e.close()},s.prototype._cleanup=function(){var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),e.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},s.enabled=function(){return!!o},s.transportName="websocket",s.roundTrips=2,P=s}function be(){if(W)return M;W=1;var e=R(),t=C(),n=function(){if($)return B;$=1;var e=R(),t=U().EventEmitter;function n(e,n){t.call(this),this.sendBuffer=[],this.sender=n,this.url=e}return e(n,t),n.prototype.send=function(e){this.sendBuffer.push(e),this.sendStop||this.sendSchedule()},n.prototype.sendScheduleWait=function(){var e,t=this;this.sendStop=function(){t.sendStop=null,clearTimeout(e)},e=setTimeout(function(){t.sendStop=null,t.sendSchedule()},25)},n.prototype.sendSchedule=function(){this.sendBuffer.length;var e=this;if(this.sendBuffer.length>0){var t="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,t,function(t){e.sendStop=null,t?(e.emit("close",t.code||1006,"Sending error: "+t),e.close()):e.sendScheduleWait()}),this.sendBuffer=[]}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.close=function(){this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},B=n}(),r=function(){if(H)return F;H=1;var e=R(),t=U().EventEmitter;function n(e,n,r){t.call(this),this.Receiver=e,this.receiveUrl=n,this.AjaxObject=r,this._scheduleReceiver()}return e(n,t),n.prototype._scheduleReceiver=function(){var e=this,t=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);t.on("message",function(t){e.emit("message",t)}),t.once("close",function(n,r){e.pollIsClosing,e.poll=t=null,e.pollIsClosing||("network"===r?e._scheduleReceiver():(e.emit("close",n||1006,r),e.removeAllListeners()))})},n.prototype.abort=function(){this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},F=n}();function i(e,i,o,s,a){var c=t.addPath(e,i),l=this;n.call(this,e,o),this.poll=new r(s,c,a),this.poll.on("message",function(e){l.emit("message",e)}),this.poll.once("close",function(e,t){l.poll=null,l.emit("close",e,t),l.close()})}return e(i,n),i.prototype.close=function(){n.prototype.close.call(this),this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null)},M=i}function ve(){if(V)return q;V=1;var e=R(),t=C(),n=be();function r(e,r,i,o){n.call(this,e,r,function(e){return function(n,r,i){var o={};"string"==typeof r&&(o.headers={"Content-type":"text/plain"});var s=t.addPath(n,"/xhr_send"),a=new e("POST",s,r,o);return a.once("finish",function(e){if(a=null,200!==e&&204!==e)return i(new Error("http status "+e));i()}),function(){a.close(),a=null;var e=new Error("Aborted");e.code=1e3,i(e)}}}(o),i,o)}return e(r,n),q=r}function we(){if(z)return J;z=1;var e=R(),t=U().EventEmitter;function n(e,n){t.call(this);var r=this;this.bufferPosition=0,this.xo=new n("POST",e,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(e,t){r._chunkHandler(e,t),r.xo=null;var n=200===e?"network":"permanent";r.emit("close",null,n),r._cleanup()})}return e(n,t),n.prototype._chunkHandler=function(e,t){if(200===e&&t)for(var n=-1;;this.bufferPosition+=n+1){var r=t.slice(this.bufferPosition);if(-1===(n=r.indexOf("\n")))break;var i=r.slice(0,n);i&&this.emit("message",i)}},n.prototype._cleanup=function(){this.removeAllListeners()},n.prototype.abort=function(){this.xo&&(this.xo.close(),this.emit("close",null,"user"),this.xo=null),this._cleanup()},J=n}function Se(){if(K)return G;K=1;var e=U().EventEmitter,n=R(),r=y(),i=C(),o=t.XMLHttpRequest;function s(t,n,r,i){var o=this;e.call(this),setTimeout(function(){o._start(t,n,r,i)},0)}n(s,e),s.prototype._start=function(e,t,n,a){var c=this;try{this.xhr=new o}catch(e){}if(!this.xhr)return this.emit("finish",0,"no xhr support"),void this._cleanup();t=i.addQuery(t,"t="+ +new Date),this.unloadRef=r.unloadAdd(function(){c._cleanup(!0)});try{this.xhr.open(e,t,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){c.emit("finish",0,""),c._cleanup(!1)})}catch(e){return this.emit("finish",0,""),void this._cleanup(!1)}if(a&&a.noCredentials||!s.supportsCORS||(this.xhr.withCredentials=!0),a&&a.headers)for(var l in a.headers)this.xhr.setRequestHeader(l,a.headers[l]);this.xhr.onreadystatechange=function(){if(c.xhr){var e,t,n=c.xhr;switch(n.readyState,n.readyState){case 3:try{t=n.status,e=n.responseText}catch(e){}1223===t&&(t=204),200===t&&e&&e.length>0&&c.emit("chunk",t,e);break;case 4:1223===(t=n.status)&&(t=204),12005!==t&&12029!==t||(t=0),n.responseText,c.emit("finish",t,n.responseText),c._cleanup(!1)}}};try{c.xhr.send(n)}catch(e){c.emit("finish",0,""),c._cleanup(!1)}},s.prototype._cleanup=function(e){if(this.xhr){if(this.removeAllListeners(),r.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),e)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}},s.prototype.close=function(){this._cleanup(!0)},s.enabled=!!o;var a=["Active"].concat("Object").join("X");!s.enabled&&a in t&&(o=function(){try{return new t[a]("Microsoft.XMLHTTP")}catch(e){return null}},s.enabled=!!new o);var c=!1;try{c="withCredentials"in new o}catch(e){}return s.supportsCORS=c,G=s}function _e(){if(Q)return X;Q=1;var e=R(),t=Se();function n(e,n,r,i){t.call(this,e,n,r,i)}return e(n,t),n.enabled=t.enabled&&t.supportsCORS,X=n}function ke(){if(Y)return Z;Y=1;var e=R(),t=Se();function n(e,n,r){t.call(this,e,n,r,{noCredentials:!0})}return e(n,t),n.enabled=t.enabled,Z=n}function Ee(){return te?ee:(te=1,ee={isOpera:function(){return t.navigator&&/opera/i.test(t.navigator.userAgent)},isKonqueror:function(){return t.navigator&&/konqueror/i.test(t.navigator.userAgent)},hasDomain:function(){if(!t.document)return!0;try{return!!t.document.domain}catch(e){return!1}}})}function Ce(){if(re)return ne;re=1;var e=R(),n=ve(),r=we(),i=_e(),o=ke(),s=Ee();function a(e){if(!o.enabled&&!i.enabled)throw new Error("Transport created when disabled");n.call(this,e,"/xhr_streaming",r,i)}return e(a,n),a.enabled=function(e){return!e.nullOrigin&&(!s.isOpera()&&i.enabled)},a.transportName="xhr-streaming",a.roundTrips=2,a.needBody=!!t.document,ne=a}function Oe(){if(oe)return ie;oe=1;var e=U().EventEmitter,n=R(),r=y(),i=Ee(),o=C();function s(t,n,r){var i=this;e.call(this),setTimeout(function(){i._start(t,n,r)},0)}return n(s,e),s.prototype._start=function(e,n,i){var s=this,a=new t.XDomainRequest;n=o.addQuery(n,"t="+ +new Date),a.onerror=function(){s._error()},a.ontimeout=function(){s._error()},a.onprogress=function(){a.responseText,s.emit("chunk",200,a.responseText)},a.onload=function(){s.emit("finish",200,a.responseText),s._cleanup(!1)},this.xdr=a,this.unloadRef=r.unloadAdd(function(){s._cleanup(!0)});try{this.xdr.open(e,n),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(i)}catch(e){this._error()}},s.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},s.prototype._cleanup=function(e){if(this.xdr){if(this.removeAllListeners(),r.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,e)try{this.xdr.abort()}catch(e){}this.unloadRef=this.xdr=null}},s.prototype.close=function(){this._cleanup(!0)},s.enabled=!(!t.XDomainRequest||!i.hasDomain()),ie=s}function Te(){if(ae)return se;ae=1;var e=R(),t=ve(),n=we(),r=Oe();function i(e){if(!r.enabled)throw new Error("Transport created when disabled");t.call(this,e,"/xhr_streaming",n,r)}return e(i,t),i.enabled=function(e){return!e.cookie_needed&&!e.nullOrigin&&(r.enabled&&e.sameScheme)},i.transportName="xdr-streaming",i.roundTrips=2,se=i}function Re(){return le?ce:(le=1,ce=t.EventSource)}function xe(){if(pe)return de;pe=1;var e=R(),t=ve(),n=function(){if(he)return ue;he=1;var e=R(),t=U().EventEmitter,n=Re();function r(e){t.call(this);var r=this,i=this.es=new n(e);i.onmessage=function(e){e.data,r.emit("message",decodeURI(e.data))},i.onerror=function(e){i.readyState;var t=2!==i.readyState?"network":"permanent";r._cleanup(),r._close(t)}}return e(r,t),r.prototype.abort=function(){this._cleanup(),this._close("user")},r.prototype._cleanup=function(){var e=this.es;e&&(e.onmessage=e.onerror=null,e.close(),this.es=null)},r.prototype._close=function(e){var t=this;setTimeout(function(){t.emit("close",null,e),t.removeAllListeners()},200)},ue=r}(),r=_e(),i=Re();function o(e){if(!o.enabled())throw new Error("Transport created when disabled");t.call(this,e,"/eventsource",n,r)}return e(o,t),o.enabled=function(){return!!i},o.transportName="eventsource",o.roundTrips=2,de=o}function Ae(){return me?fe:(me=1,fe="1.6.1")}var Ie,Ne,Le,Ue,je,Pe,De,Be,$e,Fe,He,Me,We,qe,Ve,Je,ze,Ge,Ke,Xe,Qe,Ze,Ye,et={exports:{}};function tt(){return Ie||(Ie=1,function(e){var n=y(),r=Ee();e.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){e.exports.WPrefix in t||(t[e.exports.WPrefix]={})},postMessage:function(n,r){t.parent!==t&&t.parent.postMessage(JSON.stringify({windowId:e.exports.currentWindowId,type:n,data:r||""}),"*")},createIframe:function(e,r){var i,o,s=t.document.createElement("iframe"),a=function(){clearTimeout(i);try{s.onload=null}catch(e){}s.onerror=null},c=function(){s&&(a(),setTimeout(function(){s&&s.parentNode.removeChild(s),s=null},0),n.unloadDel(o))},l=function(e){s&&(c(),r(e))};return s.src=e,s.style.display="none",s.style.position="absolute",s.onerror=function(){l("onerror")},s.onload=function(){clearTimeout(i),i=setTimeout(function(){l("onload timeout")},2e3)},t.document.body.appendChild(s),i=setTimeout(function(){l("timeout")},15e3),o=n.unloadAdd(c),{post:function(e,t){setTimeout(function(){try{s&&s.contentWindow&&s.contentWindow.postMessage(e,t)}catch(e){}},0)},cleanup:c,loaded:a}},createHtmlfile:function(r,i){var o,s,a,c=["Active"].concat("Object").join("X"),l=new t[c]("htmlfile"),u=function(){clearTimeout(o),a.onerror=null},h=function(){l&&(u(),n.unloadDel(s),a.parentNode.removeChild(a),a=l=null,CollectGarbage())},d=function(e){l&&(h(),i(e))};l.open(),l.write('<html><script>document.domain="'+t.document.domain+'";<\/script></html>'),l.close(),l.parentWindow[e.exports.WPrefix]=t[e.exports.WPrefix];var p=l.createElement("div");return l.body.appendChild(p),a=l.createElement("iframe"),p.appendChild(a),a.src=r,a.onerror=function(){d("onerror")},o=setTimeout(function(){d("timeout")},15e3),s=n.unloadAdd(h),{post:function(e,t){try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(e,t)},0)}catch(e){}},cleanup:h,loaded:u}}},e.exports.iframeEnabled=!1,t.document&&(e.exports.iframeEnabled=("function"==typeof t.postMessage||"object"==typeof t.postMessage)&&!r.isKonqueror())}(et)),et.exports}function nt(){if(Le)return Ne;Le=1;var e=R(),t=U().EventEmitter,n=Ae(),r=C(),i=tt(),o=y(),s=g();function a(e,n,c){if(!a.enabled())throw new Error("Transport created when disabled");t.call(this);var l=this;this.origin=r.getOrigin(c),this.baseUrl=c,this.transUrl=n,this.transport=e,this.windowId=s.string(8);var u=r.addPath(c,"/iframe.html")+"#"+this.windowId;this.iframeObj=i.createIframe(u,function(e){l.emit("close",1006,"Unable to load an iframe ("+e+")"),l.close()}),this.onmessageCallback=this._message.bind(this),o.attachEvent("message",this.onmessageCallback)}return e(a,t),a.prototype.close=function(){if(this.removeAllListeners(),this.iframeObj){o.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(e){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},a.prototype._message=function(e){if(e.data,!r.isOriginEqual(e.origin,this.origin))return e.origin,void this.origin;var t;try{t=JSON.parse(e.data)}catch(t){return void e.data}if(t.windowId!==this.windowId)return t.windowId,void this.windowId;switch(t.type){case"s":this.iframeObj.loaded(),this.postMessage("s",JSON.stringify([n,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",t.data);break;case"c":var i;try{i=JSON.parse(t.data)}catch(e){return void t.data}this.emit("close",i[0],i[1]),this.close()}},a.prototype.postMessage=function(e,t){this.iframeObj.post(JSON.stringify({windowId:this.windowId,type:e,data:t||""}),this.origin)},a.prototype.send=function(e){this.postMessage("m",e)},a.enabled=function(){return i.iframeEnabled},a.transportName="iframe",a.roundTrips=2,Ne=a}function rt(){return je||(je=1,Ue={isObject:function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},extend:function(e){if(!this.isObject(e))return e;for(var t,n,r=1,i=arguments.length;r<i;r++)for(n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}}),Ue}function it(){if(De)return Pe;De=1;var e=R(),n=nt(),r=rt();return Pe=function(i){function o(e,t){n.call(this,i.transportName,e,t)}return e(o,n),o.enabled=function(e,o){if(!t.document)return!1;var s=r.extend({},o);return s.sameOrigin=!0,i.enabled(s)&&n.enabled()},o.transportName="iframe-"+i.transportName,o.needBody=!0,o.roundTrips=n.roundTrips+i.roundTrips-1,o.facadeTransport=i,o},Pe}function ot(){if(He)return Fe;He=1;var e=R(),n=function(){if($e)return Be;$e=1;var e=R(),n=tt(),r=C(),i=U().EventEmitter,o=g();function s(e){i.call(this);var a=this;n.polluteGlobalNamespace(),this.id="a"+o.string(6),e=r.addQuery(e,"c="+decodeURIComponent(n.WPrefix+"."+this.id)),s.htmlfileEnabled;var c=s.htmlfileEnabled?n.createHtmlfile:n.createIframe;t[n.WPrefix][this.id]={start:function(){a.iframeObj.loaded()},message:function(e){a.emit("message",e)},stop:function(){a._cleanup(),a._close("network")}},this.iframeObj=c(e,function(){a._cleanup(),a._close("permanent")})}e(s,i),s.prototype.abort=function(){this._cleanup(),this._close("user")},s.prototype._cleanup=function(){this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete t[n.WPrefix][this.id]},s.prototype._close=function(e){this.emit("close",null,e),this.removeAllListeners()},s.htmlfileEnabled=!1;var a=["Active"].concat("Object").join("X");if(a in t)try{s.htmlfileEnabled=!!new t[a]("htmlfile")}catch(e){}return s.enabled=s.htmlfileEnabled||n.iframeEnabled,Be=s}(),r=ke(),i=ve();function o(e){if(!n.enabled)throw new Error("Transport created when disabled");i.call(this,e,"/htmlfile",n,r)}return e(o,i),o.enabled=function(e){return n.enabled&&e.sameOrigin},o.transportName="htmlfile",o.roundTrips=2,Fe=o}function st(){if(We)return Me;We=1;var e=R(),t=ve(),n=we(),r=_e(),i=ke();function o(e){if(!i.enabled&&!r.enabled)throw new Error("Transport created when disabled");t.call(this,e,"/xhr",n,r)}return e(o,t),o.enabled=function(e){return!e.nullOrigin&&(!(!i.enabled||!e.sameOrigin)||r.enabled)},o.transportName="xhr-polling",o.roundTrips=2,Me=o}function at(){if(Ve)return qe;Ve=1;var e=R(),t=ve(),n=Te(),r=we(),i=Oe();function o(e){if(!i.enabled)throw new Error("Transport created when disabled");t.call(this,e,"/xhr",r,i)}return e(o,t),o.enabled=n.enabled,o.transportName="xdr-polling",o.roundTrips=2,qe=o}function ct(){if(Ke)return Ge;Ke=1;var e,n,r=g(),i=C();return Ge=function(o,s,a){e||((e=t.document.createElement("form")).style.display="none",e.style.position="absolute",e.method="POST",e.enctype="application/x-www-form-urlencoded",e.acceptCharset="UTF-8",(n=t.document.createElement("textarea")).name="d",e.appendChild(n),t.document.body.appendChild(e));var c="a"+r.string(8);e.target=c,e.action=i.addQuery(i.addPath(o,"/jsonp_send"),"i="+c);var l=function(e){try{return t.document.createElement('<iframe name="'+e+'">')}catch(r){var n=t.document.createElement("iframe");return n.name=e,n}}(c);l.id=c,l.style.display="none",e.appendChild(l);try{n.value=s}catch(e){}e.submit();var u=function(e){l.onerror&&(l.onreadystatechange=l.onerror=l.onload=null,setTimeout(function(){l.parentNode.removeChild(l),l=null},500),n.value="",a(e))};return l.onerror=function(){u()},l.onload=function(){u()},l.onreadystatechange=function(e){l.readyState,"complete"===l.readyState&&u()},function(){u(new Error("Aborted"))}},Ge}function lt(){if(Qe)return Xe;Qe=1;var e=R(),n=be(),r=function(){if(ze)return Je;ze=1;var e=tt(),n=g(),r=Ee(),i=C(),o=R(),s=U().EventEmitter;function a(r){var o=this;s.call(this),e.polluteGlobalNamespace(),this.id="a"+n.string(6);var c=i.addQuery(r,"c="+encodeURIComponent(e.WPrefix+"."+this.id));t[e.WPrefix][this.id]=this._callback.bind(this),this._createScript(c),this.timeoutId=setTimeout(function(){o._abort(new Error("JSONP script loaded abnormally (timeout)"))},a.timeout)}return o(a,s),a.prototype.abort=function(){if(t[e.WPrefix][this.id]){var n=new Error("JSONP user aborted read");n.code=1e3,this._abort(n)}},a.timeout=35e3,a.scriptErrorTimeout=1e3,a.prototype._callback=function(e){this._cleanup(),this.aborting||(e&&this.emit("message",e),this.emit("close",null,"network"),this.removeAllListeners())},a.prototype._abort=function(e){this._cleanup(),this.aborting=!0,this.emit("close",e.code,e.message),this.removeAllListeners()},a.prototype._cleanup=function(){if(clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var n=this.script;n.parentNode.removeChild(n),n.onreadystatechange=n.onerror=n.onload=n.onclick=null,this.script=null}delete t[e.WPrefix][this.id]},a.prototype._scriptError=function(){var e=this;this.errorTimer||(this.errorTimer=setTimeout(function(){e.loadedOkay||e._abort(new Error("JSONP script loaded abnormally (onerror)"))},a.scriptErrorTimeout))},a.prototype._createScript=function(e){var i,o=this,s=this.script=t.document.createElement("script");if(s.id="a"+n.string(8),s.src=e,s.type="text/javascript",s.charset="UTF-8",s.onerror=this._scriptError.bind(this),s.onload=function(){o._abort(new Error("JSONP script loaded abnormally (onload)"))},s.onreadystatechange=function(){if(s.readyState,/loaded|closed/.test(s.readyState)){if(s&&s.htmlFor&&s.onclick){o.loadedOkay=!0;try{s.onclick()}catch(e){}}s&&o._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))}},void 0===s.async&&t.document.attachEvent)if(r.isOpera())(i=this.script2=t.document.createElement("script")).text="try{var a = document.getElementById('"+s.id+"'); if(a)a.onerror();}catch(x){};",s.async=i.async=!1;else{try{s.htmlFor=s.id,s.event="onclick"}catch(e){}s.async=!0}void 0!==s.async&&(s.async=!0);var a=t.document.getElementsByTagName("head")[0];a.insertBefore(s,a.firstChild),i&&a.insertBefore(i,a.firstChild)},Je=a}(),i=ct();function o(e){if(!o.enabled())throw new Error("Transport created when disabled");n.call(this,e,"/jsonp",i,r)}return e(o,n),o.enabled=function(){return!!t.document},o.transportName="jsonp-polling",o.roundTrips=1,o.needBody=!0,Xe=o}function ut(){return Ye?Ze:(Ye=1,Ze=[ye(),Ce(),Te(),xe(),it()(xe()),ot(),it()(ot()),st(),at(),it()(st()),lt()])}var ht,dt,pt,ft,mt,gt,yt,bt,vt,wt,St,_t,kt,Et,Ct,Ot,Tt,Rt,xt,At,It,Nt,Lt,Ut,jt,Pt,Dt,Bt,$t,Ft,Ht,Mt,Wt,qt={};function Vt(){if(ht)return qt;ht=1;var e,t=Array.prototype,n=Object.prototype,r=Function.prototype,i=String.prototype,o=t.slice,s=n.toString,a=function(e){return"[object Function]"===n.toString.call(e)},c=function(e){return"[object String]"===s.call(e)},l=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(e){return!1}}();e=l?function(e,t,n,r){!r&&t in e||Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(e,t,n,r){!r&&t in e||(e[t]=n)};var u=function(t,r,i){for(var o in r)n.hasOwnProperty.call(r,o)&&e(t,o,r[o],i)},h=function(e){if(null==e)throw new TypeError("can't convert "+e+" to object");return Object(e)};function d(){}u(r,{bind:function(e){var t=this;if(!a(t))throw new TypeError("Function.prototype.bind called on incompatible "+t);for(var n=o.call(arguments,1),r=Math.max(0,t.length-n.length),i=[],s=0;s<r;s++)i.push("$"+s);var c=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this, arguments); }")(function(){if(this instanceof c){var r=t.apply(this,n.concat(o.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(o.call(arguments)))});return t.prototype&&(d.prototype=t.prototype,c.prototype=new d,d.prototype=null),c}}),u(Array,{isArray:function(e){return"[object Array]"===s.call(e)}});var p,f,m,g=Object("a"),y="a"!==g[0]||!(0 in g);u(t,{forEach:function(e){var t=h(this),n=y&&c(this)?this.split(""):t,r=arguments[1],i=-1,o=n.length>>>0;if(!a(e))throw new TypeError;for(;++i<o;)i in n&&e.call(r,n[i],i,t)}},(p=t.forEach,f=!0,m=!0,p&&(p.call("foo",function(e,t,n){"object"!=typeof n&&(f=!1)}),p.call([1],function(){m="string"==typeof this},"x")),!(p&&f&&m)));var b=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);u(t,{indexOf:function(e){var t=y&&c(this)?this.split(""):h(this),n=t.length>>>0;if(!n)return-1;var r,i=0;for(arguments.length>1&&((r=+arguments[1])!=r?r=0:0!==r&&r!==1/0&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r))),i=r),i=i>=0?i:Math.max(0,n+i);i<n;i++)if(i in t&&t[i]===e)return i;return-1}},b);var v,w=i.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?(v=void 0===/()??/.exec("")[1],i.split=function(e,n){var r=this;if(void 0===e&&0===n)return[];if("[object RegExp]"!==s.call(e))return w.call(this,e,n);var i,o,a,c,l=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),h=0;for(e=new RegExp(e.source,u+"g"),r+="",v||(i=new RegExp("^"+e.source+"$(?!\\s)",u)),n=void 0===n?-1>>>0:n>>>0;(o=e.exec(r))&&!((a=o.index+o[0].length)>h&&(l.push(r.slice(h,o.index)),!v&&o.length>1&&o[0].replace(i,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(o[e]=void 0)}),o.length>1&&o.index<r.length&&t.push.apply(l,o.slice(1)),c=o[0].length,h=a,l.length>=n));)e.lastIndex===o.index&&e.lastIndex++;return h===r.length?!c&&e.test("")||l.push(""):l.push(r.slice(h)),l.length>n?l.slice(0,n):l}):"0".split(void 0,0).length&&(i.split=function(e,t){return void 0===e&&0===t?[]:w.call(this,e,t)});var S=i.substr,_="".substr&&"b"!=="0b".substr(-1);return u(i,{substr:function(e,t){return S.call(this,e<0&&(e=this.length+e)<0?0:e,t)}},_),qt}function Jt(){if(pt)return dt;pt=1;var e,t=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g;return dt={quote:function(n){var r=JSON.stringify(n);return t.lastIndex=0,t.test(r)?(e||(e=function(e){var t,n={},r=[];for(t=0;t<65536;t++)r.push(String.fromCharCode(t));return e.lastIndex=0,r.join("").replace(e,function(e){return n[e]="\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4),""}),e.lastIndex=0,n}(t)),r.replace(t,function(t){return e[t]})):r}}}function zt(){if(mt)return ft;mt=1;return ft=function(e){return{filterToEnabled:function(t,n){var r={main:[],facade:[]};return t?"string"==typeof t&&(t=[t]):t=[],e.forEach(function(e){e&&("websocket"===e.transportName&&!1===n.websocket||(t.length&&-1===t.indexOf(e.transportName)?e.transportName:e.enabled(n)?(e.transportName,r.main.push(e),e.facadeTransport&&r.facade.push(e.facadeTransport)):e.transportName))}),r}}}}function Gt(){if(yt)return gt;yt=1;var e={};return["log","debug","warn"].forEach(function(n){var r;try{r=t.console&&t.console[n]&&t.console[n].apply}catch(e){}e[n]=r?function(){return t.console[n].apply(t.console,arguments)}:"log"===n?function(){}:e.log}),gt=e}function Kt(){if(vt)return bt;function e(e){this.type=e}return vt=1,e.prototype.initEvent=function(e,t,n){return this.type=e,this.bubbles=t,this.cancelable=n,this.timeStamp=+new Date,this},e.prototype.stopPropagation=function(){},e.prototype.preventDefault=function(){},e.CAPTURING_PHASE=1,e.AT_TARGET=2,e.BUBBLING_PHASE=3,bt=e}function Xt(){return St?wt:(St=1,wt=t.location||{origin:"http://localhost:80",protocol:"http:",host:"localhost",port:80,href:"http://localhost/",hash:""})}function Qt(){if(xt)return Rt;xt=1;var e=U().EventEmitter,t=R(),n=rt();function r(t,r){e.call(this);var i=this,o=+new Date;this.xo=new r("GET",t),this.xo.once("finish",function(e,t){var r,s;if(200===e){if(s=+new Date-o,t)try{r=JSON.parse(t)}catch(e){}n.isObject(r)||(r={})}i.emit("finish",r,s),i.removeAllListeners()})}return t(r,e),r.prototype.close=function(){this.removeAllListeners(),this.xo.close()},Rt=r}function Zt(){if(It)return At;It=1;var e=R(),t=U().EventEmitter,n=ke(),r=Qt();function i(e){var i=this;t.call(this),this.ir=new r(e,n),this.ir.once("finish",function(e,t){i.ir=null,i.emit("message",JSON.stringify([e,t]))})}return e(i,t),i.transportName="iframe-info-receiver",i.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},At=i}function Yt(){if(jt)return Ut;jt=1;var e=U().EventEmitter,n=R(),r=C(),i=Oe(),o=_e(),s=ke(),a=function(){if(Tt)return Ot;Tt=1;var e=U().EventEmitter;function t(){var n=this;e.call(this),this.to=setTimeout(function(){n.emit("finish",200,"{}")},t.timeout)}return R()(t,e),t.prototype.close=function(){clearTimeout(this.to)},t.timeout=2e3,Ot=t}(),c=function(){if(Lt)return Nt;Lt=1;var e=U().EventEmitter,n=R(),r=y(),i=nt(),o=Zt();function s(n,s){var a=this;e.call(this);var c=function(){var e=a.ifr=new i(o.transportName,s,n);e.once("message",function(e){if(e){var t;try{t=JSON.parse(e)}catch(e){return a.emit("finish"),void a.close()}var n=t[0],r=t[1];a.emit("finish",n,r)}a.close()}),e.once("close",function(){a.emit("finish"),a.close()})};t.document.body?c():r.attachEvent("load",c)}return n(s,e),s.enabled=function(){return i.enabled()},s.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},Nt=s}(),l=Qt();function u(t,n){var r=this;e.call(this),setTimeout(function(){r.doXhr(t,n)},0)}return n(u,e),u._getReceiver=function(e,t,n){return n.sameOrigin?new l(t,s):o.enabled?new l(t,o):i.enabled&&n.sameScheme?new l(t,i):c.enabled()?new c(e,t):new l(t,a)},u.prototype.doXhr=function(e,t){var n=this,i=r.addPath(e,"/info");this.xo=u._getReceiver(e,i,t),this.timeoutRef=setTimeout(function(){n._cleanup(!1),n.emit("finish")},u.timeout),this.xo.once("finish",function(e,t){n._cleanup(!0),n.emit("finish",e,t)})},u.prototype._cleanup=function(e){clearTimeout(this.timeoutRef),this.timeoutRef=null,!e&&this.xo&&this.xo.close(),this.xo=null},u.prototype.close=function(){this.removeAllListeners(),this._cleanup(!1)},u.timeout=8e3,Ut=u}function en(){if($t)return Bt;$t=1;var e=C(),t=y(),n=function(){if(Dt)return Pt;Dt=1;var e=tt();function t(e){this._transport=e,e.on("message",this._transportMessage.bind(this)),e.on("close",this._transportClose.bind(this))}return t.prototype._transportClose=function(t,n){e.postMessage("c",JSON.stringify([t,n]))},t.prototype._transportMessage=function(t){e.postMessage("t",t)},t.prototype._send=function(e){this._transport.send(e)},t.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},Pt=t}(),r=Zt(),i=tt(),o=Xt();return Bt=function(s,a){var c,l={};a.forEach(function(e){e.facadeTransport&&(l[e.facadeTransport.transportName]=e.facadeTransport)}),l[r.transportName]=r,s.bootstrap_iframe=function(){var r;i.currentWindowId=o.hash.slice(1);t.attachEvent("message",function(t){if(t.source===parent&&(void 0===c&&(c=t.origin),t.origin===c)){var a;try{a=JSON.parse(t.data)}catch(e){return void t.data}if(a.windowId===i.currentWindowId)switch(a.type){case"s":var u;try{u=JSON.parse(a.data)}catch(e){a.data;break}var h=u[0],d=u[1],p=u[2],f=u[3];if(h!==s.version)throw new Error('Incompatible SockJS! Main site uses: "'+h+'", the iframe: "'+s.version+'".');if(!e.isOriginEqual(p,o.href)||!e.isOriginEqual(f,o.href))throw new Error("Can't connect to different domain from within an iframe. ("+o.href+", "+p+", "+f+")");r=new n(new l[d](p,f));break;case"m":r._send(a.data);break;case"c":r&&r._close(),r=null}}}),i.postMessage("s")}},Bt}function tn(){if(Ht)return Ft;Ht=1,Vt();var e,n=E(),r=R(),i=g(),o=Jt(),s=C(),a=y(),c=zt(),l=rt(),u=Ee(),h=Gt(),d=Kt(),p=L(),f=Xt(),m=function(){if(kt)return _t;kt=1;var e=R(),t=Kt();function n(){t.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}return e(n,t),_t=n}(),b=function(){if(Ct)return Et;Ct=1;var e=R(),t=Kt();function n(e){t.call(this),this.initEvent("message",!1,!1),this.data=e}return e(n,t),Et=n}(),v=Yt(),w=function(){};function S(e,t,r){if(!(this instanceof S))return new S(e,t,r);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");p.call(this),this.readyState=S.CONNECTING,this.extensions="",this.protocol="",(r=r||{}).protocols_whitelist&&h.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=r.transports,this._transportOptions=r.transportOptions||{},this._timeout=r.timeout||0;var o=r.sessionId||8;if("function"==typeof o)this._generateSessionId=o;else{if("number"!=typeof o)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return i.string(o)}}this._server=r.server||i.numberString(1e3);var a=new n(e);if(!a.host||!a.protocol)throw new SyntaxError("The URL '"+e+"' is invalid");if(a.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==a.protocol&&"https:"!==a.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+a.protocol+"' is not allowed.");var c="https:"===a.protocol;if("https:"===f.protocol&&!c&&!s.isLoopbackAddr(a.hostname))throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");t?Array.isArray(t)||(t=[t]):t=[];var l=t.sort();l.forEach(function(e,t){if(!e)throw new SyntaxError("The protocols entry '"+e+"' is invalid.");if(t<l.length-1&&e===l[t+1])throw new SyntaxError("The protocols entry '"+e+"' is duplicated.")});var d=s.getOrigin(f.href);this._origin=d?d.toLowerCase():null,a.set("pathname",a.pathname.replace(/\/+$/,"")),this.url=a.href,this.url,this._urlInfo={nullOrigin:!u.hasDomain(),sameOrigin:s.isOriginEqual(this.url,f.href),sameScheme:s.isSchemeEqual(this.url,f.href)},this._ir=new v(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function _(e){return 1e3===e||e>=3e3&&e<=4999}return r(S,p),S.prototype.close=function(e,t){if(e&&!_(e))throw new Error("InvalidAccessError: Invalid code");if(t&&t.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==S.CLOSING&&this.readyState!==S.CLOSED){this._close(e||1e3,t||"Normal closure",!0)}},S.prototype.send=function(e){if("string"!=typeof e&&(e=""+e),this.readyState===S.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===S.OPEN&&this._transport.send(o.quote(e))},S.version=Ae(),S.CONNECTING=0,S.OPEN=1,S.CLOSING=2,S.CLOSED=3,S.prototype._receiveInfo=function(t,n){if(this._ir=null,t){this._rto=this.countRTO(n),this._transUrl=t.base_url?t.base_url:this.url,t=l.extend(t,this._urlInfo);var r=e.filterToEnabled(this._transportsWhitelist,t);this._transports=r.main,this._transports.length,this._connect()}else this._close(1002,"Cannot connect to server")},S.prototype._connect=function(){for(var e=this._transports.shift();e;e=this._transports.shift()){if(w(e.transportName),e.needBody&&(!t.document.body||void 0!==t.document.readyState&&"complete"!==t.document.readyState&&"interactive"!==t.document.readyState))return this._transports.unshift(e),void a.attachEvent("load",this._connect.bind(this));var n=Math.max(this._timeout,this._rto*e.roundTrips||5e3);this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),n);var r=s.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),i=this._transportOptions[e.transportName],o=new e(r,this._transUrl,i);return o.on("message",this._transportMessage.bind(this)),o.once("close",this._transportClose.bind(this)),o.transportName=e.transportName,void(this._transport=o)}this._close(2e3,"All transports failed",!1)},S.prototype._transportTimeout=function(){this.readyState===S.CONNECTING&&(this._transport&&this._transport.close(),this._transportClose(2007,"Transport timed out"))},S.prototype._transportMessage=function(e){var t,n=this,r=e.slice(0,1),i=e.slice(1);switch(r){case"o":return void this._open();case"h":return this.dispatchEvent(new d("heartbeat")),void this.transport}if(i)try{t=JSON.parse(i)}catch(e){}if(void 0!==t)switch(r){case"a":Array.isArray(t)&&t.forEach(function(e){n.transport,n.dispatchEvent(new b(e))});break;case"m":this.transport,this.dispatchEvent(new b(t));break;case"c":Array.isArray(t)&&2===t.length&&this._close(t[0],t[1],!0)}},S.prototype._transportClose=function(e,t){this.transport,this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),_(e)||2e3===e||this.readyState!==S.CONNECTING?this._close(e,t):this._connect()},S.prototype._open=function(){this._transport&&this._transport.transportName,this.readyState,this.readyState===S.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=S.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new d("open")),this.transport):this._close(1006,"Server lost session")},S.prototype._close=function(e,t,n){this.transport,this.readyState;var r=!1;if(this._ir&&(r=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===S.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=S.CLOSING,setTimeout(function(){this.readyState=S.CLOSED,r&&this.dispatchEvent(new d("error"));var i=new m("close");i.wasClean=n||!1,i.code=e||1e3,i.reason=t,this.dispatchEvent(i),this.onmessage=this.onclose=this.onerror=null}.bind(this),0)},S.prototype.countRTO=function(e){return e>100?4*e:300+e},Ft=function(t){return e=c(t),en()(S,t),S}}var nn=function(){if(Wt)return Mt;Wt=1;var e=ut();return Mt=tn()(e),"_sockjs_onload"in t&&setTimeout(t._sockjs_onload,1),Mt}(),rn=n(nn);const on="\n",sn="\0";class an{get body(){return!this._body&&this.isBinaryBody&&(this._body=(new TextDecoder).decode(this._binaryBody)),this._body||""}get binaryBody(){return this._binaryBody||this.isBinaryBody||(this._binaryBody=(new TextEncoder).encode(this._body)),this._binaryBody}constructor(e){const{command:t,headers:n,body:r,binaryBody:i,escapeHeaderValues:o,skipContentLengthHeader:s}=e;this.command=t,this.headers=Object.assign({},n||{}),i?(this._binaryBody=i,this.isBinaryBody=!0):(this._body=r||"",this.isBinaryBody=!1),this.escapeHeaderValues=o||!1,this.skipContentLengthHeader=s||!1}static fromRawFrame(e,t){const n={},r=e=>e.replace(/^\s+|\s+$/g,"");for(const i of e.headers.reverse()){i.indexOf(":");const o=r(i[0]);let s=r(i[1]);t&&"CONNECT"!==e.command&&"CONNECTED"!==e.command&&(s=an.hdrValueUnEscape(s)),n[o]=s}return new an({command:e.command,headers:n,binaryBody:e.binaryBody,escapeHeaderValues:t})}toString(){return this.serializeCmdAndHeaders()}serialize(){const e=this.serializeCmdAndHeaders();return this.isBinaryBody?an.toUnit8Array(e,this._binaryBody).buffer:e+this._body+sn}serializeCmdAndHeaders(){const e=[this.command];this.skipContentLengthHeader&&delete this.headers["content-length"];for(const t of Object.keys(this.headers||{})){const n=this.headers[t]