<!doctypehtml><html lang=tr style=height:100%><title>{{{title}}} - Messenger</title><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=format-detection content="telephone=no"><meta name=robots content=noindex,nofollow><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><link type=text/css href=styles/messenger.css media=screen rel=stylesheet title=CSS><link rel=apple-touch-icon href=/favicon-303x303.png><script src=scripts/common-0.0.1{{min}}.js></script><script src=scripts/filesaver.min.js></script><body style=font-family:Arial,Helvetica,sans-serif><div id=xtop style="position:absolute;left:0;right:0;top:0;height:38px;background-color:#036;color:#eee;box-shadow:3px 3px 10px gray"><img style=float:left height=38 src=messenger.png><div style=position:absolute;background-color:#036;right:0;height:38px><div id=saveButton class="icon15 topButton"style=margin-right:4px title="Sohbeti kaydedin"onclick=saveChatSession()></div><div id=notifyButton class="icon13 topButton"style=display:none title="Tarayıcı bildirimini etkinleştir"onclick=enableNotificationsButtonClick()></div><div id=fileButton class="icon4 topButton"title="Dosya paylaşın"style=display:none onclick=fileButtonClick()></div><div id=camButton class="icon2 topButton"title="Kamera ve mikrofonu etkinleştirin"style=display:none onclick=camButtonClick()></div><div id=micButton class="icon6 topButton"title="Mikrofonu etkinleştir"style=display:none onclick=micButtonClick()></div><div id=hangupButton class="icon11 topRedButton"title="Telefonu kapatmak"style=display:none onclick=hangUpButtonClick(1)></div><div id=recordIcon class=deskareaicon title="Sunucu bu oturumu kaydediyor"style=background-color:red;margin:6px;margin-top:7px;border-radius:12px;height:24px;width:24px;float:right;display:none></div></div><div style=padding-top:9px;padding-left:6px;font-size:20px;display:inline-block><b><span id=xtitle></span></b></div></div><div id=xmiddle style=position:absolute;left:0;right:0;top:38px;bottom:36px;font-size:18px><div id=xmsgparent style=position:absolute;left:0;right:0;bottom:0;max-height:100%;overflow-y:auto><div id=xmsg style=padding:5px></div><div id=typingIndicator style=display:none;margin-left:5px;clear:both><img src=images/3dots-24.gif srcset="images/3dots-48.gif 2x"></div></div></div><div id=xbottom style=position:absolute;left:0;right:0;bottom:0;height:36px;background-color:#036;font-size:18px><table style=width:100%><tr><td><input id=xouttext style=box-sizing:border-box;width:100%;font-size:18px onfocus=onUserInputFocus(1) onblur=onUserInputFocus(0) onkeyup=updateLocalOutText()><td style=width:1px><input type=button id=sendButton value=Gönder style=box-sizing:border-box;float:right;font-size:18px onclick=xsend(event)><td style=width:1px><input type=button id=clearButton value=Açık style=box-sizing:border-box;float:right;font-size:18px onclick=displayClear()></table></div><div id=remoteVideo style="position:absolute;right:24px;top:45px;width:320px;height:calc(240px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Uzaktan kumanda</div><video id=remoteVideoCanvas autoplay style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);background-color:#000"onclick=remotePlay(event)></video><div id=remoteClickToView style="position:absolute;top:20px;left:0;width:100%;height:calc(100% - 30px);color:#fff;text-align:center;padding-top:20px;display:none"onclick=remotePlay(event)>Görmek için buraya tıkla.</div></div><div id=localVideo style="position:absolute;right:24px;top:320px;width:160px;height:calc(120px + 30px);background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><div style=position:absolute;right:0;left:0;top:2.5px;text-align:center>Yerel</div><video id=localVideoCanvas autoplay muted style="position:absolute;top:20px;left:0;right:100%;height:calc(100% - 30px);background-color:#000"></video></div><canvas width=256 height=256 id=remoteImage style="position:absolute;right:24px;top:45px;width:200px;height:200px;background-color:gray;border-radius:12px 12px 12px 12px;box-shadow:3px 3px 10px gray;display:none"><input id=uploadFileInput type=file multiple style=display:none><script onunload=onUnLoad()>var random="{{{randomlength}}}",userInputFocus=0,socket=null,state=0,args=XparseUriArgs(),pushMessaging=(args.key&&0==isAlphaNumeric(args.key)&&delete args.key,args.locale&&0==isAlphaNumeric(args.locale)&&delete args.locale,1==args.pmt),random=Math.random(),webrtcSessions={},webchannel=null,localStream=null,remoteStream=null,multiWebRtc=!0,userMediaSupport=0,notification=null,meshMessengerTitle=(getUserMediaSupport(function(e){userMediaSupport=e}),"{{{meshMessengerTitle}}}"),meshMessengerImage="{{{meshMessengerImage}}}",remoteUserName="{{{username}}}",remoteUserId="{{{userid}}}",webrtcconfiguration="{{{webrtconfig}}}";if(""==webrtcconfiguration)webrtcconfiguration=null;else try{webrtcconfiguration=JSON.parse(decodeURIComponent(webrtcconfiguration))}catch(e){console.log('Invalid WebRTC config: "'+webrtcconfiguration+'".'),webrtcconfiguration=null}var windowFocus=!0,chatTextSession=(new Date).toString()+"\r\n",localOutText=!1,remoteOutText=!1,remoteImage=!1,serverRecording=!1,notificationSupport=!0,fileUploads=[],fileDownloads={},currentFileUpload=null,currentFileDownload=null;function resizeVideos(){var e=0;null!=remoteStream?(e=320*Q("remoteVideoCanvas").videoHeight/Q("remoteVideoCanvas").videoWidth,QS("remoteVideo").height="calc("+e+"px + 30px)"):1==remoteImage&&(e+=200),null!=localStream&&(QS("localVideo").height="calc("+160*Q("localVideoCanvas").videoHeight/Q("localVideoCanvas").videoWidth+"px + 30px)",QS("localVideo").top=e+50+(null!=remoteStream?30:0)+"px")}setInterval(resizeVideos,1e3);var newTitle="";args.title?(newTitle=decodeURIComponent(args.title),document.title=document.title+" - "+decodeURIComponent(args.title)):newTitle="!"==meshMessengerTitle?"MeshMessenger":decodeURIComponent(meshMessengerTitle),newTitle=newTitle.split("{0}").join(decodeURIComponent(remoteUserName)).split("{1}").join(decodeURIComponent(remoteUserId)),QH("xtitle",EscapeHtml(newTitle).split(" ").join("&nbsp"));try{Notification&&QV("notifyButton","granted"!=Notification.permission)}catch(e){notificationSupport=!1}function onUserInputFocus(e){userInputFocus=e}function displayClear(){chatTextSession=(new Date).toString()+"\r\n",QH("xmsg",""),cancelAllFileTransfers(),fileUploads=[],fileDownloads={}}function getUserMediaSupport(i){try{navigator.mediaDevices.enumerateDevices().then(function(e){try{var t=0,n=0;e.forEach(function(e){"audioinput"===e.kind&&(t=1),"videoinput"===e.kind&&(n=1)}),0==t&&i(0),i(t+n)}catch(e){}})}catch(e){}}function displayControl(e){chatTextSession+=(new Date).toLocaleTimeString()+" - Kontrol> "+e+"\r\n",QA("xmsg",'<div style="clear:both"><div style="color:gray;float:left;margin-bottom:2px">'+EscapeHtml(e)+"</div><div></div></div>"),Q("xmsgparent").scrollTop=Q("xmsgparent").scrollHeight}function displayLocalVideo(e){QV("localVideo",e),adjustVideoWindows()}function displayRemoteVideo(e){QV("remoteVideo",e),adjustVideoWindows()}function adjustVideoWindows(){QS("localVideo").display;var e="none"!=QS("remoteVideo").display;QV("remoteImage",1==remoteImage&&0==e),QS("localVideo").top=e||remoteImage?"320px":"45px",resizeVideos()}function displayRemote(e){chatTextSession+=(new Date).toLocaleTimeString()+" - Uzaktan kumanda> "+e+"\r\n",QA("xmsg",'<div style="clear:both"><div class="remoteBubble">'+EscapeHtml(e)+"</div><div></div></div>"),Q("xmsgparent").scrollTop=Q("xmsgparent").scrollHeight,notificationSupport&&(Notification&&QV("notifyButton","granted"!=Notification.permission),Notification)&&0==windowFocus&&"granted"==Notification.permission&&(null!=notification&&(notification.close(),notification=null),notification=new Notification(Q("xtitle").innerHTML.split("&nbsp;").join(" "),{body:e}))}function xsend(e){notificationSupport&&(null!=notification&&(notification.close(),notification=null),Notification)&&QV("notifyButton","granted"!=Notification.permission);var t=Q("xouttext").value;0<t.length&&(chatTextSession+=(new Date).toLocaleTimeString()+" - Yerel> "+t+"\r\n",QA("xmsg",'<div style="clear:both"><div class="localBubble">'+EscapeHtml(t)+"</div><div></div></div>"),Q("xmsgparent").scrollTop=Q("xmsgparent").scrollHeight,2!=state&&!pushMessaging||send({action:"chat",msg:t}),Q("xouttext").value="",Q("xouttext").focus(),localOutText=!1)}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function updateControls(){QE("sendButton",2==state||pushMessaging),QE("clearButton",2==state||pushMessaging),QE("xouttext",2==state||pushMessaging),QV("fileButton",2==state),QV("camButton",webchannel&&webchannel.ok&&!localStream&&2==userMediaSupport),QV("micButton",webchannel&&webchannel.ok&&!localStream&&0<userMediaSupport),QV("hangupButton",webchannel&&webchannel.ok&&localStream),updateLocalOutText()}function startWebRTC(t,e){var n;return null!=webrtcSessions[0]&&0==multiWebRtc?webrtcSessions[0]:(n=null,"undefined"!=typeof RTCPeerConnection?n=new RTCPeerConnection(webrtcconfiguration):"undefined"!=typeof webkitRTCPeerConnection&&(n=new webkitRTCPeerConnection(webrtcconfiguration)),null==n?null:(n.id=t,n.onicecandidate=function(e){try{null!=e.candidate&&sendws({action:"webRtcIce",ice:e.candidate,id:this.id})}catch(e){}},n.oniceconnectionstatechange=function(){n&&"failed"==n.iceConnectionState&&(n.close(),webrtcSessions[n.id])&&delete webrtcSessions[n.id]},n.ondatachannel=function(e){(webchannel=e.channel).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),0==serverRecording&&sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}},n.onnegotiationneeded=function(e){null==n.holdTimer&&(n.holdTimer=setTimeout(function(){n.holdTimer=null,n.createOffer(function(e){n.setLocalDescription(e,function(){sendws({action:"webRtcSdp",sdp:e,id:t})},function(){hangUpButtonClick(t)})},function(){hangUpButtonClick(t)})},20))},n.ontrack=function(e){QV("remoteClickToView",!1);var n=Q("remoteVideoCanvas");n.srcObject=remoteStream=e.streams[0],n.onloadedmetadata=function(e){var t=n.play();void 0!==t&&t.then(function(){}).catch(function(e){QV("remoteClickToView",!0)})},displayRemoteVideo(!0)},1==e&&((webchannel=n.createDataChannel("DataChannel",{})).onmessage=function(e){processMessage(e.data,2)},webchannel.onopen=function(){webchannel.ok=!0,updateControls(),0==serverRecording&&sendws({action:"rtcSwitch",v:0})},webchannel.onclose=function(e){webchannel&&webchannel.ok?disconnect():hangUpButtonClick(0)}),webrtcSessions[t]=n))}function remotePlay(){QV("remoteClickToView",!1),Q("remoteVideoCanvas").play()}function webRtcHandleOffer(i,e){var t=webrtcSessions[i];t&&t.setRemoteDescription(new RTCSessionDescription(e),function(){"offer"==e.type&&t.createAnswer(function(n){t.setLocalDescription(n,function(e,t){try{sendws({action:"webRtcSdp",sdp:n,id:i})}catch(e){}},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})},function(){hangUpButtonClick(i)})}function performWebRtcSwitch(){!serverRecording&&webchannel&&webchannel.ok&&(sendws({action:"rtcSwitch",v:1}),webchannel.xoutBuffer=[])}function disconnect(){serverRecording=!1,QV("recordIcon",!1),0<state&&displayControl("Bağlantı kapandı."),1<state&&setTimeout(start,500),cancelAllFileTransfers(),hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),null!=socket&&(socket.close(),socket=null),updateControls(),state=0,remoteImage=!1,QV("remoteImage",!1),updateLocalOutText(),updateRemoteOutText()}function send(e){if(2==state||0!=pushMessaging)if("object"==typeof e&&(e=JSON.stringify(e)),!serverRecording&&webchannel&&webchannel.ok)null!=webchannel.xoutBuffer?webchannel.xoutBuffer.push(e):webchannel.send(e);else if(null!=socket)try{socket.send(e)}catch(e){}}function sendws(e){2==state&&("object"==typeof e&&(e=JSON.stringify(e)),null!=socket)&&socket.send(e)}function webRtcIdSwitch(e){return 0==e?0:3-e}function drawRemoteImage(e){var t=Q("remoteImage"),n=t.getContext("2d"),i=new Image;i.onload=function(){n.drawImage(this,0,0,t.width,t.height),remoteImage=!0,adjustVideoWindows()},i.src=e}function processMessage(t,e){if("string"==typeof t){try{t=JSON.parse(t)}catch(e){return void console.log("Unable to parse",t)}if("102938"==t.ctrlChannel)switch(t.type){case"image":drawRemoteImage(t.image);break;case"ping":send({ctrlChannel:"102938",type:"pong"})}else switch(t.action){case"chat":displayRemote(t.msg),updateRemoteOutText(!1);break;case"outtext":updateRemoteOutText(t.value);break;case"ctrl":1==t.value?displayControl("Push bildirimi olarak gönderildi."):2==t.value&&displayControl("Push bildirimi başarısız oldu."),null!=t.msg&&displayControl(msg);break;case"random":random>t.random&&startWebRTC(0,!0);break;case"webRtcSdp":webrtcSessions[webRtcIdSwitch(t.id)]||startWebRTC(webRtcIdSwitch(t.id),!1),webRtcHandleOffer(webRtcIdSwitch(t.id),t.sdp);break;case"webRtcIce":var n=webrtcSessions[webRtcIdSwitch(t.id)];if(n)try{n.addIceCandidate(new RTCIceCandidate(t.ice))}catch(e){}break;case"videoStop":hangUpButtonClick(webRtcIdSwitch(t.id),!0);break;case"rtcSwitch":switch(t.v){case 0:performWebRtcSwitch();break;case 1:sendws({action:"rtcSwitch",v:2});break;case 2:for(var i in webchannel.xoutBuffer)webchannel.send(webchannel.xoutBuffer[i]);delete webchannel.xoutBuffer;break;default:console.log("Unknown rtcSwitch value: "+t.action)}break;case"file":startFileDownload(t);break;case"fileUploadCancel":cancelFileTransfer(t.id);break;case"fileUploadStart":fileDownloads[t.id]&&((currentFileDownload=fileDownloads[t.id]).data="",changeFileInfo(t.id,2,0),continueFileDownload(t),send({action:"fileUploadAck",id:t.id}));break;case"fileUploadEnd":currentFileDownload&&currentFileDownload.id==t.id&&(changeFileInfo(t.id,3,200),currentFileDownload.done=1,currentFileDownload=null,send({action:"fileUploadAck",id:t.id})),currentFileDownload=null;break;case"fileUploadAck":continueFileUpload();break;case"fileData":currentFileDownload&&currentFileDownload.id==t.id&&(currentFileDownload.data+=t.data,changeFileInfo(t.id,2,200*currentFileDownload.data.length/currentFileDownload.size),send({action:"fileUploadAck",id:t.id}));break;default:console.log("Unhandled object data",t)}}else console.log("Unhandled data",typeof t,t)}function fileButtonClick(){var e=Q("uploadFileInput");1!=e.getAttribute("eventset")&&(e.setAttribute("eventset","1"),e.addEventListener("change",fileSelect,!1)),e.value=null,e.click()}function fileSelect(){if(2==state){var e=Q("uploadFileInput");if(10<e.files.length)displayControl("Aynı anda 10 dosya gönderilebilir.");else for(var t,n=0;n<e.files.length;n++)0<e.files[n].size&&((t=new FileReader).onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},t.xfile=e.files[n],t.readAsBinaryString(e.files[n]))}}function fileDrop(e){if(haltEvent(e),2==state&&null!=e.dataTransfer)if(10<e.dataTransfer.files.length)displayControl("Aynı anda 10 dosya gönderilebilir.");else for(var t,n=0;n<e.dataTransfer.files.length;n++)0<e.dataTransfer.files[n].size&&((t=new FileReader).onload=function(e){this.xfile.data=e.target.result,startFileUpload(this.xfile)},t.xfile=e.dataTransfer.files[n],t.readAsBinaryString(e.dataTransfer.files[n]))}function startFileUpload(e){2==state&&(e.id=Math.random(),fileUploads.push(e),chatTextSession+=(new Date).toLocaleTimeString()+" - Gönder> "+e.name+" ("+e.size+" bayt)\r\n",QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="localBubble" style="font-size:14px;width:240px;cursor:pointer" onclick="cancelFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:20px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>'),Q("xmsgparent").scrollTop=Q("xmsgparent").scrollHeight,send({action:"file",size:e.size,id:e.id,type:e.type,name:e.name}),null==currentFileUpload)&&continueFileUpload()}function startFileDownload(e){2==state&&(fileDownloads[e.id]=e,chatTextSession+=(new Date).toLocaleTimeString()+" - İndir> "+e.name+" ("+e.size+" bayt)\r\n",QA("xmsg",'<div style="clear:both"></div><div id="FILEUP-'+e.id+'" class="remoteBubble" style="font-size:14px;width:240px;cursor:pointer" onclick="saveFileTransfer(\''+e.id+'\')"><div id="FILEUP-ICON-'+e.id+'" class="fileicon" style="float:left;width:32px;height:32px"></div><div><div id="FILEUP-NAME-'+e.id+'" style="height:20px;overflow:hidden;white-space:nowrap;" title="'+e.name+'">'+e.name+'</div><div style="width:200px;background-color:lightgray;margin-left:32px;border-radius:3px;margin-top:3px;height:11px"><div id="FILEUP-PROGRESS-'+e.id+'" style="width:0px;background-color:green;border-radius:3px;height:11px">&nbsp;</div></div></div></div>'),Q("xmsgparent").scrollTop=Q("xmsgparent").scrollHeight)}function changeFileInfo(e,t,n,i){t&&(Q("FILEUP-ICON-"+e).classList.remove("fileicon"),Q("FILEUP-ICON-"+e).classList.remove("fileiconx"),Q("FILEUP-ICON-"+e).classList.remove("fileicontransfer"),Q("FILEUP-ICON-"+e).classList.remove("fileicondone"),Q("FILEUP-ICON-"+e).classList.add(["fileicon","fileiconx","fileicontransfer","fileicondone"][t])),n&&(QS("FILEUP-PROGRESS-"+e).width=n+"px"),i&&(QS("FILEUP-PROGRESS-"+e)["background-color"]=i)}function data2blob(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return new Blob([new Uint8Array(t)])}function saveFileTransfer(e){e=fileDownloads[e];e&&1==e.done&&saveAs(data2blob(e.data),e.name)}function cancelFileTransfer(e){null!=currentFileUpload&&currentFileUpload.id==e&&(currentFileUpload=null),null!=currentFileDownload&&currentFileDownload.id==e&&(currentFileDownload=null);var t=!1;if(fileDownloads[e]&&1!=fileDownloads[e].done)delete fileDownloads[e],t=!0;else for(var n in fileUploads)if(fileUploads[n].id==e){send({action:"fileUploadCancel",id:e}),fileUploads.splice(n,1),t=!0;break}t&&changeFileInfo(e,1,200,"gray")}function cancelAllFileTransfers(){for(var e in fileDownloads)cancelFileTransfer(fileDownloads[e].id);for(var e in fileUploads)cancelFileTransfer(fileUploads[e].id)}function continueFileUpload(){var e,t;null==currentFileUpload?0!=fileUploads.length&&((currentFileUpload=fileUploads[0]).ptr=0,send({action:"fileUploadStart",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name})):currentFileUpload.size<=currentFileUpload.ptr?(send({action:"fileUploadEnd",size:currentFileUpload.size,id:currentFileUpload.id,type:currentFileUpload.type,name:currentFileUpload.name}),changeFileInfo(currentFileUpload.id,3,200),fileUploads.splice(0,1),currentFileUpload=null,continueFileUpload()):(e=Math.min(4e3,currentFileUpload.data.length-currentFileUpload.ptr),t=currentFileUpload.data.substring(currentFileUpload.ptr,currentFileUpload.ptr+e),send({action:"fileData",id:currentFileUpload.id,data:t}),currentFileUpload.ptr+=e,changeFileInfo(currentFileUpload.id,0,200*currentFileUpload.ptr/currentFileUpload.size))}function continueFileDownload(e){send({action:"fileUploadAck",id:e.id})}function enableNotificationsButtonClick(){return notificationSupport&&Notification&&Notification.requestPermission().then(function(e){QV("notifyButton","granted"!=e)}),!1}function camButtonClick(){null==localStream&&startLocalStream({video:!0,audio:!0})}function micButtonClick(){null==localStream&&startLocalStream({video:!1,audio:!0})}function hangUpButtonClick(e,t){var n,i,o=Q("localVideoCanvas"),a=Q("remoteVideoCanvas"),l=webrtcSessions[1==multiWebRtc?e:0];if(0==e&&null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(l){if(1!=multiWebRtc&&0!=e||(l.ontrack=null,l.onremovetrack=null,l.onremovestream=null,l.onnicecandidate=null,l.oniceconnectionstatechange=null,l.onsignalingstatechange=null,l.onicegatheringstatechange=null,l.onnotificationneeded=null),1==e&&localStream){for(i in n=localStream.getTracks())n[i].stop();localStream=null}if(2==e&&remoteStream){for(i in n=remoteStream.getTracks())n[i].stop();remoteStream=null}1!=multiWebRtc&&0!=e||(l.close(),delete webrtcSessions[e])}1==e?(o.removeAttribute("src"),o.removeAttribute("srcObject"),null!=localStream&&(localStream=null),displayLocalVideo(!1)):2==e&&(a.removeAttribute("src"),a.removeAttribute("srcObject"),displayRemoteVideo(!1)),1!=t&&send({action:"videoStop",id:e}),updateControls()}function startLocalStream(a){var l=1==multiWebRtc?1:0;null!=localStream||1==multiWebRtc&&null!=webrtcSessions[1]||navigator.mediaDevices.getUserMedia&&(localStream=1,updateControls(),navigator.mediaDevices.getUserMedia(a).then(function(e){var t,n,i=(localStream=e).getTracks(),o=startWebRTC(l);for(n in 1==a.video&&((t=Q("localVideoCanvas")).srcObject=e,t.onloadedmetadata=function(e){t.play()},displayLocalVideo(!0)),i)o.addTrack(i[n],localStream)},function(e){displayControl(e.message+"."),hangUpButtonClick(1)}))}function start(){var e;updateControls(),"string"==typeof args.id&&0<args.id.length?(e=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/meshrelay.ashx?id="+args.id,null!=args.auth&&""!=args.auth&&(e+="&auth="+args.auth),(socket=new WebSocket(e)).onopen=function(){state=1,displayControl("Diğer kullanıcı bekleniyor ...")},socket.onerror=function(e){},socket.onclose=function(){disconnect()},socket.onmessage=function(e){state<2&&"string"==typeof e.data&&("c"==e.data||"cr"==e.data)?(serverRecording="cr"==e.data,QV("recordIcon",serverRecording),hangUpButtonClick(0,!0),hangUpButtonClick(1,!0),hangUpButtonClick(2,!0),displayControl("Bağlandı."),state=2,updateControls(),sendws({action:"random",random:random}),updateLocalOutText(),updateRemoteOutText()):"{"==e.data[0]&&processMessage(e.data,1)}):displayControl("Hata: Bağlantı anahtarı belirtilmedi.")}function saveChatSession(){saveAs(data2blob(chatTextSession),"Sohbet Oturumu")}function onUnLoad(){for(var e=0;e<3;e++)if(webrtcSessions[e])try{webrtcSessions[e].close(),delete webrtcSessions[e]}catch(e){}if(null!=webchannel){try{webchannel.close()}catch(e){}webchannel=null}if(null!=socket){try{socket.close()}catch(e){}socket=null}}function isSafeString3(e){return"string"==typeof e&&-1==e.indexOf("<")&&-1==e.indexOf(">")&&-1==e.indexOf("&")&&-1==e.indexOf('"')&&-1==e.indexOf("'")&&-1==e.indexOf("+")&&-1==e.indexOf("(")&&-1==e.indexOf(")")&&-1==e.indexOf("#")&&-1==e.indexOf(":")}function XparseUriArgs(){var e,t=window.document.location.href,n={},i=(t=t.endsWith("#")?t.substring(0,t.length-1):t).split(/[\?&|]/);for(e in i.splice(0,1),i){var o,a=i[e],l=a.indexOf("=");n[o=a.substring(0,l)]=a.substring(l+1),isSafeString3(n[o])?(a=parseInt(n[o]))==n[o]&&(n[o]=a):delete n[o]}return n}function updateLocalOutText(){var e=Q("xouttext").value;2==state&&""!=e||1!=localOutText?2==state&&""!=e&&0==localOutText&&send({action:"outtext",value:localOutText=!0}):send({action:"outtext",value:localOutText=!1})}function updateRemoteOutText(e){remoteOutText!=(e=2!=state?!1:e)&&(remoteOutText=e,QV("typingIndicator",remoteOutText))}window.addEventListener("focus",function(e){windowFocus=!0},!1),window.addEventListener("blur",function(e){windowFocus=!1},!1),document.addEventListener("dragover",haltEvent,!1),document.addEventListener("dragleave",haltEvent,!1),document.addEventListener("drop",fileDrop,!1),document.onclick=function(e){notificationSupport&&(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification)&&(notification.close(),notification=null)},document.onkeyup=function(e){var t;if(notificationSupport&&(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification)&&(notification.close(),notification=null),2==state&&8==e.keyCode&&0==userInputFocus&&(0<(t=Q("xouttext").value).length&&(Q("xouttext").value=t.substring(0,t.length-1)),updateLocalOutText()),0==userInputFocus)return haltEvent(e),!1},document.onkeypress=function(e){if(notificationSupport&&(Notification&&QV("notifyButton","granted"!=Notification.permission),null!=notification)&&(notification.close(),notification=null),2!=state&&!pushMessaging||(13==e.keyCode?xsend(e):0==userInputFocus&&1==e.key.length&&(Q("xouttext").value=Q("xouttext").value+e.key,updateLocalOutText())),0==userInputFocus)return haltEvent(e),!1},FileReader.prototype.readAsBinaryString||(FileReader.prototype.readAsBinaryString=function(e){var i="",o=this,a=new FileReader;a.onload=function(e){for(var t=new Uint8Array(a.result),n=0;n<t.byteLength;n++)i+=String.fromCharCode(t[n]);o.onload({target:{result:i}})},a.readAsArrayBuffer(e)}),start()</script></canvas>