@whereby.com/browser-sdk 2.0.0-alpha27 → 2.0.0-alpha28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/embed/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { define, ref } from 'heresy';
|
|
2
2
|
|
|
3
|
-
const sdkVersion = "2.0.0-
|
|
3
|
+
const sdkVersion = "2.0.0-alpha28";
|
|
4
4
|
|
|
5
5
|
const boolAttrs = [
|
|
6
6
|
"audio",
|
|
@@ -113,7 +113,7 @@ define("WherebyEmbed", {
|
|
|
113
113
|
if (roomUrl.searchParams.get("roomKey")) {
|
|
114
114
|
this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
|
|
115
115
|
}
|
|
116
|
-
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-
|
|
116
|
+
Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha28", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (externalId && { externalId })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
|
|
117
117
|
// add to URL if set in any way
|
|
118
118
|
(o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
|
|
119
119
|
if (!this.url.searchParams.has(k) && typeof v === "string") {
|
package/dist/react/index.esm.js
CHANGED
|
@@ -3,7 +3,6 @@ import adapter from 'webrtc-adapter';
|
|
|
3
3
|
import { io } from 'socket.io-client';
|
|
4
4
|
import SDPUtils from 'sdp';
|
|
5
5
|
import * as sdpTransform from 'sdp-transform';
|
|
6
|
-
import rtcstats from 'rtcstats';
|
|
7
6
|
import { v4 } from 'uuid';
|
|
8
7
|
import { detectDevice, Device } from 'mediasoup-client';
|
|
9
8
|
import EventEmitter$1, { EventEmitter } from 'events';
|
|
@@ -1751,6 +1750,402 @@ class Session {
|
|
|
1751
1750
|
}
|
|
1752
1751
|
}
|
|
1753
1752
|
|
|
1753
|
+
// transforms a maplike to an object. Mostly for getStats +
|
|
1754
|
+
// JSON.parse(JSON.stringify())
|
|
1755
|
+
function map2obj(m) {
|
|
1756
|
+
if (!m.entries) {
|
|
1757
|
+
return m;
|
|
1758
|
+
}
|
|
1759
|
+
var o = {};
|
|
1760
|
+
m.forEach(function(v, k) {
|
|
1761
|
+
o[k] = v;
|
|
1762
|
+
});
|
|
1763
|
+
return o;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
// apply a delta compression to the stats report. Reduces size by ~90%.
|
|
1767
|
+
// To reduce further, report keys could be compressed.
|
|
1768
|
+
function deltaCompression(oldStats, newStats) {
|
|
1769
|
+
newStats = JSON.parse(JSON.stringify(newStats));
|
|
1770
|
+
Object.keys(newStats).forEach(function(id) {
|
|
1771
|
+
var report = newStats[id];
|
|
1772
|
+
delete report.id;
|
|
1773
|
+
if (!oldStats[id]) {
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
Object.keys(report).forEach(function(name) {
|
|
1777
|
+
if (report[name] === oldStats[id][name]) {
|
|
1778
|
+
delete newStats[id][name];
|
|
1779
|
+
}
|
|
1780
|
+
if (Object.keys(report).length === 0) {
|
|
1781
|
+
delete newStats[id];
|
|
1782
|
+
} else if (Object.keys(report).length === 1 && report.timestamp) {
|
|
1783
|
+
delete newStats[id];
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
});
|
|
1787
|
+
|
|
1788
|
+
var timestamp = -Infinity;
|
|
1789
|
+
Object.keys(newStats).forEach(function(id) {
|
|
1790
|
+
var report = newStats[id];
|
|
1791
|
+
if (report.timestamp > timestamp) {
|
|
1792
|
+
timestamp = report.timestamp;
|
|
1793
|
+
}
|
|
1794
|
+
});
|
|
1795
|
+
Object.keys(newStats).forEach(function(id) {
|
|
1796
|
+
var report = newStats[id];
|
|
1797
|
+
if (report.timestamp === timestamp) {
|
|
1798
|
+
report.timestamp = 0;
|
|
1799
|
+
}
|
|
1800
|
+
});
|
|
1801
|
+
newStats.timestamp = timestamp;
|
|
1802
|
+
return newStats;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
function dumpStream(stream) {
|
|
1806
|
+
return {
|
|
1807
|
+
id: stream.id,
|
|
1808
|
+
tracks: stream.getTracks().map(function(track) {
|
|
1809
|
+
return {
|
|
1810
|
+
id: track.id, // unique identifier (GUID) for the track
|
|
1811
|
+
kind: track.kind, // `audio` or `video`
|
|
1812
|
+
label: track.label, // identified the track source
|
|
1813
|
+
enabled: track.enabled, // application can control it
|
|
1814
|
+
muted: track.muted, // application cannot control it (read-only)
|
|
1815
|
+
readyState: track.readyState, // `live` or `ended`
|
|
1816
|
+
};
|
|
1817
|
+
}),
|
|
1818
|
+
};
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
/*
|
|
1822
|
+
function filterBoringStats(results) {
|
|
1823
|
+
Object.keys(results).forEach(function(id) {
|
|
1824
|
+
switch (results[id].type) {
|
|
1825
|
+
case 'certificate':
|
|
1826
|
+
case 'codec':
|
|
1827
|
+
delete results[id];
|
|
1828
|
+
break;
|
|
1829
|
+
default:
|
|
1830
|
+
// noop
|
|
1831
|
+
}
|
|
1832
|
+
});
|
|
1833
|
+
return results;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
function removeTimestamps(results) {
|
|
1837
|
+
// FIXME: does not work in FF since the timestamp can't be deleted.
|
|
1838
|
+
Object.keys(results).forEach(function(id) {
|
|
1839
|
+
delete results[id].timestamp;
|
|
1840
|
+
});
|
|
1841
|
+
return results;
|
|
1842
|
+
}
|
|
1843
|
+
*/
|
|
1844
|
+
|
|
1845
|
+
var rtcstats = function(trace, getStatsInterval, prefixesToWrap) {
|
|
1846
|
+
var peerconnectioncounter = 0;
|
|
1847
|
+
var isFirefox = !!window.mozRTCPeerConnection;
|
|
1848
|
+
var isEdge = !!window.RTCIceGatherer;
|
|
1849
|
+
prefixesToWrap.forEach(function(prefix) {
|
|
1850
|
+
if (!window[prefix + 'RTCPeerConnection']) {
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
if (prefix === 'webkit' && isEdge) {
|
|
1854
|
+
// dont wrap webkitRTCPeerconnection in Edge.
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
var origPeerConnection = window[prefix + 'RTCPeerConnection'];
|
|
1858
|
+
var peerconnection = function(config, constraints) {
|
|
1859
|
+
var pc = new origPeerConnection(config, constraints);
|
|
1860
|
+
var id = 'PC_' + peerconnectioncounter++;
|
|
1861
|
+
pc.__rtcStatsId = id;
|
|
1862
|
+
|
|
1863
|
+
if (!config) {
|
|
1864
|
+
config = { nullConfig: true };
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
config = JSON.parse(JSON.stringify(config)); // deepcopy
|
|
1868
|
+
// don't log credentials
|
|
1869
|
+
((config && config.iceServers) || []).forEach(function(server) {
|
|
1870
|
+
delete server.credential;
|
|
1871
|
+
});
|
|
1872
|
+
|
|
1873
|
+
if (isFirefox) {
|
|
1874
|
+
config.browserType = 'moz';
|
|
1875
|
+
} else if (isEdge) {
|
|
1876
|
+
config.browserType = 'edge';
|
|
1877
|
+
} else {
|
|
1878
|
+
config.browserType = 'webkit';
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
trace('create', id, config);
|
|
1882
|
+
// TODO: do we want to log constraints here? They are chrome-proprietary.
|
|
1883
|
+
// http://stackoverflow.com/questions/31003928/what-do-each-of-these-experimental-goog-rtcpeerconnectionconstraints-do
|
|
1884
|
+
if (constraints) {
|
|
1885
|
+
trace('constraints', id, constraints);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
pc.addEventListener('icecandidate', function(e) {
|
|
1889
|
+
trace('onicecandidate', id, e.candidate);
|
|
1890
|
+
});
|
|
1891
|
+
pc.addEventListener('addstream', function(e) {
|
|
1892
|
+
trace('onaddstream', id, e.stream.id + ' ' + e.stream.getTracks().map(function(t) { return t.kind + ':' + t.id; }));
|
|
1893
|
+
});
|
|
1894
|
+
pc.addEventListener('track', function(e) {
|
|
1895
|
+
trace('ontrack', id, e.track.kind + ':' + e.track.id + ' ' + e.streams.map(function(stream) { return 'stream:' + stream.id; }));
|
|
1896
|
+
});
|
|
1897
|
+
pc.addEventListener('removestream', function(e) {
|
|
1898
|
+
trace('onremovestream', id, e.stream.id + ' ' + e.stream.getTracks().map(function(t) { return t.kind + ':' + t.id; }));
|
|
1899
|
+
});
|
|
1900
|
+
pc.addEventListener('signalingstatechange', function() {
|
|
1901
|
+
trace('onsignalingstatechange', id, pc.signalingState);
|
|
1902
|
+
});
|
|
1903
|
+
pc.addEventListener('iceconnectionstatechange', function() {
|
|
1904
|
+
trace('oniceconnectionstatechange', id, pc.iceConnectionState);
|
|
1905
|
+
});
|
|
1906
|
+
pc.addEventListener('icegatheringstatechange', function() {
|
|
1907
|
+
trace('onicegatheringstatechange', id, pc.iceGatheringState);
|
|
1908
|
+
});
|
|
1909
|
+
pc.addEventListener('connectionstatechange', function() {
|
|
1910
|
+
trace('onconnectionstatechange', id, pc.connectionState);
|
|
1911
|
+
});
|
|
1912
|
+
pc.addEventListener('negotiationneeded', function() {
|
|
1913
|
+
trace('onnegotiationneeded', id, undefined);
|
|
1914
|
+
});
|
|
1915
|
+
pc.addEventListener('datachannel', function(event) {
|
|
1916
|
+
trace('ondatachannel', id, [event.channel.id, event.channel.label]);
|
|
1917
|
+
});
|
|
1918
|
+
|
|
1919
|
+
var prev = {};
|
|
1920
|
+
var getStats = function() {
|
|
1921
|
+
pc.getStats(null).then(function(res) {
|
|
1922
|
+
var now = map2obj(res);
|
|
1923
|
+
var base = JSON.parse(JSON.stringify(now)); // our new prev
|
|
1924
|
+
trace('getstats', id, deltaCompression(prev, now));
|
|
1925
|
+
prev = base;
|
|
1926
|
+
});
|
|
1927
|
+
};
|
|
1928
|
+
// TODO: do we want one big interval and all peerconnections
|
|
1929
|
+
// queried in that or one setInterval per PC?
|
|
1930
|
+
// we have to collect results anyway so...
|
|
1931
|
+
if (!isEdge && getStatsInterval) {
|
|
1932
|
+
var interval = window.setInterval(function() {
|
|
1933
|
+
if (pc.signalingState === 'closed') {
|
|
1934
|
+
window.clearInterval(interval);
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
getStats();
|
|
1938
|
+
}, getStatsInterval);
|
|
1939
|
+
}
|
|
1940
|
+
if (!isEdge) {
|
|
1941
|
+
pc.addEventListener('connectionstatechange', function() {
|
|
1942
|
+
if (pc.connectionState === 'connected' || pc.connectionState === 'failed') {
|
|
1943
|
+
getStats();
|
|
1944
|
+
}
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
return pc;
|
|
1948
|
+
};
|
|
1949
|
+
|
|
1950
|
+
['createDataChannel', 'close'].forEach(function(method) {
|
|
1951
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
1952
|
+
if (nativeMethod) {
|
|
1953
|
+
origPeerConnection.prototype[method] = function() {
|
|
1954
|
+
trace(method, this.__rtcStatsId, arguments);
|
|
1955
|
+
return nativeMethod.apply(this, arguments);
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
|
|
1960
|
+
['addStream', 'removeStream'].forEach(function(method) {
|
|
1961
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
1962
|
+
if (nativeMethod) {
|
|
1963
|
+
origPeerConnection.prototype[method] = function() {
|
|
1964
|
+
var stream = arguments[0];
|
|
1965
|
+
var streamInfo = stream.getTracks().map(function(t) {
|
|
1966
|
+
return t.kind + ':' + t.id;
|
|
1967
|
+
}).join(',');
|
|
1968
|
+
|
|
1969
|
+
trace(method, this.__rtcStatsId, stream.id + ' ' + streamInfo);
|
|
1970
|
+
return nativeMethod.apply(this, arguments);
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
});
|
|
1974
|
+
|
|
1975
|
+
['addTrack'].forEach(function(method) {
|
|
1976
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
1977
|
+
if (nativeMethod) {
|
|
1978
|
+
origPeerConnection.prototype[method] = function() {
|
|
1979
|
+
var track = arguments[0];
|
|
1980
|
+
var streams = [].slice.call(arguments, 1);
|
|
1981
|
+
trace(method, this.__rtcStatsId, track.kind + ':' + track.id + ' ' + (streams.map(function(s) { return 'stream:' + s.id; }).join(';') || '-'));
|
|
1982
|
+
return nativeMethod.apply(this, arguments);
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
});
|
|
1986
|
+
|
|
1987
|
+
['removeTrack'].forEach(function(method) {
|
|
1988
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
1989
|
+
if (nativeMethod) {
|
|
1990
|
+
origPeerConnection.prototype[method] = function() {
|
|
1991
|
+
var track = arguments[0].track;
|
|
1992
|
+
trace(method, this.__rtcStatsId, track ? track.kind + ':' + track.id : 'null');
|
|
1993
|
+
return nativeMethod.apply(this, arguments);
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
});
|
|
1997
|
+
|
|
1998
|
+
['createOffer', 'createAnswer'].forEach(function(method) {
|
|
1999
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
2000
|
+
if (nativeMethod) {
|
|
2001
|
+
origPeerConnection.prototype[method] = function() {
|
|
2002
|
+
var rtcStatsId = this.__rtcStatsId;
|
|
2003
|
+
var args = arguments;
|
|
2004
|
+
var opts;
|
|
2005
|
+
if (arguments.length === 1 && typeof arguments[0] === 'object') {
|
|
2006
|
+
opts = arguments[0];
|
|
2007
|
+
} else if (arguments.length === 3 && typeof arguments[2] === 'object') {
|
|
2008
|
+
opts = arguments[2];
|
|
2009
|
+
}
|
|
2010
|
+
trace(method, this.__rtcStatsId, opts);
|
|
2011
|
+
return nativeMethod.apply(this, opts ? [opts] : undefined)
|
|
2012
|
+
.then(function(description) {
|
|
2013
|
+
trace(method + 'OnSuccess', rtcStatsId, description);
|
|
2014
|
+
if (args.length > 0 && typeof args[0] === 'function') {
|
|
2015
|
+
args[0].apply(null, [description]);
|
|
2016
|
+
return undefined;
|
|
2017
|
+
}
|
|
2018
|
+
return description;
|
|
2019
|
+
}, function(err) {
|
|
2020
|
+
trace(method + 'OnFailure', rtcStatsId, err.toString());
|
|
2021
|
+
if (args.length > 1 && typeof args[1] === 'function') {
|
|
2022
|
+
args[1].apply(null, [err]);
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
2025
|
+
throw err;
|
|
2026
|
+
});
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
});
|
|
2030
|
+
|
|
2031
|
+
['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function(method) {
|
|
2032
|
+
var nativeMethod = origPeerConnection.prototype[method];
|
|
2033
|
+
if (nativeMethod) {
|
|
2034
|
+
origPeerConnection.prototype[method] = function() {
|
|
2035
|
+
var rtcStatsId = this.__rtcStatsId;
|
|
2036
|
+
var args = arguments;
|
|
2037
|
+
trace(method, this.__rtcStatsId, args[0]);
|
|
2038
|
+
return nativeMethod.apply(this, [args[0]])
|
|
2039
|
+
.then(function() {
|
|
2040
|
+
trace(method + 'OnSuccess', rtcStatsId, undefined);
|
|
2041
|
+
if (args.length >= 2 && typeof args[1] === 'function') {
|
|
2042
|
+
args[1].apply(null, []);
|
|
2043
|
+
return undefined;
|
|
2044
|
+
}
|
|
2045
|
+
return undefined;
|
|
2046
|
+
}, function(err) {
|
|
2047
|
+
trace(method + 'OnFailure', rtcStatsId, err.toString());
|
|
2048
|
+
if (args.length >= 3 && typeof args[2] === 'function') {
|
|
2049
|
+
args[2].apply(null, [err]);
|
|
2050
|
+
return undefined;
|
|
2051
|
+
}
|
|
2052
|
+
throw err;
|
|
2053
|
+
});
|
|
2054
|
+
};
|
|
2055
|
+
}
|
|
2056
|
+
});
|
|
2057
|
+
|
|
2058
|
+
// wrap static methods. Currently just generateCertificate.
|
|
2059
|
+
if (origPeerConnection.generateCertificate) {
|
|
2060
|
+
Object.defineProperty(peerconnection, 'generateCertificate', {
|
|
2061
|
+
get: function() {
|
|
2062
|
+
return arguments.length ?
|
|
2063
|
+
origPeerConnection.generateCertificate.apply(null, arguments)
|
|
2064
|
+
: origPeerConnection.generateCertificate;
|
|
2065
|
+
},
|
|
2066
|
+
});
|
|
2067
|
+
}
|
|
2068
|
+
window[prefix + 'RTCPeerConnection'] = peerconnection;
|
|
2069
|
+
window[prefix + 'RTCPeerConnection'].prototype = origPeerConnection.prototype;
|
|
2070
|
+
});
|
|
2071
|
+
|
|
2072
|
+
// getUserMedia wrappers
|
|
2073
|
+
prefixesToWrap.forEach(function(prefix) {
|
|
2074
|
+
var name = prefix + (prefix.length ? 'GetUserMedia' : 'getUserMedia');
|
|
2075
|
+
if (!navigator[name]) {
|
|
2076
|
+
return;
|
|
2077
|
+
}
|
|
2078
|
+
var origGetUserMedia = navigator[name].bind(navigator);
|
|
2079
|
+
var gum = function() {
|
|
2080
|
+
trace('getUserMedia', null, arguments[0]);
|
|
2081
|
+
var cb = arguments[1];
|
|
2082
|
+
var eb = arguments[2];
|
|
2083
|
+
origGetUserMedia(arguments[0],
|
|
2084
|
+
function(stream) {
|
|
2085
|
+
// we log the stream id, track ids and tracks readystate since that is ended GUM fails
|
|
2086
|
+
// to acquire the cam (in chrome)
|
|
2087
|
+
trace('getUserMediaOnSuccess', null, dumpStream(stream));
|
|
2088
|
+
if (cb) {
|
|
2089
|
+
cb(stream);
|
|
2090
|
+
}
|
|
2091
|
+
},
|
|
2092
|
+
function(err) {
|
|
2093
|
+
trace('getUserMediaOnFailure', null, err.name);
|
|
2094
|
+
if (eb) {
|
|
2095
|
+
eb(err);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
);
|
|
2099
|
+
};
|
|
2100
|
+
navigator[name] = gum.bind(navigator);
|
|
2101
|
+
});
|
|
2102
|
+
|
|
2103
|
+
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
2104
|
+
var origGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
|
|
2105
|
+
var gum = function() {
|
|
2106
|
+
trace('navigator.mediaDevices.getUserMedia', null, arguments[0]);
|
|
2107
|
+
return origGetUserMedia.apply(navigator.mediaDevices, arguments)
|
|
2108
|
+
.then(function(stream) {
|
|
2109
|
+
trace('navigator.mediaDevices.getUserMediaOnSuccess', null, dumpStream(stream));
|
|
2110
|
+
return stream;
|
|
2111
|
+
}, function(err) {
|
|
2112
|
+
trace('navigator.mediaDevices.getUserMediaOnFailure', null, err.name);
|
|
2113
|
+
return Promise.reject(err);
|
|
2114
|
+
});
|
|
2115
|
+
};
|
|
2116
|
+
navigator.mediaDevices.getUserMedia = gum.bind(navigator.mediaDevices);
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
// getDisplayMedia
|
|
2120
|
+
if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
|
|
2121
|
+
var origGetDisplayMedia = navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);
|
|
2122
|
+
var gdm = function() {
|
|
2123
|
+
trace('navigator.mediaDevices.getDisplayMedia', null, arguments[0]);
|
|
2124
|
+
return origGetDisplayMedia.apply(navigator.mediaDevices, arguments)
|
|
2125
|
+
.then(function(stream) {
|
|
2126
|
+
trace('navigator.mediaDevices.getDisplayMediaOnSuccess', null, dumpStream(stream));
|
|
2127
|
+
return stream;
|
|
2128
|
+
}, function(err) {
|
|
2129
|
+
trace('navigator.mediaDevices.getDisplayMediaOnFailure', null, err.name);
|
|
2130
|
+
return Promise.reject(err);
|
|
2131
|
+
});
|
|
2132
|
+
};
|
|
2133
|
+
navigator.mediaDevices.getDisplayMedia = gdm.bind(navigator.mediaDevices);
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// TODO: are there events defined on MST that would allow us to listen when enabled was set?
|
|
2137
|
+
// no :-(
|
|
2138
|
+
/*
|
|
2139
|
+
Object.defineProperty(MediaStreamTrack.prototype, 'enabled', {
|
|
2140
|
+
set: function(value) {
|
|
2141
|
+
trace('MediaStreamTrackEnable', this, value);
|
|
2142
|
+
}
|
|
2143
|
+
});
|
|
2144
|
+
*/
|
|
2145
|
+
};
|
|
2146
|
+
|
|
2147
|
+
var rtcstats$1 = /*@__PURE__*/getDefaultExportFromCjs(rtcstats);
|
|
2148
|
+
|
|
1754
2149
|
// ensure adapter is loaded first.
|
|
1755
2150
|
|
|
1756
2151
|
const RTCSTATS_PROTOCOL_VERSION = "1.0";
|
|
@@ -1881,7 +2276,7 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
1881
2276
|
}
|
|
1882
2277
|
|
|
1883
2278
|
const server = rtcStatsConnection("wss://rtcstats.srv.whereby.com" );
|
|
1884
|
-
rtcstats(
|
|
2279
|
+
rtcstats$1(
|
|
1885
2280
|
server.trace,
|
|
1886
2281
|
10000, // query once every 10 seconds.
|
|
1887
2282
|
[""] // only shim unprefixed RTCPeerConnecion.
|
|
@@ -6856,7 +7251,7 @@ class LocalParticipant extends RoomParticipant {
|
|
|
6856
7251
|
}
|
|
6857
7252
|
}
|
|
6858
7253
|
|
|
6859
|
-
const sdkVersion = "2.0.0-
|
|
7254
|
+
const sdkVersion = "2.0.0-alpha28";
|
|
6860
7255
|
|
|
6861
7256
|
class RoomConnectionEvent extends CustomEvent {
|
|
6862
7257
|
constructor(eventType, eventInitDict) {
|
|
@@ -7,7 +7,7 @@ function v(e){return e.join(h).replace(N,j).replace(C,A)}var b=" \\f\\n\\r\\t",y
|
|
|
7
7
|
/*! (c) Andrea Giammarchi - ISC */
|
|
8
8
|
var R=function(e){var t="fragment",n="template",r="content"in a(n)?function(e){var t=a(n);return t.innerHTML=e,t.content}:function(e){var r=a(t),o=a(n),i=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;o.innerHTML="<table>"+e+"</table>",i=o.querySelectorAll(c)}else o.innerHTML=e,i=o.childNodes;return s(r,i),r};return function(e,t){return("svg"===t?o:r)(e)};function s(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function a(n){return n===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",n)}function o(e){var n=a(t),r=a("div");return r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",s(n,r.firstChild.childNodes),n}}(document),P=(e,t,n,r,s)=>{const a=n.length;let o=t.length,i=a,c=0,l=0,u=null;for(;c<o||l<i;)if(o===c){const t=i<a?l?r(n[l-1],-0).nextSibling:r(n[i-l],0):s;for(;l<i;)e.insertBefore(r(n[l++],1),t)}else if(i===l)for(;c<o;)u&&u.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[l])c++,l++;else if(t[o-1]===n[i-1])o--,i--;else if(t[c]===n[i-1]&&n[l]===t[o-1]){const s=r(t[--o],-1).nextSibling;e.insertBefore(r(n[l++],1),r(t[c++],-1).nextSibling),e.insertBefore(r(n[--i],1),s),t[o]=n[i]}else{if(!u){u=new Map;let e=l;for(;e<i;)u.set(n[e],e++)}if(u.has(t[c])){const s=u.get(t[c]);if(l<s&&s<i){let a=c,h=1;for(;++a<o&&a<i&&u.get(t[a])===s+h;)h++;if(h>s-l){const a=r(t[c],0);for(;l<s;)e.insertBefore(r(n[l++],1),a)}else e.replaceChild(r(n[l++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n},W=function(e,t,n,r,s){var a=s in e,o=e.createDocumentFragment();return o[t](e[r]("g")),o[t](e[r]("")),(a?e[s](o,!0):o[n](!0)).childNodes.length<2?function e(r,s){for(var a=r[n](),o=r.childNodes||[],i=o.length,c=0;s&&c<i;c++)a[t](e(o[c],s));return a}:a?e[s]:function(e,t){return e[n](!!t)}}(document,"appendChild","cloneNode","createTextNode","importNode"),Z="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},B=u?function(e,t){var n=t.join(" ");return t.slice.call(e,0).sort((function(e,t){return n.indexOf(e.name)<=n.indexOf(t.name)?-1:1}))}:function(e,t){return t.slice.call(e,0)};function z(e,t){for(var n=t.length,r=0;r<n;)e=e.childNodes[t[r++]];return e}function D(e,t,n,r){for(var s=e.childNodes,a=s.length,o=0;o<a;){var i=s[o];switch(i.nodeType){case p:var c=r.concat(o);U(i,t,n,c),D(i,t,n,c);break;case f:var u=i.textContent;if(u===l)n.shift(),t.push(g.test(e.nodeName)?I(e,r):F(i,r.concat(o)));else switch(u.slice(0,2)){case"/*":if("*/"!==u.slice(-2))break;case"👻":e.removeChild(i),o--,a--}break;case d:g.test(e.nodeName)&&Z.call(i.textContent)===h&&(n.shift(),t.push(I(e,r)))}o++}}function U(e,t,n,r){for(var s=e.attributes,a=[],o=[],i=B(s,n),c=i.length,f=0;f<c;){var p,d=i[f++],g=d.value===l;if(g||1<(p=d.value.split(h)).length){var m=d.name;if(a.indexOf(m)<0){a.push(m);var v=n.shift().replace(g?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+m+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),b=s[v]||s[v.toLowerCase()];if(g)t.push(H(b,r,v,null));else{for(var y=p.length-2;y--;)n.shift();t.push(H(b,r,v,p))}}o.push(d)}}f=0;for(var w=(0<(c=o.length)&&u&&!("ownerSVGElement"in e));f<c;){var E=o[f++];w&&(E.value=""),e.removeAttribute(E.name)}var x=e.nodeName;if(/^script$/i.test(x)){var C=document.createElement(x);for(c=s.length,f=0;f<c;)C.setAttributeNode(s[f++].cloneNode(!0));C.textContent=e.textContent,e.parentNode.replaceChild(C,e)}}function F(e,t){return{type:"any",node:e,path:t}}function H(e,t,n,r){return{type:"attr",node:e,path:t,name:n,sparse:r}}function I(e,t){return{type:"text",node:e,path:t}}var V=L(new t);function q(e,t){var n=(e.convert||v)(t),r=e.transform;r&&(n=r(n));var s=R(n,e.type);J(s);var a=[];return D(s,a,t.slice(0),[]),{content:s,updates:function(n){for(var r=[],s=a.length,o=0,i=0;o<s;){var c=a[o++],l=z(n,c.path);switch(c.type){case"any":r.push({fn:e.any(l,[]),sparse:!1});break;case"attr":var u=c.sparse,h=e.attribute(l,c.name,c.node);null===u?r.push({fn:h,sparse:!1}):(i+=u.length-2,r.push({fn:h,sparse:!0,values:u}));break;case"text":r.push({fn:e.text(l),sparse:!1}),l.textContent=""}}return s+=i,function(){var e=arguments.length;if(s!==e-1)throw new Error(e-1+" values instead of "+s+"\n"+t.join("${value}"));for(var a=1,o=1;a<e;){var i=r[a-o];if(i.sparse){var c=i.values,l=c[0],u=1,h=c.length;for(o+=h-2;u<h;)l+=arguments[a++]+c[u++];i.fn(l)}else i.fn(arguments[a++])}return n}}}}var K=[];function G(e){var t=K,n=J;return function(r){return t!==r&&(n=function(e,t){var n=V.get(t)||V.set(t,q(e,t));return n.updates(W.call(document,n.content,!0))}(e,t=r)),n.apply(null,arguments)}}function J(e){for(var t=e.childNodes,n=t.length;n--;){var r=t[n];1!==r.nodeType&&0===Z.call(r.textContent).length&&e.removeChild(r)}}
|
|
9
9
|
/*! (c) Andrea Giammarchi - ISC */var Q=function(){var e=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,t=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var n;t?n=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),n=e.getAttributeNode("style"));return n.value="",e.setAttributeNode(n),r(n,!0)}(e,t):r(e.style,!1)};function n(e,t,n){return t+"-"+n.toLowerCase()}function r(r,s){var a,o;return function(i){var c,l,u,h;switch(typeof i){case"object":if(i){if("object"===a){if(!s&&o!==i)for(l in o)l in i||(r[l]="")}else s?r.value="":r.cssText="";for(l in c=s?{}:r,i)u="number"!=typeof(h=i[l])||e.test(l)?h:h+"px",!s&&/^--/.test(l)?c.setProperty(l,u):c[l]=u;a="object",s?r.value=function(e){var r,s=[];for(r in e)s.push(r.replace(t,n),":",e[r],";");return s.join("")}(o=c):o=i;break}default:o!=i&&(a="string",o=i,s?r.value=i||"":r.cssText=i||"")}}}}();const X=(e,t)=>{let n,r=!0;const s=document.createAttributeNS(null,t);return t=>{n!==t&&(n=t,null==n?r||(e.removeAttributeNode(s),r=!0):(s.value=t,r&&(e.setAttributeNodeNS(s),r=!1)))}},Y=({dataset:e})=>t=>{for(const n in t){const r=t[n];null==r?delete e[n]:e[n]=r}},ee=(e,t)=>"dataset"===t?Y(e):n=>{e[t]=n},te=/^(?:form|list)$/i,ne=(e,t)=>e.ownerDocument.createTextNode(t);function re(e){return this.type=e,G(this)}function se(e){return e(this)}re.prototype={attribute(e,t,n){const r="svg"===this.type;switch(t){case"class":if(r)return X(e,t);t="className";case"props":return ee(e,t);case"aria":return(e=>t=>{for(const n in t){const r="role"===n?n:`aria-${n}`,s=t[n];null==s?e.removeAttribute(r):e.setAttribute(r,s)}})(e);case"style":return Q(e,n,r);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return Y(e);default:return"."===t.slice(0,1)?ee(e,t.slice(1)):"?"===t.slice(0,1)?((e,t,n)=>r=>{n!==!!r&&((n=!!r)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let n,r=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(r=r.toLowerCase()),t=>{const s=O(t)?t:[t,!1];n!==s[0]&&(n&&e.removeEventListener(r,n,s[1]),(n=s[0])&&e.addEventListener(r,n,s[1]))}})(e,t):!(t in e)||r||te.test(t)?X(e,t):((e,t)=>{let n;return r=>{n!==r&&(n=r,e[t]!==r&&(null==r?(e[t]="",e.removeAttribute(t)):e[t]=r))}})(e,t)}},any(e,t){const{type:n}=this;let r,s=!1;const a=o=>{switch(typeof o){case"string":case"number":case"boolean":s?r!==o&&(r=o,t[0].textContent=o):(s=!0,r=o,t=P(e.parentNode,t,[ne(e,o)],M,e));break;case"function":a(o(e));break;case"object":case"undefined":if(null==o){s=!1,t=P(e.parentNode,t,[],M,e);break}default:if(s=!1,r=o,O(o))if(0===o.length)t.length&&(t=P(e.parentNode,t,[],M,e));else switch(typeof o[0]){case"string":case"number":case"boolean":a(String(o));break;case"function":a(o.map(se,e));break;case"object":O(o[0])&&(o=o.concat.apply([],o));default:t=P(e.parentNode,t,o,M,e)}else"ELEMENT_NODE"in o?t=P(e.parentNode,t,11===o.nodeType?_.call(o.childNodes):[o],M,e):"text"in o?a(String(o.text)):"any"in o?a(o.any):"html"in o?t=P(e.parentNode,t,_.call(R([].concat(o.html).join(""),n).childNodes),M,e):"length"in o&&a(_.call(o))}};return a},text(e){let t;const n=r=>{if(t!==r){t=r;const s=typeof r;"object"===s&&r?"text"in r?n(String(r.text)):"any"in r?n(r.any):"html"in r?n([].concat(r.html).join("")):"length"in r&&n(_.call(r).join("")):"function"===s?n(r(e)):e.textContent=null==r?"":r}};return n}};const{create:ae,freeze:oe,keys:ie}=Object,ce=re.prototype,le=L(new t),ue=e=>({html:fe("html",e),svg:fe("svg",e),render(t,n){const r="function"==typeof n?n():n,s=le.get(t)||le.set(t,he()),a=r instanceof ge?pe(e,s,r):r;return a!==s.wire&&(s.wire=a,t.textContent="",t.appendChild(a.valueOf())),t}}),he=()=>({stack:[],entry:null,wire:null}),fe=(e,n)=>{const r=L(new t);return s.for=(e,t)=>{const a=r.get(e)||r.set(e,ae(null));return a[t]||(a[t]=(e=>function(){return pe(n,e,s.apply(null,arguments))})(he()))},s.node=function(){return pe(n,he(),s.apply(null,arguments)).valueOf()},s;function s(){return new ge(e,ve.apply(null,arguments))}},pe=(e,t,{type:n,template:r,values:s})=>{const{length:a}=s;de(e,t,s,a);let{entry:o}=t;if(o&&o.template===r&&o.type===n)o.tag(r,...s);else{const a=new e(n);t.entry=o={type:n,template:r,tag:a,wire:T(a(r,...s))}}return o.wire},de=(e,{stack:t},n,r)=>{for(let s=0;s<r;s++){const r=n[s];r instanceof me?n[s]=pe(e,t[s]||(t[s]=he()),r):O(r)?de(e,t[s]||(t[s]=he()),r,r.length):t[s]=null}r<t.length&&t.splice(r)};function ge(e,t){this.type=e,this.template=t.shift(),this.values=t}oe(ge);const me=ge;function ve(){let e=[],t=0,{length:n}=arguments;for(;t<n;)e.push(arguments[t++]);return e}ue(re);var be="function"==typeof cancelAnimationFrame,ye=be?cancelAnimationFrame:clearTimeout,we=be?requestAnimationFrame:setTimeout;function Ee(e){var t,n,r,s,a;return i(),function(e,i,l){return r=e,s=i,a=l,n||(n=we(o)),--t<0&&c(!0),c};function o(){i(),r.apply(s,a||[])}function i(){t=e||1/0,n=be?0:null}function c(e){var t=!!n;return t&&(ye(n),e&&o()),t}}
|
|
10
|
-
/*! (c) Andrea Giammarchi - ISC */let xe=null;const Ce=L(new WeakMap),Ne=(e,t,n)=>{e.apply(t,n)},ke={async:!1,always:!1},Ae=(e,t)=>"function"==typeof t?t(e):t,$e=(e,t,n,r)=>{const s=xe.i++,{hook:a,args:o,stack:i,length:c}=xe;s===c&&(xe.length=i.push({}));const l=i[s];if(l.args=o,s===c){const s="function"==typeof n,{async:o,always:i}=(s?r:n)||r||ke;l.$=s?n(t):Ae(void 0,t),l._=o?Ce.get(a)||Ce.set(a,Ee()):Ne,l.f=t=>{const n=e(l.$,t);(i||l.$!==n)&&(l.$=n,l._(a,null,l.args))}}return[l.$,l.f]},je=new WeakMap;function Oe({hook:e}){return e===this.hook}const Se=new WeakMap,_e=L(Se),Le=()=>{},Me=e=>(t,n)=>{const r=xe.i++,{hook:s,after:a,stack:o,length:i}=xe;if(r<i){const s=o[r],{update:i,values:c,stop:l}=s;if(!n||n.some(Ze,c)){s.values=n,e&&l(e);const{clean:r}=s;r&&(s.clean=null,r());const o=()=>{s.clean=t()};e?i(o):a.push(o)}}else{const r=e?Ee():Le,i={clean:null,update:r,values:n,stop:Le};xe.length=o.push(i),(_e.get(s)||_e.set(s,[])).push(i);const c=()=>{i.clean=t()};e?i.stop=r(c):a.push(c)}},Te=e=>{(Se.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};Se.has.bind(Se);const Re=Me(!0),Pe=Me(!1),We=(e,t)=>{const n=xe.i++,{stack:r,length:s}=xe;return n===s?xe.length=r.push({$:e(),_:t}):t&&!t.some(Ze,r[n]._)||(r[n]={$:e(),_:t}),r[n].$};function Ze(e,t){return e!==this[t]}let Be=null;try{Be=new{o(){}}.o}catch(zt){}let ze=e=>class extends e{};if(Be){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:n}="object"==typeof Reflect?Reflect:{construct(e,n,r){const s=[null];for(let e=0;e<n.length;e++)s.push(n[e]);const a=e.bind.apply(e,s);return t(new a,r.prototype)}};ze=function(r,s){function a(){return n(s?e(r):r,arguments,a)}return t(a.prototype,r.prototype),t(a,r)}}const De={map:{},re:null},Ue=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let Fe=null;const He=(e,t)=>{const{map:n,re:r}=Fe||t;return e.replace(r,((e,t,r,s)=>{const{tagName:a,is:o,element:i}=n[r];return i?t?`</${o}>`:`<${o}${s}`:t?`</${a}>`:`<${a} is="${o}"${s}`}))},Ie=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,Ve=()=>Fe,qe=e=>{Fe=e},Ke={useCallback:(e,t)=>We((()=>e),t),useContext:e=>{const{hook:t,args:n}=xe,r=je.get(e),s={hook:t,args:n};return r.some(Oe,s)||r.push(s),e.value},useEffect:Re,useLayoutEffect:Pe,useMemo:We,useReducer:$e,useRef:e=>{const t=xe.i++,{stack:n,length:r}=xe;return t===r&&(xe.length=n.push({current:e})),n[t]},useState:(e,t)=>$e(Ae,e,void 0,t)},{render:Ge,html:Je,svg:Qe}=(e=>{const t=ae(ce);return ie(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?v:String))})),n.prototype=t,ue(n);function n(){return re.apply(this,arguments)}})({transform:()=>e=>He(e,De)}),Xe="_🔥",{defineProperties:Ye}=Object,et=new t,tt=new t,nt=new t,rt=new c,st=!0,at="attributeChangedCallback",ot="connectedCallback",it=`dis${ot}`,ct=(e,t,n)=>{if(n in e){const r=e[n];t[n]={configurable:st,value(){return wt.call(this),r.apply(this,arguments)}}}else t[n]={configurable:st,value:wt}},lt=e=>{const{prototype:n}=e,r=[],s={html:{configurable:st,get:vt},svg:{configurable:st,get:bt}};if(s[Xe]={value:{events:r,info:null}},"handleEvent"in n||(s.handleEvent={configurable:st,value:yt}),"render"in n&&n.render.length){const{oninit:e}=n;Ye(n,{oninit:{configurable:st,value(){const t=(e=>{const t=[];return function n(){const r=xe,s=[];xe={hook:n,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{xe=r;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,Ke));Ye(this,{render:{configurable:st,value:t}}),this.addEventListener("disconnected",Te.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in n&&(r.push("init"),ct(n,s,"render")),ct(n,s,at),ct(n,s,ot),ct(n,s,it),[[at,"onattributechanged",Et],[ot,"onconnected",xt],[it,"ondisconnected",Nt],[ot,"render",Ct]].forEach((([e,t,a])=>{if(!(e in n)&&t in n)if("render"!==t&&r.push(t.slice(2)),e in s){const t=s[e].value;s[e]={configurable:st,value(){return t.apply(this,arguments),a.apply(this,arguments)}}}else s[e]={configurable:st,value:a}}));const a=e.booleanAttributes||[];a.forEach((e=>{e in n||(s[e]={configurable:st,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const o=e.observedAttributes||[];o.forEach((e=>{e in n||(s[e]={configurable:st,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const a=new t,o="on"+e in n;o&&r.push(e),s[e]={configurable:st,get(){return a.get(this)},set(t){if(a.set(this,t),o){const n=ut(e);if(n.detail=t,rt.has(this))this.dispatchEvent(n);else{const e=nt.get(this);e?e.push(n):nt.set(this,[n])}}}}})),Ye(n,s);const i=a.concat(o);return i.length?Ye(e,{observedAttributes:{configurable:st,get:()=>i}}):e},ut=e=>new r(e),ht=(...e)=>new me("html",e);ht.for=Je.for;const ft=(...e)=>new me("svg",e);ft.for=Qe.for;const pt=(e,n,r)=>{const s=dt(e,n,new t);return r.set(e,s),s},dt=(e,t,n)=>(r,...s)=>{const a=n.get(r)||((e,t,{info:n})=>{const r=n?He(t.join(Xe),n).split(Xe):t;return e.set(t,r),r})(n,r,e[Xe]);return Ge(e,(()=>t(a,...s)))};function gt(e){this.addEventListener(e,this)}function mt(e){this.dispatchEvent(e)}function vt(){return et.get(this)||pt(this,ht,et)}function bt(){return tt.get(this)||pt(this,ft,tt)}function yt(e){this[`on${e.type}`](e)}function wt(){if(!rt.has(this)){rt.add(this),this[Xe].events.forEach(gt,this),this.dispatchEvent(ut("init"));const e=nt.get(this);e&&(nt.delete(this),e.forEach(mt,this))}}function Et(e,t,n){const r=ut("attributechanged");r.attributeName=e,r.oldValue=t,r.newValue=n,this.dispatchEvent(r)}function xt(){this.dispatchEvent(ut("connected"))}function Ct(){this.render()}function Nt(){this.dispatchEvent(ut("disconnected"))}const{create:kt,defineProperty:At,defineProperties:$t,getOwnPropertyNames:jt,getOwnPropertySymbols:Ot,getOwnPropertyDescriptor:St,keys:_t}=Object,Lt={element:HTMLElement},Mt=new t;new t;const Tt=new t;new t;const Rt=e=>{const t=kt(null),n=kt(null),r={prototype:n,statics:t};return jt(e).concat(Ot(e)).forEach((r=>{const s=St(e,r);switch(s.enumerable=!1,r){case"extends":r="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[r]=s;break;default:n[r]=s}})),r},Pt=(e,t,n)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:r,$3:s,$4:a}=RegExp;let o=s||a||t.tagName||t.extends||"element";const i="fragment"===o;if(i)o="element";else if(!/^[A-Za-z0-9:._-]+$/.test(o))throw"Invalid tag";let c="",l="";o.indexOf("-")<0?(c=r.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+n,c.indexOf("-")<0&&(l="-heresy")):(c=o+n,o="element");const u=c+l;if(customElements.get(u))throw`Duplicated ${u} definition`;const h=ze("object"==typeof t?Tt.get(t)||((e,t)=>{const{statics:n,prototype:r}=Rt(e),s=ze(Lt[t]||(Lt[t]=document.createElement(t).constructor),!1);return $t(s.prototype,r),$t(s,n),Tt.set(e,lt(s)),s})(t,o):Mt.get(t)||(e=>{const t=ze(e,!1);return Mt.set(e,lt(t)),t})(t),!0),f="element"===o;if(At(h,"new",{value:f?()=>document.createElement(u):()=>document.createElement(o,{is:u})}),At(h.prototype,"is",{value:u}),""===n){const e=(e=>{const{length:t}=e;let n=0,r=0;for(;r<t;)n=(n<<5)-n+e.charCodeAt(r++),n&=n;return n.toString(36)})(c.toUpperCase());De.map[r]=Wt(h,o,u,{id:e,i:0}),De.re=Ue(_t(De.map))}if(i){const{render:e}=h.prototype;At(h.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const n=document.createRange();n.setStartBefore(e),n.setEndAfter(this.lastChild),t=n.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const p=[u,h];return f||p.push({extends:o}),customElements.define(...p),{Class:h,is:u,name:r,tagName:o}},Wt=(e,t,n,r)=>{const{prototype:s}=e,a=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),o=[Ie(a)],i=e.includes||e.contains;if(i){const e={};_t(i).forEach((t=>{const n=`-${r.id}-${r.i++}`,{Class:s,is:a,name:c,tagName:l}=Pt(t,i[t],n);o.push(Ie(e[c]=Wt(s,l,a,r)))}));const t=Ue(_t(e)),{events:n}=s[Xe],a={events:n,info:{map:e,re:t}};if(At(s,Xe,{value:a}),"render"in s){const{render:e}=s,{info:t}=a;At(s,"render",{configurable:!0,value(){const n=Ve();qe(t);const r=e.apply(this,arguments);return qe(n),r}})}}return"style"in e&&(e=>{if((e||"").length){const t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));const n=document.head||document.querySelector("head");n.insertBefore(t,n.lastChild)}})(e.style(...o)),a},Zt="2.0.0-alpha27",Bt=["audio","background","cameraaccess","chat","people","embed","emptyRoomInvitation","help","leaveButton","precallReview","screenshare","video","floatSelf","recording","logo","locking","participantCount","settingsButton","pipButton","moreButton","personality","subgridLabels","lowData","breakout"];var zt,Dt;zt="WherebyEmbed",Dt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this.onmessage.bind(this))},ondisconnected(){window.removeEventListener("message",this.onmessage.bind(this))},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl","externalId",...Bt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.origin)},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},toggleScreenshare(e){this._postCommand("toggle_screenshare",[e])},onmessage({origin:e,data:t}){if(e!==this.url.origin)return;const{type:n,payload:r}=t;this.dispatchEvent(new CustomEvent(n,{detail:r}))},render(){const{avatarurl:e,displayname:t,externalId:n,lang:r,metadata:s,minimal:a,room:o,groups:i,virtualbackgroundurl:c}=this;if(!o)return this.html`Whereby: Missing room attribute.`;const l=/https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(o),u=l&&l[1]||this.subdomain;if(!u)return this.html`Whereby: Missing subdomain attr.`;if(!l)return this.html`could not parse URL.`;const h=l[2]||".whereby.com";this.url=new URL(o,`https://${u}${h}`);const f=new URL(o);return f.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",f.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha27",iframeSource:u},t&&{displayName:t}),r&&{lang:r}),s&&{metadata:s}),n&&{externalId:n}),i&&{groups:i}),c&&{virtualBackgroundUrl:c}),e&&{avatarUrl:e}),null!=a&&{embed:a}),Bt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
|
|
10
|
+
/*! (c) Andrea Giammarchi - ISC */let xe=null;const Ce=L(new WeakMap),Ne=(e,t,n)=>{e.apply(t,n)},ke={async:!1,always:!1},Ae=(e,t)=>"function"==typeof t?t(e):t,$e=(e,t,n,r)=>{const s=xe.i++,{hook:a,args:o,stack:i,length:c}=xe;s===c&&(xe.length=i.push({}));const l=i[s];if(l.args=o,s===c){const s="function"==typeof n,{async:o,always:i}=(s?r:n)||r||ke;l.$=s?n(t):Ae(void 0,t),l._=o?Ce.get(a)||Ce.set(a,Ee()):Ne,l.f=t=>{const n=e(l.$,t);(i||l.$!==n)&&(l.$=n,l._(a,null,l.args))}}return[l.$,l.f]},je=new WeakMap;function Oe({hook:e}){return e===this.hook}const Se=new WeakMap,_e=L(Se),Le=()=>{},Me=e=>(t,n)=>{const r=xe.i++,{hook:s,after:a,stack:o,length:i}=xe;if(r<i){const s=o[r],{update:i,values:c,stop:l}=s;if(!n||n.some(Ze,c)){s.values=n,e&&l(e);const{clean:r}=s;r&&(s.clean=null,r());const o=()=>{s.clean=t()};e?i(o):a.push(o)}}else{const r=e?Ee():Le,i={clean:null,update:r,values:n,stop:Le};xe.length=o.push(i),(_e.get(s)||_e.set(s,[])).push(i);const c=()=>{i.clean=t()};e?i.stop=r(c):a.push(c)}},Te=e=>{(Se.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};Se.has.bind(Se);const Re=Me(!0),Pe=Me(!1),We=(e,t)=>{const n=xe.i++,{stack:r,length:s}=xe;return n===s?xe.length=r.push({$:e(),_:t}):t&&!t.some(Ze,r[n]._)||(r[n]={$:e(),_:t}),r[n].$};function Ze(e,t){return e!==this[t]}let Be=null;try{Be=new{o(){}}.o}catch(zt){}let ze=e=>class extends e{};if(Be){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:n}="object"==typeof Reflect?Reflect:{construct(e,n,r){const s=[null];for(let e=0;e<n.length;e++)s.push(n[e]);const a=e.bind.apply(e,s);return t(new a,r.prototype)}};ze=function(r,s){function a(){return n(s?e(r):r,arguments,a)}return t(a.prototype,r.prototype),t(a,r)}}const De={map:{},re:null},Ue=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let Fe=null;const He=(e,t)=>{const{map:n,re:r}=Fe||t;return e.replace(r,((e,t,r,s)=>{const{tagName:a,is:o,element:i}=n[r];return i?t?`</${o}>`:`<${o}${s}`:t?`</${a}>`:`<${a} is="${o}"${s}`}))},Ie=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,Ve=()=>Fe,qe=e=>{Fe=e},Ke={useCallback:(e,t)=>We((()=>e),t),useContext:e=>{const{hook:t,args:n}=xe,r=je.get(e),s={hook:t,args:n};return r.some(Oe,s)||r.push(s),e.value},useEffect:Re,useLayoutEffect:Pe,useMemo:We,useReducer:$e,useRef:e=>{const t=xe.i++,{stack:n,length:r}=xe;return t===r&&(xe.length=n.push({current:e})),n[t]},useState:(e,t)=>$e(Ae,e,void 0,t)},{render:Ge,html:Je,svg:Qe}=(e=>{const t=ae(ce);return ie(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?v:String))})),n.prototype=t,ue(n);function n(){return re.apply(this,arguments)}})({transform:()=>e=>He(e,De)}),Xe="_🔥",{defineProperties:Ye}=Object,et=new t,tt=new t,nt=new t,rt=new c,st=!0,at="attributeChangedCallback",ot="connectedCallback",it=`dis${ot}`,ct=(e,t,n)=>{if(n in e){const r=e[n];t[n]={configurable:st,value(){return wt.call(this),r.apply(this,arguments)}}}else t[n]={configurable:st,value:wt}},lt=e=>{const{prototype:n}=e,r=[],s={html:{configurable:st,get:vt},svg:{configurable:st,get:bt}};if(s[Xe]={value:{events:r,info:null}},"handleEvent"in n||(s.handleEvent={configurable:st,value:yt}),"render"in n&&n.render.length){const{oninit:e}=n;Ye(n,{oninit:{configurable:st,value(){const t=(e=>{const t=[];return function n(){const r=xe,s=[];xe={hook:n,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{xe=r;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,Ke));Ye(this,{render:{configurable:st,value:t}}),this.addEventListener("disconnected",Te.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in n&&(r.push("init"),ct(n,s,"render")),ct(n,s,at),ct(n,s,ot),ct(n,s,it),[[at,"onattributechanged",Et],[ot,"onconnected",xt],[it,"ondisconnected",Nt],[ot,"render",Ct]].forEach((([e,t,a])=>{if(!(e in n)&&t in n)if("render"!==t&&r.push(t.slice(2)),e in s){const t=s[e].value;s[e]={configurable:st,value(){return t.apply(this,arguments),a.apply(this,arguments)}}}else s[e]={configurable:st,value:a}}));const a=e.booleanAttributes||[];a.forEach((e=>{e in n||(s[e]={configurable:st,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const o=e.observedAttributes||[];o.forEach((e=>{e in n||(s[e]={configurable:st,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const a=new t,o="on"+e in n;o&&r.push(e),s[e]={configurable:st,get(){return a.get(this)},set(t){if(a.set(this,t),o){const n=ut(e);if(n.detail=t,rt.has(this))this.dispatchEvent(n);else{const e=nt.get(this);e?e.push(n):nt.set(this,[n])}}}}})),Ye(n,s);const i=a.concat(o);return i.length?Ye(e,{observedAttributes:{configurable:st,get:()=>i}}):e},ut=e=>new r(e),ht=(...e)=>new me("html",e);ht.for=Je.for;const ft=(...e)=>new me("svg",e);ft.for=Qe.for;const pt=(e,n,r)=>{const s=dt(e,n,new t);return r.set(e,s),s},dt=(e,t,n)=>(r,...s)=>{const a=n.get(r)||((e,t,{info:n})=>{const r=n?He(t.join(Xe),n).split(Xe):t;return e.set(t,r),r})(n,r,e[Xe]);return Ge(e,(()=>t(a,...s)))};function gt(e){this.addEventListener(e,this)}function mt(e){this.dispatchEvent(e)}function vt(){return et.get(this)||pt(this,ht,et)}function bt(){return tt.get(this)||pt(this,ft,tt)}function yt(e){this[`on${e.type}`](e)}function wt(){if(!rt.has(this)){rt.add(this),this[Xe].events.forEach(gt,this),this.dispatchEvent(ut("init"));const e=nt.get(this);e&&(nt.delete(this),e.forEach(mt,this))}}function Et(e,t,n){const r=ut("attributechanged");r.attributeName=e,r.oldValue=t,r.newValue=n,this.dispatchEvent(r)}function xt(){this.dispatchEvent(ut("connected"))}function Ct(){this.render()}function Nt(){this.dispatchEvent(ut("disconnected"))}const{create:kt,defineProperty:At,defineProperties:$t,getOwnPropertyNames:jt,getOwnPropertySymbols:Ot,getOwnPropertyDescriptor:St,keys:_t}=Object,Lt={element:HTMLElement},Mt=new t;new t;const Tt=new t;new t;const Rt=e=>{const t=kt(null),n=kt(null),r={prototype:n,statics:t};return jt(e).concat(Ot(e)).forEach((r=>{const s=St(e,r);switch(s.enumerable=!1,r){case"extends":r="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[r]=s;break;default:n[r]=s}})),r},Pt=(e,t,n)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:r,$3:s,$4:a}=RegExp;let o=s||a||t.tagName||t.extends||"element";const i="fragment"===o;if(i)o="element";else if(!/^[A-Za-z0-9:._-]+$/.test(o))throw"Invalid tag";let c="",l="";o.indexOf("-")<0?(c=r.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+n,c.indexOf("-")<0&&(l="-heresy")):(c=o+n,o="element");const u=c+l;if(customElements.get(u))throw`Duplicated ${u} definition`;const h=ze("object"==typeof t?Tt.get(t)||((e,t)=>{const{statics:n,prototype:r}=Rt(e),s=ze(Lt[t]||(Lt[t]=document.createElement(t).constructor),!1);return $t(s.prototype,r),$t(s,n),Tt.set(e,lt(s)),s})(t,o):Mt.get(t)||(e=>{const t=ze(e,!1);return Mt.set(e,lt(t)),t})(t),!0),f="element"===o;if(At(h,"new",{value:f?()=>document.createElement(u):()=>document.createElement(o,{is:u})}),At(h.prototype,"is",{value:u}),""===n){const e=(e=>{const{length:t}=e;let n=0,r=0;for(;r<t;)n=(n<<5)-n+e.charCodeAt(r++),n&=n;return n.toString(36)})(c.toUpperCase());De.map[r]=Wt(h,o,u,{id:e,i:0}),De.re=Ue(_t(De.map))}if(i){const{render:e}=h.prototype;At(h.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const n=document.createRange();n.setStartBefore(e),n.setEndAfter(this.lastChild),t=n.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const p=[u,h];return f||p.push({extends:o}),customElements.define(...p),{Class:h,is:u,name:r,tagName:o}},Wt=(e,t,n,r)=>{const{prototype:s}=e,a=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),o=[Ie(a)],i=e.includes||e.contains;if(i){const e={};_t(i).forEach((t=>{const n=`-${r.id}-${r.i++}`,{Class:s,is:a,name:c,tagName:l}=Pt(t,i[t],n);o.push(Ie(e[c]=Wt(s,l,a,r)))}));const t=Ue(_t(e)),{events:n}=s[Xe],a={events:n,info:{map:e,re:t}};if(At(s,Xe,{value:a}),"render"in s){const{render:e}=s,{info:t}=a;At(s,"render",{configurable:!0,value(){const n=Ve();qe(t);const r=e.apply(this,arguments);return qe(n),r}})}}return"style"in e&&(e=>{if((e||"").length){const t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));const n=document.head||document.querySelector("head");n.insertBefore(t,n.lastChild)}})(e.style(...o)),a},Zt="2.0.0-alpha28",Bt=["audio","background","cameraaccess","chat","people","embed","emptyRoomInvitation","help","leaveButton","precallReview","screenshare","video","floatSelf","recording","logo","locking","participantCount","settingsButton","pipButton","moreButton","personality","subgridLabels","lowData","breakout"];var zt,Dt;zt="WherebyEmbed",Dt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this.onmessage.bind(this))},ondisconnected(){window.removeEventListener("message",this.onmessage.bind(this))},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl","externalId",...Bt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.origin)},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},toggleScreenshare(e){this._postCommand("toggle_screenshare",[e])},onmessage({origin:e,data:t}){if(e!==this.url.origin)return;const{type:n,payload:r}=t;this.dispatchEvent(new CustomEvent(n,{detail:r}))},render(){const{avatarurl:e,displayname:t,externalId:n,lang:r,metadata:s,minimal:a,room:o,groups:i,virtualbackgroundurl:c}=this;if(!o)return this.html`Whereby: Missing room attribute.`;const l=/https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(o),u=l&&l[1]||this.subdomain;if(!u)return this.html`Whereby: Missing subdomain attr.`;if(!l)return this.html`could not parse URL.`;const h=l[2]||".whereby.com";this.url=new URL(o,`https://${u}${h}`);const f=new URL(o);return f.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",f.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha28",iframeSource:u},t&&{displayName:t}),r&&{lang:r}),s&&{metadata:s}),n&&{externalId:n}),i&&{groups:i}),c&&{virtualBackgroundUrl:c}),e&&{avatarUrl:e}),null!=a&&{embed:a}),Bt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
|
|
11
11
|
<iframe
|
|
12
12
|
ref=${this.iframe}
|
|
13
13
|
src=${this.url}
|