├── LICENSE ├── README.md ├── dist ├── vue-stomp.js └── vue-stomp.js.map ├── package.json ├── src └── index.js ├── webpack.build.config.js └── webpack.dev.config.js /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Icebob 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-stomp 2 | 3 | Stomp (Websokct) with send message timeout monitor plugin for VueJS. 4 | 5 | 6 | ## Install 7 | ### NPM 8 | You can install it via [NPM](http://npmjs.org/). 9 | ``` 10 | $ npm install vue-stomp 11 | ``` 12 | ### Manual 13 | Download zip package and unpack and add the `vue-stomp.js` file to your project from dist folder. 14 | ``` 15 | https://github.com/FlySkyBear/vue-stomp/archive/master.zip 16 | ``` 17 | 18 | ## Usage 19 | Register the plugin, it will connect to `/` 20 | ```js 21 | import VueStomp from "vue-stomp"; 22 | Vue.use(VueStomp); 23 | ``` 24 | 25 | ##Memo 26 | WM: WithMonitor 27 | 28 | Use it in your components: 29 | ```html 30 | 89 | ``` 90 | 91 | ## Build 92 | This command will build a distributable version in the `dist` directory. 93 | ```bash 94 | npm run build 95 | ``` 96 | 97 | ## Contribution 98 | Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important. 99 | 100 | ## License 101 | vue-stomp is available under the [MIT license](https://tldrlegal.com/license/mit-license). 102 | 103 | ## Contact 104 | 105 | Copyright (C) 2016-2020 FlySkyBear 106 | 107 | -------------------------------------------------------------------------------- /dist/vue-stomp.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueStomp=e():t.VueStomp=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="./dist/",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(1),s=r(i),a=n(62),c=r(a);e.default={install:function(t){var e="_";t.prototype.keyPrefix=e;var n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments[2],r=arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3e3,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};if("function"!=typeof r)throw{name:"Vue Stomp Error",message:"The fourth argument must be a function."};if(null==n)throw{name:"Vue Stomp Error",message:"The third argument must not be null."};if(null==this.$stompClient||!this.$stompClient.connected)throw{name:"Vue Stomp Error",message:"The connection is not established."};if(this.monitorEvents){var s=this.keyPrefix+n,a={cmd:e,sendTime:Date.now(),timeout:o,func:r};this.monitorEvents[s]=a}this.$stompClient.send(t,e,i)};t.prototype.sendWM=n;var r=function(t){if(null==t)throw{name:"Vue Stomp Error",message:"The first argument must not be null."};var e=this.keyPrefix+t;null!=this.monitorEvents[e]&&delete this.monitorEvents[e]};t.prototype.removeStompMonitor=r;var i=function(t){"close"==t.type&&1==this.stompReconnect&&(console.log("reconnErrorCallback reconnect required!"),this.reconnecting=!0,this.connetWM(this.connectParams.serverEndPoint,this.connectParams.headers,this.connectParams.connectCallback,this.connectParams.errorCallback)),this.errorCallback&&this.errorCallback(t)};t.prototype.reconnErrorCallback=i;var a=function(e){var n,r=this;if(!this.$stompClient||!this.$stompClient.connected){var i=new s.default(e),a=c.default.over(i);t.prototype.$stompClient=a;for(var u=arguments.length,l=Array(u>1?u-1:0),h=1;hn.timeout&&("function"==typeof r.timeoutCallback&&r.timeoutCallback(n.cmd),delete r.monitorEvents[e])}}},this.monitorIntervalTime))}};t.prototype.connetWM=a;var u=function(){if(this.$options.stompClient){var t=this.$options.stompClient;if(t.timeout){if("function"!=typeof t.timeout)throw{name:"Vue Stomp Error",message:"The argument[timeout] must be a function."};this.timeoutCallback=t.timeout}var e=100;t.monitorIntervalTime&&"number"==typeof t.monitorIntervalTime&&!isNaN(t.monitorIntervalTime)&&(e=t.monitorIntervalTime),this.monitorIntervalTime=e,t.stompReconnect&&(this.stompReconnect=t.stompReconnect)}},l=function(){this.$stompClient&&this.$stompClient.connected&&this.$stompClient.disconnect(),clearInterval(this.responseMonitor),this.responseMonitor=null};t.prototype.disconnetWM=l;var h=function(){this.$options.stompClient&&(this.disconnetWM(),delete this.monitorEvents,delete this.timeoutCallback)};t.mixin({beforeCompile:u,beforeCreate:u,beforeDestroy:h})}}},function(t,e,n){(function(e){"use strict";var r=n(2);t.exports=n(46)(r),"_sockjs_onload"in e&&setTimeout(e._sockjs_onload,1)}).call(e,function(){return this}())},function(t,e,n){"use strict";t.exports=[n(3),n(16),n(26),n(28),n(31)(n(28)),n(39),n(31)(n(39)),n(41),n(42),n(31)(n(41)),n(43)]},function(t,e,n){"use strict";function r(t,e,n){if(!r.enabled())throw new Error("Transport created when disabled");a.call(this),u("constructor",t);var s=this,l=i.addPath(t,"/websocket");l="https"===l.slice(0,5)?"wss"+l.slice(5):"ws"+l.slice(4),this.url=l,this.ws=new c(this.url,[],n),this.ws.onmessage=function(t){u("message event",t.data),s.emit("message",t.data)},this.unloadRef=o.unloadAdd(function(){u("unload"),s.ws.close()}),this.ws.onclose=function(t){u("close event",t.code,t.reason),s.emit("close",t.code,t.reason),s._cleanup()},this.ws.onerror=function(t){u("error event",t),s.emit("close",1006,"WebSocket connection broken"),s._cleanup()}}var o=n(4),i=n(7),s=n(12),a=n(13).EventEmitter,c=n(15),u=function(){};s(r,a),r.prototype.send=function(t){var e="["+t+"]";u("send",e),this.ws.send(e)},r.prototype.close=function(){u("close"),this.ws&&this.ws.close(),this._cleanup()},r.prototype._cleanup=function(){u("_cleanup");var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),o.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},r.enabled=function(){return u("enabled"),!!c},r.transportName="websocket",r.roundTrips=2,t.exports=r},function(t,e,n){(function(e){"use strict";var r=n(5),o={},i=!1,s=e.chrome&&e.chrome.app&&e.chrome.app.runtime;t.exports={attachEvent:function(t,n){"undefined"!=typeof e.addEventListener?e.addEventListener(t,n,!1):e.document&&e.attachEvent&&(e.document.attachEvent("on"+t,n),e.attachEvent("on"+t,n))},detachEvent:function(t,n){"undefined"!=typeof e.addEventListener?e.removeEventListener(t,n,!1):e.document&&e.detachEvent&&(e.document.detachEvent("on"+t,n),e.detachEvent("on"+t,n))},unloadAdd:function(t){if(s)return null;var e=r.string(8);return o[e]=t,i&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in o&&delete o[t]},triggerUnloadCallbacks:function(){for(var t in o)o[t](),delete o[t]}};var a=function(){i||(i=!0,t.exports.triggerUnloadCallbacks())};s||t.exports.attachEvent("unload",a)}).call(e,function(){return this}())},function(t,e,n){"use strict";var r=n(6),o="abcdefghijklmnopqrstuvwxyz012345";t.exports={string:function(t){for(var e=o.length,n=r.randomBytes(t),i=[],s=0;s1?this._listeners[t]=n.slice(0,r).concat(n.slice(r+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var r=this._listeners[e],o=0;o0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(s("error",e),t.emit("close",e.code||1006,"Sending error: "+e),t._cleanup()):t.sendScheduleWait()}),this.sendBuffer=[]}},r.prototype._cleanup=function(){s("_cleanup"),this.removeAllListeners()},r.prototype.stop=function(){s("stop"),this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},t.exports=r},function(t,e,n){"use strict";function r(t,e,n){s(e),i.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var o=n(12),i=n(13).EventEmitter,s=function(){};o(r,i),r.prototype._scheduleReceiver=function(){s("_scheduleReceiver");var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){s("message",e),t.emit("message",e)}),e.once("close",function(n,r){s("close",n,r,t.pollIsClosing),t.poll=e=null,t.pollIsClosing||("network"===r?t._scheduleReceiver():(t.emit("close",n||1006,r),t.removeAllListeners()))})},r.prototype.abort=function(){s("abort"),this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},t.exports=r},function(t,e,n){"use strict";function r(t,e){s(t),i.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){s("finish",t,e),n._chunkHandler(t,e),n.xo=null;var r=200===t?"network":"permanent";s("close",r),n.emit("close",null,r),n._cleanup()})}var o=n(12),i=n(13).EventEmitter,s=function(){};o(r,i),r.prototype._chunkHandler=function(t,e){if(s("_chunkHandler",t),200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var r=e.slice(this.bufferPosition);if(n=r.indexOf("\n"),n===-1)break;var o=r.slice(0,n);o&&(s("message",o),this.emit("message",o))}},r.prototype._cleanup=function(){s("_cleanup"),this.removeAllListeners()},r.prototype.abort=function(){s("abort"),this.xo&&(this.xo.close(),s("close"),this.emit("close",null,"user"),this.xo=null),this._cleanup()},t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){i.call(this,t,e,n,r)}var o=n(12),i=n(23);o(r,i),r.enabled=i.enabled&&i.supportsCORS,t.exports=r},function(t,e,n){(function(e){"use strict";function r(t,e,n,r){u(t,e);var i=this;o.call(this),setTimeout(function(){i._start(t,e,n,r)},0)}var o=n(13).EventEmitter,i=n(12),s=n(4),a=n(7),c=e.XMLHttpRequest,u=function(){};i(r,o),r.prototype._start=function(t,e,n,o){var i=this;try{this.xhr=new c}catch(t){}if(!this.xhr)return u("no xhr"),this.emit("finish",0,"no xhr support"),void this._cleanup();e=a.addQuery(e,"t="+ +new Date),this.unloadRef=s.unloadAdd(function(){u("unload cleanup"),i._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){u("xhr timeout"),i.emit("finish",0,""),i._cleanup(!1)})}catch(t){return u("exception",t),this.emit("finish",0,""),void this._cleanup(!1)}if(o&&o.noCredentials||!r.supportsCORS||(u("withCredentials"),this.xhr.withCredentials="true"),o&&o.headers)for(var l in o.headers)this.xhr.setRequestHeader(l,o.headers[l]);this.xhr.onreadystatechange=function(){if(i.xhr){var t,e,n=i.xhr;switch(u("readyState",n.readyState),n.readyState){case 3:try{e=n.status,t=n.responseText}catch(t){}u("status",e),1223===e&&(e=204),200===e&&t&&t.length>0&&(u("chunk"),i.emit("chunk",e,t));break;case 4:e=n.status,u("status",e),1223===e&&(e=204),12005!==e&&12029!==e||(e=0),u("finish",e,n.responseText),i.emit("finish",e,n.responseText),i._cleanup(!1)}}};try{i.xhr.send(n)}catch(t){i.emit("finish",0,""),i._cleanup(!1)}},r.prototype._cleanup=function(t){if(u("cleanup"),this.xhr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(t){}this.unloadRef=this.xhr=null}},r.prototype.close=function(){u("close"),this._cleanup(!0)},r.enabled=!!c;var l=["Active"].concat("Object").join("X");!r.enabled&&l in e&&(u("overriding xmlhttprequest"),c=function(){try{return new e[l]("Microsoft.XMLHTTP")}catch(t){return null}},r.enabled=!!new c);var h=!1;try{h="withCredentials"in new c}catch(t){}r.supportsCORS=h,t.exports=r}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t,e,n){i.call(this,t,e,n,{noCredentials:!0})}var o=n(12),i=n(23);o(r,i),r.enabled=i.enabled,t.exports=r},function(t,e){(function(e){"use strict";t.exports={isOpera:function(){return e.navigator&&/opera/i.test(e.navigator.userAgent)},isKonqueror:function(){return e.navigator&&/konqueror/i.test(e.navigator.userAgent)},hasDomain:function(){if(!e.document)return!0;try{return!!e.document.domain}catch(t){return!1}}}}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t){if(!a.enabled)throw new Error("Transport created when disabled");i.call(this,t,"/xhr_streaming",s,a)}var o=n(12),i=n(17),s=n(21),a=n(27);o(r,i),r.enabled=function(t){return!t.cookie_needed&&!t.nullOrigin&&(a.enabled&&t.sameScheme)},r.transportName="xdr-streaming",r.roundTrips=2,t.exports=r},function(t,e,n){(function(e){"use strict";function r(t,e,n){u(t,e);var r=this;o.call(this),setTimeout(function(){r._start(t,e,n)},0)}var o=n(13).EventEmitter,i=n(12),s=n(4),a=n(25),c=n(7),u=function(){};i(r,o),r.prototype._start=function(t,n,r){u("_start");var o=this,i=new e.XDomainRequest;n=c.addQuery(n,"t="+ +new Date),i.onerror=function(){u("onerror"),o._error()},i.ontimeout=function(){u("ontimeout"),o._error()},i.onprogress=function(){u("progress",i.responseText),o.emit("chunk",200,i.responseText)},i.onload=function(){u("load"),o.emit("finish",200,i.responseText),o._cleanup(!1)},this.xdr=i,this.unloadRef=s.unloadAdd(function(){o._cleanup(!0)});try{this.xdr.open(t,n),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(r)}catch(t){this._error()}},r.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},r.prototype._cleanup=function(t){if(u("cleanup",t),this.xdr){if(this.removeAllListeners(),s.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(t){}this.unloadRef=this.xdr=null}},r.prototype.close=function(){u("close"),this._cleanup(!0)},r.enabled=!(!e.XDomainRequest||!a.hasDomain()),t.exports=r}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t){if(!r.enabled())throw new Error("Transport created when disabled");i.call(this,t,"/eventsource",s,a)}var o=n(12),i=n(17),s=n(29),a=n(22),c=n(30);o(r,i),r.enabled=function(){return!!c},r.transportName="eventsource",r.roundTrips=2,t.exports=r},function(t,e,n){"use strict";function r(t){a(t),i.call(this);var e=this,n=this.es=new s(t);n.onmessage=function(t){a("message",t.data),e.emit("message",decodeURI(t.data))},n.onerror=function(t){a("error",n.readyState,t);var r=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(r)}}var o=n(12),i=n(13).EventEmitter,s=n(30),a=function(){};o(r,i),r.prototype.abort=function(){a("abort"),this._cleanup(),this._close("user")},r.prototype._cleanup=function(){a("cleanup");var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},r.prototype._close=function(t){a("close",t);var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},t.exports=r},function(t,e){(function(e){t.exports=e.EventSource}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";var r=n(12),o=n(32),i=n(38);t.exports=function(t){function n(e,n){o.call(this,t.transportName,e,n)}return r(n,o),n.enabled=function(n,r){if(!e.document)return!1;var s=i.extend({},r);return s.sameOrigin=!0,t.enabled(s)&&o.enabled()},n.transportName="iframe-"+t.transportName,n.needBody=!0,n.roundTrips=o.roundTrips+t.roundTrips-1,n.facadeTransport=t,n}}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t,e,n){if(!r.enabled())throw new Error("Transport created when disabled");s.call(this);var o=this;this.origin=c.getOrigin(n),this.baseUrl=n,this.transUrl=e,this.transport=t,this.windowId=h.string(8);var i=c.addPath(n,"/iframe.html")+"#"+this.windowId;f(t,e,i),this.iframeObj=u.createIframe(i,function(t){f("err callback"),o.emit("close",1006,"Unable to load an iframe ("+t+")"),o.close()}),this.onmessageCallback=this._message.bind(this),l.attachEvent("message",this.onmessageCallback)}var o=n(12),i=n(33),s=n(13).EventEmitter,a=n(36),c=n(7),u=n(37),l=n(4),h=n(5),f=function(){};o(r,s),r.prototype.close=function(){if(f("close"),this.removeAllListeners(),this.iframeObj){l.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},r.prototype._message=function(t){if(f("message",t.data),!c.isOriginEqual(t.origin,this.origin))return void f("not same origin",t.origin,this.origin);var e;try{e=i.parse(t.data)}catch(e){return void f("bad json",t.data)}if(e.windowId!==this.windowId)return void f("mismatched window id",e.windowId,this.windowId);switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",i.stringify([a,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var n;try{n=i.parse(e.data)}catch(t){return void f("bad json",e.data)}this.emit("close",n[0],n[1]),this.close()}},r.prototype.postMessage=function(t,e){f("postMessage",t,e),this.iframeObj.post(i.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},r.prototype.send=function(t){f("send",t),this.postMessage("m",t)},r.enabled=function(){return u.iframeEnabled},r.transportName="iframe",r.roundTrips=2,t.exports=r},function(t,e,n){var r;(function(t,o){(function(){function i(t,e){function n(t){if(n[t]!==v)return n[t];var i;if("bug-string-char-index"==t)i="a"!="a"[0];else if("json"==t)i=n("json-stringify")&&n("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var u=e.stringify,l="function"==typeof u&&g;if(l){(s=function(){return 1}).toJSON=s;try{l="0"===u(0)&&"0"===u(new r)&&'""'==u(new o)&&u(b)===v&&u(v)===v&&u()===v&&"1"===u(s)&&"[1]"==u([s])&&"[null]"==u([v])&&"null"==u(null)&&"[null,null,null]"==u([v,b,null])&&u({a:[s,!0,!1,null,"\0\b\n\f\r\t"]})==a&&"1"===u(null,s)&&"[\n 1,\n 2\n]"==u([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==u(new c(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==u(new c(864e13))&&'"-000001-01-01T00:00:00.000Z"'==u(new c(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==u(new c(-1))}catch(t){l=!1}}i=l}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){s=h(a);var f=5==s.a.length&&1===s.a[0];if(f){try{f=!h('"\t"')}catch(t){}if(f)try{f=1!==h("01")}catch(t){}if(f)try{f=1!==h("1.")}catch(t){}}}}catch(t){f=!1}i=f}}return n[t]=!!i}t||(t=u.Object()),e||(e=u.Object());var r=t.Number||u.Number,o=t.String||u.String,s=t.Object||u.Object,c=t.Date||u.Date,l=t.SyntaxError||u.SyntaxError,h=t.TypeError||u.TypeError,f=t.Math||u.Math,p=t.JSON||u.JSON;"object"==typeof p&&p&&(e.stringify=p.stringify,e.parse=p.parse);var d,m,v,y=s.prototype,b=y.toString,g=new c(-0xc782b5b800cec);try{g=g.getUTCFullYear()==-109252&&0===g.getUTCMonth()&&1===g.getUTCDate()&&10==g.getUTCHours()&&37==g.getUTCMinutes()&&6==g.getUTCSeconds()&&708==g.getUTCMilliseconds()}catch(t){}if(!n("json")){var w="[object Function]",_="[object Date]",x="[object Number]",E="[object String]",S="[object Array]",T="[object Boolean]",C=n("bug-string-char-index");if(!g)var O=f.floor,k=[0,31,59,90,120,151,181,212,243,273,304,334],A=function(t,e){return k[e]+365*(t-1970)+O((t-1969+(e=+(e>1)))/4)-O((t-1901+e)/100)+O((t-1601+e)/400)};if((d=y.hasOwnProperty)||(d=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=b?d=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,d=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,d.call(this,t)}),m=function(t,e){var n,r,o,i=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(o in r)d.call(r,o)&&i++;return n=r=null,i?m=2==i?function(t,e){var n,r={},o=b.call(t)==w;for(n in t)o&&"prototype"==n||d.call(r,n)||!(r[n]=1)||!d.call(t,n)||e(n)}:function(t,e){var n,r,o=b.call(t)==w;for(n in t)o&&"prototype"==n||!d.call(t,n)||(r="constructor"===n)||e(n);(r||d.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],m=function(t,e){var n,o,i=b.call(t)==w,s=!i&&"function"!=typeof t.constructor&&a[typeof t.hasOwnProperty]&&t.hasOwnProperty||d;for(n in t)i&&"prototype"==n||!s.call(t,n)||e(n);for(o=r.length;n=r[--o];s.call(t,n)&&e(n));}),m(t,e)},!n("json-stringify")){var N={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},j="000000",I=function(t,e){return(j+(e||0)).slice(-t)},P="\\u00",R=function(t){for(var e='"',n=0,r=t.length,o=!C||r>10,i=o&&(C?t.split(""):t);n-1/0&&a<1/0){if(A){for(f=O(a/864e5),u=O(f/365.2425)+1970-1;A(u+1,0)<=f;u++);for(l=O((f-A(u,0))/30.42);A(u,l+1)<=f;l++);f=1+f-A(u,l),p=(a%864e5+864e5)%864e5,y=O(p/36e5)%24,g=O(p/6e4)%60,w=O(p/1e3)%60,C=p%1e3}else u=a.getUTCFullYear(),l=a.getUTCMonth(),f=a.getUTCDate(),y=a.getUTCHours(),g=a.getUTCMinutes(),w=a.getUTCSeconds(),C=a.getUTCMilliseconds();a=(u<=0||u>=1e4?(u<0?"-":"+")+I(6,u<0?-u:u):I(4,u))+"-"+I(2,l+1)+"-"+I(2,f)+"T"+I(2,y)+":"+I(2,g)+":"+I(2,w)+"."+I(3,C)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(c=b.call(a),c==T)return""+a;if(c==x)return a>-1/0&&a<1/0?""+a:"null";if(c==E)return R(""+a);if("object"==typeof a){for(P=s.length;P--;)if(s[P]===a)throw h();if(s.push(a),k=[],U=i,i+=o,c==S){for(j=0,P=a.length;j0)for(r="",n>10&&(n=10);r.length=48&&o<=57||o>=97&&o<=102||o>=65&&o<=70||D();t+=B("0x"+i.slice(e,U));break;default:D()}else{if(34==o)break;for(o=i.charCodeAt(U),e=U;o>=32&&92!=o&&34!=o;)o=i.charCodeAt(++U);t+=i.slice(e,U)}if(34==i.charCodeAt(U))return U++,t;D();default:if(e=U,45==o&&(r=!0,o=i.charCodeAt(++U)),o>=48&&o<=57){for(48==o&&(o=i.charCodeAt(U+1),o>=48&&o<=57)&&D(),r=!1;U=48&&o<=57);U++);if(46==i.charCodeAt(U)){for(n=++U;n=48&&o<=57);n++);n==U&&D(),U=n}if(o=i.charCodeAt(U),101==o||69==o){for(o=i.charCodeAt(++U),43!=o&&45!=o||U++,n=U;n=48&&o<=57);n++);n==U&&D(),U=n}return+i.slice(e,U)}if(r&&D(),"true"==i.slice(U,U+4))return U+=4,!0;if("false"==i.slice(U,U+5))return U+=5,!1;if("null"==i.slice(U,U+4))return U+=4,null;D()}return"$"},q=function(t){var e,n;if("$"==t&&D(),"string"==typeof t){if("@"==(C?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=F(),"]"!=t;n||(n=!0))n&&(","==t?(t=F(),"]"==t&&D()):D()),","==t&&D(),e.push(q(t));return e}if("{"==t){for(e={};t=F(), 2 | "}"!=t;n||(n=!0))n&&(","==t?(t=F(),"}"==t&&D()):D()),","!=t&&"string"==typeof t&&"@"==(C?t.charAt(0):t[0])&&":"==F()||D(),e[t.slice(1)]=q(F());return e}D()}return t},V=function(t,e,n){var r=$(t,e,n);r===v?delete t[e]:t[e]=r},$=function(t,e,n){var r,o=t[e];if("object"==typeof o&&o)if(b.call(o)==S)for(r=o.length;r--;)V(o,r,n);else m(o,function(t){V(o,t,n)});return n.call(t,e,o)};e.parse=function(t,e){var n,r;return U=0,M=""+t,n=q(F()),"$"!=F()&&D(),U=M=null,e&&b.call(e)==w?$((r={},r[""]=n,r),"",e):n}}}return e.runInContext=i,e}var s=n(35),a={function:!0,object:!0},c=a[typeof e]&&e&&!e.nodeType&&e,u=a[typeof window]&&window||this,l=c&&a[typeof t]&&t&&!t.nodeType&&"object"==typeof o&&o;if(!l||l.global!==l&&l.window!==l&&l.self!==l||(u=l),c&&!s)i(u,c);else{var h=u.JSON,f=u.JSON3,p=!1,d=i(u,u.JSON3={noConflict:function(){return p||(p=!0,u.JSON=h,u.JSON3=f,h=f=null),d}});u.JSON={parse:d.parse,stringify:d.stringify}}s&&(r=function(){return d}.call(e,n,e,t),!(void 0!==r&&(t.exports=r)))}).call(this)}).call(e,n(34)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e){t.exports="1.1.1"},function(t,e,n){(function(e){"use strict";var r=n(4),o=n(33),i=n(25),s=function(){};t.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){t.exports.WPrefix in e||(e[t.exports.WPrefix]={})},postMessage:function(n,r){e.parent!==e?e.parent.postMessage(o.stringify({windowId:t.exports.currentWindowId,type:n,data:r||""}),"*"):s("Cannot postMessage, no parent window.",n,r)},createIframe:function(t,n){var o,i,a=e.document.createElement("iframe"),c=function(){s("unattach"),clearTimeout(o);try{a.onload=null}catch(t){}a.onerror=null},u=function(){s("cleanup"),a&&(c(),setTimeout(function(){a&&a.parentNode.removeChild(a),a=null},0),r.unloadDel(i))},l=function(t){s("onerror",t),a&&(u(),n(t))},h=function(t,e){s("post",t,e);try{setTimeout(function(){a&&a.contentWindow&&a.contentWindow.postMessage(t,e)},0)}catch(t){}};return a.src=t,a.style.display="none",a.style.position="absolute",a.onerror=function(){l("onerror")},a.onload=function(){s("onload"),clearTimeout(o),o=setTimeout(function(){l("onload timeout")},2e3)},e.document.body.appendChild(a),o=setTimeout(function(){l("timeout")},15e3),i=r.unloadAdd(u),{post:h,cleanup:u,loaded:c}},createHtmlfile:function(n,o){var i,a,c,u=["Active"].concat("Object").join("X"),l=new e[u]("htmlfile"),h=function(){clearTimeout(i),c.onerror=null},f=function(){l&&(h(),r.unloadDel(a),c.parentNode.removeChild(c),c=l=null,CollectGarbage())},p=function(t){s("onerror",t),l&&(f(),o(t))},d=function(t,e){try{setTimeout(function(){c&&c.contentWindow&&c.contentWindow.postMessage(t,e)},0)}catch(t){}};l.open(),l.write(''),l.close(),l.parentWindow[t.exports.WPrefix]=e[t.exports.WPrefix];var m=l.createElement("div");return l.body.appendChild(m),c=l.createElement("iframe"),m.appendChild(c),c.src=n,c.onerror=function(){p("onerror")},i=setTimeout(function(){p("timeout")},15e3),a=r.unloadAdd(f),{post:d,cleanup:f,loaded:h}}},t.exports.iframeEnabled=!1,e.document&&(t.exports.iframeEnabled=("function"==typeof e.postMessage||"object"==typeof e.postMessage)&&!i.isKonqueror())}).call(e,function(){return this}())},function(t,e){"use strict";t.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,r=1,o=arguments.length;r')}catch(r){var n=e.document.createElement("iframe");return n.name=t,n}}function o(){u("createForm"),i=e.document.createElement("form"),i.style.display="none",i.style.position="absolute",i.method="POST",i.enctype="application/x-www-form-urlencoded",i.acceptCharset="UTF-8",s=e.document.createElement("textarea"),s.name="d",i.appendChild(s),e.document.body.appendChild(i)}var i,s,a=n(5),c=n(7),u=function(){};t.exports=function(t,e,n){u(t,e),i||o();var l="a"+a.string(8);i.target=l,i.action=c.addQuery(c.addPath(t,"/jsonp_send"),"i="+l);var h=r(l);h.id=l,h.style.display="none",i.appendChild(h);try{s.value=e}catch(t){}i.submit();var f=function(t){u("completed",l,t),h.onerror&&(h.onreadystatechange=h.onerror=h.onload=null,setTimeout(function(){u("cleaning up",l),h.parentNode.removeChild(h),h=null},500),s.value="",n(t))};return h.onerror=function(){u("onerror",l),f()},h.onload=function(){u("onload",l),f()},h.onreadystatechange=function(t){u("onreadystatechange",l,h.readyState,t),"complete"===h.readyState&&f()},function(){u("aborted",l),f(new Error("Aborted"))}}}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");b.call(this),this.readyState=r.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&v.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var o=n.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 u.string(o)}}this._server=n.server||u.numberString(1e3);var i=new s(t);if(!i.host||!i.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(i.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==i.protocol&&"https:"!==i.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+i.protocol+"' is not allowed.");var a="https:"===i.protocol;if("https"===g.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var c=e.sort();c.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e=3e3&&t<=4999}n(47);var i,s=n(8),a=n(12),c=n(33),u=n(5),l=n(48),h=n(7),f=n(4),p=n(49),d=n(38),m=n(25),v=n(50),y=n(51),b=n(14),g=n(52),w=n(53),_=n(54),x=n(55),E=function(){};a(r,b),r.prototype.close=function(t,e){if(t&&!o(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==r.CLOSING&&this.readyState!==r.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},r.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===r.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===r.OPEN&&this._transport.send(l.quote(t))},r.version=n(36),r.CONNECTING=0,r.OPEN=1,r.CLOSING=2,r.CLOSED=3,r.prototype._receiveInfo=function(t,e){if(E("_receiveInfo",e),this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=d.extend(t,this._urlInfo),E("info",t);var n=i.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,E(this._transports.length+" enabled transports"),this._connect()},r.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(E("attempt",t.transportName),t.needBody&&(!e.document.body||"undefined"!=typeof e.document.readyState&&"complete"!==e.document.readyState&&"interactive"!==e.document.readyState))return E("waiting for body"),this._transports.unshift(t),void f.attachEvent("load",this._connect.bind(this));var n=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),n),E("using timeout",n);var r=h.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),o=this._transportOptions[t.transportName];E("transport url",r);var i=new t(r,this._transUrl,o);return i.on("message",this._transportMessage.bind(this)),i.once("close",this._transportClose.bind(this)),i.transportName=t.transportName,void(this._transport=i)}this._close(2e3,"All transports failed",!1)},r.prototype._transportTimeout=function(){E("_transportTimeout"),this.readyState===r.CONNECTING&&this._transportClose(2007,"Transport timed out")},r.prototype._transportMessage=function(t){E("_transportMessage",t);var e,n=this,r=t.slice(0,1),o=t.slice(1);switch(r){case"o":return void this._open();case"h":return this.dispatchEvent(new y("heartbeat")),void E("heartbeat",this.transport)}if(o)try{e=c.parse(o)}catch(t){E("bad json",o)}if("undefined"==typeof e)return void E("empty payload",o);switch(r){case"a":Array.isArray(e)&&e.forEach(function(t){E("message",n.transport,t),n.dispatchEvent(new _(t))});break;case"m":E("message",this.transport,e),this.dispatchEvent(new _(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},r.prototype._transportClose=function(t,e){return E("_transportClose",this.transport,t,e),this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),o(t)||2e3===t||this.readyState!==r.CONNECTING?void this._close(t,e):void this._connect()},r.prototype._open=function(){E("_open",this._transport.transportName,this.readyState),this.readyState===r.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=r.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new y("open")),E("connected",this.transport)):this._close(1006,"Server lost session")},r.prototype._close=function(t,e,n){E("_close",this.transport,t,e,n,this.readyState);var o=!1;if(this._ir&&(o=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===r.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=r.CLOSING,setTimeout(function(){this.readyState=r.CLOSED,o&&this.dispatchEvent(new y("error"));var i=new w("close");i.wasClean=n||!1,i.code=t||1e3,i.reason=e,this.dispatchEvent(i),this.onmessage=this.onclose=this.onerror=null,E("disconnected")}.bind(this),0)},r.prototype.countRTO=function(t){return t>100?4*t:300+t},t.exports=function(t){return i=p(t),n(60)(r,t),r}}).call(e,function(){return this}())},function(t,e){"use strict";function n(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function r(t){return t>>>0}function o(){}var i,s=Array.prototype,a=Object.prototype,c=Function.prototype,u=String.prototype,l=s.slice,h=a.toString,f=function(t){return"[object Function]"===a.toString.call(t)},p=function(t){return"[object Array]"===h.call(t)},d=function(t){return"[object String]"===h.call(t)},m=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();i=m?function(t,e,n,r){!r&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,r){!r&&e in t||(t[e]=n)};var v=function(t,e,n){for(var r in e)a.hasOwnProperty.call(e,r)&&i(t,r,e[r],n)},y=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};v(c,{bind:function(t){var e=this;if(!f(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n=l.call(arguments,1),r=function(){if(this instanceof c){var r=e.apply(this,n.concat(l.call(arguments)));return Object(r)===r?r:this}return e.apply(t,n.concat(l.call(arguments)))},i=Math.max(0,e.length-n.length),s=[],a=0;a>>0;if(!f(t))throw new TypeError;for(;++o>>0;if(!r)return-1;var o=0;for(arguments.length>1&&(o=n(arguments[1])),o=o>=0?o:Math.max(0,r+o);o1?!function(){var t=void 0===/()??/.exec("")[1];u.split=function(e,n){var o=this;if(void 0===e&&0===n)return[];if("[object RegExp]"!==h.call(e))return x.call(this,e,n);var i,a,c,u,l=[],f=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),p=0;for(e=new RegExp(e.source,f+"g"),o+="",t||(i=new RegExp("^"+e.source+"$(?!\\s)",f)),n=void 0===n?-1>>>0:r(n);(a=e.exec(o))&&(c=a.index+a[0].length,!(c>p&&(l.push(o.slice(p,a.index)),!t&&a.length>1&&a[0].replace(i,function(){for(var t=1;t1&&a.index=n)));)e.lastIndex===a.index&&e.lastIndex++;return p===o.length?!u&&e.test("")||l.push(""):l.push(o.slice(p)),l.length>n?l.slice(0,n):l}}():"0".split(void 0,0).length&&(u.split=function(t,e){return void 0===t&&0===e?[]:x.call(this,t,e)});var E="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff",S="​",T="["+E+"]",C=new RegExp("^"+T+T+"*"),O=new RegExp(T+T+"*$"),k=u.trim&&(E.trim()||!S.trim());v(u,{trim:function(){if(void 0===this||null===this)throw new TypeError("can't convert "+this+" to object");return String(this).replace(C,"").replace(O,"")}},k);var A=u.substr,N="".substr&&"b"!=="0b".substr(-1);v(u,{substr:function(t,e){return A.call(this,t<0&&(t=this.length+t)<0?0:t,e)}},N)},function(t,e,n){"use strict";var r,o=n(33),i=/[\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,s=function(t){var e,n={},r=[];for(e=0;e<65536;e++)r.push(String.fromCharCode(e));return t.lastIndex=0,r.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};t.exports={quote:function(t){var e=o.stringify(t);return i.lastIndex=0,i.test(e)?(r||(r=s(i)),e.replace(i,function(t){return r[t]})):e}}},function(t,e,n){"use strict";var r=function(){};t.exports=function(t){return{filterToEnabled:function(e,n){var o={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){if(t)return"websocket"===t.transportName&&n.websocket===!1?void r("disabled from server","websocket"):e.length&&e.indexOf(t.transportName)===-1?void r("not in whitelist",t.transportName):void(t.enabled(n)?(r("enabled",t.transportName),o.main.push(t),t.facadeTransport&&o.facade.push(t.facadeTransport)):r("disabled",t.transportName))}),o}}}},function(t,e){(function(e){"use strict";var n={};["log","debug","warn"].forEach(function(t){var r;try{r=e.console&&e.console[t]&&e.console[t].apply}catch(t){}n[t]=r?function(){return e.console[t].apply(e.console,arguments)}:"log"===t?function(){}:n.log}),t.exports=n}).call(e,function(){return this}())},function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,t.exports=n},function(t,e){(function(e){"use strict";t.exports=e.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(){i.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var o=n(12),i=n(51);o(r,i),t.exports=r},function(t,e,n){"use strict";function r(t){i.call(this),this.initEvent("message",!1,!1),this.data=t}var o=n(12),i=n(51);o(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e){p(t);var n=this;o.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var o=n(13).EventEmitter,i=n(12),s=n(7),a=n(27),c=n(22),u=n(24),l=n(56),h=n(57),f=n(59),p=function(){};i(r,o),r._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,u):c.enabled?new f(e,c):a.enabled&&n.sameScheme?new f(e,a):h.enabled()?new h(t,e):new f(e,l)},r.prototype.doXhr=function(t,e){var n=this,o=s.addPath(t,"/info");p("doXhr",o),this.xo=r._getReceiver(t,o,e),this.timeoutRef=setTimeout(function(){p("timeout"),n._cleanup(!1),n.emit("finish")},r.timeout),this.xo.once("finish",function(t,e){p("finish",t,e),n._cleanup(!0),n.emit("finish",t,e)})},r.prototype._cleanup=function(t){p("_cleanup"),clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},r.prototype.close=function(){p("close"),this.removeAllListeners(),this._cleanup(!1)},r.timeout=8e3,t.exports=r},function(t,e,n){"use strict";function r(){var t=this;o.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},r.timeout)}var o=n(13).EventEmitter,i=n(12);i(r,o),r.prototype.close=function(){clearTimeout(this.to)},r.timeout=2e3,t.exports=r},function(t,e,n){(function(e){"use strict";function r(t,n){var r=this;o.call(this);var i=function(){var e=r.ifr=new c(u.transportName,n,t);e.once("message",function(t){if(t){var e;try{e=s.parse(t)}catch(e){return l("bad json",t),r.emit("finish"),void r.close()}var n=e[0],o=e[1];r.emit("finish",n,o)}r.close()}),e.once("close",function(){r.emit("finish"),r.close()})};e.document.body?i():a.attachEvent("load",i)}var o=n(13).EventEmitter,i=n(12),s=n(33),a=n(4),c=n(32),u=n(58),l=function(){};i(r,o),r.enabled=function(){return c.enabled()},r.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},t.exports=r}).call(e,function(){return this}())},function(t,e,n){"use strict";function r(t){var e=this;i.call(this),this.ir=new c(t,a),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",s.stringify([t,n]))})}var o=n(12),i=n(13).EventEmitter,s=n(33),a=n(24),c=n(59);o(r,i),r.transportName="iframe-info-receiver",r.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},t.exports=r},function(t,e,n){"use strict";function r(t,e){o.call(this);var n=this,r=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var o,i;if(200===t){if(i=+new Date-r,e)try{o=s.parse(e)}catch(t){c("bad json",e)}a.isObject(o)||(o={})}n.emit("finish",o,i),n.removeAllListeners()})}var o=n(13).EventEmitter,i=n(12),s=n(33),a=n(38),c=function(){};i(r,o),r.prototype.close=function(){this.removeAllListeners(),this.xo.close()},t.exports=r},function(t,e,n){"use strict";var r=n(7),o=n(4),i=n(33),s=n(61),a=n(58),c=n(37),u=n(52),l=function(){};t.exports=function(t,e){var n={};e.forEach(function(t){t.facadeTransport&&(n[t.facadeTransport.transportName]=t.facadeTransport)}),n[a.transportName]=a;var h;t.bootstrap_iframe=function(){var e;c.currentWindowId=u.hash.slice(1);var a=function(o){if(o.source===parent&&("undefined"==typeof h&&(h=o.origin),o.origin===h)){var a;try{a=i.parse(o.data)}catch(t){return void l("bad json",o.data)}if(a.windowId===c.currentWindowId)switch(a.type){case"s":var f;try{f=i.parse(a.data)}catch(t){l("bad json",a.data);break}var p=f[0],d=f[1],m=f[2],v=f[3];if(l(p,d,m,v),p!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+p+'", the iframe: "'+t.version+'".');if(!r.isOriginEqual(m,u.href)||!r.isOriginEqual(v,u.href))throw new Error("Can't connect to different domain from within an iframe. ("+u.href+", "+m+", "+v+")");e=new s(new n[d](m,v));break;case"m":e._send(a.data);break;case"c":e&&e._close(),e=null}}};o.attachEvent("message",a),c.postMessage("s")}}},function(t,e,n){"use strict";function r(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var o=n(33),i=n(37);r.prototype._transportClose=function(t,e){i.postMessage("c",o.stringify([t,e]))},r.prototype._transportMessage=function(t){i.postMessage("t",t)},r.prototype._send=function(t){this._transport.send(t)},r.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},t.exports=r},function(t,e,n){!function(e,n){t.exports=n()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),i=r(o),s=n(3),a={VERSIONS:s.VERSIONS,client:function(t){var e=arguments.length<=1||void 0===arguments[1]?{protocols:s.VERSIONS.supportedProtocols()}:arguments[1],n=new WebSocket(t,e.protocols);return new i.default(n,e)},over:function(){for(var t=arguments.length,e=Array(t),n=0;n>> "+r),this._wsSend(r)}},{key:"_wsSend",value:function(t){for(this.binary&&(t=(0,u.unicodeStringToTypedArray)(t)),this.debug(">>> length "+t.length);;){if(!(t.length>this.maxWebSocketFrameSize))return this.ws.send(t);this.ws.send(t.slice(0,this.maxWebSocketFrameSize)),t=t.slice(this.maxWebSocketFrameSize),this.debug("remaining = "+t.length)}}},{key:"_setupHeartbeat",value:function(t){var e=this;if(this.version===u.VERSIONS.V1_1||this.version===u.VERSIONS.V1_2){var n=(t["heart-beat"]||"0,0").split(",").map(function(t){return parseInt(t,10)}),r=i(n,2),o=r[0],s=r[1];if(0!==this.heartbeat.outgoing&&0!==s){var a=Math.max(this.heartbeat.outgoing,s);this.debug("send PING every "+a+"ms"),this.pinger=setInterval(function(){e._wsSend(u.BYTES.LF),e.debug(">>> PING")},a)}0!==this.heartbeat.incoming&&0!==o&&!function(){var t=Math.max(e.heartbeat.incoming,o);e.debug("check PONG every "+t+"ms"),e.ponger=setInterval(function(){var n=Date.now()-e.serverActivity;n>2*t&&(e.debug("did not receive server activity for the last "+n+"ms"),e.ws.close())},t)}()}}},{key:"_parseConnect",value:function(){for(var t={},e=void 0,n=void 0,r=arguments.length,o=Array(r),i=0;i { 160 | let now = Date.now(); 161 | for (let mEventIndex in this.monitorEvents) { 162 | let monitorParm = this.monitorEvents[mEventIndex]; 163 | if(monitorParm){ 164 | let delta = now - monitorParm.sendTime; 165 | // zh:判断是否超时 166 | // ja:タイムアウトをチェックする 167 | // en:Check timeout 168 | if (delta > monitorParm.timeout) { 169 | // zh:超时回调处理 170 | // ja:タイムアウトコールバック 171 | // en:Timeout callback 172 | if(typeof this.timeoutCallback == 'function' ){ 173 | this.timeoutCallback(monitorParm.cmd); 174 | } 175 | // zh:清除此事件 176 | // ja:イベントをクリアする 177 | // en:Clear the event 178 | delete this.monitorEvents[mEventIndex]; 179 | } 180 | } 181 | } 182 | }, this.monitorIntervalTime); 183 | } 184 | } 185 | // zh:带监视的连接函数为原型函数 186 | // ja:監視機能を付け接続関数をプロトタイプ関数として設定する 187 | // en:Set the connection function that with monitor function 188 | Vue.prototype.connetWM = connetWM; 189 | // zh:初始参数设置 190 | // ja:初期値設定 191 | // en:Set initial value 192 | let addListeners = function() { 193 | if (this.$options["stompClient"]) { 194 | let conf = this.$options.stompClient; 195 | // zh:设置超时回调函数 196 | // ja:タイムアウトコールバック関数を設定する 197 | // en:Set the timeout callback function 198 | if (conf.timeout){ 199 | if( typeof conf.timeout !== 'function') { 200 | throw { 201 | name : 'Vue Stomp Error', 202 | message : 'The argument[timeout] must be a function.' 203 | }; 204 | } 205 | this.timeoutCallback = conf.timeout; 206 | } 207 | // zh:监视轮询时间设置 208 | // ja:監視ポーリング時間を設定する 209 | // en:Set Monitor polling time 210 | let monitorIntervalTime = 100; 211 | if(conf.monitorIntervalTime && typeof conf.monitorIntervalTime === 'number' && !isNaN(conf.monitorIntervalTime) ){ 212 | monitorIntervalTime = conf.monitorIntervalTime; 213 | } 214 | this.monitorIntervalTime = monitorIntervalTime; 215 | // zh:设置是否要重连 216 | // ja:リコネクションを設定する 217 | // en:Set reconnect 218 | if(conf.stompReconnect){ 219 | this.stompReconnect = conf.stompReconnect; 220 | } 221 | } 222 | }; 223 | // zh:断开连接处理 224 | // ja:切断処理 225 | // en:disconnect 226 | let disconnetWM = function(){ 227 | // zh:断开连接 228 | // ja:切断 229 | // en:disconnect 230 | if( this.$stompClient && this.$stompClient.connected){ 231 | this.$stompClient.disconnect(); 232 | } 233 | 234 | // zh:清除所有监视对象 235 | // ja:すべで監視対象をクリアする 236 | // en:Clear all of monitor target 237 | clearInterval(this.responseMonitor); 238 | this.responseMonitor = null; 239 | 240 | }; 241 | Vue.prototype.disconnetWM = disconnetWM; 242 | 243 | // zh:初始参数移除 244 | // ja:初期値を削除する 245 | // en:Delete the initial value 246 | let removeListeners = function() { 247 | if (this.$options["stompClient"]) { 248 | this.disconnetWM(); 249 | 250 | delete this.monitorEvents; 251 | 252 | delete this.timeoutCallback; 253 | } 254 | }; 255 | 256 | Vue.mixin({ 257 | // Vue v1.x 258 | beforeCompile: addListeners, 259 | 260 | // Vue v2.x 261 | beforeCreate: addListeners, 262 | 263 | beforeDestroy: removeListeners 264 | }); 265 | } 266 | }; 267 | -------------------------------------------------------------------------------- /webpack.build.config.js: -------------------------------------------------------------------------------- 1 | 2 | var webpack = require('webpack'); 3 | var path = require('path'); 4 | 5 | var paths = { 6 | src: './src/', 7 | dist: './dist/' 8 | }; 9 | 10 | module.exports = [ 11 | { 12 | devtool: "source-map", 13 | entry: "./src/index", 14 | output: { 15 | path: paths.dist, 16 | publicPath: paths.dist, 17 | filename: "vue-stomp.js", 18 | library: "VueStomp", 19 | libraryTarget: "umd" 20 | }, 21 | resolve: { 22 | extensions: ['', '.js', '.vue', '.styl'], 23 | alias: { 24 | 'src': path.resolve(__dirname, '') 25 | } 26 | }, 27 | resolveLoader: { 28 | root: path.join(__dirname, 'node_modules') 29 | }, 30 | plugins: [ 31 | new webpack.DefinePlugin({ 32 | "process.env" : { 33 | NODE_ENV : JSON.stringify("production") 34 | } 35 | }), 36 | new webpack.optimize.UglifyJsPlugin({ 37 | compress: { 38 | warnings: false 39 | } 40 | }), 41 | new webpack.optimize.DedupePlugin() 42 | ], 43 | module: { 44 | loaders: [ 45 | { 46 | "test": /\.js?$/, 47 | "exclude": /node_modules/, 48 | "loader": "babel" 49 | }, 50 | { 51 | "test": /\.vue$/, 52 | "loader": "vue" 53 | } 54 | ] 55 | }, 56 | node: { 57 | fs: "empty" 58 | } 59 | } 60 | 61 | ]; -------------------------------------------------------------------------------- /webpack.dev.config.js: -------------------------------------------------------------------------------- 1 | var vue = require('vue-loader'); 2 | var webpack = require('webpack'); 3 | var path = require('path'); 4 | 5 | var paths = { 6 | src: './src/', 7 | dist: './dist/' 8 | }; 9 | 10 | module.exports = { 11 | devtool: "eval-source-map", 12 | entry: { 13 | app: path.resolve("dev", "main.js") 14 | }, 15 | output: { 16 | path: path.resolve("dev"), 17 | filename: "[name].js", 18 | publicPath: "/" 19 | }, 20 | resolve: { 21 | extensions: ['', '.js', '.vue', '.styl'], 22 | alias: { 23 | 'src': path.resolve(__dirname, '') 24 | } 25 | }, 26 | resolveLoader: { 27 | root: path.join(__dirname, 'node_modules') 28 | }, 29 | module: { 30 | loaders: [ 31 | { 32 | "test": /\.js?$/, 33 | "exclude": /node_modules/, 34 | "loader": "babel" 35 | }, 36 | { 37 | "test": /\.vue?$/, 38 | "loader": "vue" 39 | } 40 | ] 41 | }, 42 | plugins: [ 43 | ] 44 | }; --------------------------------------------------------------------------------