From f00e981a3c7600e3fd6300c5b9b356f748d5f1c4 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Sat, 17 Aug 2024 20:11:59 +0000 Subject: [PATCH] darn node modueles --- .gitignore | 1 + Cargo.lock | 5 +- Cargo.toml | 1 + flake.nix | 1 + src/coordinator/mod.rs | 4 + src/main.rs | 40 +++++- src/tauri_functions.rs | 1 - ui/index.html | 1 - ui/static/gstreamer-rtc.js | 206 --------------------------- ui/static/gstwebrtc-api-2-0-0.js | 5 - ui/static/gstwebrtc-api-2-0-0.js.map | 1 - ui/static/package-lock.json | 30 ++++ ui/static/package.json | 14 ++ ui/static/rtc.js | 22 +-- 14 files changed, 104 insertions(+), 228 deletions(-) delete mode 100644 ui/static/gstreamer-rtc.js delete mode 100644 ui/static/gstwebrtc-api-2-0-0.js delete mode 100644 ui/static/gstwebrtc-api-2-0-0.js.map create mode 100644 ui/static/package-lock.json create mode 100644 ui/static/package.json diff --git a/.gitignore b/.gitignore index 389c3bd..5c377da 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ target settings.toml .direnv/* logs/* +ui/static/node_modules/* diff --git a/Cargo.lock b/Cargo.lock index 613ec8f..d6b7d1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2046,9 +2046,9 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" @@ -4265,6 +4265,7 @@ dependencies = [ "gilrs", "gstreamer", "gstreamer-app", + "lazy_static", "log", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index b33af89..49a9611 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,5 +37,6 @@ tracing-appender = "0.2.3" snafu = "0.8.2" console-subscriber = "0.3.0" tauri = { version = "1.6.1", features = [] } +lazy_static = "1.5.0" diff --git a/flake.nix b/flake.nix index 4c2efc5..6519e3f 100644 --- a/flake.nix +++ b/flake.nix @@ -84,6 +84,7 @@ Some utility commands: cargo-tauri cargo-edit bacon + typescript # .js language server ] ++ tauri_packages; inputsFrom = with self.packages.${system}; [ joystick-controller-client ]; shellHook = diff --git a/src/coordinator/mod.rs b/src/coordinator/mod.rs index 8574746..d6643e4 100644 --- a/src/coordinator/mod.rs +++ b/src/coordinator/mod.rs @@ -58,6 +58,7 @@ pub enum ApplicationEvent { SocketMessage(Message), MoveEvent(MoveEvent, ConnectionType), TrackerUpdate(TrackerUpdate), + WebRTCMessage(String), Close, } @@ -131,6 +132,9 @@ pub async fn start_coordinator( } } } + ApplicationEvent::WebRTCMessage(msg) => { + info!("Pew pew! WebRTCMessage! {msg}"); + } ApplicationEvent::TrackerUpdate(update) => match update { TrackerUpdate::Clear => { state.tracker_state.clear(); diff --git a/src/main.rs b/src/main.rs index 7c72998..bf9ac29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,12 @@ // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -use std::sync::Arc; +use std::sync::{Arc, Mutex}; +use async_channel::Sender; use tokio::{runtime, sync:: RwLock}; -use tracing::{self, info}; +use tracing::{self, info, error}; +use tauri::Manager; +use lazy_static::lazy_static; #[cfg(not(debug_assertions))] use tracing_subscriber; @@ -19,6 +22,10 @@ mod tauri_functions; use coordinator::{start_coordinator, ApplicationEvent}; +lazy_static! { + static ref TO_MEC_REF: Mutex>> = Mutex::new(None); +} + fn main() { #[cfg(not(debug_assertions))] @@ -43,6 +50,7 @@ fn main() { console_subscriber::init(); } + let (to_mec, mec) = async_channel::bounded::(10); info!("Logging intialized"); @@ -53,8 +61,6 @@ fn main() { let rt = runtime::Runtime::new().expect("Could not start tokio runtime"); let handle = rt.handle().clone(); - let (to_mec, mec) = async_channel::bounded::(10); - let _coordinator = rt.handle().spawn(start_coordinator( mec, to_mec.clone(), @@ -62,9 +68,35 @@ fn main() { config )); + *TO_MEC_REF.lock().unwrap() = Some(to_mec.clone()); + tauri::Builder::default() .manage(tauri_functions::TauriState { to_mec: to_mec.clone() }) .invoke_handler(tauri::generate_handler![tauri_functions::connect_to_camera]) + .setup(|app| { + let _id = app.listen_global("webrtc-event", |event| { + match event.payload() { + Some(payload) => { + if let Ok(e) = TO_MEC_REF.lock() { + match e.as_ref() { + Some(to_mec) => { + if let Err(e) = to_mec.send_blocking(ApplicationEvent::WebRTCMessage(payload.to_string())) { + error!("Could not send to mec! {e}"); + } + }, + None => { + error!("TO_MEC_REF was none!"); + } + } + } + } + None => { + info!("There was an empty payload!"); + } + } + }); + Ok(()) + }) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src/tauri_functions.rs b/src/tauri_functions.rs index 81e098f..d17d69b 100644 --- a/src/tauri_functions.rs +++ b/src/tauri_functions.rs @@ -12,6 +12,5 @@ pub struct TauriState { #[tauri::command] pub fn connect_to_camera(state: State<'_, TauriState>) { - let _ = state.to_mec.send_blocking(ApplicationEvent::CameraConnectionPress); } diff --git a/ui/index.html b/ui/index.html index 74e1a48..abbe920 100644 --- a/ui/index.html +++ b/ui/index.html @@ -4,7 +4,6 @@ - diff --git a/ui/static/gstreamer-rtc.js b/ui/static/gstreamer-rtc.js deleted file mode 100644 index 7b75dc1..0000000 --- a/ui/static/gstreamer-rtc.js +++ /dev/null @@ -1,206 +0,0 @@ -function initCapture(api) { - const captureSection = document.getElementById("capture"); - const clientIdElement = captureSection.querySelector(".client-id"); - const videoElement = captureSection.getElementsByTagName("video")[0]; - - const listener = { - connected: function(clientId) { clientIdElement.textContent = clientId; }, - disconnected: function() { clientIdElement.textContent = "none"; } - }; - api.registerConnectionListener(listener); - - document.getElementById("capture-button").addEventListener("click", (event) => { - event.preventDefault(); - - if (captureSection._producerSession) { - captureSection._producerSession.close(); - } else if (!captureSection.classList.contains("starting")) { - captureSection.classList.add("starting"); - - const constraints = { - video: { width: 1280, height: 720 } - }; - navigator.mediaDevices.getUserMedia(constraints).then((stream) => { - const session = api.createProducerSession(stream); - if (session) { - captureSection._producerSession = session; - - session.addEventListener("error", (event) => { - if (captureSection._producerSession === session) { - console.error(event.message, event.error); - } - }); - - session.addEventListener("closed", () => { - if (captureSection._producerSession === session) { - videoElement.pause(); - videoElement.srcObject = null; - captureSection.classList.remove("has-session", "starting"); - delete captureSection._producerSession; - } - }); - - session.addEventListener("stateChanged", (event) => { - if ((captureSection._producerSession === session) && - (event.target.state === GstWebRTCAPI.SessionState.streaming)) { - videoElement.srcObject = stream; - videoElement.play().catch(() => {}); - captureSection.classList.remove("starting"); - } - }); - - session.addEventListener("clientConsumerAdded", (event) => { - if (captureSection._producerSession === session) { - console.info(`client consumer added: ${event.detail.peerId}`); - } - }); - - session.addEventListener("clientConsumerRemoved", (event) => { - if (captureSection._producerSession === session) { - console.info(`client consumer removed: ${event.detail.peerId}`); - } - }); - - captureSection.classList.add("has-session"); - session.start(); - } else { - for (const track of stream.getTracks()) { - track.stop(); - } - - captureSection.classList.remove("starting"); - } - }).catch((error) => { - console.error("cannot have access to webcam and microphone", error); - captureSection.classList.remove("starting"); - }); - } - }); - } - - function initRemoteStreams(api) { - const remoteStreamsElement = document.getElementById("remote-streams"); - - const listener = { - producerAdded: function(producer) { - const producerId = producer.id - if (!document.getElementById(producerId)) { - remoteStreamsElement.insertAdjacentHTML("beforeend", - `
  • -
    ${producer.meta.name || producerId}
    -
    -
    -
    -
    -
    -
    -
    - © - -
    -
    -
  • `); - - const entryElement = document.getElementById(producerId); - const videoElement = entryElement.getElementsByTagName("video")[0]; - - videoElement.addEventListener("playing", () => { - if (entryElement.classList.contains("has-session")) { - entryElement.classList.add("streaming"); - } - }); - - entryElement.addEventListener("click", (event) => { - event.preventDefault(); - if (!event.target.classList.contains("button")) { - return; - } - - if (entryElement._consumerSession) { - entryElement._consumerSession.close(); - } else { - const session = api.createConsumerSession(producerId); - if (session) { - entryElement._consumerSession = session; - - session.addEventListener("error", (event) => { - if (entryElement._consumerSession === session) { - console.error(event.message, event.error); - } - }); - - session.addEventListener("closed", () => { - if (entryElement._consumerSession === session) { - videoElement.pause(); - videoElement.srcObject = null; - entryElement.classList.remove("has-session", "streaming", "has-remote-control"); - delete entryElement._consumerSession; - } - }); - - session.addEventListener("streamsChanged", () => { - if (entryElement._consumerSession === session) { - const streams = session.streams; - if (streams.length > 0) { - videoElement.srcObject = streams[0]; - videoElement.play().catch(() => {}); - } - } - }); - - session.addEventListener("remoteControllerChanged", () => { - if (entryElement._consumerSession === session) { - const remoteController = session.remoteController; - if (remoteController) { - entryElement.classList.add("has-remote-control"); - remoteController.attachVideoElement(videoElement); - } else { - entryElement.classList.remove("has-remote-control"); - } - } - }); - - entryElement.classList.add("has-session"); - session.connect(); - } - } - }); - } - }, - - producerRemoved: function(producer) { - const element = document.getElementById(producer.id); - if (element) { - if (element._consumerSession) { - element._consumerSession.close(); - } - - element.remove(); - } - } - }; - - api.registerProducersListener(listener); - for (const producer of api.getAvailableProducers()) { - listener.producerAdded(producer); - } - } - - window.addEventListener("DOMContentLoaded", () => { - document.addEventListener("click", (event) => { - if (event.target.matches("div.video>div.fullscreen:hover>span")) { - event.preventDefault(); - event.target.parentNode.previousElementSibling.requestFullscreen(); - } - }); - - const signalingProtocol = window.location.protocol.startsWith("https") ? "wss" : "ws"; - const gstWebRTCConfig = { - meta: { name: `WebClient-${Date.now()}` }, - signalingServerUrl: `ws://127.0.0.1:8443`, - }; - - const api = new GstWebRTCAPI(gstWebRTCConfig); - // initCapture(api); - initRemoteStreams(api); - }); diff --git a/ui/static/gstwebrtc-api-2-0-0.js b/ui/static/gstwebrtc-api-2-0-0.js deleted file mode 100644 index fe018d3..0000000 --- a/ui/static/gstwebrtc-api-2-0-0.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! gstwebrtc-api (https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api), MPL-2.0 License, Copyright (C) 2022 Igalia S.L. , Author: Loïc Le Page */ -/*! Contains embedded adapter from webrtc-adapter (https://github.com/webrtcHacks/adapter), BSD 3-Clause License, Copyright (c) 2014, The WebRTC project authors. All rights reserved. Copyright (c) 2018, The adapter.js project authors. All rights reserved. */ - -(()=>{"use strict";var e={539:e=>{const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((e=>0===e.indexOf(n)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const r=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e{void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substring(t+1,r),n.value=e.substring(r+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" ");n.profile=r[2];for(let i=3;i{n.headerExtensions.push(t.parseExtmap(e))}));const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach((e=>{i.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),n},t.writeRtpDescription=function(e,n){let r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",r+=n.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((e=>{r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));let i=0;return n.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach((e=>{r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){const n=[],r=t.parseRtpParameters(e),i=-1!==r.fecMechanisms.indexOf("RED"),o=-1!==r.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const l=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));l.length>0&&l[0].length>1&&l[0][0]===a&&(c=l[0][1]),r.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),n.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&a&&n.push({ssrc:a});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,n.forEach((e=>{e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){const n={},r=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const r=t.matchPrefix(e,"a=msid:");if(1===r.length)return n=r[0].substring(7).split(" "),{stream:n[0],track:n[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(n=i[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),r=t.matchPrefix(e,"a=max-message-size:");let i;r.length>0&&(i=parseInt(r[0].substring(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,r){let i;const o=void 0!==n?n:2;i=e||t.generateSessionId();return"v=0\r\no="+(r||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const r=t.splitLines(e);for(let e=0;e{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={};n.r(e),n.d(e,{fixNegotiationNeeded:()=>w,shimAddTrackRemoveTrack:()=>P,shimAddTrackRemoveTrackWithNative:()=>E,shimGetDisplayMedia:()=>y,shimGetSendersWithDtmf:()=>S,shimGetStats:()=>k,shimGetUserMedia:()=>C,shimMediaStream:()=>v,shimOnTrack:()=>b,shimPeerConnection:()=>R,shimSenderReceiverGetStats:()=>T});var t={};n.r(t),n.d(t,{shimAddTransceiver:()=>H,shimCreateAnswer:()=>U,shimCreateOffer:()=>N,shimGetDisplayMedia:()=>x,shimGetParameters:()=>j,shimGetUserMedia:()=>A,shimOnTrack:()=>I,shimPeerConnection:()=>O,shimRTCDataChannel:()=>G,shimReceiverGetStats:()=>D,shimRemoveStream:()=>L,shimSenderGetStats:()=>M});var r={};n.r(r),n.d(r,{shimAudioContext:()=>B,shimCallbacksAPI:()=>J,shimConstraints:()=>W,shimCreateOfferLegacy:()=>V,shimGetUserMedia:()=>K,shimLocalStreamsAPI:()=>F,shimRTCIceServerUrls:()=>Y,shimRemoteStreamsAPI:()=>z,shimTrackEventTransceiver:()=>q});var i={};n.r(i),n.d(i,{removeExtmapAllowMixed:()=>re,shimAddIceCandidateNullOrEmpty:()=>ie,shimConnectionState:()=>ne,shimMaxMessageSize:()=>ee,shimParameterlessSetLocalDescription:()=>oe,shimRTCIceCandidate:()=>$,shimRTCIceCandidateRelayProtocol:()=>Q,shimSendThrowTypeError:()=>te});let o=!0,s=!0;function a(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function c(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),i.apply(this,[e,o])};const o=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(n))return o.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function l(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(o=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function d(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(s=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function h(){if("object"==typeof window){if(o)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function p(e,t){s&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function m(e){return u(e)?Object.keys(e).reduce((function(t,n){const r=u(e[n]),i=r?m(e[n]):e[n],o=r&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[n]:i})}),{}):e}function _(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach((r=>{r.endsWith("Id")?_(e,e.get(t[r]),n):r.endsWith("Ids")&&t[r].forEach((t=>{_(e,e.get(t),n)}))})))}function f(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((n=>{n.type===r&&n.trackId===t.id&&_(e,n,i)}))})),i}const g=h;function C(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach((e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then((n=>{let s=(n=n.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=r(e.video),g("chrome: "+JSON.stringify(e)),i(e)}))}e.video=r(e.video)}return g("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,r){i(e,(e=>{n.webkitGetUserMedia(e,t,(e=>{r&&r(o(e))}))}))}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function y(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then((t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,o=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function v(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function b(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.track.id)):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===n.id)):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else c(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function S(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function k(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{n[t]=e.stat(t)})),t[n.id]=n})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const r=function(e){n(o(i(e)))};return t.apply(this,[r,e])}return new Promise(((e,n)=>{t.apply(this,[function(t){e(o(i(t)))},n])})).then(n,r)}}function T(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>f(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),c(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>f(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach((n=>{n.track===e&&(t?r=!0:t=n)})),this.getReceivers().forEach((t=>(t.track===e&&(n?r=!0:n=t),t.track===e))),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function E(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function P(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return E(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[n.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=o(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((n=>{this._streams[n].getTracks().find((t=>e.track===t))&&(t=this._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function R(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}))}function w(e,t){c(e,"negotiationneeded",(e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e}))}function A(e,t){const n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){p("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function x(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}function I(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function O(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return r.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=n[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))}))}return e})).then(i,o)}}function M(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function D(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),c(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function L(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){p("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function G(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function H(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const n=e.length>0;n&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return r})}function j(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function N(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function F(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((n=>t.call(this,n,e))),e.getVideoTracks().forEach((n=>t.call(this,n,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach((e=>{n.includes(e.track)&&this.removeTrack(e)}))})}}function z(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}))}),t.apply(e,arguments)}}}function J(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=a,a=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=a,a=function(e,t,n){const r=s.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=a}function K(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(W(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function W(e){return e&&void 0!==e.video?Object.assign({},e,{video:m(e.video)}):e}function Y(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;nt.generateCertificate})}function q(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function V(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function B(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Z=n(539),X=n.n(Z);function $(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const n=new t(e),r=X().parseCandidate(e.candidate);for(const e in r)e in n||Object.defineProperty(n,e,{value:r[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,c(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function Q(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||c(e,"icecandidate",(e=>{if(e.candidate){const t=X().parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function ee(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=X().splitSections(e.sdp);return t.shift(),t.some((e=>{const t=X().parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),r=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=X().matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r}(arguments[0],e);let i;i=0===n&&0===r?Number.POSITIVE_INFINITY:0===n||0===r?Math.max(n,r):Math.min(n,r);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return n.apply(this,arguments)}}function te(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},c(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ne(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}}))}function re(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function ie(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function oe(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return n.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>n.apply(this,[e])))})}!function({window:n}={},o={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const s=h,c=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=a(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=a(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=a(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(n),p={browserDetails:c,commonShim:i,extractVersion:a,disableLog:l,disableWarnings:d,sdp:Z};switch(c.browser){case"chrome":if(!e||!R||!o.shimChrome)return s("Chrome shim is not included in this adapter release."),p;if(null===c.version)return s("Chrome shim can not determine version, not shimming."),p;s("adapter.js shimming chrome."),p.browserShim=e,ie(n,c),oe(n),C(n,c),v(n),R(n,c),b(n),P(n,c),S(n),k(n),T(n),w(n,c),$(n),Q(n),ne(n),ee(n,c),te(n),re(n,c);break;case"firefox":if(!t||!O||!o.shimFirefox)return s("Firefox shim is not included in this adapter release."),p;s("adapter.js shimming firefox."),p.browserShim=t,ie(n,c),oe(n),A(n,c),O(n,c),I(n),L(n),M(n),D(n),G(n),H(n),j(n),N(n),U(n),$(n),ne(n),ee(n,c),te(n);break;case"safari":if(!r||!o.shimSafari)return s("Safari shim is not included in this adapter release."),p;s("adapter.js shimming safari."),p.browserShim=r,ie(n,c),oe(n),Y(n),V(n),J(n),F(n),z(n),q(n),K(n),B(n),$(n),Q(n),ee(n,c),te(n),re(n,c);break;default:s("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const se=Object.freeze({meta:null,signalingServerUrl:"ws://127.0.0.1:8443",reconnectionTimeout:2500,webrtcConfig:{iceServers:[{urls:["stun:stun.l.google.com:19302","stun:stun1.l.google.com:19302"]}]}}),ae=Object.freeze({idle:0,connecting:1,streaming:2,closed:3});class ce extends EventTarget{constructor(e,t){super(),this._peerId=e,this._sessionId="",this._comChannel=t,this._state=ae.idle,this._rtcPeerConnection=null}get peerId(){return this._peerId}get sessionId(){return this._sessionId}get state(){return this._state}get rtcPeerConnection(){return this._rtcPeerConnection}close(){this._state!==ae.closed&&(this._state!==ae.idle&&this._comChannel&&this._sessionId&&this._comChannel.send({type:"endSession",sessionId:this._sessionId}),this._state=ae.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._rtcPeerConnection&&(this._rtcPeerConnection.close(),this._rtcPeerConnection=null,this.dispatchEvent(new Event("rtcPeerConnectionChanged"))),this.dispatchEvent(new Event("closed")))}}const le=Object.freeze({32:"space",33:"exclam",34:"quotedbl",35:"numbersign",36:"dollar",37:"percent",38:"ampersand",39:"apostrophe",40:"parenleft",41:"parenright",42:"asterisk",43:"plus",44:"comma",45:"minus",46:"period",47:"slash",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",58:"colon",59:"semicolon",60:"less",61:"equal",62:"greater",63:"question",64:"at",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"bracketleft",92:"backslash",93:"bracketright",94:"asciicircum",95:"underscore",96:"grave",97:"a",98:"b",99:"c",100:"d",101:"e",102:"f",103:"g",104:"h",105:"i",106:"j",107:"k",108:"l",109:"m",110:"n",111:"o",112:"p",113:"q",114:"r",115:"s",116:"t",117:"u",118:"v",119:"w",120:"x",121:"y",122:"z",123:"braceleft",124:"bar",125:"braceright",126:"asciitilde",160:"nobreakspace",161:"exclamdown",162:"cent",163:"sterling",164:"currency",165:"yen",166:"brokenbar",167:"section",168:"diaeresis",169:"copyright",170:"ordfeminine",171:"guillemotleft",172:"notsign",173:"hyphen",174:"registered",175:"macron",176:"degree",177:"plusminus",178:"twosuperior",179:"threesuperior",180:"acute",181:"mu",182:"paragraph",183:"periodcentered",184:"cedilla",185:"onesuperior",186:"masculine",187:"guillemotright",188:"onequarter",189:"onehalf",190:"threequarters",191:"questiondown",192:"Agrave",193:"Aacute",194:"Acircumflex",195:"Atilde",196:"Adiaeresis",197:"Aring",198:"AE",199:"Ccedilla",200:"Egrave",201:"Eacute",202:"Ecircumflex",203:"Ediaeresis",204:"Igrave",205:"Iacute",206:"Icircumflex",207:"Idiaeresis",208:"ETH",209:"Ntilde",210:"Ograve",211:"Oacute",212:"Ocircumflex",213:"Otilde",214:"Odiaeresis",215:"multiply",216:"Ooblique",217:"Ugrave",218:"Uacute",219:"Ucircumflex",220:"Udiaeresis",221:"Yacute",222:"THORN",223:"ssharp",224:"agrave",225:"aacute",226:"acircumflex",227:"atilde",228:"adiaeresis",229:"aring",230:"ae",231:"ccedilla",232:"egrave",233:"eacute",234:"ecircumflex",235:"ediaeresis",236:"igrave",237:"iacute",238:"icircumflex",239:"idiaeresis",240:"eth",241:"ntilde",242:"ograve",243:"oacute",244:"ocircumflex",245:"otilde",246:"odiaeresis",247:"division",248:"oslash",249:"ugrave",250:"uacute",251:"ucircumflex",252:"udiaeresis",253:"yacute",254:"thorn",255:"ydiaeresis",260:"Aogonek",728:"breve",321:"Lstroke",317:"Lcaron",346:"Sacute",352:"Scaron",350:"Scedilla",356:"Tcaron",377:"Zacute",381:"Zcaron",379:"Zabovedot",261:"aogonek",731:"ogonek",322:"lstroke",318:"lcaron",347:"sacute",711:"caron",353:"scaron",351:"scedilla",357:"tcaron",378:"zacute",733:"doubleacute",382:"zcaron",380:"zabovedot",340:"Racute",258:"Abreve",313:"Lacute",262:"Cacute",268:"Ccaron",280:"Eogonek",282:"Ecaron",270:"Dcaron",272:"Dstroke",323:"Nacute",327:"Ncaron",336:"Odoubleacute",344:"Rcaron",366:"Uring",368:"Udoubleacute",354:"Tcedilla",341:"racute",259:"abreve",314:"lacute",263:"cacute",269:"ccaron",281:"eogonek",283:"ecaron",271:"dcaron",273:"dstroke",324:"nacute",328:"ncaron",337:"odoubleacute",345:"rcaron",367:"uring",369:"udoubleacute",355:"tcedilla",729:"abovedot",294:"Hstroke",292:"Hcircumflex",304:"Iabovedot",286:"Gbreve",308:"Jcircumflex",295:"hstroke",293:"hcircumflex",305:"idotless",287:"gbreve",309:"jcircumflex",266:"Cabovedot",264:"Ccircumflex",288:"Gabovedot",284:"Gcircumflex",364:"Ubreve",348:"Scircumflex",267:"cabovedot",265:"ccircumflex",289:"gabovedot",285:"gcircumflex",365:"ubreve",349:"scircumflex",312:"kra",342:"Rcedilla",296:"Itilde",315:"Lcedilla",274:"Emacron",290:"Gcedilla",358:"Tslash",343:"rcedilla",297:"itilde",316:"lcedilla",275:"emacron",291:"gcedilla",359:"tslash",330:"ENG",331:"eng",256:"Amacron",302:"Iogonek",278:"Eabovedot",298:"Imacron",325:"Ncedilla",332:"Omacron",310:"Kcedilla",370:"Uogonek",360:"Utilde",362:"Umacron",257:"amacron",303:"iogonek",279:"eabovedot",299:"imacron",326:"ncedilla",333:"omacron",311:"kcedilla",371:"uogonek",361:"utilde",363:"umacron",8254:"overline",12290:"kana_fullstop",12300:"kana_openingbracket",12301:"kana_closingbracket",12289:"kana_comma",12539:"kana_conjunctive",12530:"kana_WO",12449:"kana_a",12451:"kana_i",12453:"kana_u",12455:"kana_e",12457:"kana_o",12515:"kana_ya",12517:"kana_yu",12519:"kana_yo",12483:"kana_tsu",12540:"prolongedsound",12450:"kana_A",12452:"kana_I",12454:"kana_U",12456:"kana_E",12458:"kana_O",12459:"kana_KA",12461:"kana_KI",12463:"kana_KU",12465:"kana_KE",12467:"kana_KO",12469:"kana_SA",12471:"kana_SHI",12473:"kana_SU",12475:"kana_SE",12477:"kana_SO",12479:"kana_TA",12481:"kana_CHI",12484:"kana_TSU",12486:"kana_TE",12488:"kana_TO",12490:"kana_NA",12491:"kana_NI",12492:"kana_NU",12493:"kana_NE",12494:"kana_NO",12495:"kana_HA",12498:"kana_HI",12501:"kana_FU",12504:"kana_HE",12507:"kana_HO",12510:"kana_MA",12511:"kana_MI",12512:"kana_MU",12513:"kana_ME",12514:"kana_MO",12516:"kana_YA",12518:"kana_YU",12520:"kana_YO",12521:"kana_RA",12522:"kana_RI",12523:"kana_RU",12524:"kana_RE",12525:"kana_RO",12527:"kana_WA",12531:"kana_N",12443:"voicedsound",12444:"semivoicedsound",1548:"Arabic_comma",1563:"Arabic_semicolon",1567:"Arabic_question_mark",1569:"Arabic_hamza",1570:"Arabic_maddaonalef",1571:"Arabic_hamzaonalef",1572:"Arabic_hamzaonwaw",1573:"Arabic_hamzaunderalef",1574:"Arabic_hamzaonyeh",1575:"Arabic_alef",1576:"Arabic_beh",1577:"Arabic_tehmarbuta",1578:"Arabic_teh",1579:"Arabic_theh",1580:"Arabic_jeem",1581:"Arabic_hah",1582:"Arabic_khah",1583:"Arabic_dal",1584:"Arabic_thal",1585:"Arabic_ra",1586:"Arabic_zain",1587:"Arabic_seen",1588:"Arabic_sheen",1589:"Arabic_sad",1590:"Arabic_dad",1591:"Arabic_tah",1592:"Arabic_zah",1593:"Arabic_ain",1594:"Arabic_ghain",1600:"Arabic_tatweel",1601:"Arabic_feh",1602:"Arabic_qaf",1603:"Arabic_kaf",1604:"Arabic_lam",1605:"Arabic_meem",1606:"Arabic_noon",1607:"Arabic_ha",1608:"Arabic_waw",1609:"Arabic_alefmaksura",1610:"Arabic_yeh",1611:"Arabic_fathatan",1612:"Arabic_dammatan",1613:"Arabic_kasratan",1614:"Arabic_fatha",1615:"Arabic_damma",1616:"Arabic_kasra",1617:"Arabic_shadda",1618:"Arabic_sukun",1106:"Serbian_dje",1107:"Macedonia_gje",1105:"Cyrillic_io",1108:"Ukrainian_ie",1109:"Macedonia_dse",1110:"Ukrainian_i",1111:"Ukrainian_yi",1112:"Cyrillic_je",1113:"Cyrillic_lje",1114:"Cyrillic_nje",1115:"Serbian_tshe",1116:"Macedonia_kje",1118:"Byelorussian_shortu",1119:"Cyrillic_dzhe",8470:"numerosign",1026:"Serbian_DJE",1027:"Macedonia_GJE",1025:"Cyrillic_IO",1028:"Ukrainian_IE",1029:"Macedonia_DSE",1030:"Ukrainian_I",1031:"Ukrainian_YI",1032:"Cyrillic_JE",1033:"Cyrillic_LJE",1034:"Cyrillic_NJE",1035:"Serbian_TSHE",1036:"Macedonia_KJE",1038:"Byelorussian_SHORTU",1039:"Cyrillic_DZHE",1102:"Cyrillic_yu",1072:"Cyrillic_a",1073:"Cyrillic_be",1094:"Cyrillic_tse",1076:"Cyrillic_de",1077:"Cyrillic_ie",1092:"Cyrillic_ef",1075:"Cyrillic_ghe",1093:"Cyrillic_ha",1080:"Cyrillic_i",1081:"Cyrillic_shorti",1082:"Cyrillic_ka",1083:"Cyrillic_el",1084:"Cyrillic_em",1085:"Cyrillic_en",1086:"Cyrillic_o",1087:"Cyrillic_pe",1103:"Cyrillic_ya",1088:"Cyrillic_er",1089:"Cyrillic_es",1090:"Cyrillic_te",1091:"Cyrillic_u",1078:"Cyrillic_zhe",1074:"Cyrillic_ve",1100:"Cyrillic_softsign",1099:"Cyrillic_yeru",1079:"Cyrillic_ze",1096:"Cyrillic_sha",1101:"Cyrillic_e",1097:"Cyrillic_shcha",1095:"Cyrillic_che",1098:"Cyrillic_hardsign",1070:"Cyrillic_YU",1040:"Cyrillic_A",1041:"Cyrillic_BE",1062:"Cyrillic_TSE",1044:"Cyrillic_DE",1045:"Cyrillic_IE",1060:"Cyrillic_EF",1043:"Cyrillic_GHE",1061:"Cyrillic_HA",1048:"Cyrillic_I",1049:"Cyrillic_SHORTI",1050:"Cyrillic_KA",1051:"Cyrillic_EL",1052:"Cyrillic_EM",1053:"Cyrillic_EN",1054:"Cyrillic_O",1055:"Cyrillic_PE",1071:"Cyrillic_YA",1056:"Cyrillic_ER",1057:"Cyrillic_ES",1058:"Cyrillic_TE",1059:"Cyrillic_U",1046:"Cyrillic_ZHE",1042:"Cyrillic_VE",1068:"Cyrillic_SOFTSIGN",1067:"Cyrillic_YERU",1047:"Cyrillic_ZE",1064:"Cyrillic_SHA",1069:"Cyrillic_E",1065:"Cyrillic_SHCHA",1063:"Cyrillic_CHE",1066:"Cyrillic_HARDSIGN",902:"Greek_ALPHAaccent",904:"Greek_EPSILONaccent",905:"Greek_ETAaccent",906:"Greek_IOTAaccent",938:"Greek_IOTAdiaeresis",908:"Greek_OMICRONaccent",910:"Greek_UPSILONaccent",939:"Greek_UPSILONdieresis",911:"Greek_OMEGAaccent",901:"Greek_accentdieresis",8213:"Greek_horizbar",940:"Greek_alphaaccent",941:"Greek_epsilonaccent",942:"Greek_etaaccent",943:"Greek_iotaaccent",970:"Greek_iotadieresis",912:"Greek_iotaaccentdieresis",972:"Greek_omicronaccent",973:"Greek_upsilonaccent",971:"Greek_upsilondieresis",944:"Greek_upsilonaccentdieresis",974:"Greek_omegaaccent",913:"Greek_ALPHA",914:"Greek_BETA",915:"Greek_GAMMA",916:"Greek_DELTA",917:"Greek_EPSILON",918:"Greek_ZETA",919:"Greek_ETA",920:"Greek_THETA",921:"Greek_IOTA",922:"Greek_KAPPA",923:"Greek_LAMBDA",924:"Greek_MU",925:"Greek_NU",926:"Greek_XI",927:"Greek_OMICRON",928:"Greek_PI",929:"Greek_RHO",931:"Greek_SIGMA",932:"Greek_TAU",933:"Greek_UPSILON",934:"Greek_PHI",935:"Greek_CHI",936:"Greek_PSI",937:"Greek_OMEGA",945:"Greek_alpha",946:"Greek_beta",947:"Greek_gamma",948:"Greek_delta",949:"Greek_epsilon",950:"Greek_zeta",951:"Greek_eta",952:"Greek_theta",953:"Greek_iota",954:"Greek_kappa",955:"Greek_lambda",956:"Greek_mu",957:"Greek_nu",958:"Greek_xi",959:"Greek_omicron",960:"Greek_pi",961:"Greek_rho",963:"Greek_sigma",962:"Greek_finalsmallsigma",964:"Greek_tau",965:"Greek_upsilon",966:"Greek_phi",967:"Greek_chi",968:"Greek_psi",969:"Greek_omega",9143:"leftradical",8992:"topintegral",8993:"botintegral",9121:"topleftsqbracket",9123:"botleftsqbracket",9124:"toprightsqbracket",9126:"botrightsqbracket",9115:"topleftparens",9117:"botleftparens",9118:"toprightparens",9120:"botrightparens",9128:"leftmiddlecurlybrace",9132:"rightmiddlecurlybrace",8804:"lessthanequal",8800:"notequal",8805:"greaterthanequal",8747:"integral",8756:"therefore",8733:"variation",8734:"infinity",8711:"nabla",8764:"approximate",8771:"similarequal",8660:"ifonlyif",8658:"implies",8801:"identical",8730:"radical",8834:"includedin",8835:"includes",8745:"intersection",8746:"union",8743:"logicaland",8744:"logicalor",8706:"partialderivative",402:"function",8592:"leftarrow",8593:"uparrow",8594:"rightarrow",8595:"downarrow",9670:"soliddiamond",9618:"checkerboard",9225:"ht",9228:"ff",9229:"cr",9226:"lf",9252:"nl",9227:"vt",9496:"lowrightcorner",9488:"uprightcorner",9484:"upleftcorner",9492:"lowleftcorner",9532:"crossinglines",9146:"horizlinescan1",9147:"horizlinescan3",9472:"horizlinescan5",9148:"horizlinescan7",9149:"horizlinescan9",9500:"leftt",9508:"rightt",9524:"bott",9516:"topt",9474:"vertbar",8195:"emspace",8194:"enspace",8196:"em3space",8197:"em4space",8199:"digitspace",8200:"punctspace",8201:"thinspace",8202:"hairspace",8212:"emdash",8211:"endash",9251:"signifblank",8230:"ellipsis",8229:"doubbaselinedot",8531:"onethird",8532:"twothirds",8533:"onefifth",8534:"twofifths",8535:"threefifths",8536:"fourfifths",8537:"onesixth",8538:"fivesixths",8453:"careof",8210:"figdash",10216:"leftanglebracket",10217:"rightanglebracket",8539:"oneeighth",8540:"threeeighths",8541:"fiveeighths",8542:"seveneighths",8482:"trademark",9747:"signaturemark",9665:"leftopentriangle",9655:"rightopentriangle",9647:"emopenrectangle",8216:"leftsinglequotemark",8217:"rightsinglequotemark",8220:"leftdoublequotemark",8221:"rightdoublequotemark",8478:"prescription",8242:"minutes",8243:"seconds",10013:"latincross",9644:"filledrectbullet",9664:"filledlefttribullet",9654:"filledrighttribullet",9679:"emfilledcircle",9646:"emfilledrect",9702:"enopencircbullet",9643:"enopensquarebullet",9645:"openrectbullet",9651:"opentribulletup",9661:"opentribulletdown",9734:"openstar",8226:"enfilledcircbullet",9642:"enfilledsqbullet",9650:"filledtribulletup",9660:"filledtribulletdown",9756:"leftpointer",9758:"rightpointer",9827:"club",9830:"diamond",9829:"heart",10016:"maltesecross",8224:"dagger",8225:"doubledagger",10003:"checkmark",10007:"ballotcross",9839:"musicalsharp",9837:"musicalflat",9794:"malesymbol",9792:"femalesymbol",9742:"telephone",8981:"telephonerecorder",8471:"phonographcopyright",8248:"caret",8218:"singlelowquotemark",8222:"doublelowquotemark",8869:"downtack",8970:"downstile",8728:"jot",9109:"quad",8868:"uptack",9675:"circle",8968:"upstile",8866:"lefttack",8867:"righttack",8215:"hebrew_doublelowline",1488:"hebrew_aleph",1489:"hebrew_beth",1490:"hebrew_gimmel",1491:"hebrew_daleth",1492:"hebrew_he",1493:"hebrew_waw",1494:"hebrew_zayin",1495:"hebrew_het",1496:"hebrew_teth",1497:"hebrew_yod",1498:"hebrew_finalkaph",1499:"hebrew_kaph",1500:"hebrew_lamed",1501:"hebrew_finalmem",1502:"hebrew_mem",1503:"hebrew_finalnun",1504:"hebrew_nun",1505:"hebrew_samekh",1506:"hebrew_ayin",1507:"hebrew_finalpe",1508:"hebrew_pe",1509:"hebrew_finalzadi",1510:"hebrew_zadi",1511:"hebrew_qoph",1512:"hebrew_resh",1513:"hebrew_shin",1514:"hebrew_taw",3585:"Thai_kokai",3586:"Thai_khokhai",3587:"Thai_khokhuat",3588:"Thai_khokhwai",3589:"Thai_khokhon",3590:"Thai_khorakhang",3591:"Thai_ngongu",3592:"Thai_chochan",3593:"Thai_choching",3594:"Thai_chochang",3595:"Thai_soso",3596:"Thai_chochoe",3597:"Thai_yoying",3598:"Thai_dochada",3599:"Thai_topatak",3600:"Thai_thothan",3601:"Thai_thonangmontho",3602:"Thai_thophuthao",3603:"Thai_nonen",3604:"Thai_dodek",3605:"Thai_totao",3606:"Thai_thothung",3607:"Thai_thothahan",3608:"Thai_thothong",3609:"Thai_nonu",3610:"Thai_bobaimai",3611:"Thai_popla",3612:"Thai_phophung",3613:"Thai_fofa",3614:"Thai_phophan",3615:"Thai_fofan",3616:"Thai_phosamphao",3617:"Thai_moma",3618:"Thai_yoyak",3619:"Thai_rorua",3620:"Thai_ru",3621:"Thai_loling",3622:"Thai_lu",3623:"Thai_wowaen",3624:"Thai_sosala",3625:"Thai_sorusi",3626:"Thai_sosua",3627:"Thai_hohip",3628:"Thai_lochula",3629:"Thai_oang",3630:"Thai_honokhuk",3631:"Thai_paiyannoi",3632:"Thai_saraa",3633:"Thai_maihanakat",3634:"Thai_saraaa",3635:"Thai_saraam",3636:"Thai_sarai",3637:"Thai_saraii",3638:"Thai_saraue",3639:"Thai_sarauee",3640:"Thai_sarau",3641:"Thai_sarauu",3642:"Thai_phinthu",3647:"Thai_baht",3648:"Thai_sarae",3649:"Thai_saraae",3650:"Thai_sarao",3651:"Thai_saraaimaimuan",3652:"Thai_saraaimaimalai",3653:"Thai_lakkhangyao",3654:"Thai_maiyamok",3655:"Thai_maitaikhu",3656:"Thai_maiek",3657:"Thai_maitho",3658:"Thai_maitri",3659:"Thai_maichattawa",3660:"Thai_thanthakhat",3661:"Thai_nikhahit",3664:"Thai_leksun",3665:"Thai_leknung",3666:"Thai_leksong",3667:"Thai_leksam",3668:"Thai_leksi",3669:"Thai_lekha",3670:"Thai_lekhok",3671:"Thai_lekchet",3672:"Thai_lekpaet",3673:"Thai_lekkao",12593:"Hangul_Kiyeog",12594:"Hangul_SsangKiyeog",12595:"Hangul_KiyeogSios",12596:"Hangul_Nieun",12597:"Hangul_NieunJieuj",12598:"Hangul_NieunHieuh",12599:"Hangul_Dikeud",12600:"Hangul_SsangDikeud",12601:"Hangul_Rieul",12602:"Hangul_RieulKiyeog",12603:"Hangul_RieulMieum",12604:"Hangul_RieulPieub",12605:"Hangul_RieulSios",12606:"Hangul_RieulTieut",12607:"Hangul_RieulPhieuf",12608:"Hangul_RieulHieuh",12609:"Hangul_Mieum",12610:"Hangul_Pieub",12611:"Hangul_SsangPieub",12612:"Hangul_PieubSios",12613:"Hangul_Sios",12614:"Hangul_SsangSios",12615:"Hangul_Ieung",12616:"Hangul_Jieuj",12617:"Hangul_SsangJieuj",12618:"Hangul_Cieuc",12619:"Hangul_Khieuq",12620:"Hangul_Tieut",12621:"Hangul_Phieuf",12622:"Hangul_Hieuh",12623:"Hangul_A",12624:"Hangul_AE",12625:"Hangul_YA",12626:"Hangul_YAE",12627:"Hangul_EO",12628:"Hangul_E",12629:"Hangul_YEO",12630:"Hangul_YE",12631:"Hangul_O",12632:"Hangul_WA",12633:"Hangul_WAE",12634:"Hangul_OE",12635:"Hangul_YO",12636:"Hangul_U",12637:"Hangul_WEO",12638:"Hangul_WE",12639:"Hangul_WI",12640:"Hangul_YU",12641:"Hangul_EU",12642:"Hangul_YI",12643:"Hangul_I",4520:"Hangul_J_Kiyeog",4521:"Hangul_J_SsangKiyeog",4522:"Hangul_J_KiyeogSios",4523:"Hangul_J_Nieun",4524:"Hangul_J_NieunJieuj",4525:"Hangul_J_NieunHieuh",4526:"Hangul_J_Dikeud",4527:"Hangul_J_Rieul",4528:"Hangul_J_RieulKiyeog",4529:"Hangul_J_RieulMieum",4530:"Hangul_J_RieulPieub",4531:"Hangul_J_RieulSios",4532:"Hangul_J_RieulTieut",4533:"Hangul_J_RieulPhieuf",4534:"Hangul_J_RieulHieuh",4535:"Hangul_J_Mieum",4536:"Hangul_J_Pieub",4537:"Hangul_J_PieubSios",4538:"Hangul_J_Sios",4539:"Hangul_J_SsangSios",4540:"Hangul_J_Ieung",4541:"Hangul_J_Jieuj",4542:"Hangul_J_Cieuc",4543:"Hangul_J_Khieuq",4544:"Hangul_J_Tieut",4545:"Hangul_J_Phieuf",4546:"Hangul_J_Hieuh",12653:"Hangul_RieulYeorinHieuh",12657:"Hangul_SunkyeongeumMieum",12664:"Hangul_SunkyeongeumPieub",12671:"Hangul_PanSios",12673:"Hangul_KkogjiDalrinIeung",12676:"Hangul_SunkyeongeumPhieuf",12678:"Hangul_YeorinHieuh",12685:"Hangul_AraeA",12686:"Hangul_AraeAE",4587:"Hangul_J_PanSios",4592:"Hangul_J_KkogjiDalrinIeung",4601:"Hangul_J_YeorinHieuh",338:"OE",339:"oe",376:"Ydiaeresis",8352:"EcuSign",8353:"ColonSign",8354:"CruzeiroSign",8355:"FFrancSign",8356:"LiraSign",8357:"MillSign",8358:"NairaSign",8359:"PesetaSign",8360:"RupeeSign",8361:"WonSign",8362:"NewSheqelSign",8363:"DongSign",8364:"EuroSign",768:"dead_grave",769:"dead_acute",770:"dead_circumflex",771:"dead_tilde",772:"dead_macron",774:"dead_breve",775:"dead_abovedot",776:"dead_diaeresis",778:"dead_abovering",779:"dead_doubleacute",780:"dead_caron",807:"dead_cedilla",808:"dead_ogonek",837:"dead_iota",12441:"dead_voiced_sound",12442:"dead_semivoiced_sound",8:"BackSpace",9:"Tab",10:"Linefeed",11:"Clear",13:"Return",19:"Pause",20:"Scroll_Lock",21:"Sys_Req",27:"Escape",1169:"Ukrainian_ghe_with_upturn",1168:"Ukrainian_GHE_WITH_UPTURN",1415:"Armenian_ligature_ew",1417:"Armenian_verjaket",1373:"Armenian_but",1418:"Armenian_yentamna",1372:"Armenian_amanak",1371:"Armenian_shesht",1374:"Armenian_paruyk",1329:"Armenian_AYB",1377:"Armenian_ayb",1330:"Armenian_BEN",1378:"Armenian_ben",1331:"Armenian_GIM",1379:"Armenian_gim",1332:"Armenian_DA",1380:"Armenian_da",1333:"Armenian_YECH",1381:"Armenian_yech",1334:"Armenian_ZA",1382:"Armenian_za",1335:"Armenian_E",1383:"Armenian_e",1336:"Armenian_AT",1384:"Armenian_at",1337:"Armenian_TO",1385:"Armenian_to",1338:"Armenian_ZHE",1386:"Armenian_zhe",1339:"Armenian_INI",1387:"Armenian_ini",1340:"Armenian_LYUN",1388:"Armenian_lyun",1341:"Armenian_KHE",1389:"Armenian_khe",1342:"Armenian_TSA",1390:"Armenian_tsa",1343:"Armenian_KEN",1391:"Armenian_ken",1344:"Armenian_HO",1392:"Armenian_ho",1345:"Armenian_DZA",1393:"Armenian_dza",1346:"Armenian_GHAT",1394:"Armenian_ghat",1347:"Armenian_TCHE",1395:"Armenian_tche",1348:"Armenian_MEN",1396:"Armenian_men",1349:"Armenian_HI",1397:"Armenian_hi",1350:"Armenian_NU",1398:"Armenian_nu",1351:"Armenian_SHA",1399:"Armenian_sha",1352:"Armenian_VO",1400:"Armenian_vo",1353:"Armenian_CHA",1401:"Armenian_cha",1354:"Armenian_PE",1402:"Armenian_pe",1355:"Armenian_JE",1403:"Armenian_je",1356:"Armenian_RA",1404:"Armenian_ra",1357:"Armenian_SE",1405:"Armenian_se",1358:"Armenian_VEV",1406:"Armenian_vev",1359:"Armenian_TYUN",1407:"Armenian_tyun",1360:"Armenian_RE",1408:"Armenian_re",1361:"Armenian_TSO",1409:"Armenian_tso",1362:"Armenian_VYUN",1410:"Armenian_vyun",1363:"Armenian_PYUR",1411:"Armenian_pyur",1364:"Armenian_KE",1412:"Armenian_ke",1365:"Armenian_O",1413:"Armenian_o",1366:"Armenian_FE",1414:"Armenian_fe",1370:"Armenian_apostrophe",4304:"Georgian_an",4305:"Georgian_ban",4306:"Georgian_gan",4307:"Georgian_don",4308:"Georgian_en",4309:"Georgian_vin",4310:"Georgian_zen",4311:"Georgian_tan",4312:"Georgian_in",4313:"Georgian_kan",4314:"Georgian_las",4315:"Georgian_man",4316:"Georgian_nar",4317:"Georgian_on",4318:"Georgian_par",4319:"Georgian_zhar",4320:"Georgian_rae",4321:"Georgian_san",4322:"Georgian_tar",4323:"Georgian_un",4324:"Georgian_phar",4325:"Georgian_khar",4326:"Georgian_ghan",4327:"Georgian_qar",4328:"Georgian_shin",4329:"Georgian_chin",4330:"Georgian_can",4331:"Georgian_jil",4332:"Georgian_cil",4333:"Georgian_char",4334:"Georgian_xan",4335:"Georgian_jhan",4336:"Georgian_hae",4337:"Georgian_he",4338:"Georgian_hie",4339:"Georgian_we",4340:"Georgian_har",4341:"Georgian_hoe",4342:"Georgian_fi",7682:"Babovedot",7683:"babovedot",7690:"Dabovedot",7808:"Wgrave",7810:"Wacute",7691:"dabovedot",7922:"Ygrave",7710:"Fabovedot",7711:"fabovedot",7744:"Mabovedot",7745:"mabovedot",7766:"Pabovedot",7809:"wgrave",7767:"pabovedot",7811:"wacute",7776:"Sabovedot",7923:"ygrave",7812:"Wdiaeresis",7813:"wdiaeresis",7777:"sabovedot",372:"Wcircumflex",7786:"Tabovedot",374:"Ycircumflex",373:"wcircumflex",7787:"tabovedot",375:"ycircumflex",1776:"Farsi_0",1777:"Farsi_1",1778:"Farsi_2",1779:"Farsi_3",1780:"Farsi_4",1781:"Farsi_5",1782:"Farsi_6",1783:"Farsi_7",1784:"Farsi_8",1785:"Farsi_9",1642:"Arabic_percent",1648:"Arabic_superscript_alef",1657:"Arabic_tteh",1662:"Arabic_peh",1670:"Arabic_tcheh",1672:"Arabic_ddal",1681:"Arabic_rreh",1748:"Arabic_fullstop",1632:"Arabic_0",1633:"Arabic_1",1634:"Arabic_2",1635:"Arabic_3",1636:"Arabic_4",1637:"Arabic_5",1638:"Arabic_6",1639:"Arabic_7",1640:"Arabic_8",1641:"Arabic_9",1619:"Arabic_madda_above",1620:"Arabic_hamza_above",1621:"Arabic_hamza_below",1688:"Arabic_jeh",1700:"Arabic_veh",1705:"Arabic_keheh",1711:"Arabic_gaf",1722:"Arabic_noon_ghunna",1726:"Arabic_heh_doachashmee",1740:"Farsi_yeh",1746:"Arabic_yeh_baree",1729:"Arabic_heh_goal",1170:"Cyrillic_GHE_bar",1174:"Cyrillic_ZHE_descender",1178:"Cyrillic_KA_descender",1180:"Cyrillic_KA_vertstroke",1186:"Cyrillic_EN_descender",1198:"Cyrillic_U_straight",1200:"Cyrillic_U_straight_bar",1202:"Cyrillic_HA_descender",1206:"Cyrillic_CHE_descender",1208:"Cyrillic_CHE_vertstroke",1210:"Cyrillic_SHHA",1240:"Cyrillic_SCHWA",1250:"Cyrillic_I_macron",1256:"Cyrillic_O_bar",1262:"Cyrillic_U_macron",1171:"Cyrillic_ghe_bar",1175:"Cyrillic_zhe_descender",1179:"Cyrillic_ka_descender",1181:"Cyrillic_ka_vertstroke",1187:"Cyrillic_en_descender",1199:"Cyrillic_u_straight",1201:"Cyrillic_u_straight_bar",1203:"Cyrillic_ha_descender",1207:"Cyrillic_che_descender",1209:"Cyrillic_che_vertstroke",1211:"Cyrillic_shha",1241:"Cyrillic_schwa",1251:"Cyrillic_i_macron",1257:"Cyrillic_o_bar",1263:"Cyrillic_u_macron",7818:"Xabovedot",300:"Ibreve",437:"Zstroke",486:"Gcaron",415:"Obarred",7819:"xabovedot",301:"ibreve",438:"zstroke",487:"gcaron",466:"ocaron",629:"obarred",399:"SCHWA",601:"schwa",7734:"Lbelowdot",7735:"lbelowdot",7840:"Abelowdot",7841:"abelowdot",7842:"Ahook",7843:"ahook",7844:"Acircumflexacute",7845:"acircumflexacute",7846:"Acircumflexgrave",7847:"acircumflexgrave",7848:"Acircumflexhook",7849:"acircumflexhook",7850:"Acircumflextilde",7851:"acircumflextilde",7852:"Acircumflexbelowdot",7853:"acircumflexbelowdot",7854:"Abreveacute",7855:"abreveacute",7856:"Abrevegrave",7857:"abrevegrave",7858:"Abrevehook",7859:"abrevehook",7860:"Abrevetilde",7861:"abrevetilde",7862:"Abrevebelowdot",7863:"abrevebelowdot",7864:"Ebelowdot",7865:"ebelowdot",7866:"Ehook",7867:"ehook",7868:"Etilde",7869:"etilde",7870:"Ecircumflexacute",7871:"ecircumflexacute",7872:"Ecircumflexgrave",7873:"ecircumflexgrave",7874:"Ecircumflexhook",7875:"ecircumflexhook",7876:"Ecircumflextilde",7877:"ecircumflextilde",7878:"Ecircumflexbelowdot",7879:"ecircumflexbelowdot",7880:"Ihook",7881:"ihook",7882:"Ibelowdot",7883:"ibelowdot",7884:"Obelowdot",7885:"obelowdot",7886:"Ohook",7887:"ohook",7888:"Ocircumflexacute",7889:"ocircumflexacute",7890:"Ocircumflexgrave",7891:"ocircumflexgrave",7892:"Ocircumflexhook",7893:"ocircumflexhook",7894:"Ocircumflextilde",7895:"ocircumflextilde",7896:"Ocircumflexbelowdot",7897:"ocircumflexbelowdot",7898:"Ohornacute",7899:"ohornacute",7900:"Ohorngrave",7901:"ohorngrave",7902:"Ohornhook",7903:"ohornhook",7904:"Ohorntilde",7905:"ohorntilde",7906:"Ohornbelowdot",7907:"ohornbelowdot",7908:"Ubelowdot",7909:"ubelowdot",7910:"Uhook",7911:"uhook",7912:"Uhornacute",7913:"uhornacute",7914:"Uhorngrave",7915:"uhorngrave",7916:"Uhornhook",7917:"uhornhook",7918:"Uhorntilde",7919:"uhorntilde",7920:"Uhornbelowdot",7921:"uhornbelowdot",7924:"Ybelowdot",7925:"ybelowdot",7926:"Yhook",7927:"yhook",7928:"Ytilde",7929:"ytilde",416:"Ohorn",417:"ohorn",431:"Uhorn",432:"uhorn",803:"dead_belowdot",777:"dead_hook",795:"dead_horn"}),de=Object.freeze({AltLeft:"Alt_L",AltRight:"Alt_R",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",Backspace:"BackSpace",CapsLock:"Caps_Lock",ControlLeft:"Control_L",ControlRight:"Control_R",Enter:"Return",HyperLeft:"Hyper_L",HyperRight:"Hyper_R",NumLock:"Num_Lock",NumpadEnter:"Return",MetaLeft:"Meta_L",MetaRight:"Meta_R",PageDown:"Page_Down",PageUp:"Page_Up",ScrollLock:"Scroll_Lock",ShiftLeft:"Shift_L",ShiftRight:"Shift_R",SuperLeft:"Super_L",SuperRight:"Super_R"}),he=new Set(["Clear","Copy","Cut","Delete","End","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Home","Insert","Paste","Redo","Tab","Undo"]);function pe(e,t){var n="Unidentified";if(1===e.length){const t=e.charCodeAt(0);t in le&&(n=le[t])}else t in de?n=de[t]:he.has(t)&&(n=t);return n}const ue=Object.freeze(["wheel","contextmenu","mousemove","mousedown","mouseup","touchstart","touchend","touchmove","touchcancel","keyup","keydown"]),me=Object.freeze({mousemove:"MouseMove",mousedown:"MouseButtonPress",mouseup:"MouseButtonRelease"}),_e=Object.freeze({touchstart:"TouchDown",touchend:"TouchUp",touchmove:"TouchMotion",touchcancel:"TouchUp"}),fe=Object.freeze({keydown:"KeyPress",keyup:"KeyRelease"});function ge(e){const t=[];return e.altKey&&t.push("mod1-mask"),e.ctrlKey&&t.push("control-mask"),e.metaKey&&t.push("meta-mask"),e.shiftKey&&t.push("shift-mask"),t.join("+")}class Ce extends EventTarget{constructor(e,t){super(),this._rtcDataChannel=e,this._consumerSession=t,this._videoElement=null,this._videoElementComputedStyle=null,this._videoElementKeyboard=null,this._lastTouchEventTimestamp=0,e.addEventListener("close",(()=>{this._rtcDataChannel===e&&this.close()})),e.addEventListener("error",(t=>{if(this._rtcDataChannel===e){const e=t.error;this.dispatchEvent(new ErrorEvent("error",{message:e&&e.message||"Remote controller error",error:e||new Error("unknown error on the remote controller data channel")}))}}))}get rtcDataChannel(){return this._rtcDataChannel}get consumerSession(){return this._consumerSession}get videoElement(){return this._videoElement}attachVideoElement(e){if(e instanceof HTMLVideoElement&&e!==this._videoElement){this._videoElement&&this.attachVideoElement(null),this._videoElement=e,this._videoElementComputedStyle=window.getComputedStyle(e);for(const t of ue)e.addEventListener(t,this);e.setAttribute("tabindex","0")}else if(null===e&&this._videoElement){const e=this._videoElement;e.removeAttribute("tabindex"),this._videoElement=null,this._videoElementComputedStyle=null,this._lastTouchEventTimestamp=0;for(const t of ue)e.removeEventListener(t,this)}}close(){this.attachVideoElement(null);const e=this._rtcDataChannel;this._rtcDataChannel=null,e&&(e.close(),this.dispatchEvent(new Event("closed")))}_sendGstNavigationEvent(e){try{if(!e||"object"!=typeof e)throw new Error("invalid GstNavigation event");if(!this._rtcDataChannel)throw new Error("remote controller data channel is closed");this._rtcDataChannel.send(JSON.stringify(e))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:`cannot send GstNavigation event over session ${this._consumerSession.sessionId} remote controller`,error:e}))}}_computeVideoMousePosition(e){const t={x:0,y:0};if(!this._videoElement||this._videoElement.videoWidth<=0||this._videoElement.videoHeight<=0)return t;const n=parseFloat(this._videoElementComputedStyle.paddingLeft),r=parseFloat(this._videoElementComputedStyle.paddingRight),i=parseFloat(this._videoElementComputedStyle.paddingTop),o=parseFloat(this._videoElementComputedStyle.paddingBottom);if("offsetX"in e&&"offsetY"in e)t.x=e.offsetX-n,t.y=e.offsetY-i;else{const r=this._videoElement.getBoundingClientRect(),o={left:parseFloat(this._videoElementComputedStyle.borderLeftWidth),top:parseFloat(this._videoElementComputedStyle.borderTopWidth)};t.x=e.clientX-r.left-o.left-n,t.y=e.clientY-r.top-o.top-i}const s={x:this._videoElement.clientWidth-(n+r),y:this._videoElement.clientHeight-(i+o)},a=Math.min(s.x/this._videoElement.videoWidth,s.y/this._videoElement.videoHeight);s.x=Math.max(.5*(s.x-this._videoElement.videoWidth*a),0),s.y=Math.max(.5*(s.y-this._videoElement.videoHeight*a),0);const c=0!==a?1/a:0;return t.x=(t.x-s.x)*c,t.y=(t.y-s.y)*c,t.x=Math.min(Math.max(t.x,0),this._videoElement.videoWidth),t.y=Math.min(Math.max(t.y,0),this._videoElement.videoHeight),t}handleEvent(e){if(this._videoElement)switch(e.type){case"wheel":e.preventDefault();{const t=this._computeVideoMousePosition(e);this._sendGstNavigationEvent({event:"MouseScroll",x:t.x,y:t.y,delta_x:-e.deltaX,delta_y:-e.deltaY,modifier_state:ge(e)})}break;case"contextmenu":e.preventDefault();break;case"mousemove":case"mousedown":case"mouseup":e.preventDefault();{const t=this._computeVideoMousePosition(e),n={event:me[e.type],x:t.x,y:t.y,modifier_state:ge(e)};"mousemove"!==e.type&&(n.button=e.button+1,"mousedown"===e.type&&0===e.button&&this._videoElement.focus()),this._sendGstNavigationEvent(n)}break;case"touchstart":case"touchend":case"touchmove":case"touchcancel":for(const t of e.changedTouches){const n=this._computeVideoMousePosition(t),r={event:_e[e.type],identifier:t.identifier,x:n.x,y:n.y,modifier_state:ge(e)};!("force"in t)||"touchstart"!==e.type&&"touchmove"!==e.type||(r.pressure=t.force),this._sendGstNavigationEvent(r)}e.timeStamp>this._lastTouchEventTimestamp&&(this._lastTouchEventTimestamp=e.timeStamp,this._sendGstNavigationEvent({event:"TouchFrame",modifier_state:ge(e)}));break;case"keyup":case"keydown":e.preventDefault();{const t={event:fe[e.type],key:pe(e.key,e.code),modifier_state:ge(e)};this._sendGstNavigationEvent(t)}}}}class ye extends ce{constructor(e,t){super(e,t),this._streams=[],this._remoteController=null,this.addEventListener("closed",(()=>{this._streams=[],this._remoteController&&this._remoteController.close()}))}get streams(){return this._streams}get remoteController(){return this._remoteController}connect(){if(!this._comChannel||this._state===ae.closed)return!1;if(this._state!==ae.idle)return!0;const e={type:"startSession",peerId:this._peerId};return this._comChannel.send(e)?(this._state=ae.connecting,this.dispatchEvent(new Event("stateChanged")),!0):(this.dispatchEvent(new ErrorEvent("error",{message:"cannot connect consumer session",error:new Error("cannot send startSession message to signaling server")})),this.close(),!1)}onSessionStarted(e,t){this._peerId!==e||this._state!==ae.connecting||this._sessionId||(this._sessionId=t)}onSessionPeerMessage(e){if(this._state!==ae.closed&&this._comChannel&&this._sessionId){if(!this._rtcPeerConnection){const e=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=e,e.ontrack=t=>{if(this._rtcPeerConnection===e&&t.streams&&t.streams.length>0){this._state===ae.connecting&&(this._state=ae.streaming,this.dispatchEvent(new Event("stateChanged")));let e=!1;for(const n of t.streams)this._streams.includes(n)||(this._streams.push(n),e=!0);e&&this.dispatchEvent(new Event("streamsChanged"))}},e.ondatachannel=e=>{const t=e.channel;if(t&&"input"===t.label){if(this._remoteController){const e=this._remoteController;this._remoteController=null,e.close()}const e=new Ce(t,this);this._remoteController=e,this.dispatchEvent(new Event("remoteControllerChanged")),e.addEventListener("closed",(()=>{this._remoteController===e&&(this._remoteController=null,this.dispatchEvent(new Event("remoteControllerChanged")))}))}},e.onicecandidate=t=>{this._rtcPeerConnection===e&&t.candidate&&this._comChannel&&this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:t.candidate.toJSON()})},this.dispatchEvent(new Event("rtcPeerConnectionChanged"))}if(e.sdp)this._rtcPeerConnection.setRemoteDescription(e.sdp).then((()=>this._rtcPeerConnection?this._rtcPeerConnection.createAnswer():null)).then((e=>this._rtcPeerConnection&&e?this._rtcPeerConnection.setLocalDescription(e):null)).then((()=>{if(this._rtcPeerConnection&&this._comChannel){const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}})).catch((e=>{this._state!==ae.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{if(!e.ice)throw new Error(`invalid empty peer message received from consumer session ${this._sessionId}`);{const t=new RTCIceCandidate(e.ice);this._rtcPeerConnection.addIceCandidate(t).catch((e=>{this._state!==ae.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())}))}}}}}class ve extends ce{constructor(e,t,n,r){super(e,n),this._sessionId=t,this._state=ae.streaming;const i=new RTCPeerConnection(this._comChannel.webrtcConfig);this._rtcPeerConnection=i;for(const e of r.getTracks())i.addTrack(e,r);i.onicecandidate=e=>{this._rtcPeerConnection===i&&e.candidate&&this._comChannel&&this._comChannel.send({type:"peer",sessionId:this._sessionId,ice:e.candidate.toJSON()})},this.dispatchEvent(new Event("rtcPeerConnectionChanged")),i.setLocalDescription().then((()=>{if(this._rtcPeerConnection===i&&this._comChannel){const e={type:"peer",sessionId:this._sessionId,sdp:this._rtcPeerConnection.localDescription.toJSON()};if(!this._comChannel.send(e))throw new Error("cannot send local SDP configuration to WebRTC peer")}})).catch((e=>{this._state!==ae.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}))}onSessionPeerMessage(e){if(this._state!==ae.closed&&this._rtcPeerConnection)if(e.sdp)this._rtcPeerConnection.setRemoteDescription(e.sdp).catch((e=>{this._state!==ae.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during SDP handshake",error:e})),this.close())}));else{if(!e.ice)throw new Error(`invalid empty peer message received from producer's client session ${this._peerId}`);{const t=new RTCIceCandidate(e.ice);this._rtcPeerConnection.addIceCandidate(t).catch((e=>{this._state!==ae.closed&&(this.dispatchEvent(new ErrorEvent("error",{message:"an unrecoverable error occurred during ICE handshake",error:e})),this.close())}))}}}}class be extends EventTarget{constructor(e,t){super(),this._comChannel=e,this._stream=t,this._state=ae.idle,this._clientSessions={}}get stream(){return this._stream}get state(){return this._state}start(){if(!this._comChannel||this._state===ae.closed)return!1;if(this._state!==ae.idle)return!0;const e={type:"setPeerStatus",roles:["listener","producer"],meta:this._comChannel.meta};return this._comChannel.send(e)?(this._state=ae.connecting,this.dispatchEvent(new Event("stateChanged")),!0):(this.dispatchEvent(new ErrorEvent("error",{message:"cannot start producer session",error:new Error("cannot register producer to signaling server")})),this.close(),!1)}close(){if(this._state!==ae.closed){for(const e of this._stream.getTracks())e.stop();this._state!==ae.idle&&this._comChannel&&this._comChannel.send({type:"setPeerStatus",roles:["listener"],meta:this._comChannel.meta}),this._state=ae.closed,this.dispatchEvent(new Event("stateChanged")),this._comChannel=null,this._stream=null;for(const e of Object.values(this._clientSessions))e.close();this._clientSessions={},this.dispatchEvent(new Event("closed"))}}onProducerRegistered(){this._state===ae.connecting&&(this._state=ae.streaming,this.dispatchEvent(new Event("stateChanged")))}onStartSessionMessage(e){if(this._comChannel&&this._stream&&!(e.sessionId in this._clientSessions)){const t=new ve(e.peerId,e.sessionId,this._comChannel,this._stream);this._clientSessions[e.sessionId]=t,t.addEventListener("closed",(e=>{const n=e.target.sessionId;n in this._clientSessions&&this._clientSessions[n]===t&&(delete this._clientSessions[n],this.dispatchEvent(new CustomEvent("clientConsumerRemoved",{detail:t})))})),t.addEventListener("error",(e=>{this.dispatchEvent(new ErrorEvent("error",{message:`error from client consumer ${e.target.peerId}: ${e.message}`,error:e.error}))})),this.dispatchEvent(new CustomEvent("clientConsumerAdded",{detail:t}))}}onEndSessionMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].close()}onSessionPeerMessage(e){e.sessionId in this._clientSessions&&this._clientSessions[e.sessionId].onSessionPeerMessage(e)}}const Se=Object.freeze({welcome:"welcome",peerStatusChanged:"peerStatusChanged",list:"list",sessionStarted:"sessionStarted",peer:"peer",startSession:"startSession",endSession:"endSession",error:"error"});function ke(e,t){if(!e||"object"!=typeof e)return null;const n={id:"",meta:{}};if(e.id&&"string"==typeof e.id)n.id=e.id;else{if(!e.peerId||"string"!=typeof e.peerId)return null;n.id=e.peerId}return n.id===t?null:(e.meta&&"object"==typeof e.meta&&(n.meta=e.meta),Object.freeze(n.meta),Object.freeze(n))}class Te extends EventTarget{constructor(e,t,n){super(),this._meta=t,this._webrtcConfig=n,this._ws=new WebSocket(e),this._ready=!1,this._channelId="",this._producerSession=null,this._consumerSessions={},this._ws.onerror=e=>{this.dispatchEvent(new ErrorEvent("error",{message:e.message||"WebSocket error",error:e.error||new Error(this._ready?"transportation error":"cannot connect to signaling server")})),this.close()},this._ws.onclose=()=>{this._ready=!1,this._channelId="",this._ws=null,this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null),this.dispatchEvent(new Event("closed"))},this._ws.onmessage=e=>{try{const n=JSON.parse(e.data);if(n&&"object"==typeof n)switch(n.type){case Se.welcome:this._channelId=n.peerId;try{this._ws.send(JSON.stringify({type:"setPeerStatus",roles:["listener"],meta:t}))}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot initialize connection to signaling server",error:e})),this.close()}break;case Se.peerStatusChanged:if(n.peerId===this._channelId)!this._ready&&n.roles.includes("listener")&&(this._ready=!0,this.dispatchEvent(new Event("ready")),this.send({type:"list"})),this._producerSession&&n.roles.includes("producer")&&this._producerSession.onProducerRegistered();else{const e=ke(n,this._channelId);e&&(n.roles.includes("producer")?this.dispatchEvent(new CustomEvent("producerAdded",{detail:e})):this.dispatchEvent(new CustomEvent("producerRemoved",{detail:e})))}break;case Se.list:for(const e of n.producers){const t=ke(e,this._channelId);t&&this.dispatchEvent(new CustomEvent("producerAdded",{detail:t}))}break;case Se.sessionStarted:{const e=this.getConsumerSession(n.peerId);e&&(delete this._consumerSessions[n.peerId],e.onSessionStarted(n.peerId,n.sessionId),e.sessionId&&!(e.sessionId in this._consumerSessions)?this._consumerSessions[e.sessionId]=e:e.close())}break;case Se.peer:{const e=this.getConsumerSession(n.sessionId);e?e.onSessionPeerMessage(n):this._producerSession&&this._producerSession.onSessionPeerMessage(n)}break;case Se.startSession:this._producerSession&&this._producerSession.onStartSessionMessage(n);break;case Se.endSession:{const e=this.getConsumerSession(n.sessionId);e?e.close():this._producerSession&&this._producerSession.onEndSessionMessage(n)}break;case Se.error:this.dispatchEvent(new ErrorEvent("error",{message:"error received from signaling server",error:new Error(n.details)}));break;default:throw new Error(`unknown message type: "${n.type}"`)}}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot parse incoming message from signaling server",error:e}))}}}get meta(){return this._meta}get webrtcConfig(){return this._webrtcConfig}get ready(){return this._ready}get channelId(){return this._channelId}get producerSession(){return this._producerSession}createProducerSession(e){if(!(this._ready&&e instanceof MediaStream))return null;if(this._producerSession)return this._producerSession.stream===e?this._producerSession:null;const t=new be(this,e);return this._producerSession=t,t.addEventListener("closed",(()=>{this._producerSession===t&&(this._producerSession=null)})),t}createConsumerSession(e){if(!this._ready||!e||"string"!=typeof e)return null;if(e in this._consumerSessions)return this._consumerSessions[e];for(const t of Object.values(this._consumerSessions))if(t.peerId===e)return t;const t=new ye(e,this);return this._consumerSessions[e]=t,t.addEventListener("closed",(e=>{let n=e.target.sessionId;n||(n=e.target.peerId),n in this._consumerSessions&&this._consumerSessions[n]===t&&delete this._consumerSessions[n]})),t}getConsumerSession(e){return e in this._consumerSessions?this._consumerSessions[e]:null}closeAllConsumerSessions(){for(const e of Object.values(this._consumerSessions))e.close();this._consumerSessions={}}send(e){if(this._ready&&e&&"object"==typeof e)try{return this._ws.send(JSON.stringify(e)),!0}catch(e){this.dispatchEvent(new ErrorEvent("error",{message:"cannot send message to signaling server",error:e}))}return!1}close(){this._ws&&(this._ready=!1,this._channelId="",this._ws.close(),this.closeAllConsumerSessions(),this._producerSession&&(this._producerSession.close(),this._producerSession=null))}}class Ee{constructor(e){this._channel=null,this._producers={},this._connectionListeners=[],this._producersListeners=[];const t=Object.assign({},se);e&&"object"==typeof e&&Object.assign(t,e),"object"!=typeof t.meta&&(t.meta=null),this._config=t,this.connectChannel()}registerConnectionListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.connected||"function"!=typeof e.disconnected)&&(this._connectionListeners.includes(e)||this._connectionListeners.push(e),!0)}unregisterConnectionListener(e){const t=this._connectionListeners.indexOf(e);return t>=0&&(this._connectionListeners.splice(t,1),!0)}unregisterAllConnectionListeners(){this._connectionListeners=[]}createProducerSession(e){return this._channel?this._channel.createProducerSession(e):null}getAvailableProducers(){return Object.values(this._producers)}registerProducersListener(e){return!(!e||"object"!=typeof e||"function"!=typeof e.producerAdded||"function"!=typeof e.producerRemoved)&&(this._producersListeners.includes(e)||this._producersListeners.push(e),!0)}unregisterProducersListener(e){const t=this._producersListeners.indexOf(e);return t>=0&&(this._producersListeners.splice(t,1),!0)}unregisterAllProducersListeners(){this._producersListeners=[]}createConsumerSession(e){return this._channel?this._channel.createConsumerSession(e):null}connectChannel(){if(this._channel){const e=this._channel;this._channel=null,e.close();for(const e in this._producers)this.triggerProducerRemoved(e);this._producers={},this.triggerDisconnected()}this._channel=new Te(this._config.signalingServerUrl,this._config.meta,this._config.webrtcConfig),this._channel.addEventListener("error",(e=>{e.target===this._channel&&console.error(e.message,e.error)})),this._channel.addEventListener("closed",(e=>{if(e.target===this._channel){this._channel=null;for(const e in this._producers)this.triggerProducerRemoved(e);this._producers={},this.triggerDisconnected(),this._config.reconnectionTimeout>0&&window.setTimeout((()=>{this.connectChannel()}),this._config.reconnectionTimeout)}})),this._channel.addEventListener("ready",(e=>{e.target===this._channel&&this.triggerConnected(this._channel.channelId)})),this._channel.addEventListener("producerAdded",(e=>{e.target===this._channel&&this.triggerProducerAdded(e.detail)})),this._channel.addEventListener("producerRemoved",(e=>{e.target===this._channel&&this.triggerProducerRemoved(e.detail.id)}))}triggerConnected(e){for(const t of this._connectionListeners)try{t.connected(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerDisconnected(){for(const e of this._connectionListeners)try{e.disconnected()}catch(e){console.error("a listener callback should not throw any exception",e)}}triggerProducerAdded(e){if(!(e.id in this._producers)){this._producers[e.id]=e;for(const t of this._producersListeners)try{t.producerAdded(e)}catch(e){console.error("a listener callback should not throw any exception",e)}}}triggerProducerRemoved(e){if(e in this._producers){const t=this._producers[e];delete this._producers[e];for(const e of this._producersListeners)try{e.producerRemoved(t)}catch(e){console.error("a listener callback should not throw any exception",e)}}}}Ee.SessionState=ae,window.GstWebRTCAPI||(window.GstWebRTCAPI=Ee)})()})(); -//# sourceMappingURL=gstwebrtc-api-2.0.0.min.js.map \ No newline at end of file diff --git a/ui/static/gstwebrtc-api-2-0-0.js.map b/ui/static/gstwebrtc-api-2-0-0.js.map deleted file mode 100644 index 67710c2..0000000 --- a/ui/static/gstwebrtc-api-2-0-0.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gstwebrtc-api-2.0.0.min.js","mappings":";;;kCAIA,MAAMA,EA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,MAAM,qDAAsD+U,EACtE,CARF,CAUF,CAEA,sBAAA2H,CAAuBnB,GACrB,GAAIA,KAAc3jB,KAAK+jB,WAAY,CACjC,MAAM5B,EAAWniB,KAAK+jB,WAAWJ,UAC1B3jB,KAAK+jB,WAAWJ,GAEvB,IAAK,MAAMW,KAAYtkB,KAAKikB,oBAC1B,IACEK,EAASiB,gBAAgBpD,EAC3B,CAAE,MAAOhF,GACP9b,QAAQ+G,MAAM,qDAAsD+U,EACtE,CAEJ,CACF,EAGFyG,GAAa3K,aAAeA,GCzSvB3Z,OAAOskB,eACVtkB,OAAOskB,aAAeA,G","sources":["webpack://gstwebrtc-api/./node_modules/sdp/sdp.js","webpack://gstwebrtc-api/webpack/bootstrap","webpack://gstwebrtc-api/webpack/runtime/compat get default export","webpack://gstwebrtc-api/webpack/runtime/define property getters","webpack://gstwebrtc-api/webpack/runtime/hasOwnProperty shorthand","webpack://gstwebrtc-api/webpack/runtime/make namespace object","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/utils.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/chrome/getusermedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/chrome/getdisplaymedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/chrome/chrome_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/firefox/getusermedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/firefox/getdisplaymedia.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/firefox/firefox_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/safari/safari_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/common_shim.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/adapter_factory.js","webpack://gstwebrtc-api/./node_modules/webrtc-adapter/src/js/adapter_core.js","webpack://gstwebrtc-api/./src/config.js","webpack://gstwebrtc-api/./src/session-state.js","webpack://gstwebrtc-api/./src/webrtc-session.js","webpack://gstwebrtc-api/./src/keysyms.js","webpack://gstwebrtc-api/./src/remote-controller.js","webpack://gstwebrtc-api/./src/consumer-session.js","webpack://gstwebrtc-api/./src/producer-session.js","webpack://gstwebrtc-api/./src/com-channel.js","webpack://gstwebrtc-api/./src/gstwebrtc-api.js","webpack://gstwebrtc-api/./src/index.js"],"sourcesContent":["/* eslint-env node */\n'use strict';\n\n// SDP helpers.\nconst SDPUtils = {};\n\n// Generate an alphanumeric identifier for cname or mids.\n// TODO: use UUIDs instead? https://gist.github.com/jed/982883\nSDPUtils.generateIdentifier = function() {\n return Math.random().toString(36).substring(2, 12);\n};\n\n// The RTCP CNAME used by all peerconnections from the same JS.\nSDPUtils.localCName = SDPUtils.generateIdentifier();\n\n// Splits SDP into lines, dealing with both CRLF and LF.\nSDPUtils.splitLines = function(blob) {\n return blob.trim().split('\\n').map(line => line.trim());\n};\n// Splits SDP into sessionpart and mediasections. Ensures CRLF.\nSDPUtils.splitSections = function(blob) {\n const parts = blob.split('\\nm=');\n return parts.map((part, index) => (index > 0 ?\n 'm=' + part : part).trim() + '\\r\\n');\n};\n\n// Returns the session description.\nSDPUtils.getDescription = function(blob) {\n const sections = SDPUtils.splitSections(blob);\n return sections && sections[0];\n};\n\n// Returns the individual media sections.\nSDPUtils.getMediaSections = function(blob) {\n const sections = SDPUtils.splitSections(blob);\n sections.shift();\n return sections;\n};\n\n// Returns lines that start with a certain prefix.\nSDPUtils.matchPrefix = function(blob, prefix) {\n return SDPUtils.splitLines(blob).filter(line => line.indexOf(prefix) === 0);\n};\n\n// Parses an ICE candidate line. Sample input:\n// candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8\n// rport 55996\"\n// Input can be prefixed with a=.\nSDPUtils.parseCandidate = function(line) {\n let parts;\n // Parse both variants.\n if (line.indexOf('a=candidate:') === 0) {\n parts = line.substring(12).split(' ');\n } else {\n parts = line.substring(10).split(' ');\n }\n\n const candidate = {\n foundation: parts[0],\n component: {1: 'rtp', 2: 'rtcp'}[parts[1]] || parts[1],\n protocol: parts[2].toLowerCase(),\n priority: parseInt(parts[3], 10),\n ip: parts[4],\n address: parts[4], // address is an alias for ip.\n port: parseInt(parts[5], 10),\n // skip parts[6] == 'typ'\n type: parts[7],\n };\n\n for (let i = 8; i < parts.length; i += 2) {\n switch (parts[i]) {\n case 'raddr':\n candidate.relatedAddress = parts[i + 1];\n break;\n case 'rport':\n candidate.relatedPort = parseInt(parts[i + 1], 10);\n break;\n case 'tcptype':\n candidate.tcpType = parts[i + 1];\n break;\n case 'ufrag':\n candidate.ufrag = parts[i + 1]; // for backward compatibility.\n candidate.usernameFragment = parts[i + 1];\n break;\n default: // extension handling, in particular ufrag. Don't overwrite.\n if (candidate[parts[i]] === undefined) {\n candidate[parts[i]] = parts[i + 1];\n }\n break;\n }\n }\n return candidate;\n};\n\n// Translates a candidate object into SDP candidate attribute.\n// This does not include the a= prefix!\nSDPUtils.writeCandidate = function(candidate) {\n const sdp = [];\n sdp.push(candidate.foundation);\n\n const component = candidate.component;\n if (component === 'rtp') {\n sdp.push(1);\n } else if (component === 'rtcp') {\n sdp.push(2);\n } else {\n sdp.push(component);\n }\n sdp.push(candidate.protocol.toUpperCase());\n sdp.push(candidate.priority);\n sdp.push(candidate.address || candidate.ip);\n sdp.push(candidate.port);\n\n const type = candidate.type;\n sdp.push('typ');\n sdp.push(type);\n if (type !== 'host' && candidate.relatedAddress &&\n candidate.relatedPort) {\n sdp.push('raddr');\n sdp.push(candidate.relatedAddress);\n sdp.push('rport');\n sdp.push(candidate.relatedPort);\n }\n if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') {\n sdp.push('tcptype');\n sdp.push(candidate.tcpType);\n }\n if (candidate.usernameFragment || candidate.ufrag) {\n sdp.push('ufrag');\n sdp.push(candidate.usernameFragment || candidate.ufrag);\n }\n return 'candidate:' + sdp.join(' ');\n};\n\n// Parses an ice-options line, returns an array of option tags.\n// Sample input:\n// a=ice-options:foo bar\nSDPUtils.parseIceOptions = function(line) {\n return line.substring(14).split(' ');\n};\n\n// Parses a rtpmap line, returns RTCRtpCoddecParameters. Sample input:\n// a=rtpmap:111 opus/48000/2\nSDPUtils.parseRtpMap = function(line) {\n let parts = line.substring(9).split(' ');\n const parsed = {\n payloadType: parseInt(parts.shift(), 10), // was: id\n };\n\n parts = parts[0].split('/');\n\n parsed.name = parts[0];\n parsed.clockRate = parseInt(parts[1], 10); // was: clockrate\n parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1;\n // legacy alias, got renamed back to channels in ORTC.\n parsed.numChannels = parsed.channels;\n return parsed;\n};\n\n// Generates a rtpmap line from RTCRtpCodecCapability or\n// RTCRtpCodecParameters.\nSDPUtils.writeRtpMap = function(codec) {\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n const channels = codec.channels || codec.numChannels || 1;\n return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate +\n (channels !== 1 ? '/' + channels : '') + '\\r\\n';\n};\n\n// Parses a extmap line (headerextension from RFC 5285). Sample input:\n// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset\n// a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset\nSDPUtils.parseExtmap = function(line) {\n const parts = line.substring(9).split(' ');\n return {\n id: parseInt(parts[0], 10),\n direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv',\n uri: parts[1],\n attributes: parts.slice(2).join(' '),\n };\n};\n\n// Generates an extmap line from RTCRtpHeaderExtensionParameters or\n// RTCRtpHeaderExtension.\nSDPUtils.writeExtmap = function(headerExtension) {\n return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) +\n (headerExtension.direction && headerExtension.direction !== 'sendrecv'\n ? '/' + headerExtension.direction\n : '') +\n ' ' + headerExtension.uri +\n (headerExtension.attributes ? ' ' + headerExtension.attributes : '') +\n '\\r\\n';\n};\n\n// Parses a fmtp line, returns dictionary. Sample input:\n// a=fmtp:96 vbr=on;cng=on\n// Also deals with vbr=on; cng=on\nSDPUtils.parseFmtp = function(line) {\n const parsed = {};\n let kv;\n const parts = line.substring(line.indexOf(' ') + 1).split(';');\n for (let j = 0; j < parts.length; j++) {\n kv = parts[j].trim().split('=');\n parsed[kv[0].trim()] = kv[1];\n }\n return parsed;\n};\n\n// Generates a fmtp line from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeFmtp = function(codec) {\n let line = '';\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.parameters && Object.keys(codec.parameters).length) {\n const params = [];\n Object.keys(codec.parameters).forEach(param => {\n if (codec.parameters[param] !== undefined) {\n params.push(param + '=' + codec.parameters[param]);\n } else {\n params.push(param);\n }\n });\n line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\\r\\n';\n }\n return line;\n};\n\n// Parses a rtcp-fb line, returns RTCPRtcpFeedback object. Sample input:\n// a=rtcp-fb:98 nack rpsi\nSDPUtils.parseRtcpFb = function(line) {\n const parts = line.substring(line.indexOf(' ') + 1).split(' ');\n return {\n type: parts.shift(),\n parameter: parts.join(' '),\n };\n};\n\n// Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters.\nSDPUtils.writeRtcpFb = function(codec) {\n let lines = '';\n let pt = codec.payloadType;\n if (codec.preferredPayloadType !== undefined) {\n pt = codec.preferredPayloadType;\n }\n if (codec.rtcpFeedback && codec.rtcpFeedback.length) {\n // FIXME: special handling for trr-int?\n codec.rtcpFeedback.forEach(fb => {\n lines += 'a=rtcp-fb:' + pt + ' ' + fb.type +\n (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') +\n '\\r\\n';\n });\n }\n return lines;\n};\n\n// Parses a RFC 5576 ssrc media attribute. Sample input:\n// a=ssrc:3735928559 cname:something\nSDPUtils.parseSsrcMedia = function(line) {\n const sp = line.indexOf(' ');\n const parts = {\n ssrc: parseInt(line.substring(7, sp), 10),\n };\n const colon = line.indexOf(':', sp);\n if (colon > -1) {\n parts.attribute = line.substring(sp + 1, colon);\n parts.value = line.substring(colon + 1);\n } else {\n parts.attribute = line.substring(sp + 1);\n }\n return parts;\n};\n\n// Parse a ssrc-group line (see RFC 5576). Sample input:\n// a=ssrc-group:semantics 12 34\nSDPUtils.parseSsrcGroup = function(line) {\n const parts = line.substring(13).split(' ');\n return {\n semantics: parts.shift(),\n ssrcs: parts.map(ssrc => parseInt(ssrc, 10)),\n };\n};\n\n// Extracts the MID (RFC 5888) from a media section.\n// Returns the MID or undefined if no mid line was found.\nSDPUtils.getMid = function(mediaSection) {\n const mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];\n if (mid) {\n return mid.substring(6);\n }\n};\n\n// Parses a fingerprint line for DTLS-SRTP.\nSDPUtils.parseFingerprint = function(line) {\n const parts = line.substring(14).split(' ');\n return {\n algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge.\n value: parts[1].toUpperCase(), // the definition is upper-case in RFC 4572.\n };\n};\n\n// Extracts DTLS parameters from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the fingerprint line as input. See also getIceParameters.\nSDPUtils.getDtlsParameters = function(mediaSection, sessionpart) {\n const lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=fingerprint:');\n // Note: a=setup line is ignored since we use the 'auto' role in Edge.\n return {\n role: 'auto',\n fingerprints: lines.map(SDPUtils.parseFingerprint),\n };\n};\n\n// Serializes DTLS parameters to SDP.\nSDPUtils.writeDtlsParameters = function(params, setupType) {\n let sdp = 'a=setup:' + setupType + '\\r\\n';\n params.fingerprints.forEach(fp => {\n sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\\r\\n';\n });\n return sdp;\n};\n\n// Parses a=crypto lines into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#dictionary-rtcsrtpsdesparameters-members\nSDPUtils.parseCryptoLine = function(line) {\n const parts = line.substring(9).split(' ');\n return {\n tag: parseInt(parts[0], 10),\n cryptoSuite: parts[1],\n keyParams: parts[2],\n sessionParams: parts.slice(3),\n };\n};\n\nSDPUtils.writeCryptoLine = function(parameters) {\n return 'a=crypto:' + parameters.tag + ' ' +\n parameters.cryptoSuite + ' ' +\n (typeof parameters.keyParams === 'object'\n ? SDPUtils.writeCryptoKeyParams(parameters.keyParams)\n : parameters.keyParams) +\n (parameters.sessionParams ? ' ' + parameters.sessionParams.join(' ') : '') +\n '\\r\\n';\n};\n\n// Parses the crypto key parameters into\n// https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#rtcsrtpkeyparam*\nSDPUtils.parseCryptoKeyParams = function(keyParams) {\n if (keyParams.indexOf('inline:') !== 0) {\n return null;\n }\n const parts = keyParams.substring(7).split('|');\n return {\n keyMethod: 'inline',\n keySalt: parts[0],\n lifeTime: parts[1],\n mkiValue: parts[2] ? parts[2].split(':')[0] : undefined,\n mkiLength: parts[2] ? parts[2].split(':')[1] : undefined,\n };\n};\n\nSDPUtils.writeCryptoKeyParams = function(keyParams) {\n return keyParams.keyMethod + ':'\n + keyParams.keySalt +\n (keyParams.lifeTime ? '|' + keyParams.lifeTime : '') +\n (keyParams.mkiValue && keyParams.mkiLength\n ? '|' + keyParams.mkiValue + ':' + keyParams.mkiLength\n : '');\n};\n\n// Extracts all SDES parameters.\nSDPUtils.getCryptoParameters = function(mediaSection, sessionpart) {\n const lines = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=crypto:');\n return lines.map(SDPUtils.parseCryptoLine);\n};\n\n// Parses ICE information from SDP media section or sessionpart.\n// FIXME: for consistency with other functions this should only\n// get the ice-ufrag and ice-pwd lines as input.\nSDPUtils.getIceParameters = function(mediaSection, sessionpart) {\n const ufrag = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=ice-ufrag:')[0];\n const pwd = SDPUtils.matchPrefix(mediaSection + sessionpart,\n 'a=ice-pwd:')[0];\n if (!(ufrag && pwd)) {\n return null;\n }\n return {\n usernameFragment: ufrag.substring(12),\n password: pwd.substring(10),\n };\n};\n\n// Serializes ICE parameters to SDP.\nSDPUtils.writeIceParameters = function(params) {\n let sdp = 'a=ice-ufrag:' + params.usernameFragment + '\\r\\n' +\n 'a=ice-pwd:' + params.password + '\\r\\n';\n if (params.iceLite) {\n sdp += 'a=ice-lite\\r\\n';\n }\n return sdp;\n};\n\n// Parses the SDP media section and returns RTCRtpParameters.\nSDPUtils.parseRtpParameters = function(mediaSection) {\n const description = {\n codecs: [],\n headerExtensions: [],\n fecMechanisms: [],\n rtcp: [],\n };\n const lines = SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(' ');\n description.profile = mline[2];\n for (let i = 3; i < mline.length; i++) { // find all codecs from mline[3..]\n const pt = mline[i];\n const rtpmapline = SDPUtils.matchPrefix(\n mediaSection, 'a=rtpmap:' + pt + ' ')[0];\n if (rtpmapline) {\n const codec = SDPUtils.parseRtpMap(rtpmapline);\n const fmtps = SDPUtils.matchPrefix(\n mediaSection, 'a=fmtp:' + pt + ' ');\n // Only the first a=fmtp: is considered.\n codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {};\n codec.rtcpFeedback = SDPUtils.matchPrefix(\n mediaSection, 'a=rtcp-fb:' + pt + ' ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.push(codec);\n // parse FEC mechanisms from rtpmap lines.\n switch (codec.name.toUpperCase()) {\n case 'RED':\n case 'ULPFEC':\n description.fecMechanisms.push(codec.name.toUpperCase());\n break;\n default: // only RED and ULPFEC are recognized as FEC mechanisms.\n break;\n }\n }\n }\n SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(line => {\n description.headerExtensions.push(SDPUtils.parseExtmap(line));\n });\n const wildcardRtcpFb = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-fb:* ')\n .map(SDPUtils.parseRtcpFb);\n description.codecs.forEach(codec => {\n wildcardRtcpFb.forEach(fb=> {\n const duplicate = codec.rtcpFeedback.find(existingFeedback => {\n return existingFeedback.type === fb.type &&\n existingFeedback.parameter === fb.parameter;\n });\n if (!duplicate) {\n codec.rtcpFeedback.push(fb);\n }\n });\n });\n // FIXME: parse rtcp.\n return description;\n};\n\n// Generates parts of the SDP media section describing the capabilities /\n// parameters.\nSDPUtils.writeRtpDescription = function(kind, caps) {\n let sdp = '';\n\n // Build the mline.\n sdp += 'm=' + kind + ' ';\n sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs.\n sdp += ' ' + (caps.profile || 'UDP/TLS/RTP/SAVPF') + ' ';\n sdp += caps.codecs.map(codec => {\n if (codec.preferredPayloadType !== undefined) {\n return codec.preferredPayloadType;\n }\n return codec.payloadType;\n }).join(' ') + '\\r\\n';\n\n sdp += 'c=IN IP4 0.0.0.0\\r\\n';\n sdp += 'a=rtcp:9 IN IP4 0.0.0.0\\r\\n';\n\n // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb.\n caps.codecs.forEach(codec => {\n sdp += SDPUtils.writeRtpMap(codec);\n sdp += SDPUtils.writeFmtp(codec);\n sdp += SDPUtils.writeRtcpFb(codec);\n });\n let maxptime = 0;\n caps.codecs.forEach(codec => {\n if (codec.maxptime > maxptime) {\n maxptime = codec.maxptime;\n }\n });\n if (maxptime > 0) {\n sdp += 'a=maxptime:' + maxptime + '\\r\\n';\n }\n\n if (caps.headerExtensions) {\n caps.headerExtensions.forEach(extension => {\n sdp += SDPUtils.writeExtmap(extension);\n });\n }\n // FIXME: write fecMechanisms.\n return sdp;\n};\n\n// Parses the SDP media section and returns an array of\n// RTCRtpEncodingParameters.\nSDPUtils.parseRtpEncodingParameters = function(mediaSection) {\n const encodingParameters = [];\n const description = SDPUtils.parseRtpParameters(mediaSection);\n const hasRed = description.fecMechanisms.indexOf('RED') !== -1;\n const hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1;\n\n // filter a=ssrc:... cname:, ignore PlanB-msid\n const ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(parts => parts.attribute === 'cname');\n const primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc;\n let secondarySsrc;\n\n const flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID')\n .map(line => {\n const parts = line.substring(17).split(' ');\n return parts.map(part => parseInt(part, 10));\n });\n if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) {\n secondarySsrc = flows[0][1];\n }\n\n description.codecs.forEach(codec => {\n if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {\n let encParam = {\n ssrc: primarySsrc,\n codecPayloadType: parseInt(codec.parameters.apt, 10),\n };\n if (primarySsrc && secondarySsrc) {\n encParam.rtx = {ssrc: secondarySsrc};\n }\n encodingParameters.push(encParam);\n if (hasRed) {\n encParam = JSON.parse(JSON.stringify(encParam));\n encParam.fec = {\n ssrc: primarySsrc,\n mechanism: hasUlpfec ? 'red+ulpfec' : 'red',\n };\n encodingParameters.push(encParam);\n }\n }\n });\n if (encodingParameters.length === 0 && primarySsrc) {\n encodingParameters.push({\n ssrc: primarySsrc,\n });\n }\n\n // we support both b=AS and b=TIAS but interpret AS as TIAS.\n let bandwidth = SDPUtils.matchPrefix(mediaSection, 'b=');\n if (bandwidth.length) {\n if (bandwidth[0].indexOf('b=TIAS:') === 0) {\n bandwidth = parseInt(bandwidth[0].substring(7), 10);\n } else if (bandwidth[0].indexOf('b=AS:') === 0) {\n // use formula from JSEP to convert b=AS to TIAS value.\n bandwidth = parseInt(bandwidth[0].substring(5), 10) * 1000 * 0.95\n - (50 * 40 * 8);\n } else {\n bandwidth = undefined;\n }\n encodingParameters.forEach(params => {\n params.maxBitrate = bandwidth;\n });\n }\n return encodingParameters;\n};\n\n// parses http://draft.ortc.org/#rtcrtcpparameters*\nSDPUtils.parseRtcpParameters = function(mediaSection) {\n const rtcpParameters = {};\n\n // Gets the first SSRC. Note that with RTX there might be multiple\n // SSRCs.\n const remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(obj => obj.attribute === 'cname')[0];\n if (remoteSsrc) {\n rtcpParameters.cname = remoteSsrc.value;\n rtcpParameters.ssrc = remoteSsrc.ssrc;\n }\n\n // Edge uses the compound attribute instead of reducedSize\n // compound is !reducedSize\n const rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize');\n rtcpParameters.reducedSize = rsize.length > 0;\n rtcpParameters.compound = rsize.length === 0;\n\n // parses the rtcp-mux attrіbute.\n // Note that Edge does not support unmuxed RTCP.\n const mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux');\n rtcpParameters.mux = mux.length > 0;\n\n return rtcpParameters;\n};\n\nSDPUtils.writeRtcpParameters = function(rtcpParameters) {\n let sdp = '';\n if (rtcpParameters.reducedSize) {\n sdp += 'a=rtcp-rsize\\r\\n';\n }\n if (rtcpParameters.mux) {\n sdp += 'a=rtcp-mux\\r\\n';\n }\n if (rtcpParameters.ssrc !== undefined && rtcpParameters.cname) {\n sdp += 'a=ssrc:' + rtcpParameters.ssrc +\n ' cname:' + rtcpParameters.cname + '\\r\\n';\n }\n return sdp;\n};\n\n\n// parses either a=msid: or a=ssrc:... msid lines and returns\n// the id of the MediaStream and MediaStreamTrack.\nSDPUtils.parseMsid = function(mediaSection) {\n let parts;\n const spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:');\n if (spec.length === 1) {\n parts = spec[0].substring(7).split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n const planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')\n .map(line => SDPUtils.parseSsrcMedia(line))\n .filter(msidParts => msidParts.attribute === 'msid');\n if (planB.length > 0) {\n parts = planB[0].value.split(' ');\n return {stream: parts[0], track: parts[1]};\n }\n};\n\n// SCTP\n// parses draft-ietf-mmusic-sctp-sdp-26 first and falls back\n// to draft-ietf-mmusic-sctp-sdp-05\nSDPUtils.parseSctpDescription = function(mediaSection) {\n const mline = SDPUtils.parseMLine(mediaSection);\n const maxSizeLine = SDPUtils.matchPrefix(mediaSection, 'a=max-message-size:');\n let maxMessageSize;\n if (maxSizeLine.length > 0) {\n maxMessageSize = parseInt(maxSizeLine[0].substring(19), 10);\n }\n if (isNaN(maxMessageSize)) {\n maxMessageSize = 65536;\n }\n const sctpPort = SDPUtils.matchPrefix(mediaSection, 'a=sctp-port:');\n if (sctpPort.length > 0) {\n return {\n port: parseInt(sctpPort[0].substring(12), 10),\n protocol: mline.fmt,\n maxMessageSize,\n };\n }\n const sctpMapLines = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:');\n if (sctpMapLines.length > 0) {\n const parts = sctpMapLines[0]\n .substring(10)\n .split(' ');\n return {\n port: parseInt(parts[0], 10),\n protocol: parts[1],\n maxMessageSize,\n };\n }\n};\n\n// SCTP\n// outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers\n// support by now receiving in this format, unless we originally parsed\n// as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line\n// protocol of DTLS/SCTP -- without UDP/ or TCP/)\nSDPUtils.writeSctpDescription = function(media, sctp) {\n let output = [];\n if (media.protocol !== 'DTLS/SCTP') {\n output = [\n 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.protocol + '\\r\\n',\n 'c=IN IP4 0.0.0.0\\r\\n',\n 'a=sctp-port:' + sctp.port + '\\r\\n',\n ];\n } else {\n output = [\n 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.port + '\\r\\n',\n 'c=IN IP4 0.0.0.0\\r\\n',\n 'a=sctpmap:' + sctp.port + ' ' + sctp.protocol + ' 65535\\r\\n',\n ];\n }\n if (sctp.maxMessageSize !== undefined) {\n output.push('a=max-message-size:' + sctp.maxMessageSize + '\\r\\n');\n }\n return output.join('');\n};\n\n// Generate a session ID for SDP.\n// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1\n// recommends using a cryptographically random +ve 64-bit value\n// but right now this should be acceptable and within the right range\nSDPUtils.generateSessionId = function() {\n return Math.random().toString().substr(2, 22);\n};\n\n// Write boiler plate for start of SDP\n// sessId argument is optional - if not supplied it will\n// be generated randomly\n// sessVersion is optional and defaults to 2\n// sessUser is optional and defaults to 'thisisadapterortc'\nSDPUtils.writeSessionBoilerplate = function(sessId, sessVer, sessUser) {\n let sessionId;\n const version = sessVer !== undefined ? sessVer : 2;\n if (sessId) {\n sessionId = sessId;\n } else {\n sessionId = SDPUtils.generateSessionId();\n }\n const user = sessUser || 'thisisadapterortc';\n // FIXME: sess-id should be an NTP timestamp.\n return 'v=0\\r\\n' +\n 'o=' + user + ' ' + sessionId + ' ' + version +\n ' IN IP4 127.0.0.1\\r\\n' +\n 's=-\\r\\n' +\n 't=0 0\\r\\n';\n};\n\n// Gets the direction from the mediaSection or the sessionpart.\nSDPUtils.getDirection = function(mediaSection, sessionpart) {\n // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv.\n const lines = SDPUtils.splitLines(mediaSection);\n for (let i = 0; i < lines.length; i++) {\n switch (lines[i]) {\n case 'a=sendrecv':\n case 'a=sendonly':\n case 'a=recvonly':\n case 'a=inactive':\n return lines[i].substring(2);\n default:\n // FIXME: What should happen here?\n }\n }\n if (sessionpart) {\n return SDPUtils.getDirection(sessionpart);\n }\n return 'sendrecv';\n};\n\nSDPUtils.getKind = function(mediaSection) {\n const lines = SDPUtils.splitLines(mediaSection);\n const mline = lines[0].split(' ');\n return mline[0].substring(2);\n};\n\nSDPUtils.isRejected = function(mediaSection) {\n return mediaSection.split(' ', 2)[1] === '0';\n};\n\nSDPUtils.parseMLine = function(mediaSection) {\n const lines = SDPUtils.splitLines(mediaSection);\n const parts = lines[0].substring(2).split(' ');\n return {\n kind: parts[0],\n port: parseInt(parts[1], 10),\n protocol: parts[2],\n fmt: parts.slice(3).join(' '),\n };\n};\n\nSDPUtils.parseOLine = function(mediaSection) {\n const line = SDPUtils.matchPrefix(mediaSection, 'o=')[0];\n const parts = line.substring(2).split(' ');\n return {\n username: parts[0],\n sessionId: parts[1],\n sessionVersion: parseInt(parts[2], 10),\n netType: parts[3],\n addressType: parts[4],\n address: parts[5],\n };\n};\n\n// a very naive interpretation of a valid SDP.\nSDPUtils.isValidSDP = function(blob) {\n if (typeof blob !== 'string' || blob.length === 0) {\n return false;\n }\n const lines = SDPUtils.splitLines(blob);\n for (let i = 0; i < lines.length; i++) {\n if (lines[i].length < 2 || lines[i].charAt(1) !== '=') {\n return false;\n }\n // TODO: check the modifier a bit more.\n }\n return true;\n};\n\n// Expose public methods.\nif (typeof module === 'object') {\n module.exports = SDPUtils;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nlet logDisabled_ = true;\nlet deprecationWarnings_ = true;\n\n/**\n * Extract browser version out of the provided user agent string.\n *\n * @param {!string} uastring userAgent string.\n * @param {!string} expr Regular expression used as match criteria.\n * @param {!number} pos position in the version string to be returned.\n * @return {!number} browser version.\n */\nexport function extractVersion(uastring, expr, pos) {\n const match = uastring.match(expr);\n return match && match.length >= pos && parseInt(match[pos], 10);\n}\n\n// Wraps the peerconnection event eventNameToWrap in a function\n// which returns the modified event object (or false to prevent\n// the event).\nexport function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) {\n if (!window.RTCPeerConnection) {\n return;\n }\n const proto = window.RTCPeerConnection.prototype;\n const nativeAddEventListener = proto.addEventListener;\n proto.addEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap) {\n return nativeAddEventListener.apply(this, arguments);\n }\n const wrappedCallback = (e) => {\n const modifiedEvent = wrapper(e);\n if (modifiedEvent) {\n if (cb.handleEvent) {\n cb.handleEvent(modifiedEvent);\n } else {\n cb(modifiedEvent);\n }\n }\n };\n this._eventMap = this._eventMap || {};\n if (!this._eventMap[eventNameToWrap]) {\n this._eventMap[eventNameToWrap] = new Map();\n }\n this._eventMap[eventNameToWrap].set(cb, wrappedCallback);\n return nativeAddEventListener.apply(this, [nativeEventName,\n wrappedCallback]);\n };\n\n const nativeRemoveEventListener = proto.removeEventListener;\n proto.removeEventListener = function(nativeEventName, cb) {\n if (nativeEventName !== eventNameToWrap || !this._eventMap\n || !this._eventMap[eventNameToWrap]) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n if (!this._eventMap[eventNameToWrap].has(cb)) {\n return nativeRemoveEventListener.apply(this, arguments);\n }\n const unwrappedCb = this._eventMap[eventNameToWrap].get(cb);\n this._eventMap[eventNameToWrap].delete(cb);\n if (this._eventMap[eventNameToWrap].size === 0) {\n delete this._eventMap[eventNameToWrap];\n }\n if (Object.keys(this._eventMap).length === 0) {\n delete this._eventMap;\n }\n return nativeRemoveEventListener.apply(this, [nativeEventName,\n unwrappedCb]);\n };\n\n Object.defineProperty(proto, 'on' + eventNameToWrap, {\n get() {\n return this['_on' + eventNameToWrap];\n },\n set(cb) {\n if (this['_on' + eventNameToWrap]) {\n this.removeEventListener(eventNameToWrap,\n this['_on' + eventNameToWrap]);\n delete this['_on' + eventNameToWrap];\n }\n if (cb) {\n this.addEventListener(eventNameToWrap,\n this['_on' + eventNameToWrap] = cb);\n }\n },\n enumerable: true,\n configurable: true\n });\n}\n\nexport function disableLog(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n logDisabled_ = bool;\n return (bool) ? 'adapter.js logging disabled' :\n 'adapter.js logging enabled';\n}\n\n/**\n * Disable or enable deprecation warnings\n * @param {!boolean} bool set to true to disable warnings.\n */\nexport function disableWarnings(bool) {\n if (typeof bool !== 'boolean') {\n return new Error('Argument type: ' + typeof bool +\n '. Please use a boolean.');\n }\n deprecationWarnings_ = !bool;\n return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled');\n}\n\nexport function log() {\n if (typeof window === 'object') {\n if (logDisabled_) {\n return;\n }\n if (typeof console !== 'undefined' && typeof console.log === 'function') {\n console.log.apply(console, arguments);\n }\n }\n}\n\n/**\n * Shows a deprecation warning suggesting the modern and spec-compatible API.\n */\nexport function deprecated(oldMethod, newMethod) {\n if (!deprecationWarnings_) {\n return;\n }\n console.warn(oldMethod + ' is deprecated, please use ' + newMethod +\n ' instead.');\n}\n\n/**\n * Browser detector.\n *\n * @return {object} result containing browser and version\n * properties.\n */\nexport function detectBrowser(window) {\n // Returned result object.\n const result = {browser: null, version: null};\n\n // Fail early if it's not a browser\n if (typeof window === 'undefined' || !window.navigator ||\n !window.navigator.userAgent) {\n result.browser = 'Not a browser.';\n return result;\n }\n\n const {navigator} = window;\n\n if (navigator.mozGetUserMedia) { // Firefox.\n result.browser = 'firefox';\n result.version = extractVersion(navigator.userAgent,\n /Firefox\\/(\\d+)\\./, 1);\n } else if (navigator.webkitGetUserMedia ||\n (window.isSecureContext === false && window.webkitRTCPeerConnection)) {\n // Chrome, Chromium, Webview, Opera.\n // Version matches Chrome/WebRTC version.\n // Chrome 74 removed webkitGetUserMedia on http as well so we need the\n // more complicated fallback to webkitRTCPeerConnection.\n result.browser = 'chrome';\n result.version = extractVersion(navigator.userAgent,\n /Chrom(e|ium)\\/(\\d+)\\./, 2);\n } else if (window.RTCPeerConnection &&\n navigator.userAgent.match(/AppleWebKit\\/(\\d+)\\./)) { // Safari.\n result.browser = 'safari';\n result.version = extractVersion(navigator.userAgent,\n /AppleWebKit\\/(\\d+)\\./, 1);\n result.supportsUnifiedPlan = window.RTCRtpTransceiver &&\n 'currentDirection' in window.RTCRtpTransceiver.prototype;\n } else { // Default fallthrough: not supported.\n result.browser = 'Not a supported browser.';\n return result;\n }\n\n return result;\n}\n\n/**\n * Checks if something is an object.\n *\n * @param {*} val The something you want to check.\n * @return true if val is an object, false otherwise.\n */\nfunction isObject(val) {\n return Object.prototype.toString.call(val) === '[object Object]';\n}\n\n/**\n * Remove all empty objects and undefined values\n * from a nested object -- an enhanced and vanilla version\n * of Lodash's `compact`.\n */\nexport function compactObject(data) {\n if (!isObject(data)) {\n return data;\n }\n\n return Object.keys(data).reduce(function(accumulator, key) {\n const isObj = isObject(data[key]);\n const value = isObj ? compactObject(data[key]) : data[key];\n const isEmptyObject = isObj && !Object.keys(value).length;\n if (value === undefined || isEmptyObject) {\n return accumulator;\n }\n return Object.assign(accumulator, {[key]: value});\n }, {});\n}\n\n/* iterates the stats graph recursively. */\nexport function walkStats(stats, base, resultSet) {\n if (!base || resultSet.has(base.id)) {\n return;\n }\n resultSet.set(base.id, base);\n Object.keys(base).forEach(name => {\n if (name.endsWith('Id')) {\n walkStats(stats, stats.get(base[name]), resultSet);\n } else if (name.endsWith('Ids')) {\n base[name].forEach(id => {\n walkStats(stats, stats.get(id), resultSet);\n });\n }\n });\n}\n\n/* filter getStats for a sender/receiver track. */\nexport function filterStats(result, track, outbound) {\n const streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp';\n const filteredResult = new Map();\n if (track === null) {\n return filteredResult;\n }\n const trackStats = [];\n result.forEach(value => {\n if (value.type === 'track' &&\n value.trackIdentifier === track.id) {\n trackStats.push(value);\n }\n });\n trackStats.forEach(trackStat => {\n result.forEach(stats => {\n if (stats.type === streamStatsType && stats.trackId === trackStat.id) {\n walkStats(result, stats, filteredResult);\n }\n });\n });\n return filteredResult;\n}\n\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nimport * as utils from '../utils.js';\nconst logging = utils.log;\n\nexport function shimGetUserMedia(window, browserDetails) {\n const navigator = window && window.navigator;\n\n if (!navigator.mediaDevices) {\n return;\n }\n\n const constraintsToChrome_ = function(c) {\n if (typeof c !== 'object' || c.mandatory || c.optional) {\n return c;\n }\n const cc = {};\n Object.keys(c).forEach(key => {\n if (key === 'require' || key === 'advanced' || key === 'mediaSource') {\n return;\n }\n const r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]};\n if (r.exact !== undefined && typeof r.exact === 'number') {\n r.min = r.max = r.exact;\n }\n const oldname_ = function(prefix, name) {\n if (prefix) {\n return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n }\n return (name === 'deviceId') ? 'sourceId' : name;\n };\n if (r.ideal !== undefined) {\n cc.optional = cc.optional || [];\n let oc = {};\n if (typeof r.ideal === 'number') {\n oc[oldname_('min', key)] = r.ideal;\n cc.optional.push(oc);\n oc = {};\n oc[oldname_('max', key)] = r.ideal;\n cc.optional.push(oc);\n } else {\n oc[oldname_('', key)] = r.ideal;\n cc.optional.push(oc);\n }\n }\n if (r.exact !== undefined && typeof r.exact !== 'number') {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_('', key)] = r.exact;\n } else {\n ['min', 'max'].forEach(mix => {\n if (r[mix] !== undefined) {\n cc.mandatory = cc.mandatory || {};\n cc.mandatory[oldname_(mix, key)] = r[mix];\n }\n });\n }\n });\n if (c.advanced) {\n cc.optional = (cc.optional || []).concat(c.advanced);\n }\n return cc;\n };\n\n const shimConstraints_ = function(constraints, func) {\n if (browserDetails.version >= 61) {\n return func(constraints);\n }\n constraints = JSON.parse(JSON.stringify(constraints));\n if (constraints && typeof constraints.audio === 'object') {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n constraints = JSON.parse(JSON.stringify(constraints));\n remap(constraints.audio, 'autoGainControl', 'googAutoGainControl');\n remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression');\n constraints.audio = constraintsToChrome_(constraints.audio);\n }\n if (constraints && typeof constraints.video === 'object') {\n // Shim facingMode for mobile & surface pro.\n let face = constraints.video.facingMode;\n face = face && ((typeof face === 'object') ? face : {ideal: face});\n const getSupportedFacingModeLies = browserDetails.version < 66;\n\n if ((face && (face.exact === 'user' || face.exact === 'environment' ||\n face.ideal === 'user' || face.ideal === 'environment')) &&\n !(navigator.mediaDevices.getSupportedConstraints &&\n navigator.mediaDevices.getSupportedConstraints().facingMode &&\n !getSupportedFacingModeLies)) {\n delete constraints.video.facingMode;\n let matches;\n if (face.exact === 'environment' || face.ideal === 'environment') {\n matches = ['back', 'rear'];\n } else if (face.exact === 'user' || face.ideal === 'user') {\n matches = ['front'];\n }\n if (matches) {\n // Look for matches in label, or use last cam for back (typical).\n return navigator.mediaDevices.enumerateDevices()\n .then(devices => {\n devices = devices.filter(d => d.kind === 'videoinput');\n let dev = devices.find(d => matches.some(match =>\n d.label.toLowerCase().includes(match)));\n if (!dev && devices.length && matches.includes('back')) {\n dev = devices[devices.length - 1]; // more likely the back cam\n }\n if (dev) {\n constraints.video.deviceId = face.exact\n ? {exact: dev.deviceId}\n : {ideal: dev.deviceId};\n }\n constraints.video = constraintsToChrome_(constraints.video);\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n });\n }\n }\n constraints.video = constraintsToChrome_(constraints.video);\n }\n logging('chrome: ' + JSON.stringify(constraints));\n return func(constraints);\n };\n\n const shimError_ = function(e) {\n if (browserDetails.version >= 64) {\n return e;\n }\n return {\n name: {\n PermissionDeniedError: 'NotAllowedError',\n PermissionDismissedError: 'NotAllowedError',\n InvalidStateError: 'NotAllowedError',\n DevicesNotFoundError: 'NotFoundError',\n ConstraintNotSatisfiedError: 'OverconstrainedError',\n TrackStartError: 'NotReadableError',\n MediaDeviceFailedDueToShutdown: 'NotAllowedError',\n MediaDeviceKillSwitchOn: 'NotAllowedError',\n TabCaptureError: 'AbortError',\n ScreenCaptureError: 'AbortError',\n DeviceCaptureError: 'AbortError'\n }[e.name] || e.name,\n message: e.message,\n constraint: e.constraint || e.constraintName,\n toString() {\n return this.name + (this.message && ': ') + this.message;\n }\n };\n };\n\n const getUserMedia_ = function(constraints, onSuccess, onError) {\n shimConstraints_(constraints, c => {\n navigator.webkitGetUserMedia(c, onSuccess, e => {\n if (onError) {\n onError(shimError_(e));\n }\n });\n });\n };\n navigator.getUserMedia = getUserMedia_.bind(navigator);\n\n // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia\n // function which returns a Promise, it does not accept spec-style\n // constraints.\n if (navigator.mediaDevices.getUserMedia) {\n const origGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(cs) {\n return shimConstraints_(cs, c => origGetUserMedia(c).then(stream => {\n if (c.audio && !stream.getAudioTracks().length ||\n c.video && !stream.getVideoTracks().length) {\n stream.getTracks().forEach(track => {\n track.stop();\n });\n throw new DOMException('', 'NotFoundError');\n }\n return stream;\n }, e => Promise.reject(shimError_(e))));\n };\n }\n}\n","/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nexport function shimGetDisplayMedia(window, getSourceId) {\n if (window.navigator.mediaDevices &&\n 'getDisplayMedia' in window.navigator.mediaDevices) {\n return;\n }\n if (!(window.navigator.mediaDevices)) {\n return;\n }\n // getSourceId is a function that returns a promise resolving with\n // the sourceId of the screen/window/tab to be shared.\n if (typeof getSourceId !== 'function') {\n console.error('shimGetDisplayMedia: getSourceId argument is not ' +\n 'a function');\n return;\n }\n window.navigator.mediaDevices.getDisplayMedia =\n function getDisplayMedia(constraints) {\n return getSourceId(constraints)\n .then(sourceId => {\n const widthSpecified = constraints.video && constraints.video.width;\n const heightSpecified = constraints.video &&\n constraints.video.height;\n const frameRateSpecified = constraints.video &&\n constraints.video.frameRate;\n constraints.video = {\n mandatory: {\n chromeMediaSource: 'desktop',\n chromeMediaSourceId: sourceId,\n maxFrameRate: frameRateSpecified || 3\n }\n };\n if (widthSpecified) {\n constraints.video.mandatory.maxWidth = widthSpecified;\n }\n if (heightSpecified) {\n constraints.video.mandatory.maxHeight = heightSpecified;\n }\n return window.navigator.mediaDevices.getUserMedia(constraints);\n });\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\nimport * as utils from '../utils.js';\n\nexport {shimGetUserMedia} from './getusermedia';\nexport {shimGetDisplayMedia} from './getdisplaymedia';\n\nexport function shimMediaStream(window) {\n window.MediaStream = window.MediaStream || window.webkitMediaStream;\n}\n\nexport function shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in\n window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', {\n get() {\n return this._ontrack;\n },\n set(f) {\n if (this._ontrack) {\n this.removeEventListener('track', this._ontrack);\n }\n this.addEventListener('track', this._ontrack = f);\n },\n enumerable: true,\n configurable: true\n });\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n if (!this._ontrackpoly) {\n this._ontrackpoly = (e) => {\n // onaddstream does not fire when a track is added to an existing\n // stream. But stream.onaddtrack is implemented so we use that.\n e.stream.addEventListener('addtrack', te => {\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) {\n receiver = this.getReceivers()\n .find(r => r.track && r.track.id === te.track.id);\n } else {\n receiver = {track: te.track};\n }\n\n const event = new Event('track');\n event.track = te.track;\n event.receiver = receiver;\n event.transceiver = {receiver};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n });\n e.stream.getTracks().forEach(track => {\n let receiver;\n if (window.RTCPeerConnection.prototype.getReceivers) {\n receiver = this.getReceivers()\n .find(r => r.track && r.track.id === track.id);\n } else {\n receiver = {track};\n }\n const event = new Event('track');\n event.track = track;\n event.receiver = receiver;\n event.transceiver = {receiver};\n event.streams = [e.stream];\n this.dispatchEvent(event);\n });\n };\n this.addEventListener('addstream', this._ontrackpoly);\n }\n return origSetRemoteDescription.apply(this, arguments);\n };\n } else {\n // even if RTCRtpTransceiver is in window, it is only used and\n // emitted in unified-plan. Unfortunately this means we need\n // to unconditionally wrap the event.\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n if (!e.transceiver) {\n Object.defineProperty(e, 'transceiver',\n {value: {receiver: e.receiver}});\n }\n return e;\n });\n }\n}\n\nexport function shimGetSendersWithDtmf(window) {\n // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack.\n if (typeof window === 'object' && window.RTCPeerConnection &&\n !('getSenders' in window.RTCPeerConnection.prototype) &&\n 'createDTMFSender' in window.RTCPeerConnection.prototype) {\n const shimSenderWithDtmf = function(pc, track) {\n return {\n track,\n get dtmf() {\n if (this._dtmf === undefined) {\n if (track.kind === 'audio') {\n this._dtmf = pc.createDTMFSender(track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n },\n _pc: pc\n };\n };\n\n // augment addTrack when getSenders is not available.\n if (!window.RTCPeerConnection.prototype.getSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n this._senders = this._senders || [];\n return this._senders.slice(); // return a copy of the internal state.\n };\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n let sender = origAddTrack.apply(this, arguments);\n if (!sender) {\n sender = shimSenderWithDtmf(this, track);\n this._senders.push(sender);\n }\n return sender;\n };\n\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n origRemoveTrack.apply(this, arguments);\n const idx = this._senders.indexOf(sender);\n if (idx !== -1) {\n this._senders.splice(idx, 1);\n }\n };\n }\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._senders = this._senders || [];\n origAddStream.apply(this, [stream]);\n stream.getTracks().forEach(track => {\n this._senders.push(shimSenderWithDtmf(this, track));\n });\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._senders = this._senders || [];\n origRemoveStream.apply(this, [stream]);\n\n stream.getTracks().forEach(track => {\n const sender = this._senders.find(s => s.track === track);\n if (sender) { // remove sender\n this._senders.splice(this._senders.indexOf(sender), 1);\n }\n });\n };\n } else if (typeof window === 'object' && window.RTCPeerConnection &&\n 'getSenders' in window.RTCPeerConnection.prototype &&\n 'createDTMFSender' in window.RTCPeerConnection.prototype &&\n window.RTCRtpSender &&\n !('dtmf' in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n\n Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', {\n get() {\n if (this._dtmf === undefined) {\n if (this.track.kind === 'audio') {\n this._dtmf = this._pc.createDTMFSender(this.track);\n } else {\n this._dtmf = null;\n }\n }\n return this._dtmf;\n }\n });\n }\n}\n\nexport function shimGetStats(window) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n\n // If selector is a function then we are in the old style stats so just\n // pass back the original getStats format to avoid breaking old users.\n if (arguments.length > 0 && typeof selector === 'function') {\n return origGetStats.apply(this, arguments);\n }\n\n // When spec-style getStats is supported, return those when called with\n // either no arguments or the selector argument is null.\n if (origGetStats.length === 0 && (arguments.length === 0 ||\n typeof selector !== 'function')) {\n return origGetStats.apply(this, []);\n }\n\n const fixChromeStats_ = function(response) {\n const standardReport = {};\n const reports = response.result();\n reports.forEach(report => {\n const standardStats = {\n id: report.id,\n timestamp: report.timestamp,\n type: {\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n }[report.type] || report.type\n };\n report.names().forEach(name => {\n standardStats[name] = report.stat(name);\n });\n standardReport[standardStats.id] = standardStats;\n });\n\n return standardReport;\n };\n\n // shim getStats with maplike support\n const makeMapStats = function(stats) {\n return new Map(Object.keys(stats).map(key => [key, stats[key]]));\n };\n\n if (arguments.length >= 2) {\n const successCallbackWrapper_ = function(response) {\n onSucc(makeMapStats(fixChromeStats_(response)));\n };\n\n return origGetStats.apply(this, [successCallbackWrapper_,\n selector]);\n }\n\n // promise-support\n return new Promise((resolve, reject) => {\n origGetStats.apply(this, [\n function(response) {\n resolve(makeMapStats(fixChromeStats_(response)));\n }, reject]);\n }).then(onSucc, onErr);\n };\n}\n\nexport function shimSenderReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender && window.RTCRtpReceiver)) {\n return;\n }\n\n // shim sender stats.\n if (!('getStats' in window.RTCRtpSender.prototype)) {\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n window.RTCRtpSender.prototype.getStats = function getStats() {\n const sender = this;\n return this._pc.getStats().then(result =>\n /* Note: this will include stats of all senders that\n * send a track with the same id as sender.track as\n * it is not possible to identify the RTCRtpSender.\n */\n utils.filterStats(result, sender.track, true));\n };\n }\n\n // shim receiver stats.\n if (!('getStats' in window.RTCRtpReceiver.prototype)) {\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers =\n function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n const receiver = this;\n return this._pc.getStats().then(result =>\n utils.filterStats(result, receiver.track, false));\n };\n }\n\n if (!('getStats' in window.RTCRtpSender.prototype &&\n 'getStats' in window.RTCRtpReceiver.prototype)) {\n return;\n }\n\n // shim RTCPeerConnection.getStats(track).\n const origGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n if (arguments.length > 0 &&\n arguments[0] instanceof window.MediaStreamTrack) {\n const track = arguments[0];\n let sender;\n let receiver;\n let err;\n this.getSenders().forEach(s => {\n if (s.track === track) {\n if (sender) {\n err = true;\n } else {\n sender = s;\n }\n }\n });\n this.getReceivers().forEach(r => {\n if (r.track === track) {\n if (receiver) {\n err = true;\n } else {\n receiver = r;\n }\n }\n return r.track === track;\n });\n if (err || (sender && receiver)) {\n return Promise.reject(new DOMException(\n 'There are more than one sender or receiver for the track.',\n 'InvalidAccessError'));\n } else if (sender) {\n return sender.getStats();\n } else if (receiver) {\n return receiver.getStats();\n }\n return Promise.reject(new DOMException(\n 'There is no sender or receiver for the track.',\n 'InvalidAccessError'));\n }\n return origGetStats.apply(this, arguments);\n };\n}\n\nexport function shimAddTrackRemoveTrackWithNative(window) {\n // shim addTrack/removeTrack with native variants in order to make\n // the interactions with legacy getLocalStreams behave as in other browsers.\n // Keeps a mapping stream.id => [stream, rtpsenders...]\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n return Object.keys(this._shimmedLocalStreams)\n .map(streamId => this._shimmedLocalStreams[streamId][0]);\n };\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n if (!stream) {\n return origAddTrack.apply(this, arguments);\n }\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n\n const sender = origAddTrack.apply(this, arguments);\n if (!this._shimmedLocalStreams[stream.id]) {\n this._shimmedLocalStreams[stream.id] = [stream, sender];\n } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) {\n this._shimmedLocalStreams[stream.id].push(sender);\n }\n return sender;\n };\n\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n\n stream.getTracks().forEach(track => {\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n });\n const existingSenders = this.getSenders();\n origAddStream.apply(this, arguments);\n const newSenders = this.getSenders()\n .filter(newSender => existingSenders.indexOf(newSender) === -1);\n this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders);\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n delete this._shimmedLocalStreams[stream.id];\n return origRemoveStream.apply(this, arguments);\n };\n\n const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack;\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n this._shimmedLocalStreams = this._shimmedLocalStreams || {};\n if (sender) {\n Object.keys(this._shimmedLocalStreams).forEach(streamId => {\n const idx = this._shimmedLocalStreams[streamId].indexOf(sender);\n if (idx !== -1) {\n this._shimmedLocalStreams[streamId].splice(idx, 1);\n }\n if (this._shimmedLocalStreams[streamId].length === 1) {\n delete this._shimmedLocalStreams[streamId];\n }\n });\n }\n return origRemoveTrack.apply(this, arguments);\n };\n}\n\nexport function shimAddTrackRemoveTrack(window, browserDetails) {\n if (!window.RTCPeerConnection) {\n return;\n }\n // shim addTrack and removeTrack.\n if (window.RTCPeerConnection.prototype.addTrack &&\n browserDetails.version >= 65) {\n return shimAddTrackRemoveTrackWithNative(window);\n }\n\n // also shim pc.getLocalStreams when addTrack is shimmed\n // to return the original streams.\n const origGetLocalStreams = window.RTCPeerConnection.prototype\n .getLocalStreams;\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n const nativeStreams = origGetLocalStreams.apply(this);\n this._reverseStreams = this._reverseStreams || {};\n return nativeStreams.map(stream => this._reverseStreams[stream.id]);\n };\n\n const origAddStream = window.RTCPeerConnection.prototype.addStream;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n\n stream.getTracks().forEach(track => {\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n });\n // Add identity mapping for consistency with addTrack.\n // Unless this is being used with a stream from addTrack.\n if (!this._reverseStreams[stream.id]) {\n const newStream = new window.MediaStream(stream.getTracks());\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n stream = newStream;\n }\n origAddStream.apply(this, [stream]);\n };\n\n const origRemoveStream = window.RTCPeerConnection.prototype.removeStream;\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n\n origRemoveStream.apply(this, [(this._streams[stream.id] || stream)]);\n delete this._reverseStreams[(this._streams[stream.id] ?\n this._streams[stream.id].id : stream.id)];\n delete this._streams[stream.id];\n };\n\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, stream) {\n if (this.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n const streams = [].slice.call(arguments, 1);\n if (streams.length !== 1 ||\n !streams[0].getTracks().find(t => t === track)) {\n // this is not fully correct but all we can manage without\n // [[associated MediaStreams]] internal slot.\n throw new DOMException(\n 'The adapter.js addTrack polyfill only supports a single ' +\n ' stream which is associated with the specified track.',\n 'NotSupportedError');\n }\n\n const alreadyExists = this.getSenders().find(s => s.track === track);\n if (alreadyExists) {\n throw new DOMException('Track already exists.',\n 'InvalidAccessError');\n }\n\n this._streams = this._streams || {};\n this._reverseStreams = this._reverseStreams || {};\n const oldStream = this._streams[stream.id];\n if (oldStream) {\n // this is using odd Chrome behaviour, use with caution:\n // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815\n // Note: we rely on the high-level addTrack/dtmf shim to\n // create the sender with a dtmf sender.\n oldStream.addTrack(track);\n\n // Trigger ONN async.\n Promise.resolve().then(() => {\n this.dispatchEvent(new Event('negotiationneeded'));\n });\n } else {\n const newStream = new window.MediaStream([track]);\n this._streams[stream.id] = newStream;\n this._reverseStreams[newStream.id] = stream;\n this.addStream(newStream);\n }\n return this.getSenders().find(s => s.track === track);\n };\n\n // replace the internal stream id with the external one and\n // vice versa.\n function replaceInternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach(internalId => {\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(internalStream.id, 'g'),\n externalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp\n });\n }\n function replaceExternalStreamId(pc, description) {\n let sdp = description.sdp;\n Object.keys(pc._reverseStreams || []).forEach(internalId => {\n const externalStream = pc._reverseStreams[internalId];\n const internalStream = pc._streams[externalStream.id];\n sdp = sdp.replace(new RegExp(externalStream.id, 'g'),\n internalStream.id);\n });\n return new RTCSessionDescription({\n type: description.type,\n sdp\n });\n }\n ['createOffer', 'createAnswer'].forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n const args = arguments;\n const isLegacyCall = arguments.length &&\n typeof arguments[0] === 'function';\n if (isLegacyCall) {\n return nativeMethod.apply(this, [\n (description) => {\n const desc = replaceInternalStreamId(this, description);\n args[0].apply(null, [desc]);\n },\n (err) => {\n if (args[1]) {\n args[1].apply(null, err);\n }\n }, arguments[2]\n ]);\n }\n return nativeMethod.apply(this, arguments)\n .then(description => replaceInternalStreamId(this, description));\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n\n const origSetLocalDescription =\n window.RTCPeerConnection.prototype.setLocalDescription;\n window.RTCPeerConnection.prototype.setLocalDescription =\n function setLocalDescription() {\n if (!arguments.length || !arguments[0].type) {\n return origSetLocalDescription.apply(this, arguments);\n }\n arguments[0] = replaceExternalStreamId(this, arguments[0]);\n return origSetLocalDescription.apply(this, arguments);\n };\n\n // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier\n\n const origLocalDescription = Object.getOwnPropertyDescriptor(\n window.RTCPeerConnection.prototype, 'localDescription');\n Object.defineProperty(window.RTCPeerConnection.prototype,\n 'localDescription', {\n get() {\n const description = origLocalDescription.get.apply(this);\n if (description.type === '') {\n return description;\n }\n return replaceInternalStreamId(this, description);\n }\n });\n\n window.RTCPeerConnection.prototype.removeTrack =\n function removeTrack(sender) {\n if (this.signalingState === 'closed') {\n throw new DOMException(\n 'The RTCPeerConnection\\'s signalingState is \\'closed\\'.',\n 'InvalidStateError');\n }\n // We can not yet check for sender instanceof RTCRtpSender\n // since we shim RTPSender. So we check if sender._pc is set.\n if (!sender._pc) {\n throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' +\n 'does not implement interface RTCRtpSender.', 'TypeError');\n }\n const isLocal = sender._pc === this;\n if (!isLocal) {\n throw new DOMException('Sender was not created by this connection.',\n 'InvalidAccessError');\n }\n\n // Search for the native stream the senders track belongs to.\n this._streams = this._streams || {};\n let stream;\n Object.keys(this._streams).forEach(streamid => {\n const hasTrack = this._streams[streamid].getTracks()\n .find(track => sender.track === track);\n if (hasTrack) {\n stream = this._streams[streamid];\n }\n });\n\n if (stream) {\n if (stream.getTracks().length === 1) {\n // if this is the last track of the stream, remove the stream. This\n // takes care of any shimmed _senders.\n this.removeStream(this._reverseStreams[stream.id]);\n } else {\n // relying on the same odd chrome behaviour as above.\n stream.removeTrack(sender.track);\n }\n this.dispatchEvent(new Event('negotiationneeded'));\n }\n };\n}\n\nexport function shimPeerConnection(window, browserDetails) {\n if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.webkitRTCPeerConnection;\n }\n if (!window.RTCPeerConnection) {\n return;\n }\n\n // shim implicit creation of RTCSessionDescription/RTCIceCandidate\n if (browserDetails.version < 53) {\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n window.RTCIceCandidate :\n window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n}\n\n// Attempt to fix ONN in plan-b mode.\nexport function fixNegotiationNeeded(window, browserDetails) {\n utils.wrapPeerConnectionEvent(window, 'negotiationneeded', e => {\n const pc = e.target;\n if (browserDetails.version < 72 || (pc.getConfiguration &&\n pc.getConfiguration().sdpSemantics === 'plan-b')) {\n if (pc.signalingState !== 'stable') {\n return;\n }\n }\n return e;\n });\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport * as utils from '../utils';\n\nexport function shimGetUserMedia(window, browserDetails) {\n const navigator = window && window.navigator;\n const MediaStreamTrack = window && window.MediaStreamTrack;\n\n navigator.getUserMedia = function(constraints, onSuccess, onError) {\n // Replace Firefox 44+'s deprecation warning with unprefixed version.\n utils.deprecated('navigator.getUserMedia',\n 'navigator.mediaDevices.getUserMedia');\n navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError);\n };\n\n if (!(browserDetails.version > 55 &&\n 'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) {\n const remap = function(obj, a, b) {\n if (a in obj && !(b in obj)) {\n obj[b] = obj[a];\n delete obj[a];\n }\n };\n\n const nativeGetUserMedia = navigator.mediaDevices.getUserMedia.\n bind(navigator.mediaDevices);\n navigator.mediaDevices.getUserMedia = function(c) {\n if (typeof c === 'object' && typeof c.audio === 'object') {\n c = JSON.parse(JSON.stringify(c));\n remap(c.audio, 'autoGainControl', 'mozAutoGainControl');\n remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression');\n }\n return nativeGetUserMedia(c);\n };\n\n if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) {\n const nativeGetSettings = MediaStreamTrack.prototype.getSettings;\n MediaStreamTrack.prototype.getSettings = function() {\n const obj = nativeGetSettings.apply(this, arguments);\n remap(obj, 'mozAutoGainControl', 'autoGainControl');\n remap(obj, 'mozNoiseSuppression', 'noiseSuppression');\n return obj;\n };\n }\n\n if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) {\n const nativeApplyConstraints =\n MediaStreamTrack.prototype.applyConstraints;\n MediaStreamTrack.prototype.applyConstraints = function(c) {\n if (this.kind === 'audio' && typeof c === 'object') {\n c = JSON.parse(JSON.stringify(c));\n remap(c, 'autoGainControl', 'mozAutoGainControl');\n remap(c, 'noiseSuppression', 'mozNoiseSuppression');\n }\n return nativeApplyConstraints.apply(this, [c]);\n };\n }\n }\n}\n","/*\n * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nexport function shimGetDisplayMedia(window, preferredMediaSource) {\n if (window.navigator.mediaDevices &&\n 'getDisplayMedia' in window.navigator.mediaDevices) {\n return;\n }\n if (!(window.navigator.mediaDevices)) {\n return;\n }\n window.navigator.mediaDevices.getDisplayMedia =\n function getDisplayMedia(constraints) {\n if (!(constraints && constraints.video)) {\n const err = new DOMException('getDisplayMedia without video ' +\n 'constraints is undefined');\n err.name = 'NotFoundError';\n // from https://heycam.github.io/webidl/#idl-DOMException-error-names\n err.code = 8;\n return Promise.reject(err);\n }\n if (constraints.video === true) {\n constraints.video = {mediaSource: preferredMediaSource};\n } else {\n constraints.video.mediaSource = preferredMediaSource;\n }\n return window.navigator.mediaDevices.getUserMedia(constraints);\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport * as utils from '../utils';\nexport {shimGetUserMedia} from './getusermedia';\nexport {shimGetDisplayMedia} from './getdisplaymedia';\n\nexport function shimOnTrack(window) {\n if (typeof window === 'object' && window.RTCTrackEvent &&\n ('receiver' in window.RTCTrackEvent.prototype) &&\n !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {receiver: this.receiver};\n }\n });\n }\n}\n\nexport function shimPeerConnection(window, browserDetails) {\n if (typeof window !== 'object' ||\n !(window.RTCPeerConnection || window.mozRTCPeerConnection)) {\n return; // probably media.peerconnection.enabled=false in about:config\n }\n if (!window.RTCPeerConnection && window.mozRTCPeerConnection) {\n // very basic support for old versions.\n window.RTCPeerConnection = window.mozRTCPeerConnection;\n }\n\n if (browserDetails.version < 53) {\n // shim away need for obsolete RTCIceCandidate/RTCSessionDescription.\n ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']\n .forEach(function(method) {\n const nativeMethod = window.RTCPeerConnection.prototype[method];\n const methodObj = {[method]() {\n arguments[0] = new ((method === 'addIceCandidate') ?\n window.RTCIceCandidate :\n window.RTCSessionDescription)(arguments[0]);\n return nativeMethod.apply(this, arguments);\n }};\n window.RTCPeerConnection.prototype[method] = methodObj[method];\n });\n }\n\n const modernStatsTypes = {\n inboundrtp: 'inbound-rtp',\n outboundrtp: 'outbound-rtp',\n candidatepair: 'candidate-pair',\n localcandidate: 'local-candidate',\n remotecandidate: 'remote-candidate'\n };\n\n const nativeGetStats = window.RTCPeerConnection.prototype.getStats;\n window.RTCPeerConnection.prototype.getStats = function getStats() {\n const [selector, onSucc, onErr] = arguments;\n return nativeGetStats.apply(this, [selector || null])\n .then(stats => {\n if (browserDetails.version < 53 && !onSucc) {\n // Shim only promise getStats with spec-hyphens in type names\n // Leave callback version alone; misc old uses of forEach before Map\n try {\n stats.forEach(stat => {\n stat.type = modernStatsTypes[stat.type] || stat.type;\n });\n } catch (e) {\n if (e.name !== 'TypeError') {\n throw e;\n }\n // Avoid TypeError: \"type\" is read-only, in old versions. 34-43ish\n stats.forEach((stat, i) => {\n stats.set(i, Object.assign({}, stat, {\n type: modernStatsTypes[stat.type] || stat.type\n }));\n });\n }\n }\n return stats;\n })\n .then(onSucc, onErr);\n };\n}\n\nexport function shimSenderGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender)) {\n return;\n }\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) {\n return;\n }\n const origGetSenders = window.RTCPeerConnection.prototype.getSenders;\n if (origGetSenders) {\n window.RTCPeerConnection.prototype.getSenders = function getSenders() {\n const senders = origGetSenders.apply(this, []);\n senders.forEach(sender => sender._pc = this);\n return senders;\n };\n }\n\n const origAddTrack = window.RTCPeerConnection.prototype.addTrack;\n if (origAddTrack) {\n window.RTCPeerConnection.prototype.addTrack = function addTrack() {\n const sender = origAddTrack.apply(this, arguments);\n sender._pc = this;\n return sender;\n };\n }\n window.RTCRtpSender.prototype.getStats = function getStats() {\n return this.track ? this._pc.getStats(this.track) :\n Promise.resolve(new Map());\n };\n}\n\nexport function shimReceiverGetStats(window) {\n if (!(typeof window === 'object' && window.RTCPeerConnection &&\n window.RTCRtpSender)) {\n return;\n }\n if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) {\n return;\n }\n const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers;\n if (origGetReceivers) {\n window.RTCPeerConnection.prototype.getReceivers = function getReceivers() {\n const receivers = origGetReceivers.apply(this, []);\n receivers.forEach(receiver => receiver._pc = this);\n return receivers;\n };\n }\n utils.wrapPeerConnectionEvent(window, 'track', e => {\n e.receiver._pc = e.srcElement;\n return e;\n });\n window.RTCRtpReceiver.prototype.getStats = function getStats() {\n return this._pc.getStats(this.track);\n };\n}\n\nexport function shimRemoveStream(window) {\n if (!window.RTCPeerConnection ||\n 'removeStream' in window.RTCPeerConnection.prototype) {\n return;\n }\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n utils.deprecated('removeStream', 'removeTrack');\n this.getSenders().forEach(sender => {\n if (sender.track && stream.getTracks().includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n}\n\nexport function shimRTCDataChannel(window) {\n // rename DataChannel to RTCDataChannel (native fix in FF60):\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851\n if (window.DataChannel && !window.RTCDataChannel) {\n window.RTCDataChannel = window.DataChannel;\n }\n}\n\nexport function shimAddTransceiver(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver;\n if (origAddTransceiver) {\n window.RTCPeerConnection.prototype.addTransceiver =\n function addTransceiver() {\n this.setParametersPromises = [];\n // WebIDL input coercion and validation\n let sendEncodings = arguments[1] && arguments[1].sendEncodings;\n if (sendEncodings === undefined) {\n sendEncodings = [];\n }\n sendEncodings = [...sendEncodings];\n const shouldPerformCheck = sendEncodings.length > 0;\n if (shouldPerformCheck) {\n // If sendEncodings params are provided, validate grammar\n sendEncodings.forEach((encodingParam) => {\n if ('rid' in encodingParam) {\n const ridRegex = /^[a-z0-9]{0,16}$/i;\n if (!ridRegex.test(encodingParam.rid)) {\n throw new TypeError('Invalid RID value provided.');\n }\n }\n if ('scaleResolutionDownBy' in encodingParam) {\n if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) {\n throw new RangeError('scale_resolution_down_by must be >= 1.0');\n }\n }\n if ('maxFramerate' in encodingParam) {\n if (!(parseFloat(encodingParam.maxFramerate) >= 0)) {\n throw new RangeError('max_framerate must be >= 0.0');\n }\n }\n });\n }\n const transceiver = origAddTransceiver.apply(this, arguments);\n if (shouldPerformCheck) {\n // Check if the init options were applied. If not we do this in an\n // asynchronous way and save the promise reference in a global object.\n // This is an ugly hack, but at the same time is way more robust than\n // checking the sender parameters before and after the createOffer\n // Also note that after the createoffer we are not 100% sure that\n // the params were asynchronously applied so we might miss the\n // opportunity to recreate offer.\n const {sender} = transceiver;\n const params = sender.getParameters();\n if (!('encodings' in params) ||\n // Avoid being fooled by patched getParameters() below.\n (params.encodings.length === 1 &&\n Object.keys(params.encodings[0]).length === 0)) {\n params.encodings = sendEncodings;\n sender.sendEncodings = sendEncodings;\n this.setParametersPromises.push(sender.setParameters(params)\n .then(() => {\n delete sender.sendEncodings;\n }).catch(() => {\n delete sender.sendEncodings;\n })\n );\n }\n }\n return transceiver;\n };\n }\n}\n\nexport function shimGetParameters(window) {\n if (!(typeof window === 'object' && window.RTCRtpSender)) {\n return;\n }\n const origGetParameters = window.RTCRtpSender.prototype.getParameters;\n if (origGetParameters) {\n window.RTCRtpSender.prototype.getParameters =\n function getParameters() {\n const params = origGetParameters.apply(this, arguments);\n if (!('encodings' in params)) {\n params.encodings = [].concat(this.sendEncodings || [{}]);\n }\n return params;\n };\n }\n}\n\nexport function shimCreateOffer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer = function createOffer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises)\n .then(() => {\n return origCreateOffer.apply(this, arguments);\n })\n .finally(() => {\n this.setParametersPromises = [];\n });\n }\n return origCreateOffer.apply(this, arguments);\n };\n}\n\nexport function shimCreateAnswer(window) {\n // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647\n // Firefox ignores the init sendEncodings options passed to addTransceiver\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918\n if (!(typeof window === 'object' && window.RTCPeerConnection)) {\n return;\n }\n const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer;\n window.RTCPeerConnection.prototype.createAnswer = function createAnswer() {\n if (this.setParametersPromises && this.setParametersPromises.length) {\n return Promise.all(this.setParametersPromises)\n .then(() => {\n return origCreateAnswer.apply(this, arguments);\n })\n .finally(() => {\n this.setParametersPromises = [];\n });\n }\n return origCreateAnswer.apply(this, arguments);\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n'use strict';\nimport * as utils from '../utils';\n\nexport function shimLocalStreamsAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.getLocalStreams =\n function getLocalStreams() {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n return this._localStreams;\n };\n }\n if (!('addStream' in window.RTCPeerConnection.prototype)) {\n const _addTrack = window.RTCPeerConnection.prototype.addTrack;\n window.RTCPeerConnection.prototype.addStream = function addStream(stream) {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n if (!this._localStreams.includes(stream)) {\n this._localStreams.push(stream);\n }\n // Try to emulate Chrome's behaviour of adding in audio-video order.\n // Safari orders by track id.\n stream.getAudioTracks().forEach(track => _addTrack.call(this, track,\n stream));\n stream.getVideoTracks().forEach(track => _addTrack.call(this, track,\n stream));\n };\n\n window.RTCPeerConnection.prototype.addTrack =\n function addTrack(track, ...streams) {\n if (streams) {\n streams.forEach((stream) => {\n if (!this._localStreams) {\n this._localStreams = [stream];\n } else if (!this._localStreams.includes(stream)) {\n this._localStreams.push(stream);\n }\n });\n }\n return _addTrack.apply(this, arguments);\n };\n }\n if (!('removeStream' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.removeStream =\n function removeStream(stream) {\n if (!this._localStreams) {\n this._localStreams = [];\n }\n const index = this._localStreams.indexOf(stream);\n if (index === -1) {\n return;\n }\n this._localStreams.splice(index, 1);\n const tracks = stream.getTracks();\n this.getSenders().forEach(sender => {\n if (tracks.includes(sender.track)) {\n this.removeTrack(sender);\n }\n });\n };\n }\n}\n\nexport function shimRemoteStreamsAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) {\n window.RTCPeerConnection.prototype.getRemoteStreams =\n function getRemoteStreams() {\n return this._remoteStreams ? this._remoteStreams : [];\n };\n }\n if (!('onaddstream' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', {\n get() {\n return this._onaddstream;\n },\n set(f) {\n if (this._onaddstream) {\n this.removeEventListener('addstream', this._onaddstream);\n this.removeEventListener('track', this._onaddstreampoly);\n }\n this.addEventListener('addstream', this._onaddstream = f);\n this.addEventListener('track', this._onaddstreampoly = (e) => {\n e.streams.forEach(stream => {\n if (!this._remoteStreams) {\n this._remoteStreams = [];\n }\n if (this._remoteStreams.includes(stream)) {\n return;\n }\n this._remoteStreams.push(stream);\n const event = new Event('addstream');\n event.stream = stream;\n this.dispatchEvent(event);\n });\n });\n }\n });\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n const pc = this;\n if (!this._onaddstreampoly) {\n this.addEventListener('track', this._onaddstreampoly = function(e) {\n e.streams.forEach(stream => {\n if (!pc._remoteStreams) {\n pc._remoteStreams = [];\n }\n if (pc._remoteStreams.indexOf(stream) >= 0) {\n return;\n }\n pc._remoteStreams.push(stream);\n const event = new Event('addstream');\n event.stream = stream;\n pc.dispatchEvent(event);\n });\n });\n }\n return origSetRemoteDescription.apply(pc, arguments);\n };\n }\n}\n\nexport function shimCallbacksAPI(window) {\n if (typeof window !== 'object' || !window.RTCPeerConnection) {\n return;\n }\n const prototype = window.RTCPeerConnection.prototype;\n const origCreateOffer = prototype.createOffer;\n const origCreateAnswer = prototype.createAnswer;\n const setLocalDescription = prototype.setLocalDescription;\n const setRemoteDescription = prototype.setRemoteDescription;\n const addIceCandidate = prototype.addIceCandidate;\n\n prototype.createOffer =\n function createOffer(successCallback, failureCallback) {\n const options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n const promise = origCreateOffer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n prototype.createAnswer =\n function createAnswer(successCallback, failureCallback) {\n const options = (arguments.length >= 2) ? arguments[2] : arguments[0];\n const promise = origCreateAnswer.apply(this, [options]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n\n let withCallback = function(description, successCallback, failureCallback) {\n const promise = setLocalDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setLocalDescription = withCallback;\n\n withCallback = function(description, successCallback, failureCallback) {\n const promise = setRemoteDescription.apply(this, [description]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.setRemoteDescription = withCallback;\n\n withCallback = function(candidate, successCallback, failureCallback) {\n const promise = addIceCandidate.apply(this, [candidate]);\n if (!failureCallback) {\n return promise;\n }\n promise.then(successCallback, failureCallback);\n return Promise.resolve();\n };\n prototype.addIceCandidate = withCallback;\n}\n\nexport function shimGetUserMedia(window) {\n const navigator = window && window.navigator;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n // shim not needed in Safari 12.1\n const mediaDevices = navigator.mediaDevices;\n const _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices);\n navigator.mediaDevices.getUserMedia = (constraints) => {\n return _getUserMedia(shimConstraints(constraints));\n };\n }\n\n if (!navigator.getUserMedia && navigator.mediaDevices &&\n navigator.mediaDevices.getUserMedia) {\n navigator.getUserMedia = function getUserMedia(constraints, cb, errcb) {\n navigator.mediaDevices.getUserMedia(constraints)\n .then(cb, errcb);\n }.bind(navigator);\n }\n}\n\nexport function shimConstraints(constraints) {\n if (constraints && constraints.video !== undefined) {\n return Object.assign({},\n constraints,\n {video: utils.compactObject(constraints.video)}\n );\n }\n\n return constraints;\n}\n\nexport function shimRTCIceServerUrls(window) {\n if (!window.RTCPeerConnection) {\n return;\n }\n // migrate from non-spec RTCIceServer.url to RTCIceServer.urls\n const OrigPeerConnection = window.RTCPeerConnection;\n window.RTCPeerConnection =\n function RTCPeerConnection(pcConfig, pcConstraints) {\n if (pcConfig && pcConfig.iceServers) {\n const newIceServers = [];\n for (let i = 0; i < pcConfig.iceServers.length; i++) {\n let server = pcConfig.iceServers[i];\n if (server.urls === undefined && server.url) {\n utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');\n server = JSON.parse(JSON.stringify(server));\n server.urls = server.url;\n delete server.url;\n newIceServers.push(server);\n } else {\n newIceServers.push(pcConfig.iceServers[i]);\n }\n }\n pcConfig.iceServers = newIceServers;\n }\n return new OrigPeerConnection(pcConfig, pcConstraints);\n };\n window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;\n // wrap static methods. Currently just generateCertificate.\n if ('generateCertificate' in OrigPeerConnection) {\n Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {\n get() {\n return OrigPeerConnection.generateCertificate;\n }\n });\n }\n}\n\nexport function shimTrackEventTransceiver(window) {\n // Add event.transceiver member over deprecated event.receiver\n if (typeof window === 'object' && window.RTCTrackEvent &&\n 'receiver' in window.RTCTrackEvent.prototype &&\n !('transceiver' in window.RTCTrackEvent.prototype)) {\n Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', {\n get() {\n return {receiver: this.receiver};\n }\n });\n }\n}\n\nexport function shimCreateOfferLegacy(window) {\n const origCreateOffer = window.RTCPeerConnection.prototype.createOffer;\n window.RTCPeerConnection.prototype.createOffer =\n function createOffer(offerOptions) {\n if (offerOptions) {\n if (typeof offerOptions.offerToReceiveAudio !== 'undefined') {\n // support bit values\n offerOptions.offerToReceiveAudio =\n !!offerOptions.offerToReceiveAudio;\n }\n const audioTransceiver = this.getTransceivers().find(transceiver =>\n transceiver.receiver.track.kind === 'audio');\n if (offerOptions.offerToReceiveAudio === false && audioTransceiver) {\n if (audioTransceiver.direction === 'sendrecv') {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection('sendonly');\n } else {\n audioTransceiver.direction = 'sendonly';\n }\n } else if (audioTransceiver.direction === 'recvonly') {\n if (audioTransceiver.setDirection) {\n audioTransceiver.setDirection('inactive');\n } else {\n audioTransceiver.direction = 'inactive';\n }\n }\n } else if (offerOptions.offerToReceiveAudio === true &&\n !audioTransceiver) {\n this.addTransceiver('audio', {direction: 'recvonly'});\n }\n\n if (typeof offerOptions.offerToReceiveVideo !== 'undefined') {\n // support bit values\n offerOptions.offerToReceiveVideo =\n !!offerOptions.offerToReceiveVideo;\n }\n const videoTransceiver = this.getTransceivers().find(transceiver =>\n transceiver.receiver.track.kind === 'video');\n if (offerOptions.offerToReceiveVideo === false && videoTransceiver) {\n if (videoTransceiver.direction === 'sendrecv') {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection('sendonly');\n } else {\n videoTransceiver.direction = 'sendonly';\n }\n } else if (videoTransceiver.direction === 'recvonly') {\n if (videoTransceiver.setDirection) {\n videoTransceiver.setDirection('inactive');\n } else {\n videoTransceiver.direction = 'inactive';\n }\n }\n } else if (offerOptions.offerToReceiveVideo === true &&\n !videoTransceiver) {\n this.addTransceiver('video', {direction: 'recvonly'});\n }\n }\n return origCreateOffer.apply(this, arguments);\n };\n}\n\nexport function shimAudioContext(window) {\n if (typeof window !== 'object' || window.AudioContext) {\n return;\n }\n window.AudioContext = window.webkitAudioContext;\n}\n\n","/*\n * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n'use strict';\n\nimport SDPUtils from 'sdp';\nimport * as utils from './utils';\n\nexport function shimRTCIceCandidate(window) {\n // foundation is arbitrarily chosen as an indicator for full support for\n // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface\n if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'foundation' in\n window.RTCIceCandidate.prototype)) {\n return;\n }\n\n const NativeRTCIceCandidate = window.RTCIceCandidate;\n window.RTCIceCandidate = function RTCIceCandidate(args) {\n // Remove the a= which shouldn't be part of the candidate string.\n if (typeof args === 'object' && args.candidate &&\n args.candidate.indexOf('a=') === 0) {\n args = JSON.parse(JSON.stringify(args));\n args.candidate = args.candidate.substring(2);\n }\n\n if (args.candidate && args.candidate.length) {\n // Augment the native candidate with the parsed fields.\n const nativeCandidate = new NativeRTCIceCandidate(args);\n const parsedCandidate = SDPUtils.parseCandidate(args.candidate);\n for (const key in parsedCandidate) {\n if (!(key in nativeCandidate)) {\n Object.defineProperty(nativeCandidate, key,\n {value: parsedCandidate[key]});\n }\n }\n\n // Override serializer to not serialize the extra attributes.\n nativeCandidate.toJSON = function toJSON() {\n return {\n candidate: nativeCandidate.candidate,\n sdpMid: nativeCandidate.sdpMid,\n sdpMLineIndex: nativeCandidate.sdpMLineIndex,\n usernameFragment: nativeCandidate.usernameFragment,\n };\n };\n return nativeCandidate;\n }\n return new NativeRTCIceCandidate(args);\n };\n window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype;\n\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n utils.wrapPeerConnectionEvent(window, 'icecandidate', e => {\n if (e.candidate) {\n Object.defineProperty(e, 'candidate', {\n value: new window.RTCIceCandidate(e.candidate),\n writable: 'false'\n });\n }\n return e;\n });\n}\n\nexport function shimRTCIceCandidateRelayProtocol(window) {\n if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'relayProtocol' in\n window.RTCIceCandidate.prototype)) {\n return;\n }\n\n // Hook up the augmented candidate in onicecandidate and\n // addEventListener('icecandidate', ...)\n utils.wrapPeerConnectionEvent(window, 'icecandidate', e => {\n if (e.candidate) {\n const parsedCandidate = SDPUtils.parseCandidate(e.candidate.candidate);\n if (parsedCandidate.type === 'relay') {\n // This is a libwebrtc-specific mapping of local type preference\n // to relayProtocol.\n e.candidate.relayProtocol = {\n 0: 'tls',\n 1: 'tcp',\n 2: 'udp',\n }[parsedCandidate.priority >> 24];\n }\n }\n return e;\n });\n}\n\nexport function shimMaxMessageSize(window, browserDetails) {\n if (!window.RTCPeerConnection) {\n return;\n }\n\n if (!('sctp' in window.RTCPeerConnection.prototype)) {\n Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', {\n get() {\n return typeof this._sctp === 'undefined' ? null : this._sctp;\n }\n });\n }\n\n const sctpInDescription = function(description) {\n if (!description || !description.sdp) {\n return false;\n }\n const sections = SDPUtils.splitSections(description.sdp);\n sections.shift();\n return sections.some(mediaSection => {\n const mLine = SDPUtils.parseMLine(mediaSection);\n return mLine && mLine.kind === 'application'\n && mLine.protocol.indexOf('SCTP') !== -1;\n });\n };\n\n const getRemoteFirefoxVersion = function(description) {\n // TODO: Is there a better solution for detecting Firefox?\n const match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\\d+)/);\n if (match === null || match.length < 2) {\n return -1;\n }\n const version = parseInt(match[1], 10);\n // Test for NaN (yes, this is ugly)\n return version !== version ? -1 : version;\n };\n\n const getCanSendMaxMessageSize = function(remoteIsFirefox) {\n // Every implementation we know can send at least 64 KiB.\n // Note: Although Chrome is technically able to send up to 256 KiB, the\n // data does not reach the other peer reliably.\n // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419\n let canSendMaxMessageSize = 65536;\n if (browserDetails.browser === 'firefox') {\n if (browserDetails.version < 57) {\n if (remoteIsFirefox === -1) {\n // FF < 57 will send in 16 KiB chunks using the deprecated PPID\n // fragmentation.\n canSendMaxMessageSize = 16384;\n } else {\n // However, other FF (and RAWRTC) can reassemble PPID-fragmented\n // messages. Thus, supporting ~2 GiB when sending.\n canSendMaxMessageSize = 2147483637;\n }\n } else if (browserDetails.version < 60) {\n // Currently, all FF >= 57 will reset the remote maximum message size\n // to the default value when a data channel is created at a later\n // stage. :(\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n canSendMaxMessageSize =\n browserDetails.version === 57 ? 65535 : 65536;\n } else {\n // FF >= 60 supports sending ~2 GiB\n canSendMaxMessageSize = 2147483637;\n }\n }\n return canSendMaxMessageSize;\n };\n\n const getMaxMessageSize = function(description, remoteIsFirefox) {\n // Note: 65536 bytes is the default value from the SDP spec. Also,\n // every implementation we know supports receiving 65536 bytes.\n let maxMessageSize = 65536;\n\n // FF 57 has a slightly incorrect default remote max message size, so\n // we need to adjust it here to avoid a failure when sending.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697\n if (browserDetails.browser === 'firefox'\n && browserDetails.version === 57) {\n maxMessageSize = 65535;\n }\n\n const match = SDPUtils.matchPrefix(description.sdp,\n 'a=max-message-size:');\n if (match.length > 0) {\n maxMessageSize = parseInt(match[0].substring(19), 10);\n } else if (browserDetails.browser === 'firefox' &&\n remoteIsFirefox !== -1) {\n // If the maximum message size is not present in the remote SDP and\n // both local and remote are Firefox, the remote peer can receive\n // ~2 GiB.\n maxMessageSize = 2147483637;\n }\n return maxMessageSize;\n };\n\n const origSetRemoteDescription =\n window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription() {\n this._sctp = null;\n // Chrome decided to not expose .sctp in plan-b mode.\n // As usual, adapter.js has to do an 'ugly worakaround'\n // to cover up the mess.\n if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) {\n const {sdpSemantics} = this.getConfiguration();\n if (sdpSemantics === 'plan-b') {\n Object.defineProperty(this, 'sctp', {\n get() {\n return typeof this._sctp === 'undefined' ? null : this._sctp;\n },\n enumerable: true,\n configurable: true,\n });\n }\n }\n\n if (sctpInDescription(arguments[0])) {\n // Check if the remote is FF.\n const isFirefox = getRemoteFirefoxVersion(arguments[0]);\n\n // Get the maximum message size the local peer is capable of sending\n const canSendMMS = getCanSendMaxMessageSize(isFirefox);\n\n // Get the maximum message size of the remote peer.\n const remoteMMS = getMaxMessageSize(arguments[0], isFirefox);\n\n // Determine final maximum message size\n let maxMessageSize;\n if (canSendMMS === 0 && remoteMMS === 0) {\n maxMessageSize = Number.POSITIVE_INFINITY;\n } else if (canSendMMS === 0 || remoteMMS === 0) {\n maxMessageSize = Math.max(canSendMMS, remoteMMS);\n } else {\n maxMessageSize = Math.min(canSendMMS, remoteMMS);\n }\n\n // Create a dummy RTCSctpTransport object and the 'maxMessageSize'\n // attribute.\n const sctp = {};\n Object.defineProperty(sctp, 'maxMessageSize', {\n get() {\n return maxMessageSize;\n }\n });\n this._sctp = sctp;\n }\n\n return origSetRemoteDescription.apply(this, arguments);\n };\n}\n\nexport function shimSendThrowTypeError(window) {\n if (!(window.RTCPeerConnection &&\n 'createDataChannel' in window.RTCPeerConnection.prototype)) {\n return;\n }\n\n // Note: Although Firefox >= 57 has a native implementation, the maximum\n // message size can be reset for all data channels at a later stage.\n // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831\n\n function wrapDcSend(dc, pc) {\n const origDataChannelSend = dc.send;\n dc.send = function send() {\n const data = arguments[0];\n const length = data.length || data.size || data.byteLength;\n if (dc.readyState === 'open' &&\n pc.sctp && length > pc.sctp.maxMessageSize) {\n throw new TypeError('Message too large (can send a maximum of ' +\n pc.sctp.maxMessageSize + ' bytes)');\n }\n return origDataChannelSend.apply(dc, arguments);\n };\n }\n const origCreateDataChannel =\n window.RTCPeerConnection.prototype.createDataChannel;\n window.RTCPeerConnection.prototype.createDataChannel =\n function createDataChannel() {\n const dataChannel = origCreateDataChannel.apply(this, arguments);\n wrapDcSend(dataChannel, this);\n return dataChannel;\n };\n utils.wrapPeerConnectionEvent(window, 'datachannel', e => {\n wrapDcSend(e.channel, e.target);\n return e;\n });\n}\n\n\n/* shims RTCConnectionState by pretending it is the same as iceConnectionState.\n * See https://bugs.chromium.org/p/webrtc/issues/detail?id=6145#c12\n * for why this is a valid hack in Chrome. In Firefox it is slightly incorrect\n * since DTLS failures would be hidden. See\n * https://bugzilla.mozilla.org/show_bug.cgi?id=1265827\n * for the Firefox tracking bug.\n */\nexport function shimConnectionState(window) {\n if (!window.RTCPeerConnection ||\n 'connectionState' in window.RTCPeerConnection.prototype) {\n return;\n }\n const proto = window.RTCPeerConnection.prototype;\n Object.defineProperty(proto, 'connectionState', {\n get() {\n return {\n completed: 'connected',\n checking: 'connecting'\n }[this.iceConnectionState] || this.iceConnectionState;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(proto, 'onconnectionstatechange', {\n get() {\n return this._onconnectionstatechange || null;\n },\n set(cb) {\n if (this._onconnectionstatechange) {\n this.removeEventListener('connectionstatechange',\n this._onconnectionstatechange);\n delete this._onconnectionstatechange;\n }\n if (cb) {\n this.addEventListener('connectionstatechange',\n this._onconnectionstatechange = cb);\n }\n },\n enumerable: true,\n configurable: true\n });\n\n ['setLocalDescription', 'setRemoteDescription'].forEach((method) => {\n const origMethod = proto[method];\n proto[method] = function() {\n if (!this._connectionstatechangepoly) {\n this._connectionstatechangepoly = e => {\n const pc = e.target;\n if (pc._lastConnectionState !== pc.connectionState) {\n pc._lastConnectionState = pc.connectionState;\n const newEvent = new Event('connectionstatechange', e);\n pc.dispatchEvent(newEvent);\n }\n return e;\n };\n this.addEventListener('iceconnectionstatechange',\n this._connectionstatechangepoly);\n }\n return origMethod.apply(this, arguments);\n };\n });\n}\n\nexport function removeExtmapAllowMixed(window, browserDetails) {\n /* remove a=extmap-allow-mixed for webrtc.org < M71 */\n if (!window.RTCPeerConnection) {\n return;\n }\n if (browserDetails.browser === 'chrome' && browserDetails.version >= 71) {\n return;\n }\n if (browserDetails.browser === 'safari' && browserDetails.version >= 605) {\n return;\n }\n const nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription;\n window.RTCPeerConnection.prototype.setRemoteDescription =\n function setRemoteDescription(desc) {\n if (desc && desc.sdp && desc.sdp.indexOf('\\na=extmap-allow-mixed') !== -1) {\n const sdp = desc.sdp.split('\\n').filter((line) => {\n return line.trim() !== 'a=extmap-allow-mixed';\n }).join('\\n');\n // Safari enforces read-only-ness of RTCSessionDescription fields.\n if (window.RTCSessionDescription &&\n desc instanceof window.RTCSessionDescription) {\n arguments[0] = new window.RTCSessionDescription({\n type: desc.type,\n sdp,\n });\n } else {\n desc.sdp = sdp;\n }\n }\n return nativeSRD.apply(this, arguments);\n };\n}\n\nexport function shimAddIceCandidateNullOrEmpty(window, browserDetails) {\n // Support for addIceCandidate(null or undefined)\n // as well as addIceCandidate({candidate: \"\", ...})\n // https://bugs.chromium.org/p/chromium/issues/detail?id=978582\n // Note: must be called before other polyfills which change the signature.\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) {\n return;\n }\n const nativeAddIceCandidate =\n window.RTCPeerConnection.prototype.addIceCandidate;\n if (!nativeAddIceCandidate) {\n return;\n }\n window.RTCPeerConnection.prototype.addIceCandidate =\n function addIceCandidate() {\n if (!arguments[0]) {\n if (arguments[1]) {\n arguments[1].apply(null);\n }\n return Promise.resolve();\n }\n // Firefox 68+ emits and processes {candidate: \"\", ...}, ignore\n // in older versions.\n // Native support for ignoring exists for Chrome M77+.\n // Safari ignores as well, exact version unknown but works in the same\n // version that also ignores addIceCandidate(null).\n if (((browserDetails.browser === 'chrome' && browserDetails.version < 78)\n || (browserDetails.browser === 'firefox'\n && browserDetails.version < 68)\n || (browserDetails.browser === 'safari'))\n && arguments[0] && arguments[0].candidate === '') {\n return Promise.resolve();\n }\n return nativeAddIceCandidate.apply(this, arguments);\n };\n}\n\n// Note: Make sure to call this ahead of APIs that modify\n// setLocalDescription.length\nexport function shimParameterlessSetLocalDescription(window, browserDetails) {\n if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) {\n return;\n }\n const nativeSetLocalDescription =\n window.RTCPeerConnection.prototype.setLocalDescription;\n if (!nativeSetLocalDescription || nativeSetLocalDescription.length === 0) {\n return;\n }\n window.RTCPeerConnection.prototype.setLocalDescription =\n function setLocalDescription() {\n let desc = arguments[0] || {};\n if (typeof desc !== 'object' || (desc.type && desc.sdp)) {\n return nativeSetLocalDescription.apply(this, arguments);\n }\n // The remaining steps should technically happen when SLD comes off the\n // RTCPeerConnection's operations chain (not ahead of going on it), but\n // this is too difficult to shim. Instead, this shim only covers the\n // common case where the operations chain is empty. This is imperfect, but\n // should cover many cases. Rationale: Even if we can't reduce the glare\n // window to zero on imperfect implementations, there's value in tapping\n // into the perfect negotiation pattern that several browsers support.\n desc = {type: desc.type, sdp: desc.sdp};\n if (!desc.type) {\n switch (this.signalingState) {\n case 'stable':\n case 'have-local-offer':\n case 'have-remote-pranswer':\n desc.type = 'offer';\n break;\n default:\n desc.type = 'answer';\n break;\n }\n }\n if (desc.sdp || (desc.type !== 'offer' && desc.type !== 'answer')) {\n return nativeSetLocalDescription.apply(this, [desc]);\n }\n const func = desc.type === 'offer' ? this.createOffer : this.createAnswer;\n return func.apply(this)\n .then(d => nativeSetLocalDescription.apply(this, [d]));\n };\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\nimport * as utils from './utils';\n\n// Browser shims.\nimport * as chromeShim from './chrome/chrome_shim';\nimport * as firefoxShim from './firefox/firefox_shim';\nimport * as safariShim from './safari/safari_shim';\nimport * as commonShim from './common_shim';\nimport * as sdp from 'sdp';\n\n// Shimming starts here.\nexport function adapterFactory({window} = {}, options = {\n shimChrome: true,\n shimFirefox: true,\n shimSafari: true,\n}) {\n // Utils.\n const logging = utils.log;\n const browserDetails = utils.detectBrowser(window);\n\n const adapter = {\n browserDetails,\n commonShim,\n extractVersion: utils.extractVersion,\n disableLog: utils.disableLog,\n disableWarnings: utils.disableWarnings,\n // Expose sdp as a convenience. For production apps include directly.\n sdp,\n };\n\n // Shim browser if found.\n switch (browserDetails.browser) {\n case 'chrome':\n if (!chromeShim || !chromeShim.shimPeerConnection ||\n !options.shimChrome) {\n logging('Chrome shim is not included in this adapter release.');\n return adapter;\n }\n if (browserDetails.version === null) {\n logging('Chrome shim can not determine version, not shimming.');\n return adapter;\n }\n logging('adapter.js shimming chrome.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = chromeShim;\n\n // Must be called before shimPeerConnection.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n chromeShim.shimGetUserMedia(window, browserDetails);\n chromeShim.shimMediaStream(window, browserDetails);\n chromeShim.shimPeerConnection(window, browserDetails);\n chromeShim.shimOnTrack(window, browserDetails);\n chromeShim.shimAddTrackRemoveTrack(window, browserDetails);\n chromeShim.shimGetSendersWithDtmf(window, browserDetails);\n chromeShim.shimGetStats(window, browserDetails);\n chromeShim.shimSenderReceiverGetStats(window, browserDetails);\n chromeShim.fixNegotiationNeeded(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimRTCIceCandidateRelayProtocol(window, browserDetails);\n commonShim.shimConnectionState(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n commonShim.removeExtmapAllowMixed(window, browserDetails);\n break;\n case 'firefox':\n if (!firefoxShim || !firefoxShim.shimPeerConnection ||\n !options.shimFirefox) {\n logging('Firefox shim is not included in this adapter release.');\n return adapter;\n }\n logging('adapter.js shimming firefox.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = firefoxShim;\n\n // Must be called before shimPeerConnection.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n firefoxShim.shimGetUserMedia(window, browserDetails);\n firefoxShim.shimPeerConnection(window, browserDetails);\n firefoxShim.shimOnTrack(window, browserDetails);\n firefoxShim.shimRemoveStream(window, browserDetails);\n firefoxShim.shimSenderGetStats(window, browserDetails);\n firefoxShim.shimReceiverGetStats(window, browserDetails);\n firefoxShim.shimRTCDataChannel(window, browserDetails);\n firefoxShim.shimAddTransceiver(window, browserDetails);\n firefoxShim.shimGetParameters(window, browserDetails);\n firefoxShim.shimCreateOffer(window, browserDetails);\n firefoxShim.shimCreateAnswer(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimConnectionState(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n break;\n case 'safari':\n if (!safariShim || !options.shimSafari) {\n logging('Safari shim is not included in this adapter release.');\n return adapter;\n }\n logging('adapter.js shimming safari.');\n // Export to the adapter global object visible in the browser.\n adapter.browserShim = safariShim;\n\n // Must be called before shimCallbackAPI.\n commonShim.shimAddIceCandidateNullOrEmpty(window, browserDetails);\n commonShim.shimParameterlessSetLocalDescription(window, browserDetails);\n\n safariShim.shimRTCIceServerUrls(window, browserDetails);\n safariShim.shimCreateOfferLegacy(window, browserDetails);\n safariShim.shimCallbacksAPI(window, browserDetails);\n safariShim.shimLocalStreamsAPI(window, browserDetails);\n safariShim.shimRemoteStreamsAPI(window, browserDetails);\n safariShim.shimTrackEventTransceiver(window, browserDetails);\n safariShim.shimGetUserMedia(window, browserDetails);\n safariShim.shimAudioContext(window, browserDetails);\n\n commonShim.shimRTCIceCandidate(window, browserDetails);\n commonShim.shimRTCIceCandidateRelayProtocol(window, browserDetails);\n commonShim.shimMaxMessageSize(window, browserDetails);\n commonShim.shimSendThrowTypeError(window, browserDetails);\n commonShim.removeExtmapAllowMixed(window, browserDetails);\n break;\n default:\n logging('Unsupported browser!');\n break;\n }\n\n return adapter;\n}\n","/*\n * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree.\n */\n/* eslint-env node */\n\n'use strict';\n\nimport {adapterFactory} from './adapter_factory.js';\n\nconst adapter =\n adapterFactory({window: typeof window === 'undefined' ? undefined : window});\nexport default adapter;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\n/**\n * GStreamer WebRTC configuration.\n *

    The config can be passed on creation of the GstWebRTCAPI class.

    \n *

    For example:\n *

    \n *     const signalingProtocol = window.location.protocol.startsWith(\"https\") ? \"wss\" : \"ws\";\n *     const api = new GstWebRTCAPI({\n *         meta: { name: `WebClient-${Date.now()}` },\n *         signalingServerUrl: `${signalingProtocol}://${window.location.host}/webrtc`\n *     });\n * 

    \n * @typedef {object} GstWebRTCConfig\n * @property {object} meta=null - Client free-form information that will be exchanged with all peers through the\n * signaling meta property, its content depends on your application.\n * @property {string} signalingServerUrl=ws://127.0.0.1:8443 - The WebRTC signaling server URL.\n * @property {number} reconnectionTimeout=2500 - Timeout in milliseconds to reconnect to the signaling server in\n * case of an unexpected disconnection.\n * @property {object} webrtcConfig={iceServers...} - The WebRTC peer connection configuration passed to\n * {@link external:RTCPeerConnection}. Default configuration only includes a list of free STUN servers\n * (stun[0-4].l.google.com:19302).\n */\nconst defaultConfig = Object.freeze({\n meta: null,\n signalingServerUrl: \"ws://127.0.0.1:8443\",\n reconnectionTimeout: 2500,\n webrtcConfig: {\n iceServers: [\n {\n urls: [\n \"stun:stun.l.google.com:19302\",\n \"stun:stun1.l.google.com:19302\"\n ]\n }\n ]\n }\n});\n\nexport { defaultConfig as default };\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\n/**\n * Session states enumeration.
    \n * Session state always increases from idle to closed and never switches backwards.\n * @typedef {enum} GstWebRTCAPI.SessionState\n * @readonly\n * @property {0} idle - Default state when creating a new session, goes to connecting when starting\n * the session.\n * @property {1} connecting - Session is trying to connect to remote peers, goes to streaming in case of\n * success or closed in case of error.\n * @property {2} streaming - Session is correctly connected to remote peers and currently streaming audio/video, goes\n * to closed when any peer closes the session.\n * @property {3} closed - Session is closed and can be garbage collected, state will not change anymore.\n */\nconst SessionState = Object.freeze({\n idle: 0,\n connecting: 1,\n streaming: 2,\n closed: 3\n});\n\nexport { SessionState as default };\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport SessionState from \"./session-state.js\";\n\n/**\n * Event name: \"error\".
    \n * Triggered when any kind of error occurs.\n *

    When emitted by a session, it is in general an unrecoverable error. Normally, the session is automatically closed\n * but in the specific case of a {@link GstWebRTCAPI.ProducerSession}, when the error occurs on an underlying\n * {@link GstWebRTCAPI.ClientSession} between the producer session and a remote client consuming the streamed media,\n * then only the failing {@link GstWebRTCAPI.ClientSession} is closed. The producer session can keep on serving the\n * other consumer peers.

    \n * @event GstWebRTCAPI#ErrorEvent\n * @type {external:ErrorEvent}\n * @property {string} message - The error message.\n * @property {external:Error} error - The error exception.\n * @see GstWebRTCAPI.WebRTCSession\n * @see GstWebRTCAPI.RemoteController\n */\n/**\n * Event name: \"stateChanged\".
    \n * Triggered each time a session state changes.\n * @event GstWebRTCAPI#StateChangedEvent\n * @type {external:Event}\n * @see GstWebRTCAPI.WebRTCSession#state\n */\n/**\n * Event name: \"rtcPeerConnectionChanged\".
    \n * Triggered each time a session internal {@link external:RTCPeerConnection} changes. This can occur during the session\n * connecting state when the peer-to-peer WebRTC connection is established, and when closing the\n * {@link GstWebRTCAPI.WebRTCSession}.\n * @event GstWebRTCAPI#RTCPeerConnectionChangedEvent\n * @type {external:Event}\n * @see GstWebRTCAPI.WebRTCSession#rtcPeerConnection\n */\n/**\n * Event name: \"closed\".
    \n * Triggered when a session is definitively closed (then it can be garbage collected as session instances are not\n * reusable).\n * @event GstWebRTCAPI#ClosedEvent\n * @type {external:Event}\n */\n\n/**\n * @class GstWebRTCAPI.WebRTCSession\n * @hideconstructor\n * @classdesc Manages a WebRTC session between a producer and a consumer (peer-to-peer channel).\n * @extends {external:EventTarget}\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @fires {@link GstWebRTCAPI#event:StateChangedEvent}\n * @fires {@link GstWebRTCAPI#event:RTCPeerConnectionChangedEvent}\n * @fires {@link GstWebRTCAPI#event:ClosedEvent}\n * @see GstWebRTCAPI.ConsumerSession\n * @see GstWebRTCAPI.ProducerSession\n * @see GstWebRTCAPI.ClientSession\n */\nexport default class WebRTCSession extends EventTarget {\n constructor(peerId, comChannel) {\n super();\n\n this._peerId = peerId;\n this._sessionId = \"\";\n this._comChannel = comChannel;\n this._state = SessionState.idle;\n this._rtcPeerConnection = null;\n }\n\n /**\n * Unique identifier of the remote peer to which this session is connected.\n * @member {string} GstWebRTCAPI.WebRTCSession#peerId\n * @readonly\n */\n get peerId() {\n return this._peerId;\n }\n\n /**\n * Unique identifier of this session (defined by the signaling server).
    \n * The local session ID equals \"\" until it is created on server side. This is done during the connection handshake.\n * The local session ID is guaranteed to be valid and to correctly reflect the signaling server value once\n * session state has switched to {@link GstWebRTCAPI.SessionState#streaming}.\n * @member {string} GstWebRTCAPI.WebRTCSession#sessionId\n * @readonly\n */\n get sessionId() {\n return this._sessionId;\n }\n\n /**\n * The current WebRTC session state.\n * @member {GstWebRTCAPI.SessionState} GstWebRTCAPI.WebRTCSession#state\n * @readonly\n */\n get state() {\n return this._state;\n }\n\n /**\n * The internal {@link external:RTCPeerConnection} used to manage the underlying WebRTC connection with session\n * peer. Value may be null if session has no active WebRTC connection. You can listen to the\n * {@link GstWebRTCAPI#event:RTCPeerConnectionChangedEvent} event to be informed when the connection is established\n * or destroyed.\n * @member {external:RTCPeerConnection} GstWebRTCAPI.WebRTCSession#rtcPeerConnection\n * @readonly\n */\n get rtcPeerConnection() {\n return this._rtcPeerConnection;\n }\n\n /**\n * Terminates the WebRTC session.
    \n * It immediately disconnects the remote peer attached to this session and unregisters the session from the\n * signaling server.\n * @method GstWebRTCAPI.WebRTCSession#close\n */\n close() {\n if (this._state !== SessionState.closed) {\n if ((this._state !== SessionState.idle) && this._comChannel && this._sessionId) {\n this._comChannel.send({\n type: \"endSession\",\n sessionId: this._sessionId\n });\n }\n\n this._state = SessionState.closed;\n this.dispatchEvent(new Event(\"stateChanged\"));\n\n this._comChannel = null;\n\n if (this._rtcPeerConnection) {\n this._rtcPeerConnection.close();\n this._rtcPeerConnection = null;\n this.dispatchEvent(new Event(\"rtcPeerConnectionChanged\"));\n }\n\n this.dispatchEvent(new Event(\"closed\"));\n }\n }\n}\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\n// mapping is based on https://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt\nconst uniToKeySyms = Object.freeze({\n 0x0020: \"space\",\n 0x0021: \"exclam\",\n 0x0022: \"quotedbl\",\n 0x0023: \"numbersign\",\n 0x0024: \"dollar\",\n 0x0025: \"percent\",\n 0x0026: \"ampersand\",\n 0x0027: \"apostrophe\",\n 0x0028: \"parenleft\",\n 0x0029: \"parenright\",\n 0x002a: \"asterisk\",\n 0x002b: \"plus\",\n 0x002c: \"comma\",\n 0x002d: \"minus\",\n 0x002e: \"period\",\n 0x002f: \"slash\",\n 0x0030: \"0\",\n 0x0031: \"1\",\n 0x0032: \"2\",\n 0x0033: \"3\",\n 0x0034: \"4\",\n 0x0035: \"5\",\n 0x0036: \"6\",\n 0x0037: \"7\",\n 0x0038: \"8\",\n 0x0039: \"9\",\n 0x003a: \"colon\",\n 0x003b: \"semicolon\",\n 0x003c: \"less\",\n 0x003d: \"equal\",\n 0x003e: \"greater\",\n 0x003f: \"question\",\n 0x0040: \"at\",\n 0x0041: \"A\",\n 0x0042: \"B\",\n 0x0043: \"C\",\n 0x0044: \"D\",\n 0x0045: \"E\",\n 0x0046: \"F\",\n 0x0047: \"G\",\n 0x0048: \"H\",\n 0x0049: \"I\",\n 0x004a: \"J\",\n 0x004b: \"K\",\n 0x004c: \"L\",\n 0x004d: \"M\",\n 0x004e: \"N\",\n 0x004f: \"O\",\n 0x0050: \"P\",\n 0x0051: \"Q\",\n 0x0052: \"R\",\n 0x0053: \"S\",\n 0x0054: \"T\",\n 0x0055: \"U\",\n 0x0056: \"V\",\n 0x0057: \"W\",\n 0x0058: \"X\",\n 0x0059: \"Y\",\n 0x005a: \"Z\",\n 0x005b: \"bracketleft\",\n 0x005c: \"backslash\",\n 0x005d: \"bracketright\",\n 0x005e: \"asciicircum\",\n 0x005f: \"underscore\",\n 0x0060: \"grave\",\n 0x0061: \"a\",\n 0x0062: \"b\",\n 0x0063: \"c\",\n 0x0064: \"d\",\n 0x0065: \"e\",\n 0x0066: \"f\",\n 0x0067: \"g\",\n 0x0068: \"h\",\n 0x0069: \"i\",\n 0x006a: \"j\",\n 0x006b: \"k\",\n 0x006c: \"l\",\n 0x006d: \"m\",\n 0x006e: \"n\",\n 0x006f: \"o\",\n 0x0070: \"p\",\n 0x0071: \"q\",\n 0x0072: \"r\",\n 0x0073: \"s\",\n 0x0074: \"t\",\n 0x0075: \"u\",\n 0x0076: \"v\",\n 0x0077: \"w\",\n 0x0078: \"x\",\n 0x0079: \"y\",\n 0x007a: \"z\",\n 0x007b: \"braceleft\",\n 0x007c: \"bar\",\n 0x007d: \"braceright\",\n 0x007e: \"asciitilde\",\n 0x00a0: \"nobreakspace\",\n 0x00a1: \"exclamdown\",\n 0x00a2: \"cent\",\n 0x00a3: \"sterling\",\n 0x00a4: \"currency\",\n 0x00a5: \"yen\",\n 0x00a6: \"brokenbar\",\n 0x00a7: \"section\",\n 0x00a8: \"diaeresis\",\n 0x00a9: \"copyright\",\n 0x00aa: \"ordfeminine\",\n 0x00ab: \"guillemotleft\",\n 0x00ac: \"notsign\",\n 0x00ad: \"hyphen\",\n 0x00ae: \"registered\",\n 0x00af: \"macron\",\n 0x00b0: \"degree\",\n 0x00b1: \"plusminus\",\n 0x00b2: \"twosuperior\",\n 0x00b3: \"threesuperior\",\n 0x00b4: \"acute\",\n 0x00b5: \"mu\",\n 0x00b6: \"paragraph\",\n 0x00b7: \"periodcentered\",\n 0x00b8: \"cedilla\",\n 0x00b9: \"onesuperior\",\n 0x00ba: \"masculine\",\n 0x00bb: \"guillemotright\",\n 0x00bc: \"onequarter\",\n 0x00bd: \"onehalf\",\n 0x00be: \"threequarters\",\n 0x00bf: \"questiondown\",\n 0x00c0: \"Agrave\",\n 0x00c1: \"Aacute\",\n 0x00c2: \"Acircumflex\",\n 0x00c3: \"Atilde\",\n 0x00c4: \"Adiaeresis\",\n 0x00c5: \"Aring\",\n 0x00c6: \"AE\",\n 0x00c7: \"Ccedilla\",\n 0x00c8: \"Egrave\",\n 0x00c9: \"Eacute\",\n 0x00ca: \"Ecircumflex\",\n 0x00cb: \"Ediaeresis\",\n 0x00cc: \"Igrave\",\n 0x00cd: \"Iacute\",\n 0x00ce: \"Icircumflex\",\n 0x00cf: \"Idiaeresis\",\n 0x00d0: \"ETH\",\n 0x00d1: \"Ntilde\",\n 0x00d2: \"Ograve\",\n 0x00d3: \"Oacute\",\n 0x00d4: \"Ocircumflex\",\n 0x00d5: \"Otilde\",\n 0x00d6: \"Odiaeresis\",\n 0x00d7: \"multiply\",\n 0x00d8: \"Ooblique\",\n 0x00d9: \"Ugrave\",\n 0x00da: \"Uacute\",\n 0x00db: \"Ucircumflex\",\n 0x00dc: \"Udiaeresis\",\n 0x00dd: \"Yacute\",\n 0x00de: \"THORN\",\n 0x00df: \"ssharp\",\n 0x00e0: \"agrave\",\n 0x00e1: \"aacute\",\n 0x00e2: \"acircumflex\",\n 0x00e3: \"atilde\",\n 0x00e4: \"adiaeresis\",\n 0x00e5: \"aring\",\n 0x00e6: \"ae\",\n 0x00e7: \"ccedilla\",\n 0x00e8: \"egrave\",\n 0x00e9: \"eacute\",\n 0x00ea: \"ecircumflex\",\n 0x00eb: \"ediaeresis\",\n 0x00ec: \"igrave\",\n 0x00ed: \"iacute\",\n 0x00ee: \"icircumflex\",\n 0x00ef: \"idiaeresis\",\n 0x00f0: \"eth\",\n 0x00f1: \"ntilde\",\n 0x00f2: \"ograve\",\n 0x00f3: \"oacute\",\n 0x00f4: \"ocircumflex\",\n 0x00f5: \"otilde\",\n 0x00f6: \"odiaeresis\",\n 0x00f7: \"division\",\n 0x00f8: \"oslash\",\n 0x00f9: \"ugrave\",\n 0x00fa: \"uacute\",\n 0x00fb: \"ucircumflex\",\n 0x00fc: \"udiaeresis\",\n 0x00fd: \"yacute\",\n 0x00fe: \"thorn\",\n 0x00ff: \"ydiaeresis\",\n 0x0104: \"Aogonek\",\n 0x02d8: \"breve\",\n 0x0141: \"Lstroke\",\n 0x013d: \"Lcaron\",\n 0x015a: \"Sacute\",\n 0x0160: \"Scaron\",\n 0x015e: \"Scedilla\",\n 0x0164: \"Tcaron\",\n 0x0179: \"Zacute\",\n 0x017d: \"Zcaron\",\n 0x017b: \"Zabovedot\",\n 0x0105: \"aogonek\",\n 0x02db: \"ogonek\",\n 0x0142: \"lstroke\",\n 0x013e: \"lcaron\",\n 0x015b: \"sacute\",\n 0x02c7: \"caron\",\n 0x0161: \"scaron\",\n 0x015f: \"scedilla\",\n 0x0165: \"tcaron\",\n 0x017a: \"zacute\",\n 0x02dd: \"doubleacute\",\n 0x017e: \"zcaron\",\n 0x017c: \"zabovedot\",\n 0x0154: \"Racute\",\n 0x0102: \"Abreve\",\n 0x0139: \"Lacute\",\n 0x0106: \"Cacute\",\n 0x010c: \"Ccaron\",\n 0x0118: \"Eogonek\",\n 0x011a: \"Ecaron\",\n 0x010e: \"Dcaron\",\n 0x0110: \"Dstroke\",\n 0x0143: \"Nacute\",\n 0x0147: \"Ncaron\",\n 0x0150: \"Odoubleacute\",\n 0x0158: \"Rcaron\",\n 0x016e: \"Uring\",\n 0x0170: \"Udoubleacute\",\n 0x0162: \"Tcedilla\",\n 0x0155: \"racute\",\n 0x0103: \"abreve\",\n 0x013a: \"lacute\",\n 0x0107: \"cacute\",\n 0x010d: \"ccaron\",\n 0x0119: \"eogonek\",\n 0x011b: \"ecaron\",\n 0x010f: \"dcaron\",\n 0x0111: \"dstroke\",\n 0x0144: \"nacute\",\n 0x0148: \"ncaron\",\n 0x0151: \"odoubleacute\",\n 0x0159: \"rcaron\",\n 0x016f: \"uring\",\n 0x0171: \"udoubleacute\",\n 0x0163: \"tcedilla\",\n 0x02d9: \"abovedot\",\n 0x0126: \"Hstroke\",\n 0x0124: \"Hcircumflex\",\n 0x0130: \"Iabovedot\",\n 0x011e: \"Gbreve\",\n 0x0134: \"Jcircumflex\",\n 0x0127: \"hstroke\",\n 0x0125: \"hcircumflex\",\n 0x0131: \"idotless\",\n 0x011f: \"gbreve\",\n 0x0135: \"jcircumflex\",\n 0x010a: \"Cabovedot\",\n 0x0108: \"Ccircumflex\",\n 0x0120: \"Gabovedot\",\n 0x011c: \"Gcircumflex\",\n 0x016c: \"Ubreve\",\n 0x015c: \"Scircumflex\",\n 0x010b: \"cabovedot\",\n 0x0109: \"ccircumflex\",\n 0x0121: \"gabovedot\",\n 0x011d: \"gcircumflex\",\n 0x016d: \"ubreve\",\n 0x015d: \"scircumflex\",\n 0x0138: \"kra\",\n 0x0156: \"Rcedilla\",\n 0x0128: \"Itilde\",\n 0x013b: \"Lcedilla\",\n 0x0112: \"Emacron\",\n 0x0122: \"Gcedilla\",\n 0x0166: \"Tslash\",\n 0x0157: \"rcedilla\",\n 0x0129: \"itilde\",\n 0x013c: \"lcedilla\",\n 0x0113: \"emacron\",\n 0x0123: \"gcedilla\",\n 0x0167: \"tslash\",\n 0x014a: \"ENG\",\n 0x014b: \"eng\",\n 0x0100: \"Amacron\",\n 0x012e: \"Iogonek\",\n 0x0116: \"Eabovedot\",\n 0x012a: \"Imacron\",\n 0x0145: \"Ncedilla\",\n 0x014c: \"Omacron\",\n 0x0136: \"Kcedilla\",\n 0x0172: \"Uogonek\",\n 0x0168: \"Utilde\",\n 0x016a: \"Umacron\",\n 0x0101: \"amacron\",\n 0x012f: \"iogonek\",\n 0x0117: \"eabovedot\",\n 0x012b: \"imacron\",\n 0x0146: \"ncedilla\",\n 0x014d: \"omacron\",\n 0x0137: \"kcedilla\",\n 0x0173: \"uogonek\",\n 0x0169: \"utilde\",\n 0x016b: \"umacron\",\n 0x203e: \"overline\",\n 0x3002: \"kana_fullstop\",\n 0x300c: \"kana_openingbracket\",\n 0x300d: \"kana_closingbracket\",\n 0x3001: \"kana_comma\",\n 0x30fb: \"kana_conjunctive\",\n 0x30f2: \"kana_WO\",\n 0x30a1: \"kana_a\",\n 0x30a3: \"kana_i\",\n 0x30a5: \"kana_u\",\n 0x30a7: \"kana_e\",\n 0x30a9: \"kana_o\",\n 0x30e3: \"kana_ya\",\n 0x30e5: \"kana_yu\",\n 0x30e7: \"kana_yo\",\n 0x30c3: \"kana_tsu\",\n 0x30fc: \"prolongedsound\",\n 0x30a2: \"kana_A\",\n 0x30a4: \"kana_I\",\n 0x30a6: \"kana_U\",\n 0x30a8: \"kana_E\",\n 0x30aa: \"kana_O\",\n 0x30ab: \"kana_KA\",\n 0x30ad: \"kana_KI\",\n 0x30af: \"kana_KU\",\n 0x30b1: \"kana_KE\",\n 0x30b3: \"kana_KO\",\n 0x30b5: \"kana_SA\",\n 0x30b7: \"kana_SHI\",\n 0x30b9: \"kana_SU\",\n 0x30bb: \"kana_SE\",\n 0x30bd: \"kana_SO\",\n 0x30bf: \"kana_TA\",\n 0x30c1: \"kana_CHI\",\n 0x30c4: \"kana_TSU\",\n 0x30c6: \"kana_TE\",\n 0x30c8: \"kana_TO\",\n 0x30ca: \"kana_NA\",\n 0x30cb: \"kana_NI\",\n 0x30cc: \"kana_NU\",\n 0x30cd: \"kana_NE\",\n 0x30ce: \"kana_NO\",\n 0x30cf: \"kana_HA\",\n 0x30d2: \"kana_HI\",\n 0x30d5: \"kana_FU\",\n 0x30d8: \"kana_HE\",\n 0x30db: \"kana_HO\",\n 0x30de: \"kana_MA\",\n 0x30df: \"kana_MI\",\n 0x30e0: \"kana_MU\",\n 0x30e1: \"kana_ME\",\n 0x30e2: \"kana_MO\",\n 0x30e4: \"kana_YA\",\n 0x30e6: \"kana_YU\",\n 0x30e8: \"kana_YO\",\n 0x30e9: \"kana_RA\",\n 0x30ea: \"kana_RI\",\n 0x30eb: \"kana_RU\",\n 0x30ec: \"kana_RE\",\n 0x30ed: \"kana_RO\",\n 0x30ef: \"kana_WA\",\n 0x30f3: \"kana_N\",\n 0x309b: \"voicedsound\",\n 0x309c: \"semivoicedsound\",\n 0x060c: \"Arabic_comma\",\n 0x061b: \"Arabic_semicolon\",\n 0x061f: \"Arabic_question_mark\",\n 0x0621: \"Arabic_hamza\",\n 0x0622: \"Arabic_maddaonalef\",\n 0x0623: \"Arabic_hamzaonalef\",\n 0x0624: \"Arabic_hamzaonwaw\",\n 0x0625: \"Arabic_hamzaunderalef\",\n 0x0626: \"Arabic_hamzaonyeh\",\n 0x0627: \"Arabic_alef\",\n 0x0628: \"Arabic_beh\",\n 0x0629: \"Arabic_tehmarbuta\",\n 0x062a: \"Arabic_teh\",\n 0x062b: \"Arabic_theh\",\n 0x062c: \"Arabic_jeem\",\n 0x062d: \"Arabic_hah\",\n 0x062e: \"Arabic_khah\",\n 0x062f: \"Arabic_dal\",\n 0x0630: \"Arabic_thal\",\n 0x0631: \"Arabic_ra\",\n 0x0632: \"Arabic_zain\",\n 0x0633: \"Arabic_seen\",\n 0x0634: \"Arabic_sheen\",\n 0x0635: \"Arabic_sad\",\n 0x0636: \"Arabic_dad\",\n 0x0637: \"Arabic_tah\",\n 0x0638: \"Arabic_zah\",\n 0x0639: \"Arabic_ain\",\n 0x063a: \"Arabic_ghain\",\n 0x0640: \"Arabic_tatweel\",\n 0x0641: \"Arabic_feh\",\n 0x0642: \"Arabic_qaf\",\n 0x0643: \"Arabic_kaf\",\n 0x0644: \"Arabic_lam\",\n 0x0645: \"Arabic_meem\",\n 0x0646: \"Arabic_noon\",\n 0x0647: \"Arabic_ha\",\n 0x0648: \"Arabic_waw\",\n 0x0649: \"Arabic_alefmaksura\",\n 0x064a: \"Arabic_yeh\",\n 0x064b: \"Arabic_fathatan\",\n 0x064c: \"Arabic_dammatan\",\n 0x064d: \"Arabic_kasratan\",\n 0x064e: \"Arabic_fatha\",\n 0x064f: \"Arabic_damma\",\n 0x0650: \"Arabic_kasra\",\n 0x0651: \"Arabic_shadda\",\n 0x0652: \"Arabic_sukun\",\n 0x0452: \"Serbian_dje\",\n 0x0453: \"Macedonia_gje\",\n 0x0451: \"Cyrillic_io\",\n 0x0454: \"Ukrainian_ie\",\n 0x0455: \"Macedonia_dse\",\n 0x0456: \"Ukrainian_i\",\n 0x0457: \"Ukrainian_yi\",\n 0x0458: \"Cyrillic_je\",\n 0x0459: \"Cyrillic_lje\",\n 0x045a: \"Cyrillic_nje\",\n 0x045b: \"Serbian_tshe\",\n 0x045c: \"Macedonia_kje\",\n 0x045e: \"Byelorussian_shortu\",\n 0x045f: \"Cyrillic_dzhe\",\n 0x2116: \"numerosign\",\n 0x0402: \"Serbian_DJE\",\n 0x0403: \"Macedonia_GJE\",\n 0x0401: \"Cyrillic_IO\",\n 0x0404: \"Ukrainian_IE\",\n 0x0405: \"Macedonia_DSE\",\n 0x0406: \"Ukrainian_I\",\n 0x0407: \"Ukrainian_YI\",\n 0x0408: \"Cyrillic_JE\",\n 0x0409: \"Cyrillic_LJE\",\n 0x040a: \"Cyrillic_NJE\",\n 0x040b: \"Serbian_TSHE\",\n 0x040c: \"Macedonia_KJE\",\n 0x040e: \"Byelorussian_SHORTU\",\n 0x040f: \"Cyrillic_DZHE\",\n 0x044e: \"Cyrillic_yu\",\n 0x0430: \"Cyrillic_a\",\n 0x0431: \"Cyrillic_be\",\n 0x0446: \"Cyrillic_tse\",\n 0x0434: \"Cyrillic_de\",\n 0x0435: \"Cyrillic_ie\",\n 0x0444: \"Cyrillic_ef\",\n 0x0433: \"Cyrillic_ghe\",\n 0x0445: \"Cyrillic_ha\",\n 0x0438: \"Cyrillic_i\",\n 0x0439: \"Cyrillic_shorti\",\n 0x043a: \"Cyrillic_ka\",\n 0x043b: \"Cyrillic_el\",\n 0x043c: \"Cyrillic_em\",\n 0x043d: \"Cyrillic_en\",\n 0x043e: \"Cyrillic_o\",\n 0x043f: \"Cyrillic_pe\",\n 0x044f: \"Cyrillic_ya\",\n 0x0440: \"Cyrillic_er\",\n 0x0441: \"Cyrillic_es\",\n 0x0442: \"Cyrillic_te\",\n 0x0443: \"Cyrillic_u\",\n 0x0436: \"Cyrillic_zhe\",\n 0x0432: \"Cyrillic_ve\",\n 0x044c: \"Cyrillic_softsign\",\n 0x044b: \"Cyrillic_yeru\",\n 0x0437: \"Cyrillic_ze\",\n 0x0448: \"Cyrillic_sha\",\n 0x044d: \"Cyrillic_e\",\n 0x0449: \"Cyrillic_shcha\",\n 0x0447: \"Cyrillic_che\",\n 0x044a: \"Cyrillic_hardsign\",\n 0x042e: \"Cyrillic_YU\",\n 0x0410: \"Cyrillic_A\",\n 0x0411: \"Cyrillic_BE\",\n 0x0426: \"Cyrillic_TSE\",\n 0x0414: \"Cyrillic_DE\",\n 0x0415: \"Cyrillic_IE\",\n 0x0424: \"Cyrillic_EF\",\n 0x0413: \"Cyrillic_GHE\",\n 0x0425: \"Cyrillic_HA\",\n 0x0418: \"Cyrillic_I\",\n 0x0419: \"Cyrillic_SHORTI\",\n 0x041a: \"Cyrillic_KA\",\n 0x041b: \"Cyrillic_EL\",\n 0x041c: \"Cyrillic_EM\",\n 0x041d: \"Cyrillic_EN\",\n 0x041e: \"Cyrillic_O\",\n 0x041f: \"Cyrillic_PE\",\n 0x042f: \"Cyrillic_YA\",\n 0x0420: \"Cyrillic_ER\",\n 0x0421: \"Cyrillic_ES\",\n 0x0422: \"Cyrillic_TE\",\n 0x0423: \"Cyrillic_U\",\n 0x0416: \"Cyrillic_ZHE\",\n 0x0412: \"Cyrillic_VE\",\n 0x042c: \"Cyrillic_SOFTSIGN\",\n 0x042b: \"Cyrillic_YERU\",\n 0x0417: \"Cyrillic_ZE\",\n 0x0428: \"Cyrillic_SHA\",\n 0x042d: \"Cyrillic_E\",\n 0x0429: \"Cyrillic_SHCHA\",\n 0x0427: \"Cyrillic_CHE\",\n 0x042a: \"Cyrillic_HARDSIGN\",\n 0x0386: \"Greek_ALPHAaccent\",\n 0x0388: \"Greek_EPSILONaccent\",\n 0x0389: \"Greek_ETAaccent\",\n 0x038a: \"Greek_IOTAaccent\",\n 0x03aa: \"Greek_IOTAdiaeresis\",\n 0x038c: \"Greek_OMICRONaccent\",\n 0x038e: \"Greek_UPSILONaccent\",\n 0x03ab: \"Greek_UPSILONdieresis\",\n 0x038f: \"Greek_OMEGAaccent\",\n 0x0385: \"Greek_accentdieresis\",\n 0x2015: \"Greek_horizbar\",\n 0x03ac: \"Greek_alphaaccent\",\n 0x03ad: \"Greek_epsilonaccent\",\n 0x03ae: \"Greek_etaaccent\",\n 0x03af: \"Greek_iotaaccent\",\n 0x03ca: \"Greek_iotadieresis\",\n 0x0390: \"Greek_iotaaccentdieresis\",\n 0x03cc: \"Greek_omicronaccent\",\n 0x03cd: \"Greek_upsilonaccent\",\n 0x03cb: \"Greek_upsilondieresis\",\n 0x03b0: \"Greek_upsilonaccentdieresis\",\n 0x03ce: \"Greek_omegaaccent\",\n 0x0391: \"Greek_ALPHA\",\n 0x0392: \"Greek_BETA\",\n 0x0393: \"Greek_GAMMA\",\n 0x0394: \"Greek_DELTA\",\n 0x0395: \"Greek_EPSILON\",\n 0x0396: \"Greek_ZETA\",\n 0x0397: \"Greek_ETA\",\n 0x0398: \"Greek_THETA\",\n 0x0399: \"Greek_IOTA\",\n 0x039a: \"Greek_KAPPA\",\n 0x039b: \"Greek_LAMBDA\",\n 0x039c: \"Greek_MU\",\n 0x039d: \"Greek_NU\",\n 0x039e: \"Greek_XI\",\n 0x039f: \"Greek_OMICRON\",\n 0x03a0: \"Greek_PI\",\n 0x03a1: \"Greek_RHO\",\n 0x03a3: \"Greek_SIGMA\",\n 0x03a4: \"Greek_TAU\",\n 0x03a5: \"Greek_UPSILON\",\n 0x03a6: \"Greek_PHI\",\n 0x03a7: \"Greek_CHI\",\n 0x03a8: \"Greek_PSI\",\n 0x03a9: \"Greek_OMEGA\",\n 0x03b1: \"Greek_alpha\",\n 0x03b2: \"Greek_beta\",\n 0x03b3: \"Greek_gamma\",\n 0x03b4: \"Greek_delta\",\n 0x03b5: \"Greek_epsilon\",\n 0x03b6: \"Greek_zeta\",\n 0x03b7: \"Greek_eta\",\n 0x03b8: \"Greek_theta\",\n 0x03b9: \"Greek_iota\",\n 0x03ba: \"Greek_kappa\",\n 0x03bb: \"Greek_lambda\",\n 0x03bc: \"Greek_mu\",\n 0x03bd: \"Greek_nu\",\n 0x03be: \"Greek_xi\",\n 0x03bf: \"Greek_omicron\",\n 0x03c0: \"Greek_pi\",\n 0x03c1: \"Greek_rho\",\n 0x03c3: \"Greek_sigma\",\n 0x03c2: \"Greek_finalsmallsigma\",\n 0x03c4: \"Greek_tau\",\n 0x03c5: \"Greek_upsilon\",\n 0x03c6: \"Greek_phi\",\n 0x03c7: \"Greek_chi\",\n 0x03c8: \"Greek_psi\",\n 0x03c9: \"Greek_omega\",\n 0x23b7: \"leftradical\",\n 0x2320: \"topintegral\",\n 0x2321: \"botintegral\",\n 0x23a1: \"topleftsqbracket\",\n 0x23a3: \"botleftsqbracket\",\n 0x23a4: \"toprightsqbracket\",\n 0x23a6: \"botrightsqbracket\",\n 0x239b: \"topleftparens\",\n 0x239d: \"botleftparens\",\n 0x239e: \"toprightparens\",\n 0x23a0: \"botrightparens\",\n 0x23a8: \"leftmiddlecurlybrace\",\n 0x23ac: \"rightmiddlecurlybrace\",\n 0x2264: \"lessthanequal\",\n 0x2260: \"notequal\",\n 0x2265: \"greaterthanequal\",\n 0x222b: \"integral\",\n 0x2234: \"therefore\",\n 0x221d: \"variation\",\n 0x221e: \"infinity\",\n 0x2207: \"nabla\",\n 0x223c: \"approximate\",\n 0x2243: \"similarequal\",\n 0x21d4: \"ifonlyif\",\n 0x21d2: \"implies\",\n 0x2261: \"identical\",\n 0x221a: \"radical\",\n 0x2282: \"includedin\",\n 0x2283: \"includes\",\n 0x2229: \"intersection\",\n 0x222a: \"union\",\n 0x2227: \"logicaland\",\n 0x2228: \"logicalor\",\n 0x2202: \"partialderivative\",\n 0x0192: \"function\",\n 0x2190: \"leftarrow\",\n 0x2191: \"uparrow\",\n 0x2192: \"rightarrow\",\n 0x2193: \"downarrow\",\n 0x25c6: \"soliddiamond\",\n 0x2592: \"checkerboard\",\n 0x2409: \"ht\",\n 0x240c: \"ff\",\n 0x240d: \"cr\",\n 0x240a: \"lf\",\n 0x2424: \"nl\",\n 0x240b: \"vt\",\n 0x2518: \"lowrightcorner\",\n 0x2510: \"uprightcorner\",\n 0x250c: \"upleftcorner\",\n 0x2514: \"lowleftcorner\",\n 0x253c: \"crossinglines\",\n 0x23ba: \"horizlinescan1\",\n 0x23bb: \"horizlinescan3\",\n 0x2500: \"horizlinescan5\",\n 0x23bc: \"horizlinescan7\",\n 0x23bd: \"horizlinescan9\",\n 0x251c: \"leftt\",\n 0x2524: \"rightt\",\n 0x2534: \"bott\",\n 0x252c: \"topt\",\n 0x2502: \"vertbar\",\n 0x2003: \"emspace\",\n 0x2002: \"enspace\",\n 0x2004: \"em3space\",\n 0x2005: \"em4space\",\n 0x2007: \"digitspace\",\n 0x2008: \"punctspace\",\n 0x2009: \"thinspace\",\n 0x200a: \"hairspace\",\n 0x2014: \"emdash\",\n 0x2013: \"endash\",\n 0x2423: \"signifblank\",\n 0x2026: \"ellipsis\",\n 0x2025: \"doubbaselinedot\",\n 0x2153: \"onethird\",\n 0x2154: \"twothirds\",\n 0x2155: \"onefifth\",\n 0x2156: \"twofifths\",\n 0x2157: \"threefifths\",\n 0x2158: \"fourfifths\",\n 0x2159: \"onesixth\",\n 0x215a: \"fivesixths\",\n 0x2105: \"careof\",\n 0x2012: \"figdash\",\n 0x27e8: \"leftanglebracket\",\n 0x27e9: \"rightanglebracket\",\n 0x215b: \"oneeighth\",\n 0x215c: \"threeeighths\",\n 0x215d: \"fiveeighths\",\n 0x215e: \"seveneighths\",\n 0x2122: \"trademark\",\n 0x2613: \"signaturemark\",\n 0x25c1: \"leftopentriangle\",\n 0x25b7: \"rightopentriangle\",\n 0x25af: \"emopenrectangle\",\n 0x2018: \"leftsinglequotemark\",\n 0x2019: \"rightsinglequotemark\",\n 0x201c: \"leftdoublequotemark\",\n 0x201d: \"rightdoublequotemark\",\n 0x211e: \"prescription\",\n 0x2032: \"minutes\",\n 0x2033: \"seconds\",\n 0x271d: \"latincross\",\n 0x25ac: \"filledrectbullet\",\n 0x25c0: \"filledlefttribullet\",\n 0x25b6: \"filledrighttribullet\",\n 0x25cf: \"emfilledcircle\",\n 0x25ae: \"emfilledrect\",\n 0x25e6: \"enopencircbullet\",\n 0x25ab: \"enopensquarebullet\",\n 0x25ad: \"openrectbullet\",\n 0x25b3: \"opentribulletup\",\n 0x25bd: \"opentribulletdown\",\n 0x2606: \"openstar\",\n 0x2022: \"enfilledcircbullet\",\n 0x25aa: \"enfilledsqbullet\",\n 0x25b2: \"filledtribulletup\",\n 0x25bc: \"filledtribulletdown\",\n 0x261c: \"leftpointer\",\n 0x261e: \"rightpointer\",\n 0x2663: \"club\",\n 0x2666: \"diamond\",\n 0x2665: \"heart\",\n 0x2720: \"maltesecross\",\n 0x2020: \"dagger\",\n 0x2021: \"doubledagger\",\n 0x2713: \"checkmark\",\n 0x2717: \"ballotcross\",\n 0x266f: \"musicalsharp\",\n 0x266d: \"musicalflat\",\n 0x2642: \"malesymbol\",\n 0x2640: \"femalesymbol\",\n 0x260e: \"telephone\",\n 0x2315: \"telephonerecorder\",\n 0x2117: \"phonographcopyright\",\n 0x2038: \"caret\",\n 0x201a: \"singlelowquotemark\",\n 0x201e: \"doublelowquotemark\",\n 0x22a5: \"downtack\",\n 0x230a: \"downstile\",\n 0x2218: \"jot\",\n 0x2395: \"quad\",\n 0x22a4: \"uptack\",\n 0x25cb: \"circle\",\n 0x2308: \"upstile\",\n 0x22a2: \"lefttack\",\n 0x22a3: \"righttack\",\n 0x2017: \"hebrew_doublelowline\",\n 0x05d0: \"hebrew_aleph\",\n 0x05d1: \"hebrew_beth\",\n 0x05d2: \"hebrew_gimmel\",\n 0x05d3: \"hebrew_daleth\",\n 0x05d4: \"hebrew_he\",\n 0x05d5: \"hebrew_waw\",\n 0x05d6: \"hebrew_zayin\",\n 0x05d7: \"hebrew_het\",\n 0x05d8: \"hebrew_teth\",\n 0x05d9: \"hebrew_yod\",\n 0x05da: \"hebrew_finalkaph\",\n 0x05db: \"hebrew_kaph\",\n 0x05dc: \"hebrew_lamed\",\n 0x05dd: \"hebrew_finalmem\",\n 0x05de: \"hebrew_mem\",\n 0x05df: \"hebrew_finalnun\",\n 0x05e0: \"hebrew_nun\",\n 0x05e1: \"hebrew_samekh\",\n 0x05e2: \"hebrew_ayin\",\n 0x05e3: \"hebrew_finalpe\",\n 0x05e4: \"hebrew_pe\",\n 0x05e5: \"hebrew_finalzadi\",\n 0x05e6: \"hebrew_zadi\",\n 0x05e7: \"hebrew_qoph\",\n 0x05e8: \"hebrew_resh\",\n 0x05e9: \"hebrew_shin\",\n 0x05ea: \"hebrew_taw\",\n 0x0e01: \"Thai_kokai\",\n 0x0e02: \"Thai_khokhai\",\n 0x0e03: \"Thai_khokhuat\",\n 0x0e04: \"Thai_khokhwai\",\n 0x0e05: \"Thai_khokhon\",\n 0x0e06: \"Thai_khorakhang\",\n 0x0e07: \"Thai_ngongu\",\n 0x0e08: \"Thai_chochan\",\n 0x0e09: \"Thai_choching\",\n 0x0e0a: \"Thai_chochang\",\n 0x0e0b: \"Thai_soso\",\n 0x0e0c: \"Thai_chochoe\",\n 0x0e0d: \"Thai_yoying\",\n 0x0e0e: \"Thai_dochada\",\n 0x0e0f: \"Thai_topatak\",\n 0x0e10: \"Thai_thothan\",\n 0x0e11: \"Thai_thonangmontho\",\n 0x0e12: \"Thai_thophuthao\",\n 0x0e13: \"Thai_nonen\",\n 0x0e14: \"Thai_dodek\",\n 0x0e15: \"Thai_totao\",\n 0x0e16: \"Thai_thothung\",\n 0x0e17: \"Thai_thothahan\",\n 0x0e18: \"Thai_thothong\",\n 0x0e19: \"Thai_nonu\",\n 0x0e1a: \"Thai_bobaimai\",\n 0x0e1b: \"Thai_popla\",\n 0x0e1c: \"Thai_phophung\",\n 0x0e1d: \"Thai_fofa\",\n 0x0e1e: \"Thai_phophan\",\n 0x0e1f: \"Thai_fofan\",\n 0x0e20: \"Thai_phosamphao\",\n 0x0e21: \"Thai_moma\",\n 0x0e22: \"Thai_yoyak\",\n 0x0e23: \"Thai_rorua\",\n 0x0e24: \"Thai_ru\",\n 0x0e25: \"Thai_loling\",\n 0x0e26: \"Thai_lu\",\n 0x0e27: \"Thai_wowaen\",\n 0x0e28: \"Thai_sosala\",\n 0x0e29: \"Thai_sorusi\",\n 0x0e2a: \"Thai_sosua\",\n 0x0e2b: \"Thai_hohip\",\n 0x0e2c: \"Thai_lochula\",\n 0x0e2d: \"Thai_oang\",\n 0x0e2e: \"Thai_honokhuk\",\n 0x0e2f: \"Thai_paiyannoi\",\n 0x0e30: \"Thai_saraa\",\n 0x0e31: \"Thai_maihanakat\",\n 0x0e32: \"Thai_saraaa\",\n 0x0e33: \"Thai_saraam\",\n 0x0e34: \"Thai_sarai\",\n 0x0e35: \"Thai_saraii\",\n 0x0e36: \"Thai_saraue\",\n 0x0e37: \"Thai_sarauee\",\n 0x0e38: \"Thai_sarau\",\n 0x0e39: \"Thai_sarauu\",\n 0x0e3a: \"Thai_phinthu\",\n 0x0e3f: \"Thai_baht\",\n 0x0e40: \"Thai_sarae\",\n 0x0e41: \"Thai_saraae\",\n 0x0e42: \"Thai_sarao\",\n 0x0e43: \"Thai_saraaimaimuan\",\n 0x0e44: \"Thai_saraaimaimalai\",\n 0x0e45: \"Thai_lakkhangyao\",\n 0x0e46: \"Thai_maiyamok\",\n 0x0e47: \"Thai_maitaikhu\",\n 0x0e48: \"Thai_maiek\",\n 0x0e49: \"Thai_maitho\",\n 0x0e4a: \"Thai_maitri\",\n 0x0e4b: \"Thai_maichattawa\",\n 0x0e4c: \"Thai_thanthakhat\",\n 0x0e4d: \"Thai_nikhahit\",\n 0x0e50: \"Thai_leksun\",\n 0x0e51: \"Thai_leknung\",\n 0x0e52: \"Thai_leksong\",\n 0x0e53: \"Thai_leksam\",\n 0x0e54: \"Thai_leksi\",\n 0x0e55: \"Thai_lekha\",\n 0x0e56: \"Thai_lekhok\",\n 0x0e57: \"Thai_lekchet\",\n 0x0e58: \"Thai_lekpaet\",\n 0x0e59: \"Thai_lekkao\",\n 0x3131: \"Hangul_Kiyeog\",\n 0x3132: \"Hangul_SsangKiyeog\",\n 0x3133: \"Hangul_KiyeogSios\",\n 0x3134: \"Hangul_Nieun\",\n 0x3135: \"Hangul_NieunJieuj\",\n 0x3136: \"Hangul_NieunHieuh\",\n 0x3137: \"Hangul_Dikeud\",\n 0x3138: \"Hangul_SsangDikeud\",\n 0x3139: \"Hangul_Rieul\",\n 0x313a: \"Hangul_RieulKiyeog\",\n 0x313b: \"Hangul_RieulMieum\",\n 0x313c: \"Hangul_RieulPieub\",\n 0x313d: \"Hangul_RieulSios\",\n 0x313e: \"Hangul_RieulTieut\",\n 0x313f: \"Hangul_RieulPhieuf\",\n 0x3140: \"Hangul_RieulHieuh\",\n 0x3141: \"Hangul_Mieum\",\n 0x3142: \"Hangul_Pieub\",\n 0x3143: \"Hangul_SsangPieub\",\n 0x3144: \"Hangul_PieubSios\",\n 0x3145: \"Hangul_Sios\",\n 0x3146: \"Hangul_SsangSios\",\n 0x3147: \"Hangul_Ieung\",\n 0x3148: \"Hangul_Jieuj\",\n 0x3149: \"Hangul_SsangJieuj\",\n 0x314a: \"Hangul_Cieuc\",\n 0x314b: \"Hangul_Khieuq\",\n 0x314c: \"Hangul_Tieut\",\n 0x314d: \"Hangul_Phieuf\",\n 0x314e: \"Hangul_Hieuh\",\n 0x314f: \"Hangul_A\",\n 0x3150: \"Hangul_AE\",\n 0x3151: \"Hangul_YA\",\n 0x3152: \"Hangul_YAE\",\n 0x3153: \"Hangul_EO\",\n 0x3154: \"Hangul_E\",\n 0x3155: \"Hangul_YEO\",\n 0x3156: \"Hangul_YE\",\n 0x3157: \"Hangul_O\",\n 0x3158: \"Hangul_WA\",\n 0x3159: \"Hangul_WAE\",\n 0x315a: \"Hangul_OE\",\n 0x315b: \"Hangul_YO\",\n 0x315c: \"Hangul_U\",\n 0x315d: \"Hangul_WEO\",\n 0x315e: \"Hangul_WE\",\n 0x315f: \"Hangul_WI\",\n 0x3160: \"Hangul_YU\",\n 0x3161: \"Hangul_EU\",\n 0x3162: \"Hangul_YI\",\n 0x3163: \"Hangul_I\",\n 0x11a8: \"Hangul_J_Kiyeog\",\n 0x11a9: \"Hangul_J_SsangKiyeog\",\n 0x11aa: \"Hangul_J_KiyeogSios\",\n 0x11ab: \"Hangul_J_Nieun\",\n 0x11ac: \"Hangul_J_NieunJieuj\",\n 0x11ad: \"Hangul_J_NieunHieuh\",\n 0x11ae: \"Hangul_J_Dikeud\",\n 0x11af: \"Hangul_J_Rieul\",\n 0x11b0: \"Hangul_J_RieulKiyeog\",\n 0x11b1: \"Hangul_J_RieulMieum\",\n 0x11b2: \"Hangul_J_RieulPieub\",\n 0x11b3: \"Hangul_J_RieulSios\",\n 0x11b4: \"Hangul_J_RieulTieut\",\n 0x11b5: \"Hangul_J_RieulPhieuf\",\n 0x11b6: \"Hangul_J_RieulHieuh\",\n 0x11b7: \"Hangul_J_Mieum\",\n 0x11b8: \"Hangul_J_Pieub\",\n 0x11b9: \"Hangul_J_PieubSios\",\n 0x11ba: \"Hangul_J_Sios\",\n 0x11bb: \"Hangul_J_SsangSios\",\n 0x11bc: \"Hangul_J_Ieung\",\n 0x11bd: \"Hangul_J_Jieuj\",\n 0x11be: \"Hangul_J_Cieuc\",\n 0x11bf: \"Hangul_J_Khieuq\",\n 0x11c0: \"Hangul_J_Tieut\",\n 0x11c1: \"Hangul_J_Phieuf\",\n 0x11c2: \"Hangul_J_Hieuh\",\n 0x316d: \"Hangul_RieulYeorinHieuh\",\n 0x3171: \"Hangul_SunkyeongeumMieum\",\n 0x3178: \"Hangul_SunkyeongeumPieub\",\n 0x317f: \"Hangul_PanSios\",\n 0x3181: \"Hangul_KkogjiDalrinIeung\",\n 0x3184: \"Hangul_SunkyeongeumPhieuf\",\n 0x3186: \"Hangul_YeorinHieuh\",\n 0x318d: \"Hangul_AraeA\",\n 0x318e: \"Hangul_AraeAE\",\n 0x11eb: \"Hangul_J_PanSios\",\n 0x11f0: \"Hangul_J_KkogjiDalrinIeung\",\n 0x11f9: \"Hangul_J_YeorinHieuh\",\n 0x0152: \"OE\",\n 0x0153: \"oe\",\n 0x0178: \"Ydiaeresis\",\n 0x20a0: \"EcuSign\",\n 0x20a1: \"ColonSign\",\n 0x20a2: \"CruzeiroSign\",\n 0x20a3: \"FFrancSign\",\n 0x20a4: \"LiraSign\",\n 0x20a5: \"MillSign\",\n 0x20a6: \"NairaSign\",\n 0x20a7: \"PesetaSign\",\n 0x20a8: \"RupeeSign\",\n 0x20a9: \"WonSign\",\n 0x20aa: \"NewSheqelSign\",\n 0x20ab: \"DongSign\",\n 0x20ac: \"EuroSign\",\n 0x0300: \"dead_grave\",\n 0x0301: \"dead_acute\",\n 0x0302: \"dead_circumflex\",\n 0x0303: \"dead_tilde\",\n 0x0304: \"dead_macron\",\n 0x0306: \"dead_breve\",\n 0x0307: \"dead_abovedot\",\n 0x0308: \"dead_diaeresis\",\n 0x030a: \"dead_abovering\",\n 0x030b: \"dead_doubleacute\",\n 0x030c: \"dead_caron\",\n 0x0327: \"dead_cedilla\",\n 0x0328: \"dead_ogonek\",\n 0x0345: \"dead_iota\",\n 0x3099: \"dead_voiced_sound\",\n 0x309a: \"dead_semivoiced_sound\",\n 0x0008: \"BackSpace\",\n 0x0009: \"Tab\",\n 0x000a: \"Linefeed\",\n 0x000b: \"Clear\",\n 0x000d: \"Return\",\n 0x0013: \"Pause\",\n 0x0014: \"Scroll_Lock\",\n 0x0015: \"Sys_Req\",\n 0x001b: \"Escape\",\n 0x0491: \"Ukrainian_ghe_with_upturn\",\n 0x0490: \"Ukrainian_GHE_WITH_UPTURN\",\n 0x0587: \"Armenian_ligature_ew\",\n 0x0589: \"Armenian_verjaket\",\n 0x055d: \"Armenian_but\",\n 0x058a: \"Armenian_yentamna\",\n 0x055c: \"Armenian_amanak\",\n 0x055b: \"Armenian_shesht\",\n 0x055e: \"Armenian_paruyk\",\n 0x0531: \"Armenian_AYB\",\n 0x0561: \"Armenian_ayb\",\n 0x0532: \"Armenian_BEN\",\n 0x0562: \"Armenian_ben\",\n 0x0533: \"Armenian_GIM\",\n 0x0563: \"Armenian_gim\",\n 0x0534: \"Armenian_DA\",\n 0x0564: \"Armenian_da\",\n 0x0535: \"Armenian_YECH\",\n 0x0565: \"Armenian_yech\",\n 0x0536: \"Armenian_ZA\",\n 0x0566: \"Armenian_za\",\n 0x0537: \"Armenian_E\",\n 0x0567: \"Armenian_e\",\n 0x0538: \"Armenian_AT\",\n 0x0568: \"Armenian_at\",\n 0x0539: \"Armenian_TO\",\n 0x0569: \"Armenian_to\",\n 0x053a: \"Armenian_ZHE\",\n 0x056a: \"Armenian_zhe\",\n 0x053b: \"Armenian_INI\",\n 0x056b: \"Armenian_ini\",\n 0x053c: \"Armenian_LYUN\",\n 0x056c: \"Armenian_lyun\",\n 0x053d: \"Armenian_KHE\",\n 0x056d: \"Armenian_khe\",\n 0x053e: \"Armenian_TSA\",\n 0x056e: \"Armenian_tsa\",\n 0x053f: \"Armenian_KEN\",\n 0x056f: \"Armenian_ken\",\n 0x0540: \"Armenian_HO\",\n 0x0570: \"Armenian_ho\",\n 0x0541: \"Armenian_DZA\",\n 0x0571: \"Armenian_dza\",\n 0x0542: \"Armenian_GHAT\",\n 0x0572: \"Armenian_ghat\",\n 0x0543: \"Armenian_TCHE\",\n 0x0573: \"Armenian_tche\",\n 0x0544: \"Armenian_MEN\",\n 0x0574: \"Armenian_men\",\n 0x0545: \"Armenian_HI\",\n 0x0575: \"Armenian_hi\",\n 0x0546: \"Armenian_NU\",\n 0x0576: \"Armenian_nu\",\n 0x0547: \"Armenian_SHA\",\n 0x0577: \"Armenian_sha\",\n 0x0548: \"Armenian_VO\",\n 0x0578: \"Armenian_vo\",\n 0x0549: \"Armenian_CHA\",\n 0x0579: \"Armenian_cha\",\n 0x054a: \"Armenian_PE\",\n 0x057a: \"Armenian_pe\",\n 0x054b: \"Armenian_JE\",\n 0x057b: \"Armenian_je\",\n 0x054c: \"Armenian_RA\",\n 0x057c: \"Armenian_ra\",\n 0x054d: \"Armenian_SE\",\n 0x057d: \"Armenian_se\",\n 0x054e: \"Armenian_VEV\",\n 0x057e: \"Armenian_vev\",\n 0x054f: \"Armenian_TYUN\",\n 0x057f: \"Armenian_tyun\",\n 0x0550: \"Armenian_RE\",\n 0x0580: \"Armenian_re\",\n 0x0551: \"Armenian_TSO\",\n 0x0581: \"Armenian_tso\",\n 0x0552: \"Armenian_VYUN\",\n 0x0582: \"Armenian_vyun\",\n 0x0553: \"Armenian_PYUR\",\n 0x0583: \"Armenian_pyur\",\n 0x0554: \"Armenian_KE\",\n 0x0584: \"Armenian_ke\",\n 0x0555: \"Armenian_O\",\n 0x0585: \"Armenian_o\",\n 0x0556: \"Armenian_FE\",\n 0x0586: \"Armenian_fe\",\n 0x055a: \"Armenian_apostrophe\",\n 0x10d0: \"Georgian_an\",\n 0x10d1: \"Georgian_ban\",\n 0x10d2: \"Georgian_gan\",\n 0x10d3: \"Georgian_don\",\n 0x10d4: \"Georgian_en\",\n 0x10d5: \"Georgian_vin\",\n 0x10d6: \"Georgian_zen\",\n 0x10d7: \"Georgian_tan\",\n 0x10d8: \"Georgian_in\",\n 0x10d9: \"Georgian_kan\",\n 0x10da: \"Georgian_las\",\n 0x10db: \"Georgian_man\",\n 0x10dc: \"Georgian_nar\",\n 0x10dd: \"Georgian_on\",\n 0x10de: \"Georgian_par\",\n 0x10df: \"Georgian_zhar\",\n 0x10e0: \"Georgian_rae\",\n 0x10e1: \"Georgian_san\",\n 0x10e2: \"Georgian_tar\",\n 0x10e3: \"Georgian_un\",\n 0x10e4: \"Georgian_phar\",\n 0x10e5: \"Georgian_khar\",\n 0x10e6: \"Georgian_ghan\",\n 0x10e7: \"Georgian_qar\",\n 0x10e8: \"Georgian_shin\",\n 0x10e9: \"Georgian_chin\",\n 0x10ea: \"Georgian_can\",\n 0x10eb: \"Georgian_jil\",\n 0x10ec: \"Georgian_cil\",\n 0x10ed: \"Georgian_char\",\n 0x10ee: \"Georgian_xan\",\n 0x10ef: \"Georgian_jhan\",\n 0x10f0: \"Georgian_hae\",\n 0x10f1: \"Georgian_he\",\n 0x10f2: \"Georgian_hie\",\n 0x10f3: \"Georgian_we\",\n 0x10f4: \"Georgian_har\",\n 0x10f5: \"Georgian_hoe\",\n 0x10f6: \"Georgian_fi\",\n 0x1e02: \"Babovedot\",\n 0x1e03: \"babovedot\",\n 0x1e0a: \"Dabovedot\",\n 0x1e80: \"Wgrave\",\n 0x1e82: \"Wacute\",\n 0x1e0b: \"dabovedot\",\n 0x1ef2: \"Ygrave\",\n 0x1e1e: \"Fabovedot\",\n 0x1e1f: \"fabovedot\",\n 0x1e40: \"Mabovedot\",\n 0x1e41: \"mabovedot\",\n 0x1e56: \"Pabovedot\",\n 0x1e81: \"wgrave\",\n 0x1e57: \"pabovedot\",\n 0x1e83: \"wacute\",\n 0x1e60: \"Sabovedot\",\n 0x1ef3: \"ygrave\",\n 0x1e84: \"Wdiaeresis\",\n 0x1e85: \"wdiaeresis\",\n 0x1e61: \"sabovedot\",\n 0x0174: \"Wcircumflex\",\n 0x1e6a: \"Tabovedot\",\n 0x0176: \"Ycircumflex\",\n 0x0175: \"wcircumflex\",\n 0x1e6b: \"tabovedot\",\n 0x0177: \"ycircumflex\",\n 0x06f0: \"Farsi_0\",\n 0x06f1: \"Farsi_1\",\n 0x06f2: \"Farsi_2\",\n 0x06f3: \"Farsi_3\",\n 0x06f4: \"Farsi_4\",\n 0x06f5: \"Farsi_5\",\n 0x06f6: \"Farsi_6\",\n 0x06f7: \"Farsi_7\",\n 0x06f8: \"Farsi_8\",\n 0x06f9: \"Farsi_9\",\n 0x066a: \"Arabic_percent\",\n 0x0670: \"Arabic_superscript_alef\",\n 0x0679: \"Arabic_tteh\",\n 0x067e: \"Arabic_peh\",\n 0x0686: \"Arabic_tcheh\",\n 0x0688: \"Arabic_ddal\",\n 0x0691: \"Arabic_rreh\",\n 0x06d4: \"Arabic_fullstop\",\n 0x0660: \"Arabic_0\",\n 0x0661: \"Arabic_1\",\n 0x0662: \"Arabic_2\",\n 0x0663: \"Arabic_3\",\n 0x0664: \"Arabic_4\",\n 0x0665: \"Arabic_5\",\n 0x0666: \"Arabic_6\",\n 0x0667: \"Arabic_7\",\n 0x0668: \"Arabic_8\",\n 0x0669: \"Arabic_9\",\n 0x0653: \"Arabic_madda_above\",\n 0x0654: \"Arabic_hamza_above\",\n 0x0655: \"Arabic_hamza_below\",\n 0x0698: \"Arabic_jeh\",\n 0x06a4: \"Arabic_veh\",\n 0x06a9: \"Arabic_keheh\",\n 0x06af: \"Arabic_gaf\",\n 0x06ba: \"Arabic_noon_ghunna\",\n 0x06be: \"Arabic_heh_doachashmee\",\n 0x06cc: \"Farsi_yeh\",\n 0x06d2: \"Arabic_yeh_baree\",\n 0x06c1: \"Arabic_heh_goal\",\n 0x0492: \"Cyrillic_GHE_bar\",\n 0x0496: \"Cyrillic_ZHE_descender\",\n 0x049a: \"Cyrillic_KA_descender\",\n 0x049c: \"Cyrillic_KA_vertstroke\",\n 0x04a2: \"Cyrillic_EN_descender\",\n 0x04ae: \"Cyrillic_U_straight\",\n 0x04b0: \"Cyrillic_U_straight_bar\",\n 0x04b2: \"Cyrillic_HA_descender\",\n 0x04b6: \"Cyrillic_CHE_descender\",\n 0x04b8: \"Cyrillic_CHE_vertstroke\",\n 0x04ba: \"Cyrillic_SHHA\",\n 0x04d8: \"Cyrillic_SCHWA\",\n 0x04e2: \"Cyrillic_I_macron\",\n 0x04e8: \"Cyrillic_O_bar\",\n 0x04ee: \"Cyrillic_U_macron\",\n 0x0493: \"Cyrillic_ghe_bar\",\n 0x0497: \"Cyrillic_zhe_descender\",\n 0x049b: \"Cyrillic_ka_descender\",\n 0x049d: \"Cyrillic_ka_vertstroke\",\n 0x04a3: \"Cyrillic_en_descender\",\n 0x04af: \"Cyrillic_u_straight\",\n 0x04b1: \"Cyrillic_u_straight_bar\",\n 0x04b3: \"Cyrillic_ha_descender\",\n 0x04b7: \"Cyrillic_che_descender\",\n 0x04b9: \"Cyrillic_che_vertstroke\",\n 0x04bb: \"Cyrillic_shha\",\n 0x04d9: \"Cyrillic_schwa\",\n 0x04e3: \"Cyrillic_i_macron\",\n 0x04e9: \"Cyrillic_o_bar\",\n 0x04ef: \"Cyrillic_u_macron\",\n 0x1e8a: \"Xabovedot\",\n 0x012c: \"Ibreve\",\n 0x01b5: \"Zstroke\",\n 0x01e6: \"Gcaron\",\n 0x019f: \"Obarred\",\n 0x1e8b: \"xabovedot\",\n 0x012d: \"ibreve\",\n 0x01b6: \"zstroke\",\n 0x01e7: \"gcaron\",\n 0x01d2: \"ocaron\",\n 0x0275: \"obarred\",\n 0x018f: \"SCHWA\",\n 0x0259: \"schwa\",\n 0x1e36: \"Lbelowdot\",\n 0x1e37: \"lbelowdot\",\n 0x1ea0: \"Abelowdot\",\n 0x1ea1: \"abelowdot\",\n 0x1ea2: \"Ahook\",\n 0x1ea3: \"ahook\",\n 0x1ea4: \"Acircumflexacute\",\n 0x1ea5: \"acircumflexacute\",\n 0x1ea6: \"Acircumflexgrave\",\n 0x1ea7: \"acircumflexgrave\",\n 0x1ea8: \"Acircumflexhook\",\n 0x1ea9: \"acircumflexhook\",\n 0x1eaa: \"Acircumflextilde\",\n 0x1eab: \"acircumflextilde\",\n 0x1eac: \"Acircumflexbelowdot\",\n 0x1ead: \"acircumflexbelowdot\",\n 0x1eae: \"Abreveacute\",\n 0x1eaf: \"abreveacute\",\n 0x1eb0: \"Abrevegrave\",\n 0x1eb1: \"abrevegrave\",\n 0x1eb2: \"Abrevehook\",\n 0x1eb3: \"abrevehook\",\n 0x1eb4: \"Abrevetilde\",\n 0x1eb5: \"abrevetilde\",\n 0x1eb6: \"Abrevebelowdot\",\n 0x1eb7: \"abrevebelowdot\",\n 0x1eb8: \"Ebelowdot\",\n 0x1eb9: \"ebelowdot\",\n 0x1eba: \"Ehook\",\n 0x1ebb: \"ehook\",\n 0x1ebc: \"Etilde\",\n 0x1ebd: \"etilde\",\n 0x1ebe: \"Ecircumflexacute\",\n 0x1ebf: \"ecircumflexacute\",\n 0x1ec0: \"Ecircumflexgrave\",\n 0x1ec1: \"ecircumflexgrave\",\n 0x1ec2: \"Ecircumflexhook\",\n 0x1ec3: \"ecircumflexhook\",\n 0x1ec4: \"Ecircumflextilde\",\n 0x1ec5: \"ecircumflextilde\",\n 0x1ec6: \"Ecircumflexbelowdot\",\n 0x1ec7: \"ecircumflexbelowdot\",\n 0x1ec8: \"Ihook\",\n 0x1ec9: \"ihook\",\n 0x1eca: \"Ibelowdot\",\n 0x1ecb: \"ibelowdot\",\n 0x1ecc: \"Obelowdot\",\n 0x1ecd: \"obelowdot\",\n 0x1ece: \"Ohook\",\n 0x1ecf: \"ohook\",\n 0x1ed0: \"Ocircumflexacute\",\n 0x1ed1: \"ocircumflexacute\",\n 0x1ed2: \"Ocircumflexgrave\",\n 0x1ed3: \"ocircumflexgrave\",\n 0x1ed4: \"Ocircumflexhook\",\n 0x1ed5: \"ocircumflexhook\",\n 0x1ed6: \"Ocircumflextilde\",\n 0x1ed7: \"ocircumflextilde\",\n 0x1ed8: \"Ocircumflexbelowdot\",\n 0x1ed9: \"ocircumflexbelowdot\",\n 0x1eda: \"Ohornacute\",\n 0x1edb: \"ohornacute\",\n 0x1edc: \"Ohorngrave\",\n 0x1edd: \"ohorngrave\",\n 0x1ede: \"Ohornhook\",\n 0x1edf: \"ohornhook\",\n 0x1ee0: \"Ohorntilde\",\n 0x1ee1: \"ohorntilde\",\n 0x1ee2: \"Ohornbelowdot\",\n 0x1ee3: \"ohornbelowdot\",\n 0x1ee4: \"Ubelowdot\",\n 0x1ee5: \"ubelowdot\",\n 0x1ee6: \"Uhook\",\n 0x1ee7: \"uhook\",\n 0x1ee8: \"Uhornacute\",\n 0x1ee9: \"uhornacute\",\n 0x1eea: \"Uhorngrave\",\n 0x1eeb: \"uhorngrave\",\n 0x1eec: \"Uhornhook\",\n 0x1eed: \"uhornhook\",\n 0x1eee: \"Uhorntilde\",\n 0x1eef: \"uhorntilde\",\n 0x1ef0: \"Uhornbelowdot\",\n 0x1ef1: \"uhornbelowdot\",\n 0x1ef4: \"Ybelowdot\",\n 0x1ef5: \"ybelowdot\",\n 0x1ef6: \"Yhook\",\n 0x1ef7: \"yhook\",\n 0x1ef8: \"Ytilde\",\n 0x1ef9: \"ytilde\",\n 0x01a0: \"Ohorn\",\n 0x01a1: \"ohorn\",\n 0x01af: \"Uhorn\",\n 0x01b0: \"uhorn\",\n 0x0323: \"dead_belowdot\",\n 0x0309: \"dead_hook\",\n 0x031b: \"dead_horn\"\n});\n\n// mapping is based on https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values\nconst kbEventCodesToKeySyms = Object.freeze({\n \"AltLeft\": \"Alt_L\",\n \"AltRight\": \"Alt_R\",\n \"ArrowDown\": \"Down\",\n \"ArrowLeft\": \"Left\",\n \"ArrowRight\": \"Right\",\n \"ArrowUp\": \"Up\",\n \"Backspace\": \"BackSpace\",\n \"CapsLock\": \"Caps_Lock\",\n \"ControlLeft\": \"Control_L\",\n \"ControlRight\": \"Control_R\",\n \"Enter\": \"Return\",\n \"HyperLeft\": \"Hyper_L\",\n \"HyperRight\": \"Hyper_R\",\n \"NumLock\": \"Num_Lock\",\n \"NumpadEnter\": \"Return\",\n \"MetaLeft\": \"Meta_L\",\n \"MetaRight\": \"Meta_R\",\n \"PageDown\": \"Page_Down\",\n \"PageUp\": \"Page_Up\",\n \"ScrollLock\": \"Scroll_Lock\",\n \"ShiftLeft\": \"Shift_L\",\n \"ShiftRight\": \"Shift_R\",\n \"SuperLeft\": \"Super_L\",\n \"SuperRight\": \"Super_R\"\n});\n\n// these Keyboard Event codes direclty map to X11 Keysyms\nconst knownKbEventCodes = new Set([\n \"Clear\", \"Copy\", \"Cut\", \"Delete\", \"End\", \"F1\", \"F2\", \"F3\", \"F4\", \"F5\", \"F6\", \"F7\", \"F8\", \"F9\", \"F10\", \"F11\", \"F12\",\n \"Home\", \"Insert\", \"Paste\", \"Redo\", \"Tab\", \"Undo\"\n]);\n\n/**\n * Returns X11 keySym (defined in https://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt) for a given key/code from the key[up/down] event\n * For keys with length 1 (ASCII, Cyrillic etc) - uses uniToKeySyms mapping\n * For keys with length > 1 (Modifiers, Whitespaces, Navigation etc) - uses knownKbEventCodes and kbEventCodesToKeySyms mapping\n *\n * @param {string} key 'key' from the key[up/down] event\n * @param {string} code 'code' from the key[up/down] event\n * @return {string} keySymString (X11 keysym string)\n */\nexport default function getKeysymString(key, code) {\n var keySym = \"Unidentified\";\n if (key.length === 1) {\n const keyCodeUni = key.charCodeAt(0);\n if (keyCodeUni in uniToKeySyms) {\n keySym = uniToKeySyms[keyCodeUni];\n }\n } else if (code in kbEventCodesToKeySyms) {\n keySym = kbEventCodesToKeySyms[code];\n } else if (knownKbEventCodes.has(code)) {\n keySym = code;\n }\n return keySym;\n}\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport getKeysymString from \"./keysyms.js\";\n\nconst eventsNames = Object.freeze([\n \"wheel\",\n \"contextmenu\",\n \"mousemove\",\n \"mousedown\",\n \"mouseup\",\n \"touchstart\",\n \"touchend\",\n \"touchmove\",\n \"touchcancel\",\n \"keyup\",\n \"keydown\"\n]);\n\nconst mouseEventsNames = Object.freeze({\n mousemove: \"MouseMove\",\n mousedown: \"MouseButtonPress\",\n mouseup: \"MouseButtonRelease\"\n});\n\nconst touchEventsNames = Object.freeze({\n touchstart: \"TouchDown\",\n touchend: \"TouchUp\",\n touchmove: \"TouchMotion\",\n touchcancel: \"TouchUp\"\n});\n\nconst keyboardEventsNames = Object.freeze({\n keydown: \"KeyPress\",\n keyup: \"KeyRelease\"\n});\n\nfunction getModifiers(event) {\n const modifiers = [];\n if (event.altKey) {\n modifiers.push(\"mod1-mask\");\n }\n\n if (event.ctrlKey) {\n modifiers.push(\"control-mask\");\n }\n\n if (event.metaKey) {\n modifiers.push(\"meta-mask\");\n }\n\n if (event.shiftKey) {\n modifiers.push(\"shift-mask\");\n }\n\n return modifiers.join(\"+\");\n}\n\n/**\n * @class GstWebRTCAPI.RemoteController\n * @hideconstructor\n * @classdesc Manages a specific WebRTC data channel created by a remote GStreamer webrtcsink producer and offering\n * remote control of the producer through\n * [GstNavigation]{@link https://gstreamer.freedesktop.org/documentation/video/gstnavigation.html} events.\n *

    The remote control data channel is created by the GStreamer webrtcsink element on the producer side. Then it is\n * announced through the consumer session thanks to the {@link gstWebRTCAPI#event:RemoteControllerChangedEvent}\n * event.

    \n *

    You can attach an {@link external:HTMLVideoElement} to the remote controller, then all mouse and keyboard events\n * emitted by this element will be automatically relayed to the remote producer.

    \n * @extends {external:EventTarget}\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @fires {@link GstWebRTCAPI#event:ClosedEvent}\n * @see GstWebRTCAPI.ConsumerSession#remoteController\n * @see GstWebRTCAPI.RemoteController#attachVideoElement\n * @see https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/webrtc/gstwebrtc-api#produce-a-gstreamer-interactive-webrtc-stream-with-remote-control\n */\nexport default class RemoteController extends EventTarget {\n constructor(rtcDataChannel, consumerSession) {\n super();\n\n this._rtcDataChannel = rtcDataChannel;\n this._consumerSession = consumerSession;\n\n this._videoElement = null;\n this._videoElementComputedStyle = null;\n this._videoElementKeyboard = null;\n this._lastTouchEventTimestamp = 0;\n\n rtcDataChannel.addEventListener(\"close\", () => {\n if (this._rtcDataChannel === rtcDataChannel) {\n this.close();\n }\n });\n\n rtcDataChannel.addEventListener(\"error\", (event) => {\n if (this._rtcDataChannel === rtcDataChannel) {\n const error = event.error;\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: (error && error.message) || \"Remote controller error\",\n error: error || new Error(\"unknown error on the remote controller data channel\")\n }));\n }\n });\n }\n\n /**\n * The underlying WebRTC data channel connected to a remote GStreamer webrtcsink producer offering remote control.\n * The value may be null if the remote controller has been closed.\n * @member {external:RTCDataChannel} GstWebRTCAPI.RemoteController#rtcDataChannel\n * @readonly\n */\n get rtcDataChannel() {\n return this._rtcDataChannel;\n }\n\n /**\n * The consumer session associated with this remote controller.\n * @member {GstWebRTCAPI.ConsumerSession} GstWebRTCAPI.RemoteController#consumerSession\n * @readonly\n */\n get consumerSession() {\n return this._consumerSession;\n }\n\n /**\n * The video element that is currently used to send all mouse and keyboard events to the remote producer. Value may\n * be null if no video element is attached.\n * @member {external:HTMLVideoElement} GstWebRTCAPI.RemoteController#videoElement\n * @readonly\n * @see GstWebRTCAPI.RemoteController#attachVideoElement\n */\n get videoElement() {\n return this._videoElement;\n }\n\n /**\n * Associates a video element with this remote controller.
    \n * When a video element is attached to this remote controller, all mouse and keyboard events emitted by this\n * element will be sent to the remote GStreamer webrtcink producer.\n * @method GstWebRTCAPI.RemoteController#attachVideoElement\n * @param {external:HTMLVideoElement|null} element - the video element to use to relay mouse and keyboard events,\n * or null to detach any previously attached element. If the provided element parameter is not null and not a\n * valid instance of an {@link external:HTMLVideoElement}, then the method does nothing.\n */\n attachVideoElement(element) {\n if ((element instanceof HTMLVideoElement) && (element !== this._videoElement)) {\n if (this._videoElement) {\n this.attachVideoElement(null);\n }\n\n this._videoElement = element;\n this._videoElementComputedStyle = window.getComputedStyle(element);\n\n for (const eventName of eventsNames) {\n element.addEventListener(eventName, this);\n }\n\n element.setAttribute(\"tabindex\", \"0\");\n } else if ((element === null) && this._videoElement) {\n const previousElement = this._videoElement;\n previousElement.removeAttribute(\"tabindex\");\n\n this._videoElement = null;\n this._videoElementComputedStyle = null;\n\n this._lastTouchEventTimestamp = 0;\n\n for (const eventName of eventsNames) {\n previousElement.removeEventListener(eventName, this);\n }\n }\n }\n\n /**\n * Closes the remote controller channel.
    \n * It immediately shuts down the underlying WebRTC data channel connected to a remote GStreamer webrtcsink\n * producer and detaches any video element that may be used to relay mouse and keyboard events.\n * @method GstWebRTCAPI.RemoteController#close\n */\n close() {\n this.attachVideoElement(null);\n\n const rtcDataChannel = this._rtcDataChannel;\n this._rtcDataChannel = null;\n\n if (rtcDataChannel) {\n rtcDataChannel.close();\n this.dispatchEvent(new Event(\"closed\"));\n }\n }\n\n _sendGstNavigationEvent(data) {\n try {\n if (!data || (typeof (data) !== \"object\")) {\n throw new Error(\"invalid GstNavigation event\");\n }\n\n if (!this._rtcDataChannel) {\n throw new Error(\"remote controller data channel is closed\");\n }\n\n this._rtcDataChannel.send(JSON.stringify(data));\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: `cannot send GstNavigation event over session ${this._consumerSession.sessionId} remote controller`,\n error: ex\n }));\n }\n }\n\n _computeVideoMousePosition(event) {\n const mousePos = { x: 0, y: 0 };\n if (!this._videoElement || (this._videoElement.videoWidth <= 0) || (this._videoElement.videoHeight <= 0)) {\n return mousePos;\n }\n\n const padding = {\n left: parseFloat(this._videoElementComputedStyle.paddingLeft),\n right: parseFloat(this._videoElementComputedStyle.paddingRight),\n top: parseFloat(this._videoElementComputedStyle.paddingTop),\n bottom: parseFloat(this._videoElementComputedStyle.paddingBottom)\n };\n\n if ((\"offsetX\" in event) && (\"offsetY\" in event)) {\n mousePos.x = event.offsetX - padding.left;\n mousePos.y = event.offsetY - padding.top;\n } else {\n const clientRect = this._videoElement.getBoundingClientRect();\n const border = {\n left: parseFloat(this._videoElementComputedStyle.borderLeftWidth),\n top: parseFloat(this._videoElementComputedStyle.borderTopWidth)\n };\n mousePos.x = event.clientX - clientRect.left - border.left - padding.left;\n mousePos.y = event.clientY - clientRect.top - border.top - padding.top;\n }\n\n const videoOffset = {\n x: this._videoElement.clientWidth - (padding.left + padding.right),\n y: this._videoElement.clientHeight - (padding.top + padding.bottom)\n };\n\n const ratio = Math.min(videoOffset.x / this._videoElement.videoWidth, videoOffset.y / this._videoElement.videoHeight);\n videoOffset.x = Math.max(0.5 * (videoOffset.x - this._videoElement.videoWidth * ratio), 0);\n videoOffset.y = Math.max(0.5 * (videoOffset.y - this._videoElement.videoHeight * ratio), 0);\n\n const invRatio = (ratio !== 0) ? (1 / ratio) : 0;\n mousePos.x = (mousePos.x - videoOffset.x) * invRatio;\n mousePos.y = (mousePos.y - videoOffset.y) * invRatio;\n\n mousePos.x = Math.min(Math.max(mousePos.x, 0), this._videoElement.videoWidth);\n mousePos.y = Math.min(Math.max(mousePos.y, 0), this._videoElement.videoHeight);\n\n return mousePos;\n }\n\n handleEvent(event) {\n if (!this._videoElement) {\n return;\n }\n\n switch (event.type) {\n case \"wheel\":\n event.preventDefault();\n {\n const mousePos = this._computeVideoMousePosition(event);\n this._sendGstNavigationEvent({\n event: \"MouseScroll\",\n x: mousePos.x,\n y: mousePos.y,\n delta_x: -event.deltaX, // eslint-disable-line camelcase\n delta_y: -event.deltaY, // eslint-disable-line camelcase\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n });\n }\n break;\n\n case \"contextmenu\":\n event.preventDefault();\n break;\n\n case \"mousemove\":\n case \"mousedown\":\n case \"mouseup\":\n event.preventDefault();\n {\n const mousePos = this._computeVideoMousePosition(event);\n const data = {\n event: mouseEventsNames[event.type],\n x: mousePos.x,\n y: mousePos.y,\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n\n if (event.type !== \"mousemove\") {\n data.button = event.button + 1;\n\n if ((event.type === \"mousedown\") && (event.button === 0)) {\n this._videoElement.focus();\n }\n }\n\n this._sendGstNavigationEvent(data);\n }\n break;\n\n case \"touchstart\":\n case \"touchend\":\n case \"touchmove\":\n case \"touchcancel\":\n for (const touch of event.changedTouches) {\n const mousePos = this._computeVideoMousePosition(touch);\n const data = {\n event: touchEventsNames[event.type],\n identifier: touch.identifier,\n x: mousePos.x,\n y: mousePos.y,\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n\n if ((\"force\" in touch) && ((event.type === \"touchstart\") || (event.type === \"touchmove\"))) {\n data.pressure = touch.force;\n }\n\n this._sendGstNavigationEvent(data);\n }\n\n if (event.timeStamp > this._lastTouchEventTimestamp) {\n this._lastTouchEventTimestamp = event.timeStamp;\n this._sendGstNavigationEvent({\n event: \"TouchFrame\",\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n });\n }\n break;\n case \"keyup\":\n case \"keydown\":\n event.preventDefault();\n {\n const data = {\n event: keyboardEventsNames[event.type],\n key: getKeysymString(event.key, event.code),\n modifier_state: getModifiers(event) // eslint-disable-line camelcase\n };\n this._sendGstNavigationEvent(data);\n }\n break;\n }\n }\n}\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport WebRTCSession from \"./webrtc-session.js\";\nimport SessionState from \"./session-state.js\";\nimport RemoteController from \"./remote-controller.js\";\n\n/**\n * Event name: \"streamsChanged\".
    \n * Triggered when the underlying media streams of a {@link GstWebRTCAPI.ConsumerSession} change.\n * @event GstWebRTCAPI#StreamsChangedEvent\n * @type {external:Event}\n * @see GstWebRTCAPI.ConsumerSession#streams\n */\n/**\n * Event name: \"remoteControllerChanged\".
    \n * Triggered when the underlying remote controller of a {@link GstWebRTCAPI.ConsumerSession} changes.\n * @event GstWebRTCAPI#RemoteControllerChangedEvent\n * @type {external:Event}\n * @see GstWebRTCAPI.ConsumerSession#remoteController\n */\n\n/**\n * @class GstWebRTCAPI.ConsumerSession\n * @hideconstructor\n * @classdesc Consumer session managing a peer-to-peer WebRTC channel between a remote producer and this client\n * instance.\n *

    Call {@link GstWebRTCAPI#createConsumerSession} to create a ConsumerSession instance.

    \n * @extends {GstWebRTCAPI.WebRTCSession}\n * @fires {@link GstWebRTCAPI#event:StreamsChangedEvent}\n * @fires {@link GstWebRTCAPI#event:RemoteControllerChangedEvent}\n */\nexport default class ConsumerSession extends WebRTCSession {\n constructor(peerId, comChannel) {\n super(peerId, comChannel);\n this._streams = [];\n this._remoteController = null;\n\n this.addEventListener(\"closed\", () => {\n this._streams = [];\n\n if (this._remoteController) {\n this._remoteController.close();\n }\n });\n }\n\n /**\n * The array of remote media streams consumed locally through this WebRTC channel.\n * @member {external:MediaStream[]} GstWebRTCAPI.ConsumerSession#streams\n * @readonly\n */\n get streams() {\n return this._streams;\n }\n\n /**\n * The remote controller associated with this WebRTC consumer session. Value may be null if consumer session\n * has no remote controller.\n * @member {GstWebRTCAPI.RemoteController} GstWebRTCAPI.ConsumerSession#remoteController\n * @readonly\n */\n get remoteController() {\n return this._remoteController;\n }\n\n /**\n * Connects the consumer session to its remote producer.
    \n * This method must be called after creating the consumer session in order to start receiving the remote streams.\n * It registers this consumer session to the signaling server and gets ready to receive audio/video streams.\n *

    Even on success, streaming can fail later if any error occurs during or after connection. In order to know\n * the effective streaming state, you should be listening to the [error]{@link GstWebRTCAPI#event:ErrorEvent},\n * [stateChanged]{@link GstWebRTCAPI#event:StateChangedEvent} and/or [closed]{@link GstWebRTCAPI#event:ClosedEvent}\n * events.

    \n * @method GstWebRTCAPI.ConsumerSession#connect\n * @returns {boolean} true in case of success (may fail later during or after connection) or false in case of\n * immediate error (wrong session state or no connection to the signaling server).\n */\n connect() {\n if (!this._comChannel || (this._state === SessionState.closed)) {\n return false;\n }\n\n if (this._state !== SessionState.idle) {\n return true;\n }\n\n const msg = {\n type: \"startSession\",\n peerId: this._peerId\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot connect consumer session\",\n error: new Error(\"cannot send startSession message to signaling server\")\n }));\n\n this.close();\n return false;\n }\n\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n return true;\n }\n\n onSessionStarted(peerId, sessionId) {\n if ((this._peerId === peerId) && (this._state === SessionState.connecting) && !this._sessionId) {\n this._sessionId = sessionId;\n }\n }\n\n onSessionPeerMessage(msg) {\n if ((this._state === SessionState.closed) || !this._comChannel || !this._sessionId) {\n return;\n }\n\n if (!this._rtcPeerConnection) {\n const connection = new RTCPeerConnection(this._comChannel.webrtcConfig);\n this._rtcPeerConnection = connection;\n\n connection.ontrack = (event) => {\n if ((this._rtcPeerConnection === connection) && event.streams && (event.streams.length > 0)) {\n if (this._state === SessionState.connecting) {\n this._state = SessionState.streaming;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n\n let streamsChanged = false;\n for (const stream of event.streams) {\n if (!this._streams.includes(stream)) {\n this._streams.push(stream);\n streamsChanged = true;\n }\n }\n\n if (streamsChanged) {\n this.dispatchEvent(new Event(\"streamsChanged\"));\n }\n }\n };\n\n connection.ondatachannel = (event) => {\n const rtcDataChannel = event.channel;\n if (rtcDataChannel && (rtcDataChannel.label === \"input\")) {\n if (this._remoteController) {\n const previousController = this._remoteController;\n this._remoteController = null;\n previousController.close();\n }\n\n const remoteController = new RemoteController(rtcDataChannel, this);\n this._remoteController = remoteController;\n this.dispatchEvent(new Event(\"remoteControllerChanged\"));\n\n remoteController.addEventListener(\"closed\", () => {\n if (this._remoteController === remoteController) {\n this._remoteController = null;\n this.dispatchEvent(new Event(\"remoteControllerChanged\"));\n }\n });\n }\n };\n\n connection.onicecandidate = (event) => {\n if ((this._rtcPeerConnection === connection) && event.candidate && this._comChannel) {\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: event.candidate.toJSON()\n });\n }\n };\n\n this.dispatchEvent(new Event(\"rtcPeerConnectionChanged\"));\n }\n\n if (msg.sdp) {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).then(() => {\n if (this._rtcPeerConnection) {\n return this._rtcPeerConnection.createAnswer();\n } else {\n return null;\n }\n }).then((desc) => {\n if (this._rtcPeerConnection && desc) {\n return this._rtcPeerConnection.setLocalDescription(desc);\n } else {\n return null;\n }\n }).then(() => {\n if (this._rtcPeerConnection && this._comChannel) {\n const sdp = {\n type: \"peer\",\n sessionId: this._sessionId,\n sdp: this._rtcPeerConnection.localDescription.toJSON()\n };\n if (!this._comChannel.send(sdp)) {\n throw new Error(\"cannot send local SDP configuration to WebRTC peer\");\n }\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else if (msg.ice) {\n const candidate = new RTCIceCandidate(msg.ice);\n this._rtcPeerConnection.addIceCandidate(candidate).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during ICE handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n throw new Error(`invalid empty peer message received from consumer session ${this._sessionId}`);\n }\n }\n}\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport WebRTCSession from \"./webrtc-session.js\";\nimport SessionState from \"./session-state.js\";\n\n/**\n * @class GstWebRTCAPI.ClientSession\n * @hideconstructor\n * @classdesc Client session representing a link between a remote consumer and a local producer session.\n * @extends {GstWebRTCAPI.WebRTCSession}\n */\nclass ClientSession extends WebRTCSession {\n constructor(peerId, sessionId, comChannel, stream) {\n super(peerId, comChannel);\n this._sessionId = sessionId;\n this._state = SessionState.streaming;\n\n const connection = new RTCPeerConnection(this._comChannel.webrtcConfig);\n this._rtcPeerConnection = connection;\n\n for (const track of stream.getTracks()) {\n connection.addTrack(track, stream);\n }\n\n connection.onicecandidate = (event) => {\n if ((this._rtcPeerConnection === connection) && event.candidate && this._comChannel) {\n this._comChannel.send({\n type: \"peer\",\n sessionId: this._sessionId,\n ice: event.candidate.toJSON()\n });\n }\n };\n\n this.dispatchEvent(new Event(\"rtcPeerConnectionChanged\"));\n\n connection.setLocalDescription().then(() => {\n if ((this._rtcPeerConnection === connection) && this._comChannel) {\n const sdp = {\n type: \"peer\",\n sessionId: this._sessionId,\n sdp: this._rtcPeerConnection.localDescription.toJSON()\n };\n if (!this._comChannel.send(sdp)) {\n throw new Error(\"cannot send local SDP configuration to WebRTC peer\");\n }\n }\n }).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n }\n\n onSessionPeerMessage(msg) {\n if ((this._state === SessionState.closed) || !this._rtcPeerConnection) {\n return;\n }\n\n if (msg.sdp) {\n this._rtcPeerConnection.setRemoteDescription(msg.sdp).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during SDP handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else if (msg.ice) {\n const candidate = new RTCIceCandidate(msg.ice);\n this._rtcPeerConnection.addIceCandidate(candidate).catch((ex) => {\n if (this._state !== SessionState.closed) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"an unrecoverable error occurred during ICE handshake\",\n error: ex\n }));\n\n this.close();\n }\n });\n } else {\n throw new Error(`invalid empty peer message received from producer's client session ${this._peerId}`);\n }\n }\n}\n\n/**\n * Event name: \"clientConsumerAdded\".
    \n * Triggered when a remote consumer peer connects to a local {@link GstWebRTCAPI.ProducerSession}.\n * @event GstWebRTCAPI#ClientConsumerAddedEvent\n * @type {external:CustomEvent}\n * @property {GstWebRTCAPI.ClientSession} detail - The WebRTC session associated with the added consumer peer.\n * @see GstWebRTCAPI.ProducerSession\n */\n/**\n * Event name: \"clientConsumerRemoved\".
    \n * Triggered when a remote consumer peer disconnects from a local {@link GstWebRTCAPI.ProducerSession}.\n * @event GstWebRTCAPI#ClientConsumerRemovedEvent\n * @type {external:CustomEvent}\n * @property {GstWebRTCAPI.ClientSession} detail - The WebRTC session associated with the removed consumer peer.\n * @see GstWebRTCAPI.ProducerSession\n */\n\n/**\n * @class GstWebRTCAPI.ProducerSession\n * @hideconstructor\n * @classdesc Producer session managing the streaming out of a local {@link external:MediaStream}.
    \n * It manages all underlying WebRTC connections to each peer client consuming the stream.\n *

    Call {@link GstWebRTCAPI#createProducerSession} to create a ProducerSession instance.

    \n * @extends {external:EventTarget}\n * @fires {@link GstWebRTCAPI#event:ErrorEvent}\n * @fires {@link GstWebRTCAPI#event:StateChangedEvent}\n * @fires {@link GstWebRTCAPI#event:ClosedEvent}\n * @fires {@link GstWebRTCAPI#event:ClientConsumerAddedEvent}\n * @fires {@link GstWebRTCAPI#event:ClientConsumerRemovedEvent}\n */\nexport default class ProducerSession extends EventTarget {\n constructor(comChannel, stream) {\n super();\n\n this._comChannel = comChannel;\n this._stream = stream;\n this._state = SessionState.idle;\n this._clientSessions = {};\n }\n\n /**\n * The local stream produced out by this session.\n * @member {external:MediaStream} GstWebRTCAPI.ProducerSession#stream\n * @readonly\n */\n get stream() {\n return this._stream;\n }\n\n /**\n * The current producer session state.\n * @member {GstWebRTCAPI.SessionState} GstWebRTCAPI.ProducerSession#state\n * @readonly\n */\n get state() {\n return this._state;\n }\n\n /**\n * Starts the producer session.
    \n * This method must be called after creating the producer session in order to start streaming. It registers this\n * producer session to the signaling server and gets ready to serve peer requests from consumers.\n *

    Even on success, streaming can fail later if any error occurs during or after connection. In order to know\n * the effective streaming state, you should be listening to the [error]{@link GstWebRTCAPI#event:ErrorEvent},\n * [stateChanged]{@link GstWebRTCAPI#event:StateChangedEvent} and/or [closed]{@link GstWebRTCAPI#event:ClosedEvent}\n * events.

    \n * @method GstWebRTCAPI.ProducerSession#start\n * @returns {boolean} true in case of success (may fail later during or after connection) or false in case of\n * immediate error (wrong session state or no connection to the signaling server).\n */\n start() {\n if (!this._comChannel || (this._state === SessionState.closed)) {\n return false;\n }\n\n if (this._state !== SessionState.idle) {\n return true;\n }\n\n const msg = {\n type: \"setPeerStatus\",\n roles: [\"listener\", \"producer\"],\n meta: this._comChannel.meta\n };\n if (!this._comChannel.send(msg)) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot start producer session\",\n error: new Error(\"cannot register producer to signaling server\")\n }));\n\n this.close();\n return false;\n }\n\n this._state = SessionState.connecting;\n this.dispatchEvent(new Event(\"stateChanged\"));\n return true;\n }\n\n /**\n * Terminates the producer session.
    \n * It immediately disconnects all peer consumers attached to this producer session and unregisters the producer\n * from the signaling server.\n * @method GstWebRTCAPI.ProducerSession#close\n */\n close() {\n if (this._state !== SessionState.closed) {\n for (const track of this._stream.getTracks()) {\n track.stop();\n }\n\n if ((this._state !== SessionState.idle) && this._comChannel) {\n this._comChannel.send({\n type: \"setPeerStatus\",\n roles: [\"listener\"],\n meta: this._comChannel.meta\n });\n }\n\n this._state = SessionState.closed;\n this.dispatchEvent(new Event(\"stateChanged\"));\n\n this._comChannel = null;\n this._stream = null;\n\n for (const clientSession of Object.values(this._clientSessions)) {\n clientSession.close();\n }\n this._clientSessions = {};\n\n this.dispatchEvent(new Event(\"closed\"));\n }\n }\n\n onProducerRegistered() {\n if (this._state === SessionState.connecting) {\n this._state = SessionState.streaming;\n this.dispatchEvent(new Event(\"stateChanged\"));\n }\n }\n\n onStartSessionMessage(msg) {\n if (this._comChannel && this._stream && !(msg.sessionId in this._clientSessions)) {\n const session = new ClientSession(msg.peerId, msg.sessionId, this._comChannel, this._stream);\n this._clientSessions[msg.sessionId] = session;\n\n session.addEventListener(\"closed\", (event) => {\n const sessionId = event.target.sessionId;\n if ((sessionId in this._clientSessions) && (this._clientSessions[sessionId] === session)) {\n delete this._clientSessions[sessionId];\n this.dispatchEvent(new CustomEvent(\"clientConsumerRemoved\", { detail: session }));\n }\n });\n\n session.addEventListener(\"error\", (event) => {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: `error from client consumer ${event.target.peerId}: ${event.message}`,\n error: event.error\n }));\n });\n\n this.dispatchEvent(new CustomEvent(\"clientConsumerAdded\", { detail: session }));\n }\n }\n\n onEndSessionMessage(msg) {\n if (msg.sessionId in this._clientSessions) {\n this._clientSessions[msg.sessionId].close();\n }\n }\n\n onSessionPeerMessage(msg) {\n if (msg.sessionId in this._clientSessions) {\n this._clientSessions[msg.sessionId].onSessionPeerMessage(msg);\n }\n }\n}\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport ConsumerSession from \"./consumer-session.js\";\nimport ProducerSession from \"./producer-session.js\";\n\nconst SignallingServerMessageType = Object.freeze({\n welcome: \"welcome\",\n peerStatusChanged: \"peerStatusChanged\",\n list: \"list\",\n sessionStarted: \"sessionStarted\",\n peer: \"peer\",\n startSession: \"startSession\",\n endSession: \"endSession\",\n error: \"error\"\n});\n\nfunction normalizeProducer(producer, excludedId) {\n if (!producer || (typeof (producer) !== \"object\")) {\n return null;\n }\n\n const normalizedProducer = {\n id: \"\",\n meta: {}\n };\n\n if (producer.id && (typeof (producer.id) === \"string\")) {\n normalizedProducer.id = producer.id;\n } else if (producer.peerId && (typeof (producer.peerId) === \"string\")) {\n normalizedProducer.id = producer.peerId;\n } else {\n return null;\n }\n\n if (normalizedProducer.id === excludedId) {\n return null;\n }\n\n if (producer.meta && (typeof (producer.meta) === \"object\")) {\n normalizedProducer.meta = producer.meta;\n }\n\n Object.freeze(normalizedProducer.meta);\n return Object.freeze(normalizedProducer);\n}\n\nexport default class ComChannel extends EventTarget {\n constructor(url, meta, webrtcConfig) {\n super();\n\n this._meta = meta;\n this._webrtcConfig = webrtcConfig;\n this._ws = new WebSocket(url);\n this._ready = false;\n this._channelId = \"\";\n this._producerSession = null;\n this._consumerSessions = {};\n\n this._ws.onerror = (event) => {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: event.message || \"WebSocket error\",\n error: event.error || new Error(\n this._ready ? \"transportation error\" : \"cannot connect to signaling server\")\n }));\n this.close();\n };\n\n this._ws.onclose = () => {\n this._ready = false;\n this._channelId = \"\";\n this._ws = null;\n\n this.closeAllConsumerSessions();\n\n if (this._producerSession) {\n this._producerSession.close();\n this._producerSession = null;\n }\n\n this.dispatchEvent(new Event(\"closed\"));\n };\n\n this._ws.onmessage = (event) => {\n try {\n const msg = JSON.parse(event.data);\n if (msg && (typeof (msg) === \"object\")) {\n switch (msg.type) {\n\n case SignallingServerMessageType.welcome:\n this._channelId = msg.peerId;\n try {\n this._ws.send(JSON.stringify({\n type: \"setPeerStatus\",\n roles: [\"listener\"],\n meta: meta\n }));\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot initialize connection to signaling server\",\n error: ex\n }));\n this.close();\n }\n break;\n\n case SignallingServerMessageType.peerStatusChanged:\n if (msg.peerId === this._channelId) {\n if (!this._ready && msg.roles.includes(\"listener\")) {\n this._ready = true;\n this.dispatchEvent(new Event(\"ready\"));\n this.send({ type: \"list\" });\n }\n\n if (this._producerSession && msg.roles.includes(\"producer\")) {\n this._producerSession.onProducerRegistered();\n }\n } else {\n const normalizedProducer = normalizeProducer(msg, this._channelId);\n if (normalizedProducer) {\n if (msg.roles.includes(\"producer\")) {\n this.dispatchEvent(new CustomEvent(\"producerAdded\", { detail: normalizedProducer }));\n } else {\n this.dispatchEvent(new CustomEvent(\"producerRemoved\", { detail: normalizedProducer }));\n }\n }\n }\n break;\n\n case SignallingServerMessageType.list:\n for (const producer of msg.producers) {\n const normalizedProducer = normalizeProducer(producer, this._channelId);\n if (normalizedProducer) {\n this.dispatchEvent(new CustomEvent(\"producerAdded\", { detail: normalizedProducer }));\n }\n }\n break;\n\n case SignallingServerMessageType.sessionStarted:\n {\n const session = this.getConsumerSession(msg.peerId);\n if (session) {\n delete this._consumerSessions[msg.peerId];\n\n session.onSessionStarted(msg.peerId, msg.sessionId);\n if (session.sessionId && !(session.sessionId in this._consumerSessions)) {\n this._consumerSessions[session.sessionId] = session;\n } else {\n session.close();\n }\n }\n }\n break;\n\n case SignallingServerMessageType.peer:\n {\n const session = this.getConsumerSession(msg.sessionId);\n if (session) {\n session.onSessionPeerMessage(msg);\n } else if (this._producerSession) {\n this._producerSession.onSessionPeerMessage(msg);\n }\n }\n break;\n\n case SignallingServerMessageType.startSession:\n if (this._producerSession) {\n this._producerSession.onStartSessionMessage(msg);\n }\n break;\n\n case SignallingServerMessageType.endSession:\n {\n const session = this.getConsumerSession(msg.sessionId);\n if (session) {\n session.close();\n } else if (this._producerSession) {\n this._producerSession.onEndSessionMessage(msg);\n }\n }\n break;\n\n case SignallingServerMessageType.error:\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"error received from signaling server\",\n error: new Error(msg.details)\n }));\n break;\n\n default:\n throw new Error(`unknown message type: \"${msg.type}\"`);\n }\n }\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot parse incoming message from signaling server\",\n error: ex\n }));\n }\n };\n }\n\n get meta() {\n return this._meta;\n }\n\n get webrtcConfig() {\n return this._webrtcConfig;\n }\n\n get ready() {\n return this._ready;\n }\n\n get channelId() {\n return this._channelId;\n }\n\n get producerSession() {\n return this._producerSession;\n }\n\n createProducerSession(stream) {\n if (!this._ready || !(stream instanceof MediaStream)) {\n return null;\n }\n\n if (this._producerSession) {\n if (this._producerSession.stream === stream) {\n return this._producerSession;\n } else {\n return null;\n }\n }\n\n const session = new ProducerSession(this, stream);\n this._producerSession = session;\n\n session.addEventListener(\"closed\", () => {\n if (this._producerSession === session) {\n this._producerSession = null;\n }\n });\n\n return session;\n }\n\n createConsumerSession(producerId) {\n if (!this._ready || !producerId || (typeof (producerId) !== \"string\")) {\n return null;\n }\n\n if (producerId in this._consumerSessions) {\n return this._consumerSessions[producerId];\n }\n\n for (const session of Object.values(this._consumerSessions)) {\n if (session.peerId === producerId) {\n return session;\n }\n }\n\n const session = new ConsumerSession(producerId, this);\n this._consumerSessions[producerId] = session;\n\n session.addEventListener(\"closed\", (event) => {\n let sessionId = event.target.sessionId;\n if (!sessionId) {\n sessionId = event.target.peerId;\n }\n\n if ((sessionId in this._consumerSessions) && (this._consumerSessions[sessionId] === session)) {\n delete this._consumerSessions[sessionId];\n }\n });\n\n return session;\n }\n\n getConsumerSession(sessionId) {\n if (sessionId in this._consumerSessions) {\n return this._consumerSessions[sessionId];\n } else {\n return null;\n }\n }\n\n closeAllConsumerSessions() {\n for (const session of Object.values(this._consumerSessions)) {\n session.close();\n }\n\n this._consumerSessions = {};\n }\n\n send(data) {\n if (this._ready && data && (typeof (data) === \"object\")) {\n try {\n this._ws.send(JSON.stringify(data));\n return true;\n } catch (ex) {\n this.dispatchEvent(new ErrorEvent(\"error\", {\n message: \"cannot send message to signaling server\",\n error: ex\n }));\n }\n }\n\n return false;\n }\n\n close() {\n if (this._ws) {\n this._ready = false;\n this._channelId = \"\";\n this._ws.close();\n\n this.closeAllConsumerSessions();\n\n if (this._producerSession) {\n this._producerSession.close();\n this._producerSession = null;\n }\n }\n }\n}\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport defaultConfig from \"./config.js\";\nimport ComChannel from \"./com-channel.js\";\nimport SessionState from \"./session-state.js\";\n\n/**\n * @class GstWebRTCAPI\n * @classdesc The API entry point that manages a WebRTC.\n */\nexport default class GstWebRTCAPI {\n /**\n * @constructor GstWebRTCAPI\n * @param {GstWebRTCConfig} [userConfig] - The user configuration.
    Only the parameters different from the default\n * ones need to be provided.\n */\n constructor(userConfig) {\n this._channel = null;\n this._producers = {};\n this._connectionListeners = [];\n this._producersListeners = [];\n\n const config = Object.assign({}, defaultConfig);\n if (userConfig && (typeof (userConfig) === \"object\")) {\n Object.assign(config, userConfig);\n }\n\n if (typeof (config.meta) !== \"object\") {\n config.meta = null;\n }\n\n this._config = config;\n this.connectChannel();\n }\n\n /**\n * @interface GstWebRTCAPI.ConnectionListener\n */\n /**\n * Callback method called when this client connects to the WebRTC signaling server.\n * The callback implementation should not throw any exception.\n * @method GstWebRTCAPI.ConnectionListener#connected\n * @abstract\n * @param {string} clientId - The unique identifier of this WebRTC client.
    This identifier is provided by the\n * signaling server to uniquely identify each connected peer.\n */\n /**\n * Callback method called when this client disconnects from the WebRTC signaling server.\n * The callback implementation should not throw any exception.\n * @method GstWebRTCAPI.ConnectionListener#disconnected\n * @abstract\n */\n\n /**\n * Registers a connection listener that will be called each time the WebRTC API connects to or disconnects from the\n * signaling server.\n * @method GstWebRTCAPI#registerConnectionListener\n * @param {GstWebRTCAPI.ConnectionListener} listener - The connection listener to register.\n * @returns {boolean} true in case of success (or if the listener was already registered), or false if the listener\n * doesn't implement all callback functions and cannot be registered.\n */\n registerConnectionListener(listener) {\n if (!listener || (typeof (listener) !== \"object\") ||\n (typeof (listener.connected) !== \"function\") ||\n (typeof (listener.disconnected) !== \"function\")) {\n return false;\n }\n\n if (!this._connectionListeners.includes(listener)) {\n this._connectionListeners.push(listener);\n }\n\n return true;\n }\n\n /**\n * Unregisters a connection listener.
    \n * The removed listener will never be called again and can be garbage collected.\n * @method GstWebRTCAPI#unregisterConnectionListener\n * @param {GstWebRTCAPI.ConnectionListener} listener - The connection listener to unregister.\n * @returns {boolean} true if the listener is found and unregistered, or false if the listener was not previously\n * registered.\n */\n unregisterConnectionListener(listener) {\n const idx = this._connectionListeners.indexOf(listener);\n if (idx >= 0) {\n this._connectionListeners.splice(idx, 1);\n return true;\n }\n\n return false;\n }\n\n /**\n * Unregisters all previously registered connection listeners.\n * @method GstWebRTCAPI#unregisterAllConnectionListeners\n */\n unregisterAllConnectionListeners() {\n this._connectionListeners = [];\n }\n\n /**\n * Creates a new producer session.\n *

    You can only create one producer session at a time.
    \n * To request streaming from a new stream you will first need to close the previous producer session.

    \n *

    You can only request a producer session while you are connected to the signaling server. You can use the\n * {@link GstWebRTCAPI.ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.

    \n * @method GstWebRTCAPI#createProducerSession\n * @param {external:MediaStream} stream - The audio/video stream to offer as a producer through WebRTC.\n * @returns {GstWebRTCAPI.ProducerSession} The created producer session or null in case of error. To start streaming,\n * you still need to call {@link GstWebRTCAPI.ProducerSession#start} after adding on the returned session all the event\n * listeners you may need.\n */\n createProducerSession(stream) {\n if (this._channel) {\n return this._channel.createProducerSession(stream);\n }\n return null;\n }\n\n /**\n * Information about a remote producer registered by the signaling server.\n * @typedef {object} GstWebRTCAPI.Producer\n * @readonly\n * @property {string} id - The remote producer unique identifier set by the signaling server (always non-empty).\n * @property {object} meta - Free-form object containing extra information about the remote producer (always non-null,\n * but may be empty). Its content depends on your application.\n */\n\n /**\n * Gets the list of all remote WebRTC producers available on the signaling server.\n *

    The remote producers list is only populated once you've connected to the signaling server. You can use the\n * {@link GstWebRTCAPI.ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.

    \n * @method GstWebRTCAPI#getAvailableProducers\n * @returns {GstWebRTCAPI.Producer[]} The list of remote WebRTC producers available.\n */\n getAvailableProducers() {\n return Object.values(this._producers);\n }\n\n /**\n * @interface GstWebRTCAPI.ProducersListener\n */\n /**\n * Callback method called when a remote producer is added on the signaling server.\n * The callback implementation should not throw any exception.\n * @method GstWebRTCAPI.ProducersListener#producerAdded\n * @abstract\n * @param {GstWebRTCAPI.Producer} producer - The remote producer added on server-side.\n */\n /**\n * Callback method called when a remote producer is removed from the signaling server.\n * The callback implementation should not throw any exception.\n * @method GstWebRTCAPI.ProducersListener#producerRemoved\n * @abstract\n * @param {GstWebRTCAPI.Producer} producer - The remote producer removed on server-side.\n */\n\n /**\n * Registers a producers listener that will be called each time a producer is added or removed on the signaling\n * server.\n * @method GstWebRTCAPI#registerProducersListener\n * @param {GstWebRTCAPI.ProducersListener} listener - The producer listener to register.\n * @returns {boolean} true in case of success (or if the listener was already registered), or false if the listener\n * doesn't implement all callback functions and cannot be registered.\n */\n registerProducersListener(listener) {\n if (!listener || (typeof (listener) !== \"object\") ||\n (typeof (listener.producerAdded) !== \"function\") ||\n (typeof (listener.producerRemoved) !== \"function\")) {\n return false;\n }\n\n if (!this._producersListeners.includes(listener)) {\n this._producersListeners.push(listener);\n }\n\n return true;\n }\n\n /**\n * Unregisters a producers listener.
    \n * The removed listener will never be called again and can be garbage collected.\n * @method GstWebRTCAPI#unregisterProducersListener\n * @param {GstWebRTCAPI.ProducersListener} listener - The producers listener to unregister.\n * @returns {boolean} true if the listener is found and unregistered, or false if the listener was not previously\n * registered.\n */\n unregisterProducersListener(listener) {\n const idx = this._producersListeners.indexOf(listener);\n if (idx >= 0) {\n this._producersListeners.splice(idx, 1);\n return true;\n }\n\n return false;\n }\n\n /**\n * Unregisters all previously registered producers listeners.\n * @method GstWebRTCAPI#unregisterAllProducersListeners\n */\n unregisterAllProducersListeners() {\n this._producersListeners = [];\n }\n\n /**\n * Creates a consumer session by connecting the local client to a remote WebRTC producer.\n *

    You can only create one consumer session per remote producer.

    \n *

    You can only request a new consumer session while you are connected to the signaling server. You can use the\n * {@link GstWebRTCAPI.ConnectionListener} interface and {@link GstWebRTCAPI#registerConnectionListener} method to\n * listen to the connection state.

    \n * @method GstWebRTCAPI#createConsumerSession\n * @param {string} producerId - The unique identifier of the remote producer to connect to.\n * @returns {GstWebRTCAPI.ConsumerSession} The WebRTC session between the selected remote producer and this local\n * consumer, or null in case of error. To start connecting and receiving the remote streams, you still need to call\n * {@link GstWebRTCAPI.ConsumerSession#connect} after adding on the returned session all the event listeners you may\n * need.\n */\n createConsumerSession(producerId) {\n if (this._channel) {\n return this._channel.createConsumerSession(producerId);\n }\n return null;\n }\n\n connectChannel() {\n if (this._channel) {\n const oldChannel = this._channel;\n this._channel = null;\n oldChannel.close();\n for (const key in this._producers) {\n this.triggerProducerRemoved(key);\n }\n this._producers = {};\n this.triggerDisconnected();\n }\n\n this._channel = new ComChannel(\n this._config.signalingServerUrl,\n this._config.meta,\n this._config.webrtcConfig\n );\n\n this._channel.addEventListener(\"error\", (event) => {\n if (event.target === this._channel) {\n console.error(event.message, event.error);\n }\n });\n\n this._channel.addEventListener(\"closed\", (event) => {\n if (event.target !== this._channel) {\n return;\n }\n this._channel = null;\n for (const key in this._producers) {\n this.triggerProducerRemoved(key);\n }\n this._producers = {};\n this.triggerDisconnected();\n if (this._config.reconnectionTimeout > 0) {\n window.setTimeout(() => {\n this.connectChannel();\n }, this._config.reconnectionTimeout);\n }\n });\n\n this._channel.addEventListener(\"ready\", (event) => {\n if (event.target === this._channel) {\n this.triggerConnected(this._channel.channelId);\n }\n });\n\n this._channel.addEventListener(\"producerAdded\", (event) => {\n if (event.target === this._channel) {\n this.triggerProducerAdded(event.detail);\n }\n });\n\n this._channel.addEventListener(\"producerRemoved\", (event) => {\n if (event.target === this._channel) {\n this.triggerProducerRemoved(event.detail.id);\n }\n });\n }\n\n triggerConnected(clientId) {\n for (const listener of this._connectionListeners) {\n try {\n listener.connected(clientId);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerDisconnected() {\n for (const listener of this._connectionListeners) {\n try {\n listener.disconnected();\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerProducerAdded(producer) {\n if (producer.id in this._producers) {\n return;\n }\n\n this._producers[producer.id] = producer;\n for (const listener of this._producersListeners) {\n try {\n listener.producerAdded(producer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n\n triggerProducerRemoved(producerId) {\n if (producerId in this._producers) {\n const producer = this._producers[producerId];\n delete this._producers[producerId];\n\n for (const listener of this._producersListeners) {\n try {\n listener.producerRemoved(producer);\n } catch (ex) {\n console.error(\"a listener callback should not throw any exception\", ex);\n }\n }\n }\n }\n}\n\nGstWebRTCAPI.SessionState = SessionState;\n","/*\n * gstwebrtc-api\n *\n * Copyright (C) 2022 Igalia S.L. \n * Author: Loïc Le Page \n *\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nimport \"webrtc-adapter\";\nimport GstWebRTCAPI from \"./gstwebrtc-api.js\";\n\n/**\n * @external MediaStream\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaStream\n */\n/**\n * @external RTCPeerConnection\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection\n */\n/**\n * @external RTCDataChannel\n * @see https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel\n */\n/**\n * @external EventTarget\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n */\n/**\n * @external Event\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Event\n */\n/**\n * @external ErrorEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent\n */\n/**\n * @external CustomEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent\n */\n/**\n * @external Error\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error\n */\n/**\n * @external HTMLVideoElement\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement\n */\n\nif (!window.GstWebRTCAPI) {\n window.GstWebRTCAPI = GstWebRTCAPI;\n}\n"],"names":["SDPUtils","Math","random","toString","substring","localCName","generateIdentifier","splitLines","blob","trim","split","map","line","splitSections","part","index","getDescription","sections","getMediaSections","shift","matchPrefix","prefix","filter","indexOf","parseCandidate","parts","candidate","foundation","component","protocol","toLowerCase","priority","parseInt","ip","address","port","type","i","length","relatedAddress","relatedPort","tcpType","ufrag","usernameFragment","undefined","writeCandidate","sdp","push","toUpperCase","join","parseIceOptions","parseRtpMap","parsed","payloadType","name","clockRate","channels","numChannels","writeRtpMap","codec","pt","preferredPayloadType","parseExtmap","id","direction","uri","attributes","slice","writeExtmap","headerExtension","preferredId","parseFmtp","kv","j","writeFmtp","parameters","Object","keys","params","forEach","param","parseRtcpFb","parameter","writeRtcpFb","lines","rtcpFeedback","fb","parseSsrcMedia","sp","ssrc","colon","attribute","value","parseSsrcGroup","semantics","ssrcs","getMid","mediaSection","mid","parseFingerprint","algorithm","getDtlsParameters","sessionpart","role","fingerprints","writeDtlsParameters","setupType","fp","parseCryptoLine","tag","cryptoSuite","keyParams","sessionParams","writeCryptoLine","writeCryptoKeyParams","parseCryptoKeyParams","keyMethod","keySalt","lifeTime","mkiValue","mkiLength","getCryptoParameters","getIceParameters","pwd","password","writeIceParameters","iceLite","parseRtpParameters","description","codecs","headerExtensions","fecMechanisms","rtcp","mline","profile","rtpmapline","fmtps","wildcardRtcpFb","find","existingFeedback","writeRtpDescription","kind","caps","maxptime","extension","parseRtpEncodingParameters","encodingParameters","hasRed","hasUlpfec","primarySsrc","secondarySsrc","flows","apt","encParam","codecPayloadType","rtx","JSON","parse","stringify","fec","mechanism","bandwidth","maxBitrate","parseRtcpParameters","rtcpParameters","remoteSsrc","obj","cname","rsize","reducedSize","compound","mux","writeRtcpParameters","parseMsid","spec","stream","track","planB","msidParts","parseSctpDescription","parseMLine","maxSizeLine","maxMessageSize","isNaN","sctpPort","fmt","sctpMapLines","writeSctpDescription","media","sctp","output","generateSessionId","substr","writeSessionBoilerplate","sessId","sessVer","sessUser","sessionId","version","getDirection","getKind","isRejected","parseOLine","username","sessionVersion","netType","addressType","isValidSDP","charAt","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","defineProperty","enumerable","get","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","logDisabled_","deprecationWarnings_","extractVersion","uastring","expr","pos","match","wrapPeerConnectionEvent","window","eventNameToWrap","wrapper","RTCPeerConnection","proto","nativeAddEventListener","addEventListener","nativeEventName","cb","apply","this","arguments","wrappedCallback","e","modifiedEvent","handleEvent","_eventMap","Map","set","nativeRemoveEventListener","removeEventListener","has","unwrappedCb","delete","size","configurable","disableLog","bool","Error","disableWarnings","log","console","deprecated","oldMethod","newMethod","warn","isObject","val","compactObject","data","reduce","accumulator","isObj","isEmptyObject","assign","walkStats","stats","base","resultSet","endsWith","filterStats","result","outbound","streamStatsType","filteredResult","trackStats","trackIdentifier","trackStat","trackId","logging","shimGetUserMedia","browserDetails","navigator","mediaDevices","constraintsToChrome_","c","mandatory","optional","cc","ideal","exact","min","max","oldname_","oc","mix","advanced","concat","shimConstraints_","constraints","func","audio","remap","b","video","face","facingMode","getSupportedFacingModeLies","getSupportedConstraints","matches","enumerateDevices","then","devices","dev","some","label","includes","deviceId","shimError_","PermissionDeniedError","PermissionDismissedError","InvalidStateError","DevicesNotFoundError","ConstraintNotSatisfiedError","TrackStartError","MediaDeviceFailedDueToShutdown","MediaDeviceKillSwitchOn","TabCaptureError","ScreenCaptureError","DeviceCaptureError","message","constraint","constraintName","getUserMedia","onSuccess","onError","webkitGetUserMedia","bind","origGetUserMedia","cs","getAudioTracks","getVideoTracks","getTracks","stop","DOMException","Promise","reject","shimGetDisplayMedia","getSourceId","getDisplayMedia","sourceId","widthSpecified","width","heightSpecified","height","frameRateSpecified","frameRate","chromeMediaSource","chromeMediaSourceId","maxFrameRate","maxWidth","maxHeight","error","shimMediaStream","MediaStream","webkitMediaStream","shimOnTrack","_ontrack","f","origSetRemoteDescription","setRemoteDescription","_ontrackpoly","te","receiver","getReceivers","event","Event","transceiver","streams","dispatchEvent","shimGetSendersWithDtmf","shimSenderWithDtmf","pc","dtmf","_dtmf","createDTMFSender","_pc","getSenders","_senders","origAddTrack","addTrack","sender","origRemoveTrack","removeTrack","idx","splice","origAddStream","addStream","origRemoveStream","removeStream","s","RTCRtpSender","origGetSenders","senders","shimGetStats","origGetStats","getStats","selector","onSucc","onErr","fixChromeStats_","response","standardReport","report","standardStats","timestamp","localcandidate","remotecandidate","names","stat","makeMapStats","successCallbackWrapper_","resolve","shimSenderReceiverGetStats","RTCRtpReceiver","origGetReceivers","receivers","srcElement","MediaStreamTrack","err","shimAddTrackRemoveTrackWithNative","getLocalStreams","_shimmedLocalStreams","streamId","existingSenders","newSenders","newSender","shimAddTrackRemoveTrack","origGetLocalStreams","nativeStreams","_reverseStreams","_streams","newStream","replaceInternalStreamId","internalId","externalStream","internalStream","replace","RegExp","RTCSessionDescription","signalingState","t","oldStream","method","nativeMethod","methodObj","args","desc","origSetLocalDescription","setLocalDescription","replaceExternalStreamId","origLocalDescription","getOwnPropertyDescriptor","streamid","shimPeerConnection","webkitRTCPeerConnection","RTCIceCandidate","fixNegotiationNeeded","target","getConfiguration","sdpSemantics","nativeGetUserMedia","getSettings","nativeGetSettings","applyConstraints","nativeApplyConstraints","preferredMediaSource","code","mediaSource","RTCTrackEvent","mozRTCPeerConnection","modernStatsTypes","inboundrtp","outboundrtp","candidatepair","nativeGetStats","shimSenderGetStats","shimReceiverGetStats","shimRemoveStream","shimRTCDataChannel","DataChannel","RTCDataChannel","shimAddTransceiver","origAddTransceiver","addTransceiver","setParametersPromises","sendEncodings","shouldPerformCheck","encodingParam","test","rid","TypeError","parseFloat","scaleResolutionDownBy","RangeError","maxFramerate","getParameters","encodings","setParameters","catch","shimGetParameters","origGetParameters","shimCreateOffer","origCreateOffer","createOffer","all","finally","shimCreateAnswer","origCreateAnswer","createAnswer","shimLocalStreamsAPI","_localStreams","_addTrack","tracks","shimRemoteStreamsAPI","getRemoteStreams","_remoteStreams","_onaddstream","_onaddstreampoly","shimCallbacksAPI","addIceCandidate","successCallback","failureCallback","options","promise","withCallback","_getUserMedia","shimConstraints","errcb","shimRTCIceServerUrls","OrigPeerConnection","pcConfig","pcConstraints","iceServers","newIceServers","server","urls","url","generateCertificate","shimTrackEventTransceiver","shimCreateOfferLegacy","offerOptions","offerToReceiveAudio","audioTransceiver","getTransceivers","setDirection","offerToReceiveVideo","videoTransceiver","shimAudioContext","AudioContext","webkitAudioContext","shimRTCIceCandidate","NativeRTCIceCandidate","nativeCandidate","parsedCandidate","toJSON","sdpMid","sdpMLineIndex","writable","shimRTCIceCandidateRelayProtocol","relayProtocol","shimMaxMessageSize","_sctp","browser","mLine","sctpInDescription","isFirefox","getRemoteFirefoxVersion","canSendMMS","remoteIsFirefox","canSendMaxMessageSize","getCanSendMaxMessageSize","remoteMMS","getMaxMessageSize","Number","POSITIVE_INFINITY","shimSendThrowTypeError","wrapDcSend","dc","origDataChannelSend","send","byteLength","readyState","origCreateDataChannel","createDataChannel","dataChannel","channel","shimConnectionState","completed","checking","iceConnectionState","_onconnectionstatechange","origMethod","_connectionstatechangepoly","_lastConnectionState","connectionState","newEvent","removeExtmapAllowMixed","nativeSRD","shimAddIceCandidateNullOrEmpty","nativeAddIceCandidate","shimParameterlessSetLocalDescription","nativeSetLocalDescription","shimChrome","shimFirefox","shimSafari","userAgent","mozGetUserMedia","isSecureContext","supportsUnifiedPlan","RTCRtpTransceiver","adapter","commonShim","browserShim","adapterFactory","defaultConfig","freeze","meta","signalingServerUrl","reconnectionTimeout","webrtcConfig","SessionState","idle","connecting","streaming","closed","WebRTCSession","EventTarget","constructor","peerId","comChannel","super","_peerId","_sessionId","_comChannel","_state","_rtcPeerConnection","state","rtcPeerConnection","close","uniToKeySyms","kbEventCodesToKeySyms","knownKbEventCodes","Set","getKeysymString","keySym","keyCodeUni","charCodeAt","eventsNames","mouseEventsNames","mousemove","mousedown","mouseup","touchEventsNames","touchstart","touchend","touchmove","touchcancel","keyboardEventsNames","keydown","keyup","getModifiers","modifiers","altKey","ctrlKey","metaKey","shiftKey","RemoteController","rtcDataChannel","consumerSession","_rtcDataChannel","_consumerSession","_videoElement","_videoElementComputedStyle","_videoElementKeyboard","_lastTouchEventTimestamp","ErrorEvent","videoElement","attachVideoElement","element","HTMLVideoElement","getComputedStyle","eventName","setAttribute","previousElement","removeAttribute","_sendGstNavigationEvent","ex","_computeVideoMousePosition","mousePos","x","y","videoWidth","videoHeight","padding","paddingLeft","paddingRight","paddingTop","paddingBottom","offsetX","offsetY","clientRect","getBoundingClientRect","border","left","borderLeftWidth","top","borderTopWidth","clientX","clientY","videoOffset","clientWidth","clientHeight","ratio","invRatio","preventDefault","delta_x","deltaX","delta_y","deltaY","modifier_state","button","focus","touch","changedTouches","identifier","pressure","force","timeStamp","ConsumerSession","_remoteController","remoteController","connect","msg","onSessionStarted","onSessionPeerMessage","connection","ontrack","streamsChanged","ondatachannel","previousController","onicecandidate","ice","localDescription","ClientSession","ProducerSession","_stream","_clientSessions","start","roles","clientSession","values","onProducerRegistered","onStartSessionMessage","session","CustomEvent","detail","onEndSessionMessage","SignallingServerMessageType","welcome","peerStatusChanged","list","sessionStarted","peer","startSession","endSession","normalizeProducer","producer","excludedId","normalizedProducer","ComChannel","_meta","_webrtcConfig","_ws","WebSocket","_ready","_channelId","_producerSession","_consumerSessions","onerror","onclose","closeAllConsumerSessions","onmessage","producers","getConsumerSession","details","ready","channelId","producerSession","createProducerSession","createConsumerSession","producerId","GstWebRTCAPI","userConfig","_channel","_producers","_connectionListeners","_producersListeners","config","_config","connectChannel","registerConnectionListener","listener","unregisterConnectionListener","unregisterAllConnectionListeners","getAvailableProducers","registerProducersListener","unregisterProducersListener","unregisterAllProducersListeners","oldChannel","triggerProducerRemoved","triggerDisconnected","setTimeout","triggerConnected","triggerProducerAdded","clientId","connected","disconnected","producerAdded","producerRemoved"],"sourceRoot":""} \ No newline at end of file diff --git a/ui/static/package-lock.json b/ui/static/package-lock.json new file mode 100644 index 0000000..4f8c786 --- /dev/null +++ b/ui/static/package-lock.json @@ -0,0 +1,30 @@ +{ + "name": "vcs-controller", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "vcs-controller", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@tauri-apps/api": "^1.6.0" + } + }, + "node_modules/@tauri-apps/api": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-1.6.0.tgz", + "integrity": "sha512-rqI++FWClU5I2UBp4HXFvl+sBWkdigBkxnpJDQUWttNyG7IZP4FwQGhTNL5EOw0vI8i6eSAJ5frLqO7n7jbJdg==", + "engines": { + "node": ">= 14.6.0", + "npm": ">= 6.6.0", + "yarn": ">= 1.19.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/tauri" + } + } + } +} diff --git a/ui/static/package.json b/ui/static/package.json new file mode 100644 index 0000000..6f5311f --- /dev/null +++ b/ui/static/package.json @@ -0,0 +1,14 @@ +{ + "name": "vcs-controller", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "@tauri-apps/api": "^1.6.0" + } +} diff --git a/ui/static/rtc.js b/ui/static/rtc.js index 76fe93d..ff8feee 100644 --- a/ui/static/rtc.js +++ b/ui/static/rtc.js @@ -1,4 +1,6 @@ +import { emit, listen } from '@tauri-apps/api/event'; + const videoview = document.getElementById("remoteview"); const config = { @@ -6,11 +8,8 @@ const config = { }; const polite = true; -const signaler = new SignalingChannel(); const pc = new RTCPeerConnection(config); -const constraints = { audio: false, video: true }; - pc.ontrack = ({ track, streams }) => { track.onunmute = () => { if (remoteview.srcObject) { @@ -26,7 +25,7 @@ pc.onnegotionationneeded = async () => { try { makingOffer = true; await pc.setLocalDescription(); - signaler.send({ description: pc.localDescription }); + emit("webrtc-event", { description: pc.localDescription }); } catch (err) { console.error(err); } finally { @@ -34,7 +33,7 @@ pc.onnegotionationneeded = async () => { } }; -pc.onicecandidate = ({ candidate }) => signaler.send({ candidate }); +pc.onicecandidate = ({ candidate }) => emit("webrtc-event", { candidate }); pc.oniceconnectionstatechange = () => { if (pc.iceConnectionState === "failed") { pc.restartIce(); @@ -43,7 +42,12 @@ pc.oniceconnectionstatechange = () => { let ignoreOffer = false; -signaler.onmessage = async ({ data: { description, candidate } }) => { +const application_message = await listen('frontend_message', async (event) => { + console.log("Event: "); + console.log(event); + + const { description, candidate } = event.payload.data; + try { if (description) { const offerCollision = @@ -59,7 +63,7 @@ signaler.onmessage = async ({ data: { description, candidate } }) => { await pc.setRemoteDescription(description); if (description.type === "offer") { await pc.setLocalDescription(); - signaler.send({ description: pc.localDescription }); + emit( "webrtc-event", { description: pc.localDescription }); } } else if (candidate) { try { @@ -73,7 +77,9 @@ signaler.onmessage = async ({ data: { description, candidate } }) => { } catch (err) { console.error(err); } -}; + +}); + async function start_rtc_connection() { }