@whereby.com/browser-sdk 1.8.1 → 1.9.1
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/README.md +16 -4
- package/dist/lib.cjs.js +47 -15
- package/dist/lib.esm.js +47 -15
- package/dist/v1.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
# @whereby.com/browser-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<a href="https://www.npmjs.com/package/@whereby.com/browser-sdk" alt="NPM Package">
|
|
4
|
+
<img src="https://img.shields.io/npm/v/@whereby.com/browser-sdk" />
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
Clientside library defining a web component to allow embedding Whereby video
|
|
8
|
+
rooms in web applications. Only normal iframe under the hood, the web component
|
|
9
|
+
adds syntactic sugar to make it easier to customize the Whereby experience and
|
|
10
|
+
hook into powerful features such as listening to room events and sending
|
|
11
|
+
commands to the room from the host application.
|
|
4
12
|
|
|
5
13
|
## Usage
|
|
6
14
|
|
|
7
15
|
### React + a bundler (webpack, rollup, parcel etc)
|
|
8
|
-
|
|
16
|
+
|
|
17
|
+
```js
|
|
9
18
|
import "@whereby.com/browser-sdk"
|
|
10
19
|
|
|
11
20
|
const MyComponent = ({ roomUrl }) => {
|
|
@@ -17,7 +26,8 @@ export default MyComponent
|
|
|
17
26
|
```
|
|
18
27
|
|
|
19
28
|
### Directly using a script tag
|
|
20
|
-
|
|
29
|
+
|
|
30
|
+
```html
|
|
21
31
|
<html>
|
|
22
32
|
<head>
|
|
23
33
|
<script src="...."></script>
|
|
@@ -32,4 +42,6 @@ export default MyComponent
|
|
|
32
42
|
|
|
33
43
|
**Note**
|
|
34
44
|
|
|
35
|
-
Although we have just higlighted two combinations of how to load and use the
|
|
45
|
+
Although we have just higlighted two combinations of how to load and use the
|
|
46
|
+
web component, it should be possible to use this library with all the major
|
|
47
|
+
frontend frameworks.
|
package/dist/lib.cjs.js
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
var heresy = require('heresy');
|
|
4
4
|
|
|
5
|
+
function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
|
|
6
|
+
if (!roomAttribute) {
|
|
7
|
+
throw new Error("Missing room attribute");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Get subdomain from room URL, or use it specified
|
|
11
|
+
const m = /https:\/\/([^.]+)(\.whereby\.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(roomAttribute);
|
|
12
|
+
const subdomain = (m && m[1]) || subdomainAttribute;
|
|
13
|
+
|
|
14
|
+
if (!subdomain) {
|
|
15
|
+
throw new Error("Missing subdomain attribute");
|
|
16
|
+
}
|
|
17
|
+
if (!m) {
|
|
18
|
+
throw new Error("Could not parse room URL");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const roomUrl = new URL(roomAttribute);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
subdomain,
|
|
25
|
+
roomUrl,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
5
29
|
const boolAttrs = [
|
|
6
30
|
"audio",
|
|
7
31
|
"background",
|
|
@@ -71,8 +95,7 @@ heresy.define("WherebyEmbed", {
|
|
|
71
95
|
// Commands
|
|
72
96
|
_postCommand(command, args = []) {
|
|
73
97
|
if (this.iframe.current) {
|
|
74
|
-
|
|
75
|
-
this.iframe.current.contentWindow.postMessage({ command, args }, url.origin);
|
|
98
|
+
this.iframe.current.contentWindow.postMessage({ command, args }, this.roomUrl.origin);
|
|
76
99
|
}
|
|
77
100
|
},
|
|
78
101
|
startRecording() {
|
|
@@ -81,6 +104,12 @@ heresy.define("WherebyEmbed", {
|
|
|
81
104
|
stopRecording() {
|
|
82
105
|
this._postCommand("stop_recording");
|
|
83
106
|
},
|
|
107
|
+
startStreaming() {
|
|
108
|
+
this._postCommand("start_streaming");
|
|
109
|
+
},
|
|
110
|
+
stopStreaming() {
|
|
111
|
+
this._postCommand("stop_streaming");
|
|
112
|
+
},
|
|
84
113
|
toggleCamera(enabled) {
|
|
85
114
|
this._postCommand("toggle_camera", [enabled]);
|
|
86
115
|
},
|
|
@@ -92,8 +121,7 @@ heresy.define("WherebyEmbed", {
|
|
|
92
121
|
},
|
|
93
122
|
|
|
94
123
|
onmessage({ origin, data }) {
|
|
95
|
-
|
|
96
|
-
if (origin !== url.origin) return;
|
|
124
|
+
if (origin !== this.roomUrl.origin) return;
|
|
97
125
|
const { type, payload: detail } = data;
|
|
98
126
|
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
99
127
|
},
|
|
@@ -108,15 +136,19 @@ heresy.define("WherebyEmbed", {
|
|
|
108
136
|
groups,
|
|
109
137
|
virtualbackgroundurl: virtualBackgroundUrl,
|
|
110
138
|
} = this;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
139
|
+
let roomUrl, subdomain;
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
({ roomUrl, subdomain } = parseRoomUrlAndSubdomain(room, this.subdomain));
|
|
143
|
+
} catch (error) {
|
|
144
|
+
return this.html`Whereby: ${error.message}`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.roomUrl = roomUrl;
|
|
148
|
+
|
|
117
149
|
Object.entries({
|
|
118
150
|
jsApi: true,
|
|
119
|
-
we: "1.
|
|
151
|
+
we: "1.9.1",
|
|
120
152
|
iframeSource: subdomain,
|
|
121
153
|
...(displayName && { displayName }),
|
|
122
154
|
...(lang && { lang: lang }),
|
|
@@ -132,19 +164,19 @@ heresy.define("WherebyEmbed", {
|
|
|
132
164
|
{}
|
|
133
165
|
),
|
|
134
166
|
}).forEach(([k, v]) => {
|
|
135
|
-
if (!
|
|
136
|
-
|
|
167
|
+
if (!this.roomUrl.searchParams.has(k)) {
|
|
168
|
+
this.roomUrl.searchParams.set(k, v);
|
|
137
169
|
}
|
|
138
170
|
});
|
|
139
171
|
this.html`
|
|
140
172
|
<iframe
|
|
141
173
|
ref=${this.iframe}
|
|
142
|
-
src=${
|
|
174
|
+
src=${this.roomUrl}
|
|
143
175
|
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
|
|
144
176
|
`;
|
|
145
177
|
},
|
|
146
178
|
});
|
|
147
179
|
|
|
148
|
-
var index = { sdkVersion: "1.
|
|
180
|
+
var index = { sdkVersion: "1.9.1" };
|
|
149
181
|
|
|
150
182
|
module.exports = index;
|
package/dist/lib.esm.js
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
import { define, ref } from 'heresy';
|
|
2
2
|
|
|
3
|
+
function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
|
|
4
|
+
if (!roomAttribute) {
|
|
5
|
+
throw new Error("Missing room attribute");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Get subdomain from room URL, or use it specified
|
|
9
|
+
const m = /https:\/\/([^.]+)(\.whereby\.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(roomAttribute);
|
|
10
|
+
const subdomain = (m && m[1]) || subdomainAttribute;
|
|
11
|
+
|
|
12
|
+
if (!subdomain) {
|
|
13
|
+
throw new Error("Missing subdomain attribute");
|
|
14
|
+
}
|
|
15
|
+
if (!m) {
|
|
16
|
+
throw new Error("Could not parse room URL");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const roomUrl = new URL(roomAttribute);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
subdomain,
|
|
23
|
+
roomUrl,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
3
27
|
const boolAttrs = [
|
|
4
28
|
"audio",
|
|
5
29
|
"background",
|
|
@@ -69,8 +93,7 @@ define("WherebyEmbed", {
|
|
|
69
93
|
// Commands
|
|
70
94
|
_postCommand(command, args = []) {
|
|
71
95
|
if (this.iframe.current) {
|
|
72
|
-
|
|
73
|
-
this.iframe.current.contentWindow.postMessage({ command, args }, url.origin);
|
|
96
|
+
this.iframe.current.contentWindow.postMessage({ command, args }, this.roomUrl.origin);
|
|
74
97
|
}
|
|
75
98
|
},
|
|
76
99
|
startRecording() {
|
|
@@ -79,6 +102,12 @@ define("WherebyEmbed", {
|
|
|
79
102
|
stopRecording() {
|
|
80
103
|
this._postCommand("stop_recording");
|
|
81
104
|
},
|
|
105
|
+
startStreaming() {
|
|
106
|
+
this._postCommand("start_streaming");
|
|
107
|
+
},
|
|
108
|
+
stopStreaming() {
|
|
109
|
+
this._postCommand("stop_streaming");
|
|
110
|
+
},
|
|
82
111
|
toggleCamera(enabled) {
|
|
83
112
|
this._postCommand("toggle_camera", [enabled]);
|
|
84
113
|
},
|
|
@@ -90,8 +119,7 @@ define("WherebyEmbed", {
|
|
|
90
119
|
},
|
|
91
120
|
|
|
92
121
|
onmessage({ origin, data }) {
|
|
93
|
-
|
|
94
|
-
if (origin !== url.origin) return;
|
|
122
|
+
if (origin !== this.roomUrl.origin) return;
|
|
95
123
|
const { type, payload: detail } = data;
|
|
96
124
|
this.dispatchEvent(new CustomEvent(type, { detail }));
|
|
97
125
|
},
|
|
@@ -106,15 +134,19 @@ define("WherebyEmbed", {
|
|
|
106
134
|
groups,
|
|
107
135
|
virtualbackgroundurl: virtualBackgroundUrl,
|
|
108
136
|
} = this;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
137
|
+
let roomUrl, subdomain;
|
|
138
|
+
|
|
139
|
+
try {
|
|
140
|
+
({ roomUrl, subdomain } = parseRoomUrlAndSubdomain(room, this.subdomain));
|
|
141
|
+
} catch (error) {
|
|
142
|
+
return this.html`Whereby: ${error.message}`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.roomUrl = roomUrl;
|
|
146
|
+
|
|
115
147
|
Object.entries({
|
|
116
148
|
jsApi: true,
|
|
117
|
-
we: "1.
|
|
149
|
+
we: "1.9.1",
|
|
118
150
|
iframeSource: subdomain,
|
|
119
151
|
...(displayName && { displayName }),
|
|
120
152
|
...(lang && { lang: lang }),
|
|
@@ -130,19 +162,19 @@ define("WherebyEmbed", {
|
|
|
130
162
|
{}
|
|
131
163
|
),
|
|
132
164
|
}).forEach(([k, v]) => {
|
|
133
|
-
if (!
|
|
134
|
-
|
|
165
|
+
if (!this.roomUrl.searchParams.has(k)) {
|
|
166
|
+
this.roomUrl.searchParams.set(k, v);
|
|
135
167
|
}
|
|
136
168
|
});
|
|
137
169
|
this.html`
|
|
138
170
|
<iframe
|
|
139
171
|
ref=${this.iframe}
|
|
140
|
-
src=${
|
|
172
|
+
src=${this.roomUrl}
|
|
141
173
|
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
|
|
142
174
|
`;
|
|
143
175
|
},
|
|
144
176
|
});
|
|
145
177
|
|
|
146
|
-
var index = { sdkVersion: "1.
|
|
178
|
+
var index = { sdkVersion: "1.9.1" };
|
|
147
179
|
|
|
148
180
|
export { index as default };
|
package/dist/v1.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*! (c) Andrea Giammarchi - ISC */
|
|
2
|
-
var e={};try{e.WeakMap=WeakMap}catch(t){e.WeakMap=function(e,t){var n=t.defineProperty,r=t.hasOwnProperty,s
|
|
3
|
-
/*! (c) Andrea Giammarchi - ISC */try{
|
|
4
|
-
/*! (c) Andrea Giammarchi - ISC */try{
|
|
2
|
+
var e={};try{e.WeakMap=WeakMap}catch(t){e.WeakMap=function(e,t){var n=t.defineProperty,r=t.hasOwnProperty,o=s.prototype;return o.delete=function(e){return this.has(e)&&delete e[this._]},o.get=function(e){return this.has(e)?e[this._]:void 0},o.has=function(e){return r.call(e,this._)},o.set=function(e,t){return n(e,this._,{configurable:!0,value:t}),this},s;function s(t){n(this,"_",{value:"_@ungap/weakmap"+e++}),t&&t.forEach(a,this)}function a(e){this.set(e[0],e[1])}}(Math.random(),Object)}var t=e.WeakMap,n={};try{n.Event=new Event(".").constructor}catch(e){try{n.Event=new CustomEvent(".").constructor}catch(e){n.Event=function(e,t){t||(t={});var n=document.createEvent("Event"),r=!!t.bubbles,o=!!t.cancelable;n.initEvent(e,r,o);try{n.bubbles=r,n.cancelable=o}catch(n){}return n}}}var r=n.Event,o={};
|
|
3
|
+
/*! (c) Andrea Giammarchi - ISC */try{o.WeakSet=WeakSet}catch(e){!function(e){var t=new e,n=r.prototype;function r(n){t.set(this,new e),n&&n.forEach(this.add,this)}n.add=function(e){return t.get(this).set(e,1),this},n.delete=function(e){return t.get(this).delete(e)},n.has=function(e){return t.get(this).has(e)},o.WeakSet=r}(WeakMap)}var s,a,i=o.WeakSet,c="-"+Math.random().toFixed(6)+"%",l=!1;
|
|
4
|
+
/*! (c) Andrea Giammarchi - ISC */try{s=document.createElement("template"),a="tabindex","content"in s&&(s.innerHTML='<p tabindex="'+c+'"></p>',s.content.childNodes[0].getAttribute(a)==c)||(c="_dt: "+c.slice(1,-1)+";",l=!0)}catch(e){}var u="\x3c!--"+c+"--\x3e",h=/^(?:plaintext|script|style|textarea|title|xmp)$/i,f=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
|
|
5
5
|
/*! (c) Andrea Giammarchi - ISC */
|
|
6
6
|
function p(e){return e.join(u).replace(w,N).replace(y,C)}var d=" \\f\\n\\r\\t",m="[^ \\f\\n\\r\\t\\/>\"'=]+",g="[ \\f\\n\\r\\t]+"+m,v="<([A-Za-z]+[A-Za-z0-9:._-]*)((?:",b="(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|<[^>]*?>|"+m.replace("\\/","")+"))?)",y=new RegExp(v+g+b+"+)(["+d+"]*/?>)","g"),w=new RegExp(v+g+b+"*)(["+d+"]*/>)","g"),E=new RegExp("("+g+"\\s*=\\s*)(['\"]?)"+u+"\\2","gi");function C(e,t,n,r){return"<"+t+n.replace(E,x)+r}function x(e,t,n){return t+(n||'"')+c+(n||'"')}function N(e,t,n){return f.test(t)?e:"<"+t+n+"></"+t+">"}const{isArray:k}=Array,{indexOf:A,slice:$}=[];var _=e=>({get:t=>e.get(t),set:(t,n)=>(e.set(t,n),n)});const S=(e,t)=>111===e.nodeType?1/t<0?t?(({firstChild:e,lastChild:t})=>{const n=document.createRange();return n.setStartAfter(e),n.setEndAfter(t),n.deleteContents(),e})(e):e.lastChild:t?e.valueOf():e.firstChild:e,L=e=>{const{childNodes:t}=e,{length:n}=t;if(n<2)return n?t[0]:e;const r=$.call(t,0);return{ELEMENT_NODE:1,nodeType:111,firstChild:r[0],lastChild:r[n-1],valueOf(){if(t.length!==n){let t=0;for(;t<n;)e.appendChild(r[t++])}return e}}};
|
|
7
7
|
/*! (c) Andrea Giammarchi - ISC */
|
|
8
|
-
var j=function(e){var t="fragment",n="template",r="content"in
|
|
9
|
-
/*! (c) Andrea Giammarchi - ISC */var I=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,
|
|
10
|
-
/*! (c) Andrea Giammarchi - ISC */let be=null;const ye=_(new WeakMap),we=(e,t,n)=>{e.apply(t,n)},Ee={async:!1,always:!1},Ce=(e,t)=>"function"==typeof t?t(e):t,xe=(e,t,n,r)=>{const s=be.i++,{hook:o,args:a,stack:i,length:c}=be;s===c&&(be.length=i.push({}));const l=i[s];if(l.args=a,s===c){const s="function"==typeof n,{async:a,always:i}=(s?r:n)||r||Ee;l.$=s?n(t):Ce(void 0,t),l._=a?ye.get(o)||ye.set(o,ve()):we,l.f=t=>{const n=e(l.$,t);(i||l.$!==n)&&(l.$=n,l._(o,null,l.args))}}return[l.$,l.f]},Ne=new WeakMap;function ke({hook:e}){return e===this.hook}const Ae=new WeakMap,$e=_(Ae),_e=()=>{},Se=e=>(t,n)=>{const r=be.i++,{hook:s,after:o,stack:a,length:i}=be;if(r<i){const s=a[r],{update:i,values:c,stop:l}=s;if(!n||n.some(Te,c)){s.values=n,e&&l(e);const{clean:r}=s;r&&(s.clean=null,r());const a=()=>{s.clean=t()};e?i(a):o.push(a)}}else{const r=e?ve():_e,i={clean:null,update:r,values:n,stop:_e};be.length=a.push(i),($e.get(s)||$e.set(s,[])).push(i);const c=()=>{i.clean=t()};e?i.stop=r(c):o.push(c)}},Le=e=>{(Ae.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};Ae.has.bind(Ae);const je=Se(!0),Me=Se(!1),Oe=(e,t)=>{const n=be.i++,{stack:r,length:s}=be;return n===s?be.length=r.push({$:e(),_:t}):t&&!t.some(Te,r[n]._)||(r[n]={$:e(),_:t}),r[n].$};function Te(e,t){return e!==this[t]}let Re=null;try{Re=new{o(){}}.o}catch(Ot){}let We=e=>class extends e{};if(Re){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 o=e.bind.apply(e,s);return t(new o,r.prototype)}};We=function(r,s){function o(){return n(s?e(r):r,arguments,o)}return t(o.prototype,r.prototype),t(o,r)}}const Pe={map:{},re:null},Ze=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let Be=null;const ze=(e,t)=>{const{map:n,re:r}=Be||t;return e.replace(r,((e,t,r,s)=>{const{tagName:o,is:a,element:i}=n[r];return i?t?`</${a}>`:`<${a}${s}`:t?`</${o}>`:`<${o} is="${a}"${s}`}))},De=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,Ue=()=>Be,Fe=e=>{Be=e},He={useCallback:(e,t)=>Oe((()=>e),t),useContext:e=>{const{hook:t,args:n}=be,r=Ne.get(e),s={hook:t,args:n};return r.some(ke,s)||r.push(s),e.value},useEffect:je,useLayoutEffect:Me,useMemo:Oe,useReducer:xe,useRef:e=>{const t=be.i++,{stack:n,length:r}=be;return t===r&&(be.length=n.push({current:e})),n[t]},useState:(e,t)=>xe(Ce,e,void 0,t)},{render:Ve,html:qe,svg:Ie}=(e=>{const t=te(se);return re(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?p:String))})),n.prototype=t,ae(n);function n(){return Y.apply(this,arguments)}})({transform:()=>e=>ze(e,Pe)}),{defineProperties:Ge}=Object,Je=new t,Ke=new t,Qe=new t,Xe=new i,Ye="attributeChangedCallback",et="connectedCallback",tt=`dis${et}`,nt=(e,t,n)=>{if(n in e){const r=e[n];t[n]={configurable:true,value(){return dt.call(this),r.apply(this,arguments)}}}else t[n]={configurable:true,value:dt}},rt=e=>{const{prototype:n}=e,r=[],s={html:{configurable:true,get:ht},svg:{configurable:true,get:ft}};if(s["_🔥"]={value:{events:r,info:null}},"handleEvent"in n||(s.handleEvent={configurable:true,value:pt}),"render"in n&&n.render.length){const{oninit:e}=n;Ge(n,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function n(){const r=be,s=[];be={hook:n,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{be=r;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,He));Ge(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Le.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in n&&(r.push("init"),nt(n,s,"render")),nt(n,s,Ye),nt(n,s,et),nt(n,s,tt),[[Ye,"onattributechanged",mt],[et,"onconnected",gt],[tt,"ondisconnected",bt],[et,"render",vt]].forEach((([e,t,o])=>{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:true,value(){return t.apply(this,arguments),o.apply(this,arguments)}}}else s[e]={configurable:true,value:o}}));const o=e.booleanAttributes||[];o.forEach((e=>{e in n||(s[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in n||(s[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const o=new t,a="on"+e in n;a&&r.push(e),s[e]={configurable:true,get(){return o.get(this)},set(t){if(o.set(this,t),a){const n=st(e);if(n.detail=t,Xe.has(this))this.dispatchEvent(n);else{const e=Qe.get(this);e?e.push(n):Qe.set(this,[n])}}}}})),Ge(n,s);const i=o.concat(a);return i.length?Ge(e,{observedAttributes:{configurable:true,get:()=>i}}):e},st=e=>new r(e),ot=(...e)=>new fe("html",e);ot.for=qe.for;const at=(...e)=>new fe("svg",e);at.for=Ie.for;const it=(e,n,r)=>{const s=ct(e,n,new t);return r.set(e,s),s},ct=(e,t,n)=>(r,...s)=>{const o=n.get(r)||((e,t,{info:n})=>{const r=n?ze(t.join("_🔥"),n).split("_🔥"):t;return e.set(t,r),r})(n,r,e["_🔥"]);return Ve(e,(()=>t(o,...s)))};function lt(e){this.addEventListener(e,this)}function ut(e){this.dispatchEvent(e)}function ht(){return Je.get(this)||it(this,ot,Je)}function ft(){return Ke.get(this)||it(this,at,Ke)}function pt(e){this[`on${e.type}`](e)}function dt(){if(!Xe.has(this)){Xe.add(this),this["_🔥"].events.forEach(lt,this),this.dispatchEvent(st("init"));const e=Qe.get(this);e&&(Qe.delete(this),e.forEach(ut,this))}}function mt(e,t,n){const r=st("attributechanged");r.attributeName=e,r.oldValue=t,r.newValue=n,this.dispatchEvent(r)}function gt(){this.dispatchEvent(st("connected"))}function vt(){this.render()}function bt(){this.dispatchEvent(st("disconnected"))}const{create:yt,defineProperty:wt,defineProperties:Et,getOwnPropertyNames:Ct,getOwnPropertySymbols:xt,getOwnPropertyDescriptor:Nt,keys:kt}=Object,At={element:HTMLElement},$t=new t;new t;const _t=new t;new t;const St=e=>{const t=yt(null),n=yt(null),r={prototype:n,statics:t};return Ct(e).concat(xt(e)).forEach((r=>{const s=Nt(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},Lt=(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:o}=RegExp;let a=s||o||t.tagName||t.extends||"element";const i="fragment"===a;if(i)a="element";else if(!/^[A-Za-z0-9:._-]+$/.test(a))throw"Invalid tag";let c="",l="";a.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=a+n,a="element");const u=c+l;if(customElements.get(u))throw`Duplicated ${u} definition`;const h=We("object"==typeof t?_t.get(t)||((e,t)=>{const{statics:n,prototype:r}=St(e),s=We(At[t]||(At[t]=document.createElement(t).constructor),!1);return Et(s.prototype,r),Et(s,n),_t.set(e,rt(s)),s})(t,a):$t.get(t)||(e=>{const t=We(e,!1);return $t.set(e,rt(t)),t})(t),!0),f="element"===a;if(wt(h,"new",{value:f?()=>document.createElement(u):()=>document.createElement(a,{is:u})}),wt(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());Pe.map[r]=jt(h,a,u,{id:e,i:0}),Pe.re=Ze(kt(Pe.map))}if(i){const{render:e}=h.prototype;wt(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:a}),customElements.define(...p),{Class:h,is:u,name:r,tagName:a}},jt=(e,t,n,r)=>{const{prototype:s}=e,o=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),a=[De(o)],i=e.includes||e.contains;if(i){const e={};kt(i).forEach((t=>{const n=`-${r.id}-${r.i++}`,{Class:s,is:o,name:c,tagName:l}=Lt(t,i[t],n);a.push(De(e[c]=jt(s,l,o,r)))}));const t=Ze(kt(e)),{events:n}=s["_🔥"],o={events:n,info:{map:e,re:t}};if(wt(s,"_🔥",{value:o}),"render"in s){const{render:e}=s,{info:t}=o;wt(s,"render",{configurable:!0,value(){const n=Ue();Fe(t);const r=e.apply(this,arguments);return Fe(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(...a)),o},Mt=["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 Ot,Tt;Ot="WherebyEmbed",Tt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this)},ondisconnected(){window.removeEventListener("message",this)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Mt].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=[]){if(this.iframe.current){const n=new URL(this.room,`https://${this.subdomain}.whereby.com`);this.iframe.current.contentWindow.postMessage({command:e,args:t},n.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!==new URL(this.room,`https://${this.subdomain}.whereby.com`).origin)return;const{type:n,payload:r}=t;this.dispatchEvent(new CustomEvent(n,{detail:r}))},render(){const{avatarurl:e,displayname:t,lang:n,metadata:r,minimal:s,room:o,groups:a,virtualbackgroundurl:i}=this;if(!o)return this.html`Whereby: Missing room attr.`;let c=/https:\/\/([^.]+)\.whereby.com\/.+/.exec(o);const l=c&&c[1]||this.subdomain;if(!l)return this.html`Whereby: Missing subdomain attr.`;const u=new URL(o,`https://${l}.whereby.com`);Object.entries({jsApi:!0,we:"1.8.1",iframeSource:l,...t&&{displayName:t},...n&&{lang:n},...r&&{metadata:r},...a&&{groups:a},...i&&{virtualBackgroundUrl:i},...e&&{avatarUrl:e},...null!=s&&{embed:s},...Mt.reduce(((e,t)=>null!=this[t.toLowerCase()]?{...e,[t]:this[t.toLowerCase()]}:e),{})}).forEach((([e,t])=>{u.searchParams.has(e)||u.searchParams.set(e,t)})),this.html`
|
|
8
|
+
var j=function(e){var t="fragment",n="template",r="content"in s(n)?function(e){var t=s(n);return t.innerHTML=e,t.content}:function(e){var r=s(t),a=s(n),i=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;a.innerHTML="<table>"+e+"</table>",i=a.querySelectorAll(c)}else a.innerHTML=e,i=a.childNodes;return o(r,i),r};return function(e,t){return("svg"===t?a:r)(e)};function o(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function s(n){return n===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",n)}function a(e){var n=s(t),r=s("div");return r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",o(n,r.firstChild.childNodes),n}}(document),M=(e,t,n,r,o)=>{const s=n.length;let a=t.length,i=s,c=0,l=0,u=null;for(;c<a||l<i;)if(a===c){const t=i<s?l?r(n[l-1],-0).nextSibling:r(n[i-l],0):o;for(;l<i;)e.insertBefore(r(n[l++],1),t)}else if(i===l)for(;c<a;)u&&u.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[l])c++,l++;else if(t[a-1]===n[i-1])a--,i--;else if(t[c]===n[i-1]&&n[l]===t[a-1]){const o=r(t[--a],-1).nextSibling;e.insertBefore(r(n[l++],1),r(t[c++],-1).nextSibling),e.insertBefore(r(n[--i],1),o),t[a]=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 o=u.get(t[c]);if(l<o&&o<i){let s=c,h=1;for(;++s<a&&s<i&&u.get(t[s])===o+h;)h++;if(h>o-l){const s=r(t[c],0);for(;l<o;)e.insertBefore(r(n[l++],1),s)}else e.replaceChild(r(n[l++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n},O=function(e,t,n,r,o){var s=o in e,a=e.createDocumentFragment();return a.appendChild(e.createTextNode("g")),a.appendChild(e.createTextNode("")),(s?e.importNode(a,!0):a.cloneNode(!0)).childNodes.length<2?function e(t,n){for(var r=t.cloneNode(),o=t.childNodes||[],s=o.length,a=0;n&&a<s;a++)r.appendChild(e(o[a],n));return r}:s?e.importNode:function(e,t){return e.cloneNode(!!t)}}(document,0,0,0,"importNode"),T="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},R=l?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 U(e,t){for(var n=t.length,r=0;r<n;)e=e.childNodes[t[r++]];return e}function W(e,t,n,r){for(var o=e.childNodes,s=o.length,a=0;a<s;){var i=o[a];switch(i.nodeType){case 1:var l=r.concat(a);P(i,t,n,l),W(i,t,n,l);break;case 8:var f=i.textContent;if(f===c)n.shift(),t.push(h.test(e.nodeName)?z(e,r):Z(i,r.concat(a)));else switch(f.slice(0,2)){case"/*":if("*/"!==f.slice(-2))break;case"👻":e.removeChild(i),a--,s--}break;case 3:h.test(e.nodeName)&&T.call(i.textContent)===u&&(n.shift(),t.push(z(e,r)))}a++}}function P(e,t,n,r){for(var o=e.attributes,s=[],a=[],i=R(o,n),h=i.length,f=0;f<h;){var p,d=i[f++],m=d.value===c;if(m||1<(p=d.value.split(u)).length){var g=d.name;if(s.indexOf(g)<0){s.push(g);var v=n.shift().replace(m?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+g+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),b=o[v]||o[v.toLowerCase()];if(m)t.push(B(b,r,v,null));else{for(var y=p.length-2;y--;)n.shift();t.push(B(b,r,v,p))}}a.push(d)}}f=0;for(var w=(0<(h=a.length)&&l&&!("ownerSVGElement"in e));f<h;){var E=a[f++];w&&(E.value=""),e.removeAttribute(E.name)}var C=e.nodeName;if(/^script$/i.test(C)){var x=document.createElement(C);for(h=o.length,f=0;f<h;)x.setAttributeNode(o[f++].cloneNode(!0));x.textContent=e.textContent,e.parentNode.replaceChild(x,e)}}function Z(e,t){return{type:"any",node:e,path:t}}function B(e,t,n,r){return{type:"attr",node:e,path:t,name:n,sparse:r}}function z(e,t){return{type:"text",node:e,path:t}}var D=_(new t);function F(e,t){var n=(e.convert||p)(t),r=e.transform;r&&(n=r(n));var o=j(n,e.type);q(o);var s=[];return W(o,s,t.slice(0),[]),{content:o,updates:function(n){for(var r=[],o=s.length,a=0,i=0;a<o;){var c=s[a++],l=U(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 o+=i,function(){var e=arguments.length;if(o!==e-1)throw new Error(e-1+" values instead of "+o+"\n"+t.join("${value}"));for(var s=1,a=1;s<e;){var i=r[s-a];if(i.sparse){var c=i.values,l=c[0],u=1,h=c.length;for(a+=h-2;u<h;)l+=arguments[s++]+c[u++];i.fn(l)}else i.fn(arguments[s++])}return n}}}}function H(e,t){var n=D.get(t)||D.set(t,F(e,t));return n.updates(O.call(document,n.content,!0))}var V=[];function q(e){for(var t=e.childNodes,n=t.length;n--;){var r=t[n];1!==r.nodeType&&0===T.call(r.textContent).length&&e.removeChild(r)}}
|
|
9
|
+
/*! (c) Andrea Giammarchi - ISC */var I=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,o){var s,a;return function(i){var c,l,u,h;switch(typeof i){case"object":if(i){if("object"===s){if(!o&&a!==i)for(l in a)l in i||(r[l]="")}else o?r.value="":r.cssText="";for(l in c=o?{}:r,i)u="number"!=typeof(h=i[l])||e.test(l)?h:h+"px",!o&&/^--/.test(l)?c.setProperty(l,u):c[l]=u;s="object",o?r.value=function(e){var r,o=[];for(r in e)o.push(r.replace(t,n),":",e[r],";");return o.join("")}(a=c):a=i;break}default:a!=i&&(s="string",a=i,o?r.value=i||"":r.cssText=i||"")}}}}();const G=(e,t)=>{let n,r=!0;const o=document.createAttributeNS(null,t);return t=>{n!==t&&(n=t,null==n?r||(e.removeAttributeNode(o),r=!0):(o.value=t,r&&(e.setAttributeNodeNS(o),r=!1)))}},J=({dataset:e})=>t=>{for(const n in t){const r=t[n];null==r?delete e[n]:e[n]=r}},K=(e,t)=>"dataset"===t?J(e):n=>{e[t]=n},Q=/^(?:form|list)$/i,X=(e,t)=>e.ownerDocument.createTextNode(t);function Y(e){return this.type=e,function(e){var t=V,n=q;return function(r){return t!==r&&(n=H(e,t=r)),n.apply(null,arguments)}}(this)}function ee(e){return e(this)}Y.prototype={attribute(e,t,n){const r="svg"===this.type;switch(t){case"class":if(r)return G(e,t);t="className";case"props":return K(e,t);case"aria":return(e=>t=>{for(const n in t){const r="role"===n?n:`aria-${n}`,o=t[n];null==o?e.removeAttribute(r):e.setAttribute(r,o)}})(e);case"style":return I(e,n,r);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return J(e);default:return"."===t.slice(0,1)?K(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 o=k(t)?t:[t,!1];n!==o[0]&&(n&&e.removeEventListener(r,n,o[1]),(n=o[0])&&e.addEventListener(r,n,o[1]))}})(e,t):!(t in e)||r||Q.test(t)?G(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,o=!1;const s=a=>{switch(typeof a){case"string":case"number":case"boolean":o?r!==a&&(r=a,t[0].textContent=a):(o=!0,r=a,t=M(e.parentNode,t,[X(e,a)],S,e));break;case"function":s(a(e));break;case"object":case"undefined":if(null==a){o=!1,t=M(e.parentNode,t,[],S,e);break}default:if(o=!1,r=a,k(a))if(0===a.length)t.length&&(t=M(e.parentNode,t,[],S,e));else switch(typeof a[0]){case"string":case"number":case"boolean":s(String(a));break;case"function":s(a.map(ee,e));break;case"object":k(a[0])&&(a=a.concat.apply([],a));default:t=M(e.parentNode,t,a,S,e)}else"ELEMENT_NODE"in a?t=M(e.parentNode,t,11===a.nodeType?$.call(a.childNodes):[a],S,e):"text"in a?s(String(a.text)):"any"in a?s(a.any):"html"in a?t=M(e.parentNode,t,$.call(j([].concat(a.html).join(""),n).childNodes),S,e):"length"in a&&s($.call(a))}};return s},text(e){let t;const n=r=>{if(t!==r){t=r;const o=typeof r;"object"===o&&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"===o?n(r(e)):e.textContent=null==r?"":r}};return n}};const{create:te,freeze:ne,keys:re}=Object,oe=Y.prototype,se=_(new t),ae=e=>({html:ce("html",e),svg:ce("svg",e),render(t,n){const r="function"==typeof n?n():n,o=se.get(t)||se.set(t,ie()),s=r instanceof he?le(e,o,r):r;return s!==o.wire&&(o.wire=s,t.textContent="",t.appendChild(s.valueOf())),t}}),ie=()=>({stack:[],entry:null,wire:null}),ce=(e,n)=>{const r=_(new t);return o.for=(e,t)=>{const s=r.get(e)||r.set(e,te(null));return s[t]||(s[t]=(e=>function(){return le(n,e,o.apply(null,arguments))})(ie()))},o.node=function(){return le(n,ie(),o.apply(null,arguments)).valueOf()},o;function o(){return new he(e,pe.apply(null,arguments))}},le=(e,t,{type:n,template:r,values:o})=>{const{length:s}=o;ue(e,t,o,s);let{entry:a}=t;if(a&&a.template===r&&a.type===n)a.tag(r,...o);else{const s=new e(n);t.entry=a={type:n,template:r,tag:s,wire:L(s(r,...o))}}return a.wire},ue=(e,{stack:t},n,r)=>{for(let o=0;o<r;o++){const r=n[o];r instanceof fe?n[o]=le(e,t[o]||(t[o]=ie()),r):k(r)?ue(e,t[o]||(t[o]=ie()),r,r.length):t[o]=null}r<t.length&&t.splice(r)};function he(e,t){this.type=e,this.template=t.shift(),this.values=t}ne(he);const fe=he;function pe(){let e=[],t=0,{length:n}=arguments;for(;t<n;)e.push(arguments[t++]);return e}ae(Y);var de="function"==typeof cancelAnimationFrame,me=de?cancelAnimationFrame:clearTimeout,ge=de?requestAnimationFrame:setTimeout;function ve(e){var t,n,r,o,s;return i(),function(e,i,l){return r=e,o=i,s=l,n||(n=ge(a)),--t<0&&c(!0),c};function a(){i(),r.apply(o,s||[])}function i(){t=e||1/0,n=de?0:null}function c(e){var t=!!n;return t&&(me(n),e&&a()),t}}
|
|
10
|
+
/*! (c) Andrea Giammarchi - ISC */let be=null;const ye=_(new WeakMap),we=(e,t,n)=>{e.apply(t,n)},Ee={async:!1,always:!1},Ce=(e,t)=>"function"==typeof t?t(e):t,xe=(e,t,n,r)=>{const o=be.i++,{hook:s,args:a,stack:i,length:c}=be;o===c&&(be.length=i.push({}));const l=i[o];if(l.args=a,o===c){const o="function"==typeof n,{async:a,always:i}=(o?r:n)||r||Ee;l.$=o?n(t):Ce(void 0,t),l._=a?ye.get(s)||ye.set(s,ve()):we,l.f=t=>{const n=e(l.$,t);(i||l.$!==n)&&(l.$=n,l._(s,null,l.args))}}return[l.$,l.f]},Ne=new WeakMap;function ke({hook:e}){return e===this.hook}const Ae=new WeakMap,$e=_(Ae),_e=()=>{},Se=e=>(t,n)=>{const r=be.i++,{hook:o,after:s,stack:a,length:i}=be;if(r<i){const o=a[r],{update:i,values:c,stop:l}=o;if(!n||n.some(Te,c)){o.values=n,e&&l(e);const{clean:r}=o;r&&(o.clean=null,r());const a=()=>{o.clean=t()};e?i(a):s.push(a)}}else{const r=e?ve():_e,i={clean:null,update:r,values:n,stop:_e};be.length=a.push(i),($e.get(o)||$e.set(o,[])).push(i);const c=()=>{i.clean=t()};e?i.stop=r(c):s.push(c)}},Le=e=>{(Ae.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};Ae.has.bind(Ae);const je=Se(!0),Me=Se(!1),Oe=(e,t)=>{const n=be.i++,{stack:r,length:o}=be;return n===o?be.length=r.push({$:e(),_:t}):t&&!t.some(Te,r[n]._)||(r[n]={$:e(),_:t}),r[n].$};function Te(e,t){return e!==this[t]}let Re=null;try{Re=new{o(){}}.o}catch(Ot){}let Ue=e=>class extends e{};if(Re){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:n}="object"==typeof Reflect?Reflect:{construct(e,n,r){const o=[null];for(let e=0;e<n.length;e++)o.push(n[e]);const s=e.bind.apply(e,o);return t(new s,r.prototype)}};Ue=function(r,o){function s(){return n(o?e(r):r,arguments,s)}return t(s.prototype,r.prototype),t(s,r)}}const We={map:{},re:null},Pe=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let Ze=null;const Be=(e,t)=>{const{map:n,re:r}=Ze||t;return e.replace(r,((e,t,r,o)=>{const{tagName:s,is:a,element:i}=n[r];return i?t?`</${a}>`:`<${a}${o}`:t?`</${s}>`:`<${s} is="${a}"${o}`}))},ze=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,De=()=>Ze,Fe=e=>{Ze=e},He={useCallback:(e,t)=>Oe((()=>e),t),useContext:e=>{const{hook:t,args:n}=be,r=Ne.get(e),o={hook:t,args:n};return r.some(ke,o)||r.push(o),e.value},useEffect:je,useLayoutEffect:Me,useMemo:Oe,useReducer:xe,useRef:e=>{const t=be.i++,{stack:n,length:r}=be;return t===r&&(be.length=n.push({current:e})),n[t]},useState:(e,t)=>xe(Ce,e,void 0,t)},{render:Ve,html:qe,svg:Ie}=(e=>{const t=te(oe);return re(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?p:String))})),n.prototype=t,ae(n);function n(){return Y.apply(this,arguments)}})({transform:()=>e=>Be(e,We)}),{defineProperties:Ge}=Object,Je=new t,Ke=new t,Qe=new t,Xe=new i,Ye="attributeChangedCallback",et="connectedCallback",tt=`dis${et}`,nt=(e,t,n)=>{if(n in e){const r=e[n];t[n]={configurable:true,value(){return dt.call(this),r.apply(this,arguments)}}}else t[n]={configurable:true,value:dt}},rt=e=>{const{prototype:n}=e,r=[],o={html:{configurable:true,get:ht},svg:{configurable:true,get:ft}};if(o["_🔥"]={value:{events:r,info:null}},"handleEvent"in n||(o.handleEvent={configurable:true,value:pt}),"render"in n&&n.render.length){const{oninit:e}=n;Ge(n,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function n(){const r=be,o=[];be={hook:n,args:arguments,stack:t,i:0,length:t.length,after:o};try{return e.apply(null,arguments)}finally{be=r;for(let e=0,{length:t}=o;e<t;e++)o[e]()}}})(this.render.bind(this,He));Ge(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Le.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in n&&(r.push("init"),nt(n,o,"render")),nt(n,o,Ye),nt(n,o,et),nt(n,o,tt),[[Ye,"onattributechanged",mt],[et,"onconnected",gt],[tt,"ondisconnected",bt],[et,"render",vt]].forEach((([e,t,s])=>{if(!(e in n)&&t in n)if("render"!==t&&r.push(t.slice(2)),e in o){const t=o[e].value;o[e]={configurable:true,value(){return t.apply(this,arguments),s.apply(this,arguments)}}}else o[e]={configurable:true,value:s}}));const s=e.booleanAttributes||[];s.forEach((e=>{e in n||(o[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in n||(o[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const s=new t,a="on"+e in n;a&&r.push(e),o[e]={configurable:true,get(){return s.get(this)},set(t){if(s.set(this,t),a){const n=ot(e);if(n.detail=t,Xe.has(this))this.dispatchEvent(n);else{const e=Qe.get(this);e?e.push(n):Qe.set(this,[n])}}}}})),Ge(n,o);const i=s.concat(a);return i.length?Ge(e,{observedAttributes:{configurable:true,get:()=>i}}):e},ot=e=>new r(e),st=(...e)=>new fe("html",e);st.for=qe.for;const at=(...e)=>new fe("svg",e);at.for=Ie.for;const it=(e,n,r)=>{const o=ct(e,n,new t);return r.set(e,o),o},ct=(e,t,n)=>(r,...o)=>{const s=n.get(r)||((e,t,{info:n})=>{const r=n?Be(t.join("_🔥"),n).split("_🔥"):t;return e.set(t,r),r})(n,r,e["_🔥"]);return Ve(e,(()=>t(s,...o)))};function lt(e){this.addEventListener(e,this)}function ut(e){this.dispatchEvent(e)}function ht(){return Je.get(this)||it(this,st,Je)}function ft(){return Ke.get(this)||it(this,at,Ke)}function pt(e){this[`on${e.type}`](e)}function dt(){if(!Xe.has(this)){Xe.add(this),this["_🔥"].events.forEach(lt,this),this.dispatchEvent(ot("init"));const e=Qe.get(this);e&&(Qe.delete(this),e.forEach(ut,this))}}function mt(e,t,n){const r=ot("attributechanged");r.attributeName=e,r.oldValue=t,r.newValue=n,this.dispatchEvent(r)}function gt(){this.dispatchEvent(ot("connected"))}function vt(){this.render()}function bt(){this.dispatchEvent(ot("disconnected"))}const{create:yt,defineProperty:wt,defineProperties:Et,getOwnPropertyNames:Ct,getOwnPropertySymbols:xt,getOwnPropertyDescriptor:Nt,keys:kt}=Object,At={element:HTMLElement},$t=new t;new t;const _t=new t;new t;const St=e=>{const t=yt(null),n=yt(null),r={prototype:n,statics:t};return Ct(e).concat(xt(e)).forEach((r=>{const o=Nt(e,r);switch(o.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]=o;break;default:n[r]=o}})),r},Lt=(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:o,$4:s}=RegExp;let a=o||s||t.tagName||t.extends||"element";const i="fragment"===a;if(i)a="element";else if(!/^[A-Za-z0-9:._-]+$/.test(a))throw"Invalid tag";let c="",l="";a.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=a+n,a="element");const u=c+l;if(customElements.get(u))throw`Duplicated ${u} definition`;const h=Ue("object"==typeof t?_t.get(t)||((e,t)=>{const{statics:n,prototype:r}=St(e),o=Ue(At[t]||(At[t]=document.createElement(t).constructor),!1);return Et(o.prototype,r),Et(o,n),_t.set(e,rt(o)),o})(t,a):$t.get(t)||(e=>{const t=Ue(e,!1);return $t.set(e,rt(t)),t})(t),!0),f="element"===a;if(wt(h,"new",{value:f?()=>document.createElement(u):()=>document.createElement(a,{is:u})}),wt(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());We.map[r]=jt(h,a,u,{id:e,i:0}),We.re=Pe(kt(We.map))}if(i){const{render:e}=h.prototype;wt(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:a}),customElements.define(...p),{Class:h,is:u,name:r,tagName:a}},jt=(e,t,n,r)=>{const{prototype:o}=e,s=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),a=[ze(s)],i=e.includes||e.contains;if(i){const e={};kt(i).forEach((t=>{const n=`-${r.id}-${r.i++}`,{Class:o,is:s,name:c,tagName:l}=Lt(t,i[t],n);a.push(ze(e[c]=jt(o,l,s,r)))}));const t=Pe(kt(e)),{events:n}=o["_🔥"],s={events:n,info:{map:e,re:t}};if(wt(o,"_🔥",{value:s}),"render"in o){const{render:e}=o,{info:t}=s;wt(o,"render",{configurable:!0,value(){const n=De();Fe(t);const r=e.apply(this,arguments);return Fe(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(...a)),s};const Mt=["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 Ot,Tt;Ot="WherebyEmbed",Tt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this)},ondisconnected(){window.removeEventListener("message",this)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Mt].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.roomUrl.origin)},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},startStreaming(){this._postCommand("start_streaming")},stopStreaming(){this._postCommand("stop_streaming")},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.roomUrl.origin)return;const{type:n,payload:r}=t;this.dispatchEvent(new CustomEvent(n,{detail:r}))},render(){const{avatarurl:e,displayname:t,lang:n,metadata:r,minimal:o,room:s,groups:a,virtualbackgroundurl:i}=this;let c,l;try{({roomUrl:c,subdomain:l}=function(e,t){if(!e)throw new Error("Missing room attribute");const n=/https:\/\/([^.]+)(\.whereby\.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(e),r=n&&n[1]||t;if(!r)throw new Error("Missing subdomain attribute");if(!n)throw new Error("Could not parse room URL");return{subdomain:r,roomUrl:new URL(e)}}(s,this.subdomain))}catch(e){return this.html`Whereby: ${e.message}`}this.roomUrl=c,Object.entries({jsApi:!0,we:"1.9.1",iframeSource:l,...t&&{displayName:t},...n&&{lang:n},...r&&{metadata:r},...a&&{groups:a},...i&&{virtualBackgroundUrl:i},...e&&{avatarUrl:e},...null!=o&&{embed:o},...Mt.reduce(((e,t)=>null!=this[t.toLowerCase()]?{...e,[t]:this[t.toLowerCase()]}:e),{})}).forEach((([e,t])=>{this.roomUrl.searchParams.has(e)||this.roomUrl.searchParams.set(e,t)})),this.html`
|
|
11
11
|
<iframe
|
|
12
12
|
ref=${this.iframe}
|
|
13
|
-
src=${
|
|
13
|
+
src=${this.roomUrl}
|
|
14
14
|
allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
|
|
15
|
-
`}},("string"==typeof Ot?Lt(Ot,Tt,""):Lt(Ot.name,Ot,"")).Class;var Rt={sdkVersion:"1.
|
|
15
|
+
`}},("string"==typeof Ot?Lt(Ot,Tt,""):Lt(Ot.name,Ot,"")).Class;var Rt={sdkVersion:"1.9.1"};export{Rt as default};
|