(function(){varn;n=function(n){vart,e;returne=newPeer({key:"h7nlefbgavh1tt9"}),t=function(){functionn(n,t,o,i){varr;this.engine=n,this.HB=t,this.execution_listener=o,this.yatta=i,this.peer=e,this.connections=[],this.peer.on("connection",function(n){returnfunction(t){returnt.send("hey"),n.addConnection(t)}}(this)),r=function(n){returnfunction(t){returnn.send(t)}}(this),this.execution_listener.push(r)}returnn.prototype.connectToPeer=function(n){returnthis.addConnection(e.connect(n))},n.prototype.addConnection=function(n){vart;returnthis.connections.push(n),n.on("data",function(n){returnfunction(t){if("hey"!==t){if(null!=t.HB)returnn.engine.applyOpsCheckDouble(t.HB);if(null!=t.op)returnn.engine.applyOp(t.op);thrownewError("Can't parse this operation")}}}(this)),t=function(t){returnfunction(){returnn.send({HB:t.yatta.getHistoryBuffer()._encode()})}}(this),setTimeout(t,1e3)},n.prototype.send=function(n){vart,e,o,i,r;if(n.uid.creator===this.HB.getUserId()&&"string"!=typeofn.uid.op_number){for(i=this.connections,r=[],e=0,o=i.length;o>e;e++)t=i[e],r.push(t.send({op:n}));returnr}},n.prototype.receive=function(n){returnn.uid.creator!==this.HB.getUserId()?this.engine.applyOp(n):void0},n}(),e.on("open",function(e){returnn(t,e)})},module.exports=n,"undefined"!=typeofwindow&&null!==window&&(null==window.Y&&(window.Y={}),window.Y.createPeerJsConnector=n)}).call(this);