@whereby.com/browser-sdk 2.0.0-alpha20 → 2.0.0-alpha22

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/types.d.ts CHANGED
@@ -377,6 +377,6 @@ type RoomConnectionRef = {
377
377
  };
378
378
  declare function useRoomConnection(roomUrl: string, roomConnectionOptions: UseRoomConnectionOptions): RoomConnectionRef;
379
379
 
380
- declare const sdkVersion = "2.0.0-alpha20";
380
+ declare const sdkVersion = "2.0.0-alpha22";
381
381
 
382
382
  export { _default as VideoView, sdkVersion, useLocalMedia, useRoomConnection };
@@ -7,7 +7,7 @@ function D(e){return e.join(P).replace(B,q).replace(N,U)}var I=" \\f\\n\\r\\t",j
7
7
  /*! (c) Andrea Giammarchi - ISC */
8
8
  var J=function(e){var t="fragment",i="template",s="content"in a(i)?function(e){var t=a(i);return t.innerHTML=e,t.content}:function(e){var s=a(t),r=a(i),o=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;r.innerHTML="<table>"+e+"</table>",o=r.querySelectorAll(c)}else r.innerHTML=e,o=r.childNodes;return n(s,o),s};return function(e,t){return("svg"===t?r:s)(e)};function n(e,t){for(var i=t.length;i--;)e.appendChild(t[0])}function a(i){return i===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",i)}function r(e){var i=a(t),s=a("div");return s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",n(i,s.firstChild.childNodes),i}}(document),Q=(e,t,i,s,n)=>{const a=i.length;let r=t.length,o=a,c=0,p=0,d=null;for(;c<r||p<o;)if(r===c){const t=o<a?p?s(i[p-1],-0).nextSibling:s(i[o-p],0):n;for(;p<o;)e.insertBefore(s(i[p++],1),t)}else if(o===p)for(;c<r;)d&&d.has(t[c])||e.removeChild(s(t[c],-1)),c++;else if(t[c]===i[p])c++,p++;else if(t[r-1]===i[o-1])r--,o--;else if(t[c]===i[o-1]&&i[p]===t[r-1]){const n=s(t[--r],-1).nextSibling;e.insertBefore(s(i[p++],1),s(t[c++],-1).nextSibling),e.insertBefore(s(i[--o],1),n),t[r]=i[o]}else{if(!d){d=new Map;let e=p;for(;e<o;)d.set(i[e],e++)}if(d.has(t[c])){const n=d.get(t[c]);if(p<n&&n<o){let a=c,l=1;for(;++a<r&&a<o&&d.get(t[a])===n+l;)l++;if(l>n-p){const a=s(t[c],0);for(;p<n;)e.insertBefore(s(i[p++],1),a)}else e.replaceChild(s(i[p++],1),s(t[c++],-1))}else c++}else e.removeChild(s(t[c++],-1))}return i},Y=function(e,t,i,s,n){var a=n in e,r=e.createDocumentFragment();return r.appendChild(e.createTextNode("g")),r.appendChild(e.createTextNode("")),(a?e.importNode(r,!0):r.cloneNode(!0)).childNodes.length<2?function e(t,i){for(var s=t.cloneNode(),n=t.childNodes||[],a=n.length,r=0;i&&r<a;r++)s.appendChild(e(n[r],i));return s}:a?e.importNode:function(e,t){return e.cloneNode(!!t)}}(document,0,0,0,"importNode"),X="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},Z=T?function(e,t){var i=t.join(" ");return t.slice.call(e,0).sort((function(e,t){return i.indexOf(e.name)<=i.indexOf(t.name)?-1:1}))}:function(e,t){return t.slice.call(e,0)};function ee(e,t){for(var i=t.length,s=0;s<i;)e=e.childNodes[t[s++]];return e}function te(e,t,i,s){for(var n=e.childNodes,a=n.length,r=0;r<a;){var o=n[r];switch(o.nodeType){case 1:var c=s.concat(r);ie(o,t,i,c),te(o,t,i,c);break;case 8:var p=o.textContent;if(p===k)i.shift(),t.push(E.test(e.nodeName)?ae(e,s):se(o,s.concat(r)));else switch(p.slice(0,2)){case"/*":if("*/"!==p.slice(-2))break;case"👻":e.removeChild(o),r--,a--}break;case 3:E.test(e.nodeName)&&X.call(o.textContent)===P&&(i.shift(),t.push(ae(e,s)))}r++}}function ie(e,t,i,s){for(var n=e.attributes,a=[],r=[],o=Z(n,i),c=o.length,p=0;p<c;){var d,l=o[p++],u=l.value===k;if(u||1<(d=l.value.split(P)).length){var m=l.name;if(a.indexOf(m)<0){a.push(m);var h=i.shift().replace(u?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+m+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),f=n[h]||n[h.toLowerCase()];if(u)t.push(ne(f,s,h,null));else{for(var g=d.length-2;g--;)i.shift();t.push(ne(f,s,h,d))}}r.push(l)}}p=0;for(var v=(0<(c=r.length)&&T&&!("ownerSVGElement"in e));p<c;){var b=r[p++];v&&(b.value=""),e.removeAttribute(b.name)}var _=e.nodeName;if(/^script$/i.test(_)){var y=document.createElement(_);for(c=n.length,p=0;p<c;)y.setAttributeNode(n[p++].cloneNode(!0));y.textContent=e.textContent,e.parentNode.replaceChild(y,e)}}function se(e,t){return{type:"any",node:e,path:t}}function ne(e,t,i,s){return{type:"attr",node:e,path:t,name:i,sparse:s}}function ae(e,t){return{type:"text",node:e,path:t}}var re=H(new _);function oe(e,t){var i=(e.convert||D)(t),s=e.transform;s&&(i=s(i));var n=J(i,e.type);de(n);var a=[];return te(n,a,t.slice(0),[]),{content:n,updates:function(i){for(var s=[],n=a.length,r=0,o=0;r<n;){var c=a[r++],p=ee(i,c.path);switch(c.type){case"any":s.push({fn:e.any(p,[]),sparse:!1});break;case"attr":var d=c.sparse,l=e.attribute(p,c.name,c.node);null===d?s.push({fn:l,sparse:!1}):(o+=d.length-2,s.push({fn:l,sparse:!0,values:d}));break;case"text":s.push({fn:e.text(p),sparse:!1}),p.textContent=""}}return n+=o,function(){var e=arguments.length;if(n!==e-1)throw new Error(e-1+" values instead of "+n+"\n"+t.join("${value}"));for(var a=1,r=1;a<e;){var o=s[a-r];if(o.sparse){var c=o.values,p=c[0],d=1,l=c.length;for(r+=l-2;d<l;)p+=arguments[a++]+c[d++];o.fn(p)}else o.fn(arguments[a++])}return i}}}}function ce(e,t){var i=re.get(t)||re.set(t,oe(e,t));return i.updates(Y.call(document,i.content,!0))}var pe=[];function de(e){for(var t=e.childNodes,i=t.length;i--;){var s=t[i];1!==s.nodeType&&0===X.call(s.textContent).length&&e.removeChild(s)}}
