@whereby.com/browser-sdk 2.0.0-alpha1 → 2.0.0-alpha2

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/lib.cjs.js CHANGED
@@ -130,7 +130,7 @@ heresy.define("WherebyEmbed", {
130
130
  if (!subdomain)
131
131
  return this.html `Whereby: Missing subdomain attr.`;
132
132
  const url = new URL(room, `https://${subdomain}.whereby.com`);
133
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha1", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
133
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha2", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
134
134
  // add to URL if set in any way
135
135
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
136
136
  if (!url.searchParams.has(k) && typeof v === "string") {
@@ -5461,7 +5461,7 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5461
5461
  ];
5462
5462
  }
5463
5463
 
5464
- const sdkVersion = "2.0.0-alpha1";
5464
+ const sdkVersion = "2.0.0-alpha2";
5465
5465
 
5466
5466
  exports.sdkVersion = sdkVersion;
5467
5467
  exports.useRoomConnection = useRoomConnection;
package/dist/lib.esm.js CHANGED
@@ -115,7 +115,7 @@ define("WherebyEmbed", {
115
115
  if (!subdomain)
116
116
  return this.html `Whereby: Missing subdomain attr.`;
117
117
  const url = new URL(room, `https://${subdomain}.whereby.com`);
118
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha1", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
118
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha2", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
119
119
  // add to URL if set in any way
120
120
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
121
121
  if (!url.searchParams.has(k) && typeof v === "string") {
@@ -5446,6 +5446,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5446
5446
  ];
5447
5447
  }
5448
5448
 
5449
- const sdkVersion = "2.0.0-alpha1";
5449
+ const sdkVersion = "2.0.0-alpha2";
5450
5450
 
5451
5451
  export { sdkVersion, useRoomConnection };
package/dist/types.d.ts CHANGED
@@ -99,6 +99,6 @@ interface RoomConnectionComponents {
99
99
  }
100
100
  declare function useRoomConnection(roomUrl: string, roomConnectionOptions: RoomConnectionOptions): [state: RoomState, actions: RoomConnectionActions, components: RoomConnectionComponents];
101
101
 
102
- declare const sdkVersion = "2.0.0-alpha1";
102
+ declare const sdkVersion = "2.0.0-alpha2";
103
103
 
104
104
  export { sdkVersion, useRoomConnection };
@@ -7,7 +7,7 @@ function O(e){return e.join(T).replace(N,z).replace(A,F)}var D=" \\f\\n\\r\\t",j
7
7
  /*! (c) Andrea Giammarchi - ISC */
8
8
  var K=function(e){var t="fragment",n="template",i="content"in r(n)?function(e){var t=r(n);return t.innerHTML=e,t.content}:function(e){var i=r(t),a=r(n),o=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;a.innerHTML="<table>"+e+"</table>",o=a.querySelectorAll(c)}else a.innerHTML=e,o=a.childNodes;return s(i,o),i};return function(e,t){return("svg"===t?a:i)(e)};function s(e,t){for(var n=t.length;n--;)e.appendChild(t[0])}function r(n){return n===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",n)}function a(e){var n=r(t),i=r("div");return i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",s(n,i.firstChild.childNodes),n}}(document),J=(e,t,n,i,s)=>{const r=n.length;let a=t.length,o=r,c=0,p=0,d=null;for(;c<a||p<o;)if(a===c){const t=o<r?p?i(n[p-1],-0).nextSibling:i(n[o-p],0):s;for(;p<o;)e.insertBefore(i(n[p++],1),t)}else if(o===p)for(;c<a;)d&&d.has(t[c])||e.removeChild(i(t[c],-1)),c++;else if(t[c]===n[p])c++,p++;else if(t[a-1]===n[o-1])a--,o--;else if(t[c]===n[o-1]&&n[p]===t[a-1]){const s=i(t[--a],-1).nextSibling;e.insertBefore(i(n[p++],1),i(t[c++],-1).nextSibling),e.insertBefore(i(n[--o],1),s),t[a]=n[o]}else{if(!d){d=new Map;let e=p;for(;e<o;)d.set(n[e],e++)}if(d.has(t[c])){const s=d.get(t[c]);if(p<s&&s<o){let r=c,l=1;for(;++r<a&&r<o&&d.get(t[r])===s+l;)l++;if(l>s-p){const r=i(t[c],0);for(;p<s;)e.insertBefore(i(n[p++],1),r)}else e.replaceChild(i(n[p++],1),i(t[c++],-1))}else c++}else e.removeChild(i(t[c++],-1))}return n},Q=function(e,t,n,i,s){var r=s in e,a=e.createDocumentFragment();return a.appendChild(e.createTextNode("g")),a.appendChild(e.createTextNode("")),(r?e.importNode(a,!0):a.cloneNode(!0)).childNodes.length<2?function e(t,n){for(var i=t.cloneNode(),s=t.childNodes||[],r=s.length,a=0;n&&a<r;a++)i.appendChild(e(s[a],n));return i}:r?e.importNode:function(e,t){return e.cloneNode(!!t)}}(document,0,0,0,"importNode"),Y="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},X=R?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,i=0;i<n;)e=e.childNodes[t[i++]];return e}function ee(e,t,n,i){for(var s=e.childNodes,r=s.length,a=0;a<r;){var o=s[a];switch(o.nodeType){case 1:var c=i.concat(a);te(o,t,n,c),ee(o,t,n,c);break;case 8:var p=o.textContent;if(p===C)n.shift(),t.push(P.test(e.nodeName)?se(e,i):ne(o,i.concat(a)));else switch(p.slice(0,2)){case"/*":if("*/"!==p.slice(-2))break;case"👻":e.removeChild(o),a--,r--}break;case 3:P.test(e.nodeName)&&Y.call(o.textContent)===T&&(n.shift(),t.push(se(e,i)))}a++}}function te(e,t,n,i){for(var s=e.attributes,r=[],a=[],o=X(s,n),c=o.length,p=0;p<c;){var d,l=o[p++],u=l.value===C;if(u||1<(d=l.value.split(T)).length){var m=l.name;if(r.indexOf(m)<0){r.push(m);var h=n.shift().replace(u?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+m+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),f=s[h]||s[h.toLowerCase()];if(u)t.push(ie(f,i,h,null));else{for(var g=d.length-2;g--;)n.shift();t.push(ie(f,i,h,d))}}a.push(l)}}p=0;for(var v=(0<(c=a.length)&&R&&!("ownerSVGElement"in e));p<c;){var b=a[p++];v&&(b.value=""),e.removeAttribute(b.name)}var y=e.nodeName;if(/^script$/i.test(y)){var _=document.createElement(y);for(c=s.length,p=0;p<c;)_.setAttributeNode(s[p++].cloneNode(!0));_.textContent=e.textContent,e.parentNode.replaceChild(_,e)}}function ne(e,t){return{type:"any",node:e,path:t}}function ie(e,t,n,i){return{type:"attr",node:e,path:t,name:n,sparse:i}}function se(e,t){return{type:"text",node:e,path:t}}var re=H(new b);function ae(e,t){var n=(e.convert||O)(t),i=e.transform;i&&(n=i(n));var s=K(n,e.type);pe(s);var r=[];return ee(s,r,t.slice(0),[]),{content:s,updates:function(n){for(var i=[],s=r.length,a=0,o=0;a<s;){var c=r[a++],p=Z(n,c.path);switch(c.type){case"any":i.push({fn:e.any(p,[]),sparse:!1});break;case"attr":var d=c.sparse,l=e.attribute(p,c.name,c.node);null===d?i.push({fn:l,sparse:!1}):(o+=d.length-2,i.push({fn:l,sparse:!0,values:d}));break;case"text":i.push({fn:e.text(p),sparse:!1}),p.textContent=""}}return s+=o,function(){var e=arguments.length;if(s!==e-1)throw new Error(e-1+" values instead of "+s+"\n"+t.join("${value}"));for(var r=1,a=1;r<e;){var o=i[r-a];if(o.sparse){var c=o.values,p=c[0],d=1,l=c.length;for(a+=l-2;d<l;)p+=arguments[r++]+c[d++];o.fn(p)}else o.fn(arguments[r++])}return n}}}}function oe(e,t){var n=re.get(t)||re.set(t,ae(e,t));return n.updates(Q.call(document,n.content,!0))}var ce=[];function pe(e){for(var t=e.childNodes,n=t.length;n--;){var i=t[n];1!==i.nodeType&&0===Y.call(i.textContent).length&&e.removeChild(i)}}
9
9
  /*! (c) Andrea Giammarchi - ISC */var de=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),i(n,!0)}(e,t):i(e.style,!1)};function n(e,t,n){return t+"-"+n.toLowerCase()}function i(i,s){var r,a;return function(o){var c,p,d,l;switch(typeof o){case"object":if(o){if("object"===r){if(!s&&a!==o)for(p in a)p in o||(i[p]="")}else s?i.value="":i.cssText="";for(p in c=s?{}:i,o)d="number"!=typeof(l=o[p])||e.test(p)?l:l+"px",!s&&/^--/.test(p)?c.setProperty(p,d):c[p]=d;r="object",s?i.value=function(e){var i,s=[];for(i in e)s.push(i.replace(t,n),":",e[i],";");return s.join("")}(a=c):a=o;break}default:a!=o&&(r="string",a=o,s?i.value=o||"":i.cssText=o||"")}}}}();const le=(e,t)=>{let n,i=!0;const s=document.createAttributeNS(null,t);return t=>{n!==t&&(n=t,null==n?i||(e.removeAttributeNode(s),i=!0):(s.value=t,i&&(e.setAttributeNodeNS(s),i=!1)))}},ue=({dataset:e})=>t=>{for(const n in t){const i=t[n];null==i?delete e[n]:e[n]=i}},me=(e,t)=>"dataset"===t?ue(e):n=>{e[t]=n},he=/^(?:form|list)$/i,fe=(e,t)=>e.ownerDocument.createTextNode(t);function ge(e){return this.type=e,function(e){var t=ce,n=pe;return function(i){return t!==i&&(n=oe(e,t=i)),n.apply(null,arguments)}}(this)}function ve(e){return e(this)}ge.prototype={attribute(e,t,n){const i="svg"===this.type;switch(t){case"class":if(i)return le(e,t);t="className";case"props":return me(e,t);case"aria":return(e=>t=>{for(const n in t){const i="role"===n?n:`aria-${n}`,s=t[n];null==s?e.removeAttribute(i):e.setAttribute(i,s)}})(e);case"style":return de(e,n,i);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return ue(e);default:return"."===t.slice(0,1)?me(e,t.slice(1)):"?"===t.slice(0,1)?((e,t,n)=>i=>{n!==!!i&&((n=!!i)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let n,i=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(i=i.toLowerCase()),t=>{const s=q(t)?t:[t,!1];n!==s[0]&&(n&&e.removeEventListener(i,n,s[1]),(n=s[0])&&e.addEventListener(i,n,s[1]))}})(e,t):!(t in e)||i||he.test(t)?le(e,t):((e,t)=>{let n;return i=>{n!==i&&(n=i,e[t]!==i&&(null==i?(e[t]="",e.removeAttribute(t)):e[t]=i))}})(e,t)}},any(e,t){const{type:n}=this;let i,s=!1;const r=a=>{switch(typeof a){case"string":case"number":case"boolean":s?i!==a&&(i=a,t[0].textContent=a):(s=!0,i=a,t=J(e.parentNode,t,[fe(e,a)],W,e));break;case"function":r(a(e));break;case"object":case"undefined":if(null==a){s=!1,t=J(e.parentNode,t,[],W,e);break}default:if(s=!1,i=a,q(a))if(0===a.length)t.length&&(t=J(e.parentNode,t,[],W,e));else switch(typeof a[0]){case"string":case"number":case"boolean":r(String(a));break;case"function":r(a.map(ve,e));break;case"object":q(a[0])&&(a=a.concat.apply([],a));default:t=J(e.parentNode,t,a,W,e)}else"ELEMENT_NODE"in a?t=J(e.parentNode,t,11===a.nodeType?V.call(a.childNodes):[a],W,e):"text"in a?r(String(a.text)):"any"in a?r(a.any):"html"in a?t=J(e.parentNode,t,V.call(K([].concat(a.html).join(""),n).childNodes),W,e):"length"in a&&r(V.call(a))}};return r},text(e){let t;const n=i=>{if(t!==i){t=i;const s=typeof i;"object"===s&&i?"text"in i?n(String(i.text)):"any"in i?n(i.any):"html"in i?n([].concat(i.html).join("")):"length"in i&&n(V.call(i).join("")):"function"===s?n(i(e)):e.textContent=null==i?"":i}};return n}};const{create:be,freeze:ye,keys:_e}=Object,xe=ge.prototype,we=H(new b),Se=e=>({html:Ce("html",e),svg:Ce("svg",e),render(t,n){const i="function"==typeof n?n():n,s=we.get(t)||we.set(t,ke()),r=i instanceof Pe?Re(e,s,i):i;return r!==s.wire&&(s.wire=r,t.textContent="",t.appendChild(r.valueOf())),t}}),ke=()=>({stack:[],entry:null,wire:null}),Ce=(e,t)=>{const n=H(new b);return i.for=(e,s)=>{const r=n.get(e)||n.set(e,be(null));return r[s]||(r[s]=(e=>function(){return Re(t,e,i.apply(null,arguments))})(ke()))},i.node=function(){return Re(t,ke(),i.apply(null,arguments)).valueOf()},i;function i(){return new Pe(e,Oe.apply(null,arguments))}},Re=(e,t,{type:n,template:i,values:s})=>{const{length:r}=s;Te(e,t,s,r);let{entry:a}=t;if(a&&a.template===i&&a.type===n)a.tag(i,...s);else{const r=new e(n);t.entry=a={type:n,template:i,tag:r,wire:G(r(i,...s))}}return a.wire},Te=(e,{stack:t},n,i)=>{for(let s=0;s<i;s++){const i=n[s];i instanceof Ee?n[s]=Re(e,t[s]||(t[s]=ke()),i):q(i)?Te(e,t[s]||(t[s]=ke()),i,i.length):t[s]=null}i<t.length&&t.splice(i)};function Pe(e,t){this.type=e,this.template=t.shift(),this.values=t}ye(Pe);const Ee=Pe;function Oe(){let e=[],t=0,{length:n}=arguments;for(;t<n;)e.push(arguments[t++]);return e}Se(ge);var De="function"==typeof cancelAnimationFrame,je=De?cancelAnimationFrame:clearTimeout,Ie=De?requestAnimationFrame:setTimeout;function Me(e){var t,n,i,s,r;return o(),function(e,o,p){return i=e,s=o,r=p,n||(n=Ie(a)),--t<0&&c(!0),c};function a(){o(),i.apply(s,r||[])}function o(){t=e||1/0,n=De?0:null}function c(e){var t=!!n;return t&&(je(n),e&&a()),t}}
10
- /*! (c) Andrea Giammarchi - ISC */let Le=null;const Ae=H(new WeakMap),Ne=(e,t,n)=>{e.apply(t,n)},Be={async:!1,always:!1},Fe=(e,t)=>"function"==typeof t?t(e):t,Ue=(e,t,n,i)=>{const s=Le.i++,{hook:r,args:a,stack:o,length:c}=Le;s===c&&(Le.length=o.push({}));const p=o[s];if(p.args=a,s===c){const s="function"==typeof n,{async:a,always:o}=(s?i:n)||i||Be;p.$=s?n(t):Fe(void 0,t),p._=a?Ae.get(r)||Ae.set(r,Me()):Ne,p.f=t=>{const n=e(p.$,t);(o||p.$!==n)&&(p.$=n,p._(r,null,p.args))}}return[p.$,p.f]},ze=new WeakMap;function qe({hook:e}){return e===this.hook}const $e=new WeakMap,Ve=H($e),He=()=>{},We=e=>(t,n)=>{const i=Le.i++,{hook:s,after:r,stack:a,length:o}=Le;if(i<o){const s=a[i],{update:o,values:c,stop:p}=s;if(!n||n.some(Ye,c)){s.values=n,e&&p(e);const{clean:i}=s;i&&(s.clean=null,i());const a=()=>{s.clean=t()};e?o(a):r.push(a)}}else{const i=e?Me():He,o={clean:null,update:i,values:n,stop:He};Le.length=a.push(o),(Ve.get(s)||Ve.set(s,[])).push(o);const c=()=>{o.clean=t()};e?o.stop=i(c):r.push(c)}},Ge=e=>{($e.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};$e.has.bind($e);const Ke=We(!0),Je=We(!1),Qe=(e,t)=>{const n=Le.i++,{stack:i,length:s}=Le;return n===s?Le.length=i.push({$:e(),_:t}):t&&!t.some(Ye,i[n]._)||(i[n]={$:e(),_:t}),i[n].$};function Ye(e,t){return e!==this[t]}let Xe=null;try{Xe=new{o(){}}.o}catch(Qt){}let Ze=e=>class extends e{};if(Xe){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:n}="object"==typeof Reflect?Reflect:{construct(e,n,i){const s=[null];for(let e=0;e<n.length;e++)s.push(n[e]);const r=e.bind.apply(e,s);return t(new r,i.prototype)}};Ze=function(i,s){function r(){return n(s?e(i):i,arguments,r)}return t(r.prototype,i.prototype),t(r,i)}}const et={map:{},re:null},tt=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let nt=null;const it=(e,t)=>{const{map:n,re:i}=nt||t;return e.replace(i,((e,t,i,s)=>{const{tagName:r,is:a,element:o}=n[i];return o?t?`</${a}>`:`<${a}${s}`:t?`</${r}>`:`<${r} is="${a}"${s}`}))},st=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,rt=()=>nt,at=e=>{nt=e},ot={useCallback:(e,t)=>Qe((()=>e),t),useContext:e=>{const{hook:t,args:n}=Le,i=ze.get(e),s={hook:t,args:n};return i.some(qe,s)||i.push(s),e.value},useEffect:Ke,useLayoutEffect:Je,useMemo:Qe,useReducer:Ue,useRef:e=>{const t=Le.i++,{stack:n,length:i}=Le;return t===i&&(Le.length=n.push({current:e})),n[t]},useState:(e,t)=>Ue(Fe,e,void 0,t)},{render:ct,html:pt,svg:dt}=(e=>{const t=be(xe);return _e(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?O:String))})),n.prototype=t,Se(n);function n(){return ge.apply(this,arguments)}})({transform:()=>e=>it(e,et)}),{defineProperties:lt}=Object,ut=new b,mt=new b,ht=new b,ft=new k,gt="attributeChangedCallback",vt="connectedCallback",bt=`dis${vt}`,yt=(e,t,n)=>{if(n in e){const i=e[n];t[n]={configurable:true,value(){return Dt.call(this),i.apply(this,arguments)}}}else t[n]={configurable:true,value:Dt}},_t=e=>{const{prototype:t}=e,n=[],i={html:{configurable:true,get:Pt},svg:{configurable:true,get:Et}};if(i["_🔥"]={value:{events:n,info:null}},"handleEvent"in t||(i.handleEvent={configurable:true,value:Ot}),"render"in t&&t.render.length){const{oninit:e}=t;lt(t,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function n(){const i=Le,s=[];Le={hook:n,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{Le=i;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,ot));lt(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Ge.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in t&&(n.push("init"),yt(t,i,"render")),yt(t,i,gt),yt(t,i,vt),yt(t,i,bt),[[gt,"onattributechanged",jt],[vt,"onconnected",It],[bt,"ondisconnected",Lt],[vt,"render",Mt]].forEach((([e,s,r])=>{if(!(e in t)&&s in t)if("render"!==s&&n.push(s.slice(2)),e in i){const t=i[e].value;i[e]={configurable:true,value(){return t.apply(this,arguments),r.apply(this,arguments)}}}else i[e]={configurable:true,value:r}}));const s=e.booleanAttributes||[];s.forEach((e=>{e in t||(i[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const r=e.observedAttributes||[];r.forEach((e=>{e in t||(i[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 b,r="on"+e in t;r&&n.push(e),i[e]={configurable:true,get(){return s.get(this)},set(t){if(s.set(this,t),r){const n=xt(e);if(n.detail=t,ft.has(this))this.dispatchEvent(n);else{const e=ht.get(this);e?e.push(n):ht.set(this,[n])}}}}})),lt(t,i);const a=s.concat(r);return a.length?lt(e,{observedAttributes:{configurable:true,get:()=>a}}):e},xt=e=>new _(e),wt=(...e)=>new Ee("html",e);wt.for=pt.for;const St=(...e)=>new Ee("svg",e);St.for=dt.for;const kt=(e,t,n)=>{const i=Ct(e,t,new b);return n.set(e,i),i},Ct=(e,t,n)=>(i,...s)=>{const r=n.get(i)||((e,t,{info:n})=>{const i=n?it(t.join("_🔥"),n).split("_🔥"):t;return e.set(t,i),i})(n,i,e["_🔥"]);return ct(e,(()=>t(r,...s)))};function Rt(e){this.addEventListener(e,this)}function Tt(e){this.dispatchEvent(e)}function Pt(){return ut.get(this)||kt(this,wt,ut)}function Et(){return mt.get(this)||kt(this,St,mt)}function Ot(e){this[`on${e.type}`](e)}function Dt(){if(!ft.has(this)){ft.add(this),this["_🔥"].events.forEach(Rt,this),this.dispatchEvent(xt("init"));const e=ht.get(this);e&&(ht.delete(this),e.forEach(Tt,this))}}function jt(e,t,n){const i=xt("attributechanged");i.attributeName=e,i.oldValue=t,i.newValue=n,this.dispatchEvent(i)}function It(){this.dispatchEvent(xt("connected"))}function Mt(){this.render()}function Lt(){this.dispatchEvent(xt("disconnected"))}const{create:At,defineProperty:Nt,defineProperties:Bt,getOwnPropertyNames:Ft,getOwnPropertySymbols:Ut,getOwnPropertyDescriptor:zt,keys:qt}=Object,$t={element:HTMLElement},Vt=new b;new b;const Ht=new b;new b;const Wt=e=>{const t=At(null),n=At(null),i={prototype:n,statics:t};return Ft(e).concat(Ut(e)).forEach((i=>{const s=zt(e,i);switch(s.enumerable=!1,i){case"extends":i="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[i]=s;break;default:n[i]=s}})),i},Gt=(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:i,$3:s,$4:r}=RegExp;let a=s||r||t.tagName||t.extends||"element";const o="fragment"===a;if(o)a="element";else if(!/^[A-Za-z0-9:._-]+$/.test(a))throw"Invalid tag";let c="",p="";a.indexOf("-")<0?(c=i.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+n,c.indexOf("-")<0&&(p="-heresy")):(c=a+n,a="element");const d=c+p;if(customElements.get(d))throw`Duplicated ${d} definition`;const l=Ze("object"==typeof t?Ht.get(t)||((e,t)=>{const{statics:n,prototype:i}=Wt(e),s=Ze($t[t]||($t[t]=document.createElement(t).constructor),!1);return Bt(s.prototype,i),Bt(s,n),Ht.set(e,_t(s)),s})(t,a):Vt.get(t)||(e=>{const t=Ze(e,!1);return Vt.set(e,_t(t)),t})(t),!0),u="element"===a;if(Nt(l,"new",{value:u?()=>document.createElement(d):()=>document.createElement(a,{is:d})}),Nt(l.prototype,"is",{value:d}),""===n){const e=(e=>{const{length:t}=e;let n=0,i=0;for(;i<t;)n=(n<<5)-n+e.charCodeAt(i++),n&=n;return n.toString(36)})(c.toUpperCase());et.map[i]=Kt(l,a,d,{id:e,i:0}),et.re=tt(qt(et.map))}if(o){const{render:e}=l.prototype;Nt(l.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 m=[d,l];return u||m.push({extends:a}),customElements.define(...m),{Class:l,is:d,name:i,tagName:a}},Kt=(e,t,n,i)=>{const{prototype:s}=e,r=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),a=[st(r)],o=e.includes||e.contains;if(o){const e={};qt(o).forEach((t=>{const n=`-${i.id}-${i.i++}`,{Class:s,is:r,name:c,tagName:p}=Gt(t,o[t],n);a.push(st(e[c]=Kt(s,p,r,i)))}));const t=tt(qt(e)),{events:n}=s["_🔥"],r={events:n,info:{map:e,re:t}};if(Nt(s,"_🔥",{value:r}),"render"in s){const{render:e}=s,{info:t}=r;Nt(s,"render",{configurable:!0,value(){const n=rt();at(t);const i=e.apply(this,arguments);return at(n),i}})}}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)),r},Jt=["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 Qt,Yt;Qt="WherebyEmbed",Yt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this.onmessage)},ondisconnected(){window.removeEventListener("message",this.onmessage)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Jt].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:i}=t;this.dispatchEvent(new CustomEvent(n,{detail:i}))},render(){const{avatarurl:e,displayname:t,lang:n,metadata:i,minimal:s,room:r,groups:a,virtualbackgroundurl:o}=this;if(!r)return this.html`Whereby: Missing room attribute.`;const c=/https:\/\/([^.]+)\.whereby.com\/.+/.exec(r),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;const d=new URL(r,`https://${p}.whereby.com`);return Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha1",iframeSource:p},t&&{displayName:t}),n&&{lang:n}),i&&{metadata:i}),a&&{groups:a}),o&&{virtualBackgroundUrl:o}),e&&{avatarUrl:e}),null!=s&&{embed:s}),Jt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{d.searchParams.has(e)||"string"!=typeof t||d.searchParams.set(e,t)})),this.html`
10
+ /*! (c) Andrea Giammarchi - ISC */let Le=null;const Ae=H(new WeakMap),Ne=(e,t,n)=>{e.apply(t,n)},Be={async:!1,always:!1},Fe=(e,t)=>"function"==typeof t?t(e):t,Ue=(e,t,n,i)=>{const s=Le.i++,{hook:r,args:a,stack:o,length:c}=Le;s===c&&(Le.length=o.push({}));const p=o[s];if(p.args=a,s===c){const s="function"==typeof n,{async:a,always:o}=(s?i:n)||i||Be;p.$=s?n(t):Fe(void 0,t),p._=a?Ae.get(r)||Ae.set(r,Me()):Ne,p.f=t=>{const n=e(p.$,t);(o||p.$!==n)&&(p.$=n,p._(r,null,p.args))}}return[p.$,p.f]},ze=new WeakMap;function qe({hook:e}){return e===this.hook}const $e=new WeakMap,Ve=H($e),He=()=>{},We=e=>(t,n)=>{const i=Le.i++,{hook:s,after:r,stack:a,length:o}=Le;if(i<o){const s=a[i],{update:o,values:c,stop:p}=s;if(!n||n.some(Ye,c)){s.values=n,e&&p(e);const{clean:i}=s;i&&(s.clean=null,i());const a=()=>{s.clean=t()};e?o(a):r.push(a)}}else{const i=e?Me():He,o={clean:null,update:i,values:n,stop:He};Le.length=a.push(o),(Ve.get(s)||Ve.set(s,[])).push(o);const c=()=>{o.clean=t()};e?o.stop=i(c):r.push(c)}},Ge=e=>{($e.get(e)||[]).forEach((e=>{const{clean:t,stop:n}=e;n(),t&&(e.clean=null,t())}))};$e.has.bind($e);const Ke=We(!0),Je=We(!1),Qe=(e,t)=>{const n=Le.i++,{stack:i,length:s}=Le;return n===s?Le.length=i.push({$:e(),_:t}):t&&!t.some(Ye,i[n]._)||(i[n]={$:e(),_:t}),i[n].$};function Ye(e,t){return e!==this[t]}let Xe=null;try{Xe=new{o(){}}.o}catch(Qt){}let Ze=e=>class extends e{};if(Xe){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:n}="object"==typeof Reflect?Reflect:{construct(e,n,i){const s=[null];for(let e=0;e<n.length;e++)s.push(n[e]);const r=e.bind.apply(e,s);return t(new r,i.prototype)}};Ze=function(i,s){function r(){return n(s?e(i):i,arguments,r)}return t(r.prototype,i.prototype),t(r,i)}}const et={map:{},re:null},tt=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let nt=null;const it=(e,t)=>{const{map:n,re:i}=nt||t;return e.replace(i,((e,t,i,s)=>{const{tagName:r,is:a,element:o}=n[i];return o?t?`</${a}>`:`<${a}${s}`:t?`</${r}>`:`<${r} is="${a}"${s}`}))},st=({tagName:e,is:t,element:n})=>n?t:`${e}[is="${t}"]`,rt=()=>nt,at=e=>{nt=e},ot={useCallback:(e,t)=>Qe((()=>e),t),useContext:e=>{const{hook:t,args:n}=Le,i=ze.get(e),s={hook:t,args:n};return i.some(qe,s)||i.push(s),e.value},useEffect:Ke,useLayoutEffect:Je,useMemo:Qe,useReducer:Ue,useRef:e=>{const t=Le.i++,{stack:n,length:i}=Le;return t===i&&(Le.length=n.push({current:e})),n[t]},useState:(e,t)=>Ue(Fe,e,void 0,t)},{render:ct,html:pt,svg:dt}=(e=>{const t=be(xe);return _e(e).forEach((n=>{t[n]=e[n](t[n]||("convert"===n?O:String))})),n.prototype=t,Se(n);function n(){return ge.apply(this,arguments)}})({transform:()=>e=>it(e,et)}),{defineProperties:lt}=Object,ut=new b,mt=new b,ht=new b,ft=new k,gt="attributeChangedCallback",vt="connectedCallback",bt=`dis${vt}`,yt=(e,t,n)=>{if(n in e){const i=e[n];t[n]={configurable:true,value(){return Dt.call(this),i.apply(this,arguments)}}}else t[n]={configurable:true,value:Dt}},_t=e=>{const{prototype:t}=e,n=[],i={html:{configurable:true,get:Pt},svg:{configurable:true,get:Et}};if(i["_🔥"]={value:{events:n,info:null}},"handleEvent"in t||(i.handleEvent={configurable:true,value:Ot}),"render"in t&&t.render.length){const{oninit:e}=t;lt(t,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function n(){const i=Le,s=[];Le={hook:n,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{Le=i;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,ot));lt(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Ge.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in t&&(n.push("init"),yt(t,i,"render")),yt(t,i,gt),yt(t,i,vt),yt(t,i,bt),[[gt,"onattributechanged",jt],[vt,"onconnected",It],[bt,"ondisconnected",Lt],[vt,"render",Mt]].forEach((([e,s,r])=>{if(!(e in t)&&s in t)if("render"!==s&&n.push(s.slice(2)),e in i){const t=i[e].value;i[e]={configurable:true,value(){return t.apply(this,arguments),r.apply(this,arguments)}}}else i[e]={configurable:true,value:r}}));const s=e.booleanAttributes||[];s.forEach((e=>{e in t||(i[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const r=e.observedAttributes||[];r.forEach((e=>{e in t||(i[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 b,r="on"+e in t;r&&n.push(e),i[e]={configurable:true,get(){return s.get(this)},set(t){if(s.set(this,t),r){const n=xt(e);if(n.detail=t,ft.has(this))this.dispatchEvent(n);else{const e=ht.get(this);e?e.push(n):ht.set(this,[n])}}}}})),lt(t,i);const a=s.concat(r);return a.length?lt(e,{observedAttributes:{configurable:true,get:()=>a}}):e},xt=e=>new _(e),wt=(...e)=>new Ee("html",e);wt.for=pt.for;const St=(...e)=>new Ee("svg",e);St.for=dt.for;const kt=(e,t,n)=>{const i=Ct(e,t,new b);return n.set(e,i),i},Ct=(e,t,n)=>(i,...s)=>{const r=n.get(i)||((e,t,{info:n})=>{const i=n?it(t.join("_🔥"),n).split("_🔥"):t;return e.set(t,i),i})(n,i,e["_🔥"]);return ct(e,(()=>t(r,...s)))};function Rt(e){this.addEventListener(e,this)}function Tt(e){this.dispatchEvent(e)}function Pt(){return ut.get(this)||kt(this,wt,ut)}function Et(){return mt.get(this)||kt(this,St,mt)}function Ot(e){this[`on${e.type}`](e)}function Dt(){if(!ft.has(this)){ft.add(this),this["_🔥"].events.forEach(Rt,this),this.dispatchEvent(xt("init"));const e=ht.get(this);e&&(ht.delete(this),e.forEach(Tt,this))}}function jt(e,t,n){const i=xt("attributechanged");i.attributeName=e,i.oldValue=t,i.newValue=n,this.dispatchEvent(i)}function It(){this.dispatchEvent(xt("connected"))}function Mt(){this.render()}function Lt(){this.dispatchEvent(xt("disconnected"))}const{create:At,defineProperty:Nt,defineProperties:Bt,getOwnPropertyNames:Ft,getOwnPropertySymbols:Ut,getOwnPropertyDescriptor:zt,keys:qt}=Object,$t={element:HTMLElement},Vt=new b;new b;const Ht=new b;new b;const Wt=e=>{const t=At(null),n=At(null),i={prototype:n,statics:t};return Ft(e).concat(Ut(e)).forEach((i=>{const s=zt(e,i);switch(s.enumerable=!1,i){case"extends":i="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[i]=s;break;default:n[i]=s}})),i},Gt=(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:i,$3:s,$4:r}=RegExp;let a=s||r||t.tagName||t.extends||"element";const o="fragment"===a;if(o)a="element";else if(!/^[A-Za-z0-9:._-]+$/.test(a))throw"Invalid tag";let c="",p="";a.indexOf("-")<0?(c=i.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+n,c.indexOf("-")<0&&(p="-heresy")):(c=a+n,a="element");const d=c+p;if(customElements.get(d))throw`Duplicated ${d} definition`;const l=Ze("object"==typeof t?Ht.get(t)||((e,t)=>{const{statics:n,prototype:i}=Wt(e),s=Ze($t[t]||($t[t]=document.createElement(t).constructor),!1);return Bt(s.prototype,i),Bt(s,n),Ht.set(e,_t(s)),s})(t,a):Vt.get(t)||(e=>{const t=Ze(e,!1);return Vt.set(e,_t(t)),t})(t),!0),u="element"===a;if(Nt(l,"new",{value:u?()=>document.createElement(d):()=>document.createElement(a,{is:d})}),Nt(l.prototype,"is",{value:d}),""===n){const e=(e=>{const{length:t}=e;let n=0,i=0;for(;i<t;)n=(n<<5)-n+e.charCodeAt(i++),n&=n;return n.toString(36)})(c.toUpperCase());et.map[i]=Kt(l,a,d,{id:e,i:0}),et.re=tt(qt(et.map))}if(o){const{render:e}=l.prototype;Nt(l.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 m=[d,l];return u||m.push({extends:a}),customElements.define(...m),{Class:l,is:d,name:i,tagName:a}},Kt=(e,t,n,i)=>{const{prototype:s}=e,r=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,n),a=[st(r)],o=e.includes||e.contains;if(o){const e={};qt(o).forEach((t=>{const n=`-${i.id}-${i.i++}`,{Class:s,is:r,name:c,tagName:p}=Gt(t,o[t],n);a.push(st(e[c]=Kt(s,p,r,i)))}));const t=tt(qt(e)),{events:n}=s["_🔥"],r={events:n,info:{map:e,re:t}};if(Nt(s,"_🔥",{value:r}),"render"in s){const{render:e}=s,{info:t}=r;Nt(s,"render",{configurable:!0,value(){const n=rt();at(t);const i=e.apply(this,arguments);return at(n),i}})}}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)),r},Jt=["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 Qt,Yt;Qt="WherebyEmbed",Yt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this.onmessage)},ondisconnected(){window.removeEventListener("message",this.onmessage)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Jt].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:i}=t;this.dispatchEvent(new CustomEvent(n,{detail:i}))},render(){const{avatarurl:e,displayname:t,lang:n,metadata:i,minimal:s,room:r,groups:a,virtualbackgroundurl:o}=this;if(!r)return this.html`Whereby: Missing room attribute.`;const c=/https:\/\/([^.]+)\.whereby.com\/.+/.exec(r),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;const d=new URL(r,`https://${p}.whereby.com`);return Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha2",iframeSource:p},t&&{displayName:t}),n&&{lang:n}),i&&{metadata:i}),a&&{groups:a}),o&&{virtualBackgroundUrl:o}),e&&{avatarUrl:e}),null!=s&&{embed:s}),Jt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{d.searchParams.has(e)||"string"!=typeof t||d.searchParams.set(e,t)})),this.html`
11
11
  <iframe
12
12
  ref=${this.iframe}
13
13
  src=${d}
@@ -102,4 +102,4 @@ var t=Zr.exports=Aa();t.Server=Na(),t.Sender=ha(),t.Receiver=Pa(),t.createServer
102
102
  * Copyright(c) 2015 Douglas Christopher Wilson
103
103
  * MIT Licensed
104
104
  */
105
- function(e){var t=Hf,n=f.extname,i=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function r(e){if(!e||"string"!=typeof e)return!1;var n=i.exec(e),r=n&&t[n[1].toLowerCase()];return r&&r.charset?r.charset:!(!n||!s.test(n[1]))&&"UTF-8"}e.charset=r,e.charsets={lookup:r},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var n=-1===t.indexOf("/")?e.lookup(t):t;if(!n)return!1;if(-1===n.indexOf("charset")){var i=e.charset(n);i&&(n+="; charset="+i.toLowerCase())}return n},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var n=i.exec(t),s=n&&e.extensions[n[1].toLowerCase()];if(!s||!s.length)return!1;return s[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var i=n("x."+t).toLowerCase().substr(1);if(!i)return!1;return e.types[i]||!1},e.types=Object.create(null),function(e,n){var i=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(s){var r=t[s],a=r.extensions;if(a&&a.length){e[s]=a;for(var o=0;o<a.length;o++){var c=a[o];if(n[c]){var p=i.indexOf(t[n[c]].source),d=i.indexOf(r.source);if("application/octet-stream"!==n[c]&&(p>d||p===d&&"application/"===n[c].substr(0,12)))continue}n[c]=s}}}))}(e.extensions,e.types)}(Vf);var Gf=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)},Kf=function(e){var t=!1;return Gf((function(){t=!0})),function(n,i){t?e(n,i):Gf((function(){e(n,i)}))}};var Jf=function(e){Object.keys(e.jobs).forEach(Qf.bind(e)),e.jobs={}};function Qf(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Yf=Kf,Xf=Jf,Zf=function(e,t,n,i){var s=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[s]=function(e,t,n,i){var s;s=2==e.length?e(n,Yf(i)):e(n,t,Yf(i));return s}(t,s,e[s],(function(e,t){s in n.jobs&&(delete n.jobs[s],e?Xf(n):n.results[s]=t,i(e,n.results))}))};var eg=function(e,t){var n=!Array.isArray(e),i={index:0,keyedList:n||t?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};t&&i.keyedList.sort(n?t:function(n,i){return t(e[n],e[i])});return i};var tg=Jf,ng=Kf,ig=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,tg(this),ng(e)(null,this.results)};var sg=Zf,rg=eg,ag=ig,og=function(e,t,n){var i=rg(e);for(;i.index<(i.keyedList||e).length;)sg(e,t,i,(function(e,t){e?n(e,t):0!==Object.keys(i.jobs).length||n(null,i.results)})),i.index++;return ag.bind(i,n)};var cg={},pg=Zf,dg=eg,lg=ig;function ug(e,t){return e<t?-1:e>t?1:0}({get exports(){return cg},set exports(e){cg=e}}).exports=function(e,t,n,i){var s=dg(e,n);return pg(e,t,s,(function n(r,a){r?i(r,a):(s.index++,s.index<(s.keyedList||e).length?pg(e,t,s,n):i(null,s.results))})),lg.bind(s,i)},cg.ascending=ug,cg.descending=function(e,t){return-1*ug(e,t)};var mg=cg;var hg={parallel:og,serial:function(e,t,n){return mg(e,t,null,n)},serialOrdered:cg},fg=qf,gg=t,vg=f,bg=a,yg=o,_g=s.parse,xg=n,wg=p.Stream,Sg=Vf,kg=hg,Cg=function(e,t){return Object.keys(t).forEach((function(n){e[n]=e[n]||t[n]})),e},Rg=Tg;function Tg(e){if(!(this instanceof Tg))return new Tg(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],fg.call(this),e=e||{})this[t]=e[t]}function Pg(e){return jf.isPlainObject(e)||jf.isArray(e)}function Eg(e){return jf.endsWith(e,"[]")?e.slice(0,-2):e}function Og(e,t,n){return e?e.concat(t).map((function(e,t){return e=Eg(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}gg.inherits(Tg,fg),Tg.LINE_BREAK="\r\n",Tg.DEFAULT_CONTENT_TYPE="application/octet-stream",Tg.prototype.append=function(e,t,n){"string"==typeof(n=n||{})&&(n={filename:n});var i=fg.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),gg.isArray(t))this._error(new Error("Arrays are not supported."));else{var s=this._multiPartHeader(e,t,n),r=this._multiPartFooter();i(s),i(t),i(r),this._trackLength(s,t,n)}},Tg.prototype._trackLength=function(e,t,n){var i=0;null!=n.knownLength?i+=+n.knownLength:Buffer.isBuffer(t)?i=t.length:"string"==typeof t&&(i=Buffer.byteLength(t)),this._valueLength+=i,this._overheadLength+=Buffer.byteLength(e)+Tg.LINE_BREAK.length,t&&(t.path||t.readable&&t.hasOwnProperty("httpVersion")||t instanceof wg)&&(n.knownLength||this._valuesToMeasure.push(t))},Tg.prototype._lengthRetriever=function(e,t){e.hasOwnProperty("fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):xg.stat(e.path,(function(n,i){var s;n?t(n):(s=i.size-(e.start?e.start:0),t(null,s))})):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",(function(n){e.pause(),t(null,+n.headers["content-length"])})),e.resume()):t("Unknown stream")},Tg.prototype._multiPartHeader=function(e,t,n){if("string"==typeof n.header)return n.header;var i,s=this._getContentDisposition(t,n),r=this._getContentType(t,n),a="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(s||[]),"Content-Type":[].concat(r||[])};for(var c in"object"==typeof n.header&&Cg(o,n.header),o)o.hasOwnProperty(c)&&null!=(i=o[c])&&(Array.isArray(i)||(i=[i]),i.length&&(a+=c+": "+i.join("; ")+Tg.LINE_BREAK));return"--"+this.getBoundary()+Tg.LINE_BREAK+a+Tg.LINE_BREAK},Tg.prototype._getContentDisposition=function(e,t){var n,i;return"string"==typeof t.filepath?n=vg.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?n=vg.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(n=vg.basename(e.client._httpMessage.path||"")),n&&(i='filename="'+n+'"'),i},Tg.prototype._getContentType=function(e,t){var n=t.contentType;return!n&&e.name&&(n=Sg.lookup(e.name)),!n&&e.path&&(n=Sg.lookup(e.path)),!n&&e.readable&&e.hasOwnProperty("httpVersion")&&(n=e.headers["content-type"]),n||!t.filepath&&!t.filename||(n=Sg.lookup(t.filepath||t.filename)),n||"object"!=typeof e||(n=Tg.DEFAULT_CONTENT_TYPE),n},Tg.prototype._multiPartFooter=function(){return function(e){var t=Tg.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},Tg.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Tg.LINE_BREAK},Tg.prototype.getHeaders=function(e){var t,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(n[t.toLowerCase()]=e[t]);return n},Tg.prototype.setBoundary=function(e){this._boundary=e},Tg.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},Tg.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),n=0,i=this._streams.length;n<i;n++)"function"!=typeof this._streams[n]&&(e=Buffer.isBuffer(this._streams[n])?Buffer.concat([e,this._streams[n]]):Buffer.concat([e,Buffer.from(this._streams[n])]),"string"==typeof this._streams[n]&&this._streams[n].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(Tg.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},Tg.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},Tg.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},Tg.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},Tg.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?kg.parallel(this._valuesToMeasure,this._lengthRetriever,(function(n,i){n?e(n):(i.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},Tg.prototype.submit=function(e,t){var n,i,s={method:"post"};return"string"==typeof e?(e=_g(e),i=Cg({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},s)):(i=Cg(e,s)).port||(i.port="https:"==i.protocol?443:80),i.headers=this.getHeaders(e.headers),n="https:"==i.protocol?yg.request(i):bg.request(i),this.getLength(function(e,i){if(e&&"Unknown stream"!==e)this._error(e);else if(i&&n.setHeader("Content-Length",i),this.pipe(n),t){var s,r=function(e,i){return n.removeListener("error",r),n.removeListener("response",s),t.call(this,e,i)};s=r.bind(this,null),n.on("error",r),n.on("response",s)}}.bind(this)),n},Tg.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},Tg.prototype.toString=function(){return"[object FormData]"};const Dg=jf.toFlatObject(jf,{},null,(function(e){return/^is[A-Z]/.test(e)}));function jg(e,t,n){if(!jf.isObject(e))throw new TypeError("target must be an object");t=t||new(Rg||FormData);const i=(n=jf.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!jf.isUndefined(t[e])}))).metaTokens,s=n.visitor||d,r=n.dots,a=n.indexes,o=(n.Blob||"undefined"!=typeof Blob&&Blob)&&((c=t)&&jf.isFunction(c.append)&&"FormData"===c[Symbol.toStringTag]&&c[Symbol.iterator]);var c;if(!jf.isFunction(s))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(jf.isDate(e))return e.toISOString();if(!o&&jf.isBlob(e))throw new If("Blob is not supported. Use a Buffer instead.");return jf.isArrayBuffer(e)||jf.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,s){let o=e;if(e&&!s&&"object"==typeof e)if(jf.endsWith(n,"{}"))n=i?n:n.slice(0,-2),e=JSON.stringify(e);else if(jf.isArray(e)&&function(e){return jf.isArray(e)&&!e.some(Pg)}(e)||jf.isFileList(e)||jf.endsWith(n,"[]")&&(o=jf.toArray(e)))return n=Eg(n),o.forEach((function(e,i){!jf.isUndefined(e)&&null!==e&&t.append(!0===a?Og([n],i,r):null===a?n:n+"[]",p(e))})),!1;return!!Pg(e)||(t.append(Og(s,n,r),p(e)),!1)}const l=[],u=Object.assign(Dg,{defaultVisitor:d,convertValue:p,isVisitable:Pg});if(!jf.isObject(e))throw new TypeError("data must be an object");return function e(n,i){if(!jf.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+i.join("."));l.push(n),jf.forEach(n,(function(n,r){!0===(!(jf.isUndefined(n)||null===n)&&s.call(t,n,jf.isString(r)?r.trim():r,i,u))&&e(n,i?i.concat(r):[r])})),l.pop()}}(e),t}function Ig(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Mg(e,t){this._pairs=[],e&&jg(e,this,t)}const Lg=Mg.prototype;function Ag(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ng(e,t,n){if(!t)return e;const i=n&&n.encode||Ag,s=n&&n.serialize;let r;if(r=s?s(t,n):jf.isURLSearchParams(t)?t.toString():new Mg(t,n).toString(i),r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}Lg.append=function(e,t){this._pairs.push([e,t])},Lg.toString=function(e){const t=e?function(t){return e.call(this,t,Ig)}:Ig;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Bg{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){jf.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Fg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ug={isNode:!0,classes:{URLSearchParams:s.URLSearchParams,FormData:Rg,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function zg(e){function t(e,n,i,s){let r=e[s++];const a=Number.isFinite(+r),o=s>=e.length;if(r=!r&&jf.isArray(i)?i.length:r,o)return jf.hasOwnProp(i,r)?i[r]=[i[r],n]:i[r]=n,!a;i[r]&&jf.isObject(i[r])||(i[r]=[]);return t(e,n,i[r],s)&&jf.isArray(i[r])&&(i[r]=function(e){const t={},n=Object.keys(e);let i;const s=n.length;let r;for(i=0;i<s;i++)r=n[i],t[r]=e[r];return t}(i[r])),!a}if(jf.isFormData(e)&&jf.isFunction(e.entries)){const n={};return jf.forEachEntry(e,((e,i)=>{t(function(e){return jf.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,n,0)})),n}return null}const qg={"Content-Type":void 0};const $g={transitional:Fg,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=jf.isObject(e);s&&jf.isHTMLForm(e)&&(e=new FormData(e));if(jf.isFormData(e))return i&&i?JSON.stringify(zg(e)):e;if(jf.isArrayBuffer(e)||jf.isBuffer(e)||jf.isStream(e)||jf.isFile(e)||jf.isBlob(e))return e;if(jf.isArrayBufferView(e))return e.buffer;if(jf.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let r;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return jg(e,new Ug.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,i){return jf.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=jf.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return jg(r?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),function(e,t,n){if(jf.isString(e))try{return(t||JSON.parse)(e),jf.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||$g.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&jf.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw If.from(e,If.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ug.classes.FormData,Blob:Ug.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};jf.forEach(["delete","get","head"],(function(e){$g.headers[e]={}})),jf.forEach(["post","put","patch"],(function(e){$g.headers[e]=jf.merge(qg)}));const Vg=jf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Hg=Symbol("internals");function Wg(e){return e&&String(e).trim().toLowerCase()}function Gg(e){return!1===e||null==e?e:jf.isArray(e)?e.map(Gg):String(e)}function Kg(e,t,n,i){return jf.isFunction(i)?i.call(this,t,n):jf.isString(t)?jf.isString(i)?-1!==t.indexOf(i):jf.isRegExp(i)?i.test(t):void 0:void 0}class Jg{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(e,t,n){const s=Wg(t);if(!s)throw new Error("header name must be a non-empty string");const r=jf.findKey(i,s);(!r||void 0===i[r]||!0===n||void 0===n&&!1!==i[r])&&(i[r||t]=Gg(e))}const r=(e,t)=>jf.forEach(e,((e,n)=>s(e,n,t)));return jf.isPlainObject(e)||e instanceof this.constructor?r(e,t):jf.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?r((e=>{const t={};let n,i,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),i=e.substring(s+1).trim(),!n||t[n]&&Vg[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=Wg(e)){const n=jf.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(jf.isFunction(t))return t.call(this,e,n);if(jf.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Wg(e)){const n=jf.findKey(this,e);return!(!n||t&&!Kg(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function s(e){if(e=Wg(e)){const s=jf.findKey(n,e);!s||t&&!Kg(0,n[s],s,t)||(delete n[s],i=!0)}}return jf.isArray(e)?e.forEach(s):s(e),i}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,n={};return jf.forEach(this,((i,s)=>{const r=jf.findKey(n,s);if(r)return t[r]=Gg(i),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(s):String(s).trim();a!==s&&delete t[s],t[a]=Gg(i),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return jf.forEach(this,((n,i)=>{null!=n&&!1!==n&&(t[i]=e&&jf.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[Hg]=this[Hg]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=Wg(e);t[i]||(!function(e,t){const n=jf.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+n,{value:function(e,n,s){return this[i].call(this,t,e,n,s)},configurable:!0})}))}(n,e),t[i]=!0)}return jf.isArray(e)?e.forEach(i):i(e),this}}function Qg(e,t){const n=this||$g,i=t||n,s=Jg.from(i.headers);let r=i.data;return jf.forEach(e,(function(e){r=e.call(n,r,s.normalize(),t?t.status:void 0)})),s.normalize(),r}function Yg(e){return!(!e||!e.__CANCEL__)}function Xg(e,t,n){If.call(this,null==e?"canceled":e,If.ERR_CANCELED,t,n),this.name="CanceledError"}function Zg(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new If("Request failed with status code "+n.status,[If.ERR_BAD_REQUEST,If.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}function ev(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}Jg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),jf.freezeMethods(Jg.prototype),jf.freezeMethods(Jg),jf.inherits(Xg,If,{__CANCEL__:!0});var tv=s.parse,nv={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},iv=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function sv(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var rv,av=function(e){var t="string"==typeof e?tv(e):e||{},n=t.protocol,i=t.host,s=t.port;if("string"!=typeof i||!i||"string"!=typeof n)return"";if(n=n.split(":",1)[0],!function(e,t){var n=(sv("npm_config_no_proxy")||sv("no_proxy")).toLowerCase();if(!n)return!0;if("*"===n)return!1;return n.split(/[,\s]/).every((function(n){if(!n)return!0;var i=n.match(/^(.+):(\d+)$/),s=i?i[1]:n,r=i?parseInt(i[2]):0;return!(!r||r===t)||(/^[.*]/.test(s)?("*"===s.charAt(0)&&(s=s.slice(1)),!iv.call(e,s)):e!==s)}))}(i=i.replace(/:\d*$/,""),s=parseInt(s)||nv[n]||0))return"";var r=sv("npm_config_"+n+"_proxy")||sv(n+"_proxy")||sv("npm_config_proxy")||sv("all_proxy");return r&&-1===r.indexOf("://")&&(r=n+"://"+r),r},ov={},cv={get exports(){return ov},set exports(e){ov=e}},pv=s,dv=pv.URL,lv=a,uv=o,mv=p.Writable,hv=m,fv=function(){if(!rv){try{rv=gc("follow-redirects")}catch(e){}"function"!=typeof rv&&(rv=function(){})}rv.apply(null,arguments)},gv=["abort","aborted","connect","error","socket","timeout"],vv=Object.create(null);gv.forEach((function(e){vv[e]=function(t,n,i){this._redirectable.emit(e,t,n,i)}}));var bv=Pv("ERR_INVALID_URL","Invalid URL",TypeError),yv=Pv("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),_v=Pv("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),xv=Pv("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),wv=Pv("ERR_STREAM_WRITE_AFTER_END","write after end");function Sv(e,t){mv.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var n=this;this._onNativeResponse=function(e){n._processResponse(e)},this._performRequest()}function kv(e){var t={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(e).forEach((function(i){var s=i+":",r=n[s]=e[i],a=t[i]=Object.create(r);Object.defineProperties(a,{request:{value:function(e,i,r){if(Ov(e)){var a;try{a=Rv(new dv(e))}catch(t){a=pv.parse(e)}if(!Ov(a.protocol))throw new bv({input:e});e=a}else dv&&e instanceof dv?e=Rv(e):(r=i,i=e,e={protocol:s});return Dv(i)&&(r=i,i=null),(i=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,i)).nativeProtocols=n,Ov(i.host)||Ov(i.hostname)||(i.hostname="::1"),hv.equal(i.protocol,s,"protocol mismatch"),fv("options",i),new Sv(i,r)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,n){var i=a.request(e,t,n);return i.end(),i},configurable:!0,enumerable:!0,writable:!0}})})),t}function Cv(){}function Rv(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function Tv(e,t){var n;for(var i in t)e.test(i)&&(n=t[i],delete t[i]);return null==n?void 0:String(n).trim()}function Pv(e,t,n){function i(n){Error.captureStackTrace(this,this.constructor),Object.assign(this,n||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return i.prototype=new(n||Error),i.prototype.constructor=i,i.prototype.name="Error ["+e+"]",i}function Ev(e){for(var t of gv)e.removeListener(t,vv[t]);e.on("error",Cv),e.abort()}function Ov(e){return"string"==typeof e||e instanceof String}function Dv(e){return"function"==typeof e}Sv.prototype=Object.create(mv.prototype),Sv.prototype.abort=function(){Ev(this._currentRequest),this.emit("abort")},Sv.prototype.write=function(e,t,n){if(this._ending)throw new wv;if(!Ov(e)&&("object"!=typeof(i=e)||!("length"in i)))throw new TypeError("data should be a string, Buffer or Uint8Array");var i;Dv(t)&&(n=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,n)):(this.emit("error",new xv),this.abort()):n&&n()},Sv.prototype.end=function(e,t,n){if(Dv(e)?(n=e,e=t=null):Dv(t)&&(n=t,t=null),e){var i=this,s=this._currentRequest;this.write(e,t,(function(){i._ended=!0,s.end(null,null,n)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,n)},Sv.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},Sv.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},Sv.prototype.setTimeout=function(e,t){var n=this;function i(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function s(t){n._timeout&&clearTimeout(n._timeout),n._timeout=setTimeout((function(){n.emit("timeout"),r()}),e),i(t)}function r(){n._timeout&&(clearTimeout(n._timeout),n._timeout=null),n.removeListener("abort",r),n.removeListener("error",r),n.removeListener("response",r),t&&n.removeListener("timeout",t),n.socket||n._currentRequest.removeListener("socket",s)}return t&&this.on("timeout",t),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",i),this.on("abort",r),this.on("error",r),this.on("response",r),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){Sv.prototype[e]=function(t,n){return this._currentRequest[e](t,n)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(Sv.prototype,e,{get:function(){return this._currentRequest[e]}})})),Sv.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},Sv.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var n=e.slice(0,-1);this._options.agent=this._options.agents[n]}var i=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var s of(i._redirectable=this,gv))i.on(s,vv[s]);if(this._currentUrl=/^\//.test(this._options.path)?pv.format(this._options):this._options.path,this._isRedirect){var r=0,a=this,o=this._requestBodyBuffers;!function e(t){if(i===a._currentRequest)if(t)a.emit("error",t);else if(r<o.length){var n=o[r++];i.finished||i.write(n.data,n.encoding,e)}else a._ended&&i.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},Sv.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var n=e.headers.location;if(!n||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(Ev(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new _v);else{var i,s=this._options.beforeRedirect;s&&(i=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var r=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],Tv(/^content-/i,this._options.headers));var a,o=Tv(/^host$/i,this._options.headers),c=pv.parse(this._currentUrl),p=o||c.host,d=/^\w+:/.test(n)?this._currentUrl:pv.format(Object.assign(c,{host:p}));try{a=pv.resolve(d,n)}catch(e){return void this.emit("error",new yv({cause:e}))}fv("redirecting to",a),this._isRedirect=!0;var l=pv.parse(a);if(Object.assign(this._options,l),(l.protocol!==c.protocol&&"https:"!==l.protocol||l.host!==p&&!function(e,t){hv(Ov(e)&&Ov(t));var n=e.length-t.length-1;return n>0&&"."===e[n]&&e.endsWith(t)}(l.host,p))&&Tv(/^(?:authorization|cookie)$/i,this._options.headers),Dv(s)){var u={headers:e.headers,statusCode:t},m={url:d,method:r,headers:i};try{s(this._options,u,m)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new yv({cause:e}))}}},cv.exports=kv({http:lv,https:uv}),ov.wrap=kv;function jv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const Iv=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Mv(e,t){e=e||10;const n=new Array(e),i=new Array(e);let s,r=0,a=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),p=i[a];s||(s=c),n[r]=o,i[r]=c;let d=a,l=0;for(;d!==r;)l+=n[d++],d%=e;if(r=(r+1)%e,r===a&&(a=(a+1)%e),c-s<t)return;const u=p&&c-p;return u?Math.round(1e3*l/u):void 0}}const Lv=Symbol("internals");class Av extends p.Transform{constructor(e){super({readableHighWaterMark:(e=jf.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!jf.isUndefined(t[e])))).chunkSize});const t=this,n=this[Lv]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},i=Mv(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",(e=>{"progress"===e&&(n.isCaptured||(n.isCaptured=!0))}));let s=0;n.updateProgress=function(e,t){let n=0;const i=1e3/t;let s=null;return function(t,r){const a=Date.now();if(t||a-n>i)return s&&(clearTimeout(s),s=null),n=a,e.apply(null,r);s||(s=setTimeout((()=>(s=null,n=Date.now(),e.apply(null,r))),i-(a-n)))}}((function(){const e=n.length,r=n.bytesSeen,a=r-s;if(!a||t.destroyed)return;const o=i(a);s=r,process.nextTick((()=>{t.emit("progress",{loaded:r,total:e,progress:e?r/e:void 0,bytes:a,rate:o||void 0,estimated:o&&e&&r<=e?(e-r)/o:void 0})}))}),n.ticksRate);const r=()=>{n.updateProgress(!0)};this.once("end",r),this.once("error",r)}_read(e){const t=this[Lv];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){const i=this,s=this[Lv],r=s.maxRate,a=this.readableHighWaterMark,o=s.timeWindow,c=r/(1e3/o),p=!1!==s.minChunkSize?Math.max(s.minChunkSize,.01*c):0;const d=(e,t)=>{const n=Buffer.byteLength(e);let d,l=null,u=a,m=0;if(r){const e=Date.now();(!s.ts||(m=e-s.ts)>=o)&&(s.ts=e,d=c-s.bytes,s.bytes=d<0?-d:0,m=0),d=c-s.bytes}if(r){if(d<=0)return setTimeout((()=>{t(null,e)}),o-m);d<u&&(u=d)}u&&n>u&&n-u>p&&(l=e.subarray(u),e=e.subarray(0,u)),function(e,t){const n=Buffer.byteLength(e);s.bytesSeen+=n,s.bytes+=n,s.isCaptured&&s.updateProgress(),i.push(e)?process.nextTick(t):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(t)}}(e,l?()=>{process.nextTick(t,null,l)}:t)};d(e,(function e(t,i){if(t)return n(t);i?d(i,e):n(null)}))}setLength(e){return this[Lv].length=+e,this}}const Nv={flush:u.constants.Z_SYNC_FLUSH,finishFlush:u.constants.Z_SYNC_FLUSH},Bv={flush:u.constants.BROTLI_OPERATION_FLUSH,finishFlush:u.constants.BROTLI_OPERATION_FLUSH},Fv=jf.isFunction(u.createBrotliDecompress),{http:Uv,https:zv}=ov,qv=/https:?/,$v=Ug.protocols.map((e=>e+":"));function Vv(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function Hv(e,t,n){let i=t;if(!i&&!1!==i){const e=av(n);e&&(i=new URL(e))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));const t=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=i.hostname||i.host;e.hostname=t,e.host=t,e.port=i.port,e.path=n,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(e){Hv(e,t,e.href)}}var Wv="undefined"!=typeof process&&"process"===jf.kindOf(process)&&function(e){return new Promise((function(t,n){let i=e.data;const s=e.responseType,r=e.responseEncoding,c=e.method.toUpperCase();let l,m,h,f=!1;const g=new d;function v(){l||(l=!0,e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),g.removeAllListeners())}function b(e,i){m||(m=!0,i&&(f=!0,v()),i?n(e):t(e))}const y=function(e){b(e)},_=function(e){b(e,!0)};function x(t){g.emit("abort",!t||t.type?new Xg(null,e,h):t)}g.once("abort",_),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x)));const w=ev(e.baseURL,e.url),S=new URL(w),k=S.protocol||$v[0];if("data:"===k){let t;if("GET"!==c)return Zg(y,_,{status:405,statusText:"method not allowed",headers:{},config:e});try{t=function(e,t,n){const i=n&&n.Blob||Ug.classes.Blob,s=jv(e);if(void 0===t&&i&&(t=!0),"data"===s){e=s.length?e.slice(s.length+1):e;const n=Iv.exec(e);if(!n)throw new If("Invalid URL",If.ERR_INVALID_URL);const r=n[1],a=n[2],o=n[3],c=Buffer.from(decodeURIComponent(o),a?"base64":"utf8");if(t){if(!i)throw new If("Blob is not supported",If.ERR_NOT_SUPPORT);return new i([c],{type:r})}return c}throw new If("Unsupported protocol "+s,If.ERR_NOT_SUPPORT)}(e.url,"blob"===s,{Blob:e.env&&e.env.Blob})}catch(t){throw If.from(t,If.ERR_BAD_REQUEST,e)}return"text"===s?(t=t.toString(r),r&&"utf8"!==r||(i=jf.stripBOM(t))):"stream"===s&&(t=p.Readable.from(t)),Zg(y,_,{data:t,status:200,statusText:"OK",headers:new Jg,config:e})}if(-1===$v.indexOf(k))return _(new If("Unsupported protocol "+k,If.ERR_BAD_REQUEST,e));const C=Jg.from(e.headers).normalize();C.set("User-Agent","axios/1.2.3",!1);const R=e.onDownloadProgress,T=e.onUploadProgress,P=e.maxRate;let E,O;if(jf.isFormData(i)&&jf.isFunction(i.getHeaders))C.set(i.getHeaders());else if(i&&!jf.isStream(i)){if(Buffer.isBuffer(i));else if(jf.isArrayBuffer(i))i=Buffer.from(new Uint8Array(i));else{if(!jf.isString(i))return _(new If("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",If.ERR_BAD_REQUEST,e));i=Buffer.from(i,"utf-8")}if(C.set("Content-Length",i.length,!1),e.maxBodyLength>-1&&i.length>e.maxBodyLength)return _(new If("Request body larger than maxBodyLength limit",If.ERR_BAD_REQUEST,e))}const D=jf.toFiniteNumber(C.getContentLength());let j,I;if(jf.isArray(P)?(E=P[0],O=P[1]):E=O=P,i&&(T||E)&&(jf.isStream(i)||(i=p.Readable.from(i,{objectMode:!1})),i=p.pipeline([i,new Av({length:D,maxRate:jf.toFiniteNumber(E)})],jf.noop),T&&i.on("progress",(e=>{T(Object.assign(e,{upload:!0}))}))),e.auth){j=(e.auth.username||"")+":"+(e.auth.password||"")}if(!j&&S.username){j=S.username+":"+S.password}j&&C.delete("authorization");try{I=Ng(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const n=new Error(t.message);return n.config=e,n.url=e.url,n.exists=!0,_(n)}C.set("Accept-Encoding","gzip, compress, deflate"+(Fv?", br":""),!1);const M={path:I,method:c,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:k,beforeRedirect:Vv,beforeRedirects:{}};let L;e.socketPath?M.socketPath=e.socketPath:(M.hostname=S.hostname,M.port=S.port,Hv(M,e.proxy,k+"//"+S.hostname+(S.port?":"+S.port:"")+M.path));const A=qv.test(M.protocol);if(M.agent=A?e.httpsAgent:e.httpAgent,e.transport?L=e.transport:0===e.maxRedirects?L=A?o:a:(e.maxRedirects&&(M.maxRedirects=e.maxRedirects),e.beforeRedirect&&(M.beforeRedirects.config=e.beforeRedirect),L=A?zv:Uv),e.maxBodyLength>-1?M.maxBodyLength=e.maxBodyLength:M.maxBodyLength=1/0,e.insecureHTTPParser&&(M.insecureHTTPParser=e.insecureHTTPParser),h=L.request(M,(function(t){if(h.destroyed)return;const n=[t],i=+t.headers["content-length"];if(R){const e=new Av({length:jf.toFiniteNumber(i),maxRate:jf.toFiniteNumber(O)});R&&e.on("progress",(e=>{R(Object.assign(e,{download:!0}))})),n.push(e)}let a=t;const o=t.req||h;if(!1!==e.decompress&&t.headers["content-encoding"])switch("HEAD"!==c&&204!==t.statusCode||delete t.headers["content-encoding"],t.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":case"deflate":n.push(u.createUnzip(Nv)),delete t.headers["content-encoding"];break;case"br":Fv&&(n.push(u.createBrotliDecompress(Bv)),delete t.headers["content-encoding"])}a=n.length>1?p.pipeline(n,jf.noop):n[0];const d=p.finished(a,(()=>{d(),v()})),l={status:t.statusCode,statusText:t.statusMessage,headers:new Jg(t.headers),config:e,request:o};if("stream"===s)l.data=a,Zg(y,_,l);else{const t=[];let n=0;a.on("data",(function(i){t.push(i),n+=i.length,e.maxContentLength>-1&&n>e.maxContentLength&&(f=!0,a.destroy(),_(new If("maxContentLength size of "+e.maxContentLength+" exceeded",If.ERR_BAD_RESPONSE,e,o)))})),a.on("aborted",(function(){if(f)return;const t=new If("maxContentLength size of "+e.maxContentLength+" exceeded",If.ERR_BAD_RESPONSE,e,o);a.destroy(t),_(t)})),a.on("error",(function(t){h.destroyed||_(If.from(t,null,e,o))})),a.on("end",(function(){try{let e=1===t.length?t[0]:Buffer.concat(t);"arraybuffer"!==s&&(e=e.toString(r),r&&"utf8"!==r||(e=jf.stripBOM(e))),l.data=e}catch(t){_(If.from(t,null,e,l.request,l))}Zg(y,_,l)}))}g.once("abort",(e=>{a.destroyed||(a.emit("error",e),a.destroy())}))})),g.once("abort",(e=>{_(e),h.destroy(e)})),h.on("error",(function(t){_(If.from(t,null,e,h))})),h.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(isNaN(t))return void _(new If("error trying to parse `config.timeout` to int",If.ERR_BAD_OPTION_VALUE,e,h));h.setTimeout(t,(function(){if(m)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Fg;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),_(new If(t,n.clarifyTimeoutError?If.ETIMEDOUT:If.ECONNABORTED,e,h)),x()}))}if(jf.isStream(i)){let t=!1,n=!1;i.on("end",(()=>{t=!0})),i.once("error",(e=>{n=!0,h.destroy(e)})),i.on("close",(()=>{t||n||x(new Xg("Request stream has been aborted",e,h))})),i.pipe(h)}else h.end(i)}))},Gv=Ug.isStandardBrowserEnv?{write:function(e,t,n,i,s,r){const a=[];a.push(e+"="+encodeURIComponent(t)),jf.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),jf.isString(i)&&a.push("path="+i),jf.isString(s)&&a.push("domain="+s),!0===r&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Kv=Ug.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function i(n){let i=n;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(e){const t=jf.isString(e)?i(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function Jv(e,t){let n=0;const i=Mv(50,250);return s=>{const r=s.loaded,a=s.lengthComputable?s.total:void 0,o=r-n,c=i(o);n=r;const p={loaded:r,total:a,progress:a?r/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&r<=a?(a-r)/c:void 0,event:s};p[t?"download":"upload"]=!0,e(p)}}const Qv={http:Wv,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let i=e.data;const s=Jg.from(e.headers).normalize(),r=e.responseType;let a;function o(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}jf.isFormData(i)&&(Ug.isStandardBrowserEnv||Ug.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const p=ev(e.baseURL,e.url);function d(){if(!c)return;const i=Jg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Zg((function(e){t(e),o()}),(function(e){n(e),o()}),{data:r&&"text"!==r&&"json"!==r?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:i,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Ng(p,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(d)},c.onabort=function(){c&&(n(new If("Request aborted",If.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new If("Network Error",If.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Fg;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new If(t,i.clarifyTimeoutError?If.ETIMEDOUT:If.ECONNABORTED,e,c)),c=null},Ug.isStandardBrowserEnv){const t=(e.withCredentials||Kv(p))&&e.xsrfCookieName&&Gv.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===i&&s.setContentType(null),"setRequestHeader"in c&&jf.forEach(s.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),jf.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),r&&"json"!==r&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",Jv(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",Jv(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{c&&(n(!t||t.type?new Xg(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const l=jv(p);l&&-1===Ug.protocols.indexOf(l)?n(new If("Unsupported protocol "+l+":",If.ERR_BAD_REQUEST,e)):c.send(i||null)}))}};jf.forEach(Qv,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Yv=e=>{e=jf.isArray(e)?e:[e];const{length:t}=e;let n,i;for(let s=0;s<t&&(n=e[s],!(i=jf.isString(n)?Qv[n.toLowerCase()]:n));s++);if(!i){if(!1===i)throw new If(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(jf.hasOwnProp(Qv,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!jf.isFunction(i))throw new TypeError("adapter is not a function");return i};function Xv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xg(null,e)}function Zv(e){Xv(e),e.headers=Jg.from(e.headers),e.data=Qg.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Yv(e.adapter||$g.adapter)(e).then((function(t){return Xv(e),t.data=Qg.call(e,e.transformResponse,t),t.headers=Jg.from(t.headers),t}),(function(t){return Yg(t)||(Xv(e),t&&t.response&&(t.response.data=Qg.call(e,e.transformResponse,t.response),t.response.headers=Jg.from(t.response.headers))),Promise.reject(t)}))}const eb=e=>e instanceof Jg?e.toJSON():e;function tb(e,t){t=t||{};const n={};function i(e,t,n){return jf.isPlainObject(e)&&jf.isPlainObject(t)?jf.merge.call({caseless:n},e,t):jf.isPlainObject(t)?jf.merge({},t):jf.isArray(t)?t.slice():t}function s(e,t,n){return jf.isUndefined(t)?jf.isUndefined(e)?void 0:i(void 0,e,n):i(e,t,n)}function r(e,t){if(!jf.isUndefined(t))return i(void 0,t)}function a(e,t){return jf.isUndefined(t)?jf.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function o(n,s,r){return r in t?i(n,s):r in e?i(void 0,n):void 0}const c={url:r,method:r,data:r,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(e,t)=>s(eb(e),eb(t),!0)};return jf.forEach(Object.keys(e).concat(Object.keys(t)),(function(i){const r=c[i]||s,a=r(e[i],t[i],i);jf.isUndefined(a)&&r!==o||(n[i]=a)})),n}const nb={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{nb[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const ib={};nb.transitional=function(e,t,n){function i(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,r)=>{if(!1===e)throw new If(i(s," has been removed"+(t?" in "+t:"")),If.ERR_DEPRECATED);return t&&!ib[s]&&(ib[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,r)}};var sb={assertOptions:function(e,t,n){if("object"!=typeof e)throw new If("options must be an object",If.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let s=i.length;for(;s-- >0;){const r=i[s],a=t[r];if(a){const t=e[r],n=void 0===t||a(t,r,e);if(!0!==n)throw new If("option "+r+" must be "+n,If.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new If("Unknown option "+r,If.ERR_BAD_OPTION)}},validators:nb};const rb=sb.validators;class ab{constructor(e){this.defaults=e,this.interceptors={request:new Bg,response:new Bg}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=tb(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;let r;void 0!==n&&sb.assertOptions(n,{silentJSONParsing:rb.transitional(rb.boolean),forcedJSONParsing:rb.transitional(rb.boolean),clarifyTimeoutError:rb.transitional(rb.boolean)},!1),void 0!==i&&sb.assertOptions(i,{encode:rb.function,serialize:rb.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),r=s&&jf.merge(s.common,s[t.method]),r&&jf.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=Jg.concat(r,s);const a=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!o){const e=[Zv.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),d=e.length,p=Promise.resolve(t);l<d;)p=p.then(e[l++],e[l++]);return p}d=a.length;let u=t;for(l=0;l<d;){const e=a[l++],t=a[l++];try{u=e(u)}catch(e){t.call(this,e);break}}try{p=Zv.call(this,u)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)p=p.then(c[l++],c[l++]);return p}getUri(e){return Ng(ev((e=tb(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}jf.forEach(["delete","get","head","options"],(function(e){ab.prototype[e]=function(t,n){return this.request(tb(n||{},{method:e,url:t,data:(n||{}).data}))}})),jf.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,s){return this.request(tb(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}ab.prototype[e]=t(),ab.prototype[e+"Form"]=t(!0)}));class ob{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{n.subscribe(e),t=e})).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,s){n.reason||(n.reason=new Xg(e,i,s),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new ob((function(t){e=t})),cancel:e}}}const cb={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(cb).forEach((([e,t])=>{cb[t]=e}));const pb=function e(t){const n=new ab(t),i=nf(ab.prototype.request,n);return jf.extend(i,ab.prototype,n,{allOwnKeys:!0}),jf.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(tb(t,n))},i}($g);pb.Axios=ab,pb.CanceledError=Xg,pb.CancelToken=ob,pb.isCancel=Yg,pb.VERSION="1.2.3",pb.toFormData=jg,pb.AxiosError=If,pb.Cancel=pb.CanceledError,pb.all=function(e){return Promise.all(e)},pb.spread=function(e){return function(t){return e.apply(null,t)}},pb.isAxiosError=function(e){return jf.isObject(e)&&!0===e.isAxiosError},pb.mergeConfig=tb,pb.AxiosHeaders=Jg,pb.formToJSON=e=>zg(jf.isHTMLForm(e)?new FormData(e):e),pb.HttpStatusCode=cb,pb.default=pb;class db{constructor(e={}){this.data=void 0===e.data?{}:e.data,this.headers=e.headers||{},this.status=e.status||200,this.statusText=e.statusText||"OK",this.url=e.url||null}}function lb(e,t){return m.ok(e,`${t} is required`),e}function ub(e,t){return m.ok("boolean"==typeof e,`${t}<boolean> is required`),e}function mb(e,t){return m.ok("number"==typeof e,`${t}<number> is required`),e}function hb(e,t){return m.ok("string"==typeof e,`${t}<string> is required`),e}function fb(e,t,n){const i=n||t.name[0].toLowerCase()+t.name.substring(1);return m.ok(e instanceof t,`${i}<${t.name}> is required`),e}function gb(e,t="roomName"){return hb(e,t),m.equal("string"==typeof e&&e[0],"/",`${t} must begin with a '/'`),e}function vb(e,t){return m.ok(Array.isArray(e),`${t}<array> is required`),e}function bb(e,t){if(null==e||"object"!=typeof e||Array.isArray(e))throw new Error(`${t} must be a record. ${JSON.stringify(e)}`);return e}function yb(e,t,n){hb(t,"name"),function(e,t,n,i){hb(n,"name");const s=i||`${n} must be null or of type ${t}`;m.ok(null===e||typeof e===t,s)}(e,"string",t,n)}function _b({baseUrl:e,url:t}){return m.ok("string"==typeof t,"url<String> is required"),e?e+t:t}class xb{constructor({baseUrl:e}){hb(e,"baseUrl"),this._baseUrl=e}_requestAxios(e,t){const n=Object.assign({},t,{url:e,baseURL:this._baseUrl});return pb.request(n)}request(e,t){return hb(e,"url"),m.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(t,"options are required"),this._requestAxios(e,t).then((e=>{const{data:t,headers:n,status:i,statusText:s,config:r}=e,a=r&&r.url?_b({baseUrl:r.baseURL,url:r.url}):null;return new db({data:t,headers:n,status:i,statusText:s,url:a})})).catch((e=>{const t=e.response;if(!t)throw new Error("Could not make the request.");const{data:n,headers:i,status:s,statusText:r,config:a}=t,o=a&&a.url?_b({baseUrl:a.baseURL,url:a.url}):null;return Promise.reject(new db({data:n,headers:i,status:s,statusText:r,url:o}))}))}}class wb{constructor({httpClient:e}){m.ok(e,"httpClient is required"),this._httpClient=e}static dataToFormData(e){m.ok(e,"data is required");const t=new FormData;return Object.keys(e).forEach((n=>{const i=e[n];t.append(n,i)})),t}request(e,t={}){const n=Object.assign(t.headers||{},{"Content-Type":void 0});return this._httpClient.request(e,Object.assign(t,{headers:n,transformRequest:wb.dataToFormData}))}}let Sb;Sb="object"==typeof window?window.btoa||tf:"object"==typeof global&&global.btoa||tf;const kb=()=>Promise.resolve(null);class Cb{constructor({httpClient:e,fetchDeviceCredentials:t}){this._httpClient=e,this._fetchDeviceCredentials=t}request(e,t){return this._fetchDeviceCredentials().then((n=>{const i=Object.assign({},t.headers,function(e){if(e&&e.credentials){const t=`${e.credentials.uuid}:${e.hmac}`;return{Authorization:`Basic ${Sb(t)}`}}return{}}(n),{"X-Appearin-Device-Platform":"web"}),s=Object.assign({},t,{headers:i});return this._httpClient.request(e,s)}))}}class Rb{constructor({baseUrl:e="https://api.appearin.net",fetchDeviceCredentials:t=kb}={}){hb(e,"baseUrl"),m.ok("function"==typeof t,"fetchDeviceCredentials<Function> is required"),this.authenticatedHttpClient=new Cb({httpClient:new xb({baseUrl:e}),fetchDeviceCredentials:t}),this.authenticatedFormDataHttpClient=new wb({httpClient:this.authenticatedHttpClient})}request(e,t){return hb(e,"url"),m.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(t,"options are required"),this.authenticatedHttpClient.request(e,t)}requestMultipart(e,t){return hb(e,"url"),m.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(t,"options are required"),this.authenticatedFormDataHttpClient.request(e,t)}}function Tb(e,t){return hb(bb(e,"data")[t],t)}const Pb=(Eb=Tb,(e,t)=>{const n=bb(e,"data")[t];return null==n?null:Eb(e,t)});var Eb;function Ob(e,t){const n=Tb(e,t),i=new Date(n);if(isNaN(i.getTime()))throw new Error(`Invalid date for ${n}`);return i}function Db(e,t,n){return function(e,t){return vb(bb(e,"data")[t],t)}(e,t).map((e=>n(e)))}class jb{constructor(e,t,n){this.credentials={uuid:e},this.hmac=t,this.userId=n}toJson(){return Object.assign({credentials:this.credentials,hmac:this.hmac},this.userId&&{userId:this.userId})}static fromJson(e){return new jb(Tb(function(e,t){const n=bb(e,"data")[t];return void 0===n?null:n}(e,"credentials"),"uuid"),Tb(e,"hmac"),Pb(e,"userId")||void 0)}}class Ib{constructor({apiClient:e}){this._apiClient=fb(e,Rb)}getCredentials(){return this._apiClient.request("/devices",{method:"post"}).then((({data:e})=>jb.fromJson(e))).catch((e=>{if(e.response&&404===e.response.status)return null;throw e}))}}class Mb{constructor(e,t){this._key=e,this._chromeStorage=t}loadOrDefault(e){return new Promise((t=>{this._chromeStorage.get(this._key,(n=>{t(n[this._key]||e)}))}))}save(e){return new Promise((t=>{this._chromeStorage.set({[this._key]:e},(()=>{t()}))}))}}class Lb{constructor(e,t){lb(t,"localStorage"),this._key=hb(e,"key"),this._localStorage=t}loadOrDefault(e){try{const t=this._localStorage.getItem(this._key);if(t)try{return Promise.resolve(JSON.parse(t))}catch(e){}return Promise.resolve(e)}catch(t){return console.warn("Error getting access to storage. Are cookies blocked?",t),Promise.resolve(e)}}save(e){try{return this._localStorage.setItem(this._key,JSON.stringify(e)),Promise.resolve()}catch(e){return console.warn("Error getting access to storage. Are cookies blocked?",e),Promise.reject(e)}}}let Ab;try{Ab=self.localStorage}catch(e){Ab={getItem:()=>{},key:()=>{},setItem:()=>{},removeItem:()=>{},hasOwnProperty:()=>{},length:0}}var Nb=Ab;const Bb="credentials_saved";class Fb extends d{constructor({deviceService:e,credentialsStore:t}){super(),this._deviceService=fb(e,Ib),this._credentialsStore=t}static create({baseUrl:e,storeName:t="CredentialsStorage",storeType:n="localStorage"}){const i=new Ib({apiClient:new Rb({baseUrl:e})});let s=null;if("localStorage"===n)s=new Lb(t,Nb);else{if("chromeStorage"!==n)throw new Error(`Unknown store type: ${n}`);s=new Mb(t,window.chrome.storage.local)}return new Fb({deviceService:i,credentialsStore:s})}_fetchNewCredentialsFromApi(){const e=this._credentialsStore;return new Promise((t=>{const n=()=>{this._deviceService.getCredentials().then((n=>e.save(n?n.toJson():null).then((()=>t(n))))).catch((()=>{setTimeout(n,2e3)}))};n()}))}getCurrentCredentials(){return this._credentialsStore.loadOrDefault(null).then((e=>e?jb.fromJson(e):null))}getCredentials(){return this.credentialsPromise||(this.credentialsPromise=this.getCurrentCredentials().then((e=>e||this._fetchNewCredentialsFromApi()))),this.credentialsPromise}saveCredentials(e){return this.credentialsPromise=void 0,this._credentialsStore.save(e.toJson()).then((()=>(this.emit(Bb,e),e)))}setUserId(e){return this.getCurrentCredentials().then((t=>{t||console.error("Illegal state: no credentials to set user id for.");if(null===t||t.userId!==e)return this._credentialsStore.save(Object.assign({},null==t?void 0:t.toJson(),{userId:e}))})).then((()=>{}))}}const Ub=()=>Promise.resolve(void 0);class zb{constructor({apiClient:e,fetchOrganization:t=Ub}){this._apiClient=fb(e,Rb),m.ok("function"==typeof t,"fetchOrganization<Function> is required"),this._fetchOrganization=t,this._apiClient=e}_callRequestMethod(e,t,n){return hb(t,"url"),m.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(n,"options are required"),this._fetchOrganization().then((i=>{if(!i)return this._apiClient[e](t,n);const{organizationId:s}=i;return this._apiClient[e](`/organizations/${encodeURIComponent(s)}${t}`,n)}))}request(e,t){return this._callRequestMethod("request",e,t)}requestMultipart(e,t){return this._callRequestMethod("requestMultipart",e,t)}}class qb{constructor({isExhausted:e,renewsAt:t,totalMinutesLimit:n,totalMinutesUsed:i}){this.isExhausted=e,this.renewsAt=t,this.totalMinutesLimit=n,this.totalMinutesUsed=i}static fromJson(e){return new qb({isExhausted:ub(e.isExhausted,"isExhausted"),renewsAt:new Date(hb(e.renewsAt,"renewsAt")),totalMinutesLimit:mb(e.totalMinutesLimit,"totalMinutesLimit"),totalMinutesUsed:mb(e.totalMinutesUsed,"totalMinutesUsed")})}}class $b{constructor({basePlanId:e,embeddedFreeTierStatus:t,isDeactivated:n,isOnTrial:i,onTrialUntil:s,trialStatus:r}){this.basePlanId=e,this.isDeactivated=n,this.isOnTrial=i,this.onTrialUntil=s||null,this.trialStatus=r||null,this.embeddedFreeTierStatus=t||null}static fromJson(e){return new $b({basePlanId:"string"==typeof e.basePlanId?e.basePlanId:null,isDeactivated:ub(e.isDeactivated,"isDeactivated"),isOnTrial:ub(e.isOnTrial,"isOnTrial"),onTrialUntil:"string"==typeof e.onTrialUntil?new Date(e.onTrialUntil):null,trialStatus:"string"==typeof e.trialStatus?e.trialStatus:null,embeddedFreeTierStatus:e.embeddedFreeTierStatus?qb.fromJson(e.embeddedFreeTierStatus):null})}}function Vb(e){return null!=e}function Hb(e={}){return{maxNumberOfInvitationsAndUsers:Vb(null==e?void 0:e.maxNumberOfInvitationsAndUsers)?Number(null==e?void 0:e.maxNumberOfInvitationsAndUsers):null,maxNumberOfClaimedRooms:Vb(null==e?void 0:e.maxNumberOfClaimedRooms)?Number(null==e?void 0:e.maxNumberOfClaimedRooms):null,maxRoomLimitPerOrganization:Vb(null==e?void 0:e.maxRoomLimitPerOrganization)?Number(null==e?void 0:e.maxRoomLimitPerOrganization):null,trialMinutesLimit:Vb(null==e?void 0:e.trialMinutesLimit)?Number(null==e?void 0:e.trialMinutesLimit):null,includedUnits:Vb(null==e?void 0:e.includedUnits)?Number(null==e?void 0:e.includedUnits):null}}class Wb{constructor(e){this.logoImageUrl=null,this.roomBackgroundImageUrl=null,this.roomBackgroundThumbnailUrl=null,this.roomKnockPageBackgroundImageUrl=null,this.roomKnockPageBackgroundThumbnailUrl=null,this.preferences=null,this.onboardingSurvey=null,this.type=null,fb(e,Object,"properties"),hb(e.organizationId,"organizationId"),hb(e.organizationName,"organizationName"),hb(e.subdomain,"subdomain"),fb(e.permissions,Object,"permissions"),fb(e.limits,Object,"limits"),this.organizationId=e.organizationId,this.organizationName=e.organizationName,this.subdomain=e.subdomain,this.permissions=e.permissions,this.limits=e.limits,this.account=e.account?new $b(e.account):null,this.logoImageUrl=e.logoImageUrl,this.roomBackgroundImageUrl=e.roomBackgroundImageUrl,this.roomBackgroundThumbnailUrl=e.roomBackgroundThumbnailUrl,this.roomKnockPageBackgroundImageUrl=e.roomKnockPageBackgroundImageUrl,this.roomKnockPageBackgroundThumbnailUrl=e.roomKnockPageBackgroundThumbnailUrl,this.preferences=e.preferences,this.onboardingSurvey=e.onboardingSurvey,this.type=e.type}static fromJson(e){const t=fb(e,Object,"data"),n=(null==t?void 0:t.preferences)||{},i=(null==t?void 0:t.onboardingSurvey)||null,s=fb(t.permissions,Object,"permissions");return new Wb({organizationId:hb(t.organizationId,"organizationId"),organizationName:hb(t.organizationName,"organizationName"),subdomain:hb(t.subdomain,"subdomain"),permissions:s,limits:Hb(fb(t.limits,Object,"limits")),account:t.account?$b.fromJson(t.account):null,logoImageUrl:"string"==typeof t.logoImageUrl?t.logoImageUrl:null,roomBackgroundImageUrl:"string"==typeof t.roomBackgroundImageUrl?t.roomBackgroundImageUrl:null,roomBackgroundThumbnailUrl:"string"==typeof t.roomBackgroundThumbnailUrl?t.roomBackgroundThumbnailUrl:null,roomKnockPageBackgroundImageUrl:"string"==typeof t.roomKnockPageBackgroundImageUrl?t.roomKnockPageBackgroundImageUrl:null,roomKnockPageBackgroundThumbnailUrl:"string"==typeof t.roomKnockPageBackgroundThumbnailUrl?t.roomKnockPageBackgroundThumbnailUrl:null,preferences:n,onboardingSurvey:i,type:"string"==typeof t.type?t.type:null})}}Wb.GLOBAL_ORGANIZATION_ID="1";class Gb{constructor({apiClient:e}){this._apiClient=fb(e,Rb)}createOrganization({organizationName:e,subdomain:t,owner:n}){const{displayName:i,consents:s}=n||{},r="email"in n?{value:n.email,verificationCode:hb(n.verificationCode,"owner.verificationCode")}:null,a="idToken"in n?n.idToken:null;if(hb(t,"subdomain"),hb(e,"organizationName"),hb(i,"owner.displayName"),m.ok(r||a,"owner.email or owner.idToken is required"),s){vb(s,"consents");for(const{consentRevisionId:e,action:t}of s)hb(e,"consentRevisionId"),yb(t,"action")}return this._apiClient.request("/organizations",{method:"POST",data:{organizationName:e,type:"private",subdomain:t,owner:Object.assign(Object.assign(Object.assign(Object.assign({},r&&{email:r}),a&&{idToken:a}),s&&{consents:s}),{displayName:i})}}).then((({data:e})=>Tb(e,"organizationId")))}getOrganizationBySubdomain(e){return hb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/?fields=permissions,account,onboardingSurvey`,{method:"GET"}).then((({data:e})=>Wb.fromJson(e))).catch((e=>{if(e instanceof db){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationByOrganizationId(e){return hb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}?fields=permissions,account`,{method:"GET"}).then((({data:e})=>Wb.fromJson(e))).catch((e=>{if(e instanceof db){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationsByContactPoint(e){const{code:t}=e,n="email"in e?e.email:null,i="phoneNumber"in e?e.phoneNumber:null;m.ok((n||i)&&!(n&&i),"either email or phoneNumber is required"),hb(t,"code");const s=n?{type:"email",value:n}:{type:"phoneNumber",value:i};return this._apiClient.request("/organization-queries",{method:"POST",data:{contactPoint:s,code:t}}).then((({data:e})=>Db(e,"organizations",(e=>Wb.fromJson(e)))))}getOrganizationsByIdToken({idToken:e}){return hb(e,"idToken"),this._apiClient.request("/organization-queries",{method:"POST",data:{idToken:e}}).then((({data:e})=>Db(e,"organizations",(e=>Wb.fromJson(Object.assign({permissions:{},limits:{}},bb(e,"organization")))))))}getOrganizationsByLoggedInUser(){return this._apiClient.request("/user/organizations",{method:"GET"}).then((({data:e})=>Db(e,"organizations",(e=>Wb.fromJson(Object.assign({permissions:{},limits:{}},bb(e,"organization")))))))}getSubdomainAvailability(e){return hb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/availability`,{method:"GET"}).then((({data:e})=>(fb(e,Object,"data"),{status:Tb(e,"status")})))}updatePreferences({organizationId:e,preferences:t}){return lb(e,"organizationId"),lb(t,"preferences"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}deleteOrganization({organizationId:e}){return lb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}`,{method:"DELETE"}).then((()=>{}))}}class Kb{constructor({organizationService:e,subdomain:t}){fb(e,Gb),hb(t,"subdomain"),this._organizationService=e,this._subdomain=t,this._organizationPromise=null}initOrganization(){return this.fetchOrganization().then((()=>{}))}fetchOrganization(){return this._organizationPromise||(this._organizationPromise=this._organizationService.getOrganizationBySubdomain(this._subdomain)),this._organizationPromise}}class Jb{constructor(e={}){m.ok(e instanceof Object,"properties<object> must be empty or an object"),this.isClaimed=!1,this.isBanned=!1,this.isLocked=!1,this.knockPage={backgroundImageUrl:null,backgroundThumbnailUrl:null},this.logoUrl=null,this.backgroundImageUrl=null,this.backgroundThumbnailUrl=null,this.type=null,this.legacyRoomType=null,this.mode=null,this.product=null,this.roomName=null,this.theme=null,this.preferences={},this.protectedPreferences={},this.publicProfile=null;const t={};Object.getOwnPropertyNames(e).forEach((n=>{-1!==Object.getOwnPropertyNames(this).indexOf(n)&&(t[n]=e[n])})),void 0!==e.ownerId&&(this.ownerId=e.ownerId),void 0!==e.meeting&&(this.meeting=e.meeting),Object.assign(this,t)}}class Qb{constructor({meetingId:e,roomName:t,roomUrl:n,startDate:i,endDate:s,hostRoomUrl:r,viewerRoomUrl:a}){hb(e,"meetingId"),hb(t,"roomName"),hb(n,"roomUrl"),fb(i,Date,"startDate"),fb(s,Date,"endDate"),this.meetingId=e,this.roomName=t,this.roomUrl=n,this.startDate=i,this.endDate=s,this.hostRoomUrl=r,this.viewerRoomUrl=a}static fromJson(e){return new Qb({meetingId:Tb(e,"meetingId"),roomName:Tb(e,"roomName"),roomUrl:Tb(e,"roomUrl"),startDate:Ob(e,"startDate"),endDate:Ob(e,"endDate"),hostRoomUrl:Pb(e,"hostRoomUrl"),viewerRoomUrl:Pb(e,"viewerRoomUrl")})}}function Yb(e,t=""){return`/room/${encodeURIComponent(e.substring(1))}${t}`}class Xb{constructor({organizationApiClient:e}){this._organizationApiClient=fb(e,zb)}getRooms({types:e,fields:t=[]}={}){return vb(e,"types"),vb(t,"fields"),this._organizationApiClient.request("/room",{method:"GET",params:{types:e.join(","),fields:t.join(","),includeOnlyLegacyRoomType:"false"}}).then((({data:e})=>e.rooms.map((e=>new Jb(e)))))}getRoom({roomName:e,fields:t}){gb(e);const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/rooms/${n}`,{method:"GET",params:Object.assign({includeOnlyLegacyRoomType:"false"},t&&{fields:t.join(",")})}).then((({data:t})=>new Jb(Object.assign({},t,Object.assign({roomName:e},t.meeting&&{meeting:Qb.fromJson(t.meeting)}))))).catch((t=>{if(404===t.status)return new Jb({roomName:e,isClaimed:!1,mode:"normal",product:{categoryName:"personal_free"},type:"personal",legacyRoomType:"free"});if(400===t.status&&"Banned room"===t.data.error)return new Jb({roomName:e,isBanned:!0});throw new Error(t.data?t.data.error:"Could not fetch room information")}))}claimRoom({roomName:e,type:t,mode:n,isLocked:i}){return gb(e),hb(t,"type"),this._organizationApiClient.request("/room/claim",{method:"POST",data:Object.assign(Object.assign({roomName:e,type:t},"string"==typeof n&&{mode:n}),"boolean"==typeof i&&{isLocked:i})}).then((()=>{})).catch((e=>{throw new Error(e.data.error||"Failed to claim room")}))}unclaimRoom(e){gb(e);const t=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${t}`,{method:"DELETE"}).then((()=>{}))}renameRoom({roomName:e,newRoomName:t}){gb(e),hb(t,"newRoomName");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/roomName`,{method:"PUT",data:{newRoomName:t}}).then((()=>{}))}changeMode({roomName:e,mode:t}){gb(e),hb(t,"mode");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/mode`,{method:"PUT",data:{mode:t}}).then((()=>{}))}updatePreferences({roomName:e,preferences:t}){gb(e),fb(t,Object,"preferences");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}updateProtectedPreferences({roomName:e,preferences:t}){gb(e),fb(t,Object,"preferences");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/protected-preferences`,{method:"PATCH",data:t}).then((()=>{}))}getRoomPermissions(e,{roomKey:t}={}){return gb(e),this._organizationApiClient.request(Yb(e,"/permissions"),Object.assign({method:"GET"},t&&{headers:{"X-Whereby-Room-Key":t}})).then((e=>{const{permissions:t,limits:n}=e.data;return{permissions:t,limits:n}}))}getRoomMetrics({roomName:e,metrics:t,from:n,to:i}){return gb(e),hb(t,"metrics"),this._organizationApiClient.request(Yb(e,"/metrics"),{method:"GET",params:{metrics:t,from:n,to:i}}).then((e=>e.data))}changeType({roomName:e,type:t}){gb(e),function(e,t,n){if(lb(e,"value"),vb(t,"allowedValues"),!t.includes(e))throw new Error(`${n}<string> must be one of the following: ${t.join(", ")}`)}(t,["personal","personal_xl"],"type");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/type`,{method:"PUT",data:{type:t}}).then((()=>{}))}getForestSocialImage({roomName:e,count:t}){return gb(e),mb(t,"count"),this._organizationApiClient.request(Yb(e,`/forest-social-image/${t}`),{method:"GET"}).then((e=>e.data.imageUrl))}}class Zb{constructor({displayName:e,id:t,stream:n,isAudioEnabled:i,isVideoEnabled:s}){this.isLocalParticipant=!1,this.displayName=e,this.id=t,this.stream=n,this.isAudioEnabled=i,this.isVideoEnabled=s}}class ey extends Zb{constructor({displayName:e,id:t,newJoiner:n,streams:i,isAudioEnabled:s,isVideoEnabled:r}){super({displayName:e,id:t,isAudioEnabled:s,isVideoEnabled:r}),this.newJoiner=n,this.streams=i.map((e=>({id:e,state:n?"new_accept":"to_accept"})))}updateStreamState(e,t){const n=this.streams.find((t=>t.id===e));n&&(n.state=t)}}class ty extends Zb{constructor({displayName:e,id:t,stream:n,isAudioEnabled:i,isVideoEnabled:s}){super({displayName:e,id:t,stream:n,isAudioEnabled:i,isVideoEnabled:s}),this.isLocalParticipant=!0}}const ny=["recorder","streamer"];const iy=()=>{},sy=EventTarget;class ry extends sy{constructor(e,{displayName:t,localMediaConstraints:n,localStream:i,logger:s}){super(),this.localParticipant=null,this.remoteParticipants=[],this.roomConnectionState="",this.roomUrl=new URL(e),this.logger=s||{debug:iy,error:iy,log:iy,warn:iy},this.displayName=t,this.localStream=i,this.localMediaConstraints=n;const r=ef({host:this.roomUrl.host});this.credentialsService=Fb.create({baseUrl:"https://api.appearin.net"}),this.apiClient=new Rb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:"https://api.appearin.net"}),this.organizationService=new Gb({apiClient:this.apiClient}),this.organizationServiceCache=new Kb({organizationService:this.organizationService,subdomain:r.subdomain}),this.organizationApiClient=new zb({apiClient:this.apiClient,fetchOrganization:()=>mn(this,void 0,void 0,(function*(){return(yield this.organizationServiceCache.fetchOrganization())||void 0}))}),this.roomService=new Xb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL("wss://signal.appearin.net"),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v1`,n=e.origin;return new Go(n,{host:n,path:t,reconnectionDelay:5e3,reconnectionDelayMax:3e4,timeout:1e4})}(),this.signalSocket.on("new_client",this._handleNewClient.bind(this)),this.signalSocket.on("client_left",this._handleClientLeft.bind(this)),this.signalSocket.on("audio_enabled",this._handleClientAudioEnabled.bind(this)),this.signalSocket.on("video_enabled",this._handleClientVideoEnabled.bind(this)),this.signalSocket.on("client_metadata_received",this._handleClientMetadataReceived.bind(this))}_handleNewClient({client:e}){if(ny.includes(e.role.roleName))return;const t=new ey(Object.assign(Object.assign({},e),{newJoiner:!0}));this.remoteParticipants=[...this.remoteParticipants,t],this._handleAcceptStreams([t]),this.dispatchEvent(new CustomEvent("participant_joined",{detail:{remoteParticipant:t}}))}_handleClientLeft({clientId:e}){const t=this.remoteParticipants.find((t=>t.id===e));this.remoteParticipants=this.remoteParticipants.filter((t=>t.id!==e)),t&&this.dispatchEvent(new CustomEvent("participant_left",{detail:{participantId:t.id}}))}_handleClientAudioEnabled({clientId:e,isAudioEnabled:t}){const n=this.remoteParticipants.find((t=>t.id===e));n&&this.dispatchEvent(new CustomEvent("participant_audio_enabled",{detail:{participantId:n.id,isAudioEnabled:t}}))}_handleClientVideoEnabled({clientId:e,isVideoEnabled:t}){const n=this.remoteParticipants.find((t=>t.id===e));n&&this.dispatchEvent(new CustomEvent("participant_video_enabled",{detail:{participantId:n.id,isVideoEnabled:t}}))}_handleClientMetadataReceived({payload:{clientId:e,displayName:t}}){const n=this.remoteParticipants.find((t=>t.id===e));n&&this.dispatchEvent(new CustomEvent("participant_metadata_changed",{detail:{participantId:n.id,displayName:t}}))}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):void this.logger.log(`Unhandled RTC event ${e}`)}_handleRtcManagerCreated({rtcManager:e}){var t,n,i;this.rtcManager=e,this.localStream&&(null===(t=this.rtcManager)||void 0===t||t.addNewStream("0",this.localStream,!(null===(n=this.localStream)||void 0===n?void 0:n.getAudioTracks().find((e=>e.enabled))),!(null===(i=this.localStream)||void 0===i?void 0:i.getVideoTracks().find((e=>e.enabled)))))}_handleAcceptStreams(e){var t,n;if(!this.rtcManager)return void this.logger.log("Unable to accept streams, no rtc manager");const i=null===(n=(t=this.rtcManager).shouldAcceptStreamsFromBothSides)||void 0===n?void 0:n.call(t);e.forEach((e=>{const{id:t,streams:n,newJoiner:s}=e;n.forEach((n=>{var r,a;const{id:o,state:c}=n;let p;if("done_accept"!==c&&(p=(s&&"0"===o?"new":"to")+"_accept"),p){if("to_accept"===p||"new_accept"===p&&i||"old_accept"===p&&!i)this.logger.log(`Accepting stream ${o} from ${t}`),null===(r=this.rtcManager)||void 0===r||r.acceptNewStream({streamId:"0"===o?t:o,clientId:t,shouldAddLocalVideo:"0"===o,activeBreakout:false});else if("new_accept"===p||"old_accept"===p);else if("to_unaccept"===p)this.logger.log(`Disconnecting stream ${o} from ${t}`),null===(a=this.rtcManager)||void 0===a||a.disconnect("0"===o?t:o,false);else if("done_accept"!==p)return void this.logger.warn(`Stream state not handled: ${p} for ${t}-${o}`);e.updateStreamState(o,c.replace(/to_|new_|old_/,"done_"))}}))}))}_handleStreamAdded({clientId:e,stream:t,streamId:n}){this.remoteParticipants.find((t=>t.id===e))?this.dispatchEvent(new CustomEvent("participant_stream_added",{detail:{participantId:e,stream:t,streamId:n}})):this.logger.log("WARN: Could not find participant for incoming stream")}join(){return mn(this,void 0,void 0,(function*(){if(["connected","connecting"].includes(this.roomConnectionState))return void console.warn(`Trying to join room state is ${this.roomConnectionState}`);if(this.logger.log("Joining room"),this.roomConnectionState="connecting",!this.localStream&&this.localMediaConstraints){const e=yield navigator.mediaDevices.getUserMedia(this.localMediaConstraints);this.localStream=e}const e=yield this.organizationServiceCache.fetchOrganization();if(!e)throw new Error("Invalid room url");const t={getMediaConstraints:()=>{var e,t;return{audio:!!(null===(e=this.localStream)||void 0===e?void 0:e.getAudioTracks().find((e=>e.enabled))),video:!!(null===(t=this.localStream)||void 0===t?void 0:t.getVideoTracks().find((e=>e.enabled)))}},deferrable:e=>!e};this.rtcManagerDispatcher=new Xh({emitter:{emit:this._handleRtcEvent.bind(this)},serverSocket:this.signalSocket,webrtcProvider:t,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}});const n=yield this.credentialsService.getCredentials();setTimeout((()=>{this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:n})}),2e3),this.signalSocket.once("device_identified",(()=>{var t,n;this.signalSocket.emit("join_room",{avatarUrl:null,config:{isAudioEnabled:!!(null===(t=this.localStream)||void 0===t?void 0:t.getAudioTracks().find((e=>e.enabled))),isVideoEnabled:!!(null===(n=this.localStream)||void 0===n?void 0:n.getVideoTracks().find((e=>e.enabled)))},deviceCapabilities:{canScreenshare:!0},displayName:this.displayName,isCoLocated:!1,isDevicePermissionDenied:!1,kickFromOtherRooms:!1,organizationId:e.organizationId,roomKey:null,roomName:this.roomUrl.pathname,selfId:""})})),this.signalSocket.once("room_joined",(e=>{const{selfId:t,room:{clients:n}}=e,i=n.find((e=>e.id===t));if(!i)throw new Error("Missing local client");this.localParticipant=new ty(Object.assign(Object.assign({},i),{stream:this.localStream})),this.remoteParticipants=n.filter((e=>e.id!==t)).map((e=>new ey(Object.assign(Object.assign({},e),{newJoiner:!1})))),this.rtcManager&&this._handleAcceptStreams(this.remoteParticipants),this.roomConnectionState="connected",this.dispatchEvent(new CustomEvent("room_joined",{detail:{localParticipant:this.localParticipant,remoteParticipants:this.remoteParticipants}}))}))}))}leave(){return new Promise((e=>{if(!this.signalSocket)return e();this.signalSocket.emit("leave_room");const t=setTimeout((()=>{e()}),200);this.signalSocket.once("room_left",(()=>{clearTimeout(t),this.signalSocket.disconnect(),e()}))}))}toggleCamera(e){var t;const n=null===(t=this.localStream)||void 0===t?void 0:t.getVideoTracks()[0];if(!n)return void this.logger.log("Tried toggling non-existing video track");const i=null!=e?e:!n.enabled;n.enabled=i,this.signalSocket.emit("enable_video",{enabled:i})}toggleMicrophone(e){var t;const n=null===(t=this.localStream)||void 0===t?void 0:t.getAudioTracks()[0];if(!n)return void this.logger.log("Tried toggling non-existing audio track");const i=null!=e?e:!n.enabled;n.enabled=i,this.signalSocket.emit("enable_audio",{enabled:i})}setDisplayName(e){this.signalSocket.emit("send_client_metadata",{type:"UserData",payload:{displayName:e}})}}function ay(e,t,n){const i=e.find((e=>e.id===t));if(!i)return e;const s=e.indexOf(i);return[...e.slice(0,s),Object.assign(Object.assign({},i),n),...e.slice(s+1)]}function oy(e,t){switch(t.type){case"ROOM_JOINED":return Object.assign(Object.assign({},e),{localParticipant:t.payload.localParticipant,remoteParticipants:t.payload.remoteParticipants,roomConnectionStatus:"connected"});case"PARTICIPANT_AUDIO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:ay(e.remoteParticipants,t.payload.participantId,{isAudioEnabled:t.payload.isAudioEnabled})});case"PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants,t.payload.paritipant]});case"PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.filter((e=>e.id!==t.payload.participantId))]});case"PARTICIPANT_STREAM_ADDED":return Object.assign(Object.assign({},e),{remoteParticipants:ay(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:ay(e.remoteParticipants,t.payload.participantId,{isVideoEnabled:t.payload.isVideoEnabled})});case"PARTICIPANT_METADATA_CHANGED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.map((e=>e.id===t.payload.participantId?Object.assign(Object.assign({},e),{displayName:t.payload.displayName}):e))]});case"LOCAL_CLIENT_DISPLAY_NAME_CHANGED":return e.localParticipant?Object.assign(Object.assign({},e),{localParticipant:Object.assign(Object.assign({},e.localParticipant),{displayName:t.payload.displayName})}):e;default:throw e}}function cy(e,t){const[n,i]=nn.useState(null),[s,r]=nn.useReducer(oy,{remoteParticipants:[]});return nn.useEffect((()=>{i(new ry(e,t))}),[e]),nn.useEffect((()=>{if(n)return n.addEventListener("participant_audio_enabled",(e=>{const{participantId:t,isAudioEnabled:n}=e.detail;r({type:"PARTICIPANT_AUDIO_ENABLED",payload:{participantId:t,isAudioEnabled:n}})})),n.addEventListener("participant_joined",(e=>{const{remoteParticipant:t}=e.detail;r({type:"PARTICIPANT_JOINED",payload:{paritipant:t}})})),n.addEventListener("participant_left",(e=>{const{participantId:t}=e.detail;r({type:"PARTICIPANT_LEFT",payload:{participantId:t}})})),n.addEventListener("participant_stream_added",(e=>{const{participantId:t,stream:n}=e.detail;r({type:"PARTICIPANT_STREAM_ADDED",payload:{participantId:t,stream:n}})})),n.addEventListener("room_joined",(e=>{const{localParticipant:t,remoteParticipants:n}=e.detail;r({type:"ROOM_JOINED",payload:{localParticipant:t,remoteParticipants:n}})})),n.addEventListener("participant_video_enabled",(e=>{const{participantId:t,isVideoEnabled:n}=e.detail;r({type:"PARTICIPANT_VIDEO_ENABLED",payload:{participantId:t,isVideoEnabled:n}})})),n.addEventListener("participant_metadata_changed",(e=>{const{participantId:t,displayName:n}=e.detail;r({type:"PARTICIPANT_METADATA_CHANGED",payload:{participantId:t,displayName:n}})})),n.join(),()=>{n.leave()}}),[n]),[s,{toggleCamera:e=>{null==n||n.toggleCamera(e)},toggleMicrophone:e=>{null==n||n.toggleMicrophone(e)},setDisplayName:e=>{null==n||n.setDisplayName(e),r({type:"LOCAL_CLIENT_DISPLAY_NAME_CHANGED",payload:{displayName:e}})}},{VideoView:un}]}const py="2.0.0-alpha1";export{py as sdkVersion,cy as useRoomConnection};
105
+ function(e){var t=Hf,n=f.extname,i=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function r(e){if(!e||"string"!=typeof e)return!1;var n=i.exec(e),r=n&&t[n[1].toLowerCase()];return r&&r.charset?r.charset:!(!n||!s.test(n[1]))&&"UTF-8"}e.charset=r,e.charsets={lookup:r},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var n=-1===t.indexOf("/")?e.lookup(t):t;if(!n)return!1;if(-1===n.indexOf("charset")){var i=e.charset(n);i&&(n+="; charset="+i.toLowerCase())}return n},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var n=i.exec(t),s=n&&e.extensions[n[1].toLowerCase()];if(!s||!s.length)return!1;return s[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var i=n("x."+t).toLowerCase().substr(1);if(!i)return!1;return e.types[i]||!1},e.types=Object.create(null),function(e,n){var i=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(s){var r=t[s],a=r.extensions;if(a&&a.length){e[s]=a;for(var o=0;o<a.length;o++){var c=a[o];if(n[c]){var p=i.indexOf(t[n[c]].source),d=i.indexOf(r.source);if("application/octet-stream"!==n[c]&&(p>d||p===d&&"application/"===n[c].substr(0,12)))continue}n[c]=s}}}))}(e.extensions,e.types)}(Vf);var Gf=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)},Kf=function(e){var t=!1;return Gf((function(){t=!0})),function(n,i){t?e(n,i):Gf((function(){e(n,i)}))}};var Jf=function(e){Object.keys(e.jobs).forEach(Qf.bind(e)),e.jobs={}};function Qf(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Yf=Kf,Xf=Jf,Zf=function(e,t,n,i){var s=n.keyedList?n.keyedList[n.index]:n.index;n.jobs[s]=function(e,t,n,i){var s;s=2==e.length?e(n,Yf(i)):e(n,t,Yf(i));return s}(t,s,e[s],(function(e,t){s in n.jobs&&(delete n.jobs[s],e?Xf(n):n.results[s]=t,i(e,n.results))}))};var eg=function(e,t){var n=!Array.isArray(e),i={index:0,keyedList:n||t?Object.keys(e):null,jobs:{},results:n?{}:[],size:n?Object.keys(e).length:e.length};t&&i.keyedList.sort(n?t:function(n,i){return t(e[n],e[i])});return i};var tg=Jf,ng=Kf,ig=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,tg(this),ng(e)(null,this.results)};var sg=Zf,rg=eg,ag=ig,og=function(e,t,n){var i=rg(e);for(;i.index<(i.keyedList||e).length;)sg(e,t,i,(function(e,t){e?n(e,t):0!==Object.keys(i.jobs).length||n(null,i.results)})),i.index++;return ag.bind(i,n)};var cg={},pg=Zf,dg=eg,lg=ig;function ug(e,t){return e<t?-1:e>t?1:0}({get exports(){return cg},set exports(e){cg=e}}).exports=function(e,t,n,i){var s=dg(e,n);return pg(e,t,s,(function n(r,a){r?i(r,a):(s.index++,s.index<(s.keyedList||e).length?pg(e,t,s,n):i(null,s.results))})),lg.bind(s,i)},cg.ascending=ug,cg.descending=function(e,t){return-1*ug(e,t)};var mg=cg;var hg={parallel:og,serial:function(e,t,n){return mg(e,t,null,n)},serialOrdered:cg},fg=qf,gg=t,vg=f,bg=a,yg=o,_g=s.parse,xg=n,wg=p.Stream,Sg=Vf,kg=hg,Cg=function(e,t){return Object.keys(t).forEach((function(n){e[n]=e[n]||t[n]})),e},Rg=Tg;function Tg(e){if(!(this instanceof Tg))return new Tg(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],fg.call(this),e=e||{})this[t]=e[t]}function Pg(e){return jf.isPlainObject(e)||jf.isArray(e)}function Eg(e){return jf.endsWith(e,"[]")?e.slice(0,-2):e}function Og(e,t,n){return e?e.concat(t).map((function(e,t){return e=Eg(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}gg.inherits(Tg,fg),Tg.LINE_BREAK="\r\n",Tg.DEFAULT_CONTENT_TYPE="application/octet-stream",Tg.prototype.append=function(e,t,n){"string"==typeof(n=n||{})&&(n={filename:n});var i=fg.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),gg.isArray(t))this._error(new Error("Arrays are not supported."));else{var s=this._multiPartHeader(e,t,n),r=this._multiPartFooter();i(s),i(t),i(r),this._trackLength(s,t,n)}},Tg.prototype._trackLength=function(e,t,n){var i=0;null!=n.knownLength?i+=+n.knownLength:Buffer.isBuffer(t)?i=t.length:"string"==typeof t&&(i=Buffer.byteLength(t)),this._valueLength+=i,this._overheadLength+=Buffer.byteLength(e)+Tg.LINE_BREAK.length,t&&(t.path||t.readable&&t.hasOwnProperty("httpVersion")||t instanceof wg)&&(n.knownLength||this._valuesToMeasure.push(t))},Tg.prototype._lengthRetriever=function(e,t){e.hasOwnProperty("fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):xg.stat(e.path,(function(n,i){var s;n?t(n):(s=i.size-(e.start?e.start:0),t(null,s))})):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",(function(n){e.pause(),t(null,+n.headers["content-length"])})),e.resume()):t("Unknown stream")},Tg.prototype._multiPartHeader=function(e,t,n){if("string"==typeof n.header)return n.header;var i,s=this._getContentDisposition(t,n),r=this._getContentType(t,n),a="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(s||[]),"Content-Type":[].concat(r||[])};for(var c in"object"==typeof n.header&&Cg(o,n.header),o)o.hasOwnProperty(c)&&null!=(i=o[c])&&(Array.isArray(i)||(i=[i]),i.length&&(a+=c+": "+i.join("; ")+Tg.LINE_BREAK));return"--"+this.getBoundary()+Tg.LINE_BREAK+a+Tg.LINE_BREAK},Tg.prototype._getContentDisposition=function(e,t){var n,i;return"string"==typeof t.filepath?n=vg.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?n=vg.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(n=vg.basename(e.client._httpMessage.path||"")),n&&(i='filename="'+n+'"'),i},Tg.prototype._getContentType=function(e,t){var n=t.contentType;return!n&&e.name&&(n=Sg.lookup(e.name)),!n&&e.path&&(n=Sg.lookup(e.path)),!n&&e.readable&&e.hasOwnProperty("httpVersion")&&(n=e.headers["content-type"]),n||!t.filepath&&!t.filename||(n=Sg.lookup(t.filepath||t.filename)),n||"object"!=typeof e||(n=Tg.DEFAULT_CONTENT_TYPE),n},Tg.prototype._multiPartFooter=function(){return function(e){var t=Tg.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},Tg.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Tg.LINE_BREAK},Tg.prototype.getHeaders=function(e){var t,n={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(n[t.toLowerCase()]=e[t]);return n},Tg.prototype.setBoundary=function(e){this._boundary=e},Tg.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},Tg.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),n=0,i=this._streams.length;n<i;n++)"function"!=typeof this._streams[n]&&(e=Buffer.isBuffer(this._streams[n])?Buffer.concat([e,this._streams[n]]):Buffer.concat([e,Buffer.from(this._streams[n])]),"string"==typeof this._streams[n]&&this._streams[n].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(Tg.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},Tg.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},Tg.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},Tg.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},Tg.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?kg.parallel(this._valuesToMeasure,this._lengthRetriever,(function(n,i){n?e(n):(i.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},Tg.prototype.submit=function(e,t){var n,i,s={method:"post"};return"string"==typeof e?(e=_g(e),i=Cg({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},s)):(i=Cg(e,s)).port||(i.port="https:"==i.protocol?443:80),i.headers=this.getHeaders(e.headers),n="https:"==i.protocol?yg.request(i):bg.request(i),this.getLength(function(e,i){if(e&&"Unknown stream"!==e)this._error(e);else if(i&&n.setHeader("Content-Length",i),this.pipe(n),t){var s,r=function(e,i){return n.removeListener("error",r),n.removeListener("response",s),t.call(this,e,i)};s=r.bind(this,null),n.on("error",r),n.on("response",s)}}.bind(this)),n},Tg.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},Tg.prototype.toString=function(){return"[object FormData]"};const Dg=jf.toFlatObject(jf,{},null,(function(e){return/^is[A-Z]/.test(e)}));function jg(e,t,n){if(!jf.isObject(e))throw new TypeError("target must be an object");t=t||new(Rg||FormData);const i=(n=jf.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!jf.isUndefined(t[e])}))).metaTokens,s=n.visitor||d,r=n.dots,a=n.indexes,o=(n.Blob||"undefined"!=typeof Blob&&Blob)&&((c=t)&&jf.isFunction(c.append)&&"FormData"===c[Symbol.toStringTag]&&c[Symbol.iterator]);var c;if(!jf.isFunction(s))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(jf.isDate(e))return e.toISOString();if(!o&&jf.isBlob(e))throw new If("Blob is not supported. Use a Buffer instead.");return jf.isArrayBuffer(e)||jf.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,n,s){let o=e;if(e&&!s&&"object"==typeof e)if(jf.endsWith(n,"{}"))n=i?n:n.slice(0,-2),e=JSON.stringify(e);else if(jf.isArray(e)&&function(e){return jf.isArray(e)&&!e.some(Pg)}(e)||jf.isFileList(e)||jf.endsWith(n,"[]")&&(o=jf.toArray(e)))return n=Eg(n),o.forEach((function(e,i){!jf.isUndefined(e)&&null!==e&&t.append(!0===a?Og([n],i,r):null===a?n:n+"[]",p(e))})),!1;return!!Pg(e)||(t.append(Og(s,n,r),p(e)),!1)}const l=[],u=Object.assign(Dg,{defaultVisitor:d,convertValue:p,isVisitable:Pg});if(!jf.isObject(e))throw new TypeError("data must be an object");return function e(n,i){if(!jf.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+i.join("."));l.push(n),jf.forEach(n,(function(n,r){!0===(!(jf.isUndefined(n)||null===n)&&s.call(t,n,jf.isString(r)?r.trim():r,i,u))&&e(n,i?i.concat(r):[r])})),l.pop()}}(e),t}function Ig(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Mg(e,t){this._pairs=[],e&&jg(e,this,t)}const Lg=Mg.prototype;function Ag(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ng(e,t,n){if(!t)return e;const i=n&&n.encode||Ag,s=n&&n.serialize;let r;if(r=s?s(t,n):jf.isURLSearchParams(t)?t.toString():new Mg(t,n).toString(i),r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}Lg.append=function(e,t){this._pairs.push([e,t])},Lg.toString=function(e){const t=e?function(t){return e.call(this,t,Ig)}:Ig;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Bg{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){jf.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Fg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ug={isNode:!0,classes:{URLSearchParams:s.URLSearchParams,FormData:Rg,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function zg(e){function t(e,n,i,s){let r=e[s++];const a=Number.isFinite(+r),o=s>=e.length;if(r=!r&&jf.isArray(i)?i.length:r,o)return jf.hasOwnProp(i,r)?i[r]=[i[r],n]:i[r]=n,!a;i[r]&&jf.isObject(i[r])||(i[r]=[]);return t(e,n,i[r],s)&&jf.isArray(i[r])&&(i[r]=function(e){const t={},n=Object.keys(e);let i;const s=n.length;let r;for(i=0;i<s;i++)r=n[i],t[r]=e[r];return t}(i[r])),!a}if(jf.isFormData(e)&&jf.isFunction(e.entries)){const n={};return jf.forEachEntry(e,((e,i)=>{t(function(e){return jf.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,n,0)})),n}return null}const qg={"Content-Type":void 0};const $g={transitional:Fg,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",i=n.indexOf("application/json")>-1,s=jf.isObject(e);s&&jf.isHTMLForm(e)&&(e=new FormData(e));if(jf.isFormData(e))return i&&i?JSON.stringify(zg(e)):e;if(jf.isArrayBuffer(e)||jf.isBuffer(e)||jf.isStream(e)||jf.isFile(e)||jf.isBlob(e))return e;if(jf.isArrayBufferView(e))return e.buffer;if(jf.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let r;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return jg(e,new Ug.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,i){return jf.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=jf.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return jg(r?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),function(e,t,n){if(jf.isString(e))try{return(t||JSON.parse)(e),jf.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||$g.transitional,n=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&jf.isString(e)&&(n&&!this.responseType||i)){const n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw If.from(e,If.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ug.classes.FormData,Blob:Ug.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};jf.forEach(["delete","get","head"],(function(e){$g.headers[e]={}})),jf.forEach(["post","put","patch"],(function(e){$g.headers[e]=jf.merge(qg)}));const Vg=jf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Hg=Symbol("internals");function Wg(e){return e&&String(e).trim().toLowerCase()}function Gg(e){return!1===e||null==e?e:jf.isArray(e)?e.map(Gg):String(e)}function Kg(e,t,n,i){return jf.isFunction(i)?i.call(this,t,n):jf.isString(t)?jf.isString(i)?-1!==t.indexOf(i):jf.isRegExp(i)?i.test(t):void 0:void 0}class Jg{constructor(e){e&&this.set(e)}set(e,t,n){const i=this;function s(e,t,n){const s=Wg(t);if(!s)throw new Error("header name must be a non-empty string");const r=jf.findKey(i,s);(!r||void 0===i[r]||!0===n||void 0===n&&!1!==i[r])&&(i[r||t]=Gg(e))}const r=(e,t)=>jf.forEach(e,((e,n)=>s(e,n,t)));return jf.isPlainObject(e)||e instanceof this.constructor?r(e,t):jf.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?r((e=>{const t={};let n,i,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),n=e.substring(0,s).trim().toLowerCase(),i=e.substring(s+1).trim(),!n||t[n]&&Vg[n]||("set-cookie"===n?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)})),t})(e),t):null!=e&&s(t,e,n),this}get(e,t){if(e=Wg(e)){const n=jf.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}(e);if(jf.isFunction(t))return t.call(this,e,n);if(jf.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Wg(e)){const n=jf.findKey(this,e);return!(!n||t&&!Kg(0,this[n],n,t))}return!1}delete(e,t){const n=this;let i=!1;function s(e){if(e=Wg(e)){const s=jf.findKey(n,e);!s||t&&!Kg(0,n[s],s,t)||(delete n[s],i=!0)}}return jf.isArray(e)?e.forEach(s):s(e),i}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,n={};return jf.forEach(this,((i,s)=>{const r=jf.findKey(n,s);if(r)return t[r]=Gg(i),void delete t[s];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(s):String(s).trim();a!==s&&delete t[s],t[a]=Gg(i),n[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return jf.forEach(this,((n,i)=>{null!=n&&!1!==n&&(t[i]=e&&jf.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[Hg]=this[Hg]={accessors:{}}).accessors,n=this.prototype;function i(e){const i=Wg(e);t[i]||(!function(e,t){const n=jf.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+n,{value:function(e,n,s){return this[i].call(this,t,e,n,s)},configurable:!0})}))}(n,e),t[i]=!0)}return jf.isArray(e)?e.forEach(i):i(e),this}}function Qg(e,t){const n=this||$g,i=t||n,s=Jg.from(i.headers);let r=i.data;return jf.forEach(e,(function(e){r=e.call(n,r,s.normalize(),t?t.status:void 0)})),s.normalize(),r}function Yg(e){return!(!e||!e.__CANCEL__)}function Xg(e,t,n){If.call(this,null==e?"canceled":e,If.ERR_CANCELED,t,n),this.name="CanceledError"}function Zg(e,t,n){const i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(new If("Request failed with status code "+n.status,[If.ERR_BAD_REQUEST,If.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}function ev(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}Jg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),jf.freezeMethods(Jg.prototype),jf.freezeMethods(Jg),jf.inherits(Xg,If,{__CANCEL__:!0});var tv=s.parse,nv={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},iv=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function sv(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var rv,av=function(e){var t="string"==typeof e?tv(e):e||{},n=t.protocol,i=t.host,s=t.port;if("string"!=typeof i||!i||"string"!=typeof n)return"";if(n=n.split(":",1)[0],!function(e,t){var n=(sv("npm_config_no_proxy")||sv("no_proxy")).toLowerCase();if(!n)return!0;if("*"===n)return!1;return n.split(/[,\s]/).every((function(n){if(!n)return!0;var i=n.match(/^(.+):(\d+)$/),s=i?i[1]:n,r=i?parseInt(i[2]):0;return!(!r||r===t)||(/^[.*]/.test(s)?("*"===s.charAt(0)&&(s=s.slice(1)),!iv.call(e,s)):e!==s)}))}(i=i.replace(/:\d*$/,""),s=parseInt(s)||nv[n]||0))return"";var r=sv("npm_config_"+n+"_proxy")||sv(n+"_proxy")||sv("npm_config_proxy")||sv("all_proxy");return r&&-1===r.indexOf("://")&&(r=n+"://"+r),r},ov={},cv={get exports(){return ov},set exports(e){ov=e}},pv=s,dv=pv.URL,lv=a,uv=o,mv=p.Writable,hv=m,fv=function(){if(!rv){try{rv=gc("follow-redirects")}catch(e){}"function"!=typeof rv&&(rv=function(){})}rv.apply(null,arguments)},gv=["abort","aborted","connect","error","socket","timeout"],vv=Object.create(null);gv.forEach((function(e){vv[e]=function(t,n,i){this._redirectable.emit(e,t,n,i)}}));var bv=Pv("ERR_INVALID_URL","Invalid URL",TypeError),yv=Pv("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),_v=Pv("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),xv=Pv("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),wv=Pv("ERR_STREAM_WRITE_AFTER_END","write after end");function Sv(e,t){mv.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var n=this;this._onNativeResponse=function(e){n._processResponse(e)},this._performRequest()}function kv(e){var t={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(e).forEach((function(i){var s=i+":",r=n[s]=e[i],a=t[i]=Object.create(r);Object.defineProperties(a,{request:{value:function(e,i,r){if(Ov(e)){var a;try{a=Rv(new dv(e))}catch(t){a=pv.parse(e)}if(!Ov(a.protocol))throw new bv({input:e});e=a}else dv&&e instanceof dv?e=Rv(e):(r=i,i=e,e={protocol:s});return Dv(i)&&(r=i,i=null),(i=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,i)).nativeProtocols=n,Ov(i.host)||Ov(i.hostname)||(i.hostname="::1"),hv.equal(i.protocol,s,"protocol mismatch"),fv("options",i),new Sv(i,r)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,n){var i=a.request(e,t,n);return i.end(),i},configurable:!0,enumerable:!0,writable:!0}})})),t}function Cv(){}function Rv(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function Tv(e,t){var n;for(var i in t)e.test(i)&&(n=t[i],delete t[i]);return null==n?void 0:String(n).trim()}function Pv(e,t,n){function i(n){Error.captureStackTrace(this,this.constructor),Object.assign(this,n||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return i.prototype=new(n||Error),i.prototype.constructor=i,i.prototype.name="Error ["+e+"]",i}function Ev(e){for(var t of gv)e.removeListener(t,vv[t]);e.on("error",Cv),e.abort()}function Ov(e){return"string"==typeof e||e instanceof String}function Dv(e){return"function"==typeof e}Sv.prototype=Object.create(mv.prototype),Sv.prototype.abort=function(){Ev(this._currentRequest),this.emit("abort")},Sv.prototype.write=function(e,t,n){if(this._ending)throw new wv;if(!Ov(e)&&("object"!=typeof(i=e)||!("length"in i)))throw new TypeError("data should be a string, Buffer or Uint8Array");var i;Dv(t)&&(n=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,n)):(this.emit("error",new xv),this.abort()):n&&n()},Sv.prototype.end=function(e,t,n){if(Dv(e)?(n=e,e=t=null):Dv(t)&&(n=t,t=null),e){var i=this,s=this._currentRequest;this.write(e,t,(function(){i._ended=!0,s.end(null,null,n)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,n)},Sv.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},Sv.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},Sv.prototype.setTimeout=function(e,t){var n=this;function i(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function s(t){n._timeout&&clearTimeout(n._timeout),n._timeout=setTimeout((function(){n.emit("timeout"),r()}),e),i(t)}function r(){n._timeout&&(clearTimeout(n._timeout),n._timeout=null),n.removeListener("abort",r),n.removeListener("error",r),n.removeListener("response",r),t&&n.removeListener("timeout",t),n.socket||n._currentRequest.removeListener("socket",s)}return t&&this.on("timeout",t),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",i),this.on("abort",r),this.on("error",r),this.on("response",r),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){Sv.prototype[e]=function(t,n){return this._currentRequest[e](t,n)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(Sv.prototype,e,{get:function(){return this._currentRequest[e]}})})),Sv.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},Sv.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var n=e.slice(0,-1);this._options.agent=this._options.agents[n]}var i=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var s of(i._redirectable=this,gv))i.on(s,vv[s]);if(this._currentUrl=/^\//.test(this._options.path)?pv.format(this._options):this._options.path,this._isRedirect){var r=0,a=this,o=this._requestBodyBuffers;!function e(t){if(i===a._currentRequest)if(t)a.emit("error",t);else if(r<o.length){var n=o[r++];i.finished||i.write(n.data,n.encoding,e)}else a._ended&&i.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},Sv.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var n=e.headers.location;if(!n||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(Ev(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new _v);else{var i,s=this._options.beforeRedirect;s&&(i=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var r=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],Tv(/^content-/i,this._options.headers));var a,o=Tv(/^host$/i,this._options.headers),c=pv.parse(this._currentUrl),p=o||c.host,d=/^\w+:/.test(n)?this._currentUrl:pv.format(Object.assign(c,{host:p}));try{a=pv.resolve(d,n)}catch(e){return void this.emit("error",new yv({cause:e}))}fv("redirecting to",a),this._isRedirect=!0;var l=pv.parse(a);if(Object.assign(this._options,l),(l.protocol!==c.protocol&&"https:"!==l.protocol||l.host!==p&&!function(e,t){hv(Ov(e)&&Ov(t));var n=e.length-t.length-1;return n>0&&"."===e[n]&&e.endsWith(t)}(l.host,p))&&Tv(/^(?:authorization|cookie)$/i,this._options.headers),Dv(s)){var u={headers:e.headers,statusCode:t},m={url:d,method:r,headers:i};try{s(this._options,u,m)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new yv({cause:e}))}}},cv.exports=kv({http:lv,https:uv}),ov.wrap=kv;function jv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const Iv=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Mv(e,t){e=e||10;const n=new Array(e),i=new Array(e);let s,r=0,a=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),p=i[a];s||(s=c),n[r]=o,i[r]=c;let d=a,l=0;for(;d!==r;)l+=n[d++],d%=e;if(r=(r+1)%e,r===a&&(a=(a+1)%e),c-s<t)return;const u=p&&c-p;return u?Math.round(1e3*l/u):void 0}}const Lv=Symbol("internals");class Av extends p.Transform{constructor(e){super({readableHighWaterMark:(e=jf.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!jf.isUndefined(t[e])))).chunkSize});const t=this,n=this[Lv]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},i=Mv(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",(e=>{"progress"===e&&(n.isCaptured||(n.isCaptured=!0))}));let s=0;n.updateProgress=function(e,t){let n=0;const i=1e3/t;let s=null;return function(t,r){const a=Date.now();if(t||a-n>i)return s&&(clearTimeout(s),s=null),n=a,e.apply(null,r);s||(s=setTimeout((()=>(s=null,n=Date.now(),e.apply(null,r))),i-(a-n)))}}((function(){const e=n.length,r=n.bytesSeen,a=r-s;if(!a||t.destroyed)return;const o=i(a);s=r,process.nextTick((()=>{t.emit("progress",{loaded:r,total:e,progress:e?r/e:void 0,bytes:a,rate:o||void 0,estimated:o&&e&&r<=e?(e-r)/o:void 0})}))}),n.ticksRate);const r=()=>{n.updateProgress(!0)};this.once("end",r),this.once("error",r)}_read(e){const t=this[Lv];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){const i=this,s=this[Lv],r=s.maxRate,a=this.readableHighWaterMark,o=s.timeWindow,c=r/(1e3/o),p=!1!==s.minChunkSize?Math.max(s.minChunkSize,.01*c):0;const d=(e,t)=>{const n=Buffer.byteLength(e);let d,l=null,u=a,m=0;if(r){const e=Date.now();(!s.ts||(m=e-s.ts)>=o)&&(s.ts=e,d=c-s.bytes,s.bytes=d<0?-d:0,m=0),d=c-s.bytes}if(r){if(d<=0)return setTimeout((()=>{t(null,e)}),o-m);d<u&&(u=d)}u&&n>u&&n-u>p&&(l=e.subarray(u),e=e.subarray(0,u)),function(e,t){const n=Buffer.byteLength(e);s.bytesSeen+=n,s.bytes+=n,s.isCaptured&&s.updateProgress(),i.push(e)?process.nextTick(t):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(t)}}(e,l?()=>{process.nextTick(t,null,l)}:t)};d(e,(function e(t,i){if(t)return n(t);i?d(i,e):n(null)}))}setLength(e){return this[Lv].length=+e,this}}const Nv={flush:u.constants.Z_SYNC_FLUSH,finishFlush:u.constants.Z_SYNC_FLUSH},Bv={flush:u.constants.BROTLI_OPERATION_FLUSH,finishFlush:u.constants.BROTLI_OPERATION_FLUSH},Fv=jf.isFunction(u.createBrotliDecompress),{http:Uv,https:zv}=ov,qv=/https:?/,$v=Ug.protocols.map((e=>e+":"));function Vv(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function Hv(e,t,n){let i=t;if(!i&&!1!==i){const e=av(n);e&&(i=new URL(e))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));const t=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=i.hostname||i.host;e.hostname=t,e.host=t,e.port=i.port,e.path=n,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(e){Hv(e,t,e.href)}}var Wv="undefined"!=typeof process&&"process"===jf.kindOf(process)&&function(e){return new Promise((function(t,n){let i=e.data;const s=e.responseType,r=e.responseEncoding,c=e.method.toUpperCase();let l,m,h,f=!1;const g=new d;function v(){l||(l=!0,e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),g.removeAllListeners())}function b(e,i){m||(m=!0,i&&(f=!0,v()),i?n(e):t(e))}const y=function(e){b(e)},_=function(e){b(e,!0)};function x(t){g.emit("abort",!t||t.type?new Xg(null,e,h):t)}g.once("abort",_),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x)));const w=ev(e.baseURL,e.url),S=new URL(w),k=S.protocol||$v[0];if("data:"===k){let t;if("GET"!==c)return Zg(y,_,{status:405,statusText:"method not allowed",headers:{},config:e});try{t=function(e,t,n){const i=n&&n.Blob||Ug.classes.Blob,s=jv(e);if(void 0===t&&i&&(t=!0),"data"===s){e=s.length?e.slice(s.length+1):e;const n=Iv.exec(e);if(!n)throw new If("Invalid URL",If.ERR_INVALID_URL);const r=n[1],a=n[2],o=n[3],c=Buffer.from(decodeURIComponent(o),a?"base64":"utf8");if(t){if(!i)throw new If("Blob is not supported",If.ERR_NOT_SUPPORT);return new i([c],{type:r})}return c}throw new If("Unsupported protocol "+s,If.ERR_NOT_SUPPORT)}(e.url,"blob"===s,{Blob:e.env&&e.env.Blob})}catch(t){throw If.from(t,If.ERR_BAD_REQUEST,e)}return"text"===s?(t=t.toString(r),r&&"utf8"!==r||(i=jf.stripBOM(t))):"stream"===s&&(t=p.Readable.from(t)),Zg(y,_,{data:t,status:200,statusText:"OK",headers:new Jg,config:e})}if(-1===$v.indexOf(k))return _(new If("Unsupported protocol "+k,If.ERR_BAD_REQUEST,e));const C=Jg.from(e.headers).normalize();C.set("User-Agent","axios/1.2.3",!1);const R=e.onDownloadProgress,T=e.onUploadProgress,P=e.maxRate;let E,O;if(jf.isFormData(i)&&jf.isFunction(i.getHeaders))C.set(i.getHeaders());else if(i&&!jf.isStream(i)){if(Buffer.isBuffer(i));else if(jf.isArrayBuffer(i))i=Buffer.from(new Uint8Array(i));else{if(!jf.isString(i))return _(new If("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",If.ERR_BAD_REQUEST,e));i=Buffer.from(i,"utf-8")}if(C.set("Content-Length",i.length,!1),e.maxBodyLength>-1&&i.length>e.maxBodyLength)return _(new If("Request body larger than maxBodyLength limit",If.ERR_BAD_REQUEST,e))}const D=jf.toFiniteNumber(C.getContentLength());let j,I;if(jf.isArray(P)?(E=P[0],O=P[1]):E=O=P,i&&(T||E)&&(jf.isStream(i)||(i=p.Readable.from(i,{objectMode:!1})),i=p.pipeline([i,new Av({length:D,maxRate:jf.toFiniteNumber(E)})],jf.noop),T&&i.on("progress",(e=>{T(Object.assign(e,{upload:!0}))}))),e.auth){j=(e.auth.username||"")+":"+(e.auth.password||"")}if(!j&&S.username){j=S.username+":"+S.password}j&&C.delete("authorization");try{I=Ng(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const n=new Error(t.message);return n.config=e,n.url=e.url,n.exists=!0,_(n)}C.set("Accept-Encoding","gzip, compress, deflate"+(Fv?", br":""),!1);const M={path:I,method:c,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:j,protocol:k,beforeRedirect:Vv,beforeRedirects:{}};let L;e.socketPath?M.socketPath=e.socketPath:(M.hostname=S.hostname,M.port=S.port,Hv(M,e.proxy,k+"//"+S.hostname+(S.port?":"+S.port:"")+M.path));const A=qv.test(M.protocol);if(M.agent=A?e.httpsAgent:e.httpAgent,e.transport?L=e.transport:0===e.maxRedirects?L=A?o:a:(e.maxRedirects&&(M.maxRedirects=e.maxRedirects),e.beforeRedirect&&(M.beforeRedirects.config=e.beforeRedirect),L=A?zv:Uv),e.maxBodyLength>-1?M.maxBodyLength=e.maxBodyLength:M.maxBodyLength=1/0,e.insecureHTTPParser&&(M.insecureHTTPParser=e.insecureHTTPParser),h=L.request(M,(function(t){if(h.destroyed)return;const n=[t],i=+t.headers["content-length"];if(R){const e=new Av({length:jf.toFiniteNumber(i),maxRate:jf.toFiniteNumber(O)});R&&e.on("progress",(e=>{R(Object.assign(e,{download:!0}))})),n.push(e)}let a=t;const o=t.req||h;if(!1!==e.decompress&&t.headers["content-encoding"])switch("HEAD"!==c&&204!==t.statusCode||delete t.headers["content-encoding"],t.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":case"deflate":n.push(u.createUnzip(Nv)),delete t.headers["content-encoding"];break;case"br":Fv&&(n.push(u.createBrotliDecompress(Bv)),delete t.headers["content-encoding"])}a=n.length>1?p.pipeline(n,jf.noop):n[0];const d=p.finished(a,(()=>{d(),v()})),l={status:t.statusCode,statusText:t.statusMessage,headers:new Jg(t.headers),config:e,request:o};if("stream"===s)l.data=a,Zg(y,_,l);else{const t=[];let n=0;a.on("data",(function(i){t.push(i),n+=i.length,e.maxContentLength>-1&&n>e.maxContentLength&&(f=!0,a.destroy(),_(new If("maxContentLength size of "+e.maxContentLength+" exceeded",If.ERR_BAD_RESPONSE,e,o)))})),a.on("aborted",(function(){if(f)return;const t=new If("maxContentLength size of "+e.maxContentLength+" exceeded",If.ERR_BAD_RESPONSE,e,o);a.destroy(t),_(t)})),a.on("error",(function(t){h.destroyed||_(If.from(t,null,e,o))})),a.on("end",(function(){try{let e=1===t.length?t[0]:Buffer.concat(t);"arraybuffer"!==s&&(e=e.toString(r),r&&"utf8"!==r||(e=jf.stripBOM(e))),l.data=e}catch(t){_(If.from(t,null,e,l.request,l))}Zg(y,_,l)}))}g.once("abort",(e=>{a.destroyed||(a.emit("error",e),a.destroy())}))})),g.once("abort",(e=>{_(e),h.destroy(e)})),h.on("error",(function(t){_(If.from(t,null,e,h))})),h.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(isNaN(t))return void _(new If("error trying to parse `config.timeout` to int",If.ERR_BAD_OPTION_VALUE,e,h));h.setTimeout(t,(function(){if(m)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Fg;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),_(new If(t,n.clarifyTimeoutError?If.ETIMEDOUT:If.ECONNABORTED,e,h)),x()}))}if(jf.isStream(i)){let t=!1,n=!1;i.on("end",(()=>{t=!0})),i.once("error",(e=>{n=!0,h.destroy(e)})),i.on("close",(()=>{t||n||x(new Xg("Request stream has been aborted",e,h))})),i.pipe(h)}else h.end(i)}))},Gv=Ug.isStandardBrowserEnv?{write:function(e,t,n,i,s,r){const a=[];a.push(e+"="+encodeURIComponent(t)),jf.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),jf.isString(i)&&a.push("path="+i),jf.isString(s)&&a.push("domain="+s),!0===r&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},Kv=Ug.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function i(n){let i=n;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(e){const t=jf.isString(e)?i(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function Jv(e,t){let n=0;const i=Mv(50,250);return s=>{const r=s.loaded,a=s.lengthComputable?s.total:void 0,o=r-n,c=i(o);n=r;const p={loaded:r,total:a,progress:a?r/a:void 0,bytes:o,rate:c||void 0,estimated:c&&a&&r<=a?(a-r)/c:void 0,event:s};p[t?"download":"upload"]=!0,e(p)}}const Qv={http:Wv,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let i=e.data;const s=Jg.from(e.headers).normalize(),r=e.responseType;let a;function o(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}jf.isFormData(i)&&(Ug.isStandardBrowserEnv||Ug.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+n))}const p=ev(e.baseURL,e.url);function d(){if(!c)return;const i=Jg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Zg((function(e){t(e),o()}),(function(e){n(e),o()}),{data:r&&"text"!==r&&"json"!==r?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:i,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Ng(p,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(d)},c.onabort=function(){c&&(n(new If("Request aborted",If.ECONNABORTED,e,c)),c=null)},c.onerror=function(){n(new If("Network Error",If.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Fg;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new If(t,i.clarifyTimeoutError?If.ETIMEDOUT:If.ECONNABORTED,e,c)),c=null},Ug.isStandardBrowserEnv){const t=(e.withCredentials||Kv(p))&&e.xsrfCookieName&&Gv.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===i&&s.setContentType(null),"setRequestHeader"in c&&jf.forEach(s.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),jf.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),r&&"json"!==r&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",Jv(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",Jv(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=t=>{c&&(n(!t||t.type?new Xg(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const l=jv(p);l&&-1===Ug.protocols.indexOf(l)?n(new If("Unsupported protocol "+l+":",If.ERR_BAD_REQUEST,e)):c.send(i||null)}))}};jf.forEach(Qv,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Yv=e=>{e=jf.isArray(e)?e:[e];const{length:t}=e;let n,i;for(let s=0;s<t&&(n=e[s],!(i=jf.isString(n)?Qv[n.toLowerCase()]:n));s++);if(!i){if(!1===i)throw new If(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(jf.hasOwnProp(Qv,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`)}if(!jf.isFunction(i))throw new TypeError("adapter is not a function");return i};function Xv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xg(null,e)}function Zv(e){Xv(e),e.headers=Jg.from(e.headers),e.data=Qg.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Yv(e.adapter||$g.adapter)(e).then((function(t){return Xv(e),t.data=Qg.call(e,e.transformResponse,t),t.headers=Jg.from(t.headers),t}),(function(t){return Yg(t)||(Xv(e),t&&t.response&&(t.response.data=Qg.call(e,e.transformResponse,t.response),t.response.headers=Jg.from(t.response.headers))),Promise.reject(t)}))}const eb=e=>e instanceof Jg?e.toJSON():e;function tb(e,t){t=t||{};const n={};function i(e,t,n){return jf.isPlainObject(e)&&jf.isPlainObject(t)?jf.merge.call({caseless:n},e,t):jf.isPlainObject(t)?jf.merge({},t):jf.isArray(t)?t.slice():t}function s(e,t,n){return jf.isUndefined(t)?jf.isUndefined(e)?void 0:i(void 0,e,n):i(e,t,n)}function r(e,t){if(!jf.isUndefined(t))return i(void 0,t)}function a(e,t){return jf.isUndefined(t)?jf.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function o(n,s,r){return r in t?i(n,s):r in e?i(void 0,n):void 0}const c={url:r,method:r,data:r,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(e,t)=>s(eb(e),eb(t),!0)};return jf.forEach(Object.keys(e).concat(Object.keys(t)),(function(i){const r=c[i]||s,a=r(e[i],t[i],i);jf.isUndefined(a)&&r!==o||(n[i]=a)})),n}const nb={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{nb[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const ib={};nb.transitional=function(e,t,n){function i(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,s,r)=>{if(!1===e)throw new If(i(s," has been removed"+(t?" in "+t:"")),If.ERR_DEPRECATED);return t&&!ib[s]&&(ib[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,s,r)}};var sb={assertOptions:function(e,t,n){if("object"!=typeof e)throw new If("options must be an object",If.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let s=i.length;for(;s-- >0;){const r=i[s],a=t[r];if(a){const t=e[r],n=void 0===t||a(t,r,e);if(!0!==n)throw new If("option "+r+" must be "+n,If.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new If("Unknown option "+r,If.ERR_BAD_OPTION)}},validators:nb};const rb=sb.validators;class ab{constructor(e){this.defaults=e,this.interceptors={request:new Bg,response:new Bg}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=tb(this.defaults,t);const{transitional:n,paramsSerializer:i,headers:s}=t;let r;void 0!==n&&sb.assertOptions(n,{silentJSONParsing:rb.transitional(rb.boolean),forcedJSONParsing:rb.transitional(rb.boolean),clarifyTimeoutError:rb.transitional(rb.boolean)},!1),void 0!==i&&sb.assertOptions(i,{encode:rb.function,serialize:rb.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),r=s&&jf.merge(s.common,s[t.method]),r&&jf.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=Jg.concat(r,s);const a=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!o){const e=[Zv.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),d=e.length,p=Promise.resolve(t);l<d;)p=p.then(e[l++],e[l++]);return p}d=a.length;let u=t;for(l=0;l<d;){const e=a[l++],t=a[l++];try{u=e(u)}catch(e){t.call(this,e);break}}try{p=Zv.call(this,u)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)p=p.then(c[l++],c[l++]);return p}getUri(e){return Ng(ev((e=tb(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}jf.forEach(["delete","get","head","options"],(function(e){ab.prototype[e]=function(t,n){return this.request(tb(n||{},{method:e,url:t,data:(n||{}).data}))}})),jf.forEach(["post","put","patch"],(function(e){function t(t){return function(n,i,s){return this.request(tb(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}ab.prototype[e]=t(),ab.prototype[e+"Form"]=t(!0)}));class ob{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{n.subscribe(e),t=e})).then(e);return i.cancel=function(){n.unsubscribe(t)},i},e((function(e,i,s){n.reason||(n.reason=new Xg(e,i,s),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new ob((function(t){e=t})),cancel:e}}}const cb={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(cb).forEach((([e,t])=>{cb[t]=e}));const pb=function e(t){const n=new ab(t),i=nf(ab.prototype.request,n);return jf.extend(i,ab.prototype,n,{allOwnKeys:!0}),jf.extend(i,n,null,{allOwnKeys:!0}),i.create=function(n){return e(tb(t,n))},i}($g);pb.Axios=ab,pb.CanceledError=Xg,pb.CancelToken=ob,pb.isCancel=Yg,pb.VERSION="1.2.3",pb.toFormData=jg,pb.AxiosError=If,pb.Cancel=pb.CanceledError,pb.all=function(e){return Promise.all(e)},pb.spread=function(e){return function(t){return e.apply(null,t)}},pb.isAxiosError=function(e){return jf.isObject(e)&&!0===e.isAxiosError},pb.mergeConfig=tb,pb.AxiosHeaders=Jg,pb.formToJSON=e=>zg(jf.isHTMLForm(e)?new FormData(e):e),pb.HttpStatusCode=cb,pb.default=pb;class db{constructor(e={}){this.data=void 0===e.data?{}:e.data,this.headers=e.headers||{},this.status=e.status||200,this.statusText=e.statusText||"OK",this.url=e.url||null}}function lb(e,t){return m.ok(e,`${t} is required`),e}function ub(e,t){return m.ok("boolean"==typeof e,`${t}<boolean> is required`),e}function mb(e,t){return m.ok("number"==typeof e,`${t}<number> is required`),e}function hb(e,t){return m.ok("string"==typeof e,`${t}<string> is required`),e}function fb(e,t,n){const i=n||t.name[0].toLowerCase()+t.name.substring(1);return m.ok(e instanceof t,`${i}<${t.name}> is required`),e}function gb(e,t="roomName"){return hb(e,t),m.equal("string"==typeof e&&e[0],"/",`${t} must begin with a '/'`),e}function vb(e,t){return m.ok(Array.isArray(e),`${t}<array> is required`),e}function bb(e,t){if(null==e||"object"!=typeof e||Array.isArray(e))throw new Error(`${t} must be a record. ${JSON.stringify(e)}`);return e}function yb(e,t,n){hb(t,"name"),function(e,t,n,i){hb(n,"name");const s=i||`${n} must be null or of type ${t}`;m.ok(null===e||typeof e===t,s)}(e,"string",t,n)}function _b({baseUrl:e,url:t}){return m.ok("string"==typeof t,"url<String> is required"),e?e+t:t}class xb{constructor({baseUrl:e}){hb(e,"baseUrl"),this._baseUrl=e}_requestAxios(e,t){const n=Object.assign({},t,{url:e,baseURL:this._baseUrl});return pb.request(n)}request(e,t){return hb(e,"url"),m.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(t,"options are required"),this._requestAxios(e,t).then((e=>{const{data:t,headers:n,status:i,statusText:s,config:r}=e,a=r&&r.url?_b({baseUrl:r.baseURL,url:r.url}):null;return new db({data:t,headers:n,status:i,statusText:s,url:a})})).catch((e=>{const t=e.response;if(!t)throw new Error("Could not make the request.");const{data:n,headers:i,status:s,statusText:r,config:a}=t,o=a&&a.url?_b({baseUrl:a.baseURL,url:a.url}):null;return Promise.reject(new db({data:n,headers:i,status:s,statusText:r,url:o}))}))}}class wb{constructor({httpClient:e}){m.ok(e,"httpClient is required"),this._httpClient=e}static dataToFormData(e){m.ok(e,"data is required");const t=new FormData;return Object.keys(e).forEach((n=>{const i=e[n];t.append(n,i)})),t}request(e,t={}){const n=Object.assign(t.headers||{},{"Content-Type":void 0});return this._httpClient.request(e,Object.assign(t,{headers:n,transformRequest:wb.dataToFormData}))}}let Sb;Sb="object"==typeof window?window.btoa||tf:"object"==typeof global&&global.btoa||tf;const kb=()=>Promise.resolve(null);class Cb{constructor({httpClient:e,fetchDeviceCredentials:t}){this._httpClient=e,this._fetchDeviceCredentials=t}request(e,t){return this._fetchDeviceCredentials().then((n=>{const i=Object.assign({},t.headers,function(e){if(e&&e.credentials){const t=`${e.credentials.uuid}:${e.hmac}`;return{Authorization:`Basic ${Sb(t)}`}}return{}}(n),{"X-Appearin-Device-Platform":"web"}),s=Object.assign({},t,{headers:i});return this._httpClient.request(e,s)}))}}class Rb{constructor({baseUrl:e="https://api.appearin.net",fetchDeviceCredentials:t=kb}={}){hb(e,"baseUrl"),m.ok("function"==typeof t,"fetchDeviceCredentials<Function> is required"),this.authenticatedHttpClient=new Cb({httpClient:new xb({baseUrl:e}),fetchDeviceCredentials:t}),this.authenticatedFormDataHttpClient=new wb({httpClient:this.authenticatedHttpClient})}request(e,t){return hb(e,"url"),m.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(t,"options are required"),this.authenticatedHttpClient.request(e,t)}requestMultipart(e,t){return hb(e,"url"),m.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(t,"options are required"),this.authenticatedFormDataHttpClient.request(e,t)}}function Tb(e,t){return hb(bb(e,"data")[t],t)}const Pb=(Eb=Tb,(e,t)=>{const n=bb(e,"data")[t];return null==n?null:Eb(e,t)});var Eb;function Ob(e,t){const n=Tb(e,t),i=new Date(n);if(isNaN(i.getTime()))throw new Error(`Invalid date for ${n}`);return i}function Db(e,t,n){return function(e,t){return vb(bb(e,"data")[t],t)}(e,t).map((e=>n(e)))}class jb{constructor(e,t,n){this.credentials={uuid:e},this.hmac=t,this.userId=n}toJson(){return Object.assign({credentials:this.credentials,hmac:this.hmac},this.userId&&{userId:this.userId})}static fromJson(e){return new jb(Tb(function(e,t){const n=bb(e,"data")[t];return void 0===n?null:n}(e,"credentials"),"uuid"),Tb(e,"hmac"),Pb(e,"userId")||void 0)}}class Ib{constructor({apiClient:e}){this._apiClient=fb(e,Rb)}getCredentials(){return this._apiClient.request("/devices",{method:"post"}).then((({data:e})=>jb.fromJson(e))).catch((e=>{if(e.response&&404===e.response.status)return null;throw e}))}}class Mb{constructor(e,t){this._key=e,this._chromeStorage=t}loadOrDefault(e){return new Promise((t=>{this._chromeStorage.get(this._key,(n=>{t(n[this._key]||e)}))}))}save(e){return new Promise((t=>{this._chromeStorage.set({[this._key]:e},(()=>{t()}))}))}}class Lb{constructor(e,t){lb(t,"localStorage"),this._key=hb(e,"key"),this._localStorage=t}loadOrDefault(e){try{const t=this._localStorage.getItem(this._key);if(t)try{return Promise.resolve(JSON.parse(t))}catch(e){}return Promise.resolve(e)}catch(t){return console.warn("Error getting access to storage. Are cookies blocked?",t),Promise.resolve(e)}}save(e){try{return this._localStorage.setItem(this._key,JSON.stringify(e)),Promise.resolve()}catch(e){return console.warn("Error getting access to storage. Are cookies blocked?",e),Promise.reject(e)}}}let Ab;try{Ab=self.localStorage}catch(e){Ab={getItem:()=>{},key:()=>{},setItem:()=>{},removeItem:()=>{},hasOwnProperty:()=>{},length:0}}var Nb=Ab;const Bb="credentials_saved";class Fb extends d{constructor({deviceService:e,credentialsStore:t}){super(),this._deviceService=fb(e,Ib),this._credentialsStore=t}static create({baseUrl:e,storeName:t="CredentialsStorage",storeType:n="localStorage"}){const i=new Ib({apiClient:new Rb({baseUrl:e})});let s=null;if("localStorage"===n)s=new Lb(t,Nb);else{if("chromeStorage"!==n)throw new Error(`Unknown store type: ${n}`);s=new Mb(t,window.chrome.storage.local)}return new Fb({deviceService:i,credentialsStore:s})}_fetchNewCredentialsFromApi(){const e=this._credentialsStore;return new Promise((t=>{const n=()=>{this._deviceService.getCredentials().then((n=>e.save(n?n.toJson():null).then((()=>t(n))))).catch((()=>{setTimeout(n,2e3)}))};n()}))}getCurrentCredentials(){return this._credentialsStore.loadOrDefault(null).then((e=>e?jb.fromJson(e):null))}getCredentials(){return this.credentialsPromise||(this.credentialsPromise=this.getCurrentCredentials().then((e=>e||this._fetchNewCredentialsFromApi()))),this.credentialsPromise}saveCredentials(e){return this.credentialsPromise=void 0,this._credentialsStore.save(e.toJson()).then((()=>(this.emit(Bb,e),e)))}setUserId(e){return this.getCurrentCredentials().then((t=>{t||console.error("Illegal state: no credentials to set user id for.");if(null===t||t.userId!==e)return this._credentialsStore.save(Object.assign({},null==t?void 0:t.toJson(),{userId:e}))})).then((()=>{}))}}const Ub=()=>Promise.resolve(void 0);class zb{constructor({apiClient:e,fetchOrganization:t=Ub}){this._apiClient=fb(e,Rb),m.ok("function"==typeof t,"fetchOrganization<Function> is required"),this._fetchOrganization=t,this._apiClient=e}_callRequestMethod(e,t,n){return hb(t,"url"),m.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),m.ok(n,"options are required"),this._fetchOrganization().then((i=>{if(!i)return this._apiClient[e](t,n);const{organizationId:s}=i;return this._apiClient[e](`/organizations/${encodeURIComponent(s)}${t}`,n)}))}request(e,t){return this._callRequestMethod("request",e,t)}requestMultipart(e,t){return this._callRequestMethod("requestMultipart",e,t)}}class qb{constructor({isExhausted:e,renewsAt:t,totalMinutesLimit:n,totalMinutesUsed:i}){this.isExhausted=e,this.renewsAt=t,this.totalMinutesLimit=n,this.totalMinutesUsed=i}static fromJson(e){return new qb({isExhausted:ub(e.isExhausted,"isExhausted"),renewsAt:new Date(hb(e.renewsAt,"renewsAt")),totalMinutesLimit:mb(e.totalMinutesLimit,"totalMinutesLimit"),totalMinutesUsed:mb(e.totalMinutesUsed,"totalMinutesUsed")})}}class $b{constructor({basePlanId:e,embeddedFreeTierStatus:t,isDeactivated:n,isOnTrial:i,onTrialUntil:s,trialStatus:r}){this.basePlanId=e,this.isDeactivated=n,this.isOnTrial=i,this.onTrialUntil=s||null,this.trialStatus=r||null,this.embeddedFreeTierStatus=t||null}static fromJson(e){return new $b({basePlanId:"string"==typeof e.basePlanId?e.basePlanId:null,isDeactivated:ub(e.isDeactivated,"isDeactivated"),isOnTrial:ub(e.isOnTrial,"isOnTrial"),onTrialUntil:"string"==typeof e.onTrialUntil?new Date(e.onTrialUntil):null,trialStatus:"string"==typeof e.trialStatus?e.trialStatus:null,embeddedFreeTierStatus:e.embeddedFreeTierStatus?qb.fromJson(e.embeddedFreeTierStatus):null})}}function Vb(e){return null!=e}function Hb(e={}){return{maxNumberOfInvitationsAndUsers:Vb(null==e?void 0:e.maxNumberOfInvitationsAndUsers)?Number(null==e?void 0:e.maxNumberOfInvitationsAndUsers):null,maxNumberOfClaimedRooms:Vb(null==e?void 0:e.maxNumberOfClaimedRooms)?Number(null==e?void 0:e.maxNumberOfClaimedRooms):null,maxRoomLimitPerOrganization:Vb(null==e?void 0:e.maxRoomLimitPerOrganization)?Number(null==e?void 0:e.maxRoomLimitPerOrganization):null,trialMinutesLimit:Vb(null==e?void 0:e.trialMinutesLimit)?Number(null==e?void 0:e.trialMinutesLimit):null,includedUnits:Vb(null==e?void 0:e.includedUnits)?Number(null==e?void 0:e.includedUnits):null}}class Wb{constructor(e){this.logoImageUrl=null,this.roomBackgroundImageUrl=null,this.roomBackgroundThumbnailUrl=null,this.roomKnockPageBackgroundImageUrl=null,this.roomKnockPageBackgroundThumbnailUrl=null,this.preferences=null,this.onboardingSurvey=null,this.type=null,fb(e,Object,"properties"),hb(e.organizationId,"organizationId"),hb(e.organizationName,"organizationName"),hb(e.subdomain,"subdomain"),fb(e.permissions,Object,"permissions"),fb(e.limits,Object,"limits"),this.organizationId=e.organizationId,this.organizationName=e.organizationName,this.subdomain=e.subdomain,this.permissions=e.permissions,this.limits=e.limits,this.account=e.account?new $b(e.account):null,this.logoImageUrl=e.logoImageUrl,this.roomBackgroundImageUrl=e.roomBackgroundImageUrl,this.roomBackgroundThumbnailUrl=e.roomBackgroundThumbnailUrl,this.roomKnockPageBackgroundImageUrl=e.roomKnockPageBackgroundImageUrl,this.roomKnockPageBackgroundThumbnailUrl=e.roomKnockPageBackgroundThumbnailUrl,this.preferences=e.preferences,this.onboardingSurvey=e.onboardingSurvey,this.type=e.type}static fromJson(e){const t=fb(e,Object,"data"),n=(null==t?void 0:t.preferences)||{},i=(null==t?void 0:t.onboardingSurvey)||null,s=fb(t.permissions,Object,"permissions");return new Wb({organizationId:hb(t.organizationId,"organizationId"),organizationName:hb(t.organizationName,"organizationName"),subdomain:hb(t.subdomain,"subdomain"),permissions:s,limits:Hb(fb(t.limits,Object,"limits")),account:t.account?$b.fromJson(t.account):null,logoImageUrl:"string"==typeof t.logoImageUrl?t.logoImageUrl:null,roomBackgroundImageUrl:"string"==typeof t.roomBackgroundImageUrl?t.roomBackgroundImageUrl:null,roomBackgroundThumbnailUrl:"string"==typeof t.roomBackgroundThumbnailUrl?t.roomBackgroundThumbnailUrl:null,roomKnockPageBackgroundImageUrl:"string"==typeof t.roomKnockPageBackgroundImageUrl?t.roomKnockPageBackgroundImageUrl:null,roomKnockPageBackgroundThumbnailUrl:"string"==typeof t.roomKnockPageBackgroundThumbnailUrl?t.roomKnockPageBackgroundThumbnailUrl:null,preferences:n,onboardingSurvey:i,type:"string"==typeof t.type?t.type:null})}}Wb.GLOBAL_ORGANIZATION_ID="1";class Gb{constructor({apiClient:e}){this._apiClient=fb(e,Rb)}createOrganization({organizationName:e,subdomain:t,owner:n}){const{displayName:i,consents:s}=n||{},r="email"in n?{value:n.email,verificationCode:hb(n.verificationCode,"owner.verificationCode")}:null,a="idToken"in n?n.idToken:null;if(hb(t,"subdomain"),hb(e,"organizationName"),hb(i,"owner.displayName"),m.ok(r||a,"owner.email or owner.idToken is required"),s){vb(s,"consents");for(const{consentRevisionId:e,action:t}of s)hb(e,"consentRevisionId"),yb(t,"action")}return this._apiClient.request("/organizations",{method:"POST",data:{organizationName:e,type:"private",subdomain:t,owner:Object.assign(Object.assign(Object.assign(Object.assign({},r&&{email:r}),a&&{idToken:a}),s&&{consents:s}),{displayName:i})}}).then((({data:e})=>Tb(e,"organizationId")))}getOrganizationBySubdomain(e){return hb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/?fields=permissions,account,onboardingSurvey`,{method:"GET"}).then((({data:e})=>Wb.fromJson(e))).catch((e=>{if(e instanceof db){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationByOrganizationId(e){return hb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}?fields=permissions,account`,{method:"GET"}).then((({data:e})=>Wb.fromJson(e))).catch((e=>{if(e instanceof db){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationsByContactPoint(e){const{code:t}=e,n="email"in e?e.email:null,i="phoneNumber"in e?e.phoneNumber:null;m.ok((n||i)&&!(n&&i),"either email or phoneNumber is required"),hb(t,"code");const s=n?{type:"email",value:n}:{type:"phoneNumber",value:i};return this._apiClient.request("/organization-queries",{method:"POST",data:{contactPoint:s,code:t}}).then((({data:e})=>Db(e,"organizations",(e=>Wb.fromJson(e)))))}getOrganizationsByIdToken({idToken:e}){return hb(e,"idToken"),this._apiClient.request("/organization-queries",{method:"POST",data:{idToken:e}}).then((({data:e})=>Db(e,"organizations",(e=>Wb.fromJson(Object.assign({permissions:{},limits:{}},bb(e,"organization")))))))}getOrganizationsByLoggedInUser(){return this._apiClient.request("/user/organizations",{method:"GET"}).then((({data:e})=>Db(e,"organizations",(e=>Wb.fromJson(Object.assign({permissions:{},limits:{}},bb(e,"organization")))))))}getSubdomainAvailability(e){return hb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/availability`,{method:"GET"}).then((({data:e})=>(fb(e,Object,"data"),{status:Tb(e,"status")})))}updatePreferences({organizationId:e,preferences:t}){return lb(e,"organizationId"),lb(t,"preferences"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}deleteOrganization({organizationId:e}){return lb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}`,{method:"DELETE"}).then((()=>{}))}}class Kb{constructor({organizationService:e,subdomain:t}){fb(e,Gb),hb(t,"subdomain"),this._organizationService=e,this._subdomain=t,this._organizationPromise=null}initOrganization(){return this.fetchOrganization().then((()=>{}))}fetchOrganization(){return this._organizationPromise||(this._organizationPromise=this._organizationService.getOrganizationBySubdomain(this._subdomain)),this._organizationPromise}}class Jb{constructor(e={}){m.ok(e instanceof Object,"properties<object> must be empty or an object"),this.isClaimed=!1,this.isBanned=!1,this.isLocked=!1,this.knockPage={backgroundImageUrl:null,backgroundThumbnailUrl:null},this.logoUrl=null,this.backgroundImageUrl=null,this.backgroundThumbnailUrl=null,this.type=null,this.legacyRoomType=null,this.mode=null,this.product=null,this.roomName=null,this.theme=null,this.preferences={},this.protectedPreferences={},this.publicProfile=null;const t={};Object.getOwnPropertyNames(e).forEach((n=>{-1!==Object.getOwnPropertyNames(this).indexOf(n)&&(t[n]=e[n])})),void 0!==e.ownerId&&(this.ownerId=e.ownerId),void 0!==e.meeting&&(this.meeting=e.meeting),Object.assign(this,t)}}class Qb{constructor({meetingId:e,roomName:t,roomUrl:n,startDate:i,endDate:s,hostRoomUrl:r,viewerRoomUrl:a}){hb(e,"meetingId"),hb(t,"roomName"),hb(n,"roomUrl"),fb(i,Date,"startDate"),fb(s,Date,"endDate"),this.meetingId=e,this.roomName=t,this.roomUrl=n,this.startDate=i,this.endDate=s,this.hostRoomUrl=r,this.viewerRoomUrl=a}static fromJson(e){return new Qb({meetingId:Tb(e,"meetingId"),roomName:Tb(e,"roomName"),roomUrl:Tb(e,"roomUrl"),startDate:Ob(e,"startDate"),endDate:Ob(e,"endDate"),hostRoomUrl:Pb(e,"hostRoomUrl"),viewerRoomUrl:Pb(e,"viewerRoomUrl")})}}function Yb(e,t=""){return`/room/${encodeURIComponent(e.substring(1))}${t}`}class Xb{constructor({organizationApiClient:e}){this._organizationApiClient=fb(e,zb)}getRooms({types:e,fields:t=[]}={}){return vb(e,"types"),vb(t,"fields"),this._organizationApiClient.request("/room",{method:"GET",params:{types:e.join(","),fields:t.join(","),includeOnlyLegacyRoomType:"false"}}).then((({data:e})=>e.rooms.map((e=>new Jb(e)))))}getRoom({roomName:e,fields:t}){gb(e);const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/rooms/${n}`,{method:"GET",params:Object.assign({includeOnlyLegacyRoomType:"false"},t&&{fields:t.join(",")})}).then((({data:t})=>new Jb(Object.assign({},t,Object.assign({roomName:e},t.meeting&&{meeting:Qb.fromJson(t.meeting)}))))).catch((t=>{if(404===t.status)return new Jb({roomName:e,isClaimed:!1,mode:"normal",product:{categoryName:"personal_free"},type:"personal",legacyRoomType:"free"});if(400===t.status&&"Banned room"===t.data.error)return new Jb({roomName:e,isBanned:!0});throw new Error(t.data?t.data.error:"Could not fetch room information")}))}claimRoom({roomName:e,type:t,mode:n,isLocked:i}){return gb(e),hb(t,"type"),this._organizationApiClient.request("/room/claim",{method:"POST",data:Object.assign(Object.assign({roomName:e,type:t},"string"==typeof n&&{mode:n}),"boolean"==typeof i&&{isLocked:i})}).then((()=>{})).catch((e=>{throw new Error(e.data.error||"Failed to claim room")}))}unclaimRoom(e){gb(e);const t=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${t}`,{method:"DELETE"}).then((()=>{}))}renameRoom({roomName:e,newRoomName:t}){gb(e),hb(t,"newRoomName");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/roomName`,{method:"PUT",data:{newRoomName:t}}).then((()=>{}))}changeMode({roomName:e,mode:t}){gb(e),hb(t,"mode");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/mode`,{method:"PUT",data:{mode:t}}).then((()=>{}))}updatePreferences({roomName:e,preferences:t}){gb(e),fb(t,Object,"preferences");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}updateProtectedPreferences({roomName:e,preferences:t}){gb(e),fb(t,Object,"preferences");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/protected-preferences`,{method:"PATCH",data:t}).then((()=>{}))}getRoomPermissions(e,{roomKey:t}={}){return gb(e),this._organizationApiClient.request(Yb(e,"/permissions"),Object.assign({method:"GET"},t&&{headers:{"X-Whereby-Room-Key":t}})).then((e=>{const{permissions:t,limits:n}=e.data;return{permissions:t,limits:n}}))}getRoomMetrics({roomName:e,metrics:t,from:n,to:i}){return gb(e),hb(t,"metrics"),this._organizationApiClient.request(Yb(e,"/metrics"),{method:"GET",params:{metrics:t,from:n,to:i}}).then((e=>e.data))}changeType({roomName:e,type:t}){gb(e),function(e,t,n){if(lb(e,"value"),vb(t,"allowedValues"),!t.includes(e))throw new Error(`${n}<string> must be one of the following: ${t.join(", ")}`)}(t,["personal","personal_xl"],"type");const n=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${n}/type`,{method:"PUT",data:{type:t}}).then((()=>{}))}getForestSocialImage({roomName:e,count:t}){return gb(e),mb(t,"count"),this._organizationApiClient.request(Yb(e,`/forest-social-image/${t}`),{method:"GET"}).then((e=>e.data.imageUrl))}}class Zb{constructor({displayName:e,id:t,stream:n,isAudioEnabled:i,isVideoEnabled:s}){this.isLocalParticipant=!1,this.displayName=e,this.id=t,this.stream=n,this.isAudioEnabled=i,this.isVideoEnabled=s}}class ey extends Zb{constructor({displayName:e,id:t,newJoiner:n,streams:i,isAudioEnabled:s,isVideoEnabled:r}){super({displayName:e,id:t,isAudioEnabled:s,isVideoEnabled:r}),this.newJoiner=n,this.streams=i.map((e=>({id:e,state:n?"new_accept":"to_accept"})))}updateStreamState(e,t){const n=this.streams.find((t=>t.id===e));n&&(n.state=t)}}class ty extends Zb{constructor({displayName:e,id:t,stream:n,isAudioEnabled:i,isVideoEnabled:s}){super({displayName:e,id:t,stream:n,isAudioEnabled:i,isVideoEnabled:s}),this.isLocalParticipant=!0}}const ny=["recorder","streamer"];const iy=()=>{},sy=EventTarget;class ry extends sy{constructor(e,{displayName:t,localMediaConstraints:n,localStream:i,logger:s}){super(),this.localParticipant=null,this.remoteParticipants=[],this.roomConnectionState="",this.roomUrl=new URL(e),this.logger=s||{debug:iy,error:iy,log:iy,warn:iy},this.displayName=t,this.localStream=i,this.localMediaConstraints=n;const r=ef({host:this.roomUrl.host});this.credentialsService=Fb.create({baseUrl:"https://api.appearin.net"}),this.apiClient=new Rb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:"https://api.appearin.net"}),this.organizationService=new Gb({apiClient:this.apiClient}),this.organizationServiceCache=new Kb({organizationService:this.organizationService,subdomain:r.subdomain}),this.organizationApiClient=new zb({apiClient:this.apiClient,fetchOrganization:()=>mn(this,void 0,void 0,(function*(){return(yield this.organizationServiceCache.fetchOrganization())||void 0}))}),this.roomService=new Xb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL("wss://signal.appearin.net"),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v1`,n=e.origin;return new Go(n,{host:n,path:t,reconnectionDelay:5e3,reconnectionDelayMax:3e4,timeout:1e4})}(),this.signalSocket.on("new_client",this._handleNewClient.bind(this)),this.signalSocket.on("client_left",this._handleClientLeft.bind(this)),this.signalSocket.on("audio_enabled",this._handleClientAudioEnabled.bind(this)),this.signalSocket.on("video_enabled",this._handleClientVideoEnabled.bind(this)),this.signalSocket.on("client_metadata_received",this._handleClientMetadataReceived.bind(this))}_handleNewClient({client:e}){if(ny.includes(e.role.roleName))return;const t=new ey(Object.assign(Object.assign({},e),{newJoiner:!0}));this.remoteParticipants=[...this.remoteParticipants,t],this._handleAcceptStreams([t]),this.dispatchEvent(new CustomEvent("participant_joined",{detail:{remoteParticipant:t}}))}_handleClientLeft({clientId:e}){const t=this.remoteParticipants.find((t=>t.id===e));this.remoteParticipants=this.remoteParticipants.filter((t=>t.id!==e)),t&&this.dispatchEvent(new CustomEvent("participant_left",{detail:{participantId:t.id}}))}_handleClientAudioEnabled({clientId:e,isAudioEnabled:t}){const n=this.remoteParticipants.find((t=>t.id===e));n&&this.dispatchEvent(new CustomEvent("participant_audio_enabled",{detail:{participantId:n.id,isAudioEnabled:t}}))}_handleClientVideoEnabled({clientId:e,isVideoEnabled:t}){const n=this.remoteParticipants.find((t=>t.id===e));n&&this.dispatchEvent(new CustomEvent("participant_video_enabled",{detail:{participantId:n.id,isVideoEnabled:t}}))}_handleClientMetadataReceived({payload:{clientId:e,displayName:t}}){const n=this.remoteParticipants.find((t=>t.id===e));n&&this.dispatchEvent(new CustomEvent("participant_metadata_changed",{detail:{participantId:n.id,displayName:t}}))}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):void this.logger.log(`Unhandled RTC event ${e}`)}_handleRtcManagerCreated({rtcManager:e}){var t,n,i;this.rtcManager=e,this.localStream&&(null===(t=this.rtcManager)||void 0===t||t.addNewStream("0",this.localStream,!(null===(n=this.localStream)||void 0===n?void 0:n.getAudioTracks().find((e=>e.enabled))),!(null===(i=this.localStream)||void 0===i?void 0:i.getVideoTracks().find((e=>e.enabled)))))}_handleAcceptStreams(e){var t,n;if(!this.rtcManager)return void this.logger.log("Unable to accept streams, no rtc manager");const i=null===(n=(t=this.rtcManager).shouldAcceptStreamsFromBothSides)||void 0===n?void 0:n.call(t);e.forEach((e=>{const{id:t,streams:n,newJoiner:s}=e;n.forEach((n=>{var r,a;const{id:o,state:c}=n;let p;if("done_accept"!==c&&(p=(s&&"0"===o?"new":"to")+"_accept"),p){if("to_accept"===p||"new_accept"===p&&i||"old_accept"===p&&!i)this.logger.log(`Accepting stream ${o} from ${t}`),null===(r=this.rtcManager)||void 0===r||r.acceptNewStream({streamId:"0"===o?t:o,clientId:t,shouldAddLocalVideo:"0"===o,activeBreakout:false});else if("new_accept"===p||"old_accept"===p);else if("to_unaccept"===p)this.logger.log(`Disconnecting stream ${o} from ${t}`),null===(a=this.rtcManager)||void 0===a||a.disconnect("0"===o?t:o,false);else if("done_accept"!==p)return void this.logger.warn(`Stream state not handled: ${p} for ${t}-${o}`);e.updateStreamState(o,c.replace(/to_|new_|old_/,"done_"))}}))}))}_handleStreamAdded({clientId:e,stream:t,streamId:n}){this.remoteParticipants.find((t=>t.id===e))?this.dispatchEvent(new CustomEvent("participant_stream_added",{detail:{participantId:e,stream:t,streamId:n}})):this.logger.log("WARN: Could not find participant for incoming stream")}join(){return mn(this,void 0,void 0,(function*(){if(["connected","connecting"].includes(this.roomConnectionState))return void console.warn(`Trying to join room state is ${this.roomConnectionState}`);if(this.logger.log("Joining room"),this.roomConnectionState="connecting",!this.localStream&&this.localMediaConstraints){const e=yield navigator.mediaDevices.getUserMedia(this.localMediaConstraints);this.localStream=e}const e=yield this.organizationServiceCache.fetchOrganization();if(!e)throw new Error("Invalid room url");const t={getMediaConstraints:()=>{var e,t;return{audio:!!(null===(e=this.localStream)||void 0===e?void 0:e.getAudioTracks().find((e=>e.enabled))),video:!!(null===(t=this.localStream)||void 0===t?void 0:t.getVideoTracks().find((e=>e.enabled)))}},deferrable:e=>!e};this.rtcManagerDispatcher=new Xh({emitter:{emit:this._handleRtcEvent.bind(this)},serverSocket:this.signalSocket,webrtcProvider:t,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}});const n=yield this.credentialsService.getCredentials();setTimeout((()=>{this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:n})}),2e3),this.signalSocket.once("device_identified",(()=>{var t,n;this.signalSocket.emit("join_room",{avatarUrl:null,config:{isAudioEnabled:!!(null===(t=this.localStream)||void 0===t?void 0:t.getAudioTracks().find((e=>e.enabled))),isVideoEnabled:!!(null===(n=this.localStream)||void 0===n?void 0:n.getVideoTracks().find((e=>e.enabled)))},deviceCapabilities:{canScreenshare:!0},displayName:this.displayName,isCoLocated:!1,isDevicePermissionDenied:!1,kickFromOtherRooms:!1,organizationId:e.organizationId,roomKey:null,roomName:this.roomUrl.pathname,selfId:""})})),this.signalSocket.once("room_joined",(e=>{const{selfId:t,room:{clients:n}}=e,i=n.find((e=>e.id===t));if(!i)throw new Error("Missing local client");this.localParticipant=new ty(Object.assign(Object.assign({},i),{stream:this.localStream})),this.remoteParticipants=n.filter((e=>e.id!==t)).map((e=>new ey(Object.assign(Object.assign({},e),{newJoiner:!1})))),this.rtcManager&&this._handleAcceptStreams(this.remoteParticipants),this.roomConnectionState="connected",this.dispatchEvent(new CustomEvent("room_joined",{detail:{localParticipant:this.localParticipant,remoteParticipants:this.remoteParticipants}}))}))}))}leave(){return new Promise((e=>{if(!this.signalSocket)return e();this.signalSocket.emit("leave_room");const t=setTimeout((()=>{e()}),200);this.signalSocket.once("room_left",(()=>{clearTimeout(t),this.signalSocket.disconnect(),e()}))}))}toggleCamera(e){var t;const n=null===(t=this.localStream)||void 0===t?void 0:t.getVideoTracks()[0];if(!n)return void this.logger.log("Tried toggling non-existing video track");const i=null!=e?e:!n.enabled;n.enabled=i,this.signalSocket.emit("enable_video",{enabled:i})}toggleMicrophone(e){var t;const n=null===(t=this.localStream)||void 0===t?void 0:t.getAudioTracks()[0];if(!n)return void this.logger.log("Tried toggling non-existing audio track");const i=null!=e?e:!n.enabled;n.enabled=i,this.signalSocket.emit("enable_audio",{enabled:i})}setDisplayName(e){this.signalSocket.emit("send_client_metadata",{type:"UserData",payload:{displayName:e}})}}function ay(e,t,n){const i=e.find((e=>e.id===t));if(!i)return e;const s=e.indexOf(i);return[...e.slice(0,s),Object.assign(Object.assign({},i),n),...e.slice(s+1)]}function oy(e,t){switch(t.type){case"ROOM_JOINED":return Object.assign(Object.assign({},e),{localParticipant:t.payload.localParticipant,remoteParticipants:t.payload.remoteParticipants,roomConnectionStatus:"connected"});case"PARTICIPANT_AUDIO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:ay(e.remoteParticipants,t.payload.participantId,{isAudioEnabled:t.payload.isAudioEnabled})});case"PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants,t.payload.paritipant]});case"PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.filter((e=>e.id!==t.payload.participantId))]});case"PARTICIPANT_STREAM_ADDED":return Object.assign(Object.assign({},e),{remoteParticipants:ay(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:ay(e.remoteParticipants,t.payload.participantId,{isVideoEnabled:t.payload.isVideoEnabled})});case"PARTICIPANT_METADATA_CHANGED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.map((e=>e.id===t.payload.participantId?Object.assign(Object.assign({},e),{displayName:t.payload.displayName}):e))]});case"LOCAL_CLIENT_DISPLAY_NAME_CHANGED":return e.localParticipant?Object.assign(Object.assign({},e),{localParticipant:Object.assign(Object.assign({},e.localParticipant),{displayName:t.payload.displayName})}):e;default:throw e}}function cy(e,t){const[n,i]=nn.useState(null),[s,r]=nn.useReducer(oy,{remoteParticipants:[]});return nn.useEffect((()=>{i(new ry(e,t))}),[e]),nn.useEffect((()=>{if(n)return n.addEventListener("participant_audio_enabled",(e=>{const{participantId:t,isAudioEnabled:n}=e.detail;r({type:"PARTICIPANT_AUDIO_ENABLED",payload:{participantId:t,isAudioEnabled:n}})})),n.addEventListener("participant_joined",(e=>{const{remoteParticipant:t}=e.detail;r({type:"PARTICIPANT_JOINED",payload:{paritipant:t}})})),n.addEventListener("participant_left",(e=>{const{participantId:t}=e.detail;r({type:"PARTICIPANT_LEFT",payload:{participantId:t}})})),n.addEventListener("participant_stream_added",(e=>{const{participantId:t,stream:n}=e.detail;r({type:"PARTICIPANT_STREAM_ADDED",payload:{participantId:t,stream:n}})})),n.addEventListener("room_joined",(e=>{const{localParticipant:t,remoteParticipants:n}=e.detail;r({type:"ROOM_JOINED",payload:{localParticipant:t,remoteParticipants:n}})})),n.addEventListener("participant_video_enabled",(e=>{const{participantId:t,isVideoEnabled:n}=e.detail;r({type:"PARTICIPANT_VIDEO_ENABLED",payload:{participantId:t,isVideoEnabled:n}})})),n.addEventListener("participant_metadata_changed",(e=>{const{participantId:t,displayName:n}=e.detail;r({type:"PARTICIPANT_METADATA_CHANGED",payload:{participantId:t,displayName:n}})})),n.join(),()=>{n.leave()}}),[n]),[s,{toggleCamera:e=>{null==n||n.toggleCamera(e)},toggleMicrophone:e=>{null==n||n.toggleMicrophone(e)},setDisplayName:e=>{null==n||n.setDisplayName(e),r({type:"LOCAL_CLIENT_DISPLAY_NAME_CHANGED",payload:{displayName:e}})}},{VideoView:un}]}const py="2.0.0-alpha2";export{py as sdkVersion,cy as useRoomConnection};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/browser-sdk",
3
- "version": "2.0.0-alpha1",
3
+ "version": "2.0.0-alpha2",
4
4
  "description": "Modules for integration Whereby video in web apps",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",
@@ -13,7 +13,10 @@
13
13
  "main": "dist/lib.cjs.js",
14
14
  "module": "dist/lib.esm.js",
15
15
  "type": "module",
16
- "files": ["dist/**/*.js", "dist/*.d.ts"],
16
+ "files": [
17
+ "dist/**/*.js",
18
+ "dist/*.d.ts"
19
+ ],
17
20
  "types": "dist/types.d.ts",
18
21
  "scripts": {
19
22
  "prebuild": "rimraf dist",
@@ -67,6 +70,7 @@
67
70
  "dependencies": {
68
71
  "@swc/helpers": "^0.3.13",
69
72
  "@whereby/jslib-media": "whereby/jslib-media.git",
73
+ "assert": "^2.0.0",
70
74
  "axios": "^1.2.3",
71
75
  "btoa": "^1.2.1",
72
76
  "heresy": "^1.0.4"