this.name=a.name,this.serviceType=a.serviceType,this.isAdvertised=!1,this._serviceCallback=null}vare=a("./ServiceResponse"),f=(a("./ServiceRequest"),a("eventemitter2").EventEmitter2);d.prototype.__proto__=f.prototype,d.prototype.callService=function(a,b,c){if(!this.isAdvertised){vard="call_service:"+this.name+":"+++this.ros.idCounter;(b||c)&&this.ros.once(d,function(a){void0!==a.result&&a.result===!1?"function"==typeofc&&c(a.values):"function"==typeofb&&b(newe(a.values))});varf={op:"call_service",id:d,service:this.name,type:this.serviceType,args:a};this.ros.callOnConnection(f)}},d.prototype.advertise=function(a){this.isAdvertised||"function"!=typeofa||(this._serviceCallback=a,this.ros.on(this.name,this._serviceResponse.bind(this)),this.ros.callOnConnection({op:"advertise_service",type:this.serviceType,service:this.name}),this.isAdvertised=!0)},d.prototype.unadvertise=function(){this.isAdvertised&&(this.ros.callOnConnection({op:"unadvertise_service",service:this.name}),this.isAdvertised=!1)},d.prototype._serviceResponse=function(a){varb={},c=this._serviceCallback(a.args,b),d={op:"service_response",service:this.name,values:newe(b),result:c};a.id&&(d.id=a.id),this.ros.callOnConnection(d)},b.exports=d},{"./ServiceRequest":17,"./ServiceResponse":18,eventemitter2:2}],17:[function(a,b,c){functiond(a){e(this,a)}vare=a("object-assign");b.exports=d},{"object-assign":3}],18:[function(a,b,c){functiond(a){e(this,a)}vare=a("object-assign");b.exports=d},{"object-assign":3}],19:[function(a,b,c){"use strict";functiond(a){functionb(b){"publish"===b.op?a.emit(b.topic,b.msg):"service_response"===b.op?a.emit(b.id,b):"call_service"===b.op?a.emit(b.service,b):"status"===b.op&&(b.id?a.emit("status:"+b.id,b):a.emit("status",b))}functionc(a,b){"png"===a.op?e(a.data,b):b(a)}functiond(a,b){if(!h)throw"Cannot process BSON encoded message without BSON header.";varc=newFileReader;c.onload=function(){vara=newUint8Array(this.result),c=h.deserialize(a);b(c)},c.readAsArrayBuffer(a)}return{onopen:function(b){a.isConnected=!0,a.emit("connection",b)},onclose:function(b){a.isConnected=!1,a.emit("close",b)},onerror:function(b){a.emit("error",b)},onmessage:function(a){if("undefined"!=typeofBlob&&a.datainstanceofBlob)d(a.data,function(a){c(a,b)});elseif(a.datainstanceofArrayBuffer){vare=f.decode(a.data,g);b(e)}else{varh=JSON.parse("string"==typeofa?a:a.data);c(h,b)}}}}vare=a("../util/decompressPng"),f=a("cbor-js"),g=a("../util/cborTypedArrayTags"),h=null;"undefined"!=typeofbson&&(h=bson().BSON),b.exports=d},{"../util/cborTypedArrayTags":42,"../util/decompressPng":45,"cbor-js":1}],20:[function(a,b,c){functiond(a){a=a||{},this.ros=a.ros,this.name=a.name,this.messageType=a.messageType,this.isAdvertised=!1,this.compression=a.compression||"none",this.throttle_rate=a.throttle_rate||0,this.latch=a.latch||!1,this.queue_size=a.queue_size||100,this.queue_length=a.queue_length||0,this.reconnect_on_close=void0===a.reconnect_on_close||a.reconnect_on_close,this.compression&&"png"!==this.compression&&"cbor"!==this.compression&&"none"!==this.compression&&(this.emit("warning",this.compression+" compression is not supported. No compression will be used."),this.compression="none"),this.throttle_rate<0&&(this.emit("warning",this.throttle_rate+" is not allowed. Set to 0"),this.throttle_rate=0);varb=this;this.reconnect_on_close?this.callForSubscribeAndAdvertise=function(a){b.ros.callOnConnection(a),b.waitForReconnect=!1,b.reconnectFunc=function(){b.waitForReconnect||(b.waitForReconnect=!0,b.ros.callOnConnection(a),b.ros.once("connection",function(){b.waitForReconnect=!1}))},b.ros.on("close",b.reconnectFunc)}:this.callForSubscribeAndAdvertise=this.ros.callOnConnection,this._messageCallback=function(a){b.emit("message",newf(a))}}vare=a("eventemitter2").EventEmitter2,f=a("./Message");d.prototype.__proto__=e.prototype,d.prototype.subscribe=function(a){"function"==typeofa&&this.on("message",a),this.subscribeId||(this.ros.on(this.name,this._messageCallback),this.subscribeId="subscribe:"+this.name+":"+++this.ros.idCounter,this.callForSubscribeAndAdv