9
9
  /*! (c) Andrea Giammarchi - ISC */var le=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 i;t?i=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),i=e.getAttributeNode("style"));return i.value="",e.setAttributeNode(i),s(i,!0)}(e,t):s(e.style,!1)};function i(e,t,i){return t+"-"+i.toLowerCase()}function s(s,n){var a,r;return function(o){var c,p,d,l;switch(typeof o){case"object":if(o){if("object"===a){if(!n&&r!==o)for(p in r)p in o||(s[p]="")}else n?s.value="":s.cssText="";for(p in c=n?{}:s,o)d="number"!=typeof(l=o[p])||e.test(p)?l:l+"px",!n&&/^--/.test(p)?c.setProperty(p,d):c[p]=d;a="object",n?s.value=function(e){var s,n=[];for(s in e)n.push(s.replace(t,i),":",e[s],";");return n.join("")}(r=c):r=o;break}default:r!=o&&(a="string",r=o,n?s.value=o||"":s.cssText=o||"")}}}}();const ue=(e,t)=>{let i,s=!0;const n=document.createAttributeNS(null,t);return t=>{i!==t&&(i=t,null==i?s||(e.removeAttributeNode(n),s=!0):(n.value=t,s&&(e.setAttributeNodeNS(n),s=!1)))}},me=({dataset:e})=>t=>{for(const i in t){const s=t[i];null==s?delete e[i]:e[i]=s}},he=(e,t)=>"dataset"===t?me(e):i=>{e[t]=i},fe=/^(?:form|list)$/i,ge=(e,t)=>e.ownerDocument.createTextNode(t);function ve(e){return this.type=e,function(e){var t=pe,i=de;return function(s){return t!==s&&(i=ce(e,t=s)),i.apply(null,arguments)}}(this)}function be(e){return e(this)}ve.prototype={attribute(e,t,i){const s="svg"===this.type;switch(t){case"class":if(s)return ue(e,t);t="className";case"props":return he(e,t);case"aria":return(e=>t=>{for(const i in t){const s="role"===i?i:`aria-${i}`,n=t[i];null==n?e.removeAttribute(s):e.setAttribute(s,n)}})(e);case"style":return le(e,i,s);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return me(e);default:return"."===t.slice(0,1)?he(e,t.slice(1)):"?"===t.slice(0,1)?((e,t,i)=>s=>{i!==!!s&&((i=!!s)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let i,s=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(s=s.toLowerCase()),t=>{const n=$(t)?t:[t,!1];i!==n[0]&&(i&&e.removeEventListener(s,i,n[1]),(i=n[0])&&e.addEventListener(s,i,n[1]))}})(e,t):!(t in e)||s||fe.test(t)?ue(e,t):((e,t)=>{let i;return s=>{i!==s&&(i=s,e[t]!==s&&(null==s?(e[t]="",e.removeAttribute(t)):e[t]=s))}})(e,t)}},any(e,t){const{type:i}=this;let s,n=!1;const a=r=>{switch(typeof r){case"string":case"number":case"boolean":n?s!==r&&(s=r,t[0].textContent=r):(n=!0,s=r,t=Q(e.parentNode,t,[ge(e,r)],G,e));break;case"function":a(r(e));break;case"object":case"undefined":if(null==r){n=!1,t=Q(e.parentNode,t,[],G,e);break}default:if(n=!1,s=r,$(r))if(0===r.length)t.length&&(t=Q(e.parentNode,t,[],G,e));else switch(typeof r[0]){case"string":case"number":case"boolean":a(String(r));break;case"function":a(r.map(be,e));break;case"object":$(r[0])&&(r=r.concat.apply([],r));default:t=Q(e.parentNode,t,r,G,e)}else"ELEMENT_NODE"in r?t=Q(e.parentNode,t,11===r.nodeType?W.call(r.childNodes):[r],G,e):"text"in r?a(String(r.text)):"any"in r?a(r.any):"html"in r?t=Q(e.parentNode,t,W.call(J([].concat(r.html).join(""),i).childNodes),G,e):"length"in r&&a(W.call(r))}};return a},text(e){let t;const i=s=>{if(t!==s){t=s;const n=typeof s;"object"===n&&s?"text"in s?i(String(s.text)):"any"in s?i(s.any):"html"in s?i([].concat(s.html).join("")):"length"in s&&i(W.call(s).join("")):"function"===n?i(s(e)):e.textContent=null==s?"":s}};return i}};const{create:_e,freeze:ye,keys:xe}=Object,we=ve.prototype,Se=H(new _),Re=e=>({html:ke("html",e),svg:ke("svg",e),render(t,i){const s="function"==typeof i?i():i,n=Se.get(t)||Se.set(t,Ce()),a=s instanceof Ee?Te(e,n,s):s;return a!==n.wire&&(n.wire=a,t.textContent="",t.appendChild(a.valueOf())),t}}),Ce=()=>({stack:[],entry:null,wire:null}),ke=(e,t)=>{const i=H(new _);return s.for=(e,n)=>{const a=i.get(e)||i.set(e,_e(null));return a[n]||(a[n]=(e=>function(){return Te(t,e,s.apply(null,arguments))})(Ce()))},s.node=function(){return Te(t,Ce(),s.apply(null,arguments)).valueOf()},s;function s(){return new Ee(e,De.apply(null,arguments))}},Te=(e,t,{type:i,template:s,values:n})=>{const{length:a}=n;Pe(e,t,n,a);let{entry:r}=t;if(r&&r.template===s&&r.type===i)r.tag(s,...n);else{const a=new e(i);t.entry=r={type:i,template:s,tag:a,wire:K(a(s,...n))}}return r.wire},Pe=(e,{stack:t},i,s)=>{for(let n=0;n<s;n++){const s=i[n];s instanceof Oe?i[n]=Te(e,t[n]||(t[n]=Ce()),s):$(s)?Pe(e,t[n]||(t[n]=Ce()),s,s.length):t[n]=null}s<t.length&&t.splice(s)};function Ee(e,t){this.type=e,this.template=t.shift(),this.values=t}ye(Ee);const Oe=Ee;function De(){let e=[],t=0,{length:i}=arguments;for(;t<i;)e.push(arguments[t++]);return e}Re(ve);var Ie="function"==typeof cancelAnimationFrame,je=Ie?cancelAnimationFrame:clearTimeout,Me=Ie?requestAnimationFrame:setTimeout;function Le(e){var t,i,s,n,a;return o(),function(e,o,p){return s=e,n=o,a=p,i||(i=Me(r)),--t<0&&c(!0),c};function r(){o(),s.apply(n,a||[])}function o(){t=e||1/0,i=Ie?0:null}function c(e){var t=!!i;return t&&(je(i),e&&r()),t}}
10
- /*! (c) Andrea Giammarchi - ISC */let Ae=null;const Ne=H(new WeakMap),Be=(e,t,i)=>{e.apply(t,i)},Fe={async:!1,always:!1},Ue=(e,t)=>"function"==typeof t?t(e):t,ze=(e,t,i,s)=>{const n=Ae.i++,{hook:a,args:r,stack:o,length:c}=Ae;n===c&&(Ae.length=o.push({}));const p=o[n];if(p.args=r,n===c){const n="function"==typeof i,{async:r,always:o}=(n?s:i)||s||Fe;p.$=n?i(t):Ue(void 0,t),p._=r?Ne.get(a)||Ne.set(a,Le()):Be,p.f=t=>{const i=e(p.$,t);(o||p.$!==i)&&(p.$=i,p._(a,null,p.args))}}return[p.$,p.f]},qe=new WeakMap;function $e({hook:e}){return e===this.hook}const Ve=new WeakMap,We=H(Ve),He=()=>{},Ge=e=>(t,i)=>{const s=Ae.i++,{hook:n,after:a,stack:r,length:o}=Ae;if(s<o){const n=r[s],{update:o,values:c,stop:p}=n;if(!i||i.some(Xe,c)){n.values=i,e&&p(e);const{clean:s}=n;s&&(n.clean=null,s());const r=()=>{n.clean=t()};e?o(r):a.push(r)}}else{const s=e?Le():He,o={clean:null,update:s,values:i,stop:He};Ae.length=r.push(o),(We.get(n)||We.set(n,[])).push(o);const c=()=>{o.clean=t()};e?o.stop=s(c):a.push(c)}},Ke=e=>{(Ve.get(e)||[]).forEach((e=>{const{clean:t,stop:i}=e;i(),t&&(e.clean=null,t())}))};Ve.has.bind(Ve);const Je=Ge(!0),Qe=Ge(!1),Ye=(e,t)=>{const i=Ae.i++,{stack:s,length:n}=Ae;return i===n?Ae.length=s.push({$:e(),_:t}):t&&!t.some(Xe,s[i]._)||(s[i]={$:e(),_:t}),s[i].$};function Xe(e,t){return e!==this[t]}let Ze=null;try{Ze=new{o(){}}.o}catch(Yt){}let et=e=>class extends e{};if(Ze){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:i}="object"==typeof Reflect?Reflect:{construct(e,i,s){const n=[null];for(let e=0;e<i.length;e++)n.push(i[e]);const a=e.bind.apply(e,n);return t(new a,s.prototype)}};et=function(s,n){function a(){return i(n?e(s):s,arguments,a)}return t(a.prototype,s.prototype),t(a,s)}}const tt={map:{},re:null},it=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let st=null;const nt=(e,t)=>{const{map:i,re:s}=st||t;return e.replace(s,((e,t,s,n)=>{const{tagName:a,is:r,element:o}=i[s];return o?t?`</${r}>`:`<${r}${n}`:t?`</${a}>`:`<${a} is="${r}"${n}`}))},at=({tagName:e,is:t,element:i})=>i?t:`${e}[is="${t}"]`,rt=()=>st,ot=e=>{st=e},ct={useCallback:(e,t)=>Ye((()=>e),t),useContext:e=>{const{hook:t,args:i}=Ae,s=qe.get(e),n={hook:t,args:i};return s.some($e,n)||s.push(n),e.value},useEffect:Je,useLayoutEffect:Qe,useMemo:Ye,useReducer:ze,useRef:e=>{const t=Ae.i++,{stack:i,length:s}=Ae;return t===s&&(Ae.length=i.push({current:e})),i[t]},useState:(e,t)=>ze(Ue,e,void 0,t)},{render:pt,html:dt,svg:lt}=(e=>{const t=_e(we);return xe(e).forEach((i=>{t[i]=e[i](t[i]||("convert"===i?D:String))})),i.prototype=t,Re(i);function i(){return ve.apply(this,arguments)}})({transform:()=>e=>nt(e,tt)}),{defineProperties:ut}=Object,mt=new _,ht=new _,ft=new _,gt=new C,vt="attributeChangedCallback",bt="connectedCallback",_t=`dis${bt}`,yt=(e,t,i)=>{if(i in e){const s=e[i];t[i]={configurable:true,value(){return It.call(this),s.apply(this,arguments)}}}else t[i]={configurable:true,value:It}},xt=e=>{const{prototype:t}=e,i=[],s={html:{configurable:true,get:Et},svg:{configurable:true,get:Ot}};if(s["_🔥"]={value:{events:i,info:null}},"handleEvent"in t||(s.handleEvent={configurable:true,value:Dt}),"render"in t&&t.render.length){const{oninit:e}=t;ut(t,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function i(){const s=Ae,n=[];Ae={hook:i,args:arguments,stack:t,i:0,length:t.length,after:n};try{return e.apply(null,arguments)}finally{Ae=s;for(let e=0,{length:t}=n;e<t;e++)n[e]()}}})(this.render.bind(this,ct));ut(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Ke.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in t&&(i.push("init"),yt(t,s,"render")),yt(t,s,vt),yt(t,s,bt),yt(t,s,_t),[[vt,"onattributechanged",jt],[bt,"onconnected",Mt],[_t,"ondisconnected",At],[bt,"render",Lt]].forEach((([e,n,a])=>{if(!(e in t)&&n in t)if("render"!==n&&i.push(n.slice(2)),e in s){const t=s[e].value;s[e]={configurable:true,value(){return t.apply(this,arguments),a.apply(this,arguments)}}}else s[e]={configurable:true,value:a}}));const n=e.booleanAttributes||[];n.forEach((e=>{e in t||(s[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in t||(s[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const n=new _,a="on"+e in t;a&&i.push(e),s[e]={configurable:true,get(){return n.get(this)},set(t){if(n.set(this,t),a){const i=wt(e);if(i.detail=t,gt.has(this))this.dispatchEvent(i);else{const e=ft.get(this);e?e.push(i):ft.set(this,[i])}}}}})),ut(t,s);const r=n.concat(a);return r.length?ut(e,{observedAttributes:{configurable:true,get:()=>r}}):e},wt=e=>new x(e),St=(...e)=>new Oe("html",e);St.for=dt.for;const Rt=(...e)=>new Oe("svg",e);Rt.for=lt.for;const Ct=(e,t,i)=>{const s=kt(e,t,new _);return i.set(e,s),s},kt=(e,t,i)=>(s,...n)=>{const a=i.get(s)||((e,t,{info:i})=>{const s=i?nt(t.join("_🔥"),i).split("_🔥"):t;return e.set(t,s),s})(i,s,e["_🔥"]);return pt(e,(()=>t(a,...n)))};function Tt(e){this.addEventListener(e,this)}function Pt(e){this.dispatchEvent(e)}function Et(){return mt.get(this)||Ct(this,St,mt)}function Ot(){return ht.get(this)||Ct(this,Rt,ht)}function Dt(e){this[`on${e.type}`](e)}function It(){if(!gt.has(this)){gt.add(this),this["_🔥"].events.forEach(Tt,this),this.dispatchEvent(wt("init"));const e=ft.get(this);e&&(ft.delete(this),e.forEach(Pt,this))}}function jt(e,t,i){const s=wt("attributechanged");s.attributeName=e,s.oldValue=t,s.newValue=i,this.dispatchEvent(s)}function Mt(){this.dispatchEvent(wt("connected"))}function Lt(){this.render()}function At(){this.dispatchEvent(wt("disconnected"))}const{create:Nt,defineProperty:Bt,defineProperties:Ft,getOwnPropertyNames:Ut,getOwnPropertySymbols:zt,getOwnPropertyDescriptor:qt,keys:$t}=Object,Vt={element:HTMLElement},Wt=new _;new _;const Ht=new _;new _;const Gt=e=>{const t=Nt(null),i=Nt(null),s={prototype:i,statics:t};return Ut(e).concat(zt(e)).forEach((s=>{const n=qt(e,s);switch(n.enumerable=!1,s){case"extends":s="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[s]=n;break;default:i[s]=n}})),s},Kt=(e,t,i)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:s,$3:n,$4:a}=RegExp;let r=n||a||t.tagName||t.extends||"element";const o="fragment"===r;if(o)r="element";else if(!/^[A-Za-z0-9:._-]+$/.test(r))throw"Invalid tag";let c="",p="";r.indexOf("-")<0?(c=s.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+i,c.indexOf("-")<0&&(p="-heresy")):(c=r+i,r="element");const d=c+p;if(customElements.get(d))throw`Duplicated ${d} definition`;const l=et("object"==typeof t?Ht.get(t)||((e,t)=>{const{statics:i,prototype:s}=Gt(e),n=et(Vt[t]||(Vt[t]=document.createElement(t).constructor),!1);return Ft(n.prototype,s),Ft(n,i),Ht.set(e,xt(n)),n})(t,r):Wt.get(t)||(e=>{const t=et(e,!1);return Wt.set(e,xt(t)),t})(t),!0),u="element"===r;if(Bt(l,"new",{value:u?()=>document.createElement(d):()=>document.createElement(r,{is:d})}),Bt(l.prototype,"is",{value:d}),""===i){const e=(e=>{const{length:t}=e;let i=0,s=0;for(;s<t;)i=(i<<5)-i+e.charCodeAt(s++),i&=i;return i.toString(36)})(c.toUpperCase());tt.map[s]=Jt(l,r,d,{id:e,i:0}),tt.re=it($t(tt.map))}if(o){const{render:e}=l.prototype;Bt(l.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const i=document.createRange();i.setStartBefore(e),i.setEndAfter(this.lastChild),t=i.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const m=[d,l];return u||m.push({extends:r}),customElements.define(...m),{Class:l,is:d,name:s,tagName:r}},Jt=(e,t,i,s)=>{const{prototype:n}=e,a=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,i),r=[at(a)],o=e.includes||e.contains;if(o){const e={};$t(o).forEach((t=>{const i=`-${s.id}-${s.i++}`,{Class:n,is:a,name:c,tagName:p}=Kt(t,o[t],i);r.push(at(e[c]=Jt(n,p,a,s)))}));const t=it($t(e)),{events:i}=n["_🔥"],a={events:i,info:{map:e,re:t}};if(Bt(n,"_🔥",{value:a}),"render"in n){const{render:e}=n,{info:t}=a;Bt(n,"render",{configurable:!0,value(){const i=rt();ot(t);const s=e.apply(this,arguments);return ot(i),s}})}}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 i=document.head||document.querySelector("head");i.insertBefore(t,i.lastChild)}})(e.style(...r)),a},Qt=["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 Yt,Xt;function Zt(e,t,i,s){return new(i||(i=Promise))((function(n,a){function r(e){try{c(s.next(e))}catch(e){a(e)}}function o(e){try{c(s.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,o)}c((s=s.apply(e,t||[])).next())}))}Yt="WherebyEmbed",Xt={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",...Qt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.origin)},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},toggleScreenshare(e){this._postCommand("toggle_screenshare",[e])},onmessage({origin:e,data:t}){if(e!==this.url.origin)return;const{type:i,payload:s}=t;this.dispatchEvent(new CustomEvent(i,{detail:s}))},render(){const{avatarurl:e,displayname:t,lang:i,metadata:s,minimal:n,room:a,groups:r,virtualbackgroundurl:o}=this;if(!a)return this.html`Whereby: Missing room attribute.`;const c=/https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(a),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;if(!c)return this.html`could not parse URL.`;const d=c[2]||".whereby.com";this.url=new URL(a,`https://${p}${d}`);const l=new URL(a);return l.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",l.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha20",iframeSource:p},t&&{displayName:t}),i&&{lang:i}),s&&{metadata:s}),r&&{groups:r}),o&&{virtualBackgroundUrl:o}),e&&{avatarUrl:e}),null!=n&&{embed:n}),Qt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
10
+ /*! (c) Andrea Giammarchi - ISC */let Ae=null;const Ne=H(new WeakMap),Be=(e,t,i)=>{e.apply(t,i)},Fe={async:!1,always:!1},Ue=(e,t)=>"function"==typeof t?t(e):t,ze=(e,t,i,s)=>{const n=Ae.i++,{hook:a,args:r,stack:o,length:c}=Ae;n===c&&(Ae.length=o.push({}));const p=o[n];if(p.args=r,n===c){const n="function"==typeof i,{async:r,always:o}=(n?s:i)||s||Fe;p.$=n?i(t):Ue(void 0,t),p._=r?Ne.get(a)||Ne.set(a,Le()):Be,p.f=t=>{const i=e(p.$,t);(o||p.$!==i)&&(p.$=i,p._(a,null,p.args))}}return[p.$,p.f]},qe=new WeakMap;function $e({hook:e}){return e===this.hook}const Ve=new WeakMap,We=H(Ve),He=()=>{},Ge=e=>(t,i)=>{const s=Ae.i++,{hook:n,after:a,stack:r,length:o}=Ae;if(s<o){const n=r[s],{update:o,values:c,stop:p}=n;if(!i||i.some(Xe,c)){n.values=i,e&&p(e);const{clean:s}=n;s&&(n.clean=null,s());const r=()=>{n.clean=t()};e?o(r):a.push(r)}}else{const s=e?Le():He,o={clean:null,update:s,values:i,stop:He};Ae.length=r.push(o),(We.get(n)||We.set(n,[])).push(o);const c=()=>{o.clean=t()};e?o.stop=s(c):a.push(c)}},Ke=e=>{(Ve.get(e)||[]).forEach((e=>{const{clean:t,stop:i}=e;i(),t&&(e.clean=null,t())}))};Ve.has.bind(Ve);const Je=Ge(!0),Qe=Ge(!1),Ye=(e,t)=>{const i=Ae.i++,{stack:s,length:n}=Ae;return i===n?Ae.length=s.push({$:e(),_:t}):t&&!t.some(Xe,s[i]._)||(s[i]={$:e(),_:t}),s[i].$};function Xe(e,t){return e!==this[t]}let Ze=null;try{Ze=new{o(){}}.o}catch(Yt){}let et=e=>class extends e{};if(Ze){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:i}="object"==typeof Reflect?Reflect:{construct(e,i,s){const n=[null];for(let e=0;e<i.length;e++)n.push(i[e]);const a=e.bind.apply(e,n);return t(new a,s.prototype)}};et=function(s,n){function a(){return i(n?e(s):s,arguments,a)}return t(a.prototype,s.prototype),t(a,s)}}const tt={map:{},re:null},it=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let st=null;const nt=(e,t)=>{const{map:i,re:s}=st||t;return e.replace(s,((e,t,s,n)=>{const{tagName:a,is:r,element:o}=i[s];return o?t?`</${r}>`:`<${r}${n}`:t?`</${a}>`:`<${a} is="${r}"${n}`}))},at=({tagName:e,is:t,element:i})=>i?t:`${e}[is="${t}"]`,rt=()=>st,ot=e=>{st=e},ct={useCallback:(e,t)=>Ye((()=>e),t),useContext:e=>{const{hook:t,args:i}=Ae,s=qe.get(e),n={hook:t,args:i};return s.some($e,n)||s.push(n),e.value},useEffect:Je,useLayoutEffect:Qe,useMemo:Ye,useReducer:ze,useRef:e=>{const t=Ae.i++,{stack:i,length:s}=Ae;return t===s&&(Ae.length=i.push({current:e})),i[t]},useState:(e,t)=>ze(Ue,e,void 0,t)},{render:pt,html:dt,svg:lt}=(e=>{const t=_e(we);return xe(e).forEach((i=>{t[i]=e[i](t[i]||("convert"===i?D:String))})),i.prototype=t,Re(i);function i(){return ve.apply(this,arguments)}})({transform:()=>e=>nt(e,tt)}),{defineProperties:ut}=Object,mt=new _,ht=new _,ft=new _,gt=new C,vt="attributeChangedCallback",bt="connectedCallback",_t=`dis${bt}`,yt=(e,t,i)=>{if(i in e){const s=e[i];t[i]={configurable:true,value(){return It.call(this),s.apply(this,arguments)}}}else t[i]={configurable:true,value:It}},xt=e=>{const{prototype:t}=e,i=[],s={html:{configurable:true,get:Et},svg:{configurable:true,get:Ot}};if(s["_🔥"]={value:{events:i,info:null}},"handleEvent"in t||(s.handleEvent={configurable:true,value:Dt}),"render"in t&&t.render.length){const{oninit:e}=t;ut(t,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function i(){const s=Ae,n=[];Ae={hook:i,args:arguments,stack:t,i:0,length:t.length,after:n};try{return e.apply(null,arguments)}finally{Ae=s;for(let e=0,{length:t}=n;e<t;e++)n[e]()}}})(this.render.bind(this,ct));ut(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Ke.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in t&&(i.push("init"),yt(t,s,"render")),yt(t,s,vt),yt(t,s,bt),yt(t,s,_t),[[vt,"onattributechanged",jt],[bt,"onconnected",Mt],[_t,"ondisconnected",At],[bt,"render",Lt]].forEach((([e,n,a])=>{if(!(e in t)&&n in t)if("render"!==n&&i.push(n.slice(2)),e in s){const t=s[e].value;s[e]={configurable:true,value(){return t.apply(this,arguments),a.apply(this,arguments)}}}else s[e]={configurable:true,value:a}}));const n=e.booleanAttributes||[];n.forEach((e=>{e in t||(s[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in t||(s[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const n=new _,a="on"+e in t;a&&i.push(e),s[e]={configurable:true,get(){return n.get(this)},set(t){if(n.set(this,t),a){const i=wt(e);if(i.detail=t,gt.has(this))this.dispatchEvent(i);else{const e=ft.get(this);e?e.push(i):ft.set(this,[i])}}}}})),ut(t,s);const r=n.concat(a);return r.length?ut(e,{observedAttributes:{configurable:true,get:()=>r}}):e},wt=e=>new x(e),St=(...e)=>new Oe("html",e);St.for=dt.for;const Rt=(...e)=>new Oe("svg",e);Rt.for=lt.for;const Ct=(e,t,i)=>{const s=kt(e,t,new _);return i.set(e,s),s},kt=(e,t,i)=>(s,...n)=>{const a=i.get(s)||((e,t,{info:i})=>{const s=i?nt(t.join("_🔥"),i).split("_🔥"):t;return e.set(t,s),s})(i,s,e["_🔥"]);return pt(e,(()=>t(a,...n)))};function Tt(e){this.addEventListener(e,this)}function Pt(e){this.dispatchEvent(e)}function Et(){return mt.get(this)||Ct(this,St,mt)}function Ot(){return ht.get(this)||Ct(this,Rt,ht)}function Dt(e){this[`on${e.type}`](e)}function It(){if(!gt.has(this)){gt.add(this),this["_🔥"].events.forEach(Tt,this),this.dispatchEvent(wt("init"));const e=ft.get(this);e&&(ft.delete(this),e.forEach(Pt,this))}}function jt(e,t,i){const s=wt("attributechanged");s.attributeName=e,s.oldValue=t,s.newValue=i,this.dispatchEvent(s)}function Mt(){this.dispatchEvent(wt("connected"))}function Lt(){this.render()}function At(){this.dispatchEvent(wt("disconnected"))}const{create:Nt,defineProperty:Bt,defineProperties:Ft,getOwnPropertyNames:Ut,getOwnPropertySymbols:zt,getOwnPropertyDescriptor:qt,keys:$t}=Object,Vt={element:HTMLElement},Wt=new _;new _;const Ht=new _;new _;const Gt=e=>{const t=Nt(null),i=Nt(null),s={prototype:i,statics:t};return Ut(e).concat(zt(e)).forEach((s=>{const n=qt(e,s);switch(n.enumerable=!1,s){case"extends":s="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[s]=n;break;default:i[s]=n}})),s},Kt=(e,t,i)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:s,$3:n,$4:a}=RegExp;let r=n||a||t.tagName||t.extends||"element";const o="fragment"===r;if(o)r="element";else if(!/^[A-Za-z0-9:._-]+$/.test(r))throw"Invalid tag";let c="",p="";r.indexOf("-")<0?(c=s.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+i,c.indexOf("-")<0&&(p="-heresy")):(c=r+i,r="element");const d=c+p;if(customElements.get(d))throw`Duplicated ${d} definition`;const l=et("object"==typeof t?Ht.get(t)||((e,t)=>{const{statics:i,prototype:s}=Gt(e),n=et(Vt[t]||(Vt[t]=document.createElement(t).constructor),!1);return Ft(n.prototype,s),Ft(n,i),Ht.set(e,xt(n)),n})(t,r):Wt.get(t)||(e=>{const t=et(e,!1);return Wt.set(e,xt(t)),t})(t),!0),u="element"===r;if(Bt(l,"new",{value:u?()=>document.createElement(d):()=>document.createElement(r,{is:d})}),Bt(l.prototype,"is",{value:d}),""===i){const e=(e=>{const{length:t}=e;let i=0,s=0;for(;s<t;)i=(i<<5)-i+e.charCodeAt(s++),i&=i;return i.toString(36)})(c.toUpperCase());tt.map[s]=Jt(l,r,d,{id:e,i:0}),tt.re=it($t(tt.map))}if(o){const{render:e}=l.prototype;Bt(l.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const i=document.createRange();i.setStartBefore(e),i.setEndAfter(this.lastChild),t=i.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const m=[d,l];return u||m.push({extends:r}),customElements.define(...m),{Class:l,is:d,name:s,tagName:r}},Jt=(e,t,i,s)=>{const{prototype:n}=e,a=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,i),r=[at(a)],o=e.includes||e.contains;if(o){const e={};$t(o).forEach((t=>{const i=`-${s.id}-${s.i++}`,{Class:n,is:a,name:c,tagName:p}=Kt(t,o[t],i);r.push(at(e[c]=Jt(n,p,a,s)))}));const t=it($t(e)),{events:i}=n["_🔥"],a={events:i,info:{map:e,re:t}};if(Bt(n,"_🔥",{value:a}),"render"in n){const{render:e}=n,{info:t}=a;Bt(n,"render",{configurable:!0,value(){const i=rt();ot(t);const s=e.apply(this,arguments);return ot(i),s}})}}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 i=document.head||document.querySelector("head");i.insertBefore(t,i.lastChild)}})(e.style(...r)),a},Qt=["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 Yt,Xt;function Zt(e,t,i,s){return new(i||(i=Promise))((function(n,a){function r(e){try{c(s.next(e))}catch(e){a(e)}}function o(e){try{c(s.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,o)}c((s=s.apply(e,t||[])).next())}))}Yt="WherebyEmbed",Xt={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",...Qt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.origin)},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},toggleScreenshare(e){this._postCommand("toggle_screenshare",[e])},onmessage({origin:e,data:t}){if(e!==this.url.origin)return;const{type:i,payload:s}=t;this.dispatchEvent(new CustomEvent(i,{detail:s}))},render(){const{avatarurl:e,displayname:t,lang:i,metadata:s,minimal:n,room:a,groups:r,virtualbackgroundurl:o}=this;if(!a)return this.html`Whereby: Missing room attribute.`;const c=/https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(a),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;if(!c)return this.html`could not parse URL.`;const d=c[2]||".whereby.com";this.url=new URL(a,`https://${p}${d}`);const l=new URL(a);return l.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",l.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha22",iframeSource:p},t&&{displayName:t}),i&&{lang:i}),s&&{metadata:s}),r&&{groups:r}),o&&{virtualBackgroundUrl:o}),e&&{avatarUrl:e}),null!=n&&{embed:n}),Qt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
11
11
  <iframe
12
12
  ref=${this.iframe}
13
13
  src=${this.url}
@@ -40,4 +40,4 @@ let Kc;Uc.AwaitQueue=class{constructor(){this.pendingTasks=new Map,this.nextTask
40
40
  * Copyright(c) 2015 Douglas Christopher Wilson
41
41
  * MIT Licensed
42
42
  */
43
- function(e){var t=Nf,i=g.extname,s=/^\s*([^;\s]*)(?:;|\s|$)/,n=/^text\//i;function a(e){if(!e||"string"!=typeof e)return!1;var i=s.exec(e),a=i&&t[i[1].toLowerCase()];return a&&a.charset?a.charset:!(!i||!n.test(i[1]))&&"UTF-8"}e.charset=a,e.charsets={lookup:a},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var s=e.charset(i);s&&(i+="; charset="+s.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=s.exec(t),n=i&&e.extensions[i[1].toLowerCase()];if(!n||!n.length)return!1;return n[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var s=i("x."+t).toLowerCase().substr(1);if(!s)return!1;return e.types[s]||!1},e.types=Object.create(null),function(e,i){var s=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(n){var a=t[n],r=a.extensions;if(r&&r.length){e[n]=r;for(var o=0;o<r.length;o++){var c=r[o];if(i[c]){var p=s.indexOf(t[i[c]].source),d=s.indexOf(a.source);if("application/octet-stream"!==i[c]&&(p>d||p===d&&"application/"===i[c].substr(0,12)))continue}i[c]=n}}}))}(e.extensions,e.types)}(Af);var Ff=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)};var Uf=Ff,zf=function(e){var t=!1;return Uf((function(){t=!0})),function(i,s){t?e(i,s):Uf((function(){e(i,s)}))}};var qf=function(e){Object.keys(e.jobs).forEach($f.bind(e)),e.jobs={}};function $f(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Vf=zf,Wf=qf,Hf=function(e,t,i,s){var n=i.keyedList?i.keyedList[i.index]:i.index;i.jobs[n]=function(e,t,i,s){var n;n=2==e.length?e(i,Vf(s)):e(i,t,Vf(s));return n}(t,n,e[n],(function(e,t){n in i.jobs&&(delete i.jobs[n],e?Wf(i):i.results[n]=t,s(e,i.results))}))};var Gf=function(e,t){var i=!Array.isArray(e),s={index:0,keyedList:i||t?Object.keys(e):null,jobs:{},results:i?{}:[],size:i?Object.keys(e).length:e.length};t&&s.keyedList.sort(i?t:function(i,s){return t(e[i],e[s])});return s};var Kf=qf,Jf=zf,Qf=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,Kf(this),Jf(e)(null,this.results)};var Yf=Hf,Xf=Gf,Zf=Qf,eg=function(e,t,i){var s=Xf(e);for(;s.index<(s.keyedList||e).length;)Yf(e,t,s,(function(e,t){e?i(e,t):0!==Object.keys(s.jobs).length||i(null,s.results)})),s.index++;return Zf.bind(s,i)};var tg={},ig=Hf,sg=Gf,ng=Qf;function ag(e,t){return e<t?-1:e>t?1:0}({get exports(){return tg},set exports(e){tg=e}}).exports=function(e,t,i,s){var n=sg(e,i);return ig(e,t,n,(function i(a,r){a?s(a,r):(n.index++,n.index<(n.keyedList||e).length?ig(e,t,n,i):s(null,n.results))})),ng.bind(n,s)},tg.ascending=ag,tg.descending=function(e,t){return-1*ag(e,t)};var rg=tg;var og={parallel:eg,serial:function(e,t,i){return rg(e,t,null,i)},serialOrdered:tg},cg=Mf,pg=h,dg=g,lg=n,ug=a,mg=i.parse,hg=t,fg=r.Stream,gg=Af,vg=og,bg=function(e,t){return Object.keys(t).forEach((function(i){e[i]=e[i]||t[i]})),e},_g=yg;function yg(e){if(!(this instanceof yg))return new yg(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],cg.call(this),e=e||{})this[t]=e[t]}function xg(e){return Rf.isPlainObject(e)||Rf.isArray(e)}function wg(e){return Rf.endsWith(e,"[]")?e.slice(0,-2):e}function Sg(e,t,i){return e?e.concat(t).map((function(e,t){return e=wg(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}pg.inherits(yg,cg),yg.LINE_BREAK="\r\n",yg.DEFAULT_CONTENT_TYPE="application/octet-stream",yg.prototype.append=function(e,t,i){"string"==typeof(i=i||{})&&(i={filename:i});var s=cg.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),pg.isArray(t))this._error(new Error("Arrays are not supported."));else{var n=this._multiPartHeader(e,t,i),a=this._multiPartFooter();s(n),s(t),s(a),this._trackLength(n,t,i)}},yg.prototype._trackLength=function(e,t,i){var s=0;null!=i.knownLength?s+=+i.knownLength:Buffer.isBuffer(t)?s=t.length:"string"==typeof t&&(s=Buffer.byteLength(t)),this._valueLength+=s,this._overheadLength+=Buffer.byteLength(e)+yg.LINE_BREAK.length,t&&(t.path||t.readable&&t.hasOwnProperty("httpVersion")||t instanceof fg)&&(i.knownLength||this._valuesToMeasure.push(t))},yg.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)):hg.stat(e.path,(function(i,s){var n;i?t(i):(n=s.size-(e.start?e.start:0),t(null,n))})):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",(function(i){e.pause(),t(null,+i.headers["content-length"])})),e.resume()):t("Unknown stream")},yg.prototype._multiPartHeader=function(e,t,i){if("string"==typeof i.header)return i.header;var s,n=this._getContentDisposition(t,i),a=this._getContentType(t,i),r="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(n||[]),"Content-Type":[].concat(a||[])};for(var c in"object"==typeof i.header&&bg(o,i.header),o)o.hasOwnProperty(c)&&null!=(s=o[c])&&(Array.isArray(s)||(s=[s]),s.length&&(r+=c+": "+s.join("; ")+yg.LINE_BREAK));return"--"+this.getBoundary()+yg.LINE_BREAK+r+yg.LINE_BREAK},yg.prototype._getContentDisposition=function(e,t){var i,s;return"string"==typeof t.filepath?i=dg.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?i=dg.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(i=dg.basename(e.client._httpMessage.path||"")),i&&(s='filename="'+i+'"'),s},yg.prototype._getContentType=function(e,t){var i=t.contentType;return!i&&e.name&&(i=gg.lookup(e.name)),!i&&e.path&&(i=gg.lookup(e.path)),!i&&e.readable&&e.hasOwnProperty("httpVersion")&&(i=e.headers["content-type"]),i||!t.filepath&&!t.filename||(i=gg.lookup(t.filepath||t.filename)),i||"object"!=typeof e||(i=yg.DEFAULT_CONTENT_TYPE),i},yg.prototype._multiPartFooter=function(){return function(e){var t=yg.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},yg.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+yg.LINE_BREAK},yg.prototype.getHeaders=function(e){var t,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(i[t.toLowerCase()]=e[t]);return i},yg.prototype.setBoundary=function(e){this._boundary=e},yg.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},yg.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),i=0,s=this._streams.length;i<s;i++)"function"!=typeof this._streams[i]&&(e=Buffer.isBuffer(this._streams[i])?Buffer.concat([e,this._streams[i]]):Buffer.concat([e,Buffer.from(this._streams[i])]),"string"==typeof this._streams[i]&&this._streams[i].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(yg.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},yg.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},yg.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},yg.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},yg.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?vg.parallel(this._valuesToMeasure,this._lengthRetriever,(function(i,s){i?e(i):(s.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},yg.prototype.submit=function(e,t){var i,s,n={method:"post"};return"string"==typeof e?(e=mg(e),s=bg({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},n)):(s=bg(e,n)).port||(s.port="https:"==s.protocol?443:80),s.headers=this.getHeaders(e.headers),i="https:"==s.protocol?ug.request(s):lg.request(s),this.getLength(function(e,s){if(e&&"Unknown stream"!==e)this._error(e);else if(s&&i.setHeader("Content-Length",s),this.pipe(i),t){var n,a=function(e,s){return i.removeListener("error",a),i.removeListener("response",n),t.call(this,e,s)};n=a.bind(this,null),i.on("error",a),i.on("response",n)}}.bind(this)),i},yg.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},yg.prototype.toString=function(){return"[object FormData]"};const Rg=Rf.toFlatObject(Rf,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Cg(e,t,i){if(!Rf.isObject(e))throw new TypeError("target must be an object");t=t||new(_g||FormData);const s=(i=Rf.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Rf.isUndefined(t[e])}))).metaTokens,n=i.visitor||d,a=i.dots,r=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&((c=t)&&Rf.isFunction(c.append)&&"FormData"===c[Symbol.toStringTag]&&c[Symbol.iterator]);var c;if(!Rf.isFunction(n))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(Rf.isDate(e))return e.toISOString();if(!o&&Rf.isBlob(e))throw new Cf("Blob is not supported. Use a Buffer instead.");return Rf.isArrayBuffer(e)||Rf.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,i,n){let o=e;if(e&&!n&&"object"==typeof e)if(Rf.endsWith(i,"{}"))i=s?i:i.slice(0,-2),e=JSON.stringify(e);else if(Rf.isArray(e)&&function(e){return Rf.isArray(e)&&!e.some(xg)}(e)||Rf.isFileList(e)||Rf.endsWith(i,"[]")&&(o=Rf.toArray(e)))return i=wg(i),o.forEach((function(e,s){!Rf.isUndefined(e)&&null!==e&&t.append(!0===r?Sg([i],s,a):null===r?i:i+"[]",p(e))})),!1;return!!xg(e)||(t.append(Sg(n,i,a),p(e)),!1)}const l=[],u=Object.assign(Rg,{defaultVisitor:d,convertValue:p,isVisitable:xg});if(!Rf.isObject(e))throw new TypeError("data must be an object");return function e(i,s){if(!Rf.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+s.join("."));l.push(i),Rf.forEach(i,(function(i,a){!0===(!(Rf.isUndefined(i)||null===i)&&n.call(t,i,Rf.isString(a)?a.trim():a,s,u))&&e(i,s?s.concat(a):[a])})),l.pop()}}(e),t}function kg(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Tg(e,t){this._pairs=[],e&&Cg(e,this,t)}const Pg=Tg.prototype;function Eg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Og(e,t,i){if(!t)return e;const s=i&&i.encode||Eg,n=i&&i.serialize;let a;if(a=n?n(t,i):Rf.isURLSearchParams(t)?t.toString():new Tg(t,i).toString(s),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Pg.append=function(e,t){this._pairs.push([e,t])},Pg.toString=function(e){const t=e?function(t){return e.call(this,t,kg)}:kg;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Dg{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Rf.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Ig={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jg={isNode:!0,classes:{URLSearchParams:i.URLSearchParams,FormData:_g,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function Mg(e){function t(e,i,s,n){let a=e[n++];const r=Number.isFinite(+a),o=n>=e.length;if(a=!a&&Rf.isArray(s)?s.length:a,o)return Rf.hasOwnProp(s,a)?s[a]=[s[a],i]:s[a]=i,!r;s[a]&&Rf.isObject(s[a])||(s[a]=[]);return t(e,i,s[a],n)&&Rf.isArray(s[a])&&(s[a]=function(e){const t={},i=Object.keys(e);let s;const n=i.length;let a;for(s=0;s<n;s++)a=i[s],t[a]=e[a];return t}(s[a])),!r}if(Rf.isFormData(e)&&Rf.isFunction(e.entries)){const i={};return Rf.forEachEntry(e,((e,s)=>{t(function(e){return Rf.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),s,i,0)})),i}return null}const Lg={"Content-Type":void 0};const Ag={transitional:Ig,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",s=i.indexOf("application/json")>-1,n=Rf.isObject(e);n&&Rf.isHTMLForm(e)&&(e=new FormData(e));if(Rf.isFormData(e))return s&&s?JSON.stringify(Mg(e)):e;if(Rf.isArrayBuffer(e)||Rf.isBuffer(e)||Rf.isStream(e)||Rf.isFile(e)||Rf.isBlob(e))return e;if(Rf.isArrayBufferView(e))return e.buffer;if(Rf.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cg(e,new jg.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,s){return Rf.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Rf.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Cg(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||s?(t.setContentType("application/json",!1),function(e,t,i){if(Rf.isString(e))try{return(t||JSON.parse)(e),Rf.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ag.transitional,i=t&&t.forcedJSONParsing,s="json"===this.responseType;if(e&&Rf.isString(e)&&(i&&!this.responseType||s)){const i=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Cf.from(e,Cf.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:jg.classes.FormData,Blob:jg.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Rf.forEach(["delete","get","head"],(function(e){Ag.headers[e]={}})),Rf.forEach(["post","put","patch"],(function(e){Ag.headers[e]=Rf.merge(Lg)}));const Ng=Rf.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 Bg=Symbol("internals");function Fg(e){return e&&String(e).trim().toLowerCase()}function Ug(e){return!1===e||null==e?e:Rf.isArray(e)?e.map(Ug):String(e)}function zg(e,t,i,s){return Rf.isFunction(s)?s.call(this,t,i):Rf.isString(t)?Rf.isString(s)?-1!==t.indexOf(s):Rf.isRegExp(s)?s.test(t):void 0:void 0}class qg{constructor(e){e&&this.set(e)}set(e,t,i){const s=this;function n(e,t,i){const n=Fg(t);if(!n)throw new Error("header name must be a non-empty string");const a=Rf.findKey(s,n);(!a||void 0===s[a]||!0===i||void 0===i&&!1!==s[a])&&(s[a||t]=Ug(e))}const a=(e,t)=>Rf.forEach(e,((e,i)=>n(e,i,t)));return Rf.isPlainObject(e)||e instanceof this.constructor?a(e,t):Rf.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?a((e=>{const t={};let i,s,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),i=e.substring(0,n).trim().toLowerCase(),s=e.substring(n+1).trim(),!i||t[i]&&Ng[i]||("set-cookie"===i?t[i]?t[i].push(s):t[i]=[s]:t[i]=t[i]?t[i]+", "+s:s)})),t})(e),t):null!=e&&n(t,e,i),this}get(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(e);)t[s[1]]=s[2];return t}(e);if(Rf.isFunction(t))return t.call(this,e,i);if(Rf.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);return!(!i||t&&!zg(0,this[i],i,t))}return!1}delete(e,t){const i=this;let s=!1;function n(e){if(e=Fg(e)){const n=Rf.findKey(i,e);!n||t&&!zg(0,i[n],n,t)||(delete i[n],s=!0)}}return Rf.isArray(e)?e.forEach(n):n(e),s}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,i={};return Rf.forEach(this,((s,n)=>{const a=Rf.findKey(i,n);if(a)return t[a]=Ug(s),void delete t[n];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(n):String(n).trim();r!==n&&delete t[n],t[r]=Ug(s),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Rf.forEach(this,((i,s)=>{null!=i&&!1!==i&&(t[s]=e&&Rf.isArray(i)?i.join(", "):i)})),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 i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[Bg]=this[Bg]={accessors:{}}).accessors,i=this.prototype;function s(e){const s=Fg(e);t[s]||(!function(e,t){const i=Rf.toCamelCase(" "+t);["get","set","has"].forEach((s=>{Object.defineProperty(e,s+i,{value:function(e,i,n){return this[s].call(this,t,e,i,n)},configurable:!0})}))}(i,e),t[s]=!0)}return Rf.isArray(e)?e.forEach(s):s(e),this}}function $g(e,t){const i=this||Ag,s=t||i,n=qg.from(s.headers);let a=s.data;return Rf.forEach(e,(function(e){a=e.call(i,a,n.normalize(),t?t.status:void 0)})),n.normalize(),a}function Vg(e){return!(!e||!e.__CANCEL__)}function Wg(e,t,i){Cf.call(this,null==e?"canceled":e,Cf.ERR_CANCELED,t,i),this.name="CanceledError"}function Hg(e,t,i){const s=i.config.validateStatus;i.status&&s&&!s(i.status)?t(new Cf("Request failed with status code "+i.status,[Cf.ERR_BAD_REQUEST,Cf.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}function Gg(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}qg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),Rf.freezeMethods(qg.prototype),Rf.freezeMethods(qg),Rf.inherits(Wg,Cf,{__CANCEL__:!0});var Kg=i.parse,Jg={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},Qg=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function Yg(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var Xg,Zg=function(e){var t="string"==typeof e?Kg(e):e||{},i=t.protocol,s=t.host,n=t.port;if("string"!=typeof s||!s||"string"!=typeof i)return"";if(i=i.split(":",1)[0],!function(e,t){var i=(Yg("npm_config_no_proxy")||Yg("no_proxy")).toLowerCase();if(!i)return!0;if("*"===i)return!1;return i.split(/[,\s]/).every((function(i){if(!i)return!0;var s=i.match(/^(.+):(\d+)$/),n=s?s[1]:i,a=s?parseInt(s[2]):0;return!(!a||a===t)||(/^[.*]/.test(n)?("*"===n.charAt(0)&&(n=n.slice(1)),!Qg.call(e,n)):e!==n)}))}(s=s.replace(/:\d*$/,""),n=parseInt(n)||Jg[i]||0))return"";var a=Yg("npm_config_"+i+"_proxy")||Yg(i+"_proxy")||Yg("npm_config_proxy")||Yg("all_proxy");return a&&-1===a.indexOf("://")&&(a=i+"://"+a),a},ev={},tv={get exports(){return ev},set exports(e){ev=e}},iv=i,sv=iv.URL,nv=n,av=a,rv=r.Writable,ov=e,cv=function(){if(!Xg){try{Xg=jo("follow-redirects")}catch(e){}"function"!=typeof Xg&&(Xg=function(){})}Xg.apply(null,arguments)},pv=["abort","aborted","connect","error","socket","timeout"],dv=Object.create(null);pv.forEach((function(e){dv[e]=function(t,i,s){this._redirectable.emit(e,t,i,s)}}));var lv=xv("ERR_INVALID_URL","Invalid URL",TypeError),uv=xv("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),mv=xv("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),hv=xv("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),fv=xv("ERR_STREAM_WRITE_AFTER_END","write after end");function gv(e,t){rv.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 i=this;this._onNativeResponse=function(e){i._processResponse(e)},this._performRequest()}function vv(e){var t={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(e).forEach((function(s){var n=s+":",a=i[n]=e[s],r=t[s]=Object.create(a);Object.defineProperties(r,{request:{value:function(e,s,a){if(Sv(e)){var r;try{r=_v(new sv(e))}catch(t){r=iv.parse(e)}if(!Sv(r.protocol))throw new lv({input:e});e=r}else sv&&e instanceof sv?e=_v(e):(a=s,s=e,e={protocol:n});return Rv(s)&&(a=s,s=null),(s=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,s)).nativeProtocols=i,Sv(s.host)||Sv(s.hostname)||(s.hostname="::1"),ov.equal(s.protocol,n,"protocol mismatch"),cv("options",s),new gv(s,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,i){var s=r.request(e,t,i);return s.end(),s},configurable:!0,enumerable:!0,writable:!0}})})),t}function bv(){}function _v(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 yv(e,t){var i;for(var s in t)e.test(s)&&(i=t[s],delete t[s]);return null==i?void 0:String(i).trim()}function xv(e,t,i){function s(i){Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return s.prototype=new(i||Error),s.prototype.constructor=s,s.prototype.name="Error ["+e+"]",s}function wv(e){for(var t of pv)e.removeListener(t,dv[t]);e.on("error",bv),e.abort()}function Sv(e){return"string"==typeof e||e instanceof String}function Rv(e){return"function"==typeof e}gv.prototype=Object.create(rv.prototype),gv.prototype.abort=function(){wv(this._currentRequest),this.emit("abort")},gv.prototype.write=function(e,t,i){if(this._ending)throw new fv;if(!Sv(e)&&("object"!=typeof(s=e)||!("length"in s)))throw new TypeError("data should be a string, Buffer or Uint8Array");var s;Rv(t)&&(i=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,i)):(this.emit("error",new hv),this.abort()):i&&i()},gv.prototype.end=function(e,t,i){if(Rv(e)?(i=e,e=t=null):Rv(t)&&(i=t,t=null),e){var s=this,n=this._currentRequest;this.write(e,t,(function(){s._ended=!0,n.end(null,null,i)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,i)},gv.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},gv.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},gv.prototype.setTimeout=function(e,t){var i=this;function s(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function n(t){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout((function(){i.emit("timeout"),a()}),e),s(t)}function a(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",a),i.removeListener("error",a),i.removeListener("response",a),t&&i.removeListener("timeout",t),i.socket||i._currentRequest.removeListener("socket",n)}return t&&this.on("timeout",t),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",s),this.on("abort",a),this.on("error",a),this.on("response",a),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){gv.prototype[e]=function(t,i){return this._currentRequest[e](t,i)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(gv.prototype,e,{get:function(){return this._currentRequest[e]}})})),gv.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))}},gv.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var i=e.slice(0,-1);this._options.agent=this._options.agents[i]}var s=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var n of(s._redirectable=this,pv))s.on(n,dv[n]);if(this._currentUrl=/^\//.test(this._options.path)?iv.format(this._options):this._options.path,this._isRedirect){var a=0,r=this,o=this._requestBodyBuffers;!function e(t){if(s===r._currentRequest)if(t)r.emit("error",t);else if(a<o.length){var i=o[a++];s.finished||s.write(i.data,i.encoding,e)}else r._ended&&s.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},gv.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var i=e.headers.location;if(!i||!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(wv(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new mv);else{var s,n=this._options.beforeRedirect;n&&(s=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var a=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=[],yv(/^content-/i,this._options.headers));var r,o=yv(/^host$/i,this._options.headers),c=iv.parse(this._currentUrl),p=o||c.host,d=/^\w+:/.test(i)?this._currentUrl:iv.format(Object.assign(c,{host:p}));try{r=iv.resolve(d,i)}catch(e){return void this.emit("error",new uv({cause:e}))}cv("redirecting to",r),this._isRedirect=!0;var l=iv.parse(r);if(Object.assign(this._options,l),(l.protocol!==c.protocol&&"https:"!==l.protocol||l.host!==p&&!function(e,t){ov(Sv(e)&&Sv(t));var i=e.length-t.length-1;return i>0&&"."===e[i]&&e.endsWith(t)}(l.host,p))&&yv(/^(?:authorization|cookie)$/i,this._options.headers),Rv(n)){var u={headers:e.headers,statusCode:t},m={url:d,method:a,headers:s};try{n(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 uv({cause:e}))}}},tv.exports=vv({http:nv,https:av}),ev.wrap=vv;function Cv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const kv=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Tv(e,t){e=e||10;const i=new Array(e),s=new Array(e);let n,a=0,r=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),p=s[r];n||(n=c),i[a]=o,s[a]=c;let d=r,l=0;for(;d!==a;)l+=i[d++],d%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-n<t)return;const u=p&&c-p;return u?Math.round(1e3*l/u):void 0}}const Pv=Symbol("internals");class Ev extends r.Transform{constructor(e){super({readableHighWaterMark:(e=Rf.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!Rf.isUndefined(t[e])))).chunkSize});const t=this,i=this[Pv]={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},s=Tv(i.ticksRate*e.samplesCount,i.timeWindow);this.on("newListener",(e=>{"progress"===e&&(i.isCaptured||(i.isCaptured=!0))}));let n=0;i.updateProgress=function(e,t){let i=0;const s=1e3/t;let n=null;return function(t,a){const r=Date.now();if(t||r-i>s)return n&&(clearTimeout(n),n=null),i=r,e.apply(null,a);n||(n=setTimeout((()=>(n=null,i=Date.now(),e.apply(null,a))),s-(r-i)))}}((function(){const e=i.length,a=i.bytesSeen,r=a-n;if(!r||t.destroyed)return;const o=s(r);n=a,process.nextTick((()=>{t.emit("progress",{loaded:a,total:e,progress:e?a/e:void 0,bytes:r,rate:o||void 0,estimated:o&&e&&a<=e?(e-a)/o:void 0})}))}),i.ticksRate);const a=()=>{i.updateProgress(!0)};this.once("end",a),this.once("error",a)}_read(e){const t=this[Pv];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,i){const s=this,n=this[Pv],a=n.maxRate,r=this.readableHighWaterMark,o=n.timeWindow,c=a/(1e3/o),p=!1!==n.minChunkSize?Math.max(n.minChunkSize,.01*c):0;const d=(e,t)=>{const i=Buffer.byteLength(e);let d,l=null,u=r,m=0;if(a){const e=Date.now();(!n.ts||(m=e-n.ts)>=o)&&(n.ts=e,d=c-n.bytes,n.bytes=d<0?-d:0,m=0),d=c-n.bytes}if(a){if(d<=0)return setTimeout((()=>{t(null,e)}),o-m);d<u&&(u=d)}u&&i>u&&i-u>p&&(l=e.subarray(u),e=e.subarray(0,u)),function(e,t){const i=Buffer.byteLength(e);n.bytesSeen+=i,n.bytes+=i,n.isCaptured&&n.updateProgress(),s.push(e)?process.nextTick(t):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(t)}}(e,l?()=>{process.nextTick(t,null,l)}:t)};d(e,(function e(t,s){if(t)return i(t);s?d(s,e):i(null)}))}setLength(e){return this[Pv].length=+e,this}}const Ov={flush:o.constants.Z_SYNC_FLUSH,finishFlush:o.constants.Z_SYNC_FLUSH},Dv={flush:o.constants.BROTLI_OPERATION_FLUSH,finishFlush:o.constants.BROTLI_OPERATION_FLUSH},Iv=Rf.isFunction(o.createBrotliDecompress),{http:jv,https:Mv}=ev,Lv=/https:?/,Av=jg.protocols.map((e=>e+":"));function Nv(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function Bv(e,t,i){let s=t;if(!s&&!1!==s){const e=Zg(i);e&&(s=new URL(e))}if(s){if(s.username&&(s.auth=(s.username||"")+":"+(s.password||"")),s.auth){(s.auth.username||s.auth.password)&&(s.auth=(s.auth.username||"")+":"+(s.auth.password||""));const t=Buffer.from(s.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=s.hostname||s.host;e.hostname=t,e.host=t,e.port=s.port,e.path=i,s.protocol&&(e.protocol=s.protocol.includes(":")?s.protocol:`${s.protocol}:`)}e.beforeRedirects.proxy=function(e){Bv(e,t,e.href)}}var Fv="undefined"!=typeof process&&"process"===Rf.kindOf(process)&&function(e){return new Promise((function(t,i){let s=e.data;const c=e.responseType,p=e.responseEncoding,d=e.method.toUpperCase();let u,m,h,f=!1;const g=new l;function v(){u||(u=!0,e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),g.removeAllListeners())}function b(e,s){m||(m=!0,s&&(f=!0,v()),s?i(e):t(e))}const _=function(e){b(e)},y=function(e){b(e,!0)};function x(t){g.emit("abort",!t||t.type?new Wg(null,e,h):t)}g.once("abort",y),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x)));const w=Gg(e.baseURL,e.url),S=new URL(w),R=S.protocol||Av[0];if("data:"===R){let t;if("GET"!==d)return Hg(_,y,{status:405,statusText:"method not allowed",headers:{},config:e});try{t=function(e,t,i){const s=i&&i.Blob||jg.classes.Blob,n=Cv(e);if(void 0===t&&s&&(t=!0),"data"===n){e=n.length?e.slice(n.length+1):e;const i=kv.exec(e);if(!i)throw new Cf("Invalid URL",Cf.ERR_INVALID_URL);const a=i[1],r=i[2],o=i[3],c=Buffer.from(decodeURIComponent(o),r?"base64":"utf8");if(t){if(!s)throw new Cf("Blob is not supported",Cf.ERR_NOT_SUPPORT);return new s([c],{type:a})}return c}throw new Cf("Unsupported protocol "+n,Cf.ERR_NOT_SUPPORT)}(e.url,"blob"===c,{Blob:e.env&&e.env.Blob})}catch(t){throw Cf.from(t,Cf.ERR_BAD_REQUEST,e)}return"text"===c?(t=t.toString(p),p&&"utf8"!==p||(s=Rf.stripBOM(t))):"stream"===c&&(t=r.Readable.from(t)),Hg(_,y,{data:t,status:200,statusText:"OK",headers:new qg,config:e})}if(-1===Av.indexOf(R))return y(new Cf("Unsupported protocol "+R,Cf.ERR_BAD_REQUEST,e));const C=qg.from(e.headers).normalize();C.set("User-Agent","axios/1.2.3",!1);const k=e.onDownloadProgress,T=e.onUploadProgress,P=e.maxRate;let E,O;if(Rf.isFormData(s)&&Rf.isFunction(s.getHeaders))C.set(s.getHeaders());else if(s&&!Rf.isStream(s)){if(Buffer.isBuffer(s));else if(Rf.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else{if(!Rf.isString(s))return y(new Cf("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Cf.ERR_BAD_REQUEST,e));s=Buffer.from(s,"utf-8")}if(C.set("Content-Length",s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return y(new Cf("Request body larger than maxBodyLength limit",Cf.ERR_BAD_REQUEST,e))}const D=Rf.toFiniteNumber(C.getContentLength());let I,j;if(Rf.isArray(P)?(E=P[0],O=P[1]):E=O=P,s&&(T||E)&&(Rf.isStream(s)||(s=r.Readable.from(s,{objectMode:!1})),s=r.pipeline([s,new Ev({length:D,maxRate:Rf.toFiniteNumber(E)})],Rf.noop),T&&s.on("progress",(e=>{T(Object.assign(e,{upload:!0}))}))),e.auth){I=(e.auth.username||"")+":"+(e.auth.password||"")}if(!I&&S.username){I=S.username+":"+S.password}I&&C.delete("authorization");try{j=Og(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const i=new Error(t.message);return i.config=e,i.url=e.url,i.exists=!0,y(i)}C.set("Accept-Encoding","gzip, compress, deflate"+(Iv?", br":""),!1);const M={path:j,method:d,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:I,protocol:R,beforeRedirect:Nv,beforeRedirects:{}};let L;e.socketPath?M.socketPath=e.socketPath:(M.hostname=S.hostname,M.port=S.port,Bv(M,e.proxy,R+"//"+S.hostname+(S.port?":"+S.port:"")+M.path));const A=Lv.test(M.protocol);if(M.agent=A?e.httpsAgent:e.httpAgent,e.transport?L=e.transport:0===e.maxRedirects?L=A?a:n:(e.maxRedirects&&(M.maxRedirects=e.maxRedirects),e.beforeRedirect&&(M.beforeRedirects.config=e.beforeRedirect),L=A?Mv:jv),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 i=[t],s=+t.headers["content-length"];if(k){const e=new Ev({length:Rf.toFiniteNumber(s),maxRate:Rf.toFiniteNumber(O)});k&&e.on("progress",(e=>{k(Object.assign(e,{download:!0}))})),i.push(e)}let n=t;const a=t.req||h;if(!1!==e.decompress&&t.headers["content-encoding"])switch("HEAD"!==d&&204!==t.statusCode||delete t.headers["content-encoding"],t.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":case"deflate":i.push(o.createUnzip(Ov)),delete t.headers["content-encoding"];break;case"br":Iv&&(i.push(o.createBrotliDecompress(Dv)),delete t.headers["content-encoding"])}n=i.length>1?r.pipeline(i,Rf.noop):i[0];const l=r.finished(n,(()=>{l(),v()})),u={status:t.statusCode,statusText:t.statusMessage,headers:new qg(t.headers),config:e,request:a};if("stream"===c)u.data=n,Hg(_,y,u);else{const t=[];let i=0;n.on("data",(function(s){t.push(s),i+=s.length,e.maxContentLength>-1&&i>e.maxContentLength&&(f=!0,n.destroy(),y(new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,a)))})),n.on("aborted",(function(){if(f)return;const t=new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,a);n.destroy(t),y(t)})),n.on("error",(function(t){h.destroyed||y(Cf.from(t,null,e,a))})),n.on("end",(function(){try{let e=1===t.length?t[0]:Buffer.concat(t);"arraybuffer"!==c&&(e=e.toString(p),p&&"utf8"!==p||(e=Rf.stripBOM(e))),u.data=e}catch(t){y(Cf.from(t,null,e,u.request,u))}Hg(_,y,u)}))}g.once("abort",(e=>{n.destroyed||(n.emit("error",e),n.destroy())}))})),g.once("abort",(e=>{y(e),h.destroy(e)})),h.on("error",(function(t){y(Cf.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 y(new Cf("error trying to parse `config.timeout` to int",Cf.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 i=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),y(new Cf(t,i.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,h)),x()}))}if(Rf.isStream(s)){let t=!1,i=!1;s.on("end",(()=>{t=!0})),s.once("error",(e=>{i=!0,h.destroy(e)})),s.on("close",(()=>{t||i||x(new Wg("Request stream has been aborted",e,h))})),s.pipe(h)}else h.end(s)}))},Uv=jg.isStandardBrowserEnv?{write:function(e,t,i,s,n,a){const r=[];r.push(e+"="+encodeURIComponent(t)),Rf.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),Rf.isString(s)&&r.push("path="+s),Rf.isString(n)&&r.push("domain="+n),!0===a&&r.push("secure"),document.cookie=r.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(){}},zv=jg.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function s(i){let s=i;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{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 i=s(window.location.href),function(e){const t=Rf.isString(e)?s(e):e;return t.protocol===i.protocol&&t.host===i.host}}():function(){return!0};function qv(e,t){let i=0;const s=Tv(50,250);return n=>{const a=n.loaded,r=n.lengthComputable?n.total:void 0,o=a-i,c=s(o);i=a;const p={loaded:a,total:r,progress:r?a/r:void 0,bytes:o,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:n};p[t?"download":"upload"]=!0,e(p)}}var $v="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){let s=e.data;const n=qg.from(e.headers).normalize(),a=e.responseType;let r;function o(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}Rf.isFormData(s)&&(jg.isStandardBrowserEnv||jg.isStandardBrowserWebWorkerEnv)&&n.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",i=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(t+":"+i))}const p=Gg(e.baseURL,e.url);function d(){if(!c)return;const s=qg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Hg((function(e){t(e),o()}),(function(e){i(e),o()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:s,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Og(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&&(i(new Cf("Request aborted",Cf.ECONNABORTED,e,c)),c=null)},c.onerror=function(){i(new Cf("Network Error",Cf.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const s=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(new Cf(t,s.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,c)),c=null},jg.isStandardBrowserEnv){const t=(e.withCredentials||zv(p))&&e.xsrfCookieName&&Uv.read(e.xsrfCookieName);t&&n.set(e.xsrfHeaderName,t)}void 0===s&&n.setContentType(null),"setRequestHeader"in c&&Rf.forEach(n.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),Rf.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",qv(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",qv(e.onUploadProgress)),(e.cancelToken||e.signal)&&(r=t=>{c&&(i(!t||t.type?new Wg(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r)));const l=Cv(p);l&&-1===jg.protocols.indexOf(l)?i(new Cf("Unsupported protocol "+l+":",Cf.ERR_BAD_REQUEST,e)):c.send(s||null)}))};const Vv={http:Fv,xhr:$v};Rf.forEach(Vv,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Wv=e=>{e=Rf.isArray(e)?e:[e];const{length:t}=e;let i,s;for(let n=0;n<t&&(i=e[n],!(s=Rf.isString(i)?Vv[i.toLowerCase()]:i));n++);if(!s){if(!1===s)throw new Cf(`Adapter ${i} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Rf.hasOwnProp(Vv,i)?`Adapter '${i}' is not available in the build`:`Unknown adapter '${i}'`)}if(!Rf.isFunction(s))throw new TypeError("adapter is not a function");return s};function Hv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wg(null,e)}function Gv(e){Hv(e),e.headers=qg.from(e.headers),e.data=$g.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Wv(e.adapter||Ag.adapter)(e).then((function(t){return Hv(e),t.data=$g.call(e,e.transformResponse,t),t.headers=qg.from(t.headers),t}),(function(t){return Vg(t)||(Hv(e),t&&t.response&&(t.response.data=$g.call(e,e.transformResponse,t.response),t.response.headers=qg.from(t.response.headers))),Promise.reject(t)}))}const Kv=e=>e instanceof qg?e.toJSON():e;function Jv(e,t){t=t||{};const i={};function s(e,t,i){return Rf.isPlainObject(e)&&Rf.isPlainObject(t)?Rf.merge.call({caseless:i},e,t):Rf.isPlainObject(t)?Rf.merge({},t):Rf.isArray(t)?t.slice():t}function n(e,t,i){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:s(void 0,e,i):s(e,t,i)}function a(e,t){if(!Rf.isUndefined(t))return s(void 0,t)}function r(e,t){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:s(void 0,e):s(void 0,t)}function o(i,n,a){return a in t?s(i,n):a in e?s(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(e,t)=>n(Kv(e),Kv(t),!0)};return Rf.forEach(Object.keys(e).concat(Object.keys(t)),(function(s){const a=c[s]||n,r=a(e[s],t[s],s);Rf.isUndefined(r)&&a!==o||(i[s]=r)})),i}const Qv={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Qv[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Yv={};Qv.transitional=function(e,t,i){function s(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,n,a)=>{if(!1===e)throw new Cf(s(n," has been removed"+(t?" in "+t:"")),Cf.ERR_DEPRECATED);return t&&!Yv[n]&&(Yv[n]=!0,console.warn(s(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,n,a)}};var Xv={assertOptions:function(e,t,i){if("object"!=typeof e)throw new Cf("options must be an object",Cf.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const a=s[n],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new Cf("option "+a+" must be "+i,Cf.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new Cf("Unknown option "+a,Cf.ERR_BAD_OPTION)}},validators:Qv};const Zv=Xv.validators;class eb{constructor(e){this.defaults=e,this.interceptors={request:new Dg,response:new Dg}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Jv(this.defaults,t);const{transitional:i,paramsSerializer:s,headers:n}=t;let a;void 0!==i&&Xv.assertOptions(i,{silentJSONParsing:Zv.transitional(Zv.boolean),forcedJSONParsing:Zv.transitional(Zv.boolean),clarifyTimeoutError:Zv.transitional(Zv.boolean)},!1),void 0!==s&&Xv.assertOptions(s,{encode:Zv.function,serialize:Zv.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=n&&Rf.merge(n.common,n[t.method]),a&&Rf.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=qg.concat(a,n);const r=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.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=[Gv.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),d=e.length,p=Promise.resolve(t);l<d;)p=p.then(e[l++],e[l++]);return p}d=r.length;let u=t;for(l=0;l<d;){const e=r[l++],t=r[l++];try{u=e(u)}catch(e){t.call(this,e);break}}try{p=Gv.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 Og(Gg((e=Jv(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Rf.forEach(["delete","get","head","options"],(function(e){eb.prototype[e]=function(t,i){return this.request(Jv(i||{},{method:e,url:t,data:(i||{}).data}))}})),Rf.forEach(["post","put","patch"],(function(e){function t(t){return function(i,s,n){return this.request(Jv(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}eb.prototype[e]=t(),eb.prototype[e+"Form"]=t(!0)}));class tb{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 i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const s=new Promise((e=>{i.subscribe(e),t=e})).then(e);return s.cancel=function(){i.unsubscribe(t)},s},e((function(e,s,n){i.reason||(i.reason=new Wg(e,s,n),t(i.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 tb((function(t){e=t})),cancel:e}}}const ib={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(ib).forEach((([e,t])=>{ib[t]=e}));const sb=function e(t){const i=new eb(t),s=Kh(eb.prototype.request,i);return Rf.extend(s,eb.prototype,i,{allOwnKeys:!0}),Rf.extend(s,i,null,{allOwnKeys:!0}),s.create=function(i){return e(Jv(t,i))},s}(Ag);sb.Axios=eb,sb.CanceledError=Wg,sb.CancelToken=tb,sb.isCancel=Vg,sb.VERSION="1.2.3",sb.toFormData=Cg,sb.AxiosError=Cf,sb.Cancel=sb.CanceledError,sb.all=function(e){return Promise.all(e)},sb.spread=function(e){return function(t){return e.apply(null,t)}},sb.isAxiosError=function(e){return Rf.isObject(e)&&!0===e.isAxiosError},sb.mergeConfig=Jv,sb.AxiosHeaders=qg,sb.formToJSON=e=>Mg(Rf.isHTMLForm(e)?new FormData(e):e),sb.HttpStatusCode=ib,sb.default=sb;class nb{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 ab(t,i){return e.ok(t,`${i} is required`),t}function rb(t,i){return e.ok("boolean"==typeof t,`${i}<boolean> is required`),t}function ob(t,i){return e.ok("number"==typeof t,`${i}<number> is required`),t}function cb(t,i){return e.ok("string"==typeof t,`${i}<string> is required`),t}function pb(t,i,s){const n=s||i.name[0].toLowerCase()+i.name.substring(1);return e.ok(t instanceof i,`${n}<${i.name}> is required`),t}function db(t,i="roomName"){return cb(t,i),e.equal("string"==typeof t&&t[0],"/",`${i} must begin with a '/'`),t}function lb(t,i){return e.ok(Array.isArray(t),`${i}<array> is required`),t}function ub(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 mb(t,i,s){cb(i,"name"),function(t,i,s,n){cb(s,"name");const a=n||`${s} must be null or of type ${i}`;e.ok(null===t||typeof t===i,a)}(t,"string",i,s)}function hb({baseUrl:t,url:i}){return e.ok("string"==typeof i,"url<String> is required"),t?t+i:i}class fb{constructor({baseUrl:e}){cb(e,"baseUrl"),this._baseUrl=e}_requestAxios(e,t){const i=Object.assign({},t,{url:e,baseURL:this._baseUrl});return sb.request(i)}request(t,i){return cb(t,"url"),e.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(i,"options are required"),this._requestAxios(t,i).then((e=>{const{data:t,headers:i,status:s,statusText:n,config:a}=e,r=a&&a.url?hb({baseUrl:a.baseURL,url:a.url}):null;return new nb({data:t,headers:i,status:s,statusText:n,url:r})})).catch((e=>{const t=e.response;if(!t)throw new Error("Could not make the request.");const{data:i,headers:s,status:n,statusText:a,config:r}=t,o=r&&r.url?hb({baseUrl:r.baseURL,url:r.url}):null;return Promise.reject(new nb({data:i,headers:s,status:n,statusText:a,url:o}))}))}}class gb{constructor({httpClient:t}){e.ok(t,"httpClient is required"),this._httpClient=t}static dataToFormData(t){e.ok(t,"data is required");const i=new FormData;return Object.keys(t).forEach((e=>{const s=t[e];i.append(e,s)})),i}request(e,t={}){const i=Object.assign(t.headers||{},{"Content-Type":void 0});return this._httpClient.request(e,Object.assign(t,{headers:i,transformRequest:gb.dataToFormData}))}}let vb;vb="object"==typeof window?window.btoa||Gh:"object"==typeof global&&global.btoa||Gh;const bb=()=>Promise.resolve(null);class _b{constructor({httpClient:e,fetchDeviceCredentials:t}){this._httpClient=e,this._fetchDeviceCredentials=t}request(e,t){return this._fetchDeviceCredentials().then((i=>{const s=Object.assign({},t.headers,function(e){if(e&&e.credentials){const t=`${e.credentials.uuid}:${e.hmac}`;return{Authorization:`Basic ${vb(t)}`}}return{}}(i),{"X-Appearin-Device-Platform":"web"}),n=Object.assign({},t,{headers:s});return this._httpClient.request(e,n)}))}}class yb{constructor({baseUrl:t="https://api.appearin.net",fetchDeviceCredentials:i=bb}={}){cb(t,"baseUrl"),e.ok("function"==typeof i,"fetchDeviceCredentials<Function> is required"),this.authenticatedHttpClient=new _b({httpClient:new fb({baseUrl:t}),fetchDeviceCredentials:i}),this.authenticatedFormDataHttpClient=new gb({httpClient:this.authenticatedHttpClient})}request(t,i){return cb(t,"url"),e.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(i,"options are required"),this.authenticatedHttpClient.request(t,i)}requestMultipart(t,i){return cb(t,"url"),e.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(i,"options are required"),this.authenticatedFormDataHttpClient.request(t,i)}}function xb(e,t){return cb(ub(e,"data")[t],t)}const wb=(Sb=xb,(e,t)=>{const i=ub(e,"data")[t];return null==i?null:Sb(e,t)});var Sb;function Rb(e,t){const i=xb(e,t),s=new Date(i);if(isNaN(s.getTime()))throw new Error(`Invalid date for ${i}`);return s}function Cb(e,t,i){return function(e,t){return lb(ub(e,"data")[t],t)}(e,t).map((e=>i(e)))}class kb{constructor(e,t,i){this.credentials={uuid:e},this.hmac=t,this.userId=i}toJson(){return Object.assign({credentials:this.credentials,hmac:this.hmac},this.userId&&{userId:this.userId})}static fromJson(e){return new kb(xb(function(e,t){const i=ub(e,"data")[t];return void 0===i?null:i}(e,"credentials"),"uuid"),xb(e,"hmac"),wb(e,"userId")||void 0)}}class Tb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}getCredentials(){return this._apiClient.request("/devices",{method:"post"}).then((({data:e})=>kb.fromJson(e))).catch((e=>{if(e.response&&404===e.response.status)return null;throw e}))}}class Pb{constructor(e,t){this._key=e,this._chromeStorage=t}loadOrDefault(e){return new Promise((t=>{this._chromeStorage.get(this._key,(i=>{t(i[this._key]||e)}))}))}save(e){return new Promise((t=>{this._chromeStorage.set({[this._key]:e},(()=>{t()}))}))}}class Eb{constructor(e,t){ab(t,"localStorage"),this._key=cb(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 Ob;try{Ob=self.localStorage}catch(e){Ob={getItem:()=>{},key:()=>{},setItem:()=>{},removeItem:()=>{},hasOwnProperty:()=>{},length:0}}var Db=Ob;const Ib="credentials_saved";class jb extends l{constructor({deviceService:e,credentialsStore:t}){super(),this._deviceService=pb(e,Tb),this._credentialsStore=t}static create({baseUrl:e,storeName:t="CredentialsStorage",storeType:i="localStorage"}){const s=new Tb({apiClient:new yb({baseUrl:e})});let n=null;if("localStorage"===i)n=new Eb(t,Db);else{if("chromeStorage"!==i)throw new Error(`Unknown store type: ${i}`);n=new Pb(t,window.chrome.storage.local)}return new jb({deviceService:s,credentialsStore:n})}_fetchNewCredentialsFromApi(){const e=this._credentialsStore;return new Promise((t=>{const i=()=>{this._deviceService.getCredentials().then((i=>e.save(i?i.toJson():null).then((()=>t(i))))).catch((()=>{setTimeout(i,2e3)}))};i()}))}getCurrentCredentials(){return this._credentialsStore.loadOrDefault(null).then((e=>e?kb.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(Ib,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 Mb=()=>Promise.resolve(void 0);class Lb{constructor({apiClient:t,fetchOrganization:i=Mb}){this._apiClient=pb(t,yb),e.ok("function"==typeof i,"fetchOrganization<Function> is required"),this._fetchOrganization=i,this._apiClient=t}_callRequestMethod(t,i,s){return cb(i,"url"),e.equal(i[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(s,"options are required"),this._fetchOrganization().then((e=>{if(!e)return this._apiClient[t](i,s);const{organizationId:n}=e;return this._apiClient[t](`/organizations/${encodeURIComponent(n)}${i}`,s)}))}request(e,t){return this._callRequestMethod("request",e,t)}requestMultipart(e,t){return this._callRequestMethod("requestMultipart",e,t)}}class Ab{constructor({isExhausted:e,renewsAt:t,totalMinutesLimit:i,totalMinutesUsed:s}){this.isExhausted=e,this.renewsAt=t,this.totalMinutesLimit=i,this.totalMinutesUsed=s}static fromJson(e){return new Ab({isExhausted:rb(e.isExhausted,"isExhausted"),renewsAt:new Date(cb(e.renewsAt,"renewsAt")),totalMinutesLimit:ob(e.totalMinutesLimit,"totalMinutesLimit"),totalMinutesUsed:ob(e.totalMinutesUsed,"totalMinutesUsed")})}}class Nb{constructor({basePlanId:e,embeddedFreeTierStatus:t,isDeactivated:i,isOnTrial:s,onTrialUntil:n,trialStatus:a}){this.basePlanId=e,this.isDeactivated=i,this.isOnTrial=s,this.onTrialUntil=n||null,this.trialStatus=a||null,this.embeddedFreeTierStatus=t||null}static fromJson(e){return new Nb({basePlanId:"string"==typeof e.basePlanId?e.basePlanId:null,isDeactivated:rb(e.isDeactivated,"isDeactivated"),isOnTrial:rb(e.isOnTrial,"isOnTrial"),onTrialUntil:"string"==typeof e.onTrialUntil?new Date(e.onTrialUntil):null,trialStatus:"string"==typeof e.trialStatus?e.trialStatus:null,embeddedFreeTierStatus:e.embeddedFreeTierStatus?Ab.fromJson(e.embeddedFreeTierStatus):null})}}function Bb(e){return null!=e}function Fb(e={}){return{maxNumberOfInvitationsAndUsers:Bb(null==e?void 0:e.maxNumberOfInvitationsAndUsers)?Number(null==e?void 0:e.maxNumberOfInvitationsAndUsers):null,maxNumberOfClaimedRooms:Bb(null==e?void 0:e.maxNumberOfClaimedRooms)?Number(null==e?void 0:e.maxNumberOfClaimedRooms):null,maxRoomLimitPerOrganization:Bb(null==e?void 0:e.maxRoomLimitPerOrganization)?Number(null==e?void 0:e.maxRoomLimitPerOrganization):null,trialMinutesLimit:Bb(null==e?void 0:e.trialMinutesLimit)?Number(null==e?void 0:e.trialMinutesLimit):null,includedUnits:Bb(null==e?void 0:e.includedUnits)?Number(null==e?void 0:e.includedUnits):null}}class Ub{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,pb(e,Object,"properties"),cb(e.organizationId,"organizationId"),cb(e.organizationName,"organizationName"),cb(e.subdomain,"subdomain"),pb(e.permissions,Object,"permissions"),pb(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 Nb(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=pb(e,Object,"data"),i=(null==t?void 0:t.preferences)||{},s=(null==t?void 0:t.onboardingSurvey)||null,n=pb(t.permissions,Object,"permissions");return new Ub({organizationId:cb(t.organizationId,"organizationId"),organizationName:cb(t.organizationName,"organizationName"),subdomain:cb(t.subdomain,"subdomain"),permissions:n,limits:Fb(pb(t.limits,Object,"limits")),account:t.account?Nb.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:i,onboardingSurvey:s,type:"string"==typeof t.type?t.type:null})}}Ub.GLOBAL_ORGANIZATION_ID="1";class zb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}createOrganization({organizationName:t,subdomain:i,owner:s}){const{displayName:n,consents:a}=s||{},r="email"in s?{value:s.email,verificationCode:cb(s.verificationCode,"owner.verificationCode")}:null,o="idToken"in s?s.idToken:null;if(cb(i,"subdomain"),cb(t,"organizationName"),cb(n,"owner.displayName"),e.ok(r||o,"owner.email or owner.idToken is required"),a){lb(a,"consents");for(const{consentRevisionId:e,action:t}of a)cb(e,"consentRevisionId"),mb(t,"action")}return this._apiClient.request("/organizations",{method:"POST",data:{organizationName:t,type:"private",subdomain:i,owner:Object.assign(Object.assign(Object.assign(Object.assign({},r&&{email:r}),o&&{idToken:o}),a&&{consents:a}),{displayName:n})}}).then((({data:e})=>xb(e,"organizationId")))}getOrganizationBySubdomain(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/?fields=permissions,account,onboardingSurvey`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof nb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationByOrganizationId(e){return cb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}?fields=permissions,account`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof nb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationsByContactPoint(t){const{code:i}=t,s="email"in t?t.email:null,n="phoneNumber"in t?t.phoneNumber:null;e.ok((s||n)&&!(s&&n),"either email or phoneNumber is required"),cb(i,"code");const a=s?{type:"email",value:s}:{type:"phoneNumber",value:n};return this._apiClient.request("/organization-queries",{method:"POST",data:{contactPoint:a,code:i}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(e)))))}getOrganizationsByIdToken({idToken:e}){return cb(e,"idToken"),this._apiClient.request("/organization-queries",{method:"POST",data:{idToken:e}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getOrganizationsByLoggedInUser(){return this._apiClient.request("/user/organizations",{method:"GET"}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getSubdomainAvailability(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/availability`,{method:"GET"}).then((({data:e})=>(pb(e,Object,"data"),{status:xb(e,"status")})))}updatePreferences({organizationId:e,preferences:t}){return ab(e,"organizationId"),ab(t,"preferences"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}deleteOrganization({organizationId:e}){return ab(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}`,{method:"DELETE"}).then((()=>{}))}}class qb{constructor({organizationService:e,subdomain:t}){pb(e,zb),cb(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 $b{constructor(t={}){e.ok(t 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 i={};Object.getOwnPropertyNames(t).forEach((e=>{-1!==Object.getOwnPropertyNames(this).indexOf(e)&&(i[e]=t[e])})),void 0!==t.ownerId&&(this.ownerId=t.ownerId),void 0!==t.meeting&&(this.meeting=t.meeting),Object.assign(this,i)}}class Vb{constructor({meetingId:e,roomName:t,roomUrl:i,startDate:s,endDate:n,hostRoomUrl:a,viewerRoomUrl:r}){cb(e,"meetingId"),cb(t,"roomName"),cb(i,"roomUrl"),pb(s,Date,"startDate"),pb(n,Date,"endDate"),this.meetingId=e,this.roomName=t,this.roomUrl=i,this.startDate=s,this.endDate=n,this.hostRoomUrl=a,this.viewerRoomUrl=r}static fromJson(e){return new Vb({meetingId:xb(e,"meetingId"),roomName:xb(e,"roomName"),roomUrl:xb(e,"roomUrl"),startDate:Rb(e,"startDate"),endDate:Rb(e,"endDate"),hostRoomUrl:wb(e,"hostRoomUrl"),viewerRoomUrl:wb(e,"viewerRoomUrl")})}}function Wb(e,t=""){return`/room/${encodeURIComponent(e.substring(1))}${t}`}class Hb{constructor({organizationApiClient:e}){this._organizationApiClient=pb(e,Lb)}getRooms({types:e,fields:t=[]}={}){return lb(e,"types"),lb(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 $b(e)))))}getRoom({roomName:e,fields:t}){db(e);const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/rooms/${i}`,{method:"GET",params:Object.assign({includeOnlyLegacyRoomType:"false"},t&&{fields:t.join(",")})}).then((({data:t})=>new $b(Object.assign({},t,Object.assign({roomName:e},t.meeting&&{meeting:Vb.fromJson(t.meeting)}))))).catch((t=>{if(404===t.status)return new $b({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 $b({roomName:e,isBanned:!0});throw new Error(t.data?t.data.error:"Could not fetch room information")}))}claimRoom({roomName:e,type:t,mode:i,isLocked:s}){return db(e),cb(t,"type"),this._organizationApiClient.request("/room/claim",{method:"POST",data:Object.assign(Object.assign({roomName:e,type:t},"string"==typeof i&&{mode:i}),"boolean"==typeof s&&{isLocked:s})}).then((()=>{})).catch((e=>{throw new Error(e.data.error||"Failed to claim room")}))}unclaimRoom(e){db(e);const t=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${t}`,{method:"DELETE"}).then((()=>{}))}renameRoom({roomName:e,newRoomName:t}){db(e),cb(t,"newRoomName");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/roomName`,{method:"PUT",data:{newRoomName:t}}).then((()=>{}))}changeMode({roomName:e,mode:t}){db(e),cb(t,"mode");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/mode`,{method:"PUT",data:{mode:t}}).then((()=>{}))}updatePreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}updateProtectedPreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/protected-preferences`,{method:"PATCH",data:t}).then((()=>{}))}getRoomPermissions(e,{roomKey:t}={}){return db(e),this._organizationApiClient.request(Wb(e,"/permissions"),Object.assign({method:"GET"},t&&{headers:{"X-Whereby-Room-Key":t}})).then((e=>{const{permissions:t,limits:i}=e.data;return{permissions:t,limits:i}}))}getRoomMetrics({roomName:e,metrics:t,from:i,to:s}){return db(e),cb(t,"metrics"),this._organizationApiClient.request(Wb(e,"/metrics"),{method:"GET",params:{metrics:t,from:i,to:s}}).then((e=>e.data))}changeType({roomName:e,type:t}){db(e),function(e,t,i){if(ab(e,"value"),lb(t,"allowedValues"),!t.includes(e))throw new Error(`${i}<string> must be one of the following: ${t.join(", ")}`)}(t,["personal","personal_xl"],"type");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/type`,{method:"PUT",data:{type:t}}).then((()=>{}))}getForestSocialImage({roomName:e,count:t}){return db(e),ob(t,"count"),this._organizationApiClient.request(Wb(e,`/forest-social-image/${t}`),{method:"GET"}).then((e=>e.data.imageUrl))}}class Gb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:s,isVideoEnabled:n}){this.isLocalParticipant=!1,this.displayName=e,this.id=t,this.stream=i,this.isAudioEnabled=s,this.isVideoEnabled=n}}class Kb extends Gb{constructor({displayName:e,id:t,newJoiner:i,streams:s,isAudioEnabled:n,isVideoEnabled:a}){super({displayName:e,id:t,isAudioEnabled:n,isVideoEnabled:a}),this.newJoiner=i,this.streams=s.map((e=>({id:e,state:i?"new_accept":"to_accept"})))}addStream(e,t){this.streams.push({id:e,state:t})}removeStream(e){const t=this.streams.findIndex((t=>t.id===e));-1!==t&&this.streams.splice(t,1)}updateStreamState(e,t){const i=this.streams.find((t=>t.id===e));i&&(i.state=t)}}class Jb extends Gb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:s,isVideoEnabled:n}){super({displayName:e,id:t,stream:i,isAudioEnabled:s,isVideoEnabled:n}),this.isLocalParticipant=!0}}const Qb=process.env.REACT_APP_API_BASE_URL||"https://api.whereby.dev",Yb=process.env.REACT_APP_SIGNAL_BASE_URL||"wss://signal.appearin.net",Xb=["recorder","streamer"],Zb=new Map;const e_=()=>{},t_=EventTarget;class i_ extends t_{constructor(e,{displayName:t,localMedia:i,localMediaConstraints:s,logger:n,roomKey:a}){super(),this.localParticipant=null,this.remoteParticipants=[],this.screenshares=[],this._deviceCredentials=null,this._ownsLocalMedia=!1,this.organizationId="",this.roomConnectionStatus="",this.selfId=null,this.roomUrl=new URL(e);const r=new URLSearchParams(this.roomUrl.search);this._roomKey=a||r.get("roomKey"),this.roomName=this.roomUrl.pathname,this.logger=n||{debug:e_,error:e_,log:e_,warn:e_},this.displayName=t,this.localMediaConstraints=s;const o=Hh({host:this.roomUrl.host});if(i)this.localMedia=i;else{if(!s)throw new Error("Missing constraints");this.localMedia=new fi(s),this._ownsLocalMedia=!0}this.credentialsService=jb.create({baseUrl:Qb}),this.apiClient=new yb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:Qb}),this.organizationService=new zb({apiClient:this.apiClient}),this.organizationServiceCache=new qb({organizationService:this.organizationService,subdomain:o.subdomain}),this.organizationApiClient=new Lb({apiClient:this.apiClient,fetchOrganization:()=>Zt(this,void 0,void 0,(function*(){return(yield this.organizationServiceCache.fetchOrganization())||void 0}))}),this.roomService=new Hb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL(Yb),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v4`,i=e.origin;return new po(i,{autoConnect:!1,host:i,path:t,reconnectionDelay:5e3,reconnectionDelayMax:3e4,timeout:1e4,withCredentials:!0})}(),this.signalSocket.on("new_client",this._handleNewClient.bind(this)),this.signalSocket.on("chat_message",this._handleNewChatMessage.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)),this.signalSocket.on("knock_handled",this._handleKnockHandled.bind(this)),this.signalSocket.on("knocker_left",this._handleKnockerLeft.bind(this)),this.signalSocket.on("room_joined",this._handleRoomJoined.bind(this)),this.signalSocket.on("room_knocked",this._handleRoomKnocked.bind(this)),this.signalSocket.on("cloud_recording_stopped",this._handleCloudRecordingStopped.bind(this)),this.signalSocket.on("screenshare_started",this._handleScreenshareStarted.bind(this)),this.signalSocket.on("screenshare_stopped",this._handleScreenshareStopped.bind(this)),this.signalSocket.on("streaming_stopped",this._handleStreamingStopped.bind(this)),this.signalSocket.on("disconnect",this._handleDisconnect.bind(this)),this.signalSocket.on("connect_error",this._handleDisconnect.bind(this)),this.signalSocketManager=this.signalSocket.getManager(),this.signalSocketManager.on("reconnect",this._handleReconnect.bind(this)),this.localMedia.addEventListener("camera_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_video",{enabled:t})})),this.localMedia.addEventListener("microphone_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_audio",{enabled:t})}));const c={getMediaConstraints:()=>({audio:this.localMedia.isMicrophoneEnabled(),video:this.localMedia.isCameraEnabled()}),deferrable:e=>!e};this.rtcManagerDispatcher=new Vh({emitter:{emit:this._handleRtcEvent.bind(this)},serverSocket:this.signalSocket,webrtcProvider:c,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}})}get roomKey(){return this._roomKey}_handleNewChatMessage(e){this.dispatchEvent(new CustomEvent("chat_message",{detail:e}))}_handleCloudRecordingStarted({client:e}){this.dispatchEvent(new CustomEvent("cloud_recording_started",{detail:{status:"recording",startedAt:e.startedCloudRecordingAt?new Date(e.startedCloudRecordingAt).getTime():(new Date).getTime()}}))}_handleStreamingStarted(){this.dispatchEvent(new CustomEvent("streaming_started",{detail:{status:"streaming",startedAt:(new Date).getTime()}}))}_handleNewClient({client:e}){if("recorder"===e.role.roleName&&this._handleCloudRecordingStarted({client:e}),"streamer"===e.role.roleName&&this._handleStreamingStarted(),Xb.includes(e.role.roleName))return;const t=new Kb(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 i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_audio_enabled",{detail:{participantId:i.id,isAudioEnabled:t}}))}_handleClientVideoEnabled({clientId:e,isVideoEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_video_enabled",{detail:{participantId:i.id,isVideoEnabled:t}}))}_handleClientMetadataReceived({payload:{clientId:e,displayName:t}}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_metadata_changed",{detail:{participantId:i.id,displayName:t}}))}_handleKnockHandled(e){const{clientId:t,resolution:i}=e;t===this.selfId&&("accepted"===i?(this.roomConnectionStatus="accepted",this._roomKey=e.metadata.roomKey,this._joinRoom()):"rejected"===i&&(this.roomConnectionStatus="rejected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}))))}_handleKnockerLeft(e){const{clientId:t}=e;this.dispatchEvent(new CustomEvent("waiting_participant_left",{detail:{participantId:t}}))}_handleRoomJoined(e){const{error:t,isLocked:i,room:s,selfId:n}=e;if(this.selfId=n,"room_locked"===t&&i)return this.roomConnectionStatus="room_locked",void this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));if(s){const{clients:e,knockers:t}=s,i=e.find((e=>e.id===n));if(!i)throw new Error("Missing local client");this.localParticipant=new Jb(Object.assign(Object.assign({},i),{stream:this.localMedia.stream||void 0}));const a=e.find((e=>"recorder"===e.role.roleName));a&&this._handleCloudRecordingStarted({client:a});e.find((e=>"streamer"===e.role.roleName))&&this._handleStreamingStarted(),this.remoteParticipants=e.filter((e=>e.id!==n)).filter((e=>!Xb.includes(e.role.roleName))).map((e=>new Kb(Object.assign(Object.assign({},e),{newJoiner:!1})))),this.roomConnectionStatus="connected",this.dispatchEvent(new CustomEvent("room_joined",{detail:{localParticipant:this.localParticipant,remoteParticipants:this.remoteParticipants,waitingParticipants:t.map((e=>({id:e.clientId,displayName:e.displayName})))}}))}}_handleRoomKnocked(e){const{clientId:t,displayName:i}=e;this.dispatchEvent(new CustomEvent("waiting_participant_joined",{detail:{participantId:t,displayName:i}}))}_handleReconnect(){this.logger.log("Reconnected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}_handleDisconnect(){this.roomConnectionStatus="disconnected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}))}_handleCloudRecordingStopped(){this.dispatchEvent(new CustomEvent("cloud_recording_stopped"))}_handleStreamingStopped(){this.dispatchEvent(new CustomEvent("streaming_stopped"))}_handleScreenshareStarted(e){const{clientId:t,streamId:i,hasAudioTrack:s}=e,n=this.remoteParticipants.find((e=>e.id===t));if(!n)return void this.logger.log("WARN: Could not find participant for screenshare");this.screenshares.find((e=>e.id===i))?this.logger.log("WARN: Screenshare already exists"):(n.addStream(i,"to_accept"),this._handleAcceptStreams([n]),this.screenshares=[...this.screenshares,{participantId:t,id:i,hasAudioTrack:s,stream:void 0,isLocal:!1}])}_handleScreenshareStopped(e){const{clientId:t,streamId:i}=e,s=this.remoteParticipants.find((e=>e.id===t));s?(s.removeStream(i),this.screenshares=this.screenshares.filter((e=>!(e.participantId===t&&e.id===i))),this.dispatchEvent(new CustomEvent("screenshare_stopped",{detail:{participantId:t,id:i}}))):this.logger.log("WARN: Could not find participant for screenshare")}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):"rtc_manager_destroyed"===e?this._handleRtcManagerDestroyed():void this.logger.log(`Unhandled RTC event ${e}`)}_handleRtcManagerCreated({rtcManager:e}){var t;this.rtcManager=e,this.localMedia.addRtcManager(e),this.localMedia.stream&&(null===(t=this.rtcManager)||void 0===t||t.addNewStream("0",this.localMedia.stream,!this.localMedia.isMicrophoneEnabled(),!this.localMedia.isCameraEnabled())),this.remoteParticipants.length&&this._handleAcceptStreams(this.remoteParticipants)}_handleRtcManagerDestroyed(){this.rtcManager=void 0}_handleAcceptStreams(e){var t,i;if(!this.rtcManager)return void this.logger.log("Unable to accept streams, no rtc manager");const s=null===(i=(t=this.rtcManager).shouldAcceptStreamsFromBothSides)||void 0===i?void 0:i.call(t);e.forEach((e=>{const{id:t,streams:i,newJoiner:n}=e;i.forEach((i=>{var a,r;const{id:o,state:c}=i;let p;if("done_accept"!==c&&(p=(n&&"0"===o?"new":"to")+"_accept"),p){if("to_accept"===p||"new_accept"===p&&s||"old_accept"===p&&!s)this.logger.log(`Accepting stream ${o} from ${t}`),null===(a=this.rtcManager)||void 0===a||a.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===(r=this.rtcManager)||void 0===r||r.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:i,streamType:s}){const n=this.remoteParticipants.find((t=>t.id===e));if(!n)return void this.logger.log("WARN: Could not find participant for incoming stream");const a=n.streams.find((e=>e.id===i));n.stream&&n.stream.id===i||!n.stream&&"webcam"===s||!n.stream&&!s&&a&&n.streams.indexOf(a)<1?this.dispatchEvent(new CustomEvent("participant_stream_added",{detail:{participantId:e,stream:t,streamId:i}})):this.dispatchEvent(new CustomEvent("screenshare_started",{detail:{participantId:e,stream:t,id:i,isLocal:!1}}))}_joinRoom(){this.signalSocket.emit("join_room",{avatarUrl:null,config:{isAudioEnabled:this.localMedia.isMicrophoneEnabled(),isVideoEnabled:this.localMedia.isCameraEnabled()},deviceCapabilities:{canScreenshare:!0},displayName:this.displayName,isCoLocated:!1,isDevicePermissionDenied:!1,kickFromOtherRooms:!1,organizationId:this.organizationId,roomKey:this.roomKey,roomName:this.roomName,selfId:"",userAgent:`browser-sdk:${o_}`})}join(){return Zt(this,void 0,void 0,(function*(){if(["connected","connecting"].includes(this.roomConnectionStatus))return void console.warn(`Trying to join when room state is already ${this.roomConnectionStatus}`);this.logger.log("Joining room"),this.signalSocket.connect(),this.roomConnectionStatus="connecting",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));const e=yield this.organizationServiceCache.fetchOrganization();if(!e)throw new Error("Invalid room url");this.organizationId=e.organizationId,this._ownsLocalMedia&&(yield this.localMedia.start()),this._deviceCredentials=yield this.credentialsService.getCredentials(),this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}))}knock(){this.roomConnectionStatus="knocking",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}})),this.signalSocket.emit("knock_room",{displayName:this.displayName,imageUrl:null,kickFromOtherRooms:!0,liveVideo:!1,organizationId:this.organizationId,roomKey:this._roomKey,roomName:this.roomName})}leave(){this.roomConnectionStatus="disconnecting",this._ownsLocalMedia&&this.localMedia.stop(),this.rtcManager&&(this.localMedia.removeRtcManager(this.rtcManager),this.rtcManager.disconnectAll(),this.rtcManager=void 0),this.signalSocket&&(this.signalSocket.emit("leave_room"),this.signalSocket.disconnect(),this.roomConnectionStatus="disconnected")}sendChatMessage(e){this.signalSocket.emit("chat_message",{text:e})}setDisplayName(e){this.signalSocket.emit("send_client_metadata",{type:"UserData",payload:{displayName:e}})}acceptWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"accept",clientId:e,response:{}})}rejectWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"reject",clientId:e,response:{}})}updateStreamResolution({streamId:e,width:t,height:i}){var s,n;if(!e||!this.rtcManager)return;if((null===(n=null===(s=this.localParticipant)||void 0===s?void 0:s.stream)||void 0===n?void 0:n.id)===e)return;const a=Zb.get(e);a&&a.width===t&&a.height===i||this.rtcManager.updateStreamResolution(e,null,{width:t||1,height:i||1}),Zb.set(e,{width:t,height:i})}startScreenshare(){var e;return Zt(this,void 0,void 0,(function*(){const t=this.localMedia.screenshareStream||(yield this.localMedia.startScreenshare());null===(e=this.rtcManager)||void 0===e||e.addNewStream(t.id,t,!1,!0),this.screenshares=[...this.screenshares,{participantId:this.selfId||"",id:t.id,hasAudioTrack:!1,stream:t,isLocal:!0}],this.dispatchEvent(new CustomEvent("screenshare_started",{detail:{participantId:this.selfId||"",id:t.id,hasAudioTrack:!1,stream:t,isLocal:!0}}))}))}stopScreenshare(){var e;if(this.localMedia.screenshareStream){const{id:t}=this.localMedia.screenshareStream;null===(e=this.rtcManager)||void 0===e||e.removeStream(t,this.localMedia.screenshareStream,null),this.screenshares=this.screenshares.filter((e=>e.id!==t)),this.dispatchEvent(new CustomEvent("screenshare_stopped",{detail:{participantId:this.selfId,id:t}})),this.localMedia.stopScreenshare()}}}const s_={chatMessages:[],cloudRecording:{status:"",startedAt:null},isJoining:!1,isStartingScreenshare:!1,joinError:null,startScreenshareError:null,mostRecentChatMessage:null,remoteParticipants:[],roomConnectionStatus:"",screenshares:[],streaming:{status:"",startedAt:null},waitingParticipants:[]};function n_(e,t,i){const s=e.find((e=>e.id===t));if(!s)return e;const n=e.indexOf(s);return[...e.slice(0,n),Object.assign(Object.assign({},s),i),...e.slice(n+1)]}function a_(e,t){switch(t.type){case"CHAT_MESSAGE":return Object.assign(Object.assign({},e),{chatMessages:[...e.chatMessages,t.payload],mostRecentChatMessage:t.payload});case"CLOUD_RECORDING_STARTED":return Object.assign(Object.assign({},e),{cloudRecording:{status:t.payload.status,startedAt:t.payload.startedAt}});case"CLOUD_RECORDING_STOPPED":return Object.assign(Object.assign({},e),{cloudRecording:{status:"",startedAt:null}});case"ROOM_JOINED":return Object.assign(Object.assign({},e),{localParticipant:t.payload.localParticipant,remoteParticipants:t.payload.remoteParticipants,waitingParticipants:t.payload.waitingParticipants,roomConnectionStatus:"connected"});case"ROOM_CONNECTION_STATUS_CHANGED":return Object.assign(Object.assign({},e),{roomConnectionStatus:t.payload.roomConnectionStatus});case"PARTICIPANT_AUDIO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(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:n_(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(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;case"SCREENSHARE_STARTED":return Object.assign(Object.assign({},e),{screenshares:(i=e.screenshares,s={participantId:t.payload.participantId,id:t.payload.id,hasAudioTrack:t.payload.hasAudioTrack,stream:t.payload.stream,isLocal:t.payload.isLocal},i.find((e=>e.id===s.id))?i:[...i,s])});case"SCREENSHARE_STOPPED":return Object.assign(Object.assign({},e),{screenshares:e.screenshares.filter((e=>e.id!==t.payload.id))});case"LOCAL_SCREENSHARE_START_ERROR":return Object.assign(Object.assign({},e),{isStartingScreenshare:!1,startScreenshareError:t.payload});case"LOCAL_SCREENSHARE_STARTING":return Object.assign(Object.assign({},e),{isStartingScreenshare:!0});case"LOCAL_SCREENSHARE_STOPPED":return Object.assign(Object.assign({},e),{screenshares:e.screenshares.filter((e=>!e.isLocal))});case"STREAMING_STARTED":return Object.assign(Object.assign({},e),{streaming:{status:t.payload.status,startedAt:t.payload.startedAt}});case"STREAMING_STOPPED":return Object.assign(Object.assign({},e),{streaming:{status:"",startedAt:null}});case"WAITING_PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{waitingParticipants:[...e.waitingParticipants,{id:t.payload.participantId,displayName:t.payload.displayName}]});case"WAITING_PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{waitingParticipants:e.waitingParticipants.filter((e=>e.id!==t.payload.participantId))});default:throw e}var i,s}function r_(e,t){const[i]=ni.useState((()=>{var i;return new i_(e,Object.assign(Object.assign({},t),{localMedia:(null===(i=null==t?void 0:t.localMedia)||void 0===i?void 0:i._ref)||void 0}))})),[s,n]=ni.useReducer(a_,s_);function a(e,t,i){return{eventName:e,listener:t,options:i}}const r=ui.useMemo((()=>[a("chat_message",(e=>{n({type:"CHAT_MESSAGE",payload:e.detail})})),a("cloud_recording_started",(e=>{const{status:t,startedAt:i}=e.detail;n({type:"CLOUD_RECORDING_STARTED",payload:{status:t,startedAt:i}})})),a("cloud_recording_stopped",(()=>{n({type:"CLOUD_RECORDING_STOPPED"})})),a("participant_audio_enabled",(e=>{const{participantId:t,isAudioEnabled:i}=e.detail;n({type:"PARTICIPANT_AUDIO_ENABLED",payload:{participantId:t,isAudioEnabled:i}})})),a("participant_joined",(e=>{const{remoteParticipant:t}=e.detail;n({type:"PARTICIPANT_JOINED",payload:{paritipant:t}})})),a("participant_left",(e=>{const{participantId:t}=e.detail;n({type:"PARTICIPANT_LEFT",payload:{participantId:t}})})),a("participant_metadata_changed",(e=>{const{participantId:t,displayName:i}=e.detail;n({type:"PARTICIPANT_METADATA_CHANGED",payload:{participantId:t,displayName:i}})})),a("participant_stream_added",(e=>{const{participantId:t,stream:i}=e.detail;n({type:"PARTICIPANT_STREAM_ADDED",payload:{participantId:t,stream:i}})})),a("participant_video_enabled",(e=>{const{participantId:t,isVideoEnabled:i}=e.detail;n({type:"PARTICIPANT_VIDEO_ENABLED",payload:{participantId:t,isVideoEnabled:i}})})),a("room_connection_status_changed",(e=>{const{roomConnectionStatus:t}=e.detail;n({type:"ROOM_CONNECTION_STATUS_CHANGED",payload:{roomConnectionStatus:t}})})),a("room_joined",(e=>{const{localParticipant:t,remoteParticipants:i,waitingParticipants:s}=e.detail;n({type:"ROOM_JOINED",payload:{localParticipant:t,remoteParticipants:i,waitingParticipants:s}})})),a("screenshare_started",(e=>{const{participantId:t,stream:i,id:s,hasAudioTrack:a,isLocal:r}=e.detail;n({type:"SCREENSHARE_STARTED",payload:{participantId:t,stream:i,id:s,hasAudioTrack:a,isLocal:r}})})),a("screenshare_stopped",(e=>{const{participantId:t,id:i}=e.detail;n({type:"SCREENSHARE_STOPPED",payload:{participantId:t,id:i}})})),a("streaming_started",(e=>{const{status:t,startedAt:i}=e.detail;n({type:"STREAMING_STARTED",payload:{status:t,startedAt:i}})})),a("streaming_stopped",(()=>{n({type:"STREAMING_STOPPED"})})),a("waiting_participant_joined",(e=>{const{participantId:t,displayName:i}=e.detail;n({type:"WAITING_PARTICIPANT_JOINED",payload:{participantId:t,displayName:i}})}))]),[]);return ni.useEffect((()=>(r.forEach((({eventName:e,listener:t})=>{i.addEventListener(e,t)})),i.join(),()=>{r.forEach((({eventName:e,listener:t})=>{i.removeEventListener(e,t)})),i.leave()})),[]),{state:s,actions:{knock:()=>{i.knock()},sendChatMessage:e=>{i.sendChatMessage(e)},setDisplayName:e=>{i.setDisplayName(e),n({type:"LOCAL_CLIENT_DISPLAY_NAME_CHANGED",payload:{displayName:e}})},toggleCamera:e=>{i.localMedia.toggleCameraEnabled(e)},toggleMicrophone:e=>{i.localMedia.toggleMichrophoneEnabled(e)},acceptWaitingParticipant:e=>{i.acceptWaitingParticipant(e)},rejectWaitingParticipant:e=>{i.rejectWaitingParticipant(e)},startScreenshare:()=>{n({type:"LOCAL_SCREENSHARE_STARTING"});try{i.startScreenshare()}catch(e){n({type:"LOCAL_SCREENSHARE_START_ERROR",payload:e})}},stopScreenshare:()=>{i.stopScreenshare()}},components:{VideoView:e=>ui.createElement(mi,Object.assign({},e,{onResize:({stream:e,width:t,height:s})=>{i.updateStreamResolution({streamId:e.id,width:t,height:s})}}))},_ref:i}}const o_="2.0.0-alpha20";export{mi as VideoView,o_ as sdkVersion,bi as useLocalMedia,r_ as useRoomConnection};
43
+ function(e){var t=Nf,i=g.extname,s=/^\s*([^;\s]*)(?:;|\s|$)/,n=/^text\//i;function a(e){if(!e||"string"!=typeof e)return!1;var i=s.exec(e),a=i&&t[i[1].toLowerCase()];return a&&a.charset?a.charset:!(!i||!n.test(i[1]))&&"UTF-8"}e.charset=a,e.charsets={lookup:a},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var s=e.charset(i);s&&(i+="; charset="+s.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=s.exec(t),n=i&&e.extensions[i[1].toLowerCase()];if(!n||!n.length)return!1;return n[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var s=i("x."+t).toLowerCase().substr(1);if(!s)return!1;return e.types[s]||!1},e.types=Object.create(null),function(e,i){var s=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(n){var a=t[n],r=a.extensions;if(r&&r.length){e[n]=r;for(var o=0;o<r.length;o++){var c=r[o];if(i[c]){var p=s.indexOf(t[i[c]].source),d=s.indexOf(a.source);if("application/octet-stream"!==i[c]&&(p>d||p===d&&"application/"===i[c].substr(0,12)))continue}i[c]=n}}}))}(e.extensions,e.types)}(Af);var Ff=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)};var Uf=Ff,zf=function(e){var t=!1;return Uf((function(){t=!0})),function(i,s){t?e(i,s):Uf((function(){e(i,s)}))}};var qf=function(e){Object.keys(e.jobs).forEach($f.bind(e)),e.jobs={}};function $f(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Vf=zf,Wf=qf,Hf=function(e,t,i,s){var n=i.keyedList?i.keyedList[i.index]:i.index;i.jobs[n]=function(e,t,i,s){var n;n=2==e.length?e(i,Vf(s)):e(i,t,Vf(s));return n}(t,n,e[n],(function(e,t){n in i.jobs&&(delete i.jobs[n],e?Wf(i):i.results[n]=t,s(e,i.results))}))};var Gf=function(e,t){var i=!Array.isArray(e),s={index:0,keyedList:i||t?Object.keys(e):null,jobs:{},results:i?{}:[],size:i?Object.keys(e).length:e.length};t&&s.keyedList.sort(i?t:function(i,s){return t(e[i],e[s])});return s};var Kf=qf,Jf=zf,Qf=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,Kf(this),Jf(e)(null,this.results)};var Yf=Hf,Xf=Gf,Zf=Qf,eg=function(e,t,i){var s=Xf(e);for(;s.index<(s.keyedList||e).length;)Yf(e,t,s,(function(e,t){e?i(e,t):0!==Object.keys(s.jobs).length||i(null,s.results)})),s.index++;return Zf.bind(s,i)};var tg={},ig=Hf,sg=Gf,ng=Qf;function ag(e,t){return e<t?-1:e>t?1:0}({get exports(){return tg},set exports(e){tg=e}}).exports=function(e,t,i,s){var n=sg(e,i);return ig(e,t,n,(function i(a,r){a?s(a,r):(n.index++,n.index<(n.keyedList||e).length?ig(e,t,n,i):s(null,n.results))})),ng.bind(n,s)},tg.ascending=ag,tg.descending=function(e,t){return-1*ag(e,t)};var rg=tg;var og={parallel:eg,serial:function(e,t,i){return rg(e,t,null,i)},serialOrdered:tg},cg=Mf,pg=h,dg=g,lg=n,ug=a,mg=i.parse,hg=t,fg=r.Stream,gg=Af,vg=og,bg=function(e,t){return Object.keys(t).forEach((function(i){e[i]=e[i]||t[i]})),e},_g=yg;function yg(e){if(!(this instanceof yg))return new yg(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],cg.call(this),e=e||{})this[t]=e[t]}function xg(e){return Rf.isPlainObject(e)||Rf.isArray(e)}function wg(e){return Rf.endsWith(e,"[]")?e.slice(0,-2):e}function Sg(e,t,i){return e?e.concat(t).map((function(e,t){return e=wg(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}pg.inherits(yg,cg),yg.LINE_BREAK="\r\n",yg.DEFAULT_CONTENT_TYPE="application/octet-stream",yg.prototype.append=function(e,t,i){"string"==typeof(i=i||{})&&(i={filename:i});var s=cg.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),pg.isArray(t))this._error(new Error("Arrays are not supported."));else{var n=this._multiPartHeader(e,t,i),a=this._multiPartFooter();s(n),s(t),s(a),this._trackLength(n,t,i)}},yg.prototype._trackLength=function(e,t,i){var s=0;null!=i.knownLength?s+=+i.knownLength:Buffer.isBuffer(t)?s=t.length:"string"==typeof t&&(s=Buffer.byteLength(t)),this._valueLength+=s,this._overheadLength+=Buffer.byteLength(e)+yg.LINE_BREAK.length,t&&(t.path||t.readable&&t.hasOwnProperty("httpVersion")||t instanceof fg)&&(i.knownLength||this._valuesToMeasure.push(t))},yg.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)):hg.stat(e.path,(function(i,s){var n;i?t(i):(n=s.size-(e.start?e.start:0),t(null,n))})):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",(function(i){e.pause(),t(null,+i.headers["content-length"])})),e.resume()):t("Unknown stream")},yg.prototype._multiPartHeader=function(e,t,i){if("string"==typeof i.header)return i.header;var s,n=this._getContentDisposition(t,i),a=this._getContentType(t,i),r="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(n||[]),"Content-Type":[].concat(a||[])};for(var c in"object"==typeof i.header&&bg(o,i.header),o)o.hasOwnProperty(c)&&null!=(s=o[c])&&(Array.isArray(s)||(s=[s]),s.length&&(r+=c+": "+s.join("; ")+yg.LINE_BREAK));return"--"+this.getBoundary()+yg.LINE_BREAK+r+yg.LINE_BREAK},yg.prototype._getContentDisposition=function(e,t){var i,s;return"string"==typeof t.filepath?i=dg.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?i=dg.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(i=dg.basename(e.client._httpMessage.path||"")),i&&(s='filename="'+i+'"'),s},yg.prototype._getContentType=function(e,t){var i=t.contentType;return!i&&e.name&&(i=gg.lookup(e.name)),!i&&e.path&&(i=gg.lookup(e.path)),!i&&e.readable&&e.hasOwnProperty("httpVersion")&&(i=e.headers["content-type"]),i||!t.filepath&&!t.filename||(i=gg.lookup(t.filepath||t.filename)),i||"object"!=typeof e||(i=yg.DEFAULT_CONTENT_TYPE),i},yg.prototype._multiPartFooter=function(){return function(e){var t=yg.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},yg.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+yg.LINE_BREAK},yg.prototype.getHeaders=function(e){var t,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(i[t.toLowerCase()]=e[t]);return i},yg.prototype.setBoundary=function(e){this._boundary=e},yg.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},yg.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),i=0,s=this._streams.length;i<s;i++)"function"!=typeof this._streams[i]&&(e=Buffer.isBuffer(this._streams[i])?Buffer.concat([e,this._streams[i]]):Buffer.concat([e,Buffer.from(this._streams[i])]),"string"==typeof this._streams[i]&&this._streams[i].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(yg.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},yg.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},yg.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},yg.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},yg.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?vg.parallel(this._valuesToMeasure,this._lengthRetriever,(function(i,s){i?e(i):(s.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},yg.prototype.submit=function(e,t){var i,s,n={method:"post"};return"string"==typeof e?(e=mg(e),s=bg({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},n)):(s=bg(e,n)).port||(s.port="https:"==s.protocol?443:80),s.headers=this.getHeaders(e.headers),i="https:"==s.protocol?ug.request(s):lg.request(s),this.getLength(function(e,s){if(e&&"Unknown stream"!==e)this._error(e);else if(s&&i.setHeader("Content-Length",s),this.pipe(i),t){var n,a=function(e,s){return i.removeListener("error",a),i.removeListener("response",n),t.call(this,e,s)};n=a.bind(this,null),i.on("error",a),i.on("response",n)}}.bind(this)),i},yg.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},yg.prototype.toString=function(){return"[object FormData]"};const Rg=Rf.toFlatObject(Rf,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Cg(e,t,i){if(!Rf.isObject(e))throw new TypeError("target must be an object");t=t||new(_g||FormData);const s=(i=Rf.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Rf.isUndefined(t[e])}))).metaTokens,n=i.visitor||d,a=i.dots,r=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&((c=t)&&Rf.isFunction(c.append)&&"FormData"===c[Symbol.toStringTag]&&c[Symbol.iterator]);var c;if(!Rf.isFunction(n))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(Rf.isDate(e))return e.toISOString();if(!o&&Rf.isBlob(e))throw new Cf("Blob is not supported. Use a Buffer instead.");return Rf.isArrayBuffer(e)||Rf.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,i,n){let o=e;if(e&&!n&&"object"==typeof e)if(Rf.endsWith(i,"{}"))i=s?i:i.slice(0,-2),e=JSON.stringify(e);else if(Rf.isArray(e)&&function(e){return Rf.isArray(e)&&!e.some(xg)}(e)||Rf.isFileList(e)||Rf.endsWith(i,"[]")&&(o=Rf.toArray(e)))return i=wg(i),o.forEach((function(e,s){!Rf.isUndefined(e)&&null!==e&&t.append(!0===r?Sg([i],s,a):null===r?i:i+"[]",p(e))})),!1;return!!xg(e)||(t.append(Sg(n,i,a),p(e)),!1)}const l=[],u=Object.assign(Rg,{defaultVisitor:d,convertValue:p,isVisitable:xg});if(!Rf.isObject(e))throw new TypeError("data must be an object");return function e(i,s){if(!Rf.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+s.join("."));l.push(i),Rf.forEach(i,(function(i,a){!0===(!(Rf.isUndefined(i)||null===i)&&n.call(t,i,Rf.isString(a)?a.trim():a,s,u))&&e(i,s?s.concat(a):[a])})),l.pop()}}(e),t}function kg(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Tg(e,t){this._pairs=[],e&&Cg(e,this,t)}const Pg=Tg.prototype;function Eg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Og(e,t,i){if(!t)return e;const s=i&&i.encode||Eg,n=i&&i.serialize;let a;if(a=n?n(t,i):Rf.isURLSearchParams(t)?t.toString():new Tg(t,i).toString(s),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Pg.append=function(e,t){this._pairs.push([e,t])},Pg.toString=function(e){const t=e?function(t){return e.call(this,t,kg)}:kg;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Dg{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Rf.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Ig={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jg={isNode:!0,classes:{URLSearchParams:i.URLSearchParams,FormData:_g,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function Mg(e){function t(e,i,s,n){let a=e[n++];const r=Number.isFinite(+a),o=n>=e.length;if(a=!a&&Rf.isArray(s)?s.length:a,o)return Rf.hasOwnProp(s,a)?s[a]=[s[a],i]:s[a]=i,!r;s[a]&&Rf.isObject(s[a])||(s[a]=[]);return t(e,i,s[a],n)&&Rf.isArray(s[a])&&(s[a]=function(e){const t={},i=Object.keys(e);let s;const n=i.length;let a;for(s=0;s<n;s++)a=i[s],t[a]=e[a];return t}(s[a])),!r}if(Rf.isFormData(e)&&Rf.isFunction(e.entries)){const i={};return Rf.forEachEntry(e,((e,s)=>{t(function(e){return Rf.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),s,i,0)})),i}return null}const Lg={"Content-Type":void 0};const Ag={transitional:Ig,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",s=i.indexOf("application/json")>-1,n=Rf.isObject(e);n&&Rf.isHTMLForm(e)&&(e=new FormData(e));if(Rf.isFormData(e))return s&&s?JSON.stringify(Mg(e)):e;if(Rf.isArrayBuffer(e)||Rf.isBuffer(e)||Rf.isStream(e)||Rf.isFile(e)||Rf.isBlob(e))return e;if(Rf.isArrayBufferView(e))return e.buffer;if(Rf.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cg(e,new jg.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,s){return Rf.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Rf.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Cg(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||s?(t.setContentType("application/json",!1),function(e,t,i){if(Rf.isString(e))try{return(t||JSON.parse)(e),Rf.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ag.transitional,i=t&&t.forcedJSONParsing,s="json"===this.responseType;if(e&&Rf.isString(e)&&(i&&!this.responseType||s)){const i=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Cf.from(e,Cf.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:jg.classes.FormData,Blob:jg.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Rf.forEach(["delete","get","head"],(function(e){Ag.headers[e]={}})),Rf.forEach(["post","put","patch"],(function(e){Ag.headers[e]=Rf.merge(Lg)}));const Ng=Rf.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 Bg=Symbol("internals");function Fg(e){return e&&String(e).trim().toLowerCase()}function Ug(e){return!1===e||null==e?e:Rf.isArray(e)?e.map(Ug):String(e)}function zg(e,t,i,s){return Rf.isFunction(s)?s.call(this,t,i):Rf.isString(t)?Rf.isString(s)?-1!==t.indexOf(s):Rf.isRegExp(s)?s.test(t):void 0:void 0}class qg{constructor(e){e&&this.set(e)}set(e,t,i){const s=this;function n(e,t,i){const n=Fg(t);if(!n)throw new Error("header name must be a non-empty string");const a=Rf.findKey(s,n);(!a||void 0===s[a]||!0===i||void 0===i&&!1!==s[a])&&(s[a||t]=Ug(e))}const a=(e,t)=>Rf.forEach(e,((e,i)=>n(e,i,t)));return Rf.isPlainObject(e)||e instanceof this.constructor?a(e,t):Rf.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?a((e=>{const t={};let i,s,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),i=e.substring(0,n).trim().toLowerCase(),s=e.substring(n+1).trim(),!i||t[i]&&Ng[i]||("set-cookie"===i?t[i]?t[i].push(s):t[i]=[s]:t[i]=t[i]?t[i]+", "+s:s)})),t})(e),t):null!=e&&n(t,e,i),this}get(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=i.exec(e);)t[s[1]]=s[2];return t}(e);if(Rf.isFunction(t))return t.call(this,e,i);if(Rf.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);return!(!i||t&&!zg(0,this[i],i,t))}return!1}delete(e,t){const i=this;let s=!1;function n(e){if(e=Fg(e)){const n=Rf.findKey(i,e);!n||t&&!zg(0,i[n],n,t)||(delete i[n],s=!0)}}return Rf.isArray(e)?e.forEach(n):n(e),s}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,i={};return Rf.forEach(this,((s,n)=>{const a=Rf.findKey(i,n);if(a)return t[a]=Ug(s),void delete t[n];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(n):String(n).trim();r!==n&&delete t[n],t[r]=Ug(s),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Rf.forEach(this,((i,s)=>{null!=i&&!1!==i&&(t[s]=e&&Rf.isArray(i)?i.join(", "):i)})),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 i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[Bg]=this[Bg]={accessors:{}}).accessors,i=this.prototype;function s(e){const s=Fg(e);t[s]||(!function(e,t){const i=Rf.toCamelCase(" "+t);["get","set","has"].forEach((s=>{Object.defineProperty(e,s+i,{value:function(e,i,n){return this[s].call(this,t,e,i,n)},configurable:!0})}))}(i,e),t[s]=!0)}return Rf.isArray(e)?e.forEach(s):s(e),this}}function $g(e,t){const i=this||Ag,s=t||i,n=qg.from(s.headers);let a=s.data;return Rf.forEach(e,(function(e){a=e.call(i,a,n.normalize(),t?t.status:void 0)})),n.normalize(),a}function Vg(e){return!(!e||!e.__CANCEL__)}function Wg(e,t,i){Cf.call(this,null==e?"canceled":e,Cf.ERR_CANCELED,t,i),this.name="CanceledError"}function Hg(e,t,i){const s=i.config.validateStatus;i.status&&s&&!s(i.status)?t(new Cf("Request failed with status code "+i.status,[Cf.ERR_BAD_REQUEST,Cf.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}function Gg(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}qg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),Rf.freezeMethods(qg.prototype),Rf.freezeMethods(qg),Rf.inherits(Wg,Cf,{__CANCEL__:!0});var Kg=i.parse,Jg={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},Qg=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function Yg(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var Xg,Zg=function(e){var t="string"==typeof e?Kg(e):e||{},i=t.protocol,s=t.host,n=t.port;if("string"!=typeof s||!s||"string"!=typeof i)return"";if(i=i.split(":",1)[0],!function(e,t){var i=(Yg("npm_config_no_proxy")||Yg("no_proxy")).toLowerCase();if(!i)return!0;if("*"===i)return!1;return i.split(/[,\s]/).every((function(i){if(!i)return!0;var s=i.match(/^(.+):(\d+)$/),n=s?s[1]:i,a=s?parseInt(s[2]):0;return!(!a||a===t)||(/^[.*]/.test(n)?("*"===n.charAt(0)&&(n=n.slice(1)),!Qg.call(e,n)):e!==n)}))}(s=s.replace(/:\d*$/,""),n=parseInt(n)||Jg[i]||0))return"";var a=Yg("npm_config_"+i+"_proxy")||Yg(i+"_proxy")||Yg("npm_config_proxy")||Yg("all_proxy");return a&&-1===a.indexOf("://")&&(a=i+"://"+a),a},ev={},tv={get exports(){return ev},set exports(e){ev=e}},iv=i,sv=iv.URL,nv=n,av=a,rv=r.Writable,ov=e,cv=function(){if(!Xg){try{Xg=jo("follow-redirects")}catch(e){}"function"!=typeof Xg&&(Xg=function(){})}Xg.apply(null,arguments)},pv=["abort","aborted","connect","error","socket","timeout"],dv=Object.create(null);pv.forEach((function(e){dv[e]=function(t,i,s){this._redirectable.emit(e,t,i,s)}}));var lv=xv("ERR_INVALID_URL","Invalid URL",TypeError),uv=xv("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),mv=xv("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),hv=xv("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),fv=xv("ERR_STREAM_WRITE_AFTER_END","write after end");function gv(e,t){rv.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 i=this;this._onNativeResponse=function(e){i._processResponse(e)},this._performRequest()}function vv(e){var t={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(e).forEach((function(s){var n=s+":",a=i[n]=e[s],r=t[s]=Object.create(a);Object.defineProperties(r,{request:{value:function(e,s,a){if(Sv(e)){var r;try{r=_v(new sv(e))}catch(t){r=iv.parse(e)}if(!Sv(r.protocol))throw new lv({input:e});e=r}else sv&&e instanceof sv?e=_v(e):(a=s,s=e,e={protocol:n});return Rv(s)&&(a=s,s=null),(s=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,s)).nativeProtocols=i,Sv(s.host)||Sv(s.hostname)||(s.hostname="::1"),ov.equal(s.protocol,n,"protocol mismatch"),cv("options",s),new gv(s,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,i){var s=r.request(e,t,i);return s.end(),s},configurable:!0,enumerable:!0,writable:!0}})})),t}function bv(){}function _v(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 yv(e,t){var i;for(var s in t)e.test(s)&&(i=t[s],delete t[s]);return null==i?void 0:String(i).trim()}function xv(e,t,i){function s(i){Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return s.prototype=new(i||Error),s.prototype.constructor=s,s.prototype.name="Error ["+e+"]",s}function wv(e){for(var t of pv)e.removeListener(t,dv[t]);e.on("error",bv),e.abort()}function Sv(e){return"string"==typeof e||e instanceof String}function Rv(e){return"function"==typeof e}gv.prototype=Object.create(rv.prototype),gv.prototype.abort=function(){wv(this._currentRequest),this.emit("abort")},gv.prototype.write=function(e,t,i){if(this._ending)throw new fv;if(!Sv(e)&&("object"!=typeof(s=e)||!("length"in s)))throw new TypeError("data should be a string, Buffer or Uint8Array");var s;Rv(t)&&(i=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,i)):(this.emit("error",new hv),this.abort()):i&&i()},gv.prototype.end=function(e,t,i){if(Rv(e)?(i=e,e=t=null):Rv(t)&&(i=t,t=null),e){var s=this,n=this._currentRequest;this.write(e,t,(function(){s._ended=!0,n.end(null,null,i)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,i)},gv.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},gv.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},gv.prototype.setTimeout=function(e,t){var i=this;function s(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function n(t){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout((function(){i.emit("timeout"),a()}),e),s(t)}function a(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",a),i.removeListener("error",a),i.removeListener("response",a),t&&i.removeListener("timeout",t),i.socket||i._currentRequest.removeListener("socket",n)}return t&&this.on("timeout",t),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",s),this.on("abort",a),this.on("error",a),this.on("response",a),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){gv.prototype[e]=function(t,i){return this._currentRequest[e](t,i)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(gv.prototype,e,{get:function(){return this._currentRequest[e]}})})),gv.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))}},gv.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var i=e.slice(0,-1);this._options.agent=this._options.agents[i]}var s=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var n of(s._redirectable=this,pv))s.on(n,dv[n]);if(this._currentUrl=/^\//.test(this._options.path)?iv.format(this._options):this._options.path,this._isRedirect){var a=0,r=this,o=this._requestBodyBuffers;!function e(t){if(s===r._currentRequest)if(t)r.emit("error",t);else if(a<o.length){var i=o[a++];s.finished||s.write(i.data,i.encoding,e)}else r._ended&&s.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},gv.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var i=e.headers.location;if(!i||!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(wv(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new mv);else{var s,n=this._options.beforeRedirect;n&&(s=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var a=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=[],yv(/^content-/i,this._options.headers));var r,o=yv(/^host$/i,this._options.headers),c=iv.parse(this._currentUrl),p=o||c.host,d=/^\w+:/.test(i)?this._currentUrl:iv.format(Object.assign(c,{host:p}));try{r=iv.resolve(d,i)}catch(e){return void this.emit("error",new uv({cause:e}))}cv("redirecting to",r),this._isRedirect=!0;var l=iv.parse(r);if(Object.assign(this._options,l),(l.protocol!==c.protocol&&"https:"!==l.protocol||l.host!==p&&!function(e,t){ov(Sv(e)&&Sv(t));var i=e.length-t.length-1;return i>0&&"."===e[i]&&e.endsWith(t)}(l.host,p))&&yv(/^(?:authorization|cookie)$/i,this._options.headers),Rv(n)){var u={headers:e.headers,statusCode:t},m={url:d,method:a,headers:s};try{n(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 uv({cause:e}))}}},tv.exports=vv({http:nv,https:av}),ev.wrap=vv;function Cv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const kv=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Tv(e,t){e=e||10;const i=new Array(e),s=new Array(e);let n,a=0,r=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),p=s[r];n||(n=c),i[a]=o,s[a]=c;let d=r,l=0;for(;d!==a;)l+=i[d++],d%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-n<t)return;const u=p&&c-p;return u?Math.round(1e3*l/u):void 0}}const Pv=Symbol("internals");class Ev extends r.Transform{constructor(e){super({readableHighWaterMark:(e=Rf.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!Rf.isUndefined(t[e])))).chunkSize});const t=this,i=this[Pv]={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},s=Tv(i.ticksRate*e.samplesCount,i.timeWindow);this.on("newListener",(e=>{"progress"===e&&(i.isCaptured||(i.isCaptured=!0))}));let n=0;i.updateProgress=function(e,t){let i=0;const s=1e3/t;let n=null;return function(t,a){const r=Date.now();if(t||r-i>s)return n&&(clearTimeout(n),n=null),i=r,e.apply(null,a);n||(n=setTimeout((()=>(n=null,i=Date.now(),e.apply(null,a))),s-(r-i)))}}((function(){const e=i.length,a=i.bytesSeen,r=a-n;if(!r||t.destroyed)return;const o=s(r);n=a,process.nextTick((()=>{t.emit("progress",{loaded:a,total:e,progress:e?a/e:void 0,bytes:r,rate:o||void 0,estimated:o&&e&&a<=e?(e-a)/o:void 0})}))}),i.ticksRate);const a=()=>{i.updateProgress(!0)};this.once("end",a),this.once("error",a)}_read(e){const t=this[Pv];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,i){const s=this,n=this[Pv],a=n.maxRate,r=this.readableHighWaterMark,o=n.timeWindow,c=a/(1e3/o),p=!1!==n.minChunkSize?Math.max(n.minChunkSize,.01*c):0;const d=(e,t)=>{const i=Buffer.byteLength(e);let d,l=null,u=r,m=0;if(a){const e=Date.now();(!n.ts||(m=e-n.ts)>=o)&&(n.ts=e,d=c-n.bytes,n.bytes=d<0?-d:0,m=0),d=c-n.bytes}if(a){if(d<=0)return setTimeout((()=>{t(null,e)}),o-m);d<u&&(u=d)}u&&i>u&&i-u>p&&(l=e.subarray(u),e=e.subarray(0,u)),function(e,t){const i=Buffer.byteLength(e);n.bytesSeen+=i,n.bytes+=i,n.isCaptured&&n.updateProgress(),s.push(e)?process.nextTick(t):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(t)}}(e,l?()=>{process.nextTick(t,null,l)}:t)};d(e,(function e(t,s){if(t)return i(t);s?d(s,e):i(null)}))}setLength(e){return this[Pv].length=+e,this}}const Ov={flush:o.constants.Z_SYNC_FLUSH,finishFlush:o.constants.Z_SYNC_FLUSH},Dv={flush:o.constants.BROTLI_OPERATION_FLUSH,finishFlush:o.constants.BROTLI_OPERATION_FLUSH},Iv=Rf.isFunction(o.createBrotliDecompress),{http:jv,https:Mv}=ev,Lv=/https:?/,Av=jg.protocols.map((e=>e+":"));function Nv(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function Bv(e,t,i){let s=t;if(!s&&!1!==s){const e=Zg(i);e&&(s=new URL(e))}if(s){if(s.username&&(s.auth=(s.username||"")+":"+(s.password||"")),s.auth){(s.auth.username||s.auth.password)&&(s.auth=(s.auth.username||"")+":"+(s.auth.password||""));const t=Buffer.from(s.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=s.hostname||s.host;e.hostname=t,e.host=t,e.port=s.port,e.path=i,s.protocol&&(e.protocol=s.protocol.includes(":")?s.protocol:`${s.protocol}:`)}e.beforeRedirects.proxy=function(e){Bv(e,t,e.href)}}var Fv="undefined"!=typeof process&&"process"===Rf.kindOf(process)&&function(e){return new Promise((function(t,i){let s=e.data;const c=e.responseType,p=e.responseEncoding,d=e.method.toUpperCase();let u,m,h,f=!1;const g=new l;function v(){u||(u=!0,e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),g.removeAllListeners())}function b(e,s){m||(m=!0,s&&(f=!0,v()),s?i(e):t(e))}const _=function(e){b(e)},y=function(e){b(e,!0)};function x(t){g.emit("abort",!t||t.type?new Wg(null,e,h):t)}g.once("abort",y),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x)));const w=Gg(e.baseURL,e.url),S=new URL(w),R=S.protocol||Av[0];if("data:"===R){let t;if("GET"!==d)return Hg(_,y,{status:405,statusText:"method not allowed",headers:{},config:e});try{t=function(e,t,i){const s=i&&i.Blob||jg.classes.Blob,n=Cv(e);if(void 0===t&&s&&(t=!0),"data"===n){e=n.length?e.slice(n.length+1):e;const i=kv.exec(e);if(!i)throw new Cf("Invalid URL",Cf.ERR_INVALID_URL);const a=i[1],r=i[2],o=i[3],c=Buffer.from(decodeURIComponent(o),r?"base64":"utf8");if(t){if(!s)throw new Cf("Blob is not supported",Cf.ERR_NOT_SUPPORT);return new s([c],{type:a})}return c}throw new Cf("Unsupported protocol "+n,Cf.ERR_NOT_SUPPORT)}(e.url,"blob"===c,{Blob:e.env&&e.env.Blob})}catch(t){throw Cf.from(t,Cf.ERR_BAD_REQUEST,e)}return"text"===c?(t=t.toString(p),p&&"utf8"!==p||(s=Rf.stripBOM(t))):"stream"===c&&(t=r.Readable.from(t)),Hg(_,y,{data:t,status:200,statusText:"OK",headers:new qg,config:e})}if(-1===Av.indexOf(R))return y(new Cf("Unsupported protocol "+R,Cf.ERR_BAD_REQUEST,e));const C=qg.from(e.headers).normalize();C.set("User-Agent","axios/1.2.3",!1);const k=e.onDownloadProgress,T=e.onUploadProgress,P=e.maxRate;let E,O;if(Rf.isFormData(s)&&Rf.isFunction(s.getHeaders))C.set(s.getHeaders());else if(s&&!Rf.isStream(s)){if(Buffer.isBuffer(s));else if(Rf.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else{if(!Rf.isString(s))return y(new Cf("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Cf.ERR_BAD_REQUEST,e));s=Buffer.from(s,"utf-8")}if(C.set("Content-Length",s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return y(new Cf("Request body larger than maxBodyLength limit",Cf.ERR_BAD_REQUEST,e))}const D=Rf.toFiniteNumber(C.getContentLength());let I,j;if(Rf.isArray(P)?(E=P[0],O=P[1]):E=O=P,s&&(T||E)&&(Rf.isStream(s)||(s=r.Readable.from(s,{objectMode:!1})),s=r.pipeline([s,new Ev({length:D,maxRate:Rf.toFiniteNumber(E)})],Rf.noop),T&&s.on("progress",(e=>{T(Object.assign(e,{upload:!0}))}))),e.auth){I=(e.auth.username||"")+":"+(e.auth.password||"")}if(!I&&S.username){I=S.username+":"+S.password}I&&C.delete("authorization");try{j=Og(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const i=new Error(t.message);return i.config=e,i.url=e.url,i.exists=!0,y(i)}C.set("Accept-Encoding","gzip, compress, deflate"+(Iv?", br":""),!1);const M={path:j,method:d,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:I,protocol:R,beforeRedirect:Nv,beforeRedirects:{}};let L;e.socketPath?M.socketPath=e.socketPath:(M.hostname=S.hostname,M.port=S.port,Bv(M,e.proxy,R+"//"+S.hostname+(S.port?":"+S.port:"")+M.path));const A=Lv.test(M.protocol);if(M.agent=A?e.httpsAgent:e.httpAgent,e.transport?L=e.transport:0===e.maxRedirects?L=A?a:n:(e.maxRedirects&&(M.maxRedirects=e.maxRedirects),e.beforeRedirect&&(M.beforeRedirects.config=e.beforeRedirect),L=A?Mv:jv),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 i=[t],s=+t.headers["content-length"];if(k){const e=new Ev({length:Rf.toFiniteNumber(s),maxRate:Rf.toFiniteNumber(O)});k&&e.on("progress",(e=>{k(Object.assign(e,{download:!0}))})),i.push(e)}let n=t;const a=t.req||h;if(!1!==e.decompress&&t.headers["content-encoding"])switch("HEAD"!==d&&204!==t.statusCode||delete t.headers["content-encoding"],t.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":case"deflate":i.push(o.createUnzip(Ov)),delete t.headers["content-encoding"];break;case"br":Iv&&(i.push(o.createBrotliDecompress(Dv)),delete t.headers["content-encoding"])}n=i.length>1?r.pipeline(i,Rf.noop):i[0];const l=r.finished(n,(()=>{l(),v()})),u={status:t.statusCode,statusText:t.statusMessage,headers:new qg(t.headers),config:e,request:a};if("stream"===c)u.data=n,Hg(_,y,u);else{const t=[];let i=0;n.on("data",(function(s){t.push(s),i+=s.length,e.maxContentLength>-1&&i>e.maxContentLength&&(f=!0,n.destroy(),y(new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,a)))})),n.on("aborted",(function(){if(f)return;const t=new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,a);n.destroy(t),y(t)})),n.on("error",(function(t){h.destroyed||y(Cf.from(t,null,e,a))})),n.on("end",(function(){try{let e=1===t.length?t[0]:Buffer.concat(t);"arraybuffer"!==c&&(e=e.toString(p),p&&"utf8"!==p||(e=Rf.stripBOM(e))),u.data=e}catch(t){y(Cf.from(t,null,e,u.request,u))}Hg(_,y,u)}))}g.once("abort",(e=>{n.destroyed||(n.emit("error",e),n.destroy())}))})),g.once("abort",(e=>{y(e),h.destroy(e)})),h.on("error",(function(t){y(Cf.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 y(new Cf("error trying to parse `config.timeout` to int",Cf.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 i=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),y(new Cf(t,i.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,h)),x()}))}if(Rf.isStream(s)){let t=!1,i=!1;s.on("end",(()=>{t=!0})),s.once("error",(e=>{i=!0,h.destroy(e)})),s.on("close",(()=>{t||i||x(new Wg("Request stream has been aborted",e,h))})),s.pipe(h)}else h.end(s)}))},Uv=jg.isStandardBrowserEnv?{write:function(e,t,i,s,n,a){const r=[];r.push(e+"="+encodeURIComponent(t)),Rf.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),Rf.isString(s)&&r.push("path="+s),Rf.isString(n)&&r.push("domain="+n),!0===a&&r.push("secure"),document.cookie=r.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(){}},zv=jg.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function s(i){let s=i;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{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 i=s(window.location.href),function(e){const t=Rf.isString(e)?s(e):e;return t.protocol===i.protocol&&t.host===i.host}}():function(){return!0};function qv(e,t){let i=0;const s=Tv(50,250);return n=>{const a=n.loaded,r=n.lengthComputable?n.total:void 0,o=a-i,c=s(o);i=a;const p={loaded:a,total:r,progress:r?a/r:void 0,bytes:o,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:n};p[t?"download":"upload"]=!0,e(p)}}var $v="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){let s=e.data;const n=qg.from(e.headers).normalize(),a=e.responseType;let r;function o(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}Rf.isFormData(s)&&(jg.isStandardBrowserEnv||jg.isStandardBrowserWebWorkerEnv)&&n.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",i=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(t+":"+i))}const p=Gg(e.baseURL,e.url);function d(){if(!c)return;const s=qg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Hg((function(e){t(e),o()}),(function(e){i(e),o()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:s,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Og(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&&(i(new Cf("Request aborted",Cf.ECONNABORTED,e,c)),c=null)},c.onerror=function(){i(new Cf("Network Error",Cf.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const s=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(new Cf(t,s.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,c)),c=null},jg.isStandardBrowserEnv){const t=(e.withCredentials||zv(p))&&e.xsrfCookieName&&Uv.read(e.xsrfCookieName);t&&n.set(e.xsrfHeaderName,t)}void 0===s&&n.setContentType(null),"setRequestHeader"in c&&Rf.forEach(n.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),Rf.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",qv(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",qv(e.onUploadProgress)),(e.cancelToken||e.signal)&&(r=t=>{c&&(i(!t||t.type?new Wg(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r)));const l=Cv(p);l&&-1===jg.protocols.indexOf(l)?i(new Cf("Unsupported protocol "+l+":",Cf.ERR_BAD_REQUEST,e)):c.send(s||null)}))};const Vv={http:Fv,xhr:$v};Rf.forEach(Vv,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Wv=e=>{e=Rf.isArray(e)?e:[e];const{length:t}=e;let i,s;for(let n=0;n<t&&(i=e[n],!(s=Rf.isString(i)?Vv[i.toLowerCase()]:i));n++);if(!s){if(!1===s)throw new Cf(`Adapter ${i} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Rf.hasOwnProp(Vv,i)?`Adapter '${i}' is not available in the build`:`Unknown adapter '${i}'`)}if(!Rf.isFunction(s))throw new TypeError("adapter is not a function");return s};function Hv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wg(null,e)}function Gv(e){Hv(e),e.headers=qg.from(e.headers),e.data=$g.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Wv(e.adapter||Ag.adapter)(e).then((function(t){return Hv(e),t.data=$g.call(e,e.transformResponse,t),t.headers=qg.from(t.headers),t}),(function(t){return Vg(t)||(Hv(e),t&&t.response&&(t.response.data=$g.call(e,e.transformResponse,t.response),t.response.headers=qg.from(t.response.headers))),Promise.reject(t)}))}const Kv=e=>e instanceof qg?e.toJSON():e;function Jv(e,t){t=t||{};const i={};function s(e,t,i){return Rf.isPlainObject(e)&&Rf.isPlainObject(t)?Rf.merge.call({caseless:i},e,t):Rf.isPlainObject(t)?Rf.merge({},t):Rf.isArray(t)?t.slice():t}function n(e,t,i){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:s(void 0,e,i):s(e,t,i)}function a(e,t){if(!Rf.isUndefined(t))return s(void 0,t)}function r(e,t){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:s(void 0,e):s(void 0,t)}function o(i,n,a){return a in t?s(i,n):a in e?s(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(e,t)=>n(Kv(e),Kv(t),!0)};return Rf.forEach(Object.keys(e).concat(Object.keys(t)),(function(s){const a=c[s]||n,r=a(e[s],t[s],s);Rf.isUndefined(r)&&a!==o||(i[s]=r)})),i}const Qv={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Qv[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Yv={};Qv.transitional=function(e,t,i){function s(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,n,a)=>{if(!1===e)throw new Cf(s(n," has been removed"+(t?" in "+t:"")),Cf.ERR_DEPRECATED);return t&&!Yv[n]&&(Yv[n]=!0,console.warn(s(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,n,a)}};var Xv={assertOptions:function(e,t,i){if("object"!=typeof e)throw new Cf("options must be an object",Cf.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const a=s[n],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new Cf("option "+a+" must be "+i,Cf.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new Cf("Unknown option "+a,Cf.ERR_BAD_OPTION)}},validators:Qv};const Zv=Xv.validators;class eb{constructor(e){this.defaults=e,this.interceptors={request:new Dg,response:new Dg}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Jv(this.defaults,t);const{transitional:i,paramsSerializer:s,headers:n}=t;let a;void 0!==i&&Xv.assertOptions(i,{silentJSONParsing:Zv.transitional(Zv.boolean),forcedJSONParsing:Zv.transitional(Zv.boolean),clarifyTimeoutError:Zv.transitional(Zv.boolean)},!1),void 0!==s&&Xv.assertOptions(s,{encode:Zv.function,serialize:Zv.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=n&&Rf.merge(n.common,n[t.method]),a&&Rf.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=qg.concat(a,n);const r=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.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=[Gv.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),d=e.length,p=Promise.resolve(t);l<d;)p=p.then(e[l++],e[l++]);return p}d=r.length;let u=t;for(l=0;l<d;){const e=r[l++],t=r[l++];try{u=e(u)}catch(e){t.call(this,e);break}}try{p=Gv.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 Og(Gg((e=Jv(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Rf.forEach(["delete","get","head","options"],(function(e){eb.prototype[e]=function(t,i){return this.request(Jv(i||{},{method:e,url:t,data:(i||{}).data}))}})),Rf.forEach(["post","put","patch"],(function(e){function t(t){return function(i,s,n){return this.request(Jv(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:s}))}}eb.prototype[e]=t(),eb.prototype[e+"Form"]=t(!0)}));class tb{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 i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const s=new Promise((e=>{i.subscribe(e),t=e})).then(e);return s.cancel=function(){i.unsubscribe(t)},s},e((function(e,s,n){i.reason||(i.reason=new Wg(e,s,n),t(i.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 tb((function(t){e=t})),cancel:e}}}const ib={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(ib).forEach((([e,t])=>{ib[t]=e}));const sb=function e(t){const i=new eb(t),s=Kh(eb.prototype.request,i);return Rf.extend(s,eb.prototype,i,{allOwnKeys:!0}),Rf.extend(s,i,null,{allOwnKeys:!0}),s.create=function(i){return e(Jv(t,i))},s}(Ag);sb.Axios=eb,sb.CanceledError=Wg,sb.CancelToken=tb,sb.isCancel=Vg,sb.VERSION="1.2.3",sb.toFormData=Cg,sb.AxiosError=Cf,sb.Cancel=sb.CanceledError,sb.all=function(e){return Promise.all(e)},sb.spread=function(e){return function(t){return e.apply(null,t)}},sb.isAxiosError=function(e){return Rf.isObject(e)&&!0===e.isAxiosError},sb.mergeConfig=Jv,sb.AxiosHeaders=qg,sb.formToJSON=e=>Mg(Rf.isHTMLForm(e)?new FormData(e):e),sb.HttpStatusCode=ib,sb.default=sb;class nb{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 ab(t,i){return e.ok(t,`${i} is required`),t}function rb(t,i){return e.ok("boolean"==typeof t,`${i}<boolean> is required`),t}function ob(t,i){return e.ok("number"==typeof t,`${i}<number> is required`),t}function cb(t,i){return e.ok("string"==typeof t,`${i}<string> is required`),t}function pb(t,i,s){const n=s||i.name[0].toLowerCase()+i.name.substring(1);return e.ok(t instanceof i,`${n}<${i.name}> is required`),t}function db(t,i="roomName"){return cb(t,i),e.equal("string"==typeof t&&t[0],"/",`${i} must begin with a '/'`),t}function lb(t,i){return e.ok(Array.isArray(t),`${i}<array> is required`),t}function ub(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 mb(t,i,s){cb(i,"name"),function(t,i,s,n){cb(s,"name");const a=n||`${s} must be null or of type ${i}`;e.ok(null===t||typeof t===i,a)}(t,"string",i,s)}function hb({baseUrl:t,url:i}){return e.ok("string"==typeof i,"url<String> is required"),t?t+i:i}class fb{constructor({baseUrl:e}){cb(e,"baseUrl"),this._baseUrl=e}_requestAxios(e,t){const i=Object.assign({},t,{url:e,baseURL:this._baseUrl});return sb.request(i)}request(t,i){return cb(t,"url"),e.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(i,"options are required"),this._requestAxios(t,i).then((e=>{const{data:t,headers:i,status:s,statusText:n,config:a}=e,r=a&&a.url?hb({baseUrl:a.baseURL,url:a.url}):null;return new nb({data:t,headers:i,status:s,statusText:n,url:r})})).catch((e=>{const t=e.response;if(!t)throw new Error("Could not make the request.");const{data:i,headers:s,status:n,statusText:a,config:r}=t,o=r&&r.url?hb({baseUrl:r.baseURL,url:r.url}):null;return Promise.reject(new nb({data:i,headers:s,status:n,statusText:a,url:o}))}))}}class gb{constructor({httpClient:t}){e.ok(t,"httpClient is required"),this._httpClient=t}static dataToFormData(t){e.ok(t,"data is required");const i=new FormData;return Object.keys(t).forEach((e=>{const s=t[e];i.append(e,s)})),i}request(e,t={}){const i=Object.assign(t.headers||{},{"Content-Type":void 0});return this._httpClient.request(e,Object.assign(t,{headers:i,transformRequest:gb.dataToFormData}))}}let vb;vb="object"==typeof window?window.btoa||Gh:"object"==typeof global&&global.btoa||Gh;const bb=()=>Promise.resolve(null);class _b{constructor({httpClient:e,fetchDeviceCredentials:t}){this._httpClient=e,this._fetchDeviceCredentials=t}request(e,t){return this._fetchDeviceCredentials().then((i=>{const s=Object.assign({},t.headers,function(e){if(e&&e.credentials){const t=`${e.credentials.uuid}:${e.hmac}`;return{Authorization:`Basic ${vb(t)}`}}return{}}(i),{"X-Appearin-Device-Platform":"web"}),n=Object.assign({},t,{headers:s});return this._httpClient.request(e,n)}))}}class yb{constructor({baseUrl:t="https://api.appearin.net",fetchDeviceCredentials:i=bb}={}){cb(t,"baseUrl"),e.ok("function"==typeof i,"fetchDeviceCredentials<Function> is required"),this.authenticatedHttpClient=new _b({httpClient:new fb({baseUrl:t}),fetchDeviceCredentials:i}),this.authenticatedFormDataHttpClient=new gb({httpClient:this.authenticatedHttpClient})}request(t,i){return cb(t,"url"),e.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(i,"options are required"),this.authenticatedHttpClient.request(t,i)}requestMultipart(t,i){return cb(t,"url"),e.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(i,"options are required"),this.authenticatedFormDataHttpClient.request(t,i)}}function xb(e,t){return cb(ub(e,"data")[t],t)}const wb=(Sb=xb,(e,t)=>{const i=ub(e,"data")[t];return null==i?null:Sb(e,t)});var Sb;function Rb(e,t){const i=xb(e,t),s=new Date(i);if(isNaN(s.getTime()))throw new Error(`Invalid date for ${i}`);return s}function Cb(e,t,i){return function(e,t){return lb(ub(e,"data")[t],t)}(e,t).map((e=>i(e)))}class kb{constructor(e,t,i){this.credentials={uuid:e},this.hmac=t,this.userId=i}toJson(){return Object.assign({credentials:this.credentials,hmac:this.hmac},this.userId&&{userId:this.userId})}static fromJson(e){return new kb(xb(function(e,t){const i=ub(e,"data")[t];return void 0===i?null:i}(e,"credentials"),"uuid"),xb(e,"hmac"),wb(e,"userId")||void 0)}}class Tb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}getCredentials(){return this._apiClient.request("/devices",{method:"post"}).then((({data:e})=>kb.fromJson(e))).catch((e=>{if(e.response&&404===e.response.status)return null;throw e}))}}class Pb{constructor(e,t){this._key=e,this._chromeStorage=t}loadOrDefault(e){return new Promise((t=>{this._chromeStorage.get(this._key,(i=>{t(i[this._key]||e)}))}))}save(e){return new Promise((t=>{this._chromeStorage.set({[this._key]:e},(()=>{t()}))}))}}class Eb{constructor(e,t){ab(t,"localStorage"),this._key=cb(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 Ob;try{Ob=self.localStorage}catch(e){Ob={getItem:()=>{},key:()=>{},setItem:()=>{},removeItem:()=>{},hasOwnProperty:()=>{},length:0}}var Db=Ob;const Ib="credentials_saved";class jb extends l{constructor({deviceService:e,credentialsStore:t}){super(),this._deviceService=pb(e,Tb),this._credentialsStore=t}static create({baseUrl:e,storeName:t="CredentialsStorage",storeType:i="localStorage"}){const s=new Tb({apiClient:new yb({baseUrl:e})});let n=null;if("localStorage"===i)n=new Eb(t,Db);else{if("chromeStorage"!==i)throw new Error(`Unknown store type: ${i}`);n=new Pb(t,window.chrome.storage.local)}return new jb({deviceService:s,credentialsStore:n})}_fetchNewCredentialsFromApi(){const e=this._credentialsStore;return new Promise((t=>{const i=()=>{this._deviceService.getCredentials().then((i=>e.save(i?i.toJson():null).then((()=>t(i))))).catch((()=>{setTimeout(i,2e3)}))};i()}))}getCurrentCredentials(){return this._credentialsStore.loadOrDefault(null).then((e=>e?kb.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(Ib,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 Mb=()=>Promise.resolve(void 0);class Lb{constructor({apiClient:t,fetchOrganization:i=Mb}){this._apiClient=pb(t,yb),e.ok("function"==typeof i,"fetchOrganization<Function> is required"),this._fetchOrganization=i,this._apiClient=t}_callRequestMethod(t,i,s){return cb(i,"url"),e.equal(i[0],"/",'url<String> only accepts relative URLs beginning with "/".'),e.ok(s,"options are required"),this._fetchOrganization().then((e=>{if(!e)return this._apiClient[t](i,s);const{organizationId:n}=e;return this._apiClient[t](`/organizations/${encodeURIComponent(n)}${i}`,s)}))}request(e,t){return this._callRequestMethod("request",e,t)}requestMultipart(e,t){return this._callRequestMethod("requestMultipart",e,t)}}class Ab{constructor({isExhausted:e,renewsAt:t,totalMinutesLimit:i,totalMinutesUsed:s}){this.isExhausted=e,this.renewsAt=t,this.totalMinutesLimit=i,this.totalMinutesUsed=s}static fromJson(e){return new Ab({isExhausted:rb(e.isExhausted,"isExhausted"),renewsAt:new Date(cb(e.renewsAt,"renewsAt")),totalMinutesLimit:ob(e.totalMinutesLimit,"totalMinutesLimit"),totalMinutesUsed:ob(e.totalMinutesUsed,"totalMinutesUsed")})}}class Nb{constructor({basePlanId:e,embeddedFreeTierStatus:t,isDeactivated:i,isOnTrial:s,onTrialUntil:n,trialStatus:a}){this.basePlanId=e,this.isDeactivated=i,this.isOnTrial=s,this.onTrialUntil=n||null,this.trialStatus=a||null,this.embeddedFreeTierStatus=t||null}static fromJson(e){return new Nb({basePlanId:"string"==typeof e.basePlanId?e.basePlanId:null,isDeactivated:rb(e.isDeactivated,"isDeactivated"),isOnTrial:rb(e.isOnTrial,"isOnTrial"),onTrialUntil:"string"==typeof e.onTrialUntil?new Date(e.onTrialUntil):null,trialStatus:"string"==typeof e.trialStatus?e.trialStatus:null,embeddedFreeTierStatus:e.embeddedFreeTierStatus?Ab.fromJson(e.embeddedFreeTierStatus):null})}}function Bb(e){return null!=e}function Fb(e={}){return{maxNumberOfInvitationsAndUsers:Bb(null==e?void 0:e.maxNumberOfInvitationsAndUsers)?Number(null==e?void 0:e.maxNumberOfInvitationsAndUsers):null,maxNumberOfClaimedRooms:Bb(null==e?void 0:e.maxNumberOfClaimedRooms)?Number(null==e?void 0:e.maxNumberOfClaimedRooms):null,maxRoomLimitPerOrganization:Bb(null==e?void 0:e.maxRoomLimitPerOrganization)?Number(null==e?void 0:e.maxRoomLimitPerOrganization):null,trialMinutesLimit:Bb(null==e?void 0:e.trialMinutesLimit)?Number(null==e?void 0:e.trialMinutesLimit):null,includedUnits:Bb(null==e?void 0:e.includedUnits)?Number(null==e?void 0:e.includedUnits):null}}class Ub{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,pb(e,Object,"properties"),cb(e.organizationId,"organizationId"),cb(e.organizationName,"organizationName"),cb(e.subdomain,"subdomain"),pb(e.permissions,Object,"permissions"),pb(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 Nb(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=pb(e,Object,"data"),i=(null==t?void 0:t.preferences)||{},s=(null==t?void 0:t.onboardingSurvey)||null,n=pb(t.permissions,Object,"permissions");return new Ub({organizationId:cb(t.organizationId,"organizationId"),organizationName:cb(t.organizationName,"organizationName"),subdomain:cb(t.subdomain,"subdomain"),permissions:n,limits:Fb(pb(t.limits,Object,"limits")),account:t.account?Nb.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:i,onboardingSurvey:s,type:"string"==typeof t.type?t.type:null})}}Ub.GLOBAL_ORGANIZATION_ID="1";class zb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}createOrganization({organizationName:t,subdomain:i,owner:s}){const{displayName:n,consents:a}=s||{},r="email"in s?{value:s.email,verificationCode:cb(s.verificationCode,"owner.verificationCode")}:null,o="idToken"in s?s.idToken:null;if(cb(i,"subdomain"),cb(t,"organizationName"),cb(n,"owner.displayName"),e.ok(r||o,"owner.email or owner.idToken is required"),a){lb(a,"consents");for(const{consentRevisionId:e,action:t}of a)cb(e,"consentRevisionId"),mb(t,"action")}return this._apiClient.request("/organizations",{method:"POST",data:{organizationName:t,type:"private",subdomain:i,owner:Object.assign(Object.assign(Object.assign(Object.assign({},r&&{email:r}),o&&{idToken:o}),a&&{consents:a}),{displayName:n})}}).then((({data:e})=>xb(e,"organizationId")))}getOrganizationBySubdomain(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/?fields=permissions,account,onboardingSurvey`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof nb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationByOrganizationId(e){return cb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}?fields=permissions,account`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof nb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationsByContactPoint(t){const{code:i}=t,s="email"in t?t.email:null,n="phoneNumber"in t?t.phoneNumber:null;e.ok((s||n)&&!(s&&n),"either email or phoneNumber is required"),cb(i,"code");const a=s?{type:"email",value:s}:{type:"phoneNumber",value:n};return this._apiClient.request("/organization-queries",{method:"POST",data:{contactPoint:a,code:i}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(e)))))}getOrganizationsByIdToken({idToken:e}){return cb(e,"idToken"),this._apiClient.request("/organization-queries",{method:"POST",data:{idToken:e}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getOrganizationsByLoggedInUser(){return this._apiClient.request("/user/organizations",{method:"GET"}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getSubdomainAvailability(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/availability`,{method:"GET"}).then((({data:e})=>(pb(e,Object,"data"),{status:xb(e,"status")})))}updatePreferences({organizationId:e,preferences:t}){return ab(e,"organizationId"),ab(t,"preferences"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}deleteOrganization({organizationId:e}){return ab(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}`,{method:"DELETE"}).then((()=>{}))}}class qb{constructor({organizationService:e,subdomain:t}){pb(e,zb),cb(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 $b{constructor(t={}){e.ok(t 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 i={};Object.getOwnPropertyNames(t).forEach((e=>{-1!==Object.getOwnPropertyNames(this).indexOf(e)&&(i[e]=t[e])})),void 0!==t.ownerId&&(this.ownerId=t.ownerId),void 0!==t.meeting&&(this.meeting=t.meeting),Object.assign(this,i)}}class Vb{constructor({meetingId:e,roomName:t,roomUrl:i,startDate:s,endDate:n,hostRoomUrl:a,viewerRoomUrl:r}){cb(e,"meetingId"),cb(t,"roomName"),cb(i,"roomUrl"),pb(s,Date,"startDate"),pb(n,Date,"endDate"),this.meetingId=e,this.roomName=t,this.roomUrl=i,this.startDate=s,this.endDate=n,this.hostRoomUrl=a,this.viewerRoomUrl=r}static fromJson(e){return new Vb({meetingId:xb(e,"meetingId"),roomName:xb(e,"roomName"),roomUrl:xb(e,"roomUrl"),startDate:Rb(e,"startDate"),endDate:Rb(e,"endDate"),hostRoomUrl:wb(e,"hostRoomUrl"),viewerRoomUrl:wb(e,"viewerRoomUrl")})}}function Wb(e,t=""){return`/room/${encodeURIComponent(e.substring(1))}${t}`}class Hb{constructor({organizationApiClient:e}){this._organizationApiClient=pb(e,Lb)}getRooms({types:e,fields:t=[]}={}){return lb(e,"types"),lb(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 $b(e)))))}getRoom({roomName:e,fields:t}){db(e);const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/rooms/${i}`,{method:"GET",params:Object.assign({includeOnlyLegacyRoomType:"false"},t&&{fields:t.join(",")})}).then((({data:t})=>new $b(Object.assign({},t,Object.assign({roomName:e},t.meeting&&{meeting:Vb.fromJson(t.meeting)}))))).catch((t=>{if(404===t.status)return new $b({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 $b({roomName:e,isBanned:!0});throw new Error(t.data?t.data.error:"Could not fetch room information")}))}claimRoom({roomName:e,type:t,mode:i,isLocked:s}){return db(e),cb(t,"type"),this._organizationApiClient.request("/room/claim",{method:"POST",data:Object.assign(Object.assign({roomName:e,type:t},"string"==typeof i&&{mode:i}),"boolean"==typeof s&&{isLocked:s})}).then((()=>{})).catch((e=>{throw new Error(e.data.error||"Failed to claim room")}))}unclaimRoom(e){db(e);const t=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${t}`,{method:"DELETE"}).then((()=>{}))}renameRoom({roomName:e,newRoomName:t}){db(e),cb(t,"newRoomName");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/roomName`,{method:"PUT",data:{newRoomName:t}}).then((()=>{}))}changeMode({roomName:e,mode:t}){db(e),cb(t,"mode");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/mode`,{method:"PUT",data:{mode:t}}).then((()=>{}))}updatePreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}updateProtectedPreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/protected-preferences`,{method:"PATCH",data:t}).then((()=>{}))}getRoomPermissions(e,{roomKey:t}={}){return db(e),this._organizationApiClient.request(Wb(e,"/permissions"),Object.assign({method:"GET"},t&&{headers:{"X-Whereby-Room-Key":t}})).then((e=>{const{permissions:t,limits:i}=e.data;return{permissions:t,limits:i}}))}getRoomMetrics({roomName:e,metrics:t,from:i,to:s}){return db(e),cb(t,"metrics"),this._organizationApiClient.request(Wb(e,"/metrics"),{method:"GET",params:{metrics:t,from:i,to:s}}).then((e=>e.data))}changeType({roomName:e,type:t}){db(e),function(e,t,i){if(ab(e,"value"),lb(t,"allowedValues"),!t.includes(e))throw new Error(`${i}<string> must be one of the following: ${t.join(", ")}`)}(t,["personal","personal_xl"],"type");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/type`,{method:"PUT",data:{type:t}}).then((()=>{}))}getForestSocialImage({roomName:e,count:t}){return db(e),ob(t,"count"),this._organizationApiClient.request(Wb(e,`/forest-social-image/${t}`),{method:"GET"}).then((e=>e.data.imageUrl))}}class Gb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:s,isVideoEnabled:n}){this.isLocalParticipant=!1,this.displayName=e,this.id=t,this.stream=i,this.isAudioEnabled=s,this.isVideoEnabled=n}}class Kb extends Gb{constructor({displayName:e,id:t,newJoiner:i,streams:s,isAudioEnabled:n,isVideoEnabled:a}){super({displayName:e,id:t,isAudioEnabled:n,isVideoEnabled:a}),this.newJoiner=i,this.streams=s.map((e=>({id:e,state:i?"new_accept":"to_accept"})))}addStream(e,t){this.streams.push({id:e,state:t})}removeStream(e){const t=this.streams.findIndex((t=>t.id===e));-1!==t&&this.streams.splice(t,1)}updateStreamState(e,t){const i=this.streams.find((t=>t.id===e));i&&(i.state=t)}}class Jb extends Gb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:s,isVideoEnabled:n}){super({displayName:e,id:t,stream:i,isAudioEnabled:s,isVideoEnabled:n}),this.isLocalParticipant=!0}}const Qb=process.env.REACT_APP_API_BASE_URL||"https://api.whereby.dev",Yb=process.env.REACT_APP_SIGNAL_BASE_URL||"wss://signal.appearin.net",Xb=["recorder","streamer"],Zb=new Map;const e_=()=>{},t_=EventTarget;class i_ extends t_{constructor(e,{displayName:t,localMedia:i,localMediaConstraints:s,logger:n,roomKey:a}){super(),this.localParticipant=null,this.remoteParticipants=[],this.screenshares=[],this._deviceCredentials=null,this._ownsLocalMedia=!1,this.organizationId="",this.roomConnectionStatus="",this.selfId=null,this.roomUrl=new URL(e);const r=new URLSearchParams(this.roomUrl.search);this._roomKey=a||r.get("roomKey"),this.roomName=this.roomUrl.pathname,this.logger=n||{debug:e_,error:e_,log:e_,warn:e_},this.displayName=t,this.localMediaConstraints=s;const o=Hh({host:this.roomUrl.host});if(i)this.localMedia=i;else{if(!s)throw new Error("Missing constraints");this.localMedia=new fi(s),this._ownsLocalMedia=!0}this.credentialsService=jb.create({baseUrl:Qb}),this.apiClient=new yb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:Qb}),this.organizationService=new zb({apiClient:this.apiClient}),this.organizationServiceCache=new qb({organizationService:this.organizationService,subdomain:o.subdomain}),this.organizationApiClient=new Lb({apiClient:this.apiClient,fetchOrganization:()=>Zt(this,void 0,void 0,(function*(){return(yield this.organizationServiceCache.fetchOrganization())||void 0}))}),this.roomService=new Hb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL(Yb),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v4`,i=e.origin;return new po(i,{autoConnect:!1,host:i,path:t,reconnectionDelay:5e3,reconnectionDelayMax:3e4,timeout:1e4,withCredentials:!0})}(),this.signalSocket.on("new_client",this._handleNewClient.bind(this)),this.signalSocket.on("chat_message",this._handleNewChatMessage.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)),this.signalSocket.on("knock_handled",this._handleKnockHandled.bind(this)),this.signalSocket.on("knocker_left",this._handleKnockerLeft.bind(this)),this.signalSocket.on("room_joined",this._handleRoomJoined.bind(this)),this.signalSocket.on("room_knocked",this._handleRoomKnocked.bind(this)),this.signalSocket.on("cloud_recording_stopped",this._handleCloudRecordingStopped.bind(this)),this.signalSocket.on("screenshare_started",this._handleScreenshareStarted.bind(this)),this.signalSocket.on("screenshare_stopped",this._handleScreenshareStopped.bind(this)),this.signalSocket.on("streaming_stopped",this._handleStreamingStopped.bind(this)),this.signalSocket.on("disconnect",this._handleDisconnect.bind(this)),this.signalSocket.on("connect_error",this._handleDisconnect.bind(this)),this.signalSocketManager=this.signalSocket.getManager(),this.signalSocketManager.on("reconnect",this._handleReconnect.bind(this)),this.localMedia.addEventListener("camera_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_video",{enabled:t})})),this.localMedia.addEventListener("microphone_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_audio",{enabled:t})}));const c={getMediaConstraints:()=>({audio:this.localMedia.isMicrophoneEnabled(),video:this.localMedia.isCameraEnabled()}),deferrable:e=>!e};this.rtcManagerDispatcher=new Vh({emitter:{emit:this._handleRtcEvent.bind(this)},serverSocket:this.signalSocket,webrtcProvider:c,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}})}get roomKey(){return this._roomKey}_handleNewChatMessage(e){this.dispatchEvent(new CustomEvent("chat_message",{detail:e}))}_handleCloudRecordingStarted({client:e}){this.dispatchEvent(new CustomEvent("cloud_recording_started",{detail:{status:"recording",startedAt:e.startedCloudRecordingAt?new Date(e.startedCloudRecordingAt).getTime():(new Date).getTime()}}))}_handleStreamingStarted(){this.dispatchEvent(new CustomEvent("streaming_started",{detail:{status:"streaming",startedAt:(new Date).getTime()}}))}_handleNewClient({client:e}){if("recorder"===e.role.roleName&&this._handleCloudRecordingStarted({client:e}),"streamer"===e.role.roleName&&this._handleStreamingStarted(),Xb.includes(e.role.roleName))return;const t=new Kb(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 i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_audio_enabled",{detail:{participantId:i.id,isAudioEnabled:t}}))}_handleClientVideoEnabled({clientId:e,isVideoEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_video_enabled",{detail:{participantId:i.id,isVideoEnabled:t}}))}_handleClientMetadataReceived({payload:{clientId:e,displayName:t}}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_metadata_changed",{detail:{participantId:i.id,displayName:t}}))}_handleKnockHandled(e){const{clientId:t,resolution:i}=e;t===this.selfId&&("accepted"===i?(this.roomConnectionStatus="accepted",this._roomKey=e.metadata.roomKey,this._joinRoom()):"rejected"===i&&(this.roomConnectionStatus="rejected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}))))}_handleKnockerLeft(e){const{clientId:t}=e;this.dispatchEvent(new CustomEvent("waiting_participant_left",{detail:{participantId:t}}))}_handleRoomJoined(e){const{error:t,isLocked:i,room:s,selfId:n}=e;if(this.selfId=n,"room_locked"===t&&i)return this.roomConnectionStatus="room_locked",void this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));if(s){const{clients:e,knockers:t}=s,i=e.find((e=>e.id===n));if(!i)throw new Error("Missing local client");this.localParticipant=new Jb(Object.assign(Object.assign({},i),{stream:this.localMedia.stream||void 0}));const a=e.find((e=>"recorder"===e.role.roleName));a&&this._handleCloudRecordingStarted({client:a});e.find((e=>"streamer"===e.role.roleName))&&this._handleStreamingStarted(),this.remoteParticipants=e.filter((e=>e.id!==n)).filter((e=>!Xb.includes(e.role.roleName))).map((e=>new Kb(Object.assign(Object.assign({},e),{newJoiner:!1})))),this.roomConnectionStatus="connected",this.dispatchEvent(new CustomEvent("room_joined",{detail:{localParticipant:this.localParticipant,remoteParticipants:this.remoteParticipants,waitingParticipants:t.map((e=>({id:e.clientId,displayName:e.displayName})))}}))}}_handleRoomKnocked(e){const{clientId:t,displayName:i}=e;this.dispatchEvent(new CustomEvent("waiting_participant_joined",{detail:{participantId:t,displayName:i}}))}_handleReconnect(){this.logger.log("Reconnected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}_handleDisconnect(){this.roomConnectionStatus="disconnected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}))}_handleCloudRecordingStopped(){this.dispatchEvent(new CustomEvent("cloud_recording_stopped"))}_handleStreamingStopped(){this.dispatchEvent(new CustomEvent("streaming_stopped"))}_handleScreenshareStarted(e){const{clientId:t,streamId:i,hasAudioTrack:s}=e,n=this.remoteParticipants.find((e=>e.id===t));if(!n)return void this.logger.log("WARN: Could not find participant for screenshare");this.screenshares.find((e=>e.id===i))?this.logger.log("WARN: Screenshare already exists"):(n.addStream(i,"to_accept"),this._handleAcceptStreams([n]),this.screenshares=[...this.screenshares,{participantId:t,id:i,hasAudioTrack:s,stream:void 0,isLocal:!1}])}_handleScreenshareStopped(e){const{clientId:t,streamId:i}=e,s=this.remoteParticipants.find((e=>e.id===t));s?(s.removeStream(i),this.screenshares=this.screenshares.filter((e=>!(e.participantId===t&&e.id===i))),this.dispatchEvent(new CustomEvent("screenshare_stopped",{detail:{participantId:t,id:i}}))):this.logger.log("WARN: Could not find participant for screenshare")}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):"rtc_manager_destroyed"===e?this._handleRtcManagerDestroyed():void this.logger.log(`Unhandled RTC event ${e}`)}_handleRtcManagerCreated({rtcManager:e}){var t;this.rtcManager=e,this.localMedia.addRtcManager(e),this.localMedia.stream&&(null===(t=this.rtcManager)||void 0===t||t.addNewStream("0",this.localMedia.stream,!this.localMedia.isMicrophoneEnabled(),!this.localMedia.isCameraEnabled())),this.remoteParticipants.length&&this._handleAcceptStreams(this.remoteParticipants)}_handleRtcManagerDestroyed(){this.rtcManager=void 0}_handleAcceptStreams(e){var t,i;if(!this.rtcManager)return void this.logger.log("Unable to accept streams, no rtc manager");const s=null===(i=(t=this.rtcManager).shouldAcceptStreamsFromBothSides)||void 0===i?void 0:i.call(t);e.forEach((e=>{const{id:t,streams:i,newJoiner:n}=e;i.forEach((i=>{var a,r;const{id:o,state:c}=i;let p;if("done_accept"!==c&&(p=(n&&"0"===o?"new":"to")+"_accept"),p){if("to_accept"===p||"new_accept"===p&&s||"old_accept"===p&&!s)this.logger.log(`Accepting stream ${o} from ${t}`),null===(a=this.rtcManager)||void 0===a||a.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===(r=this.rtcManager)||void 0===r||r.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(e){const t=function(e,{clientId:t,stream:i,streamId:s,streamType:n}){s||(s=i.id);const a=e.find((e=>e.id===t));if(!a)return;const r=a.streams.find((e=>e.id===s))||a.streams[0];return a.stream&&a.stream.id===s||!a.stream&&"webcam"===n||!a.stream&&!n&&a.streams.indexOf(r)<1?new CustomEvent("participant_stream_added",{detail:{participantId:t,stream:i,streamId:s}}):new CustomEvent("screenshare_started",{detail:{participantId:t,stream:i,id:s,isLocal:!1}})}(this.remoteParticipants,e);t&&this.dispatchEvent(t)}_joinRoom(){this.signalSocket.emit("join_room",{avatarUrl:null,config:{isAudioEnabled:this.localMedia.isMicrophoneEnabled(),isVideoEnabled:this.localMedia.isCameraEnabled()},deviceCapabilities:{canScreenshare:!0},displayName:this.displayName,isCoLocated:!1,isDevicePermissionDenied:!1,kickFromOtherRooms:!1,organizationId:this.organizationId,roomKey:this.roomKey,roomName:this.roomName,selfId:"",userAgent:`browser-sdk:${o_}`})}join(){return Zt(this,void 0,void 0,(function*(){if(["connected","connecting"].includes(this.roomConnectionStatus))return void console.warn(`Trying to join when room state is already ${this.roomConnectionStatus}`);this.logger.log("Joining room"),this.signalSocket.connect(),this.roomConnectionStatus="connecting",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));const e=yield this.organizationServiceCache.fetchOrganization();if(!e)throw new Error("Invalid room url");this.organizationId=e.organizationId,this._ownsLocalMedia&&(yield this.localMedia.start()),this._deviceCredentials=yield this.credentialsService.getCredentials(),this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}))}knock(){this.roomConnectionStatus="knocking",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}})),this.signalSocket.emit("knock_room",{displayName:this.displayName,imageUrl:null,kickFromOtherRooms:!0,liveVideo:!1,organizationId:this.organizationId,roomKey:this._roomKey,roomName:this.roomName})}leave(){this.roomConnectionStatus="disconnecting",this._ownsLocalMedia&&this.localMedia.stop(),this.rtcManager&&(this.localMedia.removeRtcManager(this.rtcManager),this.rtcManager.disconnectAll(),this.rtcManager=void 0),this.signalSocket&&(this.signalSocket.emit("leave_room"),this.signalSocket.disconnect(),this.roomConnectionStatus="disconnected")}sendChatMessage(e){this.signalSocket.emit("chat_message",{text:e})}setDisplayName(e){this.signalSocket.emit("send_client_metadata",{type:"UserData",payload:{displayName:e}})}acceptWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"accept",clientId:e,response:{}})}rejectWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"reject",clientId:e,response:{}})}updateStreamResolution({streamId:e,width:t,height:i}){var s,n;if(!e||!this.rtcManager)return;if((null===(n=null===(s=this.localParticipant)||void 0===s?void 0:s.stream)||void 0===n?void 0:n.id)===e)return;const a=Zb.get(e);a&&a.width===t&&a.height===i||this.rtcManager.updateStreamResolution(e,null,{width:t||1,height:i||1}),Zb.set(e,{width:t,height:i})}startScreenshare(){var e;return Zt(this,void 0,void 0,(function*(){const t=this.localMedia.screenshareStream||(yield this.localMedia.startScreenshare());null===(e=this.rtcManager)||void 0===e||e.addNewStream(t.id,t,!1,!0),this.screenshares=[...this.screenshares,{participantId:this.selfId||"",id:t.id,hasAudioTrack:!1,stream:t,isLocal:!0}],this.dispatchEvent(new CustomEvent("screenshare_started",{detail:{participantId:this.selfId||"",id:t.id,hasAudioTrack:!1,stream:t,isLocal:!0}}))}))}stopScreenshare(){var e;if(this.localMedia.screenshareStream){const{id:t}=this.localMedia.screenshareStream;null===(e=this.rtcManager)||void 0===e||e.removeStream(t,this.localMedia.screenshareStream,null),this.screenshares=this.screenshares.filter((e=>e.id!==t)),this.dispatchEvent(new CustomEvent("screenshare_stopped",{detail:{participantId:this.selfId,id:t}})),this.localMedia.stopScreenshare()}}}const s_={chatMessages:[],cloudRecording:{status:"",startedAt:null},isJoining:!1,isStartingScreenshare:!1,joinError:null,startScreenshareError:null,mostRecentChatMessage:null,remoteParticipants:[],roomConnectionStatus:"",screenshares:[],streaming:{status:"",startedAt:null},waitingParticipants:[]};function n_(e,t,i){const s=e.find((e=>e.id===t));if(!s)return e;const n=e.indexOf(s);return[...e.slice(0,n),Object.assign(Object.assign({},s),i),...e.slice(n+1)]}function a_(e,t){switch(t.type){case"CHAT_MESSAGE":return Object.assign(Object.assign({},e),{chatMessages:[...e.chatMessages,t.payload],mostRecentChatMessage:t.payload});case"CLOUD_RECORDING_STARTED":return Object.assign(Object.assign({},e),{cloudRecording:{status:t.payload.status,startedAt:t.payload.startedAt}});case"CLOUD_RECORDING_STOPPED":return Object.assign(Object.assign({},e),{cloudRecording:{status:"",startedAt:null}});case"ROOM_JOINED":return Object.assign(Object.assign({},e),{localParticipant:t.payload.localParticipant,remoteParticipants:t.payload.remoteParticipants,waitingParticipants:t.payload.waitingParticipants,roomConnectionStatus:"connected"});case"ROOM_CONNECTION_STATUS_CHANGED":return Object.assign(Object.assign({},e),{roomConnectionStatus:t.payload.roomConnectionStatus});case"PARTICIPANT_AUDIO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(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:n_(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(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;case"SCREENSHARE_STARTED":return Object.assign(Object.assign({},e),{screenshares:(i=e.screenshares,s={participantId:t.payload.participantId,id:t.payload.id,hasAudioTrack:t.payload.hasAudioTrack,stream:t.payload.stream,isLocal:t.payload.isLocal},i.find((e=>e.id===s.id))?i:[...i,s])});case"SCREENSHARE_STOPPED":return Object.assign(Object.assign({},e),{screenshares:e.screenshares.filter((e=>e.id!==t.payload.id))});case"LOCAL_SCREENSHARE_START_ERROR":return Object.assign(Object.assign({},e),{isStartingScreenshare:!1,startScreenshareError:t.payload});case"LOCAL_SCREENSHARE_STARTING":return Object.assign(Object.assign({},e),{isStartingScreenshare:!0});case"LOCAL_SCREENSHARE_STOPPED":return Object.assign(Object.assign({},e),{screenshares:e.screenshares.filter((e=>!e.isLocal))});case"STREAMING_STARTED":return Object.assign(Object.assign({},e),{streaming:{status:t.payload.status,startedAt:t.payload.startedAt}});case"STREAMING_STOPPED":return Object.assign(Object.assign({},e),{streaming:{status:"",startedAt:null}});case"WAITING_PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{waitingParticipants:[...e.waitingParticipants,{id:t.payload.participantId,displayName:t.payload.displayName}]});case"WAITING_PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{waitingParticipants:e.waitingParticipants.filter((e=>e.id!==t.payload.participantId))});default:throw e}var i,s}function r_(e,t){const[i]=ni.useState((()=>{var i;return new i_(e,Object.assign(Object.assign({},t),{localMedia:(null===(i=null==t?void 0:t.localMedia)||void 0===i?void 0:i._ref)||void 0}))})),[s,n]=ni.useReducer(a_,s_);function a(e,t,i){return{eventName:e,listener:t,options:i}}const r=ui.useMemo((()=>[a("chat_message",(e=>{n({type:"CHAT_MESSAGE",payload:e.detail})})),a("cloud_recording_started",(e=>{const{status:t,startedAt:i}=e.detail;n({type:"CLOUD_RECORDING_STARTED",payload:{status:t,startedAt:i}})})),a("cloud_recording_stopped",(()=>{n({type:"CLOUD_RECORDING_STOPPED"})})),a("participant_audio_enabled",(e=>{const{participantId:t,isAudioEnabled:i}=e.detail;n({type:"PARTICIPANT_AUDIO_ENABLED",payload:{participantId:t,isAudioEnabled:i}})})),a("participant_joined",(e=>{const{remoteParticipant:t}=e.detail;n({type:"PARTICIPANT_JOINED",payload:{paritipant:t}})})),a("participant_left",(e=>{const{participantId:t}=e.detail;n({type:"PARTICIPANT_LEFT",payload:{participantId:t}})})),a("participant_metadata_changed",(e=>{const{participantId:t,displayName:i}=e.detail;n({type:"PARTICIPANT_METADATA_CHANGED",payload:{participantId:t,displayName:i}})})),a("participant_stream_added",(e=>{const{participantId:t,stream:i}=e.detail;n({type:"PARTICIPANT_STREAM_ADDED",payload:{participantId:t,stream:i}})})),a("participant_video_enabled",(e=>{const{participantId:t,isVideoEnabled:i}=e.detail;n({type:"PARTICIPANT_VIDEO_ENABLED",payload:{participantId:t,isVideoEnabled:i}})})),a("room_connection_status_changed",(e=>{const{roomConnectionStatus:t}=e.detail;n({type:"ROOM_CONNECTION_STATUS_CHANGED",payload:{roomConnectionStatus:t}})})),a("room_joined",(e=>{const{localParticipant:t,remoteParticipants:i,waitingParticipants:s}=e.detail;n({type:"ROOM_JOINED",payload:{localParticipant:t,remoteParticipants:i,waitingParticipants:s}})})),a("screenshare_started",(e=>{const{participantId:t,stream:i,id:s,hasAudioTrack:a,isLocal:r}=e.detail;n({type:"SCREENSHARE_STARTED",payload:{participantId:t,stream:i,id:s,hasAudioTrack:a,isLocal:r}})})),a("screenshare_stopped",(e=>{const{participantId:t,id:i}=e.detail;n({type:"SCREENSHARE_STOPPED",payload:{participantId:t,id:i}})})),a("streaming_started",(e=>{const{status:t,startedAt:i}=e.detail;n({type:"STREAMING_STARTED",payload:{status:t,startedAt:i}})})),a("streaming_stopped",(()=>{n({type:"STREAMING_STOPPED"})})),a("waiting_participant_joined",(e=>{const{participantId:t,displayName:i}=e.detail;n({type:"WAITING_PARTICIPANT_JOINED",payload:{participantId:t,displayName:i}})}))]),[]);return ni.useEffect((()=>(r.forEach((({eventName:e,listener:t})=>{i.addEventListener(e,t)})),i.join(),()=>{r.forEach((({eventName:e,listener:t})=>{i.removeEventListener(e,t)})),i.leave()})),[]),{state:s,actions:{knock:()=>{i.knock()},sendChatMessage:e=>{i.sendChatMessage(e)},setDisplayName:e=>{i.setDisplayName(e),n({type:"LOCAL_CLIENT_DISPLAY_NAME_CHANGED",payload:{displayName:e}})},toggleCamera:e=>{i.localMedia.toggleCameraEnabled(e)},toggleMicrophone:e=>{i.localMedia.toggleMichrophoneEnabled(e)},acceptWaitingParticipant:e=>{i.acceptWaitingParticipant(e)},rejectWaitingParticipant:e=>{i.rejectWaitingParticipant(e)},startScreenshare:()=>{n({type:"LOCAL_SCREENSHARE_STARTING"});try{i.startScreenshare()}catch(e){n({type:"LOCAL_SCREENSHARE_START_ERROR",payload:e})}},stopScreenshare:()=>{i.stopScreenshare()}},components:{VideoView:e=>ui.createElement(mi,Object.assign({},e,{onResize:({stream:e,width:t,height:s})=>{i.updateStreamResolution({streamId:e.id,width:t,height:s})}}))},_ref:i}}const o_="2.0.0-alpha22";export{mi as VideoView,o_ as sdkVersion,bi as useLocalMedia,r_ as useRoomConnection